@byteluck-fe/model-driven-engine 2.7.0-alpha.2 → 2.7.0-alpha.20
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/esm/common/ActionManager.js +98 -63
- package/dist/esm/common/DataManager.js +75 -34
- package/dist/esm/common/Engine.js +1151 -936
- package/dist/esm/common/OkWorker.js +119 -74
- package/dist/esm/common/Runtime.js +43 -22
- package/dist/esm/common/Store.js +159 -129
- package/dist/esm/common/checkerValue.js +330 -248
- package/dist/esm/common/proxyState.js +1 -1
- package/dist/esm/plugins/CalcPlugin.js +393 -309
- package/dist/esm/plugins/ControlsEventPlugin.js +169 -130
- package/dist/esm/plugins/ES6ModulePlugin.js +65 -31
- package/dist/esm/plugins/LifecycleEventPlugin.js +119 -83
- package/dist/esm/plugins/StylePlugin.js +46 -13
- package/dist/esm/utils/runtimeUtils.js +2 -1
- package/dist/index.umd.js +11 -11
- package/dist/types/common/Engine.d.ts +1 -1
- package/package.json +4 -4
|
@@ -32,6 +32,33 @@ function _classCallCheck(instance, Constructor) {
|
|
|
32
32
|
throw new TypeError("Cannot call a class as a function");
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
function _defineProperties(target, props) {
|
|
36
|
+
for(var i = 0; i < props.length; i++){
|
|
37
|
+
var descriptor = props[i];
|
|
38
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
39
|
+
descriptor.configurable = true;
|
|
40
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
41
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
45
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
46
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
47
|
+
return Constructor;
|
|
48
|
+
}
|
|
49
|
+
function _defineProperty(obj, key, value) {
|
|
50
|
+
if (key in obj) {
|
|
51
|
+
Object.defineProperty(obj, key, {
|
|
52
|
+
value: value,
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
writable: true
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
obj[key] = value;
|
|
59
|
+
}
|
|
60
|
+
return obj;
|
|
61
|
+
}
|
|
35
62
|
var __generator = this && this.__generator || function(thisArg, body) {
|
|
36
63
|
var f, y, t, g, _ = {
|
|
37
64
|
label: 0,
|
|
@@ -135,142 +162,154 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
135
162
|
"use strict";
|
|
136
163
|
function ControlsEventPlugin(config) {
|
|
137
164
|
_classCallCheck(this, ControlsEventPlugin);
|
|
165
|
+
_defineProperty(this, "config", void 0);
|
|
166
|
+
_defineProperty(this, "engine", void 0);
|
|
138
167
|
this.config = config;
|
|
139
168
|
}
|
|
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
|
-
|
|
169
|
+
_createClass(ControlsEventPlugin, [
|
|
170
|
+
{
|
|
171
|
+
key: "apply",
|
|
172
|
+
value: function apply(engine) {
|
|
173
|
+
var _this = this;
|
|
174
|
+
this.engine = engine;
|
|
175
|
+
// const eventKeyMap: EventKeyMap = {
|
|
176
|
+
// click: 'on_click',
|
|
177
|
+
// change: 'on_change',
|
|
178
|
+
// search: 'on_search',
|
|
179
|
+
// focus: 'on_focus',
|
|
180
|
+
// blur: 'on_blur',
|
|
181
|
+
// input: 'on_input',
|
|
182
|
+
// 'click-finish': 'on_click_finish',
|
|
183
|
+
// 'list-change': 'on_list_change',
|
|
184
|
+
// 'list-delete': 'on_list_delete',
|
|
185
|
+
// 'list-search': 'on_list_search',
|
|
186
|
+
// 'list-mounted': 'on_list_mounted',
|
|
187
|
+
// 'list-actions': 'on_list_actions',
|
|
188
|
+
// 'list-rowclick': 'on_list_rowclick',
|
|
189
|
+
// 'list-before-import': 'on_list_before_import',
|
|
190
|
+
// 'wps-open': 'on_wps_open',
|
|
191
|
+
// 'wps-save': 'on_wps_save',
|
|
192
|
+
// 'wps-rename': 'on_wps_rename',
|
|
193
|
+
// }
|
|
194
|
+
// Object.entries(eventKeyMap).forEach(([eventKey, controlEventKey]) => {
|
|
195
|
+
// if (eventKey && controlEventKey) {
|
|
196
|
+
// this.engineAddEventListener(eventKey as EventKeys, controlEventKey)
|
|
197
|
+
// }
|
|
198
|
+
// })
|
|
199
|
+
EventLogic.events.forEach(function(eventItem) {
|
|
200
|
+
if (eventItem.code && eventItem.key) {
|
|
201
|
+
_this.engineAddEventListener(eventItem.code, eventItem.key);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
171
204
|
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
key: "engineAddEventListener",
|
|
208
|
+
value: function engineAddEventListener(eventKey, controlEventKey) {
|
|
209
|
+
var _this = this;
|
|
210
|
+
this.engine.on(eventKey, function() {
|
|
211
|
+
var _ref = _asyncToGenerator(function(payload) {
|
|
212
|
+
return __generator(this, function(_state) {
|
|
213
|
+
switch(_state.label){
|
|
214
|
+
case 0:
|
|
215
|
+
// 初始化state的时候不触发change事件,必须在engine mounted以后才触发
|
|
216
|
+
if (eventKey === "change" && !_this.engine.isMounted) {
|
|
217
|
+
return [
|
|
218
|
+
2
|
|
219
|
+
];
|
|
220
|
+
}
|
|
221
|
+
if (!(payload.instance !== undefined)) return [
|
|
222
|
+
3,
|
|
223
|
+
2
|
|
224
|
+
];
|
|
225
|
+
return [
|
|
226
|
+
4,
|
|
227
|
+
_this.callControlEvent(controlEventKey, payload)
|
|
228
|
+
];
|
|
229
|
+
case 1:
|
|
230
|
+
return [
|
|
231
|
+
2,
|
|
232
|
+
_state.sent()
|
|
233
|
+
];
|
|
234
|
+
case 2:
|
|
235
|
+
return [
|
|
236
|
+
2
|
|
237
|
+
];
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
return function(payload) {
|
|
242
|
+
return _ref.apply(this, arguments);
|
|
243
|
+
};
|
|
244
|
+
}());
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
key: "callControlEvent",
|
|
249
|
+
value: function callControlEvent(name, payload) {
|
|
250
|
+
var _this = this;
|
|
251
|
+
return _asyncToGenerator(function() {
|
|
252
|
+
var events, result;
|
|
253
|
+
return __generator(this, function(_state) {
|
|
254
|
+
switch(_state.label){
|
|
255
|
+
case 0:
|
|
256
|
+
events = _this.config[payload.instance.id];
|
|
257
|
+
if (!events || !Array.isArray(events[name])) {
|
|
258
|
+
return [
|
|
259
|
+
2,
|
|
260
|
+
[]
|
|
261
|
+
];
|
|
262
|
+
}
|
|
263
|
+
return [
|
|
264
|
+
4,
|
|
265
|
+
Promise.all(events[name].map(function() {
|
|
266
|
+
var _ref = _asyncToGenerator(function(eventName) {
|
|
267
|
+
var execResult;
|
|
268
|
+
return __generator(this, function(_state) {
|
|
269
|
+
switch(_state.label){
|
|
270
|
+
case 0:
|
|
271
|
+
return [
|
|
272
|
+
4,
|
|
273
|
+
_this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
|
|
274
|
+
// this.engine,
|
|
275
|
+
// this.engine.getAction().actionUtils, //以前是params,空的
|
|
276
|
+
payload)
|
|
277
|
+
];
|
|
278
|
+
case 1:
|
|
279
|
+
execResult = _state.sent();
|
|
280
|
+
return [
|
|
281
|
+
2,
|
|
282
|
+
execResult
|
|
283
|
+
];
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
return function(eventName) {
|
|
288
|
+
return _ref.apply(this, arguments);
|
|
289
|
+
};
|
|
290
|
+
}()))
|
|
291
|
+
];
|
|
292
|
+
case 1:
|
|
293
|
+
result = _state.sent();
|
|
294
|
+
if (result.includes(false)) {
|
|
295
|
+
return [
|
|
296
|
+
2,
|
|
297
|
+
false
|
|
298
|
+
];
|
|
299
|
+
} else {
|
|
300
|
+
return [
|
|
301
|
+
2,
|
|
302
|
+
result
|
|
303
|
+
];
|
|
304
|
+
}
|
|
183
305
|
return [
|
|
184
306
|
2
|
|
185
307
|
];
|
|
186
|
-
}
|
|
187
|
-
if (!(payload.instance !== undefined)) return [
|
|
188
|
-
3,
|
|
189
|
-
2
|
|
190
|
-
];
|
|
191
|
-
return [
|
|
192
|
-
4,
|
|
193
|
-
_this.callControlEvent(controlEventKey, payload)
|
|
194
|
-
];
|
|
195
|
-
case 1:
|
|
196
|
-
return [
|
|
197
|
-
2,
|
|
198
|
-
_state.sent()
|
|
199
|
-
];
|
|
200
|
-
case 2:
|
|
201
|
-
return [
|
|
202
|
-
2
|
|
203
|
-
];
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
return function(payload) {
|
|
208
|
-
return _ref.apply(this, arguments);
|
|
209
|
-
};
|
|
210
|
-
}());
|
|
211
|
-
};
|
|
212
|
-
_proto.callControlEvent = function callControlEvent(name, payload) {
|
|
213
|
-
var _this = this;
|
|
214
|
-
return _asyncToGenerator(function() {
|
|
215
|
-
var events, result;
|
|
216
|
-
return __generator(this, function(_state) {
|
|
217
|
-
switch(_state.label){
|
|
218
|
-
case 0:
|
|
219
|
-
events = _this.config[payload.instance.id];
|
|
220
|
-
if (!events || !Array.isArray(events[name])) {
|
|
221
|
-
return [
|
|
222
|
-
2,
|
|
223
|
-
[]
|
|
224
|
-
];
|
|
225
|
-
}
|
|
226
|
-
return [
|
|
227
|
-
4,
|
|
228
|
-
Promise.all(events[name].map(function() {
|
|
229
|
-
var _ref = _asyncToGenerator(function(eventName) {
|
|
230
|
-
var execResult;
|
|
231
|
-
return __generator(this, function(_state) {
|
|
232
|
-
switch(_state.label){
|
|
233
|
-
case 0:
|
|
234
|
-
return [
|
|
235
|
-
4,
|
|
236
|
-
_this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
|
|
237
|
-
// this.engine,
|
|
238
|
-
// this.engine.getAction().actionUtils, //以前是params,空的
|
|
239
|
-
payload)
|
|
240
|
-
];
|
|
241
|
-
case 1:
|
|
242
|
-
execResult = _state.sent();
|
|
243
|
-
return [
|
|
244
|
-
2,
|
|
245
|
-
execResult
|
|
246
|
-
];
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
return function(eventName) {
|
|
251
|
-
return _ref.apply(this, arguments);
|
|
252
|
-
};
|
|
253
|
-
}()))
|
|
254
|
-
];
|
|
255
|
-
case 1:
|
|
256
|
-
result = _state.sent();
|
|
257
|
-
if (result.includes(false)) {
|
|
258
|
-
return [
|
|
259
|
-
2,
|
|
260
|
-
false
|
|
261
|
-
];
|
|
262
|
-
} else {
|
|
263
|
-
return [
|
|
264
|
-
2,
|
|
265
|
-
result
|
|
266
|
-
];
|
|
267
308
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
})();
|
|
274
|
-
};
|
|
309
|
+
});
|
|
310
|
+
})();
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
]);
|
|
275
314
|
return ControlsEventPlugin;
|
|
276
315
|
}();
|
|
@@ -11,6 +11,33 @@ function _classCallCheck(instance, Constructor) {
|
|
|
11
11
|
throw new TypeError("Cannot call a class as a function");
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
function _defineProperties(target, props) {
|
|
15
|
+
for(var i = 0; i < props.length; i++){
|
|
16
|
+
var descriptor = props[i];
|
|
17
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
18
|
+
descriptor.configurable = true;
|
|
19
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
20
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
24
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
25
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
26
|
+
return Constructor;
|
|
27
|
+
}
|
|
28
|
+
function _defineProperty(obj, key, value) {
|
|
29
|
+
if (key in obj) {
|
|
30
|
+
Object.defineProperty(obj, key, {
|
|
31
|
+
value: value,
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true
|
|
35
|
+
});
|
|
36
|
+
} else {
|
|
37
|
+
obj[key] = value;
|
|
38
|
+
}
|
|
39
|
+
return obj;
|
|
40
|
+
}
|
|
14
41
|
function _iterableToArrayLimit(arr, i) {
|
|
15
42
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
16
43
|
if (_i == null) return;
|
|
@@ -54,44 +81,51 @@ export var ES6ModulePlugin = /*#__PURE__*/ function() {
|
|
|
54
81
|
"use strict";
|
|
55
82
|
function ES6ModulePlugin(config, env) {
|
|
56
83
|
_classCallCheck(this, ES6ModulePlugin);
|
|
84
|
+
_defineProperty(this, "config", void 0);
|
|
85
|
+
_defineProperty(this, "engine", void 0);
|
|
86
|
+
_defineProperty(this, "env", void 0);
|
|
57
87
|
this.config = config;
|
|
58
88
|
this.env = env;
|
|
59
89
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
73
|
-
try {
|
|
74
|
-
for(var _iterator = Object.entries(res.funcMap)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
75
|
-
var _step_value = _slicedToArray(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
76
|
-
actionManager.addAction(key, value);
|
|
77
|
-
}
|
|
78
|
-
} catch (err) {
|
|
79
|
-
_didIteratorError = true;
|
|
80
|
-
_iteratorError = err;
|
|
81
|
-
} finally{
|
|
82
|
-
try {
|
|
83
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
84
|
-
_iterator.return();
|
|
90
|
+
_createClass(ES6ModulePlugin, [
|
|
91
|
+
{
|
|
92
|
+
key: "apply",
|
|
93
|
+
value: function apply(engine) {
|
|
94
|
+
this.engine = engine;
|
|
95
|
+
var action = this.config;
|
|
96
|
+
if (!action) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
var res = parseModule(action, engine, this.env);
|
|
100
|
+
if (!res) {
|
|
101
|
+
return;
|
|
85
102
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
103
|
+
var actionManager = engine.getAction();
|
|
104
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
105
|
+
try {
|
|
106
|
+
for(var _iterator = Object.entries(res.funcMap)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
107
|
+
var _step_value = _slicedToArray(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
108
|
+
actionManager.addAction(key, value);
|
|
109
|
+
}
|
|
110
|
+
} catch (err) {
|
|
111
|
+
_didIteratorError = true;
|
|
112
|
+
_iteratorError = err;
|
|
113
|
+
} finally{
|
|
114
|
+
try {
|
|
115
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
116
|
+
_iterator.return();
|
|
117
|
+
}
|
|
118
|
+
} finally{
|
|
119
|
+
if (_didIteratorError) {
|
|
120
|
+
throw _iteratorError;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
89
123
|
}
|
|
124
|
+
//qiyu state会proxy,将过深的变量存储会导致崩溃
|
|
125
|
+
// engine.setState('variables', res.variables)
|
|
90
126
|
}
|
|
91
127
|
}
|
|
92
|
-
|
|
93
|
-
// engine.setState('variables', res.variables)
|
|
94
|
-
};
|
|
128
|
+
]);
|
|
95
129
|
return ES6ModulePlugin;
|
|
96
130
|
}();
|
|
97
131
|
export function parseModule(action, engine, env) {
|
|
@@ -40,6 +40,33 @@ function _classCallCheck(instance, Constructor) {
|
|
|
40
40
|
throw new TypeError("Cannot call a class as a function");
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
function _defineProperties(target, props) {
|
|
44
|
+
for(var i = 0; i < props.length; i++){
|
|
45
|
+
var descriptor = props[i];
|
|
46
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
47
|
+
descriptor.configurable = true;
|
|
48
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
49
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
53
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
54
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
55
|
+
return Constructor;
|
|
56
|
+
}
|
|
57
|
+
function _defineProperty(obj, key, value) {
|
|
58
|
+
if (key in obj) {
|
|
59
|
+
Object.defineProperty(obj, key, {
|
|
60
|
+
value: value,
|
|
61
|
+
enumerable: true,
|
|
62
|
+
configurable: true,
|
|
63
|
+
writable: true
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
obj[key] = value;
|
|
67
|
+
}
|
|
68
|
+
return obj;
|
|
69
|
+
}
|
|
43
70
|
function _iterableToArrayLimit(arr, i) {
|
|
44
71
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
45
72
|
if (_i == null) return;
|
|
@@ -183,102 +210,111 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
183
210
|
"use strict";
|
|
184
211
|
function LifecycleEventPlugin(config) {
|
|
185
212
|
_classCallCheck(this, LifecycleEventPlugin);
|
|
213
|
+
_defineProperty(this, "config", void 0);
|
|
214
|
+
_defineProperty(this, "engine", void 0);
|
|
186
215
|
this.config = config;
|
|
187
216
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
217
|
+
_createClass(LifecycleEventPlugin, [
|
|
218
|
+
{
|
|
219
|
+
key: "apply",
|
|
220
|
+
value: function apply(engine) {
|
|
221
|
+
var _this = this;
|
|
222
|
+
this.engine = engine;
|
|
223
|
+
Object.entries(LifecycleEventKeyMap).forEach(function(param) {
|
|
224
|
+
var _param = _slicedToArray(param, 2), engineKey = _param[0], lifecycleKey = _param[1];
|
|
225
|
+
var _this1 = _this;
|
|
226
|
+
engine.on(engineKey, function() {
|
|
227
|
+
var _ref = _asyncToGenerator(function(payload) {
|
|
228
|
+
var result;
|
|
229
|
+
return __generator(this, function(_state) {
|
|
230
|
+
switch(_state.label){
|
|
231
|
+
case 0:
|
|
232
|
+
return [
|
|
233
|
+
4,
|
|
234
|
+
_this1.callLifecycleEvent(lifecycleKey, payload)
|
|
235
|
+
];
|
|
236
|
+
case 1:
|
|
237
|
+
result = _state.sent();
|
|
238
|
+
if (result.includes(false)) {
|
|
239
|
+
return [
|
|
240
|
+
2,
|
|
241
|
+
false
|
|
242
|
+
];
|
|
243
|
+
} else {
|
|
244
|
+
return [
|
|
245
|
+
2,
|
|
246
|
+
result
|
|
247
|
+
];
|
|
248
|
+
}
|
|
249
|
+
return [
|
|
250
|
+
2
|
|
251
|
+
];
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
return function(payload) {
|
|
256
|
+
return _ref.apply(this, arguments);
|
|
257
|
+
};
|
|
258
|
+
}());
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
key: "callLifecycleEvent",
|
|
264
|
+
value: function callLifecycleEvent(name, payload) {
|
|
265
|
+
var _this = this;
|
|
266
|
+
return _asyncToGenerator(function() {
|
|
267
|
+
var events, result;
|
|
198
268
|
return __generator(this, function(_state) {
|
|
199
269
|
switch(_state.label){
|
|
200
270
|
case 0:
|
|
271
|
+
events = _this.config;
|
|
272
|
+
if (!events || !Array.isArray(events[name])) {
|
|
273
|
+
return [
|
|
274
|
+
2,
|
|
275
|
+
[]
|
|
276
|
+
];
|
|
277
|
+
}
|
|
201
278
|
return [
|
|
202
279
|
4,
|
|
203
|
-
|
|
280
|
+
Promise.all(events[name].map(function() {
|
|
281
|
+
var _ref = _asyncToGenerator(function(eventName) {
|
|
282
|
+
var execResult;
|
|
283
|
+
return __generator(this, function(_state) {
|
|
284
|
+
switch(_state.label){
|
|
285
|
+
case 0:
|
|
286
|
+
return [
|
|
287
|
+
4,
|
|
288
|
+
_this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
|
|
289
|
+
// this.engine,
|
|
290
|
+
// this.engine.getAction().actionUtils, //以前是params,空的
|
|
291
|
+
payload)
|
|
292
|
+
];
|
|
293
|
+
case 1:
|
|
294
|
+
execResult = _state.sent();
|
|
295
|
+
return [
|
|
296
|
+
2,
|
|
297
|
+
execResult
|
|
298
|
+
];
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
return function(eventName) {
|
|
303
|
+
return _ref.apply(this, arguments);
|
|
304
|
+
};
|
|
305
|
+
}()))
|
|
204
306
|
];
|
|
205
307
|
case 1:
|
|
206
308
|
result = _state.sent();
|
|
207
|
-
if (result.includes(false)) {
|
|
208
|
-
return [
|
|
209
|
-
2,
|
|
210
|
-
false
|
|
211
|
-
];
|
|
212
|
-
} else {
|
|
213
|
-
return [
|
|
214
|
-
2,
|
|
215
|
-
result
|
|
216
|
-
];
|
|
217
|
-
}
|
|
218
309
|
return [
|
|
219
|
-
2
|
|
310
|
+
2,
|
|
311
|
+
result
|
|
220
312
|
];
|
|
221
313
|
}
|
|
222
314
|
});
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}());
|
|
228
|
-
});
|
|
229
|
-
};
|
|
230
|
-
_proto.callLifecycleEvent = function callLifecycleEvent(name, payload) {
|
|
231
|
-
var _this = this;
|
|
232
|
-
return _asyncToGenerator(function() {
|
|
233
|
-
var events, result;
|
|
234
|
-
return __generator(this, function(_state) {
|
|
235
|
-
switch(_state.label){
|
|
236
|
-
case 0:
|
|
237
|
-
events = _this.config;
|
|
238
|
-
if (!events || !Array.isArray(events[name])) {
|
|
239
|
-
return [
|
|
240
|
-
2,
|
|
241
|
-
[]
|
|
242
|
-
];
|
|
243
|
-
}
|
|
244
|
-
return [
|
|
245
|
-
4,
|
|
246
|
-
Promise.all(events[name].map(function() {
|
|
247
|
-
var _ref = _asyncToGenerator(function(eventName) {
|
|
248
|
-
var execResult;
|
|
249
|
-
return __generator(this, function(_state) {
|
|
250
|
-
switch(_state.label){
|
|
251
|
-
case 0:
|
|
252
|
-
return [
|
|
253
|
-
4,
|
|
254
|
-
_this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
|
|
255
|
-
// this.engine,
|
|
256
|
-
// this.engine.getAction().actionUtils, //以前是params,空的
|
|
257
|
-
payload)
|
|
258
|
-
];
|
|
259
|
-
case 1:
|
|
260
|
-
execResult = _state.sent();
|
|
261
|
-
return [
|
|
262
|
-
2,
|
|
263
|
-
execResult
|
|
264
|
-
];
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
|
-
return function(eventName) {
|
|
269
|
-
return _ref.apply(this, arguments);
|
|
270
|
-
};
|
|
271
|
-
}()))
|
|
272
|
-
];
|
|
273
|
-
case 1:
|
|
274
|
-
result = _state.sent();
|
|
275
|
-
return [
|
|
276
|
-
2,
|
|
277
|
-
result
|
|
278
|
-
];
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
})();
|
|
282
|
-
};
|
|
315
|
+
})();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
]);
|
|
283
319
|
return LifecycleEventPlugin;
|
|
284
320
|
}();
|