@farris/jit-engine 1.3.329 → 1.3.331
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 +12 -0
- package/lib/domstructure/devkit/viewmodel/component/component.js +221 -221
- package/lib/domstructure/devkit/viewmodel/component/component.js.map +1 -1
- package/lib/domstructure/devkit/viewmodel/viewmodel.js +135 -134
- package/lib/domstructure/devkit/viewmodel/viewmodel.js.map +1 -1
- package/lib/domstructure/ui/commands/toolbar.js +47 -45
- package/lib/domstructure/ui/commands/toolbar.js.map +1 -1
- package/lib/domstructure/ui/section/index.js +14 -14
- package/lib/domstructure/ui/section/section-html.js +6 -6
- package/lib/domstructure/ui/section/section.js +139 -137
- package/lib/domstructure/ui/section/section.js.map +1 -1
- package/lib/domstructure/ui/tabs/farris-tabs.js +98 -96
- package/lib/domstructure/ui/tabs/farris-tabs.js.map +1 -1
- package/lib/utility/config-hepler.js +73 -64
- package/lib/utility/config-hepler.js.map +1 -1
- package/lib/utility/declaration-trigger.js +304 -294
- package/lib/utility/declaration-trigger.js.map +1 -1
- package/lib/utility/devkit/component-parameter-collector/toolbar-collector.js +15 -10
- package/lib/utility/devkit/component-parameter-collector/toolbar-collector.js.map +1 -1
- package/lib/utility/devkit/devkit-creator.js +29 -28
- package/lib/utility/devkit/devkit-creator.js.map +1 -1
- package/lib/utility/devkit/external-component/external-component-creator.js +2 -1
- package/lib/utility/devkit/external-component/external-component-creator.js.map +1 -1
- package/lib/utility/devkit/form-file-executor.js +425 -416
- package/lib/utility/devkit/form-file-executor.js.map +1 -1
- package/lib/utility/devkit/toolbar/toolbar-item.js +2 -2
- package/lib/utility/devkit/toolbar/toolbar.js +2 -2
- package/lib/utility/devkit/toolbar/toolbaritem-state.js +2 -2
- package/lib/utility/template-generator/devkit/component-generator/component-events-parameter-generator.js +112 -112
- package/lib/utility/template-generator/devkit/component-generator/component-events-parameter-generator.js.map +1 -1
- package/lib/utility/template-generator/devkit/component-generator/component-farristabs-parameter-generator.js +210 -149
- package/lib/utility/template-generator/devkit/component-generator/component-farristabs-parameter-generator.js.map +1 -1
- package/lib/utility/template-generator/devkit/component-generator/component-section-parameter-generator.js +213 -161
- package/lib/utility/template-generator/devkit/component-generator/component-section-parameter-generator.js.map +1 -1
- package/lib/utility/template-generator/devkit/component-generator/component-toolbar-parameter-generator.js +219 -219
- package/lib/utility/template-generator/devkit/component-generator/component-toolbar-parameter-generator.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,295 +1,305 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DeclarationTrigger = void 0;
|
|
4
|
-
const toolhepler_1 = require("./toolhepler");
|
|
5
|
-
const logger_helper_1 = require("./logger/logger-helper");
|
|
6
|
-
const validate_result_1 = require("./validator/validate-result");
|
|
7
|
-
const logger_level_1 = require("./logger/logger-level");
|
|
8
|
-
class DeclarationTrigger {
|
|
9
|
-
constructor() { }
|
|
10
|
-
static getNewInstance() {
|
|
11
|
-
return new DeclarationTrigger();
|
|
12
|
-
}
|
|
13
|
-
modifyComponentCommand(declarations, components, viewModels) {
|
|
14
|
-
if (declarations && toolhepler_1.ToolHelper.isArray(declarations.events) == true && toolhepler_1.ToolHelper.isArray(components) == true) {
|
|
15
|
-
declarations.events.forEach((declarationEvent) => {
|
|
16
|
-
const declarationEventValidateResult = this.declarationEventValidate(declarationEvent);
|
|
17
|
-
if (declarationEventValidateResult.success == false && declarationEventValidateResult.canContinue == false) {
|
|
18
|
-
throw new Error(declarationEventValidateResult.errorMessage);
|
|
19
|
-
}
|
|
20
|
-
const isFieldEvent = this.isFieldEvent(declarationEvent);
|
|
21
|
-
let declarationPath = isFieldEvent ? declarationEvent.fieldPath : declarationEvent.path;
|
|
22
|
-
declarationPath = toolhepler_1.ToolHelper.convertNullToEmpty(declarationPath, declarationEvent.path);
|
|
23
|
-
const declarationPathArray = declarationPath.split(".");
|
|
24
|
-
if (declarationPathArray.length == 0) {
|
|
25
|
-
const errorMessage = `declaration event has none path.the declaration event code is ${declarationEvent.code}`;
|
|
26
|
-
logger_helper_1.LoggerHelper.log(errorMessage, logger_level_1.LoggerLevel.Error);
|
|
27
|
-
throw new Error(errorMessage);
|
|
28
|
-
}
|
|
29
|
-
const componentId = declarationPathArray[0];
|
|
30
|
-
let selectedComponent;
|
|
31
|
-
if (!isFieldEvent) {
|
|
32
|
-
selectedComponent = components.find((com) => {
|
|
33
|
-
return com.id === componentId;
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
selectedComponent = viewModels.find((com) => {
|
|
38
|
-
return com.id === componentId;
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
let findDom;
|
|
42
|
-
if (declarationPathArray.length == 1) {
|
|
43
|
-
findDom = selectedComponent;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
findDom[
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
findDom[
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
validateResult.
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
validateResult.
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
294
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeclarationTrigger = void 0;
|
|
4
|
+
const toolhepler_1 = require("./toolhepler");
|
|
5
|
+
const logger_helper_1 = require("./logger/logger-helper");
|
|
6
|
+
const validate_result_1 = require("./validator/validate-result");
|
|
7
|
+
const logger_level_1 = require("./logger/logger-level");
|
|
8
|
+
class DeclarationTrigger {
|
|
9
|
+
constructor() { }
|
|
10
|
+
static getNewInstance() {
|
|
11
|
+
return new DeclarationTrigger();
|
|
12
|
+
}
|
|
13
|
+
modifyComponentCommand(declarations, components, toolbar, viewModels) {
|
|
14
|
+
if (declarations && toolhepler_1.ToolHelper.isArray(declarations.events) == true && toolhepler_1.ToolHelper.isArray(components) == true) {
|
|
15
|
+
declarations.events.forEach((declarationEvent) => {
|
|
16
|
+
const declarationEventValidateResult = this.declarationEventValidate(declarationEvent);
|
|
17
|
+
if (declarationEventValidateResult.success == false && declarationEventValidateResult.canContinue == false) {
|
|
18
|
+
throw new Error(declarationEventValidateResult.errorMessage);
|
|
19
|
+
}
|
|
20
|
+
const isFieldEvent = this.isFieldEvent(declarationEvent);
|
|
21
|
+
let declarationPath = isFieldEvent ? declarationEvent.fieldPath : declarationEvent.path;
|
|
22
|
+
declarationPath = toolhepler_1.ToolHelper.convertNullToEmpty(declarationPath, declarationEvent.path);
|
|
23
|
+
const declarationPathArray = declarationPath.split(".");
|
|
24
|
+
if (declarationPathArray.length == 0) {
|
|
25
|
+
const errorMessage = `declaration event has none path.the declaration event code is ${declarationEvent.code}`;
|
|
26
|
+
logger_helper_1.LoggerHelper.log(errorMessage, logger_level_1.LoggerLevel.Error);
|
|
27
|
+
throw new Error(errorMessage);
|
|
28
|
+
}
|
|
29
|
+
const componentId = declarationPathArray[0];
|
|
30
|
+
let selectedComponent;
|
|
31
|
+
if (!isFieldEvent) {
|
|
32
|
+
selectedComponent = components.find((com) => {
|
|
33
|
+
return com.id === componentId;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
selectedComponent = viewModels.find((com) => {
|
|
38
|
+
return com.id === componentId;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
let findDom;
|
|
42
|
+
if (declarationPathArray.length == 1) {
|
|
43
|
+
findDom = selectedComponent;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
this.dealWithSpecialButton(selectedComponent, declarationPathArray, toolbar);
|
|
47
|
+
findDom = this.rescureComponent(selectedComponent, 0, declarationPathArray, declarationEvent, isFieldEvent);
|
|
48
|
+
}
|
|
49
|
+
if (!findDom) {
|
|
50
|
+
findDom = this.triggerValue;
|
|
51
|
+
}
|
|
52
|
+
if (!findDom) {
|
|
53
|
+
logger_helper_1.LoggerHelper.log(`can not find element ,the code is :${declarationEvent.code}`, logger_level_1.LoggerLevel.Warning);
|
|
54
|
+
}
|
|
55
|
+
this.modifyComponentDeclaration(findDom, declarationEvent, isFieldEvent);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
isFieldEvent(eventItem) {
|
|
60
|
+
if (eventItem && eventItem.type == "fieldEvent") {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
rescureComponent(currentValue, pathIndex, declarationPathArray, declaration, isFieldEvent) {
|
|
66
|
+
if (!currentValue || pathIndex >= declarationPathArray.length) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const currentFindID = declarationPathArray[pathIndex];
|
|
70
|
+
if (currentValue.id == currentFindID) {
|
|
71
|
+
if (pathIndex < (declarationPathArray.length - 1)) {
|
|
72
|
+
pathIndex = pathIndex + 1;
|
|
73
|
+
const nextFindID = declarationPathArray[pathIndex];
|
|
74
|
+
if (!isFieldEvent && (currentValue.type == "ToolBar" || toolhepler_1.ToolHelper.getClassName(currentValue) == "ToolBar" || (currentValue.type == "ToolBarItem" && currentValue.items && currentValue.items.length))) {
|
|
75
|
+
if (currentValue.items && currentValue.items.length) {
|
|
76
|
+
currentValue.items.forEach((content) => {
|
|
77
|
+
if (content.id == nextFindID) {
|
|
78
|
+
if (pathIndex != declarationPathArray.length - 1) {
|
|
79
|
+
this.rescureComponent(content, pathIndex, declarationPathArray, declaration, isFieldEvent);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
this.triggerValue = content;
|
|
83
|
+
return content;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else if (!isFieldEvent && (currentValue.type == "TabToolbar" || toolhepler_1.ToolHelper.getClassName(currentValue) == "TabToolbar")) {
|
|
90
|
+
if (currentValue.contents && currentValue.contents.length) {
|
|
91
|
+
currentValue.contents.forEach((content) => {
|
|
92
|
+
if (content.id == nextFindID) {
|
|
93
|
+
if (pathIndex != declarationPathArray.length - 1) {
|
|
94
|
+
this.rescureComponent(content, pathIndex, declarationPathArray, declaration, isFieldEvent);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
this.triggerValue = content;
|
|
98
|
+
return content;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else if (!isFieldEvent && (currentValue.componentType == "dataGrid")) {
|
|
105
|
+
if (currentValue.template && currentValue.template.id == nextFindID) {
|
|
106
|
+
if (pathIndex != declarationPathArray.length - 1) {
|
|
107
|
+
this.rescureComponent(currentValue.template, pathIndex, declarationPathArray, declaration, isFieldEvent);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else if (currentValue.contents && currentValue.contents.length) {
|
|
111
|
+
currentValue.contents.forEach((content) => {
|
|
112
|
+
if (content.id == nextFindID) {
|
|
113
|
+
if (pathIndex != declarationPathArray.length - 1) {
|
|
114
|
+
this.rescureComponent(content, pathIndex, declarationPathArray, declaration, isFieldEvent);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
this.triggerValue = content;
|
|
118
|
+
return content;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else if (!isFieldEvent && currentValue.componentType == "Frame") {
|
|
125
|
+
if (currentValue.template && currentValue.template.id == nextFindID) {
|
|
126
|
+
if (pathIndex != declarationPathArray.length - 1) {
|
|
127
|
+
this.rescureComponent(currentValue.template, pathIndex, declarationPathArray, declaration, isFieldEvent);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else if (currentValue.contents && currentValue.contents.length) {
|
|
131
|
+
currentValue.contents.forEach((content) => {
|
|
132
|
+
if (content.id == nextFindID) {
|
|
133
|
+
if (pathIndex != declarationPathArray.length - 1) {
|
|
134
|
+
this.rescureComponent(content, pathIndex, declarationPathArray, declaration, isFieldEvent);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
this.triggerValue = content;
|
|
138
|
+
return content;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else if (!isFieldEvent && (currentValue.contents && currentValue.contents.length)) {
|
|
145
|
+
if (currentValue.type == "TabPage" && currentValue.toolbar && currentValue.toolbar.id == nextFindID) {
|
|
146
|
+
this.rescureComponent(currentValue.toolbar, pathIndex, declarationPathArray, declaration, isFieldEvent);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
currentValue.contents.forEach((content) => {
|
|
150
|
+
if (content.id == nextFindID) {
|
|
151
|
+
if (pathIndex != declarationPathArray.length - 1) {
|
|
152
|
+
this.rescureComponent(content, pathIndex, declarationPathArray, declaration, isFieldEvent);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
this.triggerValue = content;
|
|
156
|
+
return content;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
else if (isFieldEvent && toolhepler_1.ToolHelper.isArray(currentValue.fields, false)) {
|
|
163
|
+
currentValue.fields.forEach((fieldItem) => {
|
|
164
|
+
if (fieldItem.id == nextFindID) {
|
|
165
|
+
if (pathIndex != declarationPathArray.length - 1) {
|
|
166
|
+
this.rescureComponent(fieldItem, pathIndex, declarationPathArray, declaration, isFieldEvent);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
this.triggerValue = fieldItem;
|
|
170
|
+
return fieldItem;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
logger_helper_1.LoggerHelper.log("unknown declaration trigger,please call to administrator", logger_level_1.LoggerLevel.Warning);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
pathIndex = pathIndex + 1;
|
|
181
|
+
const nextFindID = declarationPathArray[pathIndex];
|
|
182
|
+
if (!isFieldEvent && currentValue.type == "ToolBar") {
|
|
183
|
+
if (currentValue.items && currentValue.items.length) {
|
|
184
|
+
currentValue.items.forEach((content) => {
|
|
185
|
+
if (content.id == nextFindID) {
|
|
186
|
+
this.triggerValue = content;
|
|
187
|
+
return content;
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
if (!isFieldEvent && (currentValue.contents && currentValue.contents.length)) {
|
|
194
|
+
currentValue.contents.forEach((content) => {
|
|
195
|
+
if (content.id == nextFindID) {
|
|
196
|
+
this.triggerValue = content;
|
|
197
|
+
return content;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
else if (isFieldEvent && currentValue.fields && currentValue.fields.length) {
|
|
202
|
+
currentValue.fields.forEach((fieldItem) => {
|
|
203
|
+
if (fieldItem.id == nextFindID) {
|
|
204
|
+
this.triggerValue = fieldItem;
|
|
205
|
+
return fieldItem;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
modifyComponentDeclaration(findDom, declaration, isFieldEvent) {
|
|
214
|
+
if (findDom && declaration) {
|
|
215
|
+
const declarationEvent = declaration.event;
|
|
216
|
+
const declarationCode = declaration.code;
|
|
217
|
+
const suffixDeclarationEvent = "DeclarationEvents";
|
|
218
|
+
let generatedTriggerValue = `this.trigger('${declarationCode.trim()}');`;
|
|
219
|
+
if (isFieldEvent) {
|
|
220
|
+
generatedTriggerValue = `trigger:${declarationCode.trim()}`;
|
|
221
|
+
}
|
|
222
|
+
const generatedDeclarationEvent = `${declarationEvent}${suffixDeclarationEvent}`;
|
|
223
|
+
let domEventValue = findDom[declarationEvent];
|
|
224
|
+
if (declarationEvent == "onInit" || declarationEvent == "afterViewInit") {
|
|
225
|
+
if (!findDom[generatedDeclarationEvent]) {
|
|
226
|
+
findDom[generatedDeclarationEvent] = [];
|
|
227
|
+
}
|
|
228
|
+
findDom[generatedDeclarationEvent].push(generatedTriggerValue);
|
|
229
|
+
}
|
|
230
|
+
else if (declarationEvent == "lookupPicked" || declarationEvent == "lookupPicking") {
|
|
231
|
+
if (!findDom[generatedDeclarationEvent]) {
|
|
232
|
+
findDom[generatedDeclarationEvent] = [];
|
|
233
|
+
}
|
|
234
|
+
findDom[generatedDeclarationEvent].push(generatedTriggerValue);
|
|
235
|
+
if (declarationEvent == "lookupPicking" && !findDom["lookupPicking"]) {
|
|
236
|
+
findDom['lookupPicking'] = `${toolhepler_1.ToolHelper.toCamelCase(toolhepler_1.ToolHelper.tf(findDom["id"]))}LookupPicking`;
|
|
237
|
+
findDom["isCreatedByDeclaration"] = true;
|
|
238
|
+
}
|
|
239
|
+
if (declarationEvent == "lookupPicked" && !findDom["lookupPicked"]) {
|
|
240
|
+
findDom['lookupPicked'] = `${toolhepler_1.ToolHelper.toCamelCase(toolhepler_1.ToolHelper.tf(findDom["id"]))}LookupPicked`;
|
|
241
|
+
findDom["isCreatedByDeclaration"] = true;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
else if (findDom.type == "ToolBarItem" || toolhepler_1.ToolHelper.getClassName(findDom) == "ToolBarItem") {
|
|
245
|
+
if (!findDom[generatedDeclarationEvent]) {
|
|
246
|
+
findDom[generatedDeclarationEvent] = [];
|
|
247
|
+
}
|
|
248
|
+
findDom[generatedDeclarationEvent].push(generatedTriggerValue);
|
|
249
|
+
}
|
|
250
|
+
else if (declarationEvent == "valueChange") {
|
|
251
|
+
if (!findDom[generatedDeclarationEvent]) {
|
|
252
|
+
findDom[generatedDeclarationEvent] = [];
|
|
253
|
+
}
|
|
254
|
+
findDom[generatedDeclarationEvent].push(generatedTriggerValue);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
if (declarationEvent == "linkedLabelClick" && findDom["linkedLabelEnabled"] == false) {
|
|
258
|
+
logger_helper_1.LoggerHelper.log(`${findDom["id"]} linkedLabelEnabled is false, so declaration event use this , not effective!`, logger_level_1.LoggerLevel.Warning);
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
if (domEventValue) {
|
|
262
|
+
if (domEventValue.endsWith(";") == false) {
|
|
263
|
+
if (!isFieldEvent && domEventValue.endsWith("()") == false) {
|
|
264
|
+
domEventValue = domEventValue + "()";
|
|
265
|
+
}
|
|
266
|
+
domEventValue = domEventValue + ";" + generatedTriggerValue;
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
domEventValue = domEventValue + generatedTriggerValue;
|
|
270
|
+
}
|
|
271
|
+
findDom[declarationEvent] = domEventValue;
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
findDom[declarationEvent] = generatedTriggerValue;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
declarationEventValidate(declarationEvent) {
|
|
281
|
+
const validateResult = new validate_result_1.ValidateResult(true);
|
|
282
|
+
if (!declarationEvent.path) {
|
|
283
|
+
validateResult.setErrorMessage(`the declaration event has none path value.the declaration event code is ${declarationEvent.code}`);
|
|
284
|
+
validateResult.setCanContinue(false);
|
|
285
|
+
return validateResult;
|
|
286
|
+
}
|
|
287
|
+
if (!declarationEvent.event) {
|
|
288
|
+
validateResult.setCanContinue(false);
|
|
289
|
+
validateResult.setErrorMessage(`the declaration event has none event value.the declaration event code is ${declarationEvent.code}`);
|
|
290
|
+
return validateResult;
|
|
291
|
+
}
|
|
292
|
+
return validateResult;
|
|
293
|
+
}
|
|
294
|
+
dealWithSpecialButton(selectedComponent, declarationPathArray, toolbar) {
|
|
295
|
+
if (toolbar.items && toolbar.items[selectedComponent.viewModel] && toolbar.items[selectedComponent.viewModel].length > 0) {
|
|
296
|
+
toolbar.items[selectedComponent.viewModel].forEach((item) => {
|
|
297
|
+
if (item.id == declarationPathArray.slice(-1)[0]) {
|
|
298
|
+
this.triggerValue = item;
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
exports.DeclarationTrigger = DeclarationTrigger;
|
|
295
305
|
//# sourceMappingURL=declaration-trigger.js.map
|