@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
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import type { QuestionVariable, CustomVariable, BuilderVariable } from "./RuleVariable";
|
|
2
|
-
import type { ExcludeByPageAction, ExcludeByTagAction, JumpToPageAction } from "./RuleAction";
|
|
3
|
-
import { JumpToPageSelectItem } from "./SingleSelectItem";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* TODO Crate filters for "cardinality" or "order" of a variable;
|
|
7
|
-
* Return legal lists of variables.
|
|
8
|
-
*/
|
|
9
|
-
export class RuleInput {
|
|
10
|
-
constructor(
|
|
11
|
-
private readonly _questionVariables: ReadonlyArray<QuestionVariable>,
|
|
12
|
-
private readonly _customVariables: ReadonlyArray<CustomVariable>,
|
|
13
|
-
private readonly _pageIdActions: ReadonlyArray<ExcludeByPageAction>,
|
|
14
|
-
private readonly _tagActions: ReadonlyArray<ExcludeByTagAction>,
|
|
15
|
-
private readonly _jumpActions: ReadonlyArray<JumpToPageAction>
|
|
16
|
-
) {}
|
|
17
|
-
|
|
18
|
-
get questionVars(): ReadonlyArray<QuestionVariable> {
|
|
19
|
-
return this._questionVariables;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
getConditionInput(): ReadonlyArray<BuilderVariable> {
|
|
23
|
-
return [...this.questionVars, ...this.customVars];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
getJumpToPageOptions(): ReadonlyArray<JumpToPageSelectItem> {
|
|
27
|
-
return this._jumpActions.map(JumpToPageSelectItem.create);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
get customVars(): ReadonlyArray<CustomVariable> {
|
|
31
|
-
return this._customVariables;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
get excludeByPageIdActions() {
|
|
35
|
-
return this._pageIdActions;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
get excludeByTagActions() {
|
|
39
|
-
return this._tagActions;
|
|
40
|
-
}
|
|
41
|
-
get jumpToPageActions() {
|
|
42
|
-
return this._jumpActions;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
1
|
+
import type { QuestionVariable, CustomVariable, BuilderVariable } from "./RuleVariable";
|
|
2
|
+
import type { ExcludeByPageAction, ExcludeByTagAction, JumpToPageAction } from "./RuleAction";
|
|
3
|
+
import { JumpToPageSelectItem } from "./SingleSelectItem";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* TODO Crate filters for "cardinality" or "order" of a variable;
|
|
7
|
+
* Return legal lists of variables.
|
|
8
|
+
*/
|
|
9
|
+
export class RuleInput {
|
|
10
|
+
constructor(
|
|
11
|
+
private readonly _questionVariables: ReadonlyArray<QuestionVariable>,
|
|
12
|
+
private readonly _customVariables: ReadonlyArray<CustomVariable>,
|
|
13
|
+
private readonly _pageIdActions: ReadonlyArray<ExcludeByPageAction>,
|
|
14
|
+
private readonly _tagActions: ReadonlyArray<ExcludeByTagAction>,
|
|
15
|
+
private readonly _jumpActions: ReadonlyArray<JumpToPageAction>
|
|
16
|
+
) {}
|
|
17
|
+
|
|
18
|
+
get questionVars(): ReadonlyArray<QuestionVariable> {
|
|
19
|
+
return this._questionVariables;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
getConditionInput(): ReadonlyArray<BuilderVariable> {
|
|
23
|
+
return [...this.questionVars, ...this.customVars];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
getJumpToPageOptions(): ReadonlyArray<JumpToPageSelectItem> {
|
|
27
|
+
return this._jumpActions.map(JumpToPageSelectItem.create);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
get customVars(): ReadonlyArray<CustomVariable> {
|
|
31
|
+
return this._customVariables;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get excludeByPageIdActions() {
|
|
35
|
+
return this._pageIdActions;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get excludeByTagActions() {
|
|
39
|
+
return this._tagActions;
|
|
40
|
+
}
|
|
41
|
+
get jumpToPageActions() {
|
|
42
|
+
return this._jumpActions;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { PagePrefix } from "../primitives/page-prefix";
|
|
2
|
-
import { VarID } from "../primitives/varID";
|
|
3
|
-
import { SchemaPrefix } from "../primitives/schema-prefix";
|
|
4
|
-
|
|
5
|
-
const BuilderVariableType = {
|
|
6
|
-
numericWithOptions: true,
|
|
7
|
-
numeric: true,
|
|
8
|
-
numericRange: true,
|
|
9
|
-
text: true,
|
|
10
|
-
date: true,
|
|
11
|
-
dateRange: true,
|
|
12
|
-
time: true,
|
|
13
|
-
duration: true,
|
|
14
|
-
boolean: true,
|
|
15
|
-
} as const;
|
|
16
|
-
|
|
17
|
-
export type BuilderVariableType = keyof typeof BuilderVariableType;
|
|
18
|
-
|
|
19
|
-
export class BuilderVariableOption {
|
|
20
|
-
constructor(
|
|
21
|
-
readonly label: string,
|
|
22
|
-
readonly value: number,
|
|
23
|
-
) {}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export class QuestionVariable {
|
|
27
|
-
readonly kind: "question-variable" = "question-variable";
|
|
28
|
-
readonly dataType: BuilderVariableType = "numericWithOptions";
|
|
29
|
-
constructor(
|
|
30
|
-
// private schemaPrefix: SchemaPrefix,
|
|
31
|
-
// private pagePrefix: PagePrefix,
|
|
32
|
-
readonly varId: VarID,
|
|
33
|
-
readonly label: string,
|
|
34
|
-
readonly options: ReadonlyArray<BuilderVariableOption>,
|
|
35
|
-
readonly pageNumber: number,
|
|
36
|
-
) {}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export class CustomVariable {
|
|
40
|
-
readonly kind: "configuration-variable" = "configuration-variable";
|
|
41
|
-
readonly dataType: BuilderVariableType = "numericWithOptions";
|
|
42
|
-
constructor(
|
|
43
|
-
readonly varId: VarID,
|
|
44
|
-
readonly label: string,
|
|
45
|
-
readonly options: ReadonlyArray<BuilderVariableOption>,
|
|
46
|
-
) {}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export type BuilderVariable = QuestionVariable | CustomVariable;
|
|
1
|
+
import { PagePrefix } from "../primitives/page-prefix";
|
|
2
|
+
import { VarID } from "../primitives/varID";
|
|
3
|
+
import { SchemaPrefix } from "../primitives/schema-prefix";
|
|
4
|
+
|
|
5
|
+
const BuilderVariableType = {
|
|
6
|
+
numericWithOptions: true,
|
|
7
|
+
numeric: true,
|
|
8
|
+
numericRange: true,
|
|
9
|
+
text: true,
|
|
10
|
+
date: true,
|
|
11
|
+
dateRange: true,
|
|
12
|
+
time: true,
|
|
13
|
+
duration: true,
|
|
14
|
+
boolean: true,
|
|
15
|
+
} as const;
|
|
16
|
+
|
|
17
|
+
export type BuilderVariableType = keyof typeof BuilderVariableType;
|
|
18
|
+
|
|
19
|
+
export class BuilderVariableOption {
|
|
20
|
+
constructor(
|
|
21
|
+
readonly label: string,
|
|
22
|
+
readonly value: number,
|
|
23
|
+
) {}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class QuestionVariable {
|
|
27
|
+
readonly kind: "question-variable" = "question-variable";
|
|
28
|
+
readonly dataType: BuilderVariableType = "numericWithOptions";
|
|
29
|
+
constructor(
|
|
30
|
+
// private schemaPrefix: SchemaPrefix,
|
|
31
|
+
// private pagePrefix: PagePrefix,
|
|
32
|
+
readonly varId: VarID,
|
|
33
|
+
readonly label: string,
|
|
34
|
+
readonly options: ReadonlyArray<BuilderVariableOption>,
|
|
35
|
+
readonly pageNumber: number,
|
|
36
|
+
) {}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export class CustomVariable {
|
|
40
|
+
readonly kind: "configuration-variable" = "configuration-variable";
|
|
41
|
+
readonly dataType: BuilderVariableType = "numericWithOptions";
|
|
42
|
+
constructor(
|
|
43
|
+
readonly varId: VarID,
|
|
44
|
+
readonly label: string,
|
|
45
|
+
readonly options: ReadonlyArray<BuilderVariableOption>,
|
|
46
|
+
) {}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type BuilderVariable = QuestionVariable | CustomVariable;
|
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
import { BuilderVariable, BuilderVariableOption } from "./RuleVariable";
|
|
2
|
-
import { BuilderOperator } from "./condition/Builder-operator";
|
|
3
|
-
import { JumpToPageAction } from "./RuleAction";
|
|
4
|
-
|
|
5
|
-
export abstract class SingleSelectItem<T> {
|
|
6
|
-
private readonly _selectLabel;
|
|
7
|
-
private readonly _toolTip;
|
|
8
|
-
private readonly _searchString;
|
|
9
|
-
get selectLabel(): string {
|
|
10
|
-
return this._selectLabel;
|
|
11
|
-
}
|
|
12
|
-
get tooltip() {
|
|
13
|
-
return this._toolTip;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get searchString() {
|
|
17
|
-
return this._searchString;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
protected constructor(readonly data: T) {
|
|
21
|
-
this._selectLabel = this.getSelectLabel();
|
|
22
|
-
this._toolTip = this.getTooltip();
|
|
23
|
-
this._searchString = this.getSearchString();
|
|
24
|
-
}
|
|
25
|
-
protected abstract getSelectLabel(): string;
|
|
26
|
-
protected abstract getTooltip(): string;
|
|
27
|
-
protected abstract getSearchString(): string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export class RuleVariableSelectItem extends SingleSelectItem<BuilderVariable> {
|
|
31
|
-
public static create = (data: BuilderVariable) => {
|
|
32
|
-
return new RuleVariableSelectItem(data);
|
|
33
|
-
};
|
|
34
|
-
readonly options: ReadonlyArray<RuleOptionSelectItem>;
|
|
35
|
-
constructor(readonly data: BuilderVariable) {
|
|
36
|
-
super(data);
|
|
37
|
-
this.options = data.options.map(RuleOptionSelectItem.create);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
protected getSearchString(): string {
|
|
41
|
-
return this.data.varId + this.data.label;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
getSelectLabel(): string {
|
|
45
|
-
return this.data.varId;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
getTooltip(): string {
|
|
49
|
-
return this.data.label;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export class RuleOptionSelectItem extends SingleSelectItem<BuilderVariableOption> {
|
|
54
|
-
public static create = (option: BuilderVariableOption) => {
|
|
55
|
-
return new RuleOptionSelectItem(option);
|
|
56
|
-
};
|
|
57
|
-
private constructor(option: BuilderVariableOption) {
|
|
58
|
-
super(option);
|
|
59
|
-
}
|
|
60
|
-
protected getSearchString(): string {
|
|
61
|
-
return "";
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
protected getSelectLabel(): string {
|
|
65
|
-
return this.data.label + "(" + this.data.value + ")";
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
protected getTooltip(): string {
|
|
69
|
-
return "";
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export class OperatorSelectItem extends SingleSelectItem<BuilderOperator | ""> {
|
|
74
|
-
public static readonly EQ = new OperatorSelectItem("equal");
|
|
75
|
-
public static readonly NOT_EQ = new OperatorSelectItem("notEqual");
|
|
76
|
-
public static readonly fromSymbol = (
|
|
77
|
-
symbol: BuilderOperator | Omit<string, BuilderOperator>,
|
|
78
|
-
): OperatorSelectItem | false => {
|
|
79
|
-
if (symbol === "equal") {
|
|
80
|
-
return OperatorSelectItem.EQ;
|
|
81
|
-
}
|
|
82
|
-
if (symbol === "notEqual") {
|
|
83
|
-
return OperatorSelectItem.NOT_EQ;
|
|
84
|
-
}
|
|
85
|
-
return false;
|
|
86
|
-
};
|
|
87
|
-
private constructor(operator: BuilderOperator) {
|
|
88
|
-
super(operator);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
protected getSearchString(): string {
|
|
92
|
-
return "";
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
protected getSelectLabel(): string {
|
|
96
|
-
const operator = this.data;
|
|
97
|
-
if (operator === "equal") {
|
|
98
|
-
return "Equals";
|
|
99
|
-
}
|
|
100
|
-
if (operator === "notEqual") {
|
|
101
|
-
return "Not equals";
|
|
102
|
-
}
|
|
103
|
-
return "";
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
protected getTooltip(): string {
|
|
107
|
-
const operator = this.data;
|
|
108
|
-
if (operator === "equal") {
|
|
109
|
-
return "Equals";
|
|
110
|
-
}
|
|
111
|
-
if (operator === "notEqual") {
|
|
112
|
-
return "Not equals";
|
|
113
|
-
}
|
|
114
|
-
return "";
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export class JumpToPageSelectItem extends SingleSelectItem<JumpToPageAction> {
|
|
119
|
-
public static readonly create = (pageData: JumpToPageAction) => new JumpToPageSelectItem(pageData);
|
|
120
|
-
protected constructor(pageData: JumpToPageAction) {
|
|
121
|
-
super(pageData);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
protected getSearchString(): string {
|
|
125
|
-
return this.data.pagePrefix + this.data.mainText;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
protected getSelectLabel(): string {
|
|
129
|
-
return this.data.pagePrefix + " (" + this.data.pageNumber + ")";
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
protected getTooltip(): string {
|
|
133
|
-
return this.data.mainText;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
1
|
+
import { BuilderVariable, BuilderVariableOption } from "./RuleVariable";
|
|
2
|
+
import { BuilderOperator } from "./condition/Builder-operator";
|
|
3
|
+
import { JumpToPageAction } from "./RuleAction";
|
|
4
|
+
|
|
5
|
+
export abstract class SingleSelectItem<T> {
|
|
6
|
+
private readonly _selectLabel;
|
|
7
|
+
private readonly _toolTip;
|
|
8
|
+
private readonly _searchString;
|
|
9
|
+
get selectLabel(): string {
|
|
10
|
+
return this._selectLabel;
|
|
11
|
+
}
|
|
12
|
+
get tooltip() {
|
|
13
|
+
return this._toolTip;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get searchString() {
|
|
17
|
+
return this._searchString;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
protected constructor(readonly data: T) {
|
|
21
|
+
this._selectLabel = this.getSelectLabel();
|
|
22
|
+
this._toolTip = this.getTooltip();
|
|
23
|
+
this._searchString = this.getSearchString();
|
|
24
|
+
}
|
|
25
|
+
protected abstract getSelectLabel(): string;
|
|
26
|
+
protected abstract getTooltip(): string;
|
|
27
|
+
protected abstract getSearchString(): string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export class RuleVariableSelectItem extends SingleSelectItem<BuilderVariable> {
|
|
31
|
+
public static create = (data: BuilderVariable) => {
|
|
32
|
+
return new RuleVariableSelectItem(data);
|
|
33
|
+
};
|
|
34
|
+
readonly options: ReadonlyArray<RuleOptionSelectItem>;
|
|
35
|
+
constructor(readonly data: BuilderVariable) {
|
|
36
|
+
super(data);
|
|
37
|
+
this.options = data.options.map(RuleOptionSelectItem.create);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
protected getSearchString(): string {
|
|
41
|
+
return this.data.varId + this.data.label;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
getSelectLabel(): string {
|
|
45
|
+
return this.data.varId;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
getTooltip(): string {
|
|
49
|
+
return this.data.label;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export class RuleOptionSelectItem extends SingleSelectItem<BuilderVariableOption> {
|
|
54
|
+
public static create = (option: BuilderVariableOption) => {
|
|
55
|
+
return new RuleOptionSelectItem(option);
|
|
56
|
+
};
|
|
57
|
+
private constructor(option: BuilderVariableOption) {
|
|
58
|
+
super(option);
|
|
59
|
+
}
|
|
60
|
+
protected getSearchString(): string {
|
|
61
|
+
return "";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
protected getSelectLabel(): string {
|
|
65
|
+
return this.data.label + "(" + this.data.value + ")";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
protected getTooltip(): string {
|
|
69
|
+
return "";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export class OperatorSelectItem extends SingleSelectItem<BuilderOperator | ""> {
|
|
74
|
+
public static readonly EQ = new OperatorSelectItem("equal");
|
|
75
|
+
public static readonly NOT_EQ = new OperatorSelectItem("notEqual");
|
|
76
|
+
public static readonly fromSymbol = (
|
|
77
|
+
symbol: BuilderOperator | Omit<string, BuilderOperator>,
|
|
78
|
+
): OperatorSelectItem | false => {
|
|
79
|
+
if (symbol === "equal") {
|
|
80
|
+
return OperatorSelectItem.EQ;
|
|
81
|
+
}
|
|
82
|
+
if (symbol === "notEqual") {
|
|
83
|
+
return OperatorSelectItem.NOT_EQ;
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
};
|
|
87
|
+
private constructor(operator: BuilderOperator) {
|
|
88
|
+
super(operator);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
protected getSearchString(): string {
|
|
92
|
+
return "";
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
protected getSelectLabel(): string {
|
|
96
|
+
const operator = this.data;
|
|
97
|
+
if (operator === "equal") {
|
|
98
|
+
return "Equals";
|
|
99
|
+
}
|
|
100
|
+
if (operator === "notEqual") {
|
|
101
|
+
return "Not equals";
|
|
102
|
+
}
|
|
103
|
+
return "";
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
protected getTooltip(): string {
|
|
107
|
+
const operator = this.data;
|
|
108
|
+
if (operator === "equal") {
|
|
109
|
+
return "Equals";
|
|
110
|
+
}
|
|
111
|
+
if (operator === "notEqual") {
|
|
112
|
+
return "Not equals";
|
|
113
|
+
}
|
|
114
|
+
return "";
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export class JumpToPageSelectItem extends SingleSelectItem<JumpToPageAction> {
|
|
119
|
+
public static readonly create = (pageData: JumpToPageAction) => new JumpToPageSelectItem(pageData);
|
|
120
|
+
protected constructor(pageData: JumpToPageAction) {
|
|
121
|
+
super(pageData);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
protected getSearchString(): string {
|
|
125
|
+
return this.data.pagePrefix + this.data.mainText;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
protected getSelectLabel(): string {
|
|
129
|
+
return this.data.pagePrefix + " (" + this.data.pageNumber + ")";
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
protected getTooltip(): string {
|
|
133
|
+
return this.data.mainText;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { BuilderConditionGroup } from "./Builder-condition-group";
|
|
2
|
-
|
|
3
|
-
let group = BuilderConditionGroup.fromDto(
|
|
4
|
-
{
|
|
5
|
-
kind: "condition-group",
|
|
6
|
-
name: "g1",
|
|
7
|
-
type: "all",
|
|
8
|
-
conditions: [],
|
|
9
|
-
},
|
|
10
|
-
[]
|
|
11
|
-
);
|
|
12
|
-
beforeEach(() => {});
|
|
13
|
-
|
|
14
|
-
describe("Builder Operator", () => {
|
|
15
|
-
test("Can create", () => {
|
|
16
|
-
expect(group).toBeInstanceOf(BuilderConditionGroup);
|
|
17
|
-
group.name = "group1";
|
|
18
|
-
expect(group.name).toBe("group1");
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test("Can add condition", () => {
|
|
22
|
-
const condition = group.addCondition();
|
|
23
|
-
expect(group.conditions.length).toBe(1);
|
|
24
|
-
const success = group.removeCondition(condition);
|
|
25
|
-
expect(success).toBe(true);
|
|
26
|
-
expect(group.conditions.length).toBe(0);
|
|
27
|
-
});
|
|
28
|
-
test("Can add condition when many", () => {
|
|
29
|
-
const c1 = group.addCondition();
|
|
30
|
-
const c2 = group.addCondition();
|
|
31
|
-
const c3 = group.addCondition();
|
|
32
|
-
const c4 = group.addCondition();
|
|
33
|
-
const c5 = group.addCondition();
|
|
34
|
-
expect(group.conditionCount).toBe(5);
|
|
35
|
-
const success = group.removeCondition(c3);
|
|
36
|
-
expect(success).toBe(true);
|
|
37
|
-
const fail = group.removeCondition(c3);
|
|
38
|
-
expect(fail).toBe(false);
|
|
39
|
-
expect(group.conditions[0]).toBe(c1);
|
|
40
|
-
expect(group.conditions[1]).toBe(c2);
|
|
41
|
-
expect(group.conditions[2]).toBe(c4);
|
|
42
|
-
expect(group.conditions[3]).toBe(c5);
|
|
43
|
-
// expect(group.conditions.length).toBe(0);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
test("Can create operator from symbol", () => {});
|
|
47
|
-
});
|
|
1
|
+
import { BuilderConditionGroup } from "./Builder-condition-group";
|
|
2
|
+
|
|
3
|
+
let group = BuilderConditionGroup.fromDto(
|
|
4
|
+
{
|
|
5
|
+
kind: "condition-group",
|
|
6
|
+
name: "g1",
|
|
7
|
+
type: "all",
|
|
8
|
+
conditions: [],
|
|
9
|
+
},
|
|
10
|
+
[]
|
|
11
|
+
);
|
|
12
|
+
beforeEach(() => {});
|
|
13
|
+
|
|
14
|
+
describe("Builder Operator", () => {
|
|
15
|
+
test("Can create", () => {
|
|
16
|
+
expect(group).toBeInstanceOf(BuilderConditionGroup);
|
|
17
|
+
group.name = "group1";
|
|
18
|
+
expect(group.name).toBe("group1");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test("Can add condition", () => {
|
|
22
|
+
const condition = group.addCondition();
|
|
23
|
+
expect(group.conditions.length).toBe(1);
|
|
24
|
+
const success = group.removeCondition(condition);
|
|
25
|
+
expect(success).toBe(true);
|
|
26
|
+
expect(group.conditions.length).toBe(0);
|
|
27
|
+
});
|
|
28
|
+
test("Can add condition when many", () => {
|
|
29
|
+
const c1 = group.addCondition();
|
|
30
|
+
const c2 = group.addCondition();
|
|
31
|
+
const c3 = group.addCondition();
|
|
32
|
+
const c4 = group.addCondition();
|
|
33
|
+
const c5 = group.addCondition();
|
|
34
|
+
expect(group.conditionCount).toBe(5);
|
|
35
|
+
const success = group.removeCondition(c3);
|
|
36
|
+
expect(success).toBe(true);
|
|
37
|
+
const fail = group.removeCondition(c3);
|
|
38
|
+
expect(fail).toBe(false);
|
|
39
|
+
expect(group.conditions[0]).toBe(c1);
|
|
40
|
+
expect(group.conditions[1]).toBe(c2);
|
|
41
|
+
expect(group.conditions[2]).toBe(c4);
|
|
42
|
+
expect(group.conditions[3]).toBe(c5);
|
|
43
|
+
// expect(group.conditions.length).toBe(0);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test("Can create operator from symbol", () => {});
|
|
47
|
+
});
|