case-editor-tools 1.0.0-beta.3 → 1.0.0-beta.33

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 (131) hide show
  1. package/{build/constants → constants}/key-definitions.d.ts +1 -0
  2. package/{build/constants → constants}/key-definitions.js +3 -1
  3. package/{build/constants → constants}/key-definitions.js.map +1 -1
  4. package/exporter/index.d.ts +2 -0
  5. package/exporter/index.js +99 -0
  6. package/exporter/index.js.map +1 -0
  7. package/{build/expression-utils → expression-utils}/expressionGen.d.ts +1 -1
  8. package/{build/expression-utils → expression-utils}/expressionGen.js +0 -0
  9. package/{build/expression-utils → expression-utils}/expressionGen.js.map +0 -0
  10. package/{build/expression-utils → expression-utils}/studyEngineExpressions.d.ts +75 -13
  11. package/{build/expression-utils → expression-utils}/studyEngineExpressions.js +165 -19
  12. package/{build/expression-utils → expression-utils}/studyEngineExpressions.js.map +1 -1
  13. package/{build/index.d.ts → index.d.ts} +0 -0
  14. package/{build/index.js → index.js} +0 -0
  15. package/{build/index.js.map → index.js.map} +0 -0
  16. package/{build/item-editor-8fd24b61.js → item-editor-c6933791.js} +69 -51
  17. package/item-editor-c6933791.js.map +1 -0
  18. package/logger/index.d.ts +1 -0
  19. package/logger/index.js +10 -0
  20. package/logger/index.js.map +1 -0
  21. package/{build/logger → logger}/logger.d.ts +0 -0
  22. package/{build/logger → logger}/logger.js +0 -0
  23. package/{build/logger → logger}/logger.js.map +0 -0
  24. package/package.json +7 -8
  25. package/surveys/index.d.ts +3 -0
  26. package/surveys/index.js +28 -0
  27. package/surveys/index.js.map +1 -0
  28. package/surveys/responseTypeGenerators/likertGroupComponents.d.ts +27 -0
  29. package/surveys/responseTypeGenerators/likertGroupComponents.js +349 -0
  30. package/surveys/responseTypeGenerators/likertGroupComponents.js.map +1 -0
  31. package/surveys/responseTypeGenerators/matrixGroupComponent.d.ts +49 -0
  32. package/surveys/responseTypeGenerators/matrixGroupComponent.js +99 -0
  33. package/surveys/responseTypeGenerators/matrixGroupComponent.js.map +1 -0
  34. package/surveys/responseTypeGenerators/optionGroupComponents.d.ts +7 -0
  35. package/surveys/responseTypeGenerators/optionGroupComponents.js +125 -0
  36. package/surveys/responseTypeGenerators/optionGroupComponents.js.map +1 -0
  37. package/{build → surveys}/survey-editor/component-editor.d.ts +1 -1
  38. package/{build → surveys}/survey-editor/component-editor.js +0 -0
  39. package/{build → surveys}/survey-editor/component-editor.js.map +0 -0
  40. package/{build → surveys}/survey-editor/data-types.d.ts +1 -1
  41. package/{build → surveys}/survey-editor/data-types.js +0 -0
  42. package/{build → surveys}/survey-editor/data-types.js.map +0 -0
  43. package/{build → surveys}/survey-editor/item-editor.d.ts +1 -1
  44. package/{build → surveys}/survey-editor/item-editor.js +3 -2
  45. package/{build → surveys}/survey-editor/item-editor.js.map +1 -1
  46. package/{build → surveys}/survey-editor/survey-editor.d.ts +6 -1
  47. package/{build → surveys}/survey-editor/survey-editor.js +15 -8
  48. package/{build → surveys}/survey-editor/survey-editor.js.map +1 -1
  49. package/{build/expression-utils/surveyEngineExpressions.d.ts → surveys/survey-engine-expressions.d.ts} +9 -2
  50. package/{build/expression-utils/surveyEngineExpressions.js → surveys/survey-engine-expressions.js} +40 -4
  51. package/{build/expression-utils/surveyEngineExpressions.js.map → surveys/survey-engine-expressions.js.map} +1 -1
  52. package/surveys/survey-items.d.ts +66 -0
  53. package/surveys/survey-items.js +302 -0
  54. package/surveys/survey-items.js.map +1 -0
  55. package/{build → surveys}/types/group.d.ts +1 -1
  56. package/{build → surveys}/types/group.js +5 -5
  57. package/{build → surveys}/types/group.js.map +0 -0
  58. package/surveys/types/index.d.ts +4 -0
  59. package/surveys/types/index.js +20 -0
  60. package/surveys/types/index.js.map +1 -0
  61. package/surveys/types/item-properties.d.ts +191 -0
  62. package/surveys/types/item-properties.js +3 -0
  63. package/surveys/types/item-properties.js.map +1 -0
  64. package/{build → surveys}/types/item.d.ts +1 -1
  65. package/{build → surveys}/types/item.js +0 -0
  66. package/{build → surveys}/types/item.js.map +0 -0
  67. package/{build/types/surveyDefinition.d.ts → surveys/types/survey-definition.d.ts} +7 -3
  68. package/{build/types/surveyDefinition.js → surveys/types/survey-definition.js} +19 -11
  69. package/surveys/types/survey-definition.js.map +1 -0
  70. package/{build → surveys}/utils/componentGenerators.d.ts +2 -13
  71. package/surveys/utils/componentGenerators.js +58 -0
  72. package/{build → surveys}/utils/componentGenerators.js.map +1 -1
  73. package/surveys/utils/optionDefGenerators.d.ts +69 -0
  74. package/surveys/utils/optionDefGenerators.js +169 -0
  75. package/surveys/utils/optionDefGenerators.js.map +1 -0
  76. package/{build → surveys}/utils/randomKeyGenerator.d.ts +0 -0
  77. package/{build → surveys}/utils/randomKeyGenerator.js +0 -0
  78. package/{build → surveys}/utils/randomKeyGenerator.js.map +0 -0
  79. package/{build → surveys}/utils/simple-generators.d.ts +2 -2
  80. package/{build → surveys}/utils/simple-generators.js +5 -5
  81. package/{build → surveys}/utils/simple-generators.js.map +0 -0
  82. package/{build → surveys}/utils/simple-question-editor.d.ts +3 -3
  83. package/{build → surveys}/utils/simple-question-editor.js +7 -6
  84. package/{build → surveys}/utils/simple-question-editor.js.map +1 -1
  85. package/{build/types → types}/duration.d.ts +0 -0
  86. package/{build/types → types}/duration.js +0 -0
  87. package/{build/types → types}/duration.js.map +0 -0
  88. package/{build/types → types}/expression.d.ts +1 -1
  89. package/{build/types → types}/expression.js +0 -0
  90. package/{build/types → types}/expression.js.map +0 -0
  91. package/{build/types → types}/study.d.ts +2 -2
  92. package/{build/types → types}/study.js +0 -0
  93. package/{build/types → types}/study.js.map +0 -0
  94. package/{build/types → types}/studyRules.d.ts +3 -2
  95. package/{build/types → types}/studyRules.js +5 -1
  96. package/types/studyRules.js.map +1 -0
  97. package/.babelrc.js +0 -7
  98. package/.editorconfig +0 -13
  99. package/LICENSE +0 -202
  100. package/build/item-editor-8fd24b61.js.map +0 -1
  101. package/build/package.json +0 -26
  102. package/build/types/studyRules.js.map +0 -1
  103. package/build/types/surveyDefinition.js.map +0 -1
  104. package/build/utils/componentGenerators.js +0 -92
  105. package/build/utils/question-type-generator.d.ts +0 -283
  106. package/build/utils/question-type-generator.js +0 -949
  107. package/build/utils/question-type-generator.js.map +0 -1
  108. package/rollup.config.js +0 -53
  109. package/src/constants/key-definitions.ts +0 -13
  110. package/src/expression-utils/expressionGen.ts +0 -28
  111. package/src/expression-utils/studyEngineExpressions.ts +0 -359
  112. package/src/expression-utils/surveyEngineExpressions.ts +0 -483
  113. package/src/index.ts +0 -1
  114. package/src/logger/logger.ts +0 -31
  115. package/src/survey-editor/component-editor.ts +0 -133
  116. package/src/survey-editor/data-types.ts +0 -18
  117. package/src/survey-editor/item-editor.ts +0 -528
  118. package/src/survey-editor/survey-editor.ts +0 -260
  119. package/src/types/duration.ts +0 -32
  120. package/src/types/expression.ts +0 -22
  121. package/src/types/group.ts +0 -73
  122. package/src/types/item.ts +0 -42
  123. package/src/types/study.ts +0 -17
  124. package/src/types/studyRules.ts +0 -39
  125. package/src/types/surveyDefinition.ts +0 -83
  126. package/src/utils/componentGenerators.ts +0 -122
  127. package/src/utils/question-type-generator.ts +0 -1516
  128. package/src/utils/randomKeyGenerator.ts +0 -11
  129. package/src/utils/simple-generators.ts +0 -106
  130. package/src/utils/simple-question-editor.ts +0 -52
  131. package/tsconfig.json +0 -100
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var logger_logger = require('../logger/logger.js');
6
- var surveyEditor_itemEditor = require('../item-editor-8fd24b61.js');
7
- var utils_simpleGenerators = require('../utils/simple-generators.js');
5
+ var logger_logger = require('../../logger/logger.js');
6
+ var surveys_surveyEditor_itemEditor = require('../../item-editor-c6933791.js');
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
10
 
