case-editor-tools 1.0.0-beta.9 → 1.0.2

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 (75) hide show
  1. package/constants/key-definitions.d.ts +3 -0
  2. package/constants/key-definitions.js +7 -1
  3. package/constants/key-definitions.js.map +1 -1
  4. package/exporter/index.d.ts +2 -0
  5. package/exporter/index.js +128 -0
  6. package/exporter/index.js.map +1 -0
  7. package/expression-utils/expressionGen.d.ts +1 -1
  8. package/expression-utils/studyEngineExpressions.d.ts +94 -13
  9. package/expression-utils/studyEngineExpressions.js +215 -19
  10. package/expression-utils/studyEngineExpressions.js.map +1 -1
  11. package/{item-editor-cb5ebc1a.js → item-editor-59f51ecc.js} +67 -46
  12. package/item-editor-59f51ecc.js.map +1 -0
  13. package/logger/index.d.ts +1 -0
  14. package/logger/index.js +10 -0
  15. package/logger/index.js.map +1 -0
  16. package/package.json +5 -5
  17. package/surveys/index.d.ts +1 -0
  18. package/surveys/index.js +9 -1
  19. package/surveys/index.js.map +1 -1
  20. package/surveys/responseTypeGenerators/likertGroupComponents.d.ts +27 -0
  21. package/surveys/responseTypeGenerators/likertGroupComponents.js +350 -0
  22. package/surveys/responseTypeGenerators/likertGroupComponents.js.map +1 -0
  23. package/surveys/responseTypeGenerators/matrixGroupComponent.d.ts +49 -0
  24. package/surveys/responseTypeGenerators/matrixGroupComponent.js +100 -0
  25. package/surveys/responseTypeGenerators/matrixGroupComponent.js.map +1 -0
  26. package/surveys/responseTypeGenerators/optionGroupComponents.d.ts +7 -0
  27. package/surveys/responseTypeGenerators/optionGroupComponents.js +129 -0
  28. package/surveys/responseTypeGenerators/optionGroupComponents.js.map +1 -0
  29. package/surveys/survey-editor/component-editor.d.ts +1 -1
  30. package/surveys/survey-editor/data-types.d.ts +1 -1
  31. package/surveys/survey-editor/item-editor.d.ts +2 -1
  32. package/surveys/survey-editor/item-editor.js +2 -1
  33. package/surveys/survey-editor/item-editor.js.map +1 -1
  34. package/surveys/survey-editor/survey-editor.d.ts +6 -1
  35. package/surveys/survey-editor/survey-editor.js +13 -6
  36. package/surveys/survey-editor/survey-editor.js.map +1 -1
  37. package/surveys/survey-engine-expressions.d.ts +12 -2
  38. package/surveys/survey-engine-expressions.js +43 -2
  39. package/surveys/survey-engine-expressions.js.map +1 -1
  40. package/surveys/survey-items.d.ts +33 -227
  41. package/surveys/survey-items.js +215 -780
  42. package/surveys/survey-items.js.map +1 -1
  43. package/surveys/types/group.d.ts +1 -1
  44. package/surveys/types/group.js +2 -1
  45. package/surveys/types/group.js.map +1 -1
  46. package/surveys/types/index.js +3 -1
  47. package/surveys/types/index.js.map +1 -1
  48. package/surveys/types/item-properties.d.ts +206 -2
  49. package/surveys/types/item-properties.js +7 -0
  50. package/surveys/types/item-properties.js.map +1 -1
  51. package/surveys/types/item.d.ts +1 -1
  52. package/surveys/types/survey-definition.d.ts +7 -3
  53. package/surveys/types/survey-definition.js +11 -2
  54. package/surveys/types/survey-definition.js.map +1 -1
  55. package/surveys/utils/componentGenerators.d.ts +2 -13
  56. package/surveys/utils/componentGenerators.js +1 -34
  57. package/surveys/utils/componentGenerators.js.map +1 -1
  58. package/surveys/utils/optionDefGenerators.d.ts +84 -0
  59. package/surveys/utils/optionDefGenerators.js +211 -0
  60. package/surveys/utils/optionDefGenerators.js.map +1 -0
  61. package/surveys/utils/simple-generators.d.ts +4 -3
  62. package/surveys/utils/simple-generators.js +29 -0
  63. package/surveys/utils/simple-generators.js.map +1 -1
  64. package/surveys/utils/simple-question-editor.d.ts +5 -5
  65. package/surveys/utils/simple-question-editor.js +5 -2
  66. package/surveys/utils/simple-question-editor.js.map +1 -1
  67. package/types/expression.d.ts +1 -1
  68. package/types/messageConfig.d.ts +49 -0
  69. package/types/messageConfig.js +23 -0
  70. package/types/messageConfig.js.map +1 -0
  71. package/types/study.d.ts +3 -1
  72. package/types/studyRules.d.ts +3 -2
  73. package/types/studyRules.js +5 -1
  74. package/types/studyRules.js.map +1 -1
  75. package/item-editor-cb5ebc1a.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"survey-items.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"survey-items.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { Expression, SurveyItem } from "survey-engine/lib/data_types";
