case-editor-tools 1.2.2 → 1.3.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.
Files changed (31) hide show
  1. package/exporter/index.d.ts +1 -1
  2. package/exporter/index.js +1 -4
  3. package/exporter/index.js.map +1 -1
  4. package/expression-utils/expressionGen.d.ts +1 -1
  5. package/expression-utils/studyEngineExpressions.d.ts +23 -23
  6. package/{item-editor-59f51ecc.js → item-editor-b2c1632b.js} +4 -11
  7. package/{item-editor-59f51ecc.js.map → item-editor-b2c1632b.js.map} +1 -1
  8. package/package.json +2 -2
  9. package/surveys/index.js +1 -1
  10. package/surveys/responseTypeGenerators/likertGroupComponents.d.ts +5 -5
  11. package/surveys/responseTypeGenerators/matrixGroupComponent.d.ts +1 -1
  12. package/surveys/responseTypeGenerators/optionGroupComponents.d.ts +4 -4
  13. package/surveys/survey-editor/item-editor.d.ts +6 -4
  14. package/surveys/survey-editor/item-editor.js +1 -1
  15. package/surveys/survey-editor/survey-editor.d.ts +6 -0
  16. package/surveys/survey-editor/survey-editor.js +15 -15
  17. package/surveys/survey-engine-expressions.d.ts +4 -4
  18. package/surveys/survey-items.d.ts +4 -1
  19. package/surveys/survey-items.js +4 -4
  20. package/surveys/types/group.js +1 -1
  21. package/surveys/types/index.js +1 -1
  22. package/surveys/types/item-properties.d.ts +3 -0
  23. package/surveys/types/item.js +0 -1
  24. package/surveys/types/item.js.map +1 -1
  25. package/surveys/types/survey-definition.js +2 -2
  26. package/surveys/utils/optionDefGenerators.d.ts +2 -2
  27. package/surveys/utils/simple-generators.d.ts +2 -2
  28. package/surveys/utils/simple-generators.js +0 -1
  29. package/surveys/utils/simple-generators.js.map +1 -1
  30. package/surveys/utils/simple-question-editor.d.ts +3 -1
  31. package/surveys/utils/simple-question-editor.js +3 -3
@@ -1,2 +1,2 @@
1
1
  import { Study } from "../types/study";
2
- export declare const generateFilesForStudy: (study: Study, pretty?: boolean | undefined) => void;
2
+ export declare const generateFilesForStudy: (study: Study, pretty?: boolean) => void;
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
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
1
  import { Expression, ExpressionName } from "survey-engine/data_types";
2
- export declare const generateExpression: (name: ExpressionName, returnType?: "string" | "float" | undefined, ...args: any[]) => Expression;
2
+ export declare const generateExpression: (name: ExpressionName, returnType?: 'string' | 'float', ...args: any[]) => Expression;
@@ -11,7 +11,7 @@ export declare const NativeStudyEngineExpressions: {
11
11
  hasResponseKey: (itemKey: string, responseKey: string) => Expression;
12
12
  hasResponseKeyWithValue: (itemKey: string, responseKey: string, value: string) => Expression;
13
13
  countResponseItems: (itemKey: string, responseKey: string) => Expression;
14
- checkConditionForOldResponses: (condition: Expression, checkType?: number | "all" | "any" | undefined, surveyKey?: string | undefined, querySince?: number | Expression | undefined, queryUntil?: number | Expression | undefined) => Expression;
14
+ checkConditionForOldResponses: (condition: Expression, checkType?: number | 'all' | 'any', surveyKey?: string, querySince?: number | Expression, queryUntil?: number | Expression) => Expression;
15
15
  participantState: {
16
16
  getStudyEntryTime: () => Expression;
17
17
  hasSurveyKeyAssigned: (surveyKey: string) => Expression;
@@ -21,7 +21,7 @@ export declare const NativeStudyEngineExpressions: {
21
21
  hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
22
22
  hasParticipantFlagKey: (key: string) => Expression;
23
23
  getParticipantFlagValue: (key: string) => Expression;
24
- lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string | undefined) => Expression;
24
+ lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string) => Expression;
25
25
  hasMessageTypeAssigned: (messageType: string) => Expression;
26
26
  getMessageNextTime: (messageType: string) => Expression;
27
27
  incomingParticipantState: {
@@ -33,7 +33,7 @@ export declare const NativeStudyEngineExpressions: {
33
33
  hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
34
34
  hasParticipantFlagKey: (key: string) => Expression;
35
35
  getParticipantFlagValue: (key: string) => Expression;
36
- lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string | undefined) => Expression;
36
+ lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string) => Expression;
37
37
  hasMessageTypeAssigned: (messageType: string) => Expression;
38
38
  getMessageNextTime: (messageType: string) => Expression;
39
39
  };
