case-editor-tools 1.6.0 → 1.6.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.
- package/expression-utils/studyEngineExpressions.d.ts +2 -0
- package/expression-utils/studyEngineExpressions.js +1 -0
- package/expression-utils/studyEngineExpressions.js.map +1 -1
- package/package.json +1 -1
- package/surveys/index.js +1 -1
- package/surveys/responseTypeGenerators/likertGroupComponents.js +21 -1
- package/surveys/responseTypeGenerators/likertGroupComponents.js.map +1 -1
- package/surveys/responseTypeGenerators/optionGroupComponents.js +7 -1
- package/surveys/responseTypeGenerators/optionGroupComponents.js.map +1 -1
- package/surveys/survey-items.js +3 -0
- package/surveys/survey-items.js.map +1 -1
- package/surveys/types/index.js +1 -0
- package/surveys/types/index.js.map +1 -1
- package/surveys/types/item-properties.d.ts +15 -9
- package/surveys/types/item-properties.js +4 -0
- package/surveys/types/item-properties.js.map +1 -1
- package/surveys/utils/componentGenerators.d.ts +3 -3
- package/surveys/utils/componentGenerators.js +12 -2
- package/surveys/utils/componentGenerators.js.map +1 -1
- package/surveys/utils/optionDefGenerators.d.ts +4 -4
- package/surveys/utils/simple-generators.d.ts +3 -2
- package/surveys/utils/simple-generators.js +25 -0
- package/surveys/utils/simple-generators.js.map +1 -1
- package/surveys/utils/simple-question-editor.d.ts +2 -2
|
@@ -49,6 +49,7 @@ export declare const NativeStudyEngineExpressions: {
|
|
|
49
49
|
not: (arg: Expression) => Expression;
|
|
50
50
|
timestampWithOffset: (delta: Duration, reference?: number | Expression) => Expression;
|
|
51
51
|
parseValueAsNum: (valueRef: Expression | string | number) => Expression;
|
|
52
|
+
generateRandomNumber: (min: number, max: number) => Expression;
|
|
52
53
|
externalEventEval: (serviceName: string, route?: string, expectFloat?: boolean) => Expression;
|
|
53
54
|
};
|
|
54
55
|
export declare const StudyEngineActions: {
|
|
@@ -202,5 +203,6 @@ export declare const StudyEngine: {
|
|
|
202
203
|
not: (arg: Expression) => Expression;
|
|
203
204
|
timestampWithOffset: (delta: Duration, reference?: number | Expression) => Expression;
|
|
204
205
|
parseValueAsNum: (valueRef: Expression | string | number) => Expression;
|
|
206
|
+
generateRandomNumber: (min: number, max: number) => Expression;
|
|
205
207
|
externalEventEval: (serviceName: string, route?: string, expectFloat?: boolean) => Expression;
|
|
206
208
|
};
|
|
@@ -451,6 +451,7 @@ const NativeStudyEngineExpressions = {
|
|
|
451
451
|
// Other
|
|
452
452
|
timestampWithOffset,
|
|
453
453
|
parseValueAsNum,
|
|
454
|
+
generateRandomNumber: (min, max) => expressionUtils_expressionGen.generateExpression('generateRandomNumber', undefined, min, max),
|
|
454
455
|
externalEventEval,
|
|
455
456
|
};
|
|
456
457
|
const StudyEngineActions = {
|
|
@@ -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.6.
|
|
4
|
+
"version": "1.6.2",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": "github:case-framework/case-editor-tools",
|
package/surveys/index.js
CHANGED
|
@@ -11,8 +11,8 @@ require('../index-8e5154bb.js');
|
|
|
11
11
|
require('./utils/randomKeyGenerator.js');
|
|
12
12
|
require('../logger/logger.js');
|
|
13
13
|
require('./utils/componentGenerators.js');
|
|
14
|
-
require('./utils/simple-generators.js');
|
|
15
14
|
require('./types/item-properties.js');
|
|
15
|
+
require('./utils/simple-generators.js');
|
|
16
16
|
require('../types/duration.js');
|
|
17
17
|
require('../constants/key-definitions.js');
|
|
18
18
|
require('./utils/simple-question-editor.js');
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var surveys_surveyEditor_componentEditor = require('../survey-editor/component-editor.js');
|
|
6
|
+
require('../../logger/logger.js');
|
|
7
|
+
require('../../index-8e5154bb.js');
|
|
6
8
|
var surveys_utils_randomKeyGenerator = require('../utils/randomKeyGenerator.js');
|
|
7
9
|
var surveys_utils_simpleGenerators = require('../utils/simple-generators.js');
|
|
8
|
-
require('../types/item-properties.js');
|
|
10
|
+
var surveys_types_itemProperties = require('../types/item-properties.js');
|
|
9
11
|
|
|
10
12
|
const initLikertScaleGroup = (key, rows, scaleOptions, stackOnSmallScreen, displayCondition) => {
|
|
11
13
|
const groupEdit = new surveys_surveyEditor_componentEditor.ComponentEditor(undefined, {
|
|
@@ -114,6 +116,9 @@ const initResponsiveSingleChoiceArray = (rgKey, props, displayCondition) => {
|
|
|
114
116
|
style: option.className ? [{ key: 'className', value: option.className }] : undefined,
|
|
115
117
|
content: !Array.isArray(option.content) ? surveys_utils_simpleGenerators.generateLocStrings(option.content) : undefined,
|
|
116
118
|
items: Array.isArray(option.content) ? option.content.map((cont, index) => {
|
|
119
|
+
if (surveys_types_itemProperties.isExpressionDisplayProp(cont)) {
|
|
120
|
+
return surveys_utils_simpleGenerators.generateExpressionDisplayComp(index.toFixed(), cont);
|
|
121
|
+
}
|
|
117
122
|
return {
|
|
118
123
|
key: index.toFixed(),
|
|
119
124
|
role: 'text',
|
|
@@ -168,6 +173,9 @@ const initResponsiveSingleChoiceArray = (rgKey, props, displayCondition) => {
|
|
|
168
173
|
style: rowStyles.length > 0 ? rowStyles : undefined,
|
|
169
174
|
content: !Array.isArray(row.content) ? surveys_utils_simpleGenerators.generateLocStrings(row.content) : undefined,
|
|
170
175
|
items: Array.isArray(row.content) ? row.content.map((cont, index) => {
|
|
176
|
+
if (surveys_types_itemProperties.isExpressionDisplayProp(cont)) {
|
|
177
|
+
return surveys_utils_simpleGenerators.generateExpressionDisplayComp(index.toFixed(), cont);
|
|
178
|
+
}
|
|
171
179
|
return {
|
|
172
180
|
key: index.toFixed(),
|
|
173
181
|
role: 'text',
|
|
@@ -278,6 +286,9 @@ const initResponsiveBipolarLikertArray = (rgKey, props, displayCondition) => {
|
|
|
278
286
|
role: 'start',
|
|
279
287
|
content: !Array.isArray(row.startLabel) ? surveys_utils_simpleGenerators.generateLocStrings(row.startLabel) : undefined,
|
|
280
288
|
items: Array.isArray(row.startLabel) ? row.startLabel.map((cont, index) => {
|
|
289
|
+
if (surveys_types_itemProperties.isExpressionDisplayProp(cont)) {
|
|
290
|
+
return surveys_utils_simpleGenerators.generateExpressionDisplayComp(index.toFixed(), cont);
|
|
291
|
+
}
|
|
281
292
|
return {
|
|
282
293
|
key: index.toFixed(),
|
|
283
294
|
role: 'text',
|
|
@@ -291,6 +302,9 @@ const initResponsiveBipolarLikertArray = (rgKey, props, displayCondition) => {
|
|
|
291
302
|
role: 'end',
|
|
292
303
|
content: !Array.isArray(row.endLabel) ? surveys_utils_simpleGenerators.generateLocStrings(row.endLabel) : undefined,
|
|
293
304
|
items: Array.isArray(row.endLabel) ? row.endLabel.map((cont, index) => {
|
|
305
|
+
if (surveys_types_itemProperties.isExpressionDisplayProp(cont)) {
|
|
306
|
+
return surveys_utils_simpleGenerators.generateExpressionDisplayComp(index.toFixed(), cont);
|
|
307
|
+
}
|
|
294
308
|
return {
|
|
295
309
|
key: index.toFixed(),
|
|
296
310
|
role: 'text',
|
|
@@ -346,6 +360,9 @@ const initResponsiveMatrixItem = (rgKey, props, displayCondition) => {
|
|
|
346
360
|
role: 'category',
|
|
347
361
|
content: !Array.isArray(option.label) ? surveys_utils_simpleGenerators.generateLocStrings(option.label) : undefined,
|
|
348
362
|
items: Array.isArray(option.label) ? option.label.map((cont, index) => {
|
|
363
|
+
if (surveys_types_itemProperties.isExpressionDisplayProp(cont)) {
|
|
364
|
+
return surveys_utils_simpleGenerators.generateExpressionDisplayComp(index.toFixed(), cont);
|
|
365
|
+
}
|
|
349
366
|
return {
|
|
350
367
|
key: index.toFixed(),
|
|
351
368
|
role: 'text',
|
|
@@ -389,6 +406,9 @@ const initResponsiveMatrixItem = (rgKey, props, displayCondition) => {
|
|
|
389
406
|
style: rowStyles.length > 0 ? rowStyles : undefined,
|
|
390
407
|
content: !Array.isArray(row.label) ? surveys_utils_simpleGenerators.generateLocStrings(row.label) : undefined,
|
|
391
408
|
items: Array.isArray(row.label) ? row.label.map((cont, index) => {
|
|
409
|
+
if (surveys_types_itemProperties.isExpressionDisplayProp(cont)) {
|
|
410
|
+
return surveys_utils_simpleGenerators.generateExpressionDisplayComp(index.toFixed(), cont);
|
|
411
|
+
}
|
|
392
412
|
return {
|
|
393
413
|
key: index.toFixed(),
|
|
394
414
|
role: 'text',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"likertGroupComponents.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"likertGroupComponents.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var surveys_surveyEditor_componentEditor = require('../survey-editor/component-editor.js');
|
|
6
|
+
require('../../logger/logger.js');
|
|
7
|
+
require('../../index-8e5154bb.js');
|
|
6
8
|
var surveys_utils_simpleGenerators = require('../utils/simple-generators.js');
|
|
7
|
-
require('../types/item-properties.js');
|
|
9
|
+
var surveys_types_itemProperties = require('../types/item-properties.js');
|
|
8
10
|
require('../utils/randomKeyGenerator.js');
|
|
9
11
|
|
|
10
12
|
const optionDefToItemComponent = (optionDef) => {
|
|
@@ -60,6 +62,10 @@ const optionDefToItemComponent = (optionDef) => {
|
|
|
60
62
|
if (optionDef.items) {
|
|
61
63
|
if (optionDef.role === 'text') {
|
|
62
64
|
optionDef.items.forEach((item, index) => {
|
|
65
|
+
if (surveys_types_itemProperties.isExpressionDisplayProp(item)) {
|
|
66
|
+
optEditor.addItemComponent(surveys_utils_simpleGenerators.generateExpressionDisplayComp(index.toFixed(), item));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
63
69
|
const textItem = item;
|
|
64
70
|
optEditor.addItemComponent({
|
|
65
71
|
key: index.toFixed(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optionGroupComponents.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"optionGroupComponents.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/surveys/survey-items.js
CHANGED
|
@@ -264,6 +264,9 @@ const generateConsentQuestion = (props) => {
|
|
|
264
264
|
if (surveys_types_itemProperties.isDateDisplayComponentProp(item)) {
|
|
265
265
|
return surveys_utils_simpleGenerators.generateDateDisplayComp(index.toFixed(), item);
|
|
266
266
|
}
|
|
267
|
+
if (surveys_types_itemProperties.isExpressionDisplayProp(item)) {
|
|
268
|
+
return surveys_utils_simpleGenerators.generateExpressionDisplayComp(index.toFixed(), item);
|
|
269
|
+
}
|
|
267
270
|
return {
|
|
268
271
|
key: index.toFixed(),
|
|
269
272
|
role: 'text',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"survey-items.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"survey-items.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/surveys/types/index.js
CHANGED
|
@@ -19,5 +19,6 @@ require('../survey-editor/survey-editor.js');
|
|
|
19
19
|
exports.Group = surveys_types_group.Group;
|
|
20
20
|
exports.Item = surveys_types_item.Item;
|
|
21
21
|
exports.isDateDisplayComponentProp = surveys_types_itemProperties.isDateDisplayComponentProp;
|
|
22
|
+
exports.isExpressionDisplayProp = surveys_types_itemProperties.isExpressionDisplayProp;
|
|
22
23
|
exports.SurveyDefinition = surveys_types_surveyDefinition.SurveyDefinition;
|
|
23
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -10,12 +10,18 @@ export interface DateDisplayComponentProp {
|
|
|
10
10
|
dateFormat: string;
|
|
11
11
|
className?: string;
|
|
12
12
|
}
|
|
13
|
+
export interface ExpressionDisplayProp {
|
|
14
|
+
languageCodes: string[];
|
|
15
|
+
expression: Expression;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
13
18
|
export declare const isDateDisplayComponentProp: (value: DateDisplayComponentProp | any) => value is DateDisplayComponentProp;
|
|
19
|
+
export declare const isExpressionDisplayProp: (value: ExpressionDisplayProp | any) => value is ExpressionDisplayProp;
|
|
14
20
|
export interface OptionDef {
|
|
15
21
|
key: string;
|
|
16
22
|
role: string;
|
|
17
23
|
content?: Map<string, string>;
|
|
18
|
-
items?: Array<StyledTextComponentProp> | Array<OptionDef>;
|
|
24
|
+
items?: Array<StyledTextComponentProp | ExpressionDisplayProp> | Array<OptionDef>;
|
|
19
25
|
description?: Map<string, string>;
|
|
20
26
|
displayCondition?: Expression;
|
|
21
27
|
disabled?: Expression;
|
|
@@ -29,7 +35,7 @@ export interface GenericQuestionProps {
|
|
|
29
35
|
parentKey: string;
|
|
30
36
|
itemKey: string;
|
|
31
37
|
version?: number;
|
|
32
|
-
questionText: Map<string, string> | Array<StyledTextComponentProp | DateDisplayComponentProp>;
|
|
38
|
+
questionText: Map<string, string> | Array<StyledTextComponentProp | DateDisplayComponentProp | ExpressionDisplayProp>;
|
|
33
39
|
questionSubText?: Map<string, string>;
|
|
34
40
|
titleClassName?: string;
|
|
35
41
|
helpGroupContent?: Array<{
|
|
@@ -119,7 +125,7 @@ export declare type ClozeQuestionProps = ClozeProps & GenericQuestionProps;
|
|
|
119
125
|
* Consent Question
|
|
120
126
|
*/
|
|
121
127
|
export interface ConsentProps {
|
|
122
|
-
checkBoxLabel: Map<string, string> | Array<StyledTextComponentProp | DateDisplayComponentProp>;
|
|
128
|
+
checkBoxLabel: Map<string, string> | Array<StyledTextComponentProp | DateDisplayComponentProp | ExpressionDisplayProp>;
|
|
123
129
|
dialogTitle: Map<string, string>;
|
|
124
130
|
dialogContent: Map<string, string>;
|
|
125
131
|
acceptBtn: Map<string, string>;
|
|
@@ -135,12 +141,12 @@ export interface ResponsiveSingleChoiceArrayProps {
|
|
|
135
141
|
scaleOptions: Array<{
|
|
136
142
|
key: string;
|
|
137
143
|
className?: string;
|
|
138
|
-
content: Map<string, string> | StyledTextComponentProp
|
|
144
|
+
content: Map<string, string> | Array<StyledTextComponentProp | ExpressionDisplayProp>;
|
|
139
145
|
}>;
|
|
140
146
|
rows: Array<{
|
|
141
147
|
key: string;
|
|
142
148
|
displayCondition?: Expression;
|
|
143
|
-
content: Map<string, string> | StyledTextComponentProp
|
|
149
|
+
content: Map<string, string> | Array<StyledTextComponentProp | ExpressionDisplayProp>;
|
|
144
150
|
horizontalModeProps?: {
|
|
145
151
|
labelPlacement?: 'none' | 'top' | 'bottom';
|
|
146
152
|
className?: string;
|
|
@@ -187,8 +193,8 @@ export interface ResponsiveBipolarLikertArrayProps {
|
|
|
187
193
|
}>;
|
|
188
194
|
rows: Array<{
|
|
189
195
|
key: string;
|
|
190
|
-
startLabel: Map<string, string> | StyledTextComponentProp
|
|
191
|
-
endLabel: Map<string, string> | StyledTextComponentProp
|
|
196
|
+
startLabel: Map<string, string> | Array<StyledTextComponentProp | ExpressionDisplayProp>;
|
|
197
|
+
endLabel: Map<string, string> | Array<StyledTextComponentProp | ExpressionDisplayProp>;
|
|
192
198
|
displayCondition?: Expression;
|
|
193
199
|
withLabelRowModeProps?: {
|
|
194
200
|
className?: string;
|
|
@@ -234,12 +240,12 @@ export interface ResponsiveMatrixProps {
|
|
|
234
240
|
breakpoint?: 'sm' | 'md' | 'lg' | 'xl';
|
|
235
241
|
columns: Array<{
|
|
236
242
|
key: string;
|
|
237
|
-
label: Map<string, string> | StyledTextComponentProp
|
|
243
|
+
label: Map<string, string> | Array<StyledTextComponentProp | ExpressionDisplayProp>;
|
|
238
244
|
}>;
|
|
239
245
|
rows: Array<{
|
|
240
246
|
key: string;
|
|
241
247
|
role: 'row' | 'category';
|
|
242
|
-
label: Map<string, string> | StyledTextComponentProp
|
|
248
|
+
label: Map<string, string> | Array<StyledTextComponentProp | ExpressionDisplayProp>;
|
|
243
249
|
displayCondition?: Expression;
|
|
244
250
|
className?: string;
|
|
245
251
|
}>;
|
|
@@ -4,7 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const isDateDisplayComponentProp = (value) => {
|
|
6
6
|
return typeof (value) === 'object' && value.date !== undefined && value.dateFormat !== undefined && value.languageCodes !== undefined;
|
|
7
|
+
};
|
|
8
|
+
const isExpressionDisplayProp = (value) => {
|
|
9
|
+
return typeof (value) === 'object' && value.expression !== undefined && value.languageCodes !== undefined;
|
|
7
10
|
};
|
|
8
11
|
|
|
9
12
|
exports.isDateDisplayComponentProp = isDateDisplayComponentProp;
|
|
13
|
+
exports.isExpressionDisplayProp = isExpressionDisplayProp;
|
|
10
14
|
//# sourceMappingURL=item-properties.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item-properties.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"item-properties.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Expression, ItemComponent } from "survey-engine/data_types";
|
|
2
|
-
import { StyledTextComponentProp } from "../types/item-properties";
|
|
2
|
+
import { ExpressionDisplayProp, StyledTextComponentProp } from "../types/item-properties";
|
|
3
3
|
export interface CommonProps {
|
|
4
4
|
key?: string;
|
|
5
|
-
content?: Map<string, string> | StyledTextComponentProp
|
|
5
|
+
content?: Map<string, string> | Array<StyledTextComponentProp | ExpressionDisplayProp>;
|
|
6
6
|
displayCondition?: Expression;
|
|
7
7
|
}
|
|
8
8
|
export interface TextProps extends CommonProps {
|
|
9
|
-
content: Map<string, string>;
|
|
9
|
+
content: Map<string, string> | Array<StyledTextComponentProp | ExpressionDisplayProp>;
|
|
10
10
|
variant?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'li';
|
|
11
11
|
className?: string;
|
|
12
12
|
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var surveys_types_itemProperties = require('../types/item-properties.js');
|
|
5
6
|
var surveys_utils_randomKeyGenerator = require('./randomKeyGenerator.js');
|
|
6
7
|
var surveys_utils_simpleGenerators = require('./simple-generators.js');
|
|
7
8
|
require('../survey-editor/component-editor.js');
|
|
8
|
-
require('../types/item-properties.js');
|
|
9
9
|
|
|
10
10
|
const text = (props) => {
|
|
11
11
|
var _a;
|
|
@@ -20,11 +20,21 @@ const text = (props) => {
|
|
|
20
20
|
key: 'variant', value: props.variant
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
+
const content = !Array.isArray(props.content) ? surveys_utils_simpleGenerators.generateLocStrings(props.content) : undefined;
|
|
24
|
+
const items = Array.isArray(props.content) ? props.content.map((item, index) => {
|
|
25
|
+
return surveys_types_itemProperties.isExpressionDisplayProp(item) ? surveys_utils_simpleGenerators.generateExpressionDisplayComp(surveys_utils_randomKeyGenerator.generateRandomKey(6), item) : {
|
|
26
|
+
key: index.toFixed(),
|
|
27
|
+
role: 'text',
|
|
28
|
+
content: surveys_utils_simpleGenerators.generateLocStrings(item.content),
|
|
29
|
+
style: item.className ? [{ key: 'className', value: item.className }] : undefined,
|
|
30
|
+
};
|
|
31
|
+
}) : undefined;
|
|
23
32
|
return {
|
|
24
33
|
key: (_a = props.key) !== null && _a !== void 0 ? _a : surveys_utils_randomKeyGenerator.generateRandomKey(3),
|
|
25
34
|
role: 'text',
|
|
26
35
|
style: styles.length > 0 ? styles : undefined,
|
|
27
|
-
content:
|
|
36
|
+
content: content,
|
|
37
|
+
items: items,
|
|
28
38
|
displayCondition: props.displayCondition,
|
|
29
39
|
};
|
|
30
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"componentGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Expression } from "survey-engine/data_types";
|
|
2
|
-
import { ClozeProps, DateInputProps, NumericInputProps, OptionDef, StyledTextComponentProp, TextInputProps, TimeInputProps } from "../types/item-properties";
|
|
2
|
+
import { ClozeProps, DateInputProps, ExpressionDisplayProp, NumericInputProps, OptionDef, StyledTextComponentProp, TextInputProps, TimeInputProps } from "../types/item-properties";
|
|
3
3
|
interface CommonProps {
|
|
4
4
|
key?: string;
|
|
5
|
-
content?: Map<string, string> | StyledTextComponentProp
|
|
5
|
+
content?: Map<string, string> | Array<StyledTextComponentProp | ExpressionDisplayProp>;
|
|
6
6
|
displayCondition?: Expression;
|
|
7
7
|
}
|
|
8
8
|
interface OptionProps {
|
|
@@ -14,7 +14,7 @@ interface OptionTextProps extends CommonProps {
|
|
|
14
14
|
className?: string;
|
|
15
15
|
}
|
|
16
16
|
export declare const SingleChoiceOptionTypes: {
|
|
17
|
-
option: (key: string, content: Map<string, string> | StyledTextComponentProp
|
|
17
|
+
option: (key: string, content: Map<string, string> | Array<StyledTextComponentProp | ExpressionDisplayProp>, extraProps?: OptionProps) => OptionDef;
|
|
18
18
|
textInput: (props: TextInputProps & {
|
|
19
19
|
key: string;
|
|
20
20
|
displayCondition?: Expression;
|
|
@@ -40,7 +40,7 @@ export declare const SingleChoiceOptionTypes: {
|
|
|
40
40
|
}) => OptionDef;
|
|
41
41
|
};
|
|
42
42
|
export declare const MultipleChoiceOptionTypes: {
|
|
43
|
-
option: (key: string, content: Map<string, string> | StyledTextComponentProp
|
|
43
|
+
option: (key: string, content: Map<string, string> | Array<StyledTextComponentProp | ExpressionDisplayProp>, extraProps?: OptionProps) => OptionDef;
|
|
44
44
|
subtitle: (props: OptionTextProps) => OptionDef;
|
|
45
45
|
textInput: (props: TextInputProps & {
|
|
46
46
|
key: string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { LocalizedString, ItemComponent, ExpressionName, Expression, ItemGroupComponent, SurveySingleItem } from "survey-engine/data_types";
|
|
2
|
-
import { DateDisplayComponentProp, StyledTextComponentProp } from "../types/item-properties";
|
|
2
|
+
import { DateDisplayComponentProp, ExpressionDisplayProp, StyledTextComponentProp } from "../types/item-properties";
|
|
3
3
|
export declare const generateLocStrings: (translations: Map<string, string>) => LocalizedString[];
|
|
4
4
|
export declare const generateDateDisplayComp: (key: string, item: DateDisplayComponentProp) => ItemComponent;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const generateExpressionDisplayComp: (key: string, item: ExpressionDisplayProp) => ItemComponent;
|
|
6
|
+
export declare const generateTitleComponent: (content: Map<string, string> | Array<StyledTextComponentProp | DateDisplayComponentProp | ExpressionDisplayProp>, description?: Map<string, string>, className?: string) => ItemComponent;
|
|
6
7
|
export declare const generateHelpGroupComponent: (items: Array<{
|
|
7
8
|
content: Map<string, string>;
|
|
8
9
|
style?: Array<{
|
|
@@ -42,6 +42,27 @@ const generateDateDisplayComp = (key, item) => {
|
|
|
42
42
|
style: styleArray,
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
|
+
const generateExpressionDisplayComp = (key, item) => {
|
|
46
|
+
const styleArray = [];
|
|
47
|
+
if (item.className) {
|
|
48
|
+
styleArray.push({ key: 'className', value: item.className });
|
|
49
|
+
}
|
|
50
|
+
const locString = new Array();
|
|
51
|
+
const exp = item.expression;
|
|
52
|
+
item.languageCodes.forEach((code) => {
|
|
53
|
+
const translatedItem = {
|
|
54
|
+
code: code,
|
|
55
|
+
parts: [{ dtype: 'exp', exp: exp }]
|
|
56
|
+
};
|
|
57
|
+
locString.push(translatedItem);
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
key: key,
|
|
61
|
+
role: 'text',
|
|
62
|
+
content: locString,
|
|
63
|
+
style: styleArray,
|
|
64
|
+
};
|
|
65
|
+
};
|
|
45
66
|
const generateTitleComponent = (content, description, className) => {
|
|
46
67
|
let items = undefined;
|
|
47
68
|
let currentContent = undefined;
|
|
@@ -50,6 +71,9 @@ const generateTitleComponent = (content, description, className) => {
|
|
|
50
71
|
if (surveys_types_itemProperties.isDateDisplayComponentProp(item)) {
|
|
51
72
|
return generateDateDisplayComp(index.toFixed(), item);
|
|
52
73
|
}
|
|
74
|
+
if (surveys_types_itemProperties.isExpressionDisplayProp(item)) {
|
|
75
|
+
return generateExpressionDisplayComp(index.toFixed(), item);
|
|
76
|
+
}
|
|
53
77
|
return {
|
|
54
78
|
key: index.toFixed(),
|
|
55
79
|
role: 'text',
|
|
@@ -123,6 +147,7 @@ const generatePageBreak = (parentKey, key) => {
|
|
|
123
147
|
|
|
124
148
|
exports.expWithArgs = expWithArgs;
|
|
125
149
|
exports.generateDateDisplayComp = generateDateDisplayComp;
|
|
150
|
+
exports.generateExpressionDisplayComp = generateExpressionDisplayComp;
|
|
126
151
|
exports.generateHelpGroupComponent = generateHelpGroupComponent;
|
|
127
152
|
exports.generateLocStrings = generateLocStrings;
|
|
128
153
|
exports.generatePageBreak = generatePageBreak;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-generators.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"simple-generators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConfidentialMode, Expression, ItemComponent } from "survey-engine/data_types";
|
|
2
2
|
import { ItemEditor } from "../survey-editor/item-editor";
|
|
3
|
-
import { DateDisplayComponentProp, StyledTextComponentProp } from "../types/item-properties";
|
|
3
|
+
import { DateDisplayComponentProp, ExpressionDisplayProp, StyledTextComponentProp } from "../types/item-properties";
|
|
4
4
|
export declare class SimpleQuestionEditor {
|
|
5
5
|
editor: ItemEditor;
|
|
6
6
|
key: string;
|
|
@@ -8,7 +8,7 @@ export declare class SimpleQuestionEditor {
|
|
|
8
8
|
[key: string]: string;
|
|
9
9
|
});
|
|
10
10
|
getItem(): import("survey-engine/data_types").SurveyItem;
|
|
11
|
-
setTitle(title: Map<string, string> | Array<StyledTextComponentProp | DateDisplayComponentProp>, description?: Map<string, string>, className?: string): void;
|
|
11
|
+
setTitle(title: Map<string, string> | Array<StyledTextComponentProp | DateDisplayComponentProp | ExpressionDisplayProp>, description?: Map<string, string>, className?: string): void;
|
|
12
12
|
setCondition(exp: Expression): void;
|
|
13
13
|
addDisplayComponent(comp: ItemComponent, atPosition?: number): void;
|
|
14
14
|
addHasResponseValidation(): void;
|