1
+ import { Expression, SurveyItem } from "survey-engine/data_types";
2
2
  import { ItemEditor } from "../survey-editor/item-editor";
3
3
  export declare abstract class Group {
4
4
  groupEditor: ItemEditor;
@@ -3,10 +3,11 @@
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-cb5ebc1a.js');
6
+ var surveys_surveyEditor_itemEditor = require('../../item-editor-59f51ecc.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');
10
+ require('./item-properties.js');
10
11
 
11
12
  class Group {
12
13
  constructor(parentKey, groupKey, selectionMethod) {
@@ -1 +1 @@
1
- {"version":3,"file":"group.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"group.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -4,9 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var surveys_types_group = require('./group.js');
6
6
  var surveys_types_item = require('./item.js');
7
+ var surveys_types_itemProperties = require('./item-properties.js');
7
8
  var surveys_types_surveyDefinition = require('./survey-definition.js');
8
9
  require('../../logger/logger.js');
9
- require('../../item-editor-cb5ebc1a.js');
10
+ require('../../item-editor-59f51ecc.js');
10
11
  require('../survey-editor/component-editor.js');
11
12
  require('../utils/randomKeyGenerator.js');
12
13
  require('../utils/simple-generators.js');
@@ -16,5 +17,6 @@ require('../survey-editor/survey-editor.js');
16
17
 
17
18
  exports.Group = surveys_types_group.Group;
18
19
  exports.Item = surveys_types_item.Item;
20
+ exports.isDateDisplayComponentProp = surveys_types_itemProperties.isDateDisplayComponentProp;
19
21
  exports.SurveyDefinition = surveys_types_surveyDefinition.SurveyDefinition;
20
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
@@ -1,13 +1,21 @@
1
- import { ComponentProperties, Expression } from "survey-engine/lib/data_types";
1
+ import { ComponentProperties, ConfidentialMode, Expression, ItemComponent, Validation } from "survey-engine/data_types";
2
+ import { Duration } from "../../types/duration";
2
3
  export interface StyledTextComponentProp {
3
4
  content: Map<string, string>;
4
5
  className?: string;
5
6
  }
7
+ export interface DateDisplayComponentProp {
8
+ languageCodes: string[];
9
+ date: Expression;
10
+ dateFormat: string;
11
+ className?: string;
12
+ }
13
+ export declare const isDateDisplayComponentProp: (value: DateDisplayComponentProp | any) => value is DateDisplayComponentProp;
6
14
  export interface OptionDef {
7
15
  key: string;
8
16
  role: string;
9
17
  content?: Map<string, string>;
10
- items?: Array<StyledTextComponentProp>;
18
+ items?: Array<StyledTextComponentProp> | Array<OptionDef>;
11
19
  description?: Map<string, string>;
12
20
  displayCondition?: Expression;
13
21
  disabled?: Expression;
@@ -17,3 +25,199 @@ export interface OptionDef {
17
25
  }>;
18
26
  optionProps?: ComponentProperties;
19
27
  }
28
+ export interface GenericQuestionProps {
29
+ parentKey: string;
30
+ itemKey: string;
31
+ version?: number;
32
+ questionText: Map<string, string> | Array<StyledTextComponentProp | DateDisplayComponentProp>;
33
+ questionSubText?: Map<string, string>;
34
+ titleClassName?: string;
35
+ helpGroupContent?: Array<{
36
+ content: Map<string, string>;
37
+ style?: Array<{
38
+ key: string;
39
+ value: string;
40
+ }>;
41
+ }>;
42
+ condition?: Expression;
43
+ topDisplayCompoments?: Array<ItemComponent>;
44
+ bottomDisplayCompoments?: Array<ItemComponent>;
45
+ isRequired?: boolean;
46
+ footnoteText?: Map<string, string>;
47
+ customValidations?: Array<Validation>;
48
+ confidentialMode?: ConfidentialMode;
49
+ }
50
+ /**
51
+ * Numeric Input
52
+ */
53
+ export interface NumericInputProps {
54
+ inputLabel: Map<string, string>;
55
+ labelBehindInput?: boolean;
56
+ componentProperties?: ComponentProperties;
57
+ inputMaxWidth?: string;
58
+ disabled?: Expression;
59
+ }
60
+ export declare type NumericInputQuestionProps = GenericQuestionProps & NumericInputProps;
61
+ /**
62
+ * Date Input
63
+ */
64
+ export interface DateInputProps {
65
+ dateInputMode: 'YMD' | 'YM' | 'Y';
66
+ inputLabelText?: Map<string, string>;
67
+ placeholderText?: Map<string, string>;
68
+ minRelativeDate?: {
69
+ reference?: number | Expression;
70
+ delta: Duration;
71
+ };
72
+ maxRelativeDate?: {
73
+ reference?: number | Expression;
74
+ delta: Duration;
75
+ };
76
+ }
77
+ export declare type DateInputQuestionProps = DateInputProps & GenericQuestionProps;
78
+ /**
79
+ * Time Input
80
+ */
81
+ export interface TimeInputProps {
82
+ inputLabelText?: Map<string, string>;
83
+ labelBehindInput?: boolean;
84
+ defaultValue?: string;
85
+ minTime?: string;
86
+ maxTime?: string;
87
+ step?: number;
88
+ }
89
+ export declare type TimeInputQuestionProps = TimeInputProps & GenericQuestionProps;
90
+ /**
91
+ * Text Input
92
+ */
93
+ export interface TextInputProps {
94
+ placeholderText?: Map<string, string>;
95
+ inputLabel?: Map<string, string>;
96
+ inputMaxWidth?: string;
97
+ className?: string;
98
+ maxLength?: number;
99
+ disabled?: Expression;
100
+ }
101
+ export declare type TextInputQuestionProps = TextInputProps & GenericQuestionProps;
102
+ export interface MultiLineTextInput extends GenericQuestionProps {
103
+ inputLabelText?: Map<string, string>;
104
+ placeholderText?: Map<string, string>;
105
+ maxLength?: number;
106
+ }
107
+ /**
108
+ * Cloze Question
109
+ */
110
+ export interface ClozeProps {
111
+ items: Array<OptionDef>;
112
+ }
113
+ export declare type ClozeQuestionProps = ClozeProps & GenericQuestionProps;
114
+ /**
115
+ * Consent Question
116
+ */
117
+ export interface ConsentProps {
118
+ checkBoxLabel: Map<string, string> | Array<StyledTextComponentProp | DateDisplayComponentProp>;
119
+ dialogTitle: Map<string, string>;
120
+ dialogContent: Map<string, string>;
121
+ acceptBtn: Map<string, string>;
122
+ rejectBtn: Map<string, string>;
123
+ className?: string;
124
+ }
125
+ export declare type ConsentQuestionProps = ConsentProps & GenericQuestionProps;
126
+ /**
127
+ * Response Single Choice Likert Array
128
+ */
129
+ export declare type ResponsiveSingleChoiceArrayVariant = 'horizontal' | 'vertical' | 'table';
130
+ export interface ResponsiveSingleChoiceArrayProps {
131
+ scaleOptions: Array<{
132
+ key: string;
133
+ className?: string;
134
+ content: Map<string, string> | StyledTextComponentProp[];
135
+ }>;
136
+ rows: Array<{
137
+ key: string;
138
+ displayCondition?: Expression;
139
+ content: Map<string, string> | StyledTextComponentProp[];
140
+ horizontalModeProps?: {
141
+ labelPlacement?: 'none' | 'top' | 'bottom';
142
+ className?: string;
143
+ };
144
+ verticalModeProps?: {
145
+ className?: string;
146
+ };
147
+ tableModeProps?: {
148
+ className?: string;
149
+ };
150
+ }>;
151
+ defaultMode: ResponsiveSingleChoiceArrayVariant;
152
+ responsiveModes?: {
153
+ sm?: ResponsiveSingleChoiceArrayVariant;
154
+ md?: ResponsiveSingleChoiceArrayVariant;
155
+ lg?: ResponsiveSingleChoiceArrayVariant;
156
+ xl?: ResponsiveSingleChoiceArrayVariant;
157
+ xxl?: ResponsiveSingleChoiceArrayVariant;
158
+ };
159
+ rgClassName?: string;
160
+ tableModeProps?: {
161
+ className?: string;
162
+ layout?: "fixed";
163
+ firstColWidth?: string;
164
+ optionHeaderClassName?: string;
165
+ hideRowBorder?: boolean;
166
+ };
167
+ horizontalModeProps?: {
168
+ hideRowBorder?: boolean;
169
+ };
170
+ verticalModeProps?: {
171
+ hideRowBorder?: boolean;
172
+ useReverseOptionOrder?: boolean;
173
+ };
174
+ }
175
+ export declare type ResponsiveSingleChoiceArrayQuestionProps = GenericQuestionProps & ResponsiveSingleChoiceArrayProps;
176
+ /**
177
+ * Response Bipolar Likert Array
178
+ */
179
+ export declare type ResponsiveBipolarLikertArrayVariant = 'withLabelRow' | 'vertical' | 'table';
180
+ export interface ResponsiveBipolarLikertArrayProps {
181
+ scaleOptions: Array<{
182
+ key: string;
183
+ }>;
184
+ rows: Array<{
185
+ key: string;
186
+ startLabel: Map<string, string> | StyledTextComponentProp[];
187
+ endLabel: Map<string, string> | StyledTextComponentProp[];
188
+ displayCondition?: Expression;
189
+ withLabelRowModeProps?: {
190
+ className?: string;
191
+ };
192
+ verticalModeProps?: {
193
+ className?: string;
194
+ };
195
+ tableModeProps?: {
196
+ className?: string;
197
+ };
198
+ }>;
199
+ defaultMode: ResponsiveBipolarLikertArrayVariant;
200
+ responsiveModes?: {
201
+ sm?: ResponsiveBipolarLikertArrayVariant;
202
+ md?: ResponsiveBipolarLikertArrayVariant;
203
+ lg?: ResponsiveBipolarLikertArrayVariant;
204
+ xl?: ResponsiveBipolarLikertArrayVariant;
205
+ xxl?: ResponsiveBipolarLikertArrayVariant;
206
+ };
207
+ rgClassName?: string;
208
+ tableModeProps?: {
209
+ className?: string;
210
+ layout?: "fixed";
211
+ labelColWidth?: string;
212
+ hideRowBorder?: boolean;
213
+ };
214
+ withLabelRowModeProps?: {
215
+ hideRowBorder?: boolean;
216
+ maxLabelWidth?: string;
217
+ useBottomLabel?: boolean;
218
+ };
219
+ verticalModeProps?: {
220
+ hideRowBorder?: boolean;
221
+ };
222
+ }
223
+ export declare type ResponsiveBipolarLikertArrayQuestionProps = GenericQuestionProps & ResponsiveBipolarLikertArrayProps;
@@ -1,3 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const isDateDisplayComponentProp = (value) => {
6
+ return typeof (value) === 'object' && value.date !== undefined && value.dateFormat !== undefined && value.languageCodes !== undefined;
7
+ };
8
+
9
+ exports.isDateDisplayComponentProp = isDateDisplayComponentProp;
3
10
  //# sourceMappingURL=item-properties.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"item-properties.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"item-properties.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { Expression, SurveySingleItem } from "survey-engine/lib/data_types";
1
+ import { Expression, SurveySingleItem } from "survey-engine/data_types";
2
2
  export declare abstract class Item {
3
3
  key: string;
4
4
  item: SurveySingleItem;
@@ -1,19 +1,23 @@
1
- import { SurveyItem } from "survey-engine/lib/data_types";
1
+ import { SurveyItem } from "survey-engine/data_types";
2
2
  import { SurveyEditor } from "../survey-editor/survey-editor";
3
+ export declare type SurveyAvailableFor = 'public' | 'temporary_participants' | 'active_participants';
3
4
  export interface SurveyProps {
4
5
  surveyKey: string;
5
6
  name: Map<string, string>;
6
7
  description: Map<string, string>;
7
8
  durationText: Map<string, string>;
9
+ availableFor?: SurveyAvailableFor;
10
+ requireLoginBeforeSubmission?: boolean;
8
11
  }
9
12
  export declare abstract class SurveyDefinition {
10
13
  key: string;
11
14
  editor: SurveyEditor;
12
15
  constructor(props: SurveyProps);
13
16
  abstract buildSurvey(): void;
14
- getSurvey(): import("survey-engine/lib/data_types").Survey;
17
+ getSurvey(): import("survey-engine/data_types").Survey;
15
18
  getSurveyJSON(pretty?: boolean): string;
16
- addItem(item: SurveyItem): void;
19
+ addItem(item: SurveyItem, pageBreakAfter?: boolean): void;
20
+ addPageBreak(): void;
17
21
  addSurveyItemToPath(item: SurveyItem, parentKey: string): void;
18
22
  private checkDuplicateChildKeys;
19
23
  }
@@ -3,11 +3,12 @@
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-cb5ebc1a.js');
6
+ var surveys_surveyEditor_itemEditor = require('../../item-editor-59f51ecc.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');
10
10
  require('../utils/randomKeyGenerator.js');
11
+ require('./item-properties.js');
11
12
 
12
13
  class SurveyDefinition {
13
14
  constructor(props) {
@@ -18,6 +19,8 @@ class SurveyDefinition {
18
19
  this.editor.setSurveyName(surveys_utils_simpleGenerators.generateLocStrings(props.name));
19
20
  this.editor.setSurveyDescription(surveys_utils_simpleGenerators.generateLocStrings(props.description));
20
21
  this.editor.setSurveyDuration(surveys_utils_simpleGenerators.generateLocStrings(props.durationText));
22
+ this.editor.setAvailableFor(props.availableFor);
23
+ this.editor.setRequireLoginBeforeSubmission(props.requireLoginBeforeSubmission);
21
24
  const rootItemEditor = new surveys_surveyEditor_itemEditor.ItemEditor(this.editor.findSurveyItem(props.surveyKey));
22
25
  rootItemEditor.setSelectionMethod({ name: 'sequential' });
23
26
  this.editor.updateSurveyItem(rootItemEditor.getItem());
@@ -32,8 +35,14 @@ class SurveyDefinition {
32
35
  this.checkDuplicateChildKeys();
33
36
  return this.editor.getSurveyJSON(pretty);
34
37
  }
35
- addItem(item) {
38
+ addItem(item, pageBreakAfter) {
36
39
  this.editor.addExistingSurveyItem(item, this.key);
40
+ if (pageBreakAfter) {
41
+ this.addPageBreak();
42
+ }
43
+ }
44
+ addPageBreak() {
45
+ this.editor.addExistingSurveyItem(surveys_utils_simpleGenerators.generatePageBreak(this.key), this.key);
37
46
  }
38
47
  addSurveyItemToPath(item, parentKey) {
39
48
  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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,19 +1,10 @@
1
- import { Expression, ItemComponent } from "survey-engine/lib/data_types";
2
- import { OptionDef, StyledTextComponentProp } from "../types/item-properties";
1
+ import { Expression, ItemComponent } from "survey-engine/data_types";
2
+ import { StyledTextComponentProp } from "../types/item-properties";
3
3
  interface CommonProps {
4
4
  key?: string;
5
5
  content?: Map<string, string> | StyledTextComponentProp[];
6
6
  displayCondition?: Expression;
7
7
  }
8
- interface OptionProps extends CommonProps {
9
- key: string;
10
- disabled?: Expression;
11
- className?: string;
12
- }
13
- interface OptionTextProps extends CommonProps {
14
- key: string;
15
- className?: string;
16
- }
17
8
  interface TextProps extends CommonProps {
18
9
  content: Map<string, string>;
19
10
  variant?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'li';
@@ -24,8 +15,6 @@ interface MarkdownProps extends CommonProps {
24
15
  className?: string;
25
16
  }
26
17
  export declare const ComponentGenerators: {
27
- option: (props: OptionProps) => OptionDef;
28
- multipleChoiceOptionSubtitle: (props: OptionTextProps) => OptionDef;
29
18
  footnote: (props: {
30
19
  content: Map<string, string>;
31
20
  }) => ItemComponent;
@@ -5,39 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var surveys_utils_randomKeyGenerator = require('./randomKeyGenerator.js');
6
6
  var surveys_utils_simpleGenerators = require('./simple-generators.js');
7
7
  require('../survey-editor/component-editor.js');
8
+ require('../types/item-properties.js');
8
9
 
9
- const option = (props) => {
10
- const styles = [];
11
- if (props.className !== undefined) {
12
- styles.push({
13
- key: 'className', value: props.className
14
- });
15
- }
16
- return {
17
- key: props.key,
18
- role: 'option',
19
- content: !Array.isArray(props.content) ? props.content : undefined,
20
- items: Array.isArray(props.content) ? props.content : undefined,
21
- displayCondition: props.displayCondition,
22
- disabled: props.disabled,
23
- style: styles,
24
- };
25
- };
26
- const multipleChoiceOptionSubtitle = (props) => {
27
- const styles = [];
28
- if (props.className !== undefined) {
29
- styles.push({
30
- key: 'className', value: props.className
31
- });
32
- }
33
- return {
34
- key: props.key,
35
- role: 'text',
36
- content: !Array.isArray(props.content) ? props.content : undefined,
37
- displayCondition: props.displayCondition,
38
- style: styles,
39
- };
40
- };
41
10
  const text = (props) => {
42
11
  const styles = [];
43
12
  if (props.className !== undefined) {
@@ -81,8 +50,6 @@ const footnote = (props) => {
81
50
  };
82
51
  };
83
52
  const ComponentGenerators = {
84
- option,
85
- multipleChoiceOptionSubtitle,
86
53
  footnote,
87
54
  text,
88
55
  markdown,
@@ -1 +1 @@
1
- {"version":3,"file":"componentGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"componentGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,84 @@
1
+ import { Expression } from "survey-engine/data_types";
2
+ import { ClozeProps, DateInputProps, NumericInputProps, OptionDef, StyledTextComponentProp, TextInputProps, TimeInputProps } from "../types/item-properties";
3
+ interface CommonProps {
4
+ key?: string;
5
+ content?: Map<string, string> | StyledTextComponentProp[];
6
+ displayCondition?: Expression;
7
+ }
8
+ interface OptionProps {
9
+ disabled?: Expression;
10
+ className?: string;
11
+ displayCondition?: Expression;
12
+ }
13
+ interface OptionTextProps extends CommonProps {
14
+ className?: string;
15
+ }
16
+ export declare const SingleChoiceOptionTypes: {
17
+ option: (key: string, content: Map<string, string> | StyledTextComponentProp[], extraProps?: OptionProps | undefined) => OptionDef;
18
+ textInput: (props: TextInputProps & {
19
+ key: string;
20
+ displayCondition?: Expression;
21
+ }) => OptionDef;
22
+ timeInput: (props: TimeInputProps & {
23
+ key: string;
24
+ displayCondition?: Expression;
25
+ }) => OptionDef;
26
+ numberInput: (props: NumericInputProps & {
27
+ key: string;
28
+ displayCondition?: Expression;
29
+ }) => OptionDef;
30
+ cloze: (props: ClozeProps & {
31
+ key: string;
32
+ displayCondition?: Expression;
33
+ className?: string;
34
+ }) => OptionDef;
35
+ };
36
+ export declare const MultipleChoiceOptionTypes: {
37
+ option: (key: string, content: Map<string, string> | StyledTextComponentProp[], extraProps?: OptionProps | undefined) => OptionDef;
38
+ subtitle: (props: OptionTextProps) => OptionDef;
39
+ textInput: (props: TextInputProps & {
40
+ key: string;
41
+ displayCondition?: Expression;
42
+ }) => OptionDef;
43
+ timeInput: (props: TimeInputProps & {
44
+ key: string;
45
+ displayCondition?: Expression;
46
+ }) => OptionDef;
47
+ numberInput: (props: NumericInputProps & {
48
+ key: string;
49
+ displayCondition?: Expression;
50
+ }) => OptionDef;
51
+ cloze: (props: ClozeProps & {
52
+ key: string;
53
+ displayCondition?: Expression;
54
+ className?: string;
55
+ }) => OptionDef;
56
+ };
57
+ export declare const ClozeItemTypes: {
58
+ text: (props: OptionTextProps) => OptionDef;
59
+ markdown: (props: OptionTextProps) => OptionDef;
60
+ textInput: (props: TextInputProps & {
61
+ key: string;
62
+ displayCondition?: Expression;
63
+ }) => OptionDef;
64
+ dateInput: (props: DateInputProps & {
65
+ key: string;
66
+ displayCondition?: Expression;
67
+ }) => OptionDef;
68
+ timeInput: (props: TimeInputProps & {
69
+ key: string;
70
+ displayCondition?: Expression;
71
+ }) => OptionDef;
72
+ clozeLineBreak: () => OptionDef;
73
+ numberInput: (props: NumericInputProps & {
74
+ key: string;
75
+ displayCondition?: Expression;
76
+ }) => OptionDef;
77
+ dropDown: (props: {
78
+ key: string;
79
+ placeholder?: Map<string, string>;
80
+ displayCondition?: Expression;
81
+ options: Array<OptionDef>;
82
+ }) => OptionDef;
83
+ };
84
+ export {};