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,36 +1,13 @@
1
- import { ItemGroupComponent, Expression, ComponentProperties, ItemComponent, SurveyItem, ExpressionArg, Validation } from "survey-engine/lib/data_types";
2
- import { Duration } from "../types/duration";
3
- import { OptionDef, StyledTextComponentProp } from "./types/item-properties";
4
- interface GenericQuestionProps {
5
- parentKey: string;
6
- itemKey: string;
7
- version?: number;
8
- questionText: Map<string, string> | Array<StyledTextComponentProp>;
9
- questionSubText?: Map<string, string>;
10
- titleClassName?: string;
11
- helpGroupContent?: Array<{
12
- content: Map<string, string>;
13
- style?: Array<{
14
- key: string;
15
- value: string;
16
- }>;
17
- }>;
18
- condition?: Expression;
19
- topDisplayCompoments?: Array<ItemComponent>;
20
- bottomDisplayCompoments?: Array<ItemComponent>;
21
- isRequired?: boolean;
22
- footnoteText?: Map<string, string>;
23
- customValidations?: Array<Validation>;
24
- }
25
- interface NumericInputQuestionProps extends GenericQuestionProps {
26
- content: Map<string, string>;
27
- contentBehindInput?: boolean;
28
- componentProperties?: ComponentProperties;
29
- inputMaxWidth?: string;
30
- }
1
+ import { ItemGroupComponent, Expression, ItemComponent, SurveyItem, ExpressionArg, ResponseComponent } from "survey-engine/data_types";
2
+ import { ClozeQuestionProps, ConsentQuestionProps, DateInputQuestionProps, GenericQuestionProps, MultiLineTextInput, NumericInputQuestionProps, OptionDef, ResponsiveBipolarLikertArrayQuestionProps, ResponsiveSingleChoiceArrayQuestionProps, TextInputQuestionProps, TimeInputQuestionProps } from "./types/item-properties";
3
+ import { LikertGroupRow } from "./responseTypeGenerators/likertGroupComponents";
31
4
  interface OptionQuestionProps extends GenericQuestionProps {
32
5
  responseOptions: Array<OptionDef>;
33
6
  }