@@ -46,11 +46,11 @@ export declare const NativeStudyEngineExpressions: {
46
46
  or: (...args: Expression[]) => Expression;
47
47
  and: (...args: Expression[]) => Expression;
48
48
  not: (arg: Expression) => Expression;
49
- timestampWithOffset: (delta: Duration, reference?: number | Expression | undefined) => Expression;
50
- externalEventEval: (serviceName: string, expectFloat?: boolean | undefined) => Expression;
49
+ timestampWithOffset: (delta: Duration, reference?: number | Expression) => Expression;
50
+ externalEventEval: (serviceName: string, expectFloat?: boolean) => Expression;
51
51
  };
52
52
  export declare const StudyEngineActions: {
53
- if: (condition: Expression, actionIfTrue: Expression, actionIfFalse?: Expression | undefined) => Expression;
53
+ if: (condition: Expression, actionIfTrue: Expression, actionIfFalse?: Expression) => Expression;
54
54
  do: (...args: Expression[]) => Expression;
55
55
  ifThen: (condition: Expression, ...args: Expression[]) => Expression;
56
56
  participantActions: {
@@ -59,18 +59,18 @@ export declare const StudyEngineActions: {
59
59
  updateFlag: (key: string, newValue: string | number | Expression) => Expression;
60
60
  removeFlag: (key: string) => Expression;
61
61
  assignedSurveys: {
62
- add: (surveyKey: string, category: 'immediate' | 'prio' | 'normal' | 'optional', activeFrom?: number | Expression | undefined, activeUntil?: number | Expression | undefined) => Expression;
62
+ add: (surveyKey: string, category: 'immediate' | 'prio' | 'normal' | 'optional', activeFrom?: number | Expression, activeUntil?: number | Expression) => Expression;
63
63
  removeAll: () => Expression;
64
64
  remove: (surveyKey: string, selector: 'first' | 'last' | 'all') => Expression;
65
65
  };
66
66
  reports: {
67
67
  init: (reportKey: string) => Expression;
68
68
  cancel: (reportKey: string) => Expression;
69
- updateData: (reportKey: string, attributeKey: string, value: number | string | Expression, dtype?: "string" | "date" | "float" | "int" | "rawMessage" | "keyList" | undefined) => Expression;
69
+ updateData: (reportKey: string, attributeKey: string, value: number | string | Expression, dtype?: 'date' | 'float' | 'int' | 'string' | 'rawMessage' | 'keyList') => Expression;
70
70
  removeData: (reportKey: string, attributeKey: string) => Expression;
71
71
  setReportIcon: (reportKey: string, icon: string) => Expression;
72
- setReportMessage: (reportKey: string, content: string, asTranslationKey?: boolean | undefined) => Expression;
73
- setReportSummary: (reportKey: string, content: string, asTranslationKey?: boolean | undefined) => Expression;
72
+ setReportMessage: (reportKey: string, content: string, asTranslationKey?: boolean) => Expression;
73
+ setReportSummary: (reportKey: string, content: string, asTranslationKey?: boolean) => Expression;
74
74
  };
75
75
  messages: {
76
76
  add: (messageType: string, scheduledFor: number | Expression) => Expression;
@@ -102,12 +102,12 @@ export declare const StudyEngine: {
102
102
  };
103
103
  survey: {
104
104
  isActive: (surveyKey: string) => Expression;
105
- validFromOlderThan: (surveyKey: string, delta: Duration, reference?: number | Expression | undefined) => Expression;
106
- validUntilSoonerThan: (surveyKey: string, delta: Duration, reference?: number | Expression | undefined) => Expression;
105
+ validFromOlderThan: (surveyKey: string, delta: Duration, reference?: number | Expression) => Expression;
106
+ validUntilSoonerThan: (surveyKey: string, delta: Duration, reference?: number | Expression) => Expression;
107
107
  };
108
108
  prefillRules: {
109
109
  PREFILL_SLOT_WITH_VALUE: (itemKey: string, slotKey: string, value: string | number) => Expression;
110
- GET_LAST_SURVEY_ITEM: (surveyKey: string, itemKey: string, submittedLaterThan?: Duration | undefined) => Expression;
110
+ GET_LAST_SURVEY_ITEM: (surveyKey: string, itemKey: string, submittedLaterThan?: Duration) => Expression;
111
111
  };
112
112
  contextRules: {
113
113
  previousResponses: {
@@ -116,7 +116,7 @@ export declare const StudyEngine: {
116
116
  RESPONSES_SINCE_BY_KEY: (sinceTimestamp: number, surveyKey: string) => Expression;
117
117
  };
118
118
  };
119
- if: (condition: Expression, actionIfTrue: Expression, actionIfFalse?: Expression | undefined) => Expression;
119
+ if: (condition: Expression, actionIfTrue: Expression, actionIfFalse?: Expression) => Expression;
120
120
  do: (...args: Expression[]) => Expression;
121
121
  ifThen: (condition: Expression, ...args: Expression[]) => Expression;
122
122
  participantActions: {
@@ -125,18 +125,18 @@ export declare const StudyEngine: {
125
125
  updateFlag: (key: string, newValue: string | number | Expression) => Expression;
126
126
  removeFlag: (key: string) => Expression;
127
127
  assignedSurveys: {
128
- add: (surveyKey: string, category: 'immediate' | 'prio' | 'normal' | 'optional', activeFrom?: number | Expression | undefined, activeUntil?: number | Expression | undefined) => Expression;
128
+ add: (surveyKey: string, category: 'immediate' | 'prio' | 'normal' | 'optional', activeFrom?: number | Expression, activeUntil?: number | Expression) => Expression;
129
129
  removeAll: () => Expression;
130
130
  remove: (surveyKey: string, selector: 'first' | 'last' | 'all') => Expression;
131
131
  };
132
132
  reports: {
133
133
  init: (reportKey: string) => Expression;
134
134
  cancel: (reportKey: string) => Expression;
135
- updateData: (reportKey: string, attributeKey: string, value: number | string | Expression, dtype?: "string" | "date" | "float" | "int" | "rawMessage" | "keyList" | undefined) => Expression;
135
+ updateData: (reportKey: string, attributeKey: string, value: number | string | Expression, dtype?: 'date' | 'float' | 'int' | 'string' | 'rawMessage' | 'keyList') => Expression;
136
136
  removeData: (reportKey: string, attributeKey: string) => Expression;
137
137
  setReportIcon: (reportKey: string, icon: string) => Expression;
138
- setReportMessage: (reportKey: string, content: string, asTranslationKey?: boolean | undefined) => Expression;
139
- setReportSummary: (reportKey: string, content: string, asTranslationKey?: boolean | undefined) => Expression;
138
+ setReportMessage: (reportKey: string, content: string, asTranslationKey?: boolean) => Expression;
139
+ setReportSummary: (reportKey: string, content: string, asTranslationKey?: boolean) => Expression;
140
140
  };
141
141
  messages: {
142
142
  add: (messageType: string, scheduledFor: number | Expression) => Expression;
@@ -162,7 +162,7 @@ export declare const StudyEngine: {
162
162
  hasResponseKey: (itemKey: string, responseKey: string) => Expression;
163
163
  hasResponseKeyWithValue: (itemKey: string, responseKey: string, value: string) => Expression;
164
164
  countResponseItems: (itemKey: string, responseKey: string) => Expression;
165
- checkConditionForOldResponses: (condition: Expression, checkType?: number | "all" | "any" | undefined, surveyKey?: string | undefined, querySince?: number | Expression | undefined, queryUntil?: number | Expression | undefined) => Expression;
165
+ checkConditionForOldResponses: (condition: Expression, checkType?: number | 'all' | 'any', surveyKey?: string, querySince?: number | Expression, queryUntil?: number | Expression) => Expression;
166
166
  participantState: {
167
167
  getStudyEntryTime: () => Expression;
168
168
  hasSurveyKeyAssigned: (surveyKey: string) => Expression;
@@ -172,7 +172,7 @@ export declare const StudyEngine: {
172
172
  hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
173
173
  hasParticipantFlagKey: (key: string) => Expression;
174
174
  getParticipantFlagValue: (key: string) => Expression;
175
- lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string | undefined) => Expression;
175
+ lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string) => Expression;
176
176
  hasMessageTypeAssigned: (messageType: string) => Expression;
177
177
  getMessageNextTime: (messageType: string) => Expression;
178
178
  incomingParticipantState: {
@@ -184,7 +184,7 @@ export declare const StudyEngine: {
184
184
  hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
185
185
  hasParticipantFlagKey: (key: string) => Expression;
186
186
  getParticipantFlagValue: (key: string) => Expression;
187
- lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string | undefined) => Expression;
187
+ lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string) => Expression;
188
188
  hasMessageTypeAssigned: (messageType: string) => Expression;
189
189
  getMessageNextTime: (messageType: string) => Expression;
190
190
  };
@@ -197,6 +197,6 @@ export declare const StudyEngine: {
197
197
  or: (...args: Expression[]) => Expression;
198
198
  and: (...args: Expression[]) => Expression;
199
199
  not: (arg: Expression) => Expression;
200
- timestampWithOffset: (delta: Duration, reference?: number | Expression | undefined) => Expression;
201
- externalEventEval: (serviceName: string, expectFloat?: boolean | undefined) => Expression;
200
+ timestampWithOffset: (delta: Duration, reference?: number | Expression) => Expression;
201
+ externalEventEval: (serviceName: string, expectFloat?: boolean) => Expression;
202
202
  };
@@ -86,7 +86,7 @@ const initialRootComp = () => {
86
86
  };
87
87
  class ItemEditor {
88
88
  constructor(existingItem, newItem) {
89
- this.surveyItem = { key: '', version: 0 };
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
- setVersion(version) {
167
- this.surveyItem.version = version;
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-59f51ecc.js.map
535
+ //# sourceMappingURL=item-editor-b2c1632b.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"item-editor-59f51ecc.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":";;;;;;;;;;AAEA,MAAM,CAAC,cAAc,CAAC,UAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D;AACA,MAAM,YAAY,GAAG,CAAC,KAAK,KAAK;AAChC,IAAI,OAAO,QAAQ,KAAK,CAAC,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;AAC5F,CAAC,CAAC;AACF,MAAM,mBAAmB,GAAG,CAAC,GAAG,KAAK;AACrC,IAAI,QAAQ,GAAG,CAAC,KAAK;AACrB,QAAQ,KAAK,KAAK;AAClB,YAAY,OAAO,GAAG,CAAC,GAAG,CAAC;AAC3B,Q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ACPpC,MAAM,CAAC,cAAc,CAAC,UAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D;AACA,IAAI,qBAAqB,GAAGC,UAA0B,CAAC;AACvD,IAAI,qBAAqB,GAAGC,UAA2B,CAAC;AACxD,IAAI,8BAA8B,GAAGC,mBAAqC,CAAC;AAC3E,IAAI,mBAAmB,GAAGC,QAAwB,CAAC;AACnD;AACA;AACA;8BAC2B,GAAG,qBAAqB,CAAC,oBAAoB;uBACpD,GAAG,qBAAqB,CAAC,aAAa;oDACjC,GAAG,qBAAqB,CAAC,kBAAkB;AACpE,0DAA4B,GAAG,8BAA8B,CAAC,oBAAoB,CAAC;oCAClD,GAAG,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
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$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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.2.2",
4
+ "version": "1.3.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.1.7"
23
+ "survey-engine": "^1.2.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-59f51ecc.js');
9
+ require('../item-editor-b2c1632b.js');
10
10
  require('./utils/randomKeyGenerator.js');
11
11
  require('../logger/logger.js');
12
12
  require('./utils/componentGenerators.js');
@@ -16,13 +16,13 @@ export declare const initLikertScaleGroup: (key: string, rows: Array<LikertGroup
16
16
  key: string;
17
17
  className?: string | undefined;
18
18
  content: Map<string, string>;
19
- }[], stackOnSmallScreen?: boolean | undefined, displayCondition?: Expression | undefined) => ItemGroupComponent;
20
- export declare const initResponsiveSingleChoiceArray: (rgKey: string, props: ResponsiveSingleChoiceArrayProps, displayCondition?: Expression | undefined) => ItemGroupComponent;
21
- export declare const initResponsiveBipolarLikertArray: (rgKey: string, props: ResponsiveBipolarLikertArrayProps, displayCondition?: Expression | undefined) => ItemGroupComponent;
22
- export declare const initResponsiveMatrixItem: (rgKey: string, props: ResponsiveMatrixProps, displayCondition?: Expression | undefined) => ItemGroupComponent;
19
+ }[], stackOnSmallScreen?: boolean, displayCondition?: Expression) => ItemGroupComponent;
20
+ export declare const initResponsiveSingleChoiceArray: (rgKey: string, props: ResponsiveSingleChoiceArrayProps, displayCondition?: Expression) => ItemGroupComponent;
21
+ export declare const initResponsiveBipolarLikertArray: (rgKey: string, props: ResponsiveBipolarLikertArrayProps, displayCondition?: Expression) => ItemGroupComponent;
22
+ export declare const initResponsiveMatrixItem: (rgKey: string, props: ResponsiveMatrixProps, displayCondition?: Expression) => ItemGroupComponent;
23
23
  export declare const initLikertScaleItem: (key: string, options: {
24
24
  key: string;
25
25
  className?: string | undefined;
26
26
  content?: Map<string, string> | undefined;
27
27
  disabled?: Expression | undefined;
28
- }[], stackOnSmallScreen?: boolean | undefined, displayCondition?: Expression | undefined) => ItemGroupComponent;
28
+ }[], stackOnSmallScreen?: boolean, displayCondition?: Expression) => ItemGroupComponent;
@@ -45,5 +45,5 @@ interface ResponseRow {
45
45
  cells: Array<ResponseRowCell>;
46
46
  }
47
47
  declare type MatrixRow = HeaderRow | RadioRow | ResponseRow;
48
- export declare const initMatrixQuestion: (key: string, rows: Array<MatrixRow>, order?: Expression | undefined) => ItemGroupComponent;
48
+ export declare const initMatrixQuestion: (key: string, rows: Array<MatrixRow>, order?: Expression) => ItemGroupComponent;
49
49
  export {};
@@ -1,7 +1,7 @@
1
1
  import { Expression, ItemComponent, ItemGroupComponent } from "survey-engine/data_types";
2
2
  import { OptionDef } from "../types";
3
3
  export declare const optionDefToItemComponent: (optionDef: OptionDef) => ItemComponent;
4
- export declare const initSingleChoiceGroup: (key: string, optionItems: OptionDef[], order?: Expression | undefined) => ItemGroupComponent;
5
- export declare const initMultipleChoiceGroup: (key: string, optionItems: OptionDef[], order?: Expression | undefined) => ItemGroupComponent;
6
- export declare const initDropdownGroup: (key: string, optionItems: OptionDef[], order?: Expression | undefined, groupDisabled?: Expression | undefined, groupContent?: Map<string, string> | undefined, groupDescription?: Map<string, string> | undefined) => ItemGroupComponent;
7
- export declare const initSliderCategoricalGroup: (key: string, optionItems: OptionDef[], order?: Expression | undefined, groupDisabled?: Expression | undefined) => ItemGroupComponent;
4
+ export declare const initSingleChoiceGroup: (key: string, optionItems: OptionDef[], order?: Expression) => ItemGroupComponent;
5
+ export declare const initMultipleChoiceGroup: (key: string, optionItems: OptionDef[], order?: Expression) => ItemGroupComponent;
6
+ export declare const initDropdownGroup: (key: string, optionItems: OptionDef[], order?: Expression, groupDisabled?: Expression, groupContent?: Map<string, string>, groupDescription?: Map<string, string>) => ItemGroupComponent;
7
+ export declare const initSliderCategoricalGroup: (key: string, optionItems: OptionDef[], order?: Expression, groupDisabled?: Expression) => ItemGroupComponent;
@@ -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
- setVersion: (version: number) => void;
13
- setVersionTags: (tags: string[]) => void;
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
- setVersion(version: number): void;
46
- setVersionTags(tags: string[]): void;
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-59f51ecc.js');
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-59f51ecc.js');
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.current.surveyDefinition.key;
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
- current: {
21
- versionId: '',
22
- surveyDefinition: {
23
- key: this.surveyKey,
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.current.surveyDefinition.items.find(it => newItem.itemKey === it.key)) {
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.current.surveyDefinition.items.splice(atPosition, 0, item);
78
+ this.survey.surveyDefinition.items.splice(atPosition, 0, item);
79
79
  }
80
80
  else {
81
- this.survey.current.surveyDefinition.items.push(item);
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.current.surveyDefinition = this.changeItemKeyForSubtree(this.survey.current.surveyDefinition, newKey);
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.current.surveyDefinition = Object.assign(Object.assign({}, this.survey.current.surveyDefinition), item);
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.current.surveyDefinition;
182
+ obj = this.survey.surveyDefinition;
183
183
  continue;
184
184
  }
185
185
  if (!surveys_surveyEditor_itemEditor.isSurveyGroupItem(obj)) {
@@ -30,7 +30,7 @@ export declare const NativeSurveyEngineExpressions: {
30
30
  responseHasKeysAll: (itemKey: string, responseKey: string, ...optionKeys: string[]) => Expression;
31
31
  responseHasOnlyKeysOtherThan: (itemKey: string, responseKey: string, ...optionKeys: string[]) => Expression;
32
32
  getSurveyItemValidation: (itemKey: string, validationKey: string) => Expression;
33
- dateResponseDiffFromNow: (itemKey: string, responseKey: string, unit: 'years' | 'months' | 'days' | 'hours' | 'minutes' | 'seconds', ignoreSign?: boolean | undefined) => Expression;
33
+ dateResponseDiffFromNow: (itemKey: string, responseKey: string, unit: 'years' | 'months' | 'days' | 'hours' | 'minutes' | 'seconds', ignoreSign?: boolean) => Expression;
34
34
  countResponseItems: (itemKey: string, responseKey: string) => Expression;
35
35
  compare: {
36
36
  eq: (val1: Expression | string | number, val2: Expression | string | number) => Expression;
@@ -45,7 +45,7 @@ export declare const NativeSurveyEngineExpressions: {
45
45
  not: (arg: Expression) => Expression;
46
46
  };
47
47
  getSecondsSince: (referenceTime: Expression) => Expression;
48
- timestampWithOffset: (delta: Duration, reference?: number | Expression | undefined) => Expression;
48
+ timestampWithOffset: (delta: Duration, reference?: number | Expression) => Expression;
49
49
  };
50
50
  export declare const SurveyEngine: {
51
51
  singleChoice: {
@@ -111,7 +111,7 @@ export declare const SurveyEngine: {
111
111
  responseHasKeysAll: (itemKey: string, responseKey: string, ...optionKeys: string[]) => Expression;
112
112
  responseHasOnlyKeysOtherThan: (itemKey: string, responseKey: string, ...optionKeys: string[]) => Expression;
113
113
  getSurveyItemValidation: (itemKey: string, validationKey: string) => Expression;
114
- dateResponseDiffFromNow: (itemKey: string, responseKey: string, unit: 'years' | 'months' | 'days' | 'hours' | 'minutes' | 'seconds', ignoreSign?: boolean | undefined) => Expression;
114
+ dateResponseDiffFromNow: (itemKey: string, responseKey: string, unit: 'years' | 'months' | 'days' | 'hours' | 'minutes' | 'seconds', ignoreSign?: boolean) => Expression;
115
115
  countResponseItems: (itemKey: string, responseKey: string) => Expression;
116
116
  compare: {
117
117
  eq: (val1: Expression | string | number, val2: Expression | string | number) => Expression;
@@ -126,5 +126,5 @@ export declare const SurveyEngine: {
126
126
  not: (arg: Expression) => Expression;
127
127
  };
128
128
  getSecondsSince: (referenceTime: Expression) => Expression;
129
- timestampWithOffset: (delta: Duration, reference?: number | Expression | undefined) => Expression;
129
+ timestampWithOffset: (delta: Duration, reference?: number | Expression) => Expression;
130
130
  };
@@ -36,6 +36,9 @@ interface DisplayProps {
36
36
  itemKey: string;
37
37
  content: Array<ItemComponent>;
38
38
  condition?: Expression;
39
+ metadata?: {
40
+ [key: string]: string;
41
+ };
39
42
  }
40
43
  interface EQ5DHealthSliderProps {
41
44
  role: 'eq5d-health-indicator';
@@ -64,7 +67,7 @@ export declare const SurveyItems: {
64
67
  dropDown: (props: DropDownQuestionProps) => SurveyItem;
65
68
  numericSlider: (props: NumericSliderProps) => SurveyItem;
66
69
  display: (props: DisplayProps) => SurveyItem;
67
- surveyEnd: (parentKey: string, content: Map<string, string>, condition?: Expression | undefined) => SurveyItem;
70
+ surveyEnd: (parentKey: string, content: Map<string, string>, condition?: Expression) => SurveyItem;
68
71
  customQuestion: (props: CustomQuestionProps) => SurveyItem;
69
72
  old: {
70
73
  simpleLikertGroup: (props: LikertGroupQuestionProps) => SurveyItem;
@@ -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-59f51ecc.js');
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.version ? props.version : 1, props.confidentialMode);
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) {
@@ -317,7 +317,7 @@ const generateCustomQuestion = (props) => {
317
317
  const rg_inner = Object.assign(Object.assign({}, item), { role: role });
318
318
  items.push(rg_inner);
319
319
  });
320
- const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, props.version ? props.version : 1, props.confidentialMode);
320
+ const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, props.confidentialMode, props.metadata);
321
321
  // QUESTION TEXT
322
322
  simpleEditor.setTitle(props.questionText, props.questionSubText, props.titleClassName);
323
323
  if (props.condition) {
@@ -349,7 +349,7 @@ const generateCustomQuestion = (props) => {
349
349
  return simpleEditor.getItem();
350
350
  };
351
351
  const generateDisplay = (props) => {
352
- const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, 1);
352
+ const simpleEditor = new surveys_utils_simpleQuestionEditor.SimpleQuestionEditor(props.parentKey, props.itemKey, undefined, props.metadata);
353
353
  props.content.forEach(item => simpleEditor.addDisplayComponent(item));
354
354
  if (props.condition) {
355
355
  simpleEditor.setCondition(props.condition);
@@ -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-59f51ecc.js');
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');
@@ -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-59f51ecc.js');
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');
@@ -46,6 +46,9 @@ export interface GenericQuestionProps {
46
46
  footnoteText?: Map<string, string>;
47
47
  customValidations?: Array<Validation>;
48
48
  confidentialMode?: ConfidentialMode;
49
+ metadata?: {
50
+ [key: string]: string;
51
+ };
49
52
  }
50
53
  /**
51
54
  * Numeric Input
@@ -8,7 +8,6 @@ class Item {
8
8
  this.itemKey = itemKey;
9
9
  this.key = [this.parentKey, itemKey].join('.');
10
10
  this.item = {
11
- version: 0,
12
11
  key: "not defined"
13
12
  };
14
13
  }
@@ -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-59f51ecc.js');
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().current.surveyDefinition;
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;
@@ -14,7 +14,7 @@ interface OptionTextProps extends CommonProps {
14
14
  className?: string;
15
15
  }
16
16
  export declare const SingleChoiceOptionTypes: {
17
- option: (key: string, content: Map<string, string> | StyledTextComponentProp[], extraProps?: OptionProps | undefined) => OptionDef;
17
+ option: (key: string, content: Map<string, string> | StyledTextComponentProp[], extraProps?: OptionProps) => OptionDef;
18
18
  textInput: (props: TextInputProps & {
19
19
  key: string;
20
20
  displayCondition?: Expression;
@@ -36,7 +36,7 @@ export declare const SingleChoiceOptionTypes: {
36
36
  }) => OptionDef;
37
37
  };
38
38
  export declare const MultipleChoiceOptionTypes: {
39
- option: (key: string, content: Map<string, string> | StyledTextComponentProp[], extraProps?: OptionProps | undefined) => OptionDef;
39
+ option: (key: string, content: Map<string, string> | StyledTextComponentProp[], extraProps?: OptionProps) => OptionDef;
40
40
  subtitle: (props: OptionTextProps) => OptionDef;
41
41
  textInput: (props: TextInputProps & {
42
42
  key: string;
@@ -2,7 +2,7 @@ import { LocalizedString, ItemComponent, ExpressionName, Expression, ItemGroupCo
2
2
  import { DateDisplayComponentProp, StyledTextComponentProp } from "../types/item-properties";
3
3
  export declare const generateLocStrings: (translations: Map<string, string>) => LocalizedString[];
4
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
+ export declare const generateTitleComponent: (content: Map<string, string> | Array<StyledTextComponentProp | DateDisplayComponentProp>, description?: Map<string, string>, className?: string) => ItemComponent;
6
6
  export declare const generateHelpGroupComponent: (items: Array<{
7
7
  content: Map<string, string>;
8
8
  style?: Array<{
@@ -11,4 +11,4 @@ export declare const generateHelpGroupComponent: (items: Array<{
11
11
  }>;
12
12
  }>) => ItemGroupComponent;
13
13
  export declare const expWithArgs: (name: ExpressionName, ...args: any[]) => Expression;
14
- export declare const generatePageBreak: (parentKey: string, key?: string | undefined) => SurveySingleItem;
14
+ export declare const generatePageBreak: (parentKey: string, key?: string) => SurveySingleItem;
@@ -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, version: number, confidentialMode?: ConfidentialMode);
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-59f51ecc.js');
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, version, confidentialMode) {
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.setVersion(version);
18
+ this.editor.setMetadata(metadata);
19
19
  this.editor.setConfidentialMode(confidentialMode);
20
20
  }
21
21
  getItem() {