case-editor-tools 1.0.0-beta.35 → 1.0.0-beta.39

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.
@@ -10,5 +10,7 @@ export declare const sliderCategoricalKey = "scc";
10
10
  export declare const inputKey = "ic";
11
11
  export declare const numericInputKey = "num";
12
12
  export declare const datePickerKey = "date";
13
+ export declare const timeInputKey = "time";
13
14
  export declare const matrixKey = "mat";
14
15
  export declare const clozeKey = "cloze";
16
+ export declare const consentKey = "con";
@@ -14,10 +14,13 @@ const sliderCategoricalKey = "scc";
14
14
  const inputKey = "ic";
15
15
  const numericInputKey = "num";
16
16
  const datePickerKey = "date";
17
+ const timeInputKey = "time";
17
18
  const matrixKey = "mat";
18
- const clozeKey = "cloze";
19
+ const clozeKey = "cloze";
20
+ const consentKey = "con";
19
21
 
20
22
  exports.clozeKey = clozeKey;
23
+ exports.consentKey = consentKey;
21
24
  exports.datePickerKey = datePickerKey;
22
25
  exports.dropDownKey = dropDownKey;
23
26
  exports.inputKey = inputKey;
@@ -31,4 +34,5 @@ exports.responsiveBipolarLikertArrayKey = responsiveBipolarLikertArrayKey;
31
34
  exports.responsiveSingleChoiceArrayKey = responsiveSingleChoiceArrayKey;
32
35
  exports.singleChoiceKey = singleChoiceKey;
33
36
  exports.sliderCategoricalKey = sliderCategoricalKey;
37
+ exports.timeInputKey = timeInputKey;
34
38
  //# sourceMappingURL=key-definitions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"key-definitions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"key-definitions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -72,6 +72,10 @@ export declare const StudyEngineActions: {
72
72
  removeAll: () => Expression;
73
73
  remove: (messageType: string) => Expression;
74
74
  };
75
+ confidentialResponses: {
76
+ removeByKey: (key: string) => Expression;
77
+ removeAll: () => Expression;
78
+ };
75
79
  stopParticipation: () => Expression;
76
80
  finishParticipation: () => Expression;
77
81
  };
@@ -86,6 +90,9 @@ export declare const StudyEngine: {
86
90
  none: (itemKey: string, ...optionKeys: string[]) => Expression;
87
91
  all: (itemKey: string, ...optionKeys: string[]) => Expression;
88
92
  };
93
+ consent: {
94
+ accepted: (itemKey: string) => Expression;
95
+ };
89
96
  survey: {
90
97
  isActive: (surveyKey: string) => Expression;
91
98
  validFromOlderThan: (surveyKey: string, delta: Duration, reference?: number | Expression | undefined) => Expression;
@@ -127,6 +134,10 @@ export declare const StudyEngine: {
127
134
  removeAll: () => Expression;
128
135
  remove: (messageType: string) => Expression;
129
136
  };
137
+ confidentialResponses: {
138
+ removeByKey: (key: string) => Expression;
139
+ removeAll: () => Expression;
140
+ };
130
141
  stopParticipation: () => Expression;
131
142
  finishParticipation: () => Expression;
132
143
  };
