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
@@ -1,92 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var utils_randomKeyGenerator = require('./randomKeyGenerator.js');
6
- var utils_simpleGenerators = require('./simple-generators.js');
7
- require('../survey-editor/component-editor.js');
8
-
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
- const text = (props) => {
42
- const styles = [];
43
- if (props.className !== undefined) {
44
- styles.push({
45
- key: 'className', value: props.className
46
- });
47
- }
48
- if (props.variant !== undefined) {
49
- styles.push({
50
- key: 'variant', value: props.variant
51
- });
52
- }
53
- return {
54
- key: utils_randomKeyGenerator.generateRandomKey(3),
55
- role: 'text',
56
- style: styles.length > 0 ? styles : undefined,
57
- content: utils_simpleGenerators.generateLocStrings(props.content),
58
- displayCondition: props.displayCondition,
59
- };
60
- };
61
- const markdown = (props) => {
62
- const styles = [];
63
- if (props.className !== undefined) {
64
- styles.push({
65
- key: 'className', value: props.className
66
- });
67
- }
68
- return {
69
- key: utils_randomKeyGenerator.generateRandomKey(3),
70
- role: 'markdown',
71
- style: styles.length > 0 ? styles : undefined,
72
- content: utils_simpleGenerators.generateLocStrings(props.content),
73
- displayCondition: props.displayCondition,
74
- };
75
- };
76
- const footnote = (props) => {
77
- return {
78
- role: 'footnote', content: utils_simpleGenerators.generateLocStrings(props.content), style: [
79
- { key: 'className', value: 'fs-small fst-italic text-center' }
80
- ]
81
- };
82
- };
83
- const ComponentGenerators = {
84
- option,
85
- multipleChoiceOptionSubtitle,
86
- footnote,
87
- text,
88
- markdown,
89
- };
90
-
91
- exports.ComponentGenerators = ComponentGenerators;
92
- //# sourceMappingURL=componentGenerators.js.map
@@ -1,283 +0,0 @@
1
- import { ItemGroupComponent, Expression, ComponentProperties, ItemComponent, SurveyItem, ExpressionArg, Validation } from "survey-engine/lib/data_types";
2
- import { Duration } from "../types/duration";
3
- export interface OptionDef {
4
- key: string;
5
- role: string;
6
- content?: Map<string, string>;
7
- items?: Array<StyledTextComponentProp>;
8
- description?: Map<string, string>;
9
- displayCondition?: Expression;
10
- disabled?: Expression;
11
- style?: Array<{
12
- key: string;
13
- value: string;
14
- }>;
15
- optionProps?: ComponentProperties;
16
- }
17
- export interface StyledTextComponentProp {
18
- content: Map<string, string>;
19
- className?: string;
20
- }
21
- 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
- interface NumericInputQuestionProps extends GenericQuestionProps {
43
- content: Map<string, string>;
44
- contentBehindInput?: boolean;
45
- componentProperties?: ComponentProperties;
46
- inputMaxWidth?: string;
47
- }
48
- interface OptionQuestionProps extends GenericQuestionProps {
49
- responseOptions: Array<OptionDef>;
50
- }
51
- interface LikertGroupQuestionProps extends GenericQuestionProps {
52
- rows: Array<LikertGroupRow>;
53
- scaleOptions: Array<{
54
- key: string;
55
- className?: string;
56
- content: Map<string, string>;
57
- }>;
58
- stackOnSmallScreen?: boolean;
59
- }
60
- declare type ResponsiveSingleChoiceArrayVariant = 'horizontal' | 'vertical' | 'table';
61
- declare type ResponsiveBipolarLikertArrayVariant = 'withLabelRow' | 'vertical' | 'table';
62
- interface ResponsiveSingleChoiceArrayProps {
63
- scaleOptions: Array<{
64
- key: string;
65
- className?: string;
66
- content: Map<string, string> | StyledTextComponentProp[];
67
- }>;
68
- rows: Array<{
69
- key: string;
70
- content: Map<string, string> | StyledTextComponentProp[];
71
- horizontalModeProps?: {
72
- labelPlacement?: 'none' | 'top' | 'bottom';
73
- className?: string;
74
- };
75
- verticalModeProps?: {
76
- className?: string;
77
- };
78
- tableModeProps?: {
79
- className?: string;
80
- };
81
- }>;
82
- defaultMode: ResponsiveSingleChoiceArrayVariant;
83
- responsiveModes?: {
84
- sm?: ResponsiveSingleChoiceArrayVariant;
85
- md?: ResponsiveSingleChoiceArrayVariant;
86
- lg?: ResponsiveSingleChoiceArrayVariant;
87
- xl?: ResponsiveSingleChoiceArrayVariant;
88
- xxl?: ResponsiveSingleChoiceArrayVariant;
89
- };
90
- rgClassName?: string;
91
- tableModeProps?: {
92
- className?: string;
93
- layout?: "fixed";
94
- firstColWidth?: string;
95
- optionHeaderClassName?: string;
96
- hideRowBorder?: boolean;
97
- };
98
- horizontalModeProps?: {
99
- hideRowBorder?: boolean;
100
- };
101
- verticalModeProps?: {
102
- hideRowBorder?: boolean;
103
- useReverseOptionOrder?: boolean;
104
- };
105
- }
106
- interface ResponsiveBipolarLikertArrayProps {
107
- scaleOptions: Array<{
108
- key: string;
109
- }>;
110
- rows: Array<{
111
- key: string;
112
- startLabel: Map<string, string> | StyledTextComponentProp[];
113
- endLabel: Map<string, string> | StyledTextComponentProp[];
114
- withLabelRowModeProps?: {
115
- className?: string;
116
- };
117
- verticalModeProps?: {
118
- className?: string;
119
- };
120
- tableModeProps?: {
121
- className?: string;
122
- };
123
- }>;
124
- defaultMode: ResponsiveBipolarLikertArrayVariant;
125
- responsiveModes?: {
126
- sm?: ResponsiveBipolarLikertArrayVariant;
127
- md?: ResponsiveBipolarLikertArrayVariant;
128
- lg?: ResponsiveBipolarLikertArrayVariant;
129
- xl?: ResponsiveBipolarLikertArrayVariant;
130
- xxl?: ResponsiveBipolarLikertArrayVariant;
131
- };
132
- rgClassName?: string;
133
- tableModeProps?: {
134
- className?: string;
135
- layout?: "fixed";
136
- labelColWidth?: string;
137
- hideRowBorder?: boolean;
138
- };
139
- withLabelRowModeProps?: {
140
- hideRowBorder?: boolean;
141
- maxLabelWidth?: string;
142
- useBottomLabel?: boolean;
143
- };
144
- verticalModeProps?: {
145
- hideRowBorder?: boolean;
146
- };
147
- }
148
- interface ResponsiveSingleChoiceArrayQuestionProps extends GenericQuestionProps, ResponsiveSingleChoiceArrayProps {
149
- }
150
- interface ResponsiveBipolarLikertArrayQuestionProps extends GenericQuestionProps, ResponsiveBipolarLikertArrayProps {
151
- }
152
- interface NumericSliderProps extends GenericQuestionProps {
153
- sliderLabel: Map<string, string>;
154
- noResponseLabel: Map<string, string>;
155
- min?: number | ExpressionArg;
156
- max?: number | ExpressionArg;
157
- stepSize?: number | ExpressionArg;
158
- }
159
- interface DatePickerInput extends GenericQuestionProps {
160
- dateInputMode: 'YMD' | 'YM' | 'Y';
161
- inputLabelText?: Map<string, string>;
162
- placeholderText?: Map<string, string>;
163
- minRelativeDate?: {
164
- reference?: number | Expression;
165
- delta: Duration;
166
- };
167
- maxRelativeDate?: {
168
- reference?: number | Expression;
169
- delta: Duration;
170
- };
171
- }
172
- interface MultiLineTextInput extends GenericQuestionProps {
173
- inputLabelText?: Map<string, string>;
174
- placeholderText?: Map<string, string>;
175
- }
176
- interface DisplayProps {
177
- parentKey: string;
178
- itemKey: string;
179
- content: Array<ItemComponent>;
180
- condition?: Expression;
181
- }
182
- export declare const SurveyItemGenerators: {
183
- singleChoice: (props: OptionQuestionProps) => SurveyItem;
184
- responsiveSingleChoiceArray: (props: ResponsiveSingleChoiceArrayQuestionProps) => SurveyItem;
185
- responsiveBipolarLikertArray: (props: ResponsiveBipolarLikertArrayQuestionProps) => SurveyItem;
186
- multipleChoice: (props: OptionQuestionProps) => SurveyItem;
187
- simpleLikertGroup: (props: LikertGroupQuestionProps) => SurveyItem;
188
- dateInput: (props: DatePickerInput) => SurveyItem;
189
- multilineTextInput: (props: MultiLineTextInput) => SurveyItem;
190
- dropDown: (props: OptionQuestionProps) => SurveyItem;
191
- numericSlider: (props: NumericSliderProps) => SurveyItem;
192
- numericInput: (props: NumericInputQuestionProps) => SurveyItem;
193
- display: (props: DisplayProps) => SurveyItem;
194
- surveyEnd: (parentKey: string, content: Map<string, string>, condition?: Expression | undefined) => SurveyItem;
195
- };
196
- export declare const initSingleChoiceGroup: (key: string, optionItems: OptionDef[], order?: Expression | undefined) => ItemGroupComponent;
197
- export declare const initMultipleChoiceGroup: (key: string, optionItems: OptionDef[], order?: Expression | undefined) => ItemGroupComponent;
198
- 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;
199
- export declare const initSliderCategoricalGroup: (key: string, optionItems: OptionDef[], order?: Expression | undefined, groupDisabled?: Expression | undefined) => ItemGroupComponent;
200
- interface HeaderRow {
201
- role: 'headerRow';
202
- key: string;
203
- displayCondition?: Expression;
204
- disabled?: Expression;
205
- cells: Array<{
206
- role: 'text';
207
- key: string;
208
- content?: Map<string, string>;
209
- description?: Map<string, string>;
210
- }>;
211
- }
212
- interface RadioRow {
213
- role: 'radioRow';
214
- key: string;
215
- displayCondition?: Expression;
216
- disabled?: Expression;
217
- cells: Array<{
218
- role: 'label' | 'option';
219
- key: string;
220
- content?: Map<string, string>;
221
- description?: Map<string, string>;
222
- }>;
223
- }
224
- export interface ResponseRowCell {
225
- role: 'label' | 'check' | 'input' | 'numberInput' | 'dropDownGroup';
226
- key: string;
227
- content?: Map<string, string>;
228
- description?: Map<string, string>;
229
- properties?: ComponentProperties;
230
- items?: Array<{
231
- role: 'option';
232
- key: string;
233
- content?: Map<string, string>;
234
- disabled?: Expression;
235
- displayCondition?: Expression;
236
- }>;
237
- }
238
- interface ResponseRow {
239
- role: 'responseRow';
240
- key: string;
241
- displayCondition?: Expression;
242
- disabled?: Expression;
243
- cells: Array<ResponseRowCell>;
244
- }
245
- declare type MatrixRow = HeaderRow | RadioRow | ResponseRow;
246
- export declare const initMatrixQuestion: (key: string, rows: Array<MatrixRow>, order?: Expression | undefined) => ItemGroupComponent;
247
- interface EQ5DHealthSliderProps {
248
- role: 'eq5d-health-indicator';
249
- key: string;
250
- displayCondition?: Expression;
251
- disabled?: Expression;
252
- instructionText: Map<string, string>;
253
- valueBoxText: Map<string, string>;
254
- maxHealthText: Map<string, string>;
255
- minHealthText: Map<string, string>;
256
- }
257
- export declare const initEQ5DHealthIndicatorQuestion: (props: EQ5DHealthSliderProps) => ItemGroupComponent;
258
- interface LikertGroupRow {
259
- key: string;
260
- content: Map<string, string>;
261
- descriptions?: ItemComponent[];
262
- hideTopBorder?: boolean;
263
- hideLabels?: boolean;
264
- optionDisabled?: Array<{
265
- optionKey: string;
266
- exp: Expression;
267
- }>;
268
- displayCondition?: Expression;
269
- }
270
- export declare const initLikertScaleGroup: (key: string, rows: Array<LikertGroupRow>, scaleOptions: {
271
- key: string;
272
- className?: string | undefined;
273
- content: Map<string, string>;
274
- }[], stackOnSmallScreen?: boolean | undefined, displayCondition?: Expression | undefined) => ItemGroupComponent;
275
- export declare const initResponsiveSingleChoiceArray: (rgKey: string, props: ResponsiveSingleChoiceArrayProps, displayCondition?: Expression | undefined) => ItemGroupComponent;
276
- export declare const initResponsiveBipolarLikertArray: (rgKey: string, props: ResponsiveBipolarLikertArrayProps, displayCondition?: Expression | undefined) => ItemGroupComponent;
277
- export declare const initLikertScaleItem: (key: string, options: {
278
- key: string;
279
- className?: string | undefined;
280
- content?: Map<string, string> | undefined;
281
- disabled?: Expression | undefined;
282
- }[], stackOnSmallScreen?: boolean | undefined, displayCondition?: Expression | undefined) => ItemGroupComponent;
283
- export {};