@media-quest/builder 0.0.22 → 0.0.23
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/package.json +1 -1
- package/src/Builder-option.ts +66 -66
- package/src/Builder-page.spec.ts +320 -320
- package/src/Builder-page.ts +257 -257
- package/src/Builder-question.spec.ts +68 -68
- package/src/Builder-question.ts +101 -101
- package/src/Builder-schema.spec.ts +357 -306
- package/src/Builder-schema.ts +287 -254
- package/src/Builder-text.spec.ts +24 -24
- package/src/Builder-text.ts +57 -57
- package/src/BuilderMainImageDto.ts +7 -7
- package/src/BuilderMainText.ts +81 -81
- package/src/BuilderMainVideoDto.ts +10 -10
- package/src/BuilderObject.ts +61 -61
- package/src/BuilderTag.ts +97 -97
- package/src/builder-compiler.ts +14 -0
- package/src/codebook.ts +72 -72
- package/src/media-files.ts +28 -28
- package/src/primitives/page-prefix.ts +58 -58
- package/src/primitives/prefix.spec.ts +5 -5
- package/src/primitives/schema-prefix.ts +52 -52
- package/src/primitives/varID.ts +11 -11
- package/src/public-api.ts +3 -1
- package/src/rulebuilder/Builder-rule.spec.ts +322 -322
- package/src/rulebuilder/Builder-rule.ts +190 -190
- package/src/rulebuilder/RuleAction.ts +106 -106
- package/src/rulebuilder/RuleBuilder-test-utils.ts +316 -316
- package/src/rulebuilder/RuleInput.ts +44 -44
- package/src/rulebuilder/RuleVariable.ts +49 -49
- package/src/rulebuilder/SingleSelectItem.ts +135 -135
- package/src/rulebuilder/condition/Builder-condition-group.spec.ts +47 -47
- package/src/rulebuilder/condition/Builder-condition-group.ts +118 -118
- package/src/rulebuilder/condition/Builder-condition.spec.ts +195 -195
- package/src/rulebuilder/condition/Builder-condition.ts +208 -208
- package/src/rulebuilder/condition/Builder-operator.spec.ts +9 -9
- package/src/rulebuilder/condition/Builder-operator.ts +31 -31
- package/src/rulebuilder/index.ts +22 -22
- package/src/rulebuilder/jump-to-action-manager.ts +33 -33
- package/src/rulebuilder/multi-select-item.ts +73 -73
- package/src/rulebuilder/page-action-manager.ts +31 -31
- package/src/rulebuilder/rule2/Rule2.ts +211 -211
- package/src/rulebuilder/tag-action-manager.spec.ts +44 -44
- package/src/rulebuilder/tag-action-manager.ts +28 -28
- package/src/schema-config.ts +25 -25
- package/src/theme/AbstractThemeCompiler.ts +7 -7
- package/src/theme/IDefaultTheme.ts +226 -226
- package/src/theme/css-theme.ts +7 -7
- package/src/theme/default-theme-compiler.ts +358 -358
- package/src/theme/icon-urls.ts +29 -29
- package/src/theme/theme-utils.ts +57 -57
- package/src/theme/theme1.spec.ts +52 -52
- package/src/variable/mq-variable.spec.ts +91 -0
- package/src/{mq-variable.ts → variable/mq-variable.ts} +63 -61
- package/src/variable/sum-score-variable.ts +56 -0
- package/tsconfig.json +15 -15
- package/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
package/src/Builder-option.ts
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
import { BuilderObjectId, BuilderObject } from "./BuilderObject";
|
|
2
|
-
import type { BuilderOptionTheme } from "./theme/IDefaultTheme";
|
|
3
|
-
import { DefaultTheme } from "./theme/IDefaultTheme";
|
|
4
|
-
import { AudioFile } from "./media-files";
|
|
5
|
-
|
|
6
|
-
export interface BuilderOptionDto {
|
|
7
|
-
readonly id: BuilderObjectId.QuestionOptionID;
|
|
8
|
-
readonly value: number;
|
|
9
|
-
readonly label: string;
|
|
10
|
-
readonly labelAudio?: AudioFile;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class BuilderOption extends BuilderObject<"builder-question-option", BuilderOptionDto> {
|
|
14
|
-
readonly objectType = "builder-question-option";
|
|
15
|
-
theme: BuilderOptionTheme = DefaultTheme.responseButtons;
|
|
16
|
-
|
|
17
|
-
id: BuilderObjectId.QuestionOptionID;
|
|
18
|
-
value: number;
|
|
19
|
-
label = "";
|
|
20
|
-
private _labelAudioFile: AudioFile | false = false;
|
|
21
|
-
get labelAudioFile() {
|
|
22
|
-
return this._labelAudioFile;
|
|
23
|
-
}
|
|
24
|
-
set labelAudioFile(audioFile: AudioFile | false) {
|
|
25
|
-
this._labelAudioFile = audioFile;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
private constructor(dto: BuilderOptionDto) {
|
|
29
|
-
super(dto);
|
|
30
|
-
this.id = dto.id;
|
|
31
|
-
this.value = dto.value;
|
|
32
|
-
this.label = dto.label;
|
|
33
|
-
// this.theme = dto.theme;
|
|
34
|
-
}
|
|
35
|
-
public static create(value: number, label: string) {
|
|
36
|
-
const id = BuilderObjectId.questionOptionId();
|
|
37
|
-
const dto: BuilderOptionDto = {
|
|
38
|
-
id,
|
|
39
|
-
value,
|
|
40
|
-
label,
|
|
41
|
-
};
|
|
42
|
-
const instance = new BuilderOption(dto);
|
|
43
|
-
return instance;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public static fromJson(dto: BuilderOptionDto) {
|
|
47
|
-
const instance = new BuilderOption(dto);
|
|
48
|
-
return instance;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
toJson(): BuilderOptionDto {
|
|
52
|
-
const dto: BuilderOptionDto = {
|
|
53
|
-
id: this.id,
|
|
54
|
-
value: this.value,
|
|
55
|
-
label: this.label,
|
|
56
|
-
};
|
|
57
|
-
return dto;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
clone(): BuilderOptionDto {
|
|
61
|
-
const cloneId = BuilderObjectId.questionOptionId();
|
|
62
|
-
const dto = this.toJson();
|
|
63
|
-
const cloneDto: BuilderOptionDto = { ...dto, id: cloneId };
|
|
64
|
-
return cloneDto;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
1
|
+
import { BuilderObjectId, BuilderObject } from "./BuilderObject";
|
|
2
|
+
import type { BuilderOptionTheme } from "./theme/IDefaultTheme";
|
|
3
|
+
import { DefaultTheme } from "./theme/IDefaultTheme";
|
|
4
|
+
import { AudioFile } from "./media-files";
|
|
5
|
+
|
|
6
|
+
export interface BuilderOptionDto {
|
|
7
|
+
readonly id: BuilderObjectId.QuestionOptionID;
|
|
8
|
+
readonly value: number;
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly labelAudio?: AudioFile;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class BuilderOption extends BuilderObject<"builder-question-option", BuilderOptionDto> {
|
|
14
|
+
readonly objectType = "builder-question-option";
|
|
15
|
+
theme: BuilderOptionTheme = DefaultTheme.responseButtons;
|
|
16
|
+
|
|
17
|
+
id: BuilderObjectId.QuestionOptionID;
|
|
18
|
+
value: number;
|
|
19
|
+
label = "";
|
|
20
|
+
private _labelAudioFile: AudioFile | false = false;
|
|
21
|
+
get labelAudioFile() {
|
|
22
|
+
return this._labelAudioFile;
|
|
23
|
+
}
|
|
24
|
+
set labelAudioFile(audioFile: AudioFile | false) {
|
|
25
|
+
this._labelAudioFile = audioFile;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private constructor(dto: BuilderOptionDto) {
|
|
29
|
+
super(dto);
|
|
30
|
+
this.id = dto.id;
|
|
31
|
+
this.value = dto.value;
|
|
32
|
+
this.label = dto.label;
|
|
33
|
+
// this.theme = dto.theme;
|
|
34
|
+
}
|
|
35
|
+
public static create(value: number, label: string) {
|
|
36
|
+
const id = BuilderObjectId.questionOptionId();
|
|
37
|
+
const dto: BuilderOptionDto = {
|
|
38
|
+
id,
|
|
39
|
+
value,
|
|
40
|
+
label,
|
|
41
|
+
};
|
|
42
|
+
const instance = new BuilderOption(dto);
|
|
43
|
+
return instance;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public static fromJson(dto: BuilderOptionDto) {
|
|
47
|
+
const instance = new BuilderOption(dto);
|
|
48
|
+
return instance;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
toJson(): BuilderOptionDto {
|
|
52
|
+
const dto: BuilderOptionDto = {
|
|
53
|
+
id: this.id,
|
|
54
|
+
value: this.value,
|
|
55
|
+
label: this.label,
|
|
56
|
+
};
|
|
57
|
+
return dto;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
clone(): BuilderOptionDto {
|
|
61
|
+
const cloneId = BuilderObjectId.questionOptionId();
|
|
62
|
+
const dto = this.toJson();
|
|
63
|
+
const cloneDto: BuilderOptionDto = { ...dto, id: cloneId };
|
|
64
|
+
return cloneDto;
|
|
65
|
+
}
|
|
66
|
+
}
|