@byteluck-fe/model-driven-engine 2.7.0-alpha.15a → 2.7.0-alpha.17

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.
@@ -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 _iterableToArray(iter) {
29
42
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
30
43
  }
@@ -42,8 +55,8 @@ function _unsupportedIterableToArray(o, minLen) {
42
55
  if (n === "Map" || n === "Set") return Array.from(n);
43
56
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
44
57
  }
45
- import { CONTROL_TYPE, CALC_TOKEN_TYPE, CALC_AGGREGATE_TYPE } from '@byteluck-fe/model-driven-shared';
46
- import { format } from 'mathjs';
58
+ import { CONTROL_TYPE, CALC_TOKEN_TYPE, CALC_AGGREGATE_TYPE } from "@byteluck-fe/model-driven-shared";
59
+ import { format } from "mathjs";
47
60
  var DisplayType;
48
61
  (function(DisplayType) {
49
62
  DisplayType[/**
@@ -57,19 +70,21 @@ export var CalcPlugin = /*#__PURE__*/ function() {
57
70
  "use strict";
58
71
  function CalcPlugin(options) {
59
72
  _classCallCheck(this, CalcPlugin);
73
+ _defineProperty(this, "engine", void 0);
74
+ _defineProperty(this, "options", void 0);
60
75
  /**
61
76
  * 所有的计算公式控件
62
77
  * */ // @ts-ignore
63
- this.calcControls = [];
78
+ _defineProperty(this, "calcControls", []);
64
79
  /**
65
80
  * key=控件id value=控件修改后需要触发重新计算的计算公式控件组成的数组
66
81
  * 存储为一个Map,用于在控件change的时候,重新计算依赖的calc
67
- * */ this.dependenciesTriggerMap = new Map();
82
+ * */ _defineProperty(this, "dependenciesTriggerMap", new Map());
68
83
  /**
69
84
  * 隐藏以后需要被计算的控件
70
- * */ this.hideNotRememberControlIds = [];
71
- this.dontHasPermissionControlIds = [];
72
- this.cacheComputedResult = {};
85
+ * */ _defineProperty(this, "hideNotRememberControlIds", []);
86
+ _defineProperty(this, "dontHasPermissionControlIds", []);
87
+ _defineProperty(this, "cacheComputedResult", {});
73
88
  this.options = options;
74
89
  this.getDontHasPermissionControlIds();
75
90
  this.getNeedHideRememberControlIds();
@@ -80,8 +95,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
80
95
  value: /**
81
96
  * @description 获取显隐控制的需要被记住值的控件id
82
97
  * */ function getNeedHideRememberControlIds() {
83
- var ref;
84
- if (!((ref = this.options) === null || ref === void 0 ? void 0 : ref.displayBoList)) {
98
+ var _this_options;
99
+ if (!((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.displayBoList)) {
85
100
  return;
86
101
  }
87
102
  this.hideNotRememberControlIds = this.options.displayBoList.reduce(function(result, current) {
@@ -98,8 +113,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
98
113
  value: /**
99
114
  * @description 获取权限控制的隐藏的字段,不需要参与计算
100
115
  * */ function getDontHasPermissionControlIds() {
101
- var ref;
102
- if (!((ref = this.options) === null || ref === void 0 ? void 0 : ref.behavior)) {
116
+ var _this_options;
117
+ if (!((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.behavior)) {
103
118
  return;
104
119
  }
105
120
  this.dontHasPermissionControlIds = this.options.behavior.reduce(function(result, current) {
@@ -156,7 +171,7 @@ export var CalcPlugin = /*#__PURE__*/ function() {
156
171
  this.watchControlChange();
157
172
  this.watchSubtableChange();
158
173
  this.watchSchemaHideChange();
159
- this.engine.on('engine-mounted', function() {
174
+ this.engine.on("engine-mounted", function() {
160
175
  _this.allCalcControlComputed();
161
176
  });
162
177
  }
@@ -201,16 +216,15 @@ export var CalcPlugin = /*#__PURE__*/ function() {
201
216
  * */ function getCalcDependencies() {
202
217
  var _this = this;
203
218
  this.calcControls.forEach(function(item) {
204
- var _this1 = _this;
205
219
  var scriptEcho = item.props.scriptEcho;
206
220
  scriptEcho.forEach(function(scriptItem) {
207
221
  if (scriptItem.type === CALC_TOKEN_TYPE.VariableInMainTable || scriptItem.type === CALC_TOKEN_TYPE.VariableInCurrentSubTable || scriptItem.type === CALC_TOKEN_TYPE.VariableInOtherSubTable) {
208
222
  // 当前是一个变量,存储依赖于当前变量的计算公式
209
- _this1.setDependenciesTriggerMapItem(scriptItem.id, item);
223
+ _this.setDependenciesTriggerMapItem(scriptItem.id, item);
210
224
  }
211
225
  // 依赖明细子表的计算公式控件,不收集自己表内的,而是主表或者其他明细子表的控件
212
226
  if (scriptItem.type === CALC_TOKEN_TYPE.VariableInOtherSubTable && scriptItem.subTableId) {
213
- _this1.setDependenciesTriggerMapItem(scriptItem.subTableId, item);
227
+ _this.setDependenciesTriggerMapItem(scriptItem.subTableId, item);
214
228
  }
215
229
  });
216
230
  });
@@ -235,12 +249,11 @@ export var CalcPlugin = /*#__PURE__*/ function() {
235
249
  subtableRows) {
236
250
  var _this = this;
237
251
  return subtableRows.reduce(function(result, current) {
238
- var _this2 = _this;
239
252
  // @ts-ignore
240
253
  current.children.forEach(function(item) {
241
254
  var control = item.children[0];
242
255
  // @ts-ignore
243
- if (control && _this2.engine.assertInstance(control, CONTROL_TYPE.CALC)) {
256
+ if (control && _this.engine.assertInstance(control, CONTROL_TYPE.CALC)) {
244
257
  result.push(control);
245
258
  }
246
259
  });
@@ -255,13 +268,12 @@ export var CalcPlugin = /*#__PURE__*/ function() {
255
268
  * @description 监听控件的显隐事件,把显隐会影响的控件触发一遍计算
256
269
  * */ function watchSchemaHideChange() {
257
270
  var _this = this;
258
- this.engine.on('schema-change', function(payload) {
259
- if (payload.props === 'isHide') {
260
- var _this3 = _this;
261
- var ref;
262
- var calcControls = (ref = _this.dependenciesTriggerMap.get(payload.instance.id)) !== null && ref !== void 0 ? ref : [];
271
+ this.engine.on("schema-change", function(payload) {
272
+ if (payload.props === "isHide") {
273
+ var _this_dependenciesTriggerMap_get;
274
+ var calcControls = (_this_dependenciesTriggerMap_get = _this.dependenciesTriggerMap.get(payload.instance.id)) !== null && _this_dependenciesTriggerMap_get !== void 0 ? _this_dependenciesTriggerMap_get : [];
263
275
  calcControls.forEach(function(calc) {
264
- _this3.computedCalcValue(calc);
276
+ _this.computedCalcValue(calc);
265
277
  });
266
278
  }
267
279
  });
@@ -273,23 +285,22 @@ export var CalcPlugin = /*#__PURE__*/ function() {
273
285
  * @description 监听明细子表的change事件,把明细表会影响的控件触发一遍计算
274
286
  * */ function watchSubtableChange() {
275
287
  var _this = this;
276
- this.engine.on('list-change', function(payload) {
277
- var _this5 = _this;
278
- var ref;
288
+ this.engine.on("list-change", function(payload) {
289
+ var _payload_options;
279
290
  _this.resetDependencies();
280
- var ref1;
281
- var changedRows = (ref1 = (ref = payload.options) === null || ref === void 0 ? void 0 : ref.changed) !== null && ref1 !== void 0 ? ref1 : [];
291
+ var _payload_options_changed;
292
+ var changedRows = (_payload_options_changed = (_payload_options = payload.options) === null || _payload_options === void 0 ? void 0 : _payload_options.changed) !== null && _payload_options_changed !== void 0 ? _payload_options_changed : [];
282
293
  // 对发生改变的行进行重新计算
283
294
  var changedCalc = _this.getCalcControlsFromSubtableRows(changedRows);
284
295
  // @ts-ignore
285
296
  changedCalc.forEach(function(calcControl) {
286
- _this5.computedCalcValue(calcControl);
297
+ _this.computedCalcValue(calcControl);
287
298
  });
288
- var ref2;
289
- var calcControls = (ref2 = _this.dependenciesTriggerMap.get(payload.instance.id)) !== null && ref2 !== void 0 ? ref2 : [];
299
+ var _this_dependenciesTriggerMap_get;
300
+ var calcControls = (_this_dependenciesTriggerMap_get = _this.dependenciesTriggerMap.get(payload.instance.id)) !== null && _this_dependenciesTriggerMap_get !== void 0 ? _this_dependenciesTriggerMap_get : [];
290
301
  // @ts-ignore
291
302
  calcControls.forEach(function(calcControl) {
292
- _this5.computedCalcValue(calcControl);
303
+ _this.computedCalcValue(calcControl);
293
304
  });
294
305
  });
295
306
  }
@@ -300,31 +311,29 @@ export var CalcPlugin = /*#__PURE__*/ function() {
300
311
  * @description 监听控件的change事件,当控件change的时候,取到控件会影响的计算公式,然后执行对应的计算
301
312
  * */ function watchControlChange() {
302
313
  var _this = this;
303
- this.engine.on('change', function(payload) {
314
+ this.engine.on("change", function(payload) {
304
315
  var instance = payload.instance;
305
316
  if (!_this.dependenciesTriggerMap.has(instance.id)) {
306
317
  return;
307
318
  }
308
- var ref;
309
- var calcControls = (ref = _this.dependenciesTriggerMap.get(instance.id)) !== null && ref !== void 0 ? ref : [];
319
+ var _this_dependenciesTriggerMap_get;
320
+ var calcControls = (_this_dependenciesTriggerMap_get = _this.dependenciesTriggerMap.get(instance.id)) !== null && _this_dependenciesTriggerMap_get !== void 0 ? _this_dependenciesTriggerMap_get : [];
310
321
  // 在明细子表中的控件,如果计算公式也在明细子表,那只触发同一行的计算公式的计算
311
322
  if (payload.rowIndex !== undefined && payload.rowIndex > -1) {
312
- var _this7 = _this;
313
323
  // @ts-ignore
314
324
  calcControls.forEach(function(calcControl) {
315
- if (_this7.controlInSubtable(calcControl)) {
316
- var calcIndex = _this7.engine.getInstanceRowIndex(calcControl);
325
+ if (_this.controlInSubtable(calcControl)) {
326
+ var calcIndex = _this.engine.getInstanceRowIndex(calcControl);
317
327
  if (calcIndex !== payload.rowIndex) {
318
328
  return;
319
329
  }
320
330
  }
321
- _this7.computedCalcValue(calcControl);
331
+ _this.computedCalcValue(calcControl);
322
332
  });
323
333
  } else {
324
- var _this6 = _this;
325
334
  // @ts-ignore
326
335
  calcControls.forEach(function(calcControl) {
327
- _this6.computedCalcValue(calcControl);
336
+ _this.computedCalcValue(calcControl);
328
337
  });
329
338
  }
330
339
  });
@@ -335,8 +344,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
335
344
  value: /**
336
345
  * @description 控件在明细子表内
337
346
  * */ function controlInSubtable(control) {
338
- var ref;
339
- return ((ref = control.parent) === null || ref === void 0 ? void 0 : ref.type) === CONTROL_TYPE.SUBTABLE_COLUMN;
347
+ var _control_parent;
348
+ return ((_control_parent = control.parent) === null || _control_parent === void 0 ? void 0 : _control_parent.type) === CONTROL_TYPE.SUBTABLE_COLUMN;
340
349
  }
341
350
  },
342
351
  {
@@ -380,10 +389,9 @@ export var CalcPlugin = /*#__PURE__*/ function() {
380
389
  }
381
390
  case CALC_TOKEN_TYPE.VariableInOtherSubTable:
382
391
  {
383
- var _this8 = _this;
384
392
  var states = _this.engine.getState(current.id);
385
393
  var values = Array.isArray(states) ? states.map(function(item) {
386
- return _this8.getNumberValue(item);
394
+ return _this.getNumberValue(item);
387
395
  }) : [];
388
396
  var value2 = _this.getAggregateTypeValue(values, current.aggregateType);
389
397
  instance = _this.engine.getInstance(current.subTableId);
@@ -398,17 +406,17 @@ export var CalcPlugin = /*#__PURE__*/ function() {
398
406
  result += 0;
399
407
  }
400
408
  return result;
401
- }, '');
402
- var value3;
409
+ }, "");
410
+ var value;
403
411
  // 有缓存的话取缓存,没有缓存再执行eval
404
412
  if (this.cacheComputedResult[scriptText] !== undefined) {
405
- value3 = this.cacheComputedResult[scriptText];
413
+ value = this.cacheComputedResult[scriptText];
406
414
  } else {
407
415
  // 解决js精准度问题
408
- value3 = Number(format(new Function("return ".concat(scriptText))(), {
416
+ value = Number(format(new Function("return ".concat(scriptText))(), {
409
417
  precision: 16
410
418
  }));
411
- this.cacheComputedResult[scriptText] = value3;
419
+ this.cacheComputedResult[scriptText] = value;
412
420
  }
413
421
  // let rowIndex = undefined
414
422
  if (this.controlInSubtable(control)) {
@@ -419,15 +427,15 @@ export var CalcPlugin = /*#__PURE__*/ function() {
419
427
  }
420
428
  }
421
429
  var oldValue = this.engine.getState(control.id, rowIndex);
422
- var result1 = !value3 || value3 === Infinity || value3 === -Infinity ? 0 : control.props.precision === '' ? value3 : Number(value3.toFixed(control.props.precision));
430
+ var result = !value || value === Infinity || value === -Infinity ? 0 : control.props.precision === "" ? value : Number(value.toFixed(control.props.precision));
423
431
  // 如果值没变的话,不触发修改
424
- if (result1 === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.result)) {
432
+ if (result === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.result)) {
425
433
  return;
426
434
  }
427
- var ref;
435
+ var _oldValue_unit;
428
436
  this.engine.setState(control.id, {
429
- result: result1,
430
- unit: (ref = oldValue === null || oldValue === void 0 ? void 0 : oldValue.unit) !== null && ref !== void 0 ? ref : ''
437
+ result: result,
438
+ unit: (_oldValue_unit = oldValue === null || oldValue === void 0 ? void 0 : oldValue.unit) !== null && _oldValue_unit !== void 0 ? _oldValue_unit : ""
431
439
  }, rowIndex);
432
440
  }
433
441
  },
@@ -436,14 +444,14 @@ export var CalcPlugin = /*#__PURE__*/ function() {
436
444
  value: /**
437
445
  * @description 获取数字值,因为计算公式可以依赖计算公式和金额,所以需要从value中取到对应的值
438
446
  * */ function getNumberValue(value) {
439
- if (typeof value === 'object' && value) {
440
- if ('result' in value) {
447
+ if (typeof value === "object" && value) {
448
+ if ("result" in value) {
441
449
  return value.result;
442
- } else if ('amount' in value) {
450
+ } else if ("amount" in value) {
443
451
  return value.amount;
444
452
  }
445
453
  }
446
- if (typeof value === 'number') {
454
+ if (typeof value === "number") {
447
455
  return value;
448
456
  }
449
457
  return 0;
@@ -46,8 +46,115 @@ function _createClass(Constructor, protoProps, staticProps) {
46
46
  if (staticProps) _defineProperties(Constructor, staticProps);
47
47
  return Constructor;
48
48
  }
49
- import regeneratorRuntime from "regenerator-runtime";
50
- import { EventLogic } from '@byteluck-fe/model-driven-shared';
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(regeneratorRuntime.mark(function _callee(payload) {
103
- return regeneratorRuntime.wrap(function _callee$(_ctx) {
104
- while(1)switch(_ctx.prev = _ctx.next){
211
+ var _ref = _asyncToGenerator(function(payload) {
212
+ return __generator(this, function(_state) {
213
+ switch(_state.label){
105
214
  case 0:
106
- if (!(eventKey === 'change' && !_this.engine.isMounted)) {
107
- _ctx.next = 2;
108
- break;
215
+ // 初始化state的时候不触发change事件,必须在engine mounted以后才触发
216
+ if (eventKey === "change" && !_this.engine.isMounted) {
217
+ return [
218
+ 2
219
+ ];
109
220
  }
110
- return _ctx.abrupt("return");
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
- if (!(payload.instance !== undefined)) {
113
- _ctx.next = 6;
114
- break;
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
- }, _callee);
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(regeneratorRuntime.mark(function _callee1() {
251
+ return _asyncToGenerator(function() {
137
252
  var events, result;
138
- return regeneratorRuntime.wrap(function _callee$(_ctx1) {
139
- while(1)switch(_ctx1.prev = _ctx1.next){
253
+ return __generator(this, function(_state) {
254
+ switch(_state.label){
140
255
  case 0:
141
256
  events = _this.config[payload.instance.id];
142
- if (!(!events || !Array.isArray(events[name]))) {
143
- _ctx1.next = 3;
144
- break;
257
+ if (!events || !Array.isArray(events[name])) {
258
+ return [
259
+ 2,
260
+ []
261
+ ];
145
262
  }
146
- return _ctx1.abrupt("return", []);
147
- case 3:
148
- _ctx1.next = 5;
149
- return Promise.all(events[name].map(function() {
150
- var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(eventName) {
151
- var execResult;
152
- return regeneratorRuntime.wrap(function _callee$(_ctx) {
153
- while(1)switch(_ctx.prev = _ctx.next){
154
- case 0:
155
- _ctx.next = 2;
156
- return _this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
157
- // this.engine,
158
- // this.engine.getAction().actionUtils, //以前是params,空的
159
- payload);
160
- case 2:
161
- execResult = _ctx.sent;
162
- return _ctx.abrupt("return", execResult);
163
- case 4:
164
- case "end":
165
- return _ctx.stop();
166
- }
167
- }, _callee);
168
- }));
169
- return function(eventName) {
170
- return _ref.apply(this, arguments);
171
- };
172
- }()));
173
- case 5:
174
- result = _ctx1.sent;
175
- if (!result.includes(false)) {
176
- _ctx1.next = 10;
177
- break;
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 _ctx1.abrupt("return", false);
180
- case 10:
181
- return _ctx1.abrupt("return", result);
182
- case 11:
183
- case "end":
184
- return _ctx1.stop();
305
+ return [
306
+ 2
307
+ ];
185
308
  }
186
- }, _callee1);
187
- }))();
309
+ });
310
+ })();
188
311
  }
189
312
  }
190
313
  ]);