@@ -12,7 +12,7 @@ class Group {
12
12
  constructor(parentKey, groupKey, selectionMethod) {
13
13
  this.parentKey = parentKey;
14
14
  this.key = [this.parentKey, groupKey].join('.');
15
- this.groupEditor = new surveyEditor_itemEditor.ItemEditor(undefined, {
15
+ this.groupEditor = new surveys_surveyEditor_itemEditor.ItemEditor(undefined, {
16
16
  itemKey: this.key,
17
17
  isGroup: true
18
18
  });
@@ -41,7 +41,7 @@ class Group {
41
41
  return this.groupEditor.getItem();
42
42
  }
43
43
  addPageBreak() {
44
- this.groupEditor.addSurveyItem(utils_simpleGenerators.generatePageBreak(this.key));
44
+ this.groupEditor.addSurveyItem(surveys_utils_simpleGenerators.generatePageBreak(this.key));
45
45
  }
46
46
  addItem(item, pageBreakAfter) {
47
47
  this.groupEditor.addSurveyItem(item);
File without changes
@@ -0,0 +1,4 @@
1
+ export * from './group';
2
+ export * from './item';
3
+ export * from './item-properties';
4
+ export * from './survey-definition';
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var surveys_types_group = require('./group.js');
6
+ var surveys_types_item = require('./item.js');
7
+ var surveys_types_surveyDefinition = require('./survey-definition.js');
8
+ require('../../logger/logger.js');
9
+ require('../../item-editor-c6933791.js');
10
+ require('../survey-editor/component-editor.js');
11
+ require('../utils/randomKeyGenerator.js');
12
+ require('../utils/simple-generators.js');
13
+ require('../survey-editor/survey-editor.js');
14
+
15
+
16
+
17
+ exports.Group = surveys_types_group.Group;
18
+ exports.Item = surveys_types_item.Item;
19
+ exports.SurveyDefinition = surveys_types_surveyDefinition.SurveyDefinition;
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,191 @@
1
+ import { ComponentProperties, Expression, ItemComponent, Validation } from "survey-engine/data_types";
2
+ import { Duration } from "../../types/duration";
3
+ export interface StyledTextComponentProp {
4
+ content: Map<string, string>;
5
+ className?: string;
6
+ }
7
+ export interface OptionDef {
8
+ key: string;
9
+ role: string;
10
+ content?: Map<string, string>;
11
+ items?: Array<StyledTextComponentProp> | Array<OptionDef>;
12
+ description?: Map<string, string>;
13
+ displayCondition?: Expression;
14
+ disabled?: Expression;
15
+ style?: Array<{
16
+ key: string;
17
+ value: string;
18
+ }>;
19
+ optionProps?: ComponentProperties;
20
+ }
21
+ export interface GenericQuestionProps {
22
+ parentKey: string;
23
+ itemKey: string;
24
+ version?: number;
25
+ questionText: Map<string, string> | Array<StyledTextComponentProp>;
26
+ questionSubText?: Map<string, string>;
27
+ titleClassName?: string;
28
+ helpGroupContent?: Array<{
29
+ content: Map<string, string>;
30
+ style?: Array<{
31
+ key: string;
32
+ value: string;
33
+ }>;
34
+ }>;
35
+ condition?: Expression;
36
+ topDisplayCompoments?: Array<ItemComponent>;
37
+ bottomDisplayCompoments?: Array<ItemComponent>;
38
+ isRequired?: boolean;
39
+ footnoteText?: Map<string, string>;
40
+ customValidations?: Array<Validation>;
41
+ }
42
+ /**
43
+ * Numeric Input
44
+ */
45
+ export interface NumericInputProps {
46
+ inputLabel: Map<string, string>;
47
+ labelBehindInput?: boolean;
48
+ componentProperties?: ComponentProperties;
49
+ inputMaxWidth?: string;
50
+ disabled?: Expression;
51
+ }
52
+ export declare type NumericInputQuestionProps = GenericQuestionProps & NumericInputProps;
53
+ /**
54
+ * Date Input
55
+ */
56
+ export interface DateInputProps {
57
+ dateInputMode: 'YMD' | 'YM' | 'Y';
58
+ inputLabelText?: Map<string, string>;
59
+ placeholderText?: Map<string, string>;
60
+ minRelativeDate?: {
61
+ reference?: number | Expression;
62
+ delta: Duration;
63
+ };
64
+ maxRelativeDate?: {
65
+ reference?: number | Expression;
66
+ delta: Duration;
67
+ };
68
+ }
69
+ export declare type DateInputQuestionProps = DateInputProps & GenericQuestionProps;
70
+ /**
71
+ * Text Input
72
+ */
73
+ export interface TextInputProps {
74
+ placeholderText?: Map<string, string>;
75
+ inputLabel?: Map<string, string>;
76
+ inputMaxWidth?: string;
77
+ className?: string;
78
+ maxLength?: number;
79
+ disabled?: Expression;
80
+ }
81
+ export declare type TextInputQuestionProps = TextInputProps & GenericQuestionProps;
82
+ export interface MultiLineTextInput extends GenericQuestionProps {
83
+ inputLabelText?: Map<string, string>;
84
+ placeholderText?: Map<string, string>;
85
+ maxLength?: number;
86
+ }
87
+ /**
88
+ * Cloze Question
89
+ */
90
+ export interface ClozeProps {
91
+ items: Array<OptionDef>;
92
+ }
93
+ export declare type ClozeQuestionProps = ClozeProps & GenericQuestionProps;
94
+ /**
95
+ * Response Single Choice Likert Array
96
+ */
97
+ export declare type ResponsiveSingleChoiceArrayVariant = 'horizontal' | 'vertical' | 'table';
98
+ export interface ResponsiveSingleChoiceArrayProps {
99
+ scaleOptions: Array<{
100
+ key: string;
101
+ className?: string;
102
+ content: Map<string, string> | StyledTextComponentProp[];
103
+ }>;
104
+ rows: Array<{
105
+ key: string;
106
+ displayCondition?: Expression;
107
+ content: Map<string, string> | StyledTextComponentProp[];
108
+ horizontalModeProps?: {
109
+ labelPlacement?: 'none' | 'top' | 'bottom';
110
+ className?: string;
111
+ };
112
+ verticalModeProps?: {
113
+ className?: string;
114
+ };
115
+ tableModeProps?: {
116
+ className?: string;
117
+ };
118
+ }>;
119
+ defaultMode: ResponsiveSingleChoiceArrayVariant;
120
+ responsiveModes?: {
121
+ sm?: ResponsiveSingleChoiceArrayVariant;
122
+ md?: ResponsiveSingleChoiceArrayVariant;
123
+ lg?: ResponsiveSingleChoiceArrayVariant;
124
+ xl?: ResponsiveSingleChoiceArrayVariant;
125
+ xxl?: ResponsiveSingleChoiceArrayVariant;
126
+ };
127
+ rgClassName?: string;
128
+ tableModeProps?: {
129
+ className?: string;
130
+ layout?: "fixed";
131
+ firstColWidth?: string;
132
+ optionHeaderClassName?: string;
133
+ hideRowBorder?: boolean;
134
+ };
135
+ horizontalModeProps?: {
136
+ hideRowBorder?: boolean;
137
+ };
138
+ verticalModeProps?: {
139
+ hideRowBorder?: boolean;
140
+ useReverseOptionOrder?: boolean;
141
+ };
142
+ }
143
+ export declare type ResponsiveSingleChoiceArrayQuestionProps = GenericQuestionProps & ResponsiveSingleChoiceArrayProps;
144
+ /**
145
+ * Response Bipolar Likert Array
146
+ */
147
+ export declare type ResponsiveBipolarLikertArrayVariant = 'withLabelRow' | 'vertical' | 'table';
148
+ export interface ResponsiveBipolarLikertArrayProps {
149
+ scaleOptions: Array<{
150
+ key: string;
151
+ }>;
152
+ rows: Array<{
153
+ key: string;
154
+ startLabel: Map<string, string> | StyledTextComponentProp[];
155
+ endLabel: Map<string, string> | StyledTextComponentProp[];
156
+ displayCondition?: Expression;
157
+ withLabelRowModeProps?: {
158
+ className?: string;
159
+ };
160
+ verticalModeProps?: {
161
+ className?: string;
162
+ };
163
+ tableModeProps?: {
164
+ className?: string;
165
+ };
166
+ }>;
167
+ defaultMode: ResponsiveBipolarLikertArrayVariant;
168
+ responsiveModes?: {
169
+ sm?: ResponsiveBipolarLikertArrayVariant;
170
+ md?: ResponsiveBipolarLikertArrayVariant;
171
+ lg?: ResponsiveBipolarLikertArrayVariant;
172
+ xl?: ResponsiveBipolarLikertArrayVariant;
173
+ xxl?: ResponsiveBipolarLikertArrayVariant;
174
+ };
175
+ rgClassName?: string;
176
+ tableModeProps?: {
177
+ className?: string;
178
+ layout?: "fixed";
179
+ labelColWidth?: string;
180
+ hideRowBorder?: boolean;
181
+ };
182
+ withLabelRowModeProps?: {
183
+ hideRowBorder?: boolean;
184
+ maxLabelWidth?: string;
185
+ useBottomLabel?: boolean;
186
+ };
187
+ verticalModeProps?: {
188
+ hideRowBorder?: boolean;
189
+ };
190
+ }
191
+ export declare type ResponsiveBipolarLikertArrayQuestionProps = GenericQuestionProps & ResponsiveBipolarLikertArrayProps;
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ //# sourceMappingURL=item-properties.js.map
@@ -0,0 +1 @@
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;
File without changes
File without changes
@@ -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
  }
@@ -2,23 +2,25 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var logger_logger = require('../logger/logger.js');
6
- var surveyEditor_itemEditor = require('../item-editor-8fd24b61.js');
7
- var surveyEditor_surveyEditor = require('../survey-editor/survey-editor.js');
8
- var utils_simpleGenerators = require('../utils/simple-generators.js');
5
+ var logger_logger = require('../../logger/logger.js');
6
+ var surveys_surveyEditor_itemEditor = require('../../item-editor-c6933791.js');
7
+ var surveys_surveyEditor_surveyEditor = require('../survey-editor/survey-editor.js');
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
11
 
12
12
  class SurveyDefinition {
13
13
  constructor(props) {
14
- this.editor = new surveyEditor_surveyEditor.SurveyEditor();
14
+ this.editor = new surveys_surveyEditor_surveyEditor.SurveyEditor();
15
15
  this.editor.changeItemKey('survey', props.surveyKey);
16
16
  this.key = props.surveyKey;
17
17
  // define name and description of the survey
18
- this.editor.setSurveyName(utils_simpleGenerators.generateLocStrings(props.name));
19
- this.editor.setSurveyDescription(utils_simpleGenerators.generateLocStrings(props.description));
20
- this.editor.setSurveyDuration(utils_simpleGenerators.generateLocStrings(props.durationText));
21
- const rootItemEditor = new surveyEditor_itemEditor.ItemEditor(this.editor.findSurveyItem(props.surveyKey));
18
+ this.editor.setSurveyName(surveys_utils_simpleGenerators.generateLocStrings(props.name));
19
+ this.editor.setSurveyDescription(surveys_utils_simpleGenerators.generateLocStrings(props.description));
20
+ this.editor.setSurveyDuration(surveys_utils_simpleGenerators.generateLocStrings(props.durationText));
21
+ this.editor.setAvailableFor(props.availableFor);
22
+ this.editor.setRequireLoginBeforeSubmission(props.requireLoginBeforeSubmission);
23
+ const rootItemEditor = new surveys_surveyEditor_itemEditor.ItemEditor(this.editor.findSurveyItem(props.surveyKey));
22
24
  rootItemEditor.setSelectionMethod({ name: 'sequential' });
23
25
  this.editor.updateSurveyItem(rootItemEditor.getItem());
24
26
  }
@@ -32,8 +34,14 @@ class SurveyDefinition {
32
34
  this.checkDuplicateChildKeys();
33
35
  return this.editor.getSurveyJSON(pretty);
34
36
  }
35
- addItem(item) {
37
+ addItem(item, pageBreakAfter) {
36
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);
37
45
  }
38
46
  addSurveyItemToPath(item, parentKey) {
39
47
  this.editor.addExistingSurveyItem(item, parentKey);
@@ -57,4 +65,4 @@ class SurveyDefinition {
57
65
  }
58
66
 
59
67
  exports.SurveyDefinition = SurveyDefinition;
60
- //# sourceMappingURL=surveyDefinition.js.map
68
+ //# sourceMappingURL=survey-definition.js.map
@@ -0,0 +1 @@
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 "./question-type-generator";
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;
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var surveys_utils_randomKeyGenerator = require('./randomKeyGenerator.js');
6
+ var surveys_utils_simpleGenerators = require('./simple-generators.js');
7
+ require('../survey-editor/component-editor.js');
8
+
9
+ const text = (props) => {
10
+ const styles = [];
11
+ if (props.className !== undefined) {
12
+ styles.push({
13
+ key: 'className', value: props.className
14
+ });
15
+ }
16
+ if (props.variant !== undefined) {
17
+ styles.push({
18
+ key: 'variant', value: props.variant
19
+ });
20
+ }
21
+ return {
22
+ key: surveys_utils_randomKeyGenerator.generateRandomKey(3),
23
+ role: 'text',
24
+ style: styles.length > 0 ? styles : undefined,
25
+ content: surveys_utils_simpleGenerators.generateLocStrings(props.content),
26
+ displayCondition: props.displayCondition,
27
+ };
28
+ };
29
+ const markdown = (props) => {
30
+ const styles = [];
31
+ if (props.className !== undefined) {
32
+ styles.push({
33
+ key: 'className', value: props.className
34
+ });
35
+ }
36
+ return {
37
+ key: surveys_utils_randomKeyGenerator.generateRandomKey(3),
38
+ role: 'markdown',
39
+ style: styles.length > 0 ? styles : undefined,
40
+ content: surveys_utils_simpleGenerators.generateLocStrings(props.content),
41
+ displayCondition: props.displayCondition,
42
+ };
43
+ };
44
+ const footnote = (props) => {
45
+ return {
46
+ role: 'footnote', content: surveys_utils_simpleGenerators.generateLocStrings(props.content), style: [
47
+ { key: 'className', value: 'fs-small fst-italic text-center' }
48
+ ]
49
+ };
50
+ };
51
+ const ComponentGenerators = {
52
+ footnote,
53
+ text,
54
+ markdown,
55
+ };
56
+
57
+ exports.ComponentGenerators = ComponentGenerators;
58
+ //# sourceMappingURL=componentGenerators.js.map
@@ -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,69 @@
1
+ import { Expression } from "survey-engine/data_types";
2
+ import { ClozeProps, DateInputProps, NumericInputProps, OptionDef, StyledTextComponentProp, TextInputProps } 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
+ numberInput: (props: NumericInputProps & {
23
+ key: string;
24
+ displayCondition?: Expression;
25
+ }) => OptionDef;
26
+ cloze: (props: ClozeProps & {
27
+ key: string;
28
+ displayCondition?: Expression;
29
+ }) => OptionDef;
30
+ };
31
+ export declare const MultipleChoiceOptionTypes: {
32
+ option: (key: string, content: Map<string, string> | StyledTextComponentProp[], extraProps?: OptionProps | undefined) => OptionDef;
33
+ subtitle: (props: OptionTextProps) => OptionDef;
34
+ textInput: (props: TextInputProps & {
35
+ key: string;
36
+ displayCondition?: Expression;
37
+ }) => OptionDef;
38
+ numberInput: (props: NumericInputProps & {
39
+ key: string;
40
+ displayCondition?: Expression;
41
+ }) => OptionDef;
42
+ cloze: (props: ClozeProps & {
43
+ key: string;
44
+ displayCondition?: Expression;
45
+ }) => OptionDef;
46
+ };
47
+ export declare const ClozeItemTypes: {
48
+ text: (props: OptionTextProps) => OptionDef;
49
+ markdown: (props: OptionTextProps) => OptionDef;
50
+ textInput: (props: TextInputProps & {
51
+ key: string;
52
+ displayCondition?: Expression;
53
+ }) => OptionDef;
54
+ dateInput: (props: DateInputProps & {
55
+ key: string;
56
+ displayCondition?: Expression;
57
+ }) => OptionDef;
58
+ clozeLineBreak: () => OptionDef;
59
+ numberInput: (props: NumericInputProps & {
60
+ key: string;
61
+ displayCondition?: Expression;
62
+ }) => OptionDef;
63
+ dropDown: (props: {
64
+ key: string;
65
+ displayCondition?: Expression;
66
+ options: Array<OptionDef>;
67
+ }) => OptionDef;
68
+ };
69
+ export {};