7
+ interface DropDownQuestionProps extends GenericQuestionProps {
8
+ responseOptions: Array<OptionDef>;
9
+ placeholder?: Map<string, string>;
10
+ }
34
11
  interface LikertGroupQuestionProps extends GenericQuestionProps {
35
12
  rows: Array<LikertGroupRow>;
36
13
  scaleOptions: Array<{
@@ -40,98 +17,6 @@ interface LikertGroupQuestionProps extends GenericQuestionProps {
40
17
  }>;
41
18
  stackOnSmallScreen?: boolean;
42
19
  }
43
- declare type ResponsiveSingleChoiceArrayVariant = 'horizontal' | 'vertical' | 'table';
44
- declare type ResponsiveBipolarLikertArrayVariant = 'withLabelRow' | 'vertical' | 'table';
45
- interface ResponsiveSingleChoiceArrayProps {
46
- scaleOptions: Array<{
47
- key: string;
48
- className?: string;
49
- content: Map<string, string> | StyledTextComponentProp[];
50
- }>;
51
- rows: Array<{
52
- key: string;
53
- content: Map<string, string> | StyledTextComponentProp[];
54
- horizontalModeProps?: {
55
- labelPlacement?: 'none' | 'top' | 'bottom';
56
- className?: string;
57
- };
58
- verticalModeProps?: {
59
- className?: string;
60
- };
61
- tableModeProps?: {
62
- className?: string;
63
- };
64
- }>;
65
- defaultMode: ResponsiveSingleChoiceArrayVariant;
66
- responsiveModes?: {
67
- sm?: ResponsiveSingleChoiceArrayVariant;
68
- md?: ResponsiveSingleChoiceArrayVariant;
69
- lg?: ResponsiveSingleChoiceArrayVariant;
70
- xl?: ResponsiveSingleChoiceArrayVariant;
71
- xxl?: ResponsiveSingleChoiceArrayVariant;
72
- };
73
- rgClassName?: string;
74
- tableModeProps?: {
75
- className?: string;
76
- layout?: "fixed";
77
- firstColWidth?: string;
78
- optionHeaderClassName?: string;
79
- hideRowBorder?: boolean;
80
- };
81
- horizontalModeProps?: {
82
- hideRowBorder?: boolean;
83
- };
84
- verticalModeProps?: {
85
- hideRowBorder?: boolean;
86
- useReverseOptionOrder?: boolean;
87
- };
88
- }
89
- interface ResponsiveBipolarLikertArrayProps {
90
- scaleOptions: Array<{
91
- key: string;
92
- }>;
93
- rows: Array<{
94
- key: string;
95
- startLabel: Map<string, string> | StyledTextComponentProp[];
96
- endLabel: Map<string, string> | StyledTextComponentProp[];
97
- withLabelRowModeProps?: {
98
- className?: string;
99
- };
100
- verticalModeProps?: {
101
- className?: string;
102
- };
103
- tableModeProps?: {
104
- className?: string;
105
- };
106
- }>;
107
- defaultMode: ResponsiveBipolarLikertArrayVariant;
108
- responsiveModes?: {
109
- sm?: ResponsiveBipolarLikertArrayVariant;
110
- md?: ResponsiveBipolarLikertArrayVariant;
111
- lg?: ResponsiveBipolarLikertArrayVariant;
112
- xl?: ResponsiveBipolarLikertArrayVariant;
113
- xxl?: ResponsiveBipolarLikertArrayVariant;
114
- };
115
- rgClassName?: string;
116
- tableModeProps?: {
117
- className?: string;
118
- layout?: "fixed";
119
- labelColWidth?: string;
120
- hideRowBorder?: boolean;
121
- };
122
- withLabelRowModeProps?: {
123
- hideRowBorder?: boolean;
124
- maxLabelWidth?: string;
125
- useBottomLabel?: boolean;
126
- };
127
- verticalModeProps?: {
128
- hideRowBorder?: boolean;
129
- };
130
- }
131
- interface ResponsiveSingleChoiceArrayQuestionProps extends GenericQuestionProps, ResponsiveSingleChoiceArrayProps {
132
- }
133
- interface ResponsiveBipolarLikertArrayQuestionProps extends GenericQuestionProps, ResponsiveBipolarLikertArrayProps {
134
- }
135
20
  interface NumericSliderProps extends GenericQuestionProps {
136
21
  sliderLabel: Map<string, string>;
137
22
  noResponseLabel: Map<string, string>;
@@ -139,22 +24,12 @@ interface NumericSliderProps extends GenericQuestionProps {
139
24
  max?: number | ExpressionArg;
140
25
  stepSize?: number | ExpressionArg;
141
26
  }
142
- interface DatePickerInput extends GenericQuestionProps {
143
- dateInputMode: 'YMD' | 'YM' | 'Y';
144
- inputLabelText?: Map<string, string>;
145
- placeholderText?: Map<string, string>;
146
- minRelativeDate?: {
147
- reference?: number | Expression;
148
- delta: Duration;
149
- };
150
- maxRelativeDate?: {
151
- reference?: number | Expression;
152
- delta: Duration;
153
- };
27
+ interface CustomResponseItem extends ResponseComponent {
28
+ mapToRole?: 'singleChoiceGroup' | 'multipleChoiceGroup' | 'input';
29
+ items?: ItemComponent[];
154
30
  }
155
- interface MultiLineTextInput extends GenericQuestionProps {
156
- inputLabelText?: Map<string, string>;
157
- placeholderText?: Map<string, string>;
31
+ interface CustomQuestionProps extends GenericQuestionProps {
32
+ responseItemDefs: CustomResponseItem[];
158
33
  }
159
34
  interface DisplayProps {
160
35
  parentKey: string;
@@ -162,71 +37,6 @@ interface DisplayProps {
162
37
  content: Array<ItemComponent>;
163
38
  condition?: Expression;
164
39
  }
165
- export declare const SurveyItems: {
166
- singleChoice: (props: OptionQuestionProps) => SurveyItem;
167
- responsiveSingleChoiceArray: (props: ResponsiveSingleChoiceArrayQuestionProps) => SurveyItem;
168
- responsiveBipolarLikertArray: (props: ResponsiveBipolarLikertArrayQuestionProps) => SurveyItem;
169
- multipleChoice: (props: OptionQuestionProps) => SurveyItem;
170
- simpleLikertGroup: (props: LikertGroupQuestionProps) => SurveyItem;
171
- dateInput: (props: DatePickerInput) => SurveyItem;
172
- multilineTextInput: (props: MultiLineTextInput) => SurveyItem;
173
- dropDown: (props: OptionQuestionProps) => SurveyItem;
174
- numericSlider: (props: NumericSliderProps) => SurveyItem;
175
- numericInput: (props: NumericInputQuestionProps) => SurveyItem;
176
- display: (props: DisplayProps) => SurveyItem;
177
- surveyEnd: (parentKey: string, content: Map<string, string>, condition?: Expression | undefined) => SurveyItem;
178
- };
179
- export declare const initSingleChoiceGroup: (key: string, optionItems: OptionDef[], order?: Expression | undefined) => ItemGroupComponent;
180
- export declare const initMultipleChoiceGroup: (key: string, optionItems: OptionDef[], order?: Expression | undefined) => ItemGroupComponent;
181
- 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;
182
- export declare const initSliderCategoricalGroup: (key: string, optionItems: OptionDef[], order?: Expression | undefined, groupDisabled?: Expression | undefined) => ItemGroupComponent;
183
- interface HeaderRow {
184
- role: 'headerRow';
185
- key: string;
186
- displayCondition?: Expression;
187
- disabled?: Expression;
188
- cells: Array<{
189
- role: 'text';
190
- key: string;
191
- content?: Map<string, string>;
192
- description?: Map<string, string>;
193
- }>;
194
- }
195
- interface RadioRow {
196
- role: 'radioRow';
197
- key: string;
198
- displayCondition?: Expression;
199
- disabled?: Expression;
200
- cells: Array<{
201
- role: 'label' | 'option';
202
- key: string;
203
- content?: Map<string, string>;
204
- description?: Map<string, string>;
205
- }>;
206
- }
207
- export interface ResponseRowCell {
208
- role: 'label' | 'check' | 'input' | 'numberInput' | 'dropDownGroup';
209
- key: string;
210
- content?: Map<string, string>;
211
- description?: Map<string, string>;
212
- properties?: ComponentProperties;
213
- items?: Array<{
214
- role: 'option';
215
- key: string;
216
- content?: Map<string, string>;
217
- disabled?: Expression;
218
- displayCondition?: Expression;
219
- }>;
220
- }
221
- interface ResponseRow {
222
- role: 'responseRow';
223
- key: string;
224
- displayCondition?: Expression;
225
- disabled?: Expression;
226
- cells: Array<ResponseRowCell>;
227
- }
228
- declare type MatrixRow = HeaderRow | RadioRow | ResponseRow;
229
- export declare const initMatrixQuestion: (key: string, rows: Array<MatrixRow>, order?: Expression | undefined) => ItemGroupComponent;
230
40
  interface EQ5DHealthSliderProps {
231
41
  role: 'eq5d-health-indicator';
232
42
  key: string;
@@ -238,29 +48,25 @@ interface EQ5DHealthSliderProps {
238
48
  minHealthText: Map<string, string>;
239
49
  }
240
50
  export declare const initEQ5DHealthIndicatorQuestion: (props: EQ5DHealthSliderProps) => ItemGroupComponent;
241
- interface LikertGroupRow {
242
- key: string;
243
- content: Map<string, string>;
244
- descriptions?: ItemComponent[];
245
- hideTopBorder?: boolean;
246
- hideLabels?: boolean;
247
- optionDisabled?: Array<{
248
- optionKey: string;
249
- exp: Expression;
250
- }>;
251
- displayCondition?: Expression;
252
- }
253
- export declare const initLikertScaleGroup: (key: string, rows: Array<LikertGroupRow>, scaleOptions: {
254
- key: string;
255
- className?: string | undefined;
256
- content: Map<string, string>;
257
- }[], stackOnSmallScreen?: boolean | undefined, displayCondition?: Expression | undefined) => ItemGroupComponent;
258
- export declare const initResponsiveSingleChoiceArray: (rgKey: string, props: ResponsiveSingleChoiceArrayProps, displayCondition?: Expression | undefined) => ItemGroupComponent;
259
- export declare const initResponsiveBipolarLikertArray: (rgKey: string, props: ResponsiveBipolarLikertArrayProps, displayCondition?: Expression | undefined) => ItemGroupComponent;
260
- export declare const initLikertScaleItem: (key: string, options: {
261
- key: string;
262
- className?: string | undefined;
263
- content?: Map<string, string> | undefined;
264
- disabled?: Expression | undefined;
265
- }[], stackOnSmallScreen?: boolean | undefined, displayCondition?: Expression | undefined) => ItemGroupComponent;
51
+ export declare const SurveyItems: {
52
+ consent: (props: ConsentQuestionProps) => SurveyItem;
53
+ singleChoice: (props: OptionQuestionProps) => SurveyItem;
54
+ responsiveSingleChoiceArray: (props: ResponsiveSingleChoiceArrayQuestionProps) => SurveyItem;
55
+ responsiveBipolarLikertArray: (props: ResponsiveBipolarLikertArrayQuestionProps) => SurveyItem;
56
+ multipleChoice: (props: OptionQuestionProps) => SurveyItem;
57
+ dateInput: (props: DateInputQuestionProps) => SurveyItem;
58
+ timeInput: (props: TimeInputQuestionProps) => SurveyItem;
59
+ textInput: (props: TextInputQuestionProps) => SurveyItem;
60
+ clozeQuestion: (props: ClozeQuestionProps) => SurveyItem;
61
+ numericInput: (props: NumericInputQuestionProps) => SurveyItem;
62
+ multilineTextInput: (props: MultiLineTextInput) => SurveyItem;
63
+ dropDown: (props: DropDownQuestionProps) => SurveyItem;
64
+ numericSlider: (props: NumericSliderProps) => SurveyItem;
65
+ display: (props: DisplayProps) => SurveyItem;
66
+ surveyEnd: (parentKey: string, content: Map<string, string>, condition?: Expression | undefined) => SurveyItem;
67
+ customQuestion: (props: CustomQuestionProps) => SurveyItem;
68
+ old: {
69
+ simpleLikertGroup: (props: LikertGroupQuestionProps) => SurveyItem;
70
+ };
71
+ };
266
72
  export {};