@@ -236,6 +236,21 @@ const INIT_REPORT = (reportKey) => {
236
236
  const CANCEL_REPORT = (reportKey) => {
237
237
  return expressionUtils_expressionGen.generateExpression('CANCEL_REPORT', undefined, reportKey);
238
238
  };
239
+ /**
240
+ * Remove the confidential responses with this key for the participant
241
+ * @param key key of the confidential responses that should be removed
242
+ * @returns
243
+ */
244
+ const REMOVE_CONFIDENTIAL_RESPONSE_BY_KEY = (key) => {
245
+ return expressionUtils_expressionGen.generateExpression('REMOVE_CONFIDENTIAL_RESPONSE_BY_KEY', undefined, key);
246
+ };
247
+ /**
248
+ * Remove all confidential responses for the participant
249
+ * @returns
250
+ */
251
+ const REMOVE_ALL_CONFIDENTIAL_RESPONSES = () => {
252
+ return expressionUtils_expressionGen.generateExpression('REMOVE_ALL_CONFIDENTIAL_RESPONSES', undefined);
253
+ };
239
254
  /**
240
255
  * Update one value attribute in a report. If report was not initialized, one will be added to the list.
241
256
  * @param reportKey
@@ -288,6 +303,9 @@ const multipleChoiceOptionsSelected = (itemKey, ...optionKeys) => expressionUtil
288
303
  const multipleChoiceAllOfTheseSelected = (itemKey, ...optionKeys) => and(...optionKeys.map(option => expressionUtils_expressionGen.generateExpression('responseHasKeysAny', undefined, itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.multipleChoiceKey].join('.'), option)));
289
304
  const multipleChoiceOnlyOtherKeysSelected = (itemKey, ...optionKeys) => expressionUtils_expressionGen.generateExpression('responseHasOnlyKeysOtherThan', undefined, itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.multipleChoiceKey].join('.'), ...optionKeys);
290
305
  const singleChoiceOnlyOtherOptionSelected = (itemKey, ...optionKeys) => expressionUtils_expressionGen.generateExpression('responseHasOnlyKeysOtherThan', undefined, itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.singleChoiceKey].join('.'), ...optionKeys);
306
+ const consentAcceptedCondition = (itemKey) => {
307
+ return hasResponseKey(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.consentKey].join('.'));
308
+ };
291
309
  const stopParticipation = () => UPDATE_STUDY_STATUS('inactive');
292
310
  const finishParticipation = () => UPDATE_STUDY_STATUS('finished');
293
311
  /**
@@ -397,6 +415,10 @@ const StudyEngineActions = {
397
415
  removeAll: REMOVE_ALL_MESSAGES,
398
416
  remove: REMOVE_MESSAGES_BY_TYPE,
399
417
  },
418
+ confidentialResponses: {
419
+ removeByKey: REMOVE_CONFIDENTIAL_RESPONSE_BY_KEY,
420
+ removeAll: REMOVE_ALL_CONFIDENTIAL_RESPONSES,
421
+ },
400
422
  // Extra methods:
401
423
  stopParticipation,
402
424
  finishParticipation,
@@ -409,6 +431,8 @@ const StudyEngine = Object.assign(Object.assign(Object.assign({}, NativeStudyEng
409
431
  any: multipleChoiceOptionsSelected,
410
432
  none: multipleChoiceOnlyOtherKeysSelected,
411
433
  all: multipleChoiceAllOfTheseSelected,
434
+ }, consent: {
435
+ accepted: consentAcceptedCondition,
412
436
  }, survey: {
413
437
  isActive: hasSurveyKeyActive,
414
438
  validFromOlderThan: hasSurveyKeyValidFromOlderThan,
@@ -1 +1 @@
1
- {"version":3,"file":"studyEngineExpressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"studyEngineExpressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "case-editor-tools",
3
3
  "description": "Javascript tools to simplify survey and study coding for CASE.",
4
- "version": "1.0.0-beta.35",
4
+ "version": "1.0.0-beta.39",
5
5
  "main": "index.js",
6
6
  "license": "Apache-2.0",
7
7
  "repository": "github:case-framework/case-editor-tools",
@@ -32,6 +32,9 @@ const optionDefToItemComponent = (optionDef) => {
32
32
  case 'numberInput':
33
33
  optEditor.setDType('number');
34
34
  break;
35
+ case 'timeInput':
36
+ optEditor.setDType('number');
37
+ break;
35
38
  }
36
39
  if (optionDef.displayCondition) {
37
40
  optEditor.setDisplayCondition(optionDef.displayCondition);
@@ -1 +1 @@
1
- {"version":3,"file":"optionGroupComponents.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"optionGroupComponents.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -64,6 +64,9 @@ export declare const SurveyEngine: {
64
64
  getNumValue: (itemKey: string, optionKey: string) => Expression;
65
65
  regexCheck: (itemKey: string, optionKey: string, pattern: string) => Expression;
66
66
  };
67
+ consentQuestion: {
68
+ accepted: (itemKey: string) => Expression;
69
+ };
67
70
  textInput: {
68
71
  regexCheck: (itemKey: string, pattern: string) => Expression;
69
72
  };
@@ -360,6 +360,9 @@ const textInputRegexCheck = (itemKey, pattern) => {
360
360
  const multilineTextInputRegexCheck = (itemKey, pattern) => {
361
361
  return checkResponseValueWithRegex(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.inputKey].join('.'), pattern);
362
362
  };
363
+ const consentAcceptedCondition = (itemKey) => {
364
+ return hasResponse(itemKey, [constants_keyDefinitions.responseGroupKey, constants_keyDefinitions.consentKey].join('.'));
365
+ };
363
366
  const NativeSurveyEngineExpressions = {
364
367
  getters: {
365
368
  // root data reference:
@@ -426,6 +429,8 @@ const SurveyEngine = Object.assign(Object.assign({}, NativeSurveyEngineExpressio
426
429
  getDateValue: multipleChoiceGetNumOptionValue,
427
430
  getNumValue: multipleChoiceGetNumOptionValue,
428
431
  regexCheck: mulitpleChoiceTextInputRegexCheck,
432
+ }, consentQuestion: {
433
+ accepted: consentAcceptedCondition,
429
434
  }, textInput: {
430
435
  regexCheck: textInputRegexCheck,
431
436
  }, multilineTextInput: {
@@ -1 +1 @@
1
- {"version":3,"file":"survey-engine-expressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"survey-engine-expressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { ItemGroupComponent, Expression, ItemComponent, SurveyItem, ExpressionArg, ResponseComponent } from "survey-engine/data_types";
2
- import { ClozeQuestionProps, DateInputQuestionProps, GenericQuestionProps, MultiLineTextInput, NumericInputQuestionProps, OptionDef, ResponsiveBipolarLikertArrayQuestionProps, ResponsiveSingleChoiceArrayQuestionProps, TextInputQuestionProps } from "./types/item-properties";
2
+ import { ClozeQuestionProps, ConsentQuestionProps, DateInputQuestionProps, GenericQuestionProps, MultiLineTextInput, NumericInputQuestionProps, OptionDef, ResponsiveBipolarLikertArrayQuestionProps, ResponsiveSingleChoiceArrayQuestionProps, TextInputQuestionProps, TimeInputQuestionProps } from "./types/item-properties";
3
3
  import { LikertGroupRow } from "./responseTypeGenerators/likertGroupComponents";
4
4
  interface OptionQuestionProps extends GenericQuestionProps {
5
5
  responseOptions: Array<OptionDef>;
@@ -45,11 +45,13 @@ interface EQ5DHealthSliderProps {
45
45
  }
46
46
  export declare const initEQ5DHealthIndicatorQuestion: (props: EQ5DHealthSliderProps) => ItemGroupComponent;
47
47
  export declare const SurveyItems: {
48
+ consent: (props: ConsentQuestionProps) => SurveyItem;
48
49
  singleChoice: (props: OptionQuestionProps) => SurveyItem;
49
50
  responsiveSingleChoiceArray: (props: ResponsiveSingleChoiceArrayQuestionProps) => SurveyItem;
50
51
  responsiveBipolarLikertArray: (props: ResponsiveBipolarLikertArrayQuestionProps) => SurveyItem;
51
52
  multipleChoice: (props: OptionQuestionProps) => SurveyItem;
52
53
  dateInput: (props: DateInputQuestionProps) => SurveyItem;
54
+ timeInput: (props: TimeInputQuestionProps) => SurveyItem;
53
55
  textInput: (props: TextInputQuestionProps) => SurveyItem;
54
56
  clozeQuestion: (props: ClozeQuestionProps) => SurveyItem;
55
57
  numericInput: (props: NumericInputQuestionProps) => SurveyItem;
@@ -10,11 +10,11 @@ var constants_keyDefinitions = require('../constants/key-definitions.js');
10
10
  var surveys_utils_simpleGenerators = require('./utils/simple-generators.js');
11
11
  var surveys_utils_simpleQuestionEditor = require('./utils/simple-question-editor.js');
12
12
  var surveys_surveyEngineExpressions = require('./survey-engine-expressions.js');
13
+ var surveys_types_itemProperties = require('./types/item-properties.js');
13
14
  var surveys_responseTypeGenerators_optionGroupComponents = require('./responseTypeGenerators/optionGroupComponents.js');
14
15
  var surveys_responseTypeGenerators_likertGroupComponents = require('./responseTypeGenerators/likertGroupComponents.js');
15
16
  require('./utils/randomKeyGenerator.js');
16
17
  require('../logger/logger.js');
17
- require('./types/item-properties.js');
18
18
  require('../expression-utils/expressionGen.js');
19
19
 
20
20
  const commonQuestionGenerator = (props, rg_inner) => {
@@ -159,6 +159,36 @@ const generateDatePickerInput = (props) => {
159
159
  };
160
160
  return commonQuestionGenerator(props, rg_inner);
161
161
  };
162
+ const generateTimeInput = (props) => {
163
+ const style = [];
164
+ if (props.minTime) {
165
+ style.push({
166
+ key: 'minTime', value: props.minTime,
167
+ });
168
+ }
169
+ if (props.maxTime) {
170
+ style.push({
171
+ key: 'maxTime', value: props.maxTime,
172
+ });
173
+ }
174
+ if (props.defaultValue) {
175
+ style.push({
176
+ key: 'defaultValue', value: props.defaultValue,
177
+ });
178
+ }
179
+ if (props.labelBehindInput) {
180
+ style.push({ key: 'labelPlacement', value: 'after' });
181
+ }
182
+ const rg_inner = {
183
+ key: constants_keyDefinitions.timeInputKey, role: 'timeInput',
184
+ properties: {
185
+ stepSize: props.step,
186
+ },
187
+ content: props.inputLabelText ? surveys_utils_simpleGenerators.generateLocStrings(props.inputLabelText) : undefined,
188
+ style: style.length > 0 ? style : undefined,
189
+ };
190
+ return commonQuestionGenerator(props, rg_inner);
191
+ };
162
192
  const generateTextInputQuestion = (props) => {
163
193
  const style = [];
164
194
  if (props.maxLength !== undefined) {
@@ -179,6 +209,43 @@ const generateTextInputQuestion = (props) => {
179
209
  };
180
210
  return commonQuestionGenerator(props, rg_inner);
181
211
  };
212
+ const generateConsentQuestion = (props) => {
213
+ const style = props.className ? [{ key: 'className', value: props.className }] : undefined;
214
+ const rg_inner = {
215
+ key: constants_keyDefinitions.consentKey, role: 'consent',
216
+ items: [
217
+ {
218
+ key: 'label', role: 'label',
219
+ content: !Array.isArray(props.checkBoxLabel) ? surveys_utils_simpleGenerators.generateLocStrings(props.checkBoxLabel) : undefined,
220
+ items: Array.isArray(props.checkBoxLabel) ? props.checkBoxLabel.map((item, index) => {
221
+ if (surveys_types_itemProperties.isDateDisplayComponentProp(item)) {
222
+ return surveys_utils_simpleGenerators.generateDateDisplayComp(index.toFixed(), item);
223
+ }
224
+ return {
225
+ key: index.toFixed(),
226
+ role: 'text',
227
+ content: surveys_utils_simpleGenerators.generateLocStrings(item.content),
228
+ style: item.className ? [{ key: 'className', value: item.className }] : undefined
229
+ };
230
+ }) : undefined,
231
+ },
232
+ {
233
+ key: 'title', role: 'title', content: surveys_utils_simpleGenerators.generateLocStrings(props.dialogTitle)
234
+ },
235
+ {
236
+ key: 'content', role: 'content', content: surveys_utils_simpleGenerators.generateLocStrings(props.dialogContent)
237
+ },
238
+ {
239
+ key: 'acceptBtn', role: 'acceptBtn', content: surveys_utils_simpleGenerators.generateLocStrings(props.acceptBtn)
240
+ },
241
+ {
242
+ key: 'rejectBtn', role: 'rejectBtn', content: surveys_utils_simpleGenerators.generateLocStrings(props.rejectBtn)
243
+ },
244
+ ],
245
+ style: style,
246
+ };
247
+ return commonQuestionGenerator(props, rg_inner);
248
+ };
182
249
  const generateMultilineInput = (props) => {
183
250
  const rg_inner = {
184
251
  key: constants_keyDefinitions.inputKey, role: 'multilineTextInput',
@@ -278,11 +345,13 @@ const initEQ5DHealthIndicatorQuestion = (props) => {
278
345
  return groupEdit.getComponent();
279
346
  };
280
347
  const SurveyItems = {
348
+ consent: generateConsentQuestion,
281
349
  singleChoice: generateSingleChoiceQuestion,
282
350
  responsiveSingleChoiceArray: generateResponsiveSingleChoiceArrayQuestion,
283
351
  responsiveBipolarLikertArray: generateResponsiveBipolarLikertArray,
284
352
  multipleChoice: generateMultipleChoiceQuestion,
285
353
  dateInput: generateDatePickerInput,
354
+ timeInput: generateTimeInput,
286
355
  textInput: generateTextInputQuestion,
287
356
  // eq5dSlider: todo,
288
357
  clozeQuestion: generateClozeQuestion,
@@ -1 +1 @@
1
- {"version":3,"file":"survey-items.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"survey-items.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -75,6 +75,18 @@ export interface DateInputProps {
75
75
  };
76
76
  }
77
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;
78
90
  /**
79
91
  * Text Input
80
92
  */
@@ -99,6 +111,18 @@ export interface ClozeProps {
99
111
  items: Array<OptionDef>;
100
112
  }
101
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;
102
126
  /**
103
127
  * Response Single Choice Likert Array
104
128
  */
@@ -1,5 +1,5 @@
1
1
  import { Expression } from "survey-engine/data_types";
2
- import { ClozeProps, DateInputProps, NumericInputProps, OptionDef, StyledTextComponentProp, TextInputProps } from "../types/item-properties";
2
+ import { ClozeProps, DateInputProps, NumericInputProps, OptionDef, StyledTextComponentProp, TextInputProps, TimeInputProps } from "../types/item-properties";
3
3
  interface CommonProps {
4
4
  key?: string;
5
5
  content?: Map<string, string> | StyledTextComponentProp[];
@@ -19,6 +19,10 @@ export declare const SingleChoiceOptionTypes: {
19
19
  key: string;
20
20
  displayCondition?: Expression;
21
21
  }) => OptionDef;
22
+ timeInput: (props: TimeInputProps & {
23
+ key: string;
24
+ displayCondition?: Expression;
25
+ }) => OptionDef;
22
26
  numberInput: (props: NumericInputProps & {
23
27
  key: string;
24
28
  displayCondition?: Expression;
@@ -26,6 +30,7 @@ export declare const SingleChoiceOptionTypes: {
26
30
  cloze: (props: ClozeProps & {
27
31
  key: string;
28
32
  displayCondition?: Expression;
33
+ className?: string;
29
34
  }) => OptionDef;
30
35
  };
31
36
  export declare const MultipleChoiceOptionTypes: {
@@ -35,6 +40,10 @@ export declare const MultipleChoiceOptionTypes: {
35
40
  key: string;
36
41
  displayCondition?: Expression;
37
42
  }) => OptionDef;
43
+ timeInput: (props: TimeInputProps & {
44
+ key: string;
45
+ displayCondition?: Expression;
46
+ }) => OptionDef;
38
47
  numberInput: (props: NumericInputProps & {
39
48
  key: string;
40
49
  displayCondition?: Expression;
@@ -42,6 +51,7 @@ export declare const MultipleChoiceOptionTypes: {
42
51
  cloze: (props: ClozeProps & {
43
52
  key: string;
44
53
  displayCondition?: Expression;
54
+ className?: string;
45
55
  }) => OptionDef;
46
56
  };
47
57
  export declare const ClozeItemTypes: {
@@ -55,6 +65,10 @@ export declare const ClozeItemTypes: {
55
65
  key: string;
56
66
  displayCondition?: Expression;
57
67
  }) => OptionDef;
68
+ timeInput: (props: TimeInputProps & {
69
+ key: string;
70
+ displayCondition?: Expression;
71
+ }) => OptionDef;
58
72
  clozeLineBreak: () => OptionDef;
59
73
  numberInput: (props: NumericInputProps & {
60
74
  key: string;
@@ -116,6 +116,37 @@ const dateInput = (props) => {
116
116
  displayCondition: props.displayCondition,
117
117
  };
118
118
  };
119
+ const timeInput = (props) => {
120
+ const style = [];
121
+ if (props.minTime) {
122
+ style.push({
123
+ key: 'minTime', value: props.minTime,
124
+ });
125
+ }
126
+ if (props.maxTime) {
127
+ style.push({
128
+ key: 'maxTime', value: props.maxTime,
129
+ });
130
+ }
131
+ if (props.defaultValue) {
132
+ style.push({
133
+ key: 'defaultValue', value: props.defaultValue,
134
+ });
135
+ }
136
+ if (props.labelBehindInput) {
137
+ style.push({ key: 'labelPlacement', value: 'after' });
138
+ }
139
+ return {
140
+ key: props.key,
141
+ role: 'timeInput',
142
+ optionProps: {
143
+ stepSize: props.step,
144
+ },
145
+ content: props.inputLabelText,
146
+ displayCondition: props.displayCondition,
147
+ style: style.length > 0 ? style : undefined,
148
+ };
149
+ };
119
150
  const dropDown = (props) => {
120
151
  return {
121
152
  key: props.key,
@@ -125,11 +156,18 @@ const dropDown = (props) => {
125
156
  };
126
157
  };
127
158
  const cloze = (props) => {
159
+ const styles = [];
160
+ if (props.className !== undefined) {
161
+ styles.push({
162
+ key: 'className', value: props.className
163
+ });
164
+ }
128
165
  return {
129
166
  key: props.key,
130
167
  role: 'cloze',
131
168
  items: props.items,
132
169
  displayCondition: props.displayCondition,
170
+ style: styles.length > 0 ? styles : undefined,
133
171
  };
134
172
  };
135
173
  const clozeLineBreak = () => {
@@ -142,6 +180,7 @@ const SingleChoiceOptionTypes = {
142
180
  option,
143
181
  textInput,
144
182
  //dateInput,
183
+ timeInput,
145
184
  numberInput,
146
185
  cloze,
147
186
  };
@@ -149,7 +188,8 @@ const MultipleChoiceOptionTypes = {
149
188
  option,
150
189
  subtitle: multipleChoiceOptionSubtitle,
151
190
  textInput,
152
- // dateInput,
191
+ // dateInput
192
+ timeInput,
153
193
  numberInput,
154
194
  cloze,
155
195
  };
@@ -158,6 +198,7 @@ const ClozeItemTypes = {
158
198
  markdown,
159
199
  textInput,
160
200
  dateInput,
201
+ timeInput,
161
202
  clozeLineBreak,
162
203
  numberInput,
163
204
  dropDown,
@@ -1 +1 @@
1
- {"version":3,"file":"optionDefGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"optionDefGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -31,7 +31,7 @@ const generateDateDisplayComp = (key, item) => {
31
31
  item.languageCodes.forEach((code) => {
32
32
  const translatedItem = {
33
33
  code: code,
34
- parts: [{ exp: dateExp }]
34
+ parts: [{ dtype: 'exp', exp: dateExp }]
35
35
  };
36
36
  locString.push(translatedItem);
37
37
  });