case-editor-tools 1.0.0-beta.36 → 1.0.0-beta.37

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,6 @@ 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";
@@ -14,6 +14,7 @@ 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
19
  const clozeKey = "cloze";
19
20
 
@@ -31,4 +32,5 @@ exports.responsiveBipolarLikertArrayKey = responsiveBipolarLikertArrayKey;
31
32
  exports.responsiveSingleChoiceArrayKey = responsiveSingleChoiceArrayKey;
32
33
  exports.singleChoiceKey = singleChoiceKey;
33
34
  exports.sliderCategoricalKey = sliderCategoricalKey;
35
+ exports.timeInputKey = timeInputKey;
34
36
  //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
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.36",
4
+ "version": "1.0.0-beta.37",
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -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, 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>;
@@ -50,6 +50,7 @@ export declare const SurveyItems: {
50
50
  responsiveBipolarLikertArray: (props: ResponsiveBipolarLikertArrayQuestionProps) => SurveyItem;
51
51
  multipleChoice: (props: OptionQuestionProps) => SurveyItem;
52
52
  dateInput: (props: DateInputQuestionProps) => SurveyItem;
53
+ timeInput: (props: TimeInputQuestionProps) => SurveyItem;
53
54
  textInput: (props: TextInputQuestionProps) => SurveyItem;
54
55
  clozeQuestion: (props: ClozeQuestionProps) => SurveyItem;
55
56
  numericInput: (props: NumericInputQuestionProps) => SurveyItem;
@@ -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) {
@@ -283,6 +313,7 @@ const SurveyItems = {
283
313
  responsiveBipolarLikertArray: generateResponsiveBipolarLikertArray,
284
314
  multipleChoice: generateMultipleChoiceQuestion,
285
315
  dateInput: generateDatePickerInput,
316
+ timeInput: generateTimeInput,
286
317
  textInput: generateTextInputQuestion,
287
318
  // eq5dSlider: todo,
288
319
  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
  */
@@ -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;
@@ -35,6 +39,10 @@ export declare const MultipleChoiceOptionTypes: {
35
39
  key: string;
36
40
  displayCondition?: Expression;
37
41
  }) => OptionDef;
42
+ timeInput: (props: TimeInputProps & {
43
+ key: string;
44
+ displayCondition?: Expression;
45
+ }) => OptionDef;
38
46
  numberInput: (props: NumericInputProps & {
39
47
  key: string;
40
48
  displayCondition?: Expression;
@@ -55,6 +63,10 @@ export declare const ClozeItemTypes: {
55
63
  key: string;
56
64
  displayCondition?: Expression;
57
65
  }) => OptionDef;
66
+ timeInput: (props: TimeInputProps & {
67
+ key: string;
68
+ displayCondition?: Expression;
69
+ }) => OptionDef;
58
70
  clozeLineBreak: () => OptionDef;
59
71
  numberInput: (props: NumericInputProps & {
60
72
  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,
@@ -142,6 +173,7 @@ const SingleChoiceOptionTypes = {
142
173
  option,
143
174
  textInput,
144
175
  //dateInput,
176
+ timeInput,
145
177
  numberInput,
146
178
  cloze,
147
179
  };
@@ -149,7 +181,8 @@ const MultipleChoiceOptionTypes = {
149
181
  option,
150
182
  subtitle: multipleChoiceOptionSubtitle,
151
183
  textInput,
152
- // dateInput,
184
+ // dateInput
185
+ timeInput,
153
186
  numberInput,
154
187
  cloze,
155
188
  };
@@ -158,6 +191,7 @@ const ClozeItemTypes = {
158
191
  markdown,
159
192
  textInput,
160
193
  dateInput,
194
+ timeInput,
161
195
  clozeLineBreak,
162
196
  numberInput,
163
197
  dropDown,
@@ -1 +1 @@
1
- {"version":3,"file":"optionDefGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"optionDefGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}