@media-quest/builder 0.0.39 → 0.0.40
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/dist/public-api.d.ts +82 -99
- package/dist/public-api.js +36 -101
- package/dist/public-api.js.map +1 -1
- package/package.json +29 -29
- package/src/{theme → ARKIV}/button-bar/button-text-utils.ts +233 -233
- package/src/{theme → ARKIV}/button-bar/text-utils.spec.ts +105 -105
- package/src/Builder-option.ts +78 -62
- package/src/Builder-question.ts +98 -98
- package/src/Builder-schema.spec.ts +348 -348
- package/src/Builder-schema.ts +308 -306
- package/src/builder-compiler.ts +14 -20
- package/src/code-book/codebook-variable.ts +27 -27
- package/src/code-book/codebook.ts +89 -89
- package/src/media-files.ts +28 -32
- package/src/page/Builder-page-collection.spec.ts +219 -219
- package/src/page/Builder-page-collection.ts +129 -129
- package/src/page/Builder-page.spec.ts +177 -177
- package/src/page/Builder-page.ts +250 -250
- package/src/primitives/ID.ts +135 -135
- package/src/public-api.ts +29 -30
- package/src/rulebuilder/RuleAction.ts +105 -105
- package/src/schema-config.ts +25 -26
- package/src/sum-score/sum-score-variable-collection.spec.ts +68 -68
- package/src/sum-score/sum-score-variable-collection.ts +101 -101
- package/src/sum-score/sum-score-variable.ts +0 -1
- package/src/sum-score/sum-score.ts +166 -167
- package/src/tag/BuilderTag.ts +45 -45
- package/src/tag/Tag-Collection.ts +53 -53
- package/src/theme/Default-theme.ts +173 -188
- package/src/theme/IDefault-theme.ts +125 -125
- package/src/theme/ThemeCompiler.ts +10 -11
- package/src/theme/default-theme-compiler.spec.ts +31 -31
- package/src/theme/default-theme-compiler.ts +655 -652
- package/src/theme/icon-urls.ts +29 -29
- package/src/theme/icons.ts +117 -117
- package/src/theme/theme-utils.spec.ts +52 -52
- package/src/theme/theme-utils.ts +56 -56
- package/src/theme/theme2.ts +388 -386
- package/tsconfig.json +19 -19
- package/src/Builder-schema-dto.spec.ts +0 -155
- package/src/Builder-schema-dto.ts +0 -86
package/dist/public-api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Condition, PageQueRules, SchemaDto, DStyle } from '@media-quest/engine';
|
|
1
|
+
import { PStyle as PStyle$1, Condition, PageQueRules, SchemaDto, DStyle } from '@media-quest/engine';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Builder objects are complex objects that are embedded inside
|
|
@@ -17,33 +17,29 @@ declare abstract class BuilderObject<T extends BuilderObjectType, Dto extends {}
|
|
|
17
17
|
interface AudioFile {
|
|
18
18
|
readonly kind: "audio-file";
|
|
19
19
|
readonly id: string;
|
|
20
|
-
downloadUrl: string;
|
|
20
|
+
readonly downloadUrl: string;
|
|
21
21
|
readonly duration: number;
|
|
22
22
|
readonly originalFileName: string;
|
|
23
23
|
readonly name: string;
|
|
24
24
|
readonly size: number;
|
|
25
|
-
readonly relativePath?: string;
|
|
26
25
|
}
|
|
27
26
|
interface VideoFile {
|
|
28
27
|
readonly kind: "video-file";
|
|
29
28
|
readonly id: string;
|
|
30
|
-
downloadUrl: string;
|
|
29
|
+
readonly downloadUrl: string;
|
|
31
30
|
readonly duration: number;
|
|
32
31
|
readonly name: string;
|
|
33
32
|
readonly size: number;
|
|
34
33
|
readonly type: string;
|
|
35
34
|
readonly originalFileName: string;
|
|
36
|
-
readonly relativePath?: string;
|
|
37
35
|
}
|
|
38
36
|
interface ImageFile {
|
|
39
37
|
readonly kind: "image-file";
|
|
40
38
|
readonly id: string;
|
|
41
|
-
downloadUrl: string;
|
|
39
|
+
readonly downloadUrl: string;
|
|
42
40
|
readonly name: string;
|
|
43
41
|
readonly size: number;
|
|
44
42
|
readonly type: string;
|
|
45
|
-
readonly originalFileName?: string;
|
|
46
|
-
readonly relativePath?: string;
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
type ID<B extends string> = string & {
|
|
@@ -93,17 +89,19 @@ interface BuilderOptionDto {
|
|
|
93
89
|
readonly value: number;
|
|
94
90
|
readonly label: string;
|
|
95
91
|
readonly labelAudio?: AudioFile;
|
|
92
|
+
readonly cssOverride?: PStyle$1;
|
|
96
93
|
}
|
|
97
94
|
declare class BuilderOption extends BuilderObject<"builder-question-option", BuilderOptionDto> {
|
|
98
95
|
readonly objectType = "builder-question-option";
|
|
99
96
|
id: OptionID;
|
|
100
97
|
value: number;
|
|
101
98
|
label: string;
|
|
99
|
+
cssOverride: PStyle$1;
|
|
102
100
|
private _labelAudioFile;
|
|
103
101
|
get labelAudioFile(): AudioFile | false;
|
|
104
102
|
set labelAudioFile(audioFile: AudioFile | false);
|
|
105
103
|
private constructor();
|
|
106
|
-
static create(value: number, label: string): BuilderOption;
|
|
104
|
+
static create(value: number, label: string, css?: PStyle$1): BuilderOption;
|
|
107
105
|
static fromJson(dto: BuilderOptionDto): BuilderOption;
|
|
108
106
|
toJson(): BuilderOptionDto;
|
|
109
107
|
clone(): BuilderOptionDto;
|
|
@@ -599,89 +597,6 @@ declare class BuilderTag extends BuilderObject<"builder-tag", BuilderTagDto> {
|
|
|
599
597
|
toJson(): BuilderTagDto;
|
|
600
598
|
}
|
|
601
599
|
|
|
602
|
-
interface SumScoreVariableDto {
|
|
603
|
-
id: SumScoreVariableID;
|
|
604
|
-
name: string;
|
|
605
|
-
description: string;
|
|
606
|
-
useAvg: boolean;
|
|
607
|
-
}
|
|
608
|
-
declare class SumScoreVariable extends BuilderObject<"builder-sum-score-variable", SumScoreVariableDto> {
|
|
609
|
-
readonly objectType = "builder-sum-score-variable";
|
|
610
|
-
readonly id: SumScoreVariableID;
|
|
611
|
-
private _useAvg;
|
|
612
|
-
private _name;
|
|
613
|
-
private _description;
|
|
614
|
-
private _error;
|
|
615
|
-
private _usedIn;
|
|
616
|
-
get usedIn(): BuilderPage[];
|
|
617
|
-
static readonly create: (data: {
|
|
618
|
-
name: string;
|
|
619
|
-
description: string;
|
|
620
|
-
useAvg: boolean;
|
|
621
|
-
}) => SumScoreVariable;
|
|
622
|
-
get hasErrors(): boolean;
|
|
623
|
-
static fromDto: (dto: SumScoreVariableDto) => SumScoreVariable;
|
|
624
|
-
private constructor();
|
|
625
|
-
toJson(): SumScoreVariableDto;
|
|
626
|
-
clone(): SumScoreVariableDto;
|
|
627
|
-
get name(): string;
|
|
628
|
-
get description(): string;
|
|
629
|
-
get useAvg(): boolean;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
/**
|
|
633
|
-
* Interface representing a code book question sum-score.
|
|
634
|
-
*
|
|
635
|
-
* @interface
|
|
636
|
-
*/
|
|
637
|
-
interface CodeBookQuestionVariable {
|
|
638
|
-
readonly kind: "codebook-question-variable";
|
|
639
|
-
readonly label: string;
|
|
640
|
-
readonly varId: string;
|
|
641
|
-
readonly pageId: PageID;
|
|
642
|
-
readonly pagePrefix: string;
|
|
643
|
-
readonly modulePrefix: string;
|
|
644
|
-
readonly pagePosition: number;
|
|
645
|
-
readonly options: ReadonlyArray<{
|
|
646
|
-
label: string;
|
|
647
|
-
value: number;
|
|
648
|
-
}>;
|
|
649
|
-
readonly includedInSumScores: ReadonlyArray<SumScoreVariableDto>;
|
|
650
|
-
}
|
|
651
|
-
interface CodebookPredefinedVariable {
|
|
652
|
-
readonly kind: "codebook-predefined-variable";
|
|
653
|
-
readonly modulePrefix: string;
|
|
654
|
-
readonly moduleID: string;
|
|
655
|
-
defaultValue: number;
|
|
656
|
-
options: Array<{
|
|
657
|
-
label: string;
|
|
658
|
-
value: number;
|
|
659
|
-
}>;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
interface BuilderSchemaDto {
|
|
663
|
-
readonly id: SchemaID;
|
|
664
|
-
readonly prefix: SchemaPrefixValue;
|
|
665
|
-
readonly mainImage: ImageFile | false;
|
|
666
|
-
readonly backgroundColor: string;
|
|
667
|
-
readonly name: string;
|
|
668
|
-
readonly pages: ReadonlyArray<BuilderPageDto>;
|
|
669
|
-
readonly baseHeight: number;
|
|
670
|
-
readonly baseWidth: number;
|
|
671
|
-
readonly predefinedVariables?: Array<CodebookPredefinedVariable>;
|
|
672
|
-
readonly sumScoreVariables?: ReadonlyArray<SumScoreVariableDto>;
|
|
673
|
-
readonly rules: ReadonlyArray<BuilderRuleDto>;
|
|
674
|
-
readonly tags: ReadonlyArray<BuilderTagDto>;
|
|
675
|
-
}
|
|
676
|
-
declare const BuilderSchemaDto: {
|
|
677
|
-
blockAutoplayVideo: (dto: BuilderPageDto) => BuilderPageDto;
|
|
678
|
-
overrideAllMediaUrls: (schema: BuilderSchemaDto, options: {
|
|
679
|
-
videoFilesBaseUrl: string;
|
|
680
|
-
audioFilesBaseUrl: string;
|
|
681
|
-
imageFilesBaseUrl: string;
|
|
682
|
-
}) => BuilderSchemaDto;
|
|
683
|
-
};
|
|
684
|
-
|
|
685
600
|
interface ThemeCompiler<ThemeSchema> {
|
|
686
601
|
currentTheme: ThemeSchema;
|
|
687
602
|
allThemes: ThemeSchema[];
|
|
@@ -855,6 +770,66 @@ declare class DefaultThemeCompiler implements ThemeCompiler<IDefaultTheme> {
|
|
|
855
770
|
private compileButton;
|
|
856
771
|
}
|
|
857
772
|
|
|
773
|
+
interface SumScoreVariableDto {
|
|
774
|
+
id: SumScoreVariableID;
|
|
775
|
+
name: string;
|
|
776
|
+
description: string;
|
|
777
|
+
useAvg: boolean;
|
|
778
|
+
}
|
|
779
|
+
declare class SumScoreVariable extends BuilderObject<"builder-sum-score-variable", SumScoreVariableDto> {
|
|
780
|
+
readonly objectType = "builder-sum-score-variable";
|
|
781
|
+
readonly id: SumScoreVariableID;
|
|
782
|
+
private _useAvg;
|
|
783
|
+
private _name;
|
|
784
|
+
private _description;
|
|
785
|
+
private _error;
|
|
786
|
+
private _usedIn;
|
|
787
|
+
get usedIn(): BuilderPage[];
|
|
788
|
+
static readonly create: (data: {
|
|
789
|
+
name: string;
|
|
790
|
+
description: string;
|
|
791
|
+
useAvg: boolean;
|
|
792
|
+
}) => SumScoreVariable;
|
|
793
|
+
get hasErrors(): boolean;
|
|
794
|
+
static fromDto: (dto: SumScoreVariableDto) => SumScoreVariable;
|
|
795
|
+
private constructor();
|
|
796
|
+
toJson(): SumScoreVariableDto;
|
|
797
|
+
clone(): SumScoreVariableDto;
|
|
798
|
+
get name(): string;
|
|
799
|
+
get description(): string;
|
|
800
|
+
get useAvg(): boolean;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* Interface representing a code book question sum-score.
|
|
805
|
+
*
|
|
806
|
+
* @interface
|
|
807
|
+
*/
|
|
808
|
+
interface CodeBookQuestionVariable {
|
|
809
|
+
readonly kind: "codebook-question-variable";
|
|
810
|
+
readonly label: string;
|
|
811
|
+
readonly varId: string;
|
|
812
|
+
readonly pageId: PageID;
|
|
813
|
+
readonly pagePrefix: string;
|
|
814
|
+
readonly modulePrefix: string;
|
|
815
|
+
readonly pagePosition: number;
|
|
816
|
+
readonly options: ReadonlyArray<{
|
|
817
|
+
label: string;
|
|
818
|
+
value: number;
|
|
819
|
+
}>;
|
|
820
|
+
readonly includedInSumScores: ReadonlyArray<SumScoreVariableDto>;
|
|
821
|
+
}
|
|
822
|
+
interface CodebookPredefinedVariable {
|
|
823
|
+
readonly kind: "codebook-predefined-variable";
|
|
824
|
+
readonly modulePrefix: string;
|
|
825
|
+
readonly moduleID: string;
|
|
826
|
+
defaultValue: number;
|
|
827
|
+
options: Array<{
|
|
828
|
+
label: string;
|
|
829
|
+
value: number;
|
|
830
|
+
}>;
|
|
831
|
+
}
|
|
832
|
+
|
|
858
833
|
interface Codebook {
|
|
859
834
|
readonly predefinedVariables: ReadonlyArray<CodebookPredefinedVariable>;
|
|
860
835
|
readonly pageVariables: ReadonlyArray<CodeBookQuestionVariable>;
|
|
@@ -888,14 +863,22 @@ interface CompilerOutput {
|
|
|
888
863
|
interface CompilerOption {
|
|
889
864
|
blockAutoplayQuestion: boolean;
|
|
890
865
|
blockAutoplayVideo: boolean;
|
|
891
|
-
mediaAssets: {
|
|
892
|
-
audioFilesBaseUrl: string;
|
|
893
|
-
videoFilesBaseUrl: string;
|
|
894
|
-
imageFilesBaseUrl: string;
|
|
895
|
-
fileNameStrategy: "id" | "newFileName" | "originalFileName" | "relativePath";
|
|
896
|
-
} | null;
|
|
897
866
|
}
|
|
898
867
|
|
|
868
|
+
interface BuilderSchemaDto {
|
|
869
|
+
readonly id: SchemaID;
|
|
870
|
+
readonly prefix: SchemaPrefixValue;
|
|
871
|
+
readonly mainImage: ImageFile | false;
|
|
872
|
+
readonly backgroundColor: string;
|
|
873
|
+
readonly name: string;
|
|
874
|
+
readonly pages: ReadonlyArray<BuilderPageDto>;
|
|
875
|
+
readonly baseHeight: number;
|
|
876
|
+
readonly baseWidth: number;
|
|
877
|
+
readonly predefinedVariables?: Array<CodebookPredefinedVariable>;
|
|
878
|
+
readonly sumScoreVariables?: ReadonlyArray<SumScoreVariableDto>;
|
|
879
|
+
readonly rules: ReadonlyArray<BuilderRuleDto>;
|
|
880
|
+
readonly tags: ReadonlyArray<BuilderTagDto>;
|
|
881
|
+
}
|
|
899
882
|
declare class BuilderSchema {
|
|
900
883
|
readonly id: SchemaID;
|
|
901
884
|
name: string;
|
|
@@ -1015,4 +998,4 @@ declare class TagCollection implements Iterable<BuilderTag> {
|
|
|
1015
998
|
|
|
1016
999
|
declare const DefaultTheme: IDefaultTheme;
|
|
1017
1000
|
|
|
1018
|
-
export { type AudioFile, BuilderCondition, type BuilderConditionDto, BuilderConditionGroup, type BuilderConditionGroupDto, type BuilderMainImageDto, BuilderMainText, type BuilderMainTextDto, type BuilderMainVideoDto, BuilderOperator, BuilderOption, type BuilderOptionDto, BuilderPage, type BuilderPageDto, type BuilderPageType, BuilderQuestion, type BuilderQuestionDto, type BuilderQuestionType, BuilderRule, type BuilderRuleDto, BuilderSchema, BuilderSchemaDto, BuilderTag, type BuilderTagDto, BuilderText, type BuilderTextDto, CodeBook, type CodeBookQuestionVariable, type Codebook, type CodebookPredefinedVariable, type CompilerOption, type CompilerOutput, ConditionGroupType, DefaultTheme, type ExcludeByPageAction, ExcludeByPageIdSelectItem, type ExcludeByTagAction, ExcludeByTagSelectItem, type ID, type ImageFile, JumpToActionManager, type JumpToPageAction, JumpToPageSelectItem, MultiSelectItem, OperatorSelectItem, OptionID, PageActionManager, PageID, PagePrefix, type PagePrefixValue, QuestionID, RuleCustomVariable, RuleInput, RuleOptionSelectItem, RuleQuestionVariable, type RuleVariable, RuleVariableOption, RuleVariableSelectItem, SchemaConfig, SchemaID, SchemaPrefix, type SchemaPrefixValue, SingleSelectItem, SumScore, type SumScoreAnswer, SumScoreVariable, type SumScoreVariableDto, SumScoreVariableID, TagActionManager, TagCollection, TagID, TextID, VarID, type VideoFile, _CodeBook, createTypedIdSingleton };
|
|
1001
|
+
export { type AudioFile, BuilderCondition, type BuilderConditionDto, BuilderConditionGroup, type BuilderConditionGroupDto, type BuilderMainImageDto, BuilderMainText, type BuilderMainTextDto, type BuilderMainVideoDto, BuilderOperator, BuilderOption, type BuilderOptionDto, BuilderPage, type BuilderPageDto, type BuilderPageType, BuilderQuestion, type BuilderQuestionDto, type BuilderQuestionType, BuilderRule, type BuilderRuleDto, BuilderSchema, type BuilderSchemaDto, BuilderTag, type BuilderTagDto, BuilderText, type BuilderTextDto, CodeBook, type CodeBookQuestionVariable, type Codebook, type CodebookPredefinedVariable, type CompilerOption, type CompilerOutput, ConditionGroupType, DefaultTheme, type ExcludeByPageAction, ExcludeByPageIdSelectItem, type ExcludeByTagAction, ExcludeByTagSelectItem, type ID, type ImageFile, JumpToActionManager, type JumpToPageAction, JumpToPageSelectItem, MultiSelectItem, OperatorSelectItem, OptionID, PageActionManager, PageID, PagePrefix, type PagePrefixValue, QuestionID, RuleCustomVariable, RuleInput, RuleOptionSelectItem, RuleQuestionVariable, type RuleVariable, RuleVariableOption, RuleVariableSelectItem, SchemaConfig, SchemaID, SchemaPrefix, type SchemaPrefixValue, SingleSelectItem, SumScore, type SumScoreAnswer, SumScoreVariable, type SumScoreVariableDto, SumScoreVariableID, TagActionManager, TagCollection, TagID, TextID, VarID, type VideoFile, _CodeBook, createTypedIdSingleton };
|
package/dist/public-api.js
CHANGED
|
@@ -29,7 +29,6 @@ __export(public_api_exports, {
|
|
|
29
29
|
BuilderQuestion: () => BuilderQuestion,
|
|
30
30
|
BuilderRule: () => BuilderRule,
|
|
31
31
|
BuilderSchema: () => BuilderSchema,
|
|
32
|
-
BuilderSchemaDto: () => BuilderSchemaDto,
|
|
33
32
|
BuilderTag: () => BuilderTag,
|
|
34
33
|
BuilderText: () => BuilderText,
|
|
35
34
|
CodeBook: () => CodeBook,
|
|
@@ -150,6 +149,7 @@ var BuilderOption = class _BuilderOption extends BuilderObject {
|
|
|
150
149
|
id;
|
|
151
150
|
value;
|
|
152
151
|
label = "";
|
|
152
|
+
cssOverride = {};
|
|
153
153
|
_labelAudioFile = false;
|
|
154
154
|
get labelAudioFile() {
|
|
155
155
|
return this._labelAudioFile;
|
|
@@ -162,13 +162,17 @@ var BuilderOption = class _BuilderOption extends BuilderObject {
|
|
|
162
162
|
this.id = dto.id;
|
|
163
163
|
this.value = dto.value;
|
|
164
164
|
this.label = dto.label;
|
|
165
|
+
if (dto.cssOverride) {
|
|
166
|
+
this.cssOverride = { ...dto.cssOverride };
|
|
167
|
+
}
|
|
165
168
|
}
|
|
166
|
-
static create(value, label) {
|
|
169
|
+
static create(value, label, css = {}) {
|
|
167
170
|
const id = OptionID.create();
|
|
168
171
|
const dto = {
|
|
169
172
|
id,
|
|
170
173
|
value,
|
|
171
|
-
label
|
|
174
|
+
label,
|
|
175
|
+
cssOverride: css
|
|
172
176
|
};
|
|
173
177
|
const instance = new _BuilderOption(dto);
|
|
174
178
|
return instance;
|
|
@@ -181,7 +185,8 @@ var BuilderOption = class _BuilderOption extends BuilderObject {
|
|
|
181
185
|
const dto = {
|
|
182
186
|
id: this.id,
|
|
183
187
|
value: this.value,
|
|
184
|
-
label: this.label
|
|
188
|
+
label: this.label,
|
|
189
|
+
cssOverride: { ...this.cssOverride }
|
|
185
190
|
};
|
|
186
191
|
return dto;
|
|
187
192
|
}
|
|
@@ -223,7 +228,7 @@ var BuilderQuestion = class _BuilderQuestion extends BuilderObject {
|
|
|
223
228
|
this.options = dto.options.map((o) => BuilderOption.fromJson(o));
|
|
224
229
|
}
|
|
225
230
|
addOption(label, value, atIndex = -1) {
|
|
226
|
-
const option = BuilderOption.create(value, label);
|
|
231
|
+
const option = BuilderOption.create(value, label, {});
|
|
227
232
|
if (atIndex >= 0 && atIndex < this.options.length) {
|
|
228
233
|
this.options.splice(atIndex, 0, option);
|
|
229
234
|
} else {
|
|
@@ -1419,14 +1424,11 @@ var BuilderOptionTheme;
|
|
|
1419
1424
|
const BLUE = "#2F5597";
|
|
1420
1425
|
const BTN_BORDER_WIDTH = 3;
|
|
1421
1426
|
const BTN_BORDER_RADIUS = 10;
|
|
1422
|
-
const BTN_HEIGHT = 130;
|
|
1423
|
-
const BTN_WIDTH_LONG = { _unit: "percent", value: 19 };
|
|
1424
|
-
const BTN_WIDTH_SHORT = { _unit: "percent", value: 15 };
|
|
1425
1427
|
const BTN_BORDER_STYLE = "solid";
|
|
1426
|
-
const FONT_WEIGHT =
|
|
1427
|
-
const FONT_SIZE =
|
|
1428
|
-
const BTN_PADDING_LEFT =
|
|
1429
|
-
const BTN_PADDING_TOP =
|
|
1428
|
+
const FONT_WEIGHT = 600;
|
|
1429
|
+
const FONT_SIZE = 50;
|
|
1430
|
+
const BTN_PADDING_LEFT = 40;
|
|
1431
|
+
const BTN_PADDING_TOP = 40;
|
|
1430
1432
|
const buttonBaseCss = () => ({
|
|
1431
1433
|
css: {
|
|
1432
1434
|
fontWeight: FONT_WEIGHT,
|
|
@@ -1438,8 +1440,6 @@ var BuilderOptionTheme;
|
|
|
1438
1440
|
paddingRight: { _unit: "px", value: BTN_PADDING_LEFT },
|
|
1439
1441
|
borderRadius: { _unit: "px", value: BTN_BORDER_RADIUS },
|
|
1440
1442
|
borderWidth: { _unit: "px", value: BTN_BORDER_WIDTH },
|
|
1441
|
-
width: BTN_WIDTH_LONG,
|
|
1442
|
-
height: { _unit: "px", value: BTN_HEIGHT },
|
|
1443
1443
|
borderStyle: BTN_BORDER_STYLE,
|
|
1444
1444
|
// boxShadow: "3px 3px gray",
|
|
1445
1445
|
position: "relative",
|
|
@@ -1474,8 +1474,7 @@ var BuilderOptionTheme;
|
|
|
1474
1474
|
...css,
|
|
1475
1475
|
backgroundColor: WHITE,
|
|
1476
1476
|
borderColor: LIGHT_BLUE,
|
|
1477
|
-
textColor: BLUE
|
|
1478
|
-
width: BTN_WIDTH_SHORT
|
|
1477
|
+
textColor: BLUE
|
|
1479
1478
|
},
|
|
1480
1479
|
cssDisabled,
|
|
1481
1480
|
cssEnabled
|
|
@@ -1488,22 +1487,17 @@ var BuilderOptionTheme;
|
|
|
1488
1487
|
return optionTheme;
|
|
1489
1488
|
};
|
|
1490
1489
|
})(BuilderOptionTheme || (BuilderOptionTheme = {}));
|
|
1491
|
-
var
|
|
1492
|
-
var
|
|
1493
|
-
var
|
|
1494
|
-
var
|
|
1495
|
-
var audioHighTop = 30;
|
|
1496
|
-
var audioLowTop = 72;
|
|
1490
|
+
var textHighTop = 25;
|
|
1491
|
+
var textLowTop = 55;
|
|
1492
|
+
var audioHighTop = 20;
|
|
1493
|
+
var audioLowTop = 55;
|
|
1497
1494
|
var textBase = {
|
|
1498
|
-
width:
|
|
1499
|
-
// backgroundColor: "red",
|
|
1495
|
+
width: 80,
|
|
1500
1496
|
top: textHighTop,
|
|
1501
|
-
left:
|
|
1502
|
-
|
|
1503
|
-
textAlign: "left",
|
|
1497
|
+
left: 10,
|
|
1498
|
+
textAlign: "center",
|
|
1504
1499
|
textColor: "black",
|
|
1505
|
-
|
|
1506
|
-
fontSize: MAIN_TEXT_FONT_SIZE
|
|
1500
|
+
fontSize: { _unit: "px", value: 40 }
|
|
1507
1501
|
};
|
|
1508
1502
|
var textHigh = { ...textBase, top: textHighTop };
|
|
1509
1503
|
var textLow = { ...textHigh, top: textLowTop };
|
|
@@ -1514,7 +1508,6 @@ var audioBase = {
|
|
|
1514
1508
|
top: audioHighTop,
|
|
1515
1509
|
cursor: "pointer",
|
|
1516
1510
|
opacity: 0.8,
|
|
1517
|
-
transform: "translate(0, -50%)",
|
|
1518
1511
|
visibility: "visible"
|
|
1519
1512
|
};
|
|
1520
1513
|
var audioHigh = { ...audioBase, top: audioHighTop };
|
|
@@ -1571,8 +1564,8 @@ var DefaultTheme = {
|
|
|
1571
1564
|
bottom: 0,
|
|
1572
1565
|
left: 0,
|
|
1573
1566
|
// h: 10,
|
|
1574
|
-
alignItems: "center"
|
|
1575
|
-
|
|
1567
|
+
alignItems: "center",
|
|
1568
|
+
backgroundColor: "yellow"
|
|
1576
1569
|
},
|
|
1577
1570
|
whenSingle: { justifyContent: "space-evenly" },
|
|
1578
1571
|
whenMany: { justifyContent: "space-evenly" }
|
|
@@ -1793,7 +1786,9 @@ var responseButtonBaseCss = () => ({
|
|
|
1793
1786
|
fontWeight: 600,
|
|
1794
1787
|
fontSize: { _unit: "px", value: 28 },
|
|
1795
1788
|
lineHeight: 1.1,
|
|
1789
|
+
// TODO Denne angir knappens max-bredde. Default bør være 25.
|
|
1796
1790
|
maxWidth: 25,
|
|
1791
|
+
minWidth: 12,
|
|
1797
1792
|
// width: 20,
|
|
1798
1793
|
// flex: "0 0 auto",
|
|
1799
1794
|
paddingLeft: { _unit: "px", value: 10 },
|
|
@@ -2019,7 +2014,7 @@ var DefaultThemeCompiler = class {
|
|
|
2019
2014
|
name = "Ispe default theme.";
|
|
2020
2015
|
defaultTheme = DefaultTheme;
|
|
2021
2016
|
theme2 = Theme2;
|
|
2022
|
-
currentTheme =
|
|
2017
|
+
currentTheme = Theme2;
|
|
2023
2018
|
allThemes = [DefaultTheme, Theme2];
|
|
2024
2019
|
TAG = "[ DEFAULT_THEME_COMPILER ]: ";
|
|
2025
2020
|
setTheme(theme) {
|
|
@@ -2091,7 +2086,6 @@ var DefaultThemeCompiler = class {
|
|
|
2091
2086
|
let initialVideoTaskList = [];
|
|
2092
2087
|
const newPage = {
|
|
2093
2088
|
background: "white",
|
|
2094
|
-
pageNumber,
|
|
2095
2089
|
elements,
|
|
2096
2090
|
id,
|
|
2097
2091
|
prefix,
|
|
@@ -2505,7 +2499,7 @@ var DefaultThemeCompiler = class {
|
|
|
2505
2499
|
return buttonBar;
|
|
2506
2500
|
}
|
|
2507
2501
|
compileButton(buttonDto, options) {
|
|
2508
|
-
const { id, value, label } = buttonDto;
|
|
2502
|
+
const { id, value, label, cssOverride } = buttonDto;
|
|
2509
2503
|
const t = this.currentTheme;
|
|
2510
2504
|
const onclickAction = options.kind === "response-button" ? {
|
|
2511
2505
|
kind: "submit-fact",
|
|
@@ -2517,10 +2511,13 @@ var DefaultThemeCompiler = class {
|
|
|
2517
2511
|
referenceLabel: options.questionText
|
|
2518
2512
|
}
|
|
2519
2513
|
} : { kind: "next-page" };
|
|
2520
|
-
|
|
2514
|
+
let btnStyles = value === 9 ? t.buttonBar.responseButtons.dontKnow : t.buttonBar.responseButtons.normal;
|
|
2521
2515
|
if (t.buttonBar.vibrateMs) {
|
|
2522
2516
|
onclickAction.vibrateMs = t.buttonBar.vibrateMs;
|
|
2523
2517
|
}
|
|
2518
|
+
if (cssOverride) {
|
|
2519
|
+
btnStyles.btn.css = { ...btnStyles.btn.css, ...cssOverride };
|
|
2520
|
+
}
|
|
2524
2521
|
const btn = {
|
|
2525
2522
|
_tag: "button",
|
|
2526
2523
|
innerText: label,
|
|
@@ -2953,54 +2950,6 @@ var BuilderPageCollection = class _BuilderPageCollection {
|
|
|
2953
2950
|
}
|
|
2954
2951
|
};
|
|
2955
2952
|
|
|
2956
|
-
// src/Builder-schema-dto.ts
|
|
2957
|
-
var blockAutoplayVideo = (dto) => {
|
|
2958
|
-
if (dto.mainMedia && dto.mainMedia.kind === "main-video") {
|
|
2959
|
-
dto.mainMedia.mode = "optional";
|
|
2960
|
-
}
|
|
2961
|
-
return dto;
|
|
2962
|
-
};
|
|
2963
|
-
var overrideVideoUrl = (dto, baseUrl) => {
|
|
2964
|
-
const mainMedia = dto.mainMedia;
|
|
2965
|
-
if (mainMedia && mainMedia.kind === "main-video") {
|
|
2966
|
-
const url = [baseUrl, mainMedia.file.id].join("/");
|
|
2967
|
-
const file = { ...mainMedia.file, downloadUrl: url };
|
|
2968
|
-
dto.mainMedia = { ...mainMedia, file };
|
|
2969
|
-
}
|
|
2970
|
-
return dto;
|
|
2971
|
-
};
|
|
2972
|
-
var overrideImageUrl = (dto, baseUrl) => {
|
|
2973
|
-
const mainMedia = dto.mainMedia;
|
|
2974
|
-
if (mainMedia && mainMedia.kind === "main-image") {
|
|
2975
|
-
const url = [baseUrl, mainMedia.file.id].join("/");
|
|
2976
|
-
const file = { ...mainMedia.file, downloadUrl: url };
|
|
2977
|
-
dto.mainMedia = { ...mainMedia, file };
|
|
2978
|
-
}
|
|
2979
|
-
return dto;
|
|
2980
|
-
};
|
|
2981
|
-
var overrideAudioUrl = (dto, baseUrl) => {
|
|
2982
|
-
const newAudioFile = { ...dto };
|
|
2983
|
-
const audioFile = newAudioFile.mainText.audioFile;
|
|
2984
|
-
if (audioFile) {
|
|
2985
|
-
const url = [baseUrl, audioFile.id].join("/");
|
|
2986
|
-
dto.mainText.audioFile = { ...audioFile, downloadUrl: url };
|
|
2987
|
-
}
|
|
2988
|
-
return dto;
|
|
2989
|
-
};
|
|
2990
|
-
var overrideAllMediaUrls = (schema, options) => {
|
|
2991
|
-
const pages = schema.pages.map((page) => {
|
|
2992
|
-
page = overrideVideoUrl(page, options.videoFilesBaseUrl);
|
|
2993
|
-
page = overrideImageUrl(page, options.imageFilesBaseUrl);
|
|
2994
|
-
page = overrideAudioUrl(page, options.audioFilesBaseUrl);
|
|
2995
|
-
return page;
|
|
2996
|
-
});
|
|
2997
|
-
return { ...schema, pages };
|
|
2998
|
-
};
|
|
2999
|
-
var BuilderSchemaDto = {
|
|
3000
|
-
blockAutoplayVideo,
|
|
3001
|
-
overrideAllMediaUrls
|
|
3002
|
-
};
|
|
3003
|
-
|
|
3004
2953
|
// src/Builder-schema.ts
|
|
3005
2954
|
var BuilderSchema = class _BuilderSchema {
|
|
3006
2955
|
constructor(id, name, prefix) {
|
|
@@ -3194,12 +3143,8 @@ var BuilderSchema = class _BuilderSchema {
|
|
|
3194
3143
|
addTag(builderTag) {
|
|
3195
3144
|
this._tagCollection.add(builderTag);
|
|
3196
3145
|
}
|
|
3197
|
-
compile(options = {
|
|
3198
|
-
|
|
3199
|
-
blockAutoplayVideo: false,
|
|
3200
|
-
mediaAssets: null
|
|
3201
|
-
}) {
|
|
3202
|
-
let builderSchema = _BuilderSchema.fromJson(this.toJson());
|
|
3146
|
+
compile(options = { blockAutoplayQuestion: false, blockAutoplayVideo: false }) {
|
|
3147
|
+
const builderSchema = _BuilderSchema.fromJson(this.toJson());
|
|
3203
3148
|
builderSchema._pageCollection.pages.forEach((p) => {
|
|
3204
3149
|
if (options.blockAutoplayQuestion) {
|
|
3205
3150
|
p.mainText.autoplay = false;
|
|
@@ -3210,16 +3155,7 @@ var BuilderSchema = class _BuilderSchema {
|
|
|
3210
3155
|
}
|
|
3211
3156
|
}
|
|
3212
3157
|
});
|
|
3213
|
-
|
|
3214
|
-
console.log(options.mediaAssets);
|
|
3215
|
-
if (options.mediaAssets) {
|
|
3216
|
-
const { videoFilesBaseUrl, audioFilesBaseUrl, imageFilesBaseUrl } = options.mediaAssets;
|
|
3217
|
-
moduleDto = BuilderSchemaDto.overrideAllMediaUrls(moduleDto, {
|
|
3218
|
-
videoFilesBaseUrl,
|
|
3219
|
-
audioFilesBaseUrl,
|
|
3220
|
-
imageFilesBaseUrl
|
|
3221
|
-
});
|
|
3222
|
-
}
|
|
3158
|
+
const moduleDto = builderSchema.toJson();
|
|
3223
3159
|
const codebook = CodeBook.fromSchema(moduleDto);
|
|
3224
3160
|
const schema = this.compiler.compile(moduleDto);
|
|
3225
3161
|
const schemaConfig = SchemaConfig.fromSchema(moduleDto);
|
|
@@ -3406,7 +3342,6 @@ var SumScore = {
|
|
|
3406
3342
|
BuilderQuestion,
|
|
3407
3343
|
BuilderRule,
|
|
3408
3344
|
BuilderSchema,
|
|
3409
|
-
BuilderSchemaDto,
|
|
3410
3345
|
BuilderTag,
|
|
3411
3346
|
BuilderText,
|
|
3412
3347
|
CodeBook,
|