case-editor-tools 1.0.0-beta.4 → 1.0.0-beta.40

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 (132) hide show
  1. package/{build/constants → constants}/key-definitions.d.ts +3 -0
  2. package/{build/constants → constants}/key-definitions.js +7 -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 +86 -13
  11. package/{build/expression-utils → expression-utils}/studyEngineExpressions.js +189 -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-59f51ecc.js} +72 -51
  17. package/item-editor-59f51ecc.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 +29 -0
  27. package/surveys/index.js.map +1 -0
  28. package/surveys/responseTypeGenerators/likertGroupComponents.d.ts +27 -0
  29. package/surveys/responseTypeGenerators/likertGroupComponents.js +350 -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 +100 -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 +129 -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 +2 -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} +12 -2
  50. package/{build/expression-utils/surveyEngineExpressions.js → surveys/survey-engine-expressions.js} +45 -4
  51. package/{build/expression-utils/surveyEngineExpressions.js.map → surveys/survey-engine-expressions.js.map} +1 -1
  52. package/surveys/survey-items.d.ts +68 -0
  53. package/surveys/survey-items.js +384 -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 +6 -5
  57. package/{build → surveys}/types/group.js.map +1 -1
  58. package/surveys/types/index.d.ts +4 -0
  59. package/surveys/types/index.js +22 -0
  60. package/surveys/types/index.js.map +1 -0
  61. package/surveys/types/item-properties.d.ts +223 -0
  62. package/surveys/types/item-properties.js +10 -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} +20 -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 +59 -0
  72. package/{build → surveys}/utils/componentGenerators.js.map +1 -1
  73. package/surveys/utils/optionDefGenerators.d.ts +83 -0
  74. package/surveys/utils/optionDefGenerators.js +210 -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 +4 -3
  80. package/{build → surveys}/utils/simple-generators.js +34 -5
  81. package/{build → surveys}/utils/simple-generators.js.map +1 -1
  82. package/surveys/utils/simple-question-editor.d.ts +14 -0
  83. package/{build → surveys}/utils/simple-question-editor.js +10 -7
  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/build/utils/simple-question-editor.d.ts +0 -14
  109. package/rollup.config.js +0 -53
  110. package/src/constants/key-definitions.ts +0 -13
  111. package/src/expression-utils/expressionGen.ts +0 -28
  112. package/src/expression-utils/studyEngineExpressions.ts +0 -359
  113. package/src/expression-utils/surveyEngineExpressions.ts +0 -483
  114. package/src/index.ts +0 -1
  115. package/src/logger/logger.ts +0 -31
  116. package/src/survey-editor/component-editor.ts +0 -133
  117. package/src/survey-editor/data-types.ts +0 -18
  118. package/src/survey-editor/item-editor.ts +0 -528
  119. package/src/survey-editor/survey-editor.ts +0 -260
  120. package/src/types/duration.ts +0 -32
  121. package/src/types/expression.ts +0 -22
  122. package/src/types/group.ts +0 -73
  123. package/src/types/item.ts +0 -42
  124. package/src/types/study.ts +0 -17
  125. package/src/types/studyRules.ts +0 -39
  126. package/src/types/surveyDefinition.ts +0 -83
  127. package/src/utils/componentGenerators.ts +0 -122
  128. package/src/utils/question-type-generator.ts +0 -1516
  129. package/src/utils/randomKeyGenerator.ts +0 -11
  130. package/src/utils/simple-generators.ts +0 -106
  131. package/src/utils/simple-question-editor.ts +0 -52
  132. package/tsconfig.json +0 -100
@@ -0,0 +1,223 @@
1
+ import { ComponentProperties, ConfidentialMode, 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 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;
14
+ export interface OptionDef {
15
+ key: string;
16
+ role: string;
17
+ content?: Map<string, string>;
18
+ items?: Array<StyledTextComponentProp> | Array<OptionDef>;
19
+ description?: Map<string, string>;
20
+ displayCondition?: Expression;
21
+ disabled?: Expression;
22
+ style?: Array<{
23
+ key: string;
24
+ value: string;
25
+ }>;
26
+ optionProps?: ComponentProperties;
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;
@@ -0,0 +1,10 @@
1
+ 'use strict';
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;
10
+ //# 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,26 @@
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-59f51ecc.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
+ require('./item-properties.js');
11
12
 
12
13
  class SurveyDefinition {
13
14
  constructor(props) {
14
- this.editor = new surveyEditor_surveyEditor.SurveyEditor();
15
+ this.editor = new surveys_surveyEditor_surveyEditor.SurveyEditor();
15
16
  this.editor.changeItemKey('survey', props.surveyKey);
16
17
  this.key = props.surveyKey;
17
18
  // 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));
19
+ this.editor.setSurveyName(surveys_utils_simpleGenerators.generateLocStrings(props.name));
20
+ this.editor.setSurveyDescription(surveys_utils_simpleGenerators.generateLocStrings(props.description));
21
+ this.editor.setSurveyDuration(surveys_utils_simpleGenerators.generateLocStrings(props.durationText));
22
+ this.editor.setAvailableFor(props.availableFor);
23
+ this.editor.setRequireLoginBeforeSubmission(props.requireLoginBeforeSubmission);
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());
24
27
  }
@@ -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);
@@ -57,4 +66,4 @@ class SurveyDefinition {
57
66
  }
58
67
 
59
68
  exports.SurveyDefinition = SurveyDefinition;
60
- //# sourceMappingURL=surveyDefinition.js.map
69
+ //# 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,59 @@
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
+ require('../types/item-properties.js');
9
+
10
+ const text = (props) => {
11
+ const styles = [];
12
+ if (props.className !== undefined) {
13
+ styles.push({
14
+ key: 'className', value: props.className
15
+ });
16
+ }
17
+ if (props.variant !== undefined) {
18
+ styles.push({
19
+ key: 'variant', value: props.variant
20
+ });
21
+ }
22
+ return {
23
+ key: surveys_utils_randomKeyGenerator.generateRandomKey(3),
24
+ role: 'text',
25
+ style: styles.length > 0 ? styles : undefined,
26
+ content: surveys_utils_simpleGenerators.generateLocStrings(props.content),
27
+ displayCondition: props.displayCondition,
28
+ };
29
+ };
30
+ const markdown = (props) => {
31
+ const styles = [];
32
+ if (props.className !== undefined) {
33
+ styles.push({
34
+ key: 'className', value: props.className
35
+ });
36
+ }
37
+ return {
38
+ key: surveys_utils_randomKeyGenerator.generateRandomKey(3),
39
+ role: 'markdown',
40
+ style: styles.length > 0 ? styles : undefined,
41
+ content: surveys_utils_simpleGenerators.generateLocStrings(props.content),
42
+ displayCondition: props.displayCondition,
43
+ };
44
+ };
45
+ const footnote = (props) => {
46
+ return {
47
+ role: 'footnote', content: surveys_utils_simpleGenerators.generateLocStrings(props.content), style: [
48
+ { key: 'className', value: 'fs-small fst-italic text-center' }
49
+ ]
50
+ };
51
+ };
52
+ const ComponentGenerators = {
53
+ footnote,
54
+ text,
55
+ markdown,
56
+ };
57
+
58
+ exports.ComponentGenerators = ComponentGenerators;
59
+ //# 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,83 @@
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
+ displayCondition?: Expression;
80
+ options: Array<OptionDef>;
81
+ }) => OptionDef;
82
+ };
83
+ export {};