@farris/jit-engine 1.3.352 → 1.3.353
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/README.md +5 -1
- package/lib/domstructure/ui/common/absctract_dom.js +2 -2
- package/lib/domstructure/ui/common/appearance.js +35 -35
- package/lib/domstructure/ui/common/background.js +33 -33
- package/lib/domstructure/ui/common/base-title-component.js +46 -46
- package/lib/domstructure/ui/common/basecomponent.js +160 -160
- package/lib/domstructure/ui/common/binding.js +164 -164
- package/lib/domstructure/ui/common/binding.js.map +1 -1
- package/lib/domstructure/ui/common/border.js +39 -39
- package/lib/domstructure/ui/common/font.js +38 -38
- package/lib/domstructure/ui/common/index.js +21 -21
- package/lib/domstructure/ui/common/margin.js +39 -39
- package/lib/domstructure/ui/common/padding.js +39 -39
- package/lib/domstructure/ui/common/size.js +34 -34
- package/lib/domstructure/ui/common/visible.js +69 -69
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=absctract_dom.js.map
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Appearance = void 0;
|
|
4
|
-
const utility_1 = require("../../../utility");
|
|
5
|
-
class Appearance {
|
|
6
|
-
constructor(param) {
|
|
7
|
-
let obj;
|
|
8
|
-
if (typeof param === 'string') {
|
|
9
|
-
obj = utility_1.ToolHelper.convertToJsonOrDefault(param);
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
obj = param;
|
|
13
|
-
}
|
|
14
|
-
if (!obj) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const keys = 'class,style,dropdownCls';
|
|
18
|
-
Object.keys(obj).forEach(key => {
|
|
19
|
-
if (keys.includes(key)) {
|
|
20
|
-
this[key] = obj[key];
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
toJSON() {
|
|
25
|
-
return {
|
|
26
|
-
"class": this.class,
|
|
27
|
-
"style": this.style,
|
|
28
|
-
"dropdownCls": this.dropdownCls
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
toString() {
|
|
32
|
-
return JSON.stringify(this.toJSON());
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.Appearance = Appearance;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Appearance = void 0;
|
|
4
|
+
const utility_1 = require("../../../utility");
|
|
5
|
+
class Appearance {
|
|
6
|
+
constructor(param) {
|
|
7
|
+
let obj;
|
|
8
|
+
if (typeof param === 'string') {
|
|
9
|
+
obj = utility_1.ToolHelper.convertToJsonOrDefault(param);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
obj = param;
|
|
13
|
+
}
|
|
14
|
+
if (!obj) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const keys = 'class,style,dropdownCls';
|
|
18
|
+
Object.keys(obj).forEach(key => {
|
|
19
|
+
if (keys.includes(key)) {
|
|
20
|
+
this[key] = obj[key];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
toJSON() {
|
|
25
|
+
return {
|
|
26
|
+
"class": this.class,
|
|
27
|
+
"style": this.style,
|
|
28
|
+
"dropdownCls": this.dropdownCls
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
toString() {
|
|
32
|
+
return JSON.stringify(this.toJSON());
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.Appearance = Appearance;
|
|
36
36
|
//# sourceMappingURL=appearance.js.map
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Background = void 0;
|
|
4
|
-
const utility_1 = require("../../../utility");
|
|
5
|
-
class Background {
|
|
6
|
-
constructor(param) {
|
|
7
|
-
let obj;
|
|
8
|
-
if (typeof param === 'string') {
|
|
9
|
-
obj = utility_1.ToolHelper.convertToJsonOrDefault(param);
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
obj = param;
|
|
13
|
-
}
|
|
14
|
-
if (!obj) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const keys = 'color';
|
|
18
|
-
Object.keys(obj).forEach(key => {
|
|
19
|
-
if (keys.includes(key)) {
|
|
20
|
-
this[key] = obj[key];
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
toJSON() {
|
|
25
|
-
return {
|
|
26
|
-
"color": this.color
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
toString() {
|
|
30
|
-
return JSON.stringify(this.toJSON());
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.Background = Background;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Background = void 0;
|
|
4
|
+
const utility_1 = require("../../../utility");
|
|
5
|
+
class Background {
|
|
6
|
+
constructor(param) {
|
|
7
|
+
let obj;
|
|
8
|
+
if (typeof param === 'string') {
|
|
9
|
+
obj = utility_1.ToolHelper.convertToJsonOrDefault(param);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
obj = param;
|
|
13
|
+
}
|
|
14
|
+
if (!obj) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const keys = 'color';
|
|
18
|
+
Object.keys(obj).forEach(key => {
|
|
19
|
+
if (keys.includes(key)) {
|
|
20
|
+
this[key] = obj[key];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
toJSON() {
|
|
25
|
+
return {
|
|
26
|
+
"color": this.color
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
toString() {
|
|
30
|
+
return JSON.stringify(this.toJSON());
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.Background = Background;
|
|
34
34
|
//# sourceMappingURL=background.js.map
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseTitleComponent = void 0;
|
|
4
|
-
const utility_1 = require("../../../utility");
|
|
5
|
-
const basecomponent_1 = require("./basecomponent");
|
|
6
|
-
class BaseTitleComponent extends basecomponent_1.BaseComponent {
|
|
7
|
-
constructor(param) {
|
|
8
|
-
super(param);
|
|
9
|
-
let obj;
|
|
10
|
-
if (typeof param === 'string') {
|
|
11
|
-
obj = utility_1.ToolHelper.convertToJsonOrDefault(param);
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
obj = param;
|
|
15
|
-
}
|
|
16
|
-
if (!obj) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const keys = 'title,titleSourceType,titleDataSource';
|
|
20
|
-
Object.keys(obj).forEach(key => {
|
|
21
|
-
if (keys.includes(key)) {
|
|
22
|
-
if (key == "titleDataSource") {
|
|
23
|
-
if (obj[key]) {
|
|
24
|
-
this[key] = utility_1.ToolHelper.createBindingWithoutDefaultValue(obj[key], this.externalComponentNameSpace, this.id);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
this[key] = obj[key];
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
getTitleValue() {
|
|
34
|
-
if (this.isStaticTitle()) {
|
|
35
|
-
return this.title;
|
|
36
|
-
}
|
|
37
|
-
if (!this.titleDataSource) {
|
|
38
|
-
return "";
|
|
39
|
-
}
|
|
40
|
-
return this.titleDataSource.value;
|
|
41
|
-
}
|
|
42
|
-
isStaticTitle() {
|
|
43
|
-
return !this.titleSourceType || this.titleSourceType == "static";
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.BaseTitleComponent = BaseTitleComponent;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseTitleComponent = void 0;
|
|
4
|
+
const utility_1 = require("../../../utility");
|
|
5
|
+
const basecomponent_1 = require("./basecomponent");
|
|
6
|
+
class BaseTitleComponent extends basecomponent_1.BaseComponent {
|
|
7
|
+
constructor(param) {
|
|
8
|
+
super(param);
|
|
9
|
+
let obj;
|
|
10
|
+
if (typeof param === 'string') {
|
|
11
|
+
obj = utility_1.ToolHelper.convertToJsonOrDefault(param);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
obj = param;
|
|
15
|
+
}
|
|
16
|
+
if (!obj) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const keys = 'title,titleSourceType,titleDataSource';
|
|
20
|
+
Object.keys(obj).forEach(key => {
|
|
21
|
+
if (keys.includes(key)) {
|
|
22
|
+
if (key == "titleDataSource") {
|
|
23
|
+
if (obj[key]) {
|
|
24
|
+
this[key] = utility_1.ToolHelper.createBindingWithoutDefaultValue(obj[key], this.externalComponentNameSpace, this.id);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
this[key] = obj[key];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
getTitleValue() {
|
|
34
|
+
if (this.isStaticTitle()) {
|
|
35
|
+
return this.title;
|
|
36
|
+
}
|
|
37
|
+
if (!this.titleDataSource) {
|
|
38
|
+
return "";
|
|
39
|
+
}
|
|
40
|
+
return this.titleDataSource.value;
|
|
41
|
+
}
|
|
42
|
+
isStaticTitle() {
|
|
43
|
+
return !this.titleSourceType || this.titleSourceType == "static";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.BaseTitleComponent = BaseTitleComponent;
|
|
47
47
|
//# sourceMappingURL=base-title-component.js.map
|
|
@@ -1,161 +1,161 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseComponent = void 0;
|
|
4
|
-
const appearance_1 = require("./appearance");
|
|
5
|
-
const border_1 = require("./border");
|
|
6
|
-
const font_1 = require("./font");
|
|
7
|
-
const margin_1 = require("./margin");
|
|
8
|
-
const padding_1 = require("./padding");
|
|
9
|
-
const size_1 = require("./size");
|
|
10
|
-
const static_control_1 = require("../static-control");
|
|
11
|
-
const utility_1 = require("../../../utility");
|
|
12
|
-
const running_position_enum_1 = require("../../running-position-enum");
|
|
13
|
-
const component_readonly_parameter_creator_1 = require("../../../utility/devkit/component-readonly-parameter-creator");
|
|
14
|
-
const editor_type_enum_1 = require("../../editor-type-enum");
|
|
15
|
-
class BaseComponent extends static_control_1.StaticControlAttribute {
|
|
16
|
-
constructor(param) {
|
|
17
|
-
super(param);
|
|
18
|
-
this.editorType = editor_type_enum_1.EditorTypeEnum.Default;
|
|
19
|
-
this.includeInLoopContainer = false;
|
|
20
|
-
let obj;
|
|
21
|
-
if (typeof param === 'string') {
|
|
22
|
-
obj = utility_1.ToolHelper.convertToJsonOrDefault(param);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
obj = param;
|
|
26
|
-
}
|
|
27
|
-
if (!obj) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
this.externalComponentNameSpace = obj["externalComponentNameSpace"];
|
|
31
|
-
this.id = obj["id"];
|
|
32
|
-
const keys = 'visible,type,readonly,require,binding,appearance,border,font,margin,padding,size,tabindex,hasDefaultFocus,focusState,controlIndex,enableTitleTips,titleTipsTemplate,viewModel,useDisplayStyle,includeInLoopContainer';
|
|
33
|
-
Object.keys(obj).forEach(key => {
|
|
34
|
-
if (keys.includes(key)) {
|
|
35
|
-
switch (key) {
|
|
36
|
-
case 'appearance':
|
|
37
|
-
this[key] = new appearance_1.Appearance(obj[key]);
|
|
38
|
-
break;
|
|
39
|
-
case "type":
|
|
40
|
-
this.originalType = obj[key];
|
|
41
|
-
break;
|
|
42
|
-
case 'border':
|
|
43
|
-
this[key] = new border_1.Border(obj[key]);
|
|
44
|
-
break;
|
|
45
|
-
case 'font':
|
|
46
|
-
this[key] = new font_1.Font(obj[key]);
|
|
47
|
-
break;
|
|
48
|
-
case 'margin':
|
|
49
|
-
this[key] = new margin_1.Margin(obj[key]);
|
|
50
|
-
break;
|
|
51
|
-
case 'padding':
|
|
52
|
-
this[key] = new padding_1.Padding(obj[key]);
|
|
53
|
-
break;
|
|
54
|
-
case 'size':
|
|
55
|
-
this[key] = new size_1.Size(obj[key]);
|
|
56
|
-
break;
|
|
57
|
-
case "visible":
|
|
58
|
-
this[key] = utility_1.ToolHelper.createBindingWithPosition(obj[key], true, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
|
|
59
|
-
break;
|
|
60
|
-
case "readonly":
|
|
61
|
-
this[key] = utility_1.ToolHelper.createBindingWithPosition(obj[key], false, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
|
|
62
|
-
break;
|
|
63
|
-
case "require":
|
|
64
|
-
this[key] = utility_1.ToolHelper.createBindingWithPosition(obj[key], false, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
|
|
65
|
-
break;
|
|
66
|
-
case "enableTitleTips":
|
|
67
|
-
this[key] = utility_1.ToolHelper.createBinding(obj[key], false, this.externalComponentNameSpace, this.id);
|
|
68
|
-
break;
|
|
69
|
-
default:
|
|
70
|
-
this[key] = obj[key];
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
if (!this.visible) {
|
|
76
|
-
this.visible = utility_1.ToolHelper.createBindingWithPosition(true, true, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
|
|
77
|
-
}
|
|
78
|
-
if (!this.readonly) {
|
|
79
|
-
this.readonly = utility_1.ToolHelper.createBindingWithPosition(false, false, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
|
|
80
|
-
}
|
|
81
|
-
if (!this.require) {
|
|
82
|
-
this.require = utility_1.ToolHelper.createBindingWithPosition(false, false, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
|
|
83
|
-
}
|
|
84
|
-
if (this.readonly.isComposite) {
|
|
85
|
-
this.readonly.value = "this.viewModel.calculateReadonlyByRules(" + component_readonly_parameter_creator_1.ComponentReadonlyParameterCreator.createTitleId(this.id) + ")";
|
|
86
|
-
}
|
|
87
|
-
if (this.id) {
|
|
88
|
-
this.replacedId = utility_1.ToolHelper.replaceDotToXiaHuaXian(this.id);
|
|
89
|
-
this.referenceId = utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.id);
|
|
90
|
-
}
|
|
91
|
-
if (!this.enableTitleTips || !this.enableTitleTips.value) {
|
|
92
|
-
this.titleTipsTemplate = null;
|
|
93
|
-
}
|
|
94
|
-
this.resourceId = utility_1.I18nResourceManager.generateI18nResourceId(this.id, this.resourcePrefix);
|
|
95
|
-
this.titleTipsTemplateName = utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.resourceId + "_TipsTemplate");
|
|
96
|
-
if (obj.binding) {
|
|
97
|
-
if (obj.visibleControlledByRules) {
|
|
98
|
-
this.visiblePipeSuffix = `|elementVisibility:'${utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.id)}':tracker['${this.id}']`;
|
|
99
|
-
}
|
|
100
|
-
if (obj.requireControlledByRules) {
|
|
101
|
-
this.requirePipeSuffix = `|elementRequired:'${utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.id)}':tracker['${this.id}']`;
|
|
102
|
-
}
|
|
103
|
-
if (obj.readonlyControlledByRules) {
|
|
104
|
-
this.readonlyPipeSuffix = `|elementReadonly:'${utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.id)}':tracker['${this.id}']`;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
toJSON() {
|
|
109
|
-
const result = {
|
|
110
|
-
"id": this.id,
|
|
111
|
-
"type": "BaseComponent",
|
|
112
|
-
"visible": this.visible,
|
|
113
|
-
"readonly": this.readonly,
|
|
114
|
-
"require": this.require,
|
|
115
|
-
"appearance": null,
|
|
116
|
-
"border": null,
|
|
117
|
-
"font": null,
|
|
118
|
-
"margin": null,
|
|
119
|
-
"padding": null,
|
|
120
|
-
"size": null,
|
|
121
|
-
"tabindex": this.tabindex,
|
|
122
|
-
"hasDefaultFocus": this.hasDefaultFocus,
|
|
123
|
-
"focusState": this.focusState
|
|
124
|
-
};
|
|
125
|
-
const keys = 'appearance,border,font,margin,padding,size,visible,readonly,require';
|
|
126
|
-
keys.split(',').forEach(key => {
|
|
127
|
-
if (this[key]) {
|
|
128
|
-
try {
|
|
129
|
-
result[key] = this[key].toJSON();
|
|
130
|
-
}
|
|
131
|
-
catch (e) {
|
|
132
|
-
console.log(key);
|
|
133
|
-
throw e;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
return Object.assign({}, super.toJSON(), result);
|
|
138
|
-
}
|
|
139
|
-
toString() {
|
|
140
|
-
return JSON.stringify(this.toJSON());
|
|
141
|
-
}
|
|
142
|
-
toAbstractDom() {
|
|
143
|
-
const abstractDOM = {
|
|
144
|
-
"type": "BaseComponent",
|
|
145
|
-
"visible": (this.visible !== undefined && this.visible !== null) ? this.visible : true
|
|
146
|
-
};
|
|
147
|
-
const keys = 'id,type,visible,size,readonly';
|
|
148
|
-
keys.split(',').forEach(key => {
|
|
149
|
-
if (this[key] !== null && this[key] !== undefined && this[key] !== '') {
|
|
150
|
-
switch (key) {
|
|
151
|
-
default:
|
|
152
|
-
abstractDOM[key] = this[key];
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
return Object.assign({}, super.toAbstractDom(), abstractDOM);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
exports.BaseComponent = BaseComponent;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseComponent = void 0;
|
|
4
|
+
const appearance_1 = require("./appearance");
|
|
5
|
+
const border_1 = require("./border");
|
|
6
|
+
const font_1 = require("./font");
|
|
7
|
+
const margin_1 = require("./margin");
|
|
8
|
+
const padding_1 = require("./padding");
|
|
9
|
+
const size_1 = require("./size");
|
|
10
|
+
const static_control_1 = require("../static-control");
|
|
11
|
+
const utility_1 = require("../../../utility");
|
|
12
|
+
const running_position_enum_1 = require("../../running-position-enum");
|
|
13
|
+
const component_readonly_parameter_creator_1 = require("../../../utility/devkit/component-readonly-parameter-creator");
|
|
14
|
+
const editor_type_enum_1 = require("../../editor-type-enum");
|
|
15
|
+
class BaseComponent extends static_control_1.StaticControlAttribute {
|
|
16
|
+
constructor(param) {
|
|
17
|
+
super(param);
|
|
18
|
+
this.editorType = editor_type_enum_1.EditorTypeEnum.Default;
|
|
19
|
+
this.includeInLoopContainer = false;
|
|
20
|
+
let obj;
|
|
21
|
+
if (typeof param === 'string') {
|
|
22
|
+
obj = utility_1.ToolHelper.convertToJsonOrDefault(param);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
obj = param;
|
|
26
|
+
}
|
|
27
|
+
if (!obj) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
this.externalComponentNameSpace = obj["externalComponentNameSpace"];
|
|
31
|
+
this.id = obj["id"];
|
|
32
|
+
const keys = 'visible,type,readonly,require,binding,appearance,border,font,margin,padding,size,tabindex,hasDefaultFocus,focusState,controlIndex,enableTitleTips,titleTipsTemplate,viewModel,useDisplayStyle,includeInLoopContainer';
|
|
33
|
+
Object.keys(obj).forEach(key => {
|
|
34
|
+
if (keys.includes(key)) {
|
|
35
|
+
switch (key) {
|
|
36
|
+
case 'appearance':
|
|
37
|
+
this[key] = new appearance_1.Appearance(obj[key]);
|
|
38
|
+
break;
|
|
39
|
+
case "type":
|
|
40
|
+
this.originalType = obj[key];
|
|
41
|
+
break;
|
|
42
|
+
case 'border':
|
|
43
|
+
this[key] = new border_1.Border(obj[key]);
|
|
44
|
+
break;
|
|
45
|
+
case 'font':
|
|
46
|
+
this[key] = new font_1.Font(obj[key]);
|
|
47
|
+
break;
|
|
48
|
+
case 'margin':
|
|
49
|
+
this[key] = new margin_1.Margin(obj[key]);
|
|
50
|
+
break;
|
|
51
|
+
case 'padding':
|
|
52
|
+
this[key] = new padding_1.Padding(obj[key]);
|
|
53
|
+
break;
|
|
54
|
+
case 'size':
|
|
55
|
+
this[key] = new size_1.Size(obj[key]);
|
|
56
|
+
break;
|
|
57
|
+
case "visible":
|
|
58
|
+
this[key] = utility_1.ToolHelper.createBindingWithPosition(obj[key], true, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
|
|
59
|
+
break;
|
|
60
|
+
case "readonly":
|
|
61
|
+
this[key] = utility_1.ToolHelper.createBindingWithPosition(obj[key], false, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
|
|
62
|
+
break;
|
|
63
|
+
case "require":
|
|
64
|
+
this[key] = utility_1.ToolHelper.createBindingWithPosition(obj[key], false, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
|
|
65
|
+
break;
|
|
66
|
+
case "enableTitleTips":
|
|
67
|
+
this[key] = utility_1.ToolHelper.createBinding(obj[key], false, this.externalComponentNameSpace, this.id);
|
|
68
|
+
break;
|
|
69
|
+
default:
|
|
70
|
+
this[key] = obj[key];
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
if (!this.visible) {
|
|
76
|
+
this.visible = utility_1.ToolHelper.createBindingWithPosition(true, true, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
|
|
77
|
+
}
|
|
78
|
+
if (!this.readonly) {
|
|
79
|
+
this.readonly = utility_1.ToolHelper.createBindingWithPosition(false, false, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
|
|
80
|
+
}
|
|
81
|
+
if (!this.require) {
|
|
82
|
+
this.require = utility_1.ToolHelper.createBindingWithPosition(false, false, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
|
|
83
|
+
}
|
|
84
|
+
if (this.readonly.isComposite) {
|
|
85
|
+
this.readonly.value = "this.viewModel.calculateReadonlyByRules(" + component_readonly_parameter_creator_1.ComponentReadonlyParameterCreator.createTitleId(this.id) + ")";
|
|
86
|
+
}
|
|
87
|
+
if (this.id) {
|
|
88
|
+
this.replacedId = utility_1.ToolHelper.replaceDotToXiaHuaXian(this.id);
|
|
89
|
+
this.referenceId = utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.id);
|
|
90
|
+
}
|
|
91
|
+
if (!this.enableTitleTips || !this.enableTitleTips.value) {
|
|
92
|
+
this.titleTipsTemplate = null;
|
|
93
|
+
}
|
|
94
|
+
this.resourceId = utility_1.I18nResourceManager.generateI18nResourceId(this.id, this.resourcePrefix);
|
|
95
|
+
this.titleTipsTemplateName = utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.resourceId + "_TipsTemplate");
|
|
96
|
+
if (obj.binding) {
|
|
97
|
+
if (obj.visibleControlledByRules) {
|
|
98
|
+
this.visiblePipeSuffix = `|elementVisibility:'${utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.id)}':tracker['${this.id}']`;
|
|
99
|
+
}
|
|
100
|
+
if (obj.requireControlledByRules) {
|
|
101
|
+
this.requirePipeSuffix = `|elementRequired:'${utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.id)}':tracker['${this.id}']`;
|
|
102
|
+
}
|
|
103
|
+
if (obj.readonlyControlledByRules) {
|
|
104
|
+
this.readonlyPipeSuffix = `|elementReadonly:'${utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.id)}':tracker['${this.id}']`;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
toJSON() {
|
|
109
|
+
const result = {
|
|
110
|
+
"id": this.id,
|
|
111
|
+
"type": "BaseComponent",
|
|
112
|
+
"visible": this.visible,
|
|
113
|
+
"readonly": this.readonly,
|
|
114
|
+
"require": this.require,
|
|
115
|
+
"appearance": null,
|
|
116
|
+
"border": null,
|
|
117
|
+
"font": null,
|
|
118
|
+
"margin": null,
|
|
119
|
+
"padding": null,
|
|
120
|
+
"size": null,
|
|
121
|
+
"tabindex": this.tabindex,
|
|
122
|
+
"hasDefaultFocus": this.hasDefaultFocus,
|
|
123
|
+
"focusState": this.focusState
|
|
124
|
+
};
|
|
125
|
+
const keys = 'appearance,border,font,margin,padding,size,visible,readonly,require';
|
|
126
|
+
keys.split(',').forEach(key => {
|
|
127
|
+
if (this[key]) {
|
|
128
|
+
try {
|
|
129
|
+
result[key] = this[key].toJSON();
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
console.log(key);
|
|
133
|
+
throw e;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
return Object.assign({}, super.toJSON(), result);
|
|
138
|
+
}
|
|
139
|
+
toString() {
|
|
140
|
+
return JSON.stringify(this.toJSON());
|
|
141
|
+
}
|
|
142
|
+
toAbstractDom() {
|
|
143
|
+
const abstractDOM = {
|
|
144
|
+
"type": "BaseComponent",
|
|
145
|
+
"visible": (this.visible !== undefined && this.visible !== null) ? this.visible : true
|
|
146
|
+
};
|
|
147
|
+
const keys = 'id,type,visible,size,readonly';
|
|
148
|
+
keys.split(',').forEach(key => {
|
|
149
|
+
if (this[key] !== null && this[key] !== undefined && this[key] !== '') {
|
|
150
|
+
switch (key) {
|
|
151
|
+
default:
|
|
152
|
+
abstractDOM[key] = this[key];
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
return Object.assign({}, super.toAbstractDom(), abstractDOM);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
exports.BaseComponent = BaseComponent;
|
|
161
161
|
//# sourceMappingURL=basecomponent.js.map
|