@byteluck-fe/model-driven-engine 2.7.0-alpha.18 → 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 +157 -40
- package/dist/esm/common/DataManager.js +129 -20
- package/dist/esm/common/Engine.js +338 -211
- package/dist/esm/common/OkWorker.js +27 -13
- package/dist/esm/common/Runtime.js +26 -11
- package/dist/esm/common/Store.js +51 -50
- package/dist/esm/common/checkerValue.js +39 -39
- package/dist/esm/common/index.js +2 -2
- package/dist/esm/common/proxyState.js +47 -47
- package/dist/esm/index.js +3 -3
- package/dist/esm/plugins/CalcPlugin.js +67 -59
- package/dist/esm/plugins/ControlsEventPlugin.js +191 -68
- package/dist/esm/plugins/ES6ModulePlugin.js +24 -8
- package/dist/esm/plugins/LifecycleEventPlugin.js +183 -64
- package/dist/esm/plugins/StylePlugin.js +22 -7
- package/dist/esm/plugins/index.js +5 -5
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/runtimeUtils.js +5 -7
- package/dist/index.umd.js +8 -8
- package/dist/types/common/Engine.d.ts +6 -6
- package/dist/types/common/Runtime.d.ts +1 -1
- package/dist/types/common/Store.d.ts +5 -5
- package/dist/types/common/proxyState.d.ts +3 -3
- package/dist/types/plugins/ControlsEventPlugin.d.ts +1 -1
- package/dist/types/plugins/ES6ModulePlugin.d.ts +4 -4
- package/dist/types/plugins/LifecycleEventPlugin.d.ts +1 -1
- package/dist/types/plugins/StylePlugin.d.ts +1 -1
- package/package.json +3 -3
|
@@ -46,8 +46,115 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
46
46
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
47
47
|
return Constructor;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
|
|
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
|
+
}
|
|
62
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
63
|
+
var f, y, t, g, _ = {
|
|
64
|
+
label: 0,
|
|
65
|
+
sent: function() {
|
|
66
|
+
if (t[0] & 1) throw t[1];
|
|
67
|
+
return t[1];
|
|
68
|
+
},
|
|
69
|
+
trys: [],
|
|
70
|
+
ops: []
|
|
71
|
+
};
|
|
72
|
+
return(g = {
|
|
73
|
+
next: verb(0),
|
|
74
|
+
"throw": verb(1),
|
|
75
|
+
"return": verb(2)
|
|
76
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
77
|
+
return this;
|
|
78
|
+
}), g);
|
|
79
|
+
function verb(n) {
|
|
80
|
+
return function(v) {
|
|
81
|
+
return step([
|
|
82
|
+
n,
|
|
83
|
+
v
|
|
84
|
+
]);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function step(op) {
|
|
88
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
89
|
+
while(_)try {
|
|
90
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
91
|
+
if (y = 0, t) op = [
|
|
92
|
+
op[0] & 2,
|
|
93
|
+
t.value
|
|
94
|
+
];
|
|
95
|
+
switch(op[0]){
|
|
96
|
+
case 0:
|
|
97
|
+
case 1:
|
|
98
|
+
t = op;
|
|
99
|
+
break;
|
|
100
|
+
case 4:
|
|
101
|
+
_.label++;
|
|
102
|
+
return {
|
|
103
|
+
value: op[1],
|
|
104
|
+
done: false
|
|
105
|
+
};
|
|
106
|
+
case 5:
|
|
107
|
+
_.label++;
|
|
108
|
+
y = op[1];
|
|
109
|
+
op = [
|
|
110
|
+
0
|
|
111
|
+
];
|
|
112
|
+
continue;
|
|
113
|
+
case 7:
|
|
114
|
+
op = _.ops.pop();
|
|
115
|
+
_.trys.pop();
|
|
116
|
+
continue;
|
|
117
|
+
default:
|
|
118
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
119
|
+
_ = 0;
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
123
|
+
_.label = op[1];
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
127
|
+
_.label = t[1];
|
|
128
|
+
t = op;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
if (t && _.label < t[2]) {
|
|
132
|
+
_.label = t[2];
|
|
133
|
+
_.ops.push(op);
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
if (t[2]) _.ops.pop();
|
|
137
|
+
_.trys.pop();
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
op = body.call(thisArg, _);
|
|
141
|
+
} catch (e) {
|
|
142
|
+
op = [
|
|
143
|
+
6,
|
|
144
|
+
e
|
|
145
|
+
];
|
|
146
|
+
y = 0;
|
|
147
|
+
} finally{
|
|
148
|
+
f = t = 0;
|
|
149
|
+
}
|
|
150
|
+
if (op[0] & 5) throw op[1];
|
|
151
|
+
return {
|
|
152
|
+
value: op[0] ? op[1] : void 0,
|
|
153
|
+
done: true
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
import { EventLogic } from "@byteluck-fe/model-driven-shared";
|
|
51
158
|
// type EventKeyMap = {
|
|
52
159
|
// [eventKey in EventKeys]?: string
|
|
53
160
|
// }
|
|
@@ -55,6 +162,8 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
55
162
|
"use strict";
|
|
56
163
|
function ControlsEventPlugin(config) {
|
|
57
164
|
_classCallCheck(this, ControlsEventPlugin);
|
|
165
|
+
_defineProperty(this, "config", void 0);
|
|
166
|
+
_defineProperty(this, "engine", void 0);
|
|
58
167
|
this.config = config;
|
|
59
168
|
}
|
|
60
169
|
_createClass(ControlsEventPlugin, [
|
|
@@ -99,30 +208,36 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
99
208
|
value: function engineAddEventListener(eventKey, controlEventKey) {
|
|
100
209
|
var _this = this;
|
|
101
210
|
this.engine.on(eventKey, function() {
|
|
102
|
-
var _ref = _asyncToGenerator(
|
|
103
|
-
return
|
|
104
|
-
|
|
211
|
+
var _ref = _asyncToGenerator(function(payload) {
|
|
212
|
+
return __generator(this, function(_state) {
|
|
213
|
+
switch(_state.label){
|
|
105
214
|
case 0:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
215
|
+
// 初始化state的时候不触发change事件,必须在engine mounted以后才触发
|
|
216
|
+
if (eventKey === "change" && !_this.engine.isMounted) {
|
|
217
|
+
return [
|
|
218
|
+
2
|
|
219
|
+
];
|
|
109
220
|
}
|
|
110
|
-
|
|
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
|
+
];
|
|
111
234
|
case 2:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
_ctx.next = 5;
|
|
117
|
-
return _this.callControlEvent(controlEventKey, payload);
|
|
118
|
-
case 5:
|
|
119
|
-
return _ctx.abrupt("return", _ctx.sent);
|
|
120
|
-
case 6:
|
|
121
|
-
case "end":
|
|
122
|
-
return _ctx.stop();
|
|
235
|
+
return [
|
|
236
|
+
2
|
|
237
|
+
];
|
|
123
238
|
}
|
|
124
|
-
}
|
|
125
|
-
})
|
|
239
|
+
});
|
|
240
|
+
});
|
|
126
241
|
return function(payload) {
|
|
127
242
|
return _ref.apply(this, arguments);
|
|
128
243
|
};
|
|
@@ -133,58 +248,66 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
133
248
|
key: "callControlEvent",
|
|
134
249
|
value: function callControlEvent(name, payload) {
|
|
135
250
|
var _this = this;
|
|
136
|
-
return _asyncToGenerator(
|
|
251
|
+
return _asyncToGenerator(function() {
|
|
137
252
|
var events, result;
|
|
138
|
-
return
|
|
139
|
-
|
|
253
|
+
return __generator(this, function(_state) {
|
|
254
|
+
switch(_state.label){
|
|
140
255
|
case 0:
|
|
141
256
|
events = _this.config[payload.instance.id];
|
|
142
|
-
if (!
|
|
143
|
-
|
|
144
|
-
|
|
257
|
+
if (!events || !Array.isArray(events[name])) {
|
|
258
|
+
return [
|
|
259
|
+
2,
|
|
260
|
+
[]
|
|
261
|
+
];
|
|
145
262
|
}
|
|
146
|
-
return
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
return
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
+
];
|
|
178
304
|
}
|
|
179
|
-
return
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
case 11:
|
|
183
|
-
case "end":
|
|
184
|
-
return _ctx1.stop();
|
|
305
|
+
return [
|
|
306
|
+
2
|
|
307
|
+
];
|
|
185
308
|
}
|
|
186
|
-
}
|
|
187
|
-
})
|
|
309
|
+
});
|
|
310
|
+
})();
|
|
188
311
|
}
|
|
189
312
|
}
|
|
190
313
|
]);
|
|
@@ -25,6 +25,19 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
25
25
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
26
26
|
return Constructor;
|
|
27
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
|
+
}
|
|
28
41
|
function _iterableToArrayLimit(arr, i) {
|
|
29
42
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
30
43
|
if (_i == null) return;
|
|
@@ -63,11 +76,14 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
63
76
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
64
77
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
65
78
|
}
|
|
66
|
-
import { error } from
|
|
79
|
+
import { error } from "@byteluck-fe/model-driven-shared";
|
|
67
80
|
export var ES6ModulePlugin = /*#__PURE__*/ function() {
|
|
68
81
|
"use strict";
|
|
69
82
|
function ES6ModulePlugin(config, env) {
|
|
70
83
|
_classCallCheck(this, ES6ModulePlugin);
|
|
84
|
+
_defineProperty(this, "config", void 0);
|
|
85
|
+
_defineProperty(this, "engine", void 0);
|
|
86
|
+
_defineProperty(this, "env", void 0);
|
|
71
87
|
this.config = config;
|
|
72
88
|
this.env = env;
|
|
73
89
|
}
|
|
@@ -88,7 +104,7 @@ export var ES6ModulePlugin = /*#__PURE__*/ function() {
|
|
|
88
104
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
89
105
|
try {
|
|
90
106
|
for(var _iterator = Object.entries(res.funcMap)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
91
|
-
var
|
|
107
|
+
var _step_value = _slicedToArray(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
92
108
|
actionManager.addAction(key, value);
|
|
93
109
|
}
|
|
94
110
|
} catch (err) {
|
|
@@ -125,11 +141,11 @@ export function parseModule(action, engine, env) {
|
|
|
125
141
|
}
|
|
126
142
|
};
|
|
127
143
|
try {
|
|
128
|
-
new Function(
|
|
144
|
+
new Function("module", "exports", compiled).call(module, module, module.exports);
|
|
129
145
|
} catch (e) {
|
|
130
|
-
error(e.message +
|
|
131
|
-
if (process.env.NODE_ENV !==
|
|
132
|
-
error(
|
|
146
|
+
error(e.message + ". fail to parse the module");
|
|
147
|
+
if (process.env.NODE_ENV !== "production") {
|
|
148
|
+
error("fail to parse the module");
|
|
133
149
|
}
|
|
134
150
|
}
|
|
135
151
|
var funcMap = {};
|
|
@@ -137,8 +153,8 @@ export function parseModule(action, engine, env) {
|
|
|
137
153
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
138
154
|
try {
|
|
139
155
|
for(var _iterator = Object.entries(module.exports)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
140
|
-
var
|
|
141
|
-
if (typeof value ===
|
|
156
|
+
var _step_value = _slicedToArray(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
157
|
+
if (typeof value === "function") {
|
|
142
158
|
funcMap[key] = value;
|
|
143
159
|
} else {
|
|
144
160
|
variables[key] = value;
|
|
@@ -54,6 +54,19 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
54
54
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
55
55
|
return Constructor;
|
|
56
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
|
+
}
|
|
57
70
|
function _iterableToArrayLimit(arr, i) {
|
|
58
71
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
59
72
|
if (_i == null) return;
|
|
@@ -92,17 +105,113 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
92
105
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
93
106
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
94
107
|
}
|
|
95
|
-
|
|
108
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
109
|
+
var f, y, t, g, _ = {
|
|
110
|
+
label: 0,
|
|
111
|
+
sent: function() {
|
|
112
|
+
if (t[0] & 1) throw t[1];
|
|
113
|
+
return t[1];
|
|
114
|
+
},
|
|
115
|
+
trys: [],
|
|
116
|
+
ops: []
|
|
117
|
+
};
|
|
118
|
+
return(g = {
|
|
119
|
+
next: verb(0),
|
|
120
|
+
"throw": verb(1),
|
|
121
|
+
"return": verb(2)
|
|
122
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
123
|
+
return this;
|
|
124
|
+
}), g);
|
|
125
|
+
function verb(n) {
|
|
126
|
+
return function(v) {
|
|
127
|
+
return step([
|
|
128
|
+
n,
|
|
129
|
+
v
|
|
130
|
+
]);
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function step(op) {
|
|
134
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
135
|
+
while(_)try {
|
|
136
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
137
|
+
if (y = 0, t) op = [
|
|
138
|
+
op[0] & 2,
|
|
139
|
+
t.value
|
|
140
|
+
];
|
|
141
|
+
switch(op[0]){
|
|
142
|
+
case 0:
|
|
143
|
+
case 1:
|
|
144
|
+
t = op;
|
|
145
|
+
break;
|
|
146
|
+
case 4:
|
|
147
|
+
_.label++;
|
|
148
|
+
return {
|
|
149
|
+
value: op[1],
|
|
150
|
+
done: false
|
|
151
|
+
};
|
|
152
|
+
case 5:
|
|
153
|
+
_.label++;
|
|
154
|
+
y = op[1];
|
|
155
|
+
op = [
|
|
156
|
+
0
|
|
157
|
+
];
|
|
158
|
+
continue;
|
|
159
|
+
case 7:
|
|
160
|
+
op = _.ops.pop();
|
|
161
|
+
_.trys.pop();
|
|
162
|
+
continue;
|
|
163
|
+
default:
|
|
164
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
165
|
+
_ = 0;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
169
|
+
_.label = op[1];
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
173
|
+
_.label = t[1];
|
|
174
|
+
t = op;
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
if (t && _.label < t[2]) {
|
|
178
|
+
_.label = t[2];
|
|
179
|
+
_.ops.push(op);
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
if (t[2]) _.ops.pop();
|
|
183
|
+
_.trys.pop();
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
op = body.call(thisArg, _);
|
|
187
|
+
} catch (e) {
|
|
188
|
+
op = [
|
|
189
|
+
6,
|
|
190
|
+
e
|
|
191
|
+
];
|
|
192
|
+
y = 0;
|
|
193
|
+
} finally{
|
|
194
|
+
f = t = 0;
|
|
195
|
+
}
|
|
196
|
+
if (op[0] & 5) throw op[1];
|
|
197
|
+
return {
|
|
198
|
+
value: op[0] ? op[1] : void 0,
|
|
199
|
+
done: true
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
};
|
|
96
203
|
var LifecycleEventKeyMap = {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
204
|
+
"engine-mounted": "did_mount",
|
|
205
|
+
"engine-submit": "will_submit",
|
|
206
|
+
"engine-submit-params": "do_submit",
|
|
207
|
+
"engine-submitted": "did_submit"
|
|
101
208
|
};
|
|
102
209
|
export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
103
210
|
"use strict";
|
|
104
211
|
function LifecycleEventPlugin(config) {
|
|
105
212
|
_classCallCheck(this, LifecycleEventPlugin);
|
|
213
|
+
_defineProperty(this, "config", void 0);
|
|
214
|
+
_defineProperty(this, "engine", void 0);
|
|
106
215
|
this.config = config;
|
|
107
216
|
}
|
|
108
217
|
_createClass(LifecycleEventPlugin, [
|
|
@@ -115,28 +224,34 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
115
224
|
var _param = _slicedToArray(param, 2), engineKey = _param[0], lifecycleKey = _param[1];
|
|
116
225
|
var _this1 = _this;
|
|
117
226
|
engine.on(engineKey, function() {
|
|
118
|
-
var _ref = _asyncToGenerator(
|
|
227
|
+
var _ref = _asyncToGenerator(function(payload) {
|
|
119
228
|
var result;
|
|
120
|
-
return
|
|
121
|
-
|
|
229
|
+
return __generator(this, function(_state) {
|
|
230
|
+
switch(_state.label){
|
|
122
231
|
case 0:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
+
];
|
|
130
248
|
}
|
|
131
|
-
return
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
case 8:
|
|
135
|
-
case "end":
|
|
136
|
-
return _ctx.stop();
|
|
249
|
+
return [
|
|
250
|
+
2
|
|
251
|
+
];
|
|
137
252
|
}
|
|
138
|
-
}
|
|
139
|
-
})
|
|
253
|
+
});
|
|
254
|
+
});
|
|
140
255
|
return function(payload) {
|
|
141
256
|
return _ref.apply(this, arguments);
|
|
142
257
|
};
|
|
@@ -148,52 +263,56 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
148
263
|
key: "callLifecycleEvent",
|
|
149
264
|
value: function callLifecycleEvent(name, payload) {
|
|
150
265
|
var _this = this;
|
|
151
|
-
return _asyncToGenerator(
|
|
266
|
+
return _asyncToGenerator(function() {
|
|
152
267
|
var events, result;
|
|
153
|
-
return
|
|
154
|
-
|
|
268
|
+
return __generator(this, function(_state) {
|
|
269
|
+
switch(_state.label){
|
|
155
270
|
case 0:
|
|
156
271
|
events = _this.config;
|
|
157
|
-
if (!
|
|
158
|
-
|
|
159
|
-
|
|
272
|
+
if (!events || !Array.isArray(events[name])) {
|
|
273
|
+
return [
|
|
274
|
+
2,
|
|
275
|
+
[]
|
|
276
|
+
];
|
|
160
277
|
}
|
|
161
|
-
return
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
278
|
+
return [
|
|
279
|
+
4,
|
|
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
|
+
}()))
|
|
306
|
+
];
|
|
307
|
+
case 1:
|
|
308
|
+
result = _state.sent();
|
|
309
|
+
return [
|
|
310
|
+
2,
|
|
311
|
+
result
|
|
312
|
+
];
|
|
194
313
|
}
|
|
195
|
-
}
|
|
196
|
-
})
|
|
314
|
+
});
|
|
315
|
+
})();
|
|
197
316
|
}
|
|
198
317
|
}
|
|
199
318
|
]);
|