@byteluck-fe/model-driven-engine 2.3.1-beta.2 → 2.3.1-beta.22

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.
@@ -18,12 +18,12 @@ var OkWorker = /*#__PURE__*/ function() {
18
18
  });
19
19
  };
20
20
  _proto.destroy = function destroy() {
21
- var ref;
22
- (ref = this.worker) === null || ref === void 0 ? void 0 : ref.terminate();
21
+ var _this_worker;
22
+ (_this_worker = this.worker) === null || _this_worker === void 0 ? void 0 : _this_worker.terminate();
23
23
  };
24
24
  _proto.postMessage = function postMessage(message) {
25
- var ref;
26
- (ref = this.worker) === null || ref === void 0 ? void 0 : ref.postMessage(message);
25
+ var _this_worker;
26
+ (_this_worker = this.worker) === null || _this_worker === void 0 ? void 0 : _this_worker.postMessage(message);
27
27
  };
28
28
  OkWorker.createWorker = function createWorker() {
29
29
  var blob = new Blob([
@@ -64,7 +64,7 @@ var OkWorker = /*#__PURE__*/ function() {
64
64
  // return new Proxy(obj, createHandler(parentKey))
65
65
  // }
66
66
  _self.addEventListener("message", function(event) {
67
- var _data = event.data, action = _data.action, payload = _data.payload, fn = _data.fn;
67
+ var _event_data = event.data, action = _event_data.action, payload = _event_data.payload, fn = _event_data.fn;
68
68
  log(action, payload);
69
69
  // 通过proxy进行代理,每次修改的时候,自动向外抛出postMessage
70
70
  // data.key1 = 1
@@ -25,12 +25,12 @@ function _instanceof(left, right) {
25
25
  }
26
26
  import { DataBind, ObjectDataBind } from "@byteluck-fe/model-driven-core";
27
27
  import { loopFormSchema, JSONCopy, warn, CONTROL_TYPE, CONTROL_BASE_TYPE } from "@byteluck-fe/model-driven-shared";
28
- import { loopDataViewControl, loopFormControl } from "../utils/runtimeUtils";
28
+ import { loopDataViewControl, loopFormControl, buildUUID } from "../utils/runtimeUtils";
29
29
  var Store = /*#__PURE__*/ function() {
30
30
  "use strict";
31
31
  function Store(props) {
32
32
  _classCallCheck(this, Store);
33
- var ref = init(props.instance), state = ref.state, emptyState = ref.emptyState, databindMapping = ref.databindMapping, controlidMapping = ref.controlidMapping;
33
+ var _init = init(props.instance), state = _init.state, emptyState = _init.emptyState, databindMapping = _init.databindMapping, controlidMapping = _init.controlidMapping;
34
34
  this.emptyState = emptyState;
35
35
  this.state = state;
36
36
  this.dataBindMapping = databindMapping;
@@ -57,7 +57,7 @@ var Store = /*#__PURE__*/ function() {
57
57
  // }
58
58
  } else {
59
59
  if (rowIndex !== undefined) {
60
- //TODO 目前只找了一层明细表,没有递归
60
+ //TODO 目前只找了一层明细表,没有递归 如果是添加uid
61
61
  Object.keys(this.controlIdMapping).map(function(subtableId) {
62
62
  var dataView = _this.controlIdMapping[subtableId].dataView;
63
63
  var children = _this.controlIdMapping[subtableId].children;
@@ -96,8 +96,8 @@ var Store = /*#__PURE__*/ function() {
96
96
  if (children !== undefined) {
97
97
  Object.keys(children).map(function(childControlId) {
98
98
  if (childControlId === controlId) {
99
- var ref;
100
- state = (ref = _this.state[dataViewId][subtableId][rowIndex]) === null || ref === void 0 ? void 0 : ref[controlId];
99
+ var _this_state_dataViewId_subtableId_rowIndex;
100
+ state = (_this_state_dataViewId_subtableId_rowIndex = _this.state[dataViewId][subtableId][rowIndex]) === null || _this_state_dataViewId_subtableId_rowIndex === void 0 ? void 0 : _this_state_dataViewId_subtableId_rowIndex[controlId];
101
101
  }
102
102
  });
103
103
  }
@@ -131,9 +131,16 @@ var Store = /*#__PURE__*/ function() {
131
131
  } else {
132
132
  var controlInfo = this.controlIdMapping[controlId];
133
133
  if (controlInfo !== undefined) {
134
- return this.emptyState[controlInfo.dataView][controlId];
134
+ var state = this.emptyState[controlInfo.dataView][controlId];
135
+ //判断找到的是否是明细表的控件
136
+ if ("children" in controlInfo) {
137
+ Object.assign(state, {
138
+ uid: "new:" + buildUUID("uid")
139
+ });
140
+ }
141
+ return state;
135
142
  } else {
136
- var state;
143
+ var state1;
137
144
  //TODO 目前只找了一层明细表,没有递归
138
145
  Object.keys(this.controlIdMapping).map(function(subtableId) {
139
146
  var dataViewId = _this.controlIdMapping[subtableId].dataView;
@@ -141,12 +148,12 @@ var Store = /*#__PURE__*/ function() {
141
148
  if (children !== undefined) {
142
149
  Object.keys(children).map(function(childControlId) {
143
150
  if (childControlId === controlId) {
144
- state = _this.emptyState[dataViewId][subtableId][controlId];
151
+ state1 = _this.emptyState[dataViewId][subtableId][controlId];
145
152
  }
146
153
  });
147
154
  }
148
155
  });
149
- return state;
156
+ return state1;
150
157
  }
151
158
  }
152
159
  };
@@ -204,15 +211,16 @@ function buildState(dataViewState, emptyDataViewState, // @ts-ignore
204
211
  item) {
205
212
  //if (item instanceof RuntimeFormControl) {
206
213
  if (item.controlType === CONTROL_BASE_TYPE.FORM) {
207
- dataViewState[item.id] = JSONCopy(item.props.defaultValue);
214
+ // 2023-4-2 jiaqi 首次进入页面去除填充默认值
215
+ // dataViewState[item.id] = JSONCopy(item.props.defaultValue)
208
216
  emptyDataViewState[item.id] = JSONCopy(item.props.defaultValue);
209
217
  } else {
210
218
  var emptyTemplate = {};
211
219
  loopFormSchema(item.props.headers, function(headerItem) {
212
220
  emptyTemplate[headerItem.id] = JSONCopy(headerItem.props.defaultValue);
213
221
  });
214
- var _defaultRows;
215
- dataViewState[item.id] = new Array((_defaultRows = item.props.defaultRows) !== null && _defaultRows !== void 0 ? _defaultRows : 1).fill(0).map(function() {
222
+ var _item_props_defaultRows;
223
+ dataViewState[item.id] = new Array((_item_props_defaultRows = item.props.defaultRows) !== null && _item_props_defaultRows !== void 0 ? _item_props_defaultRows : 1).fill(0).map(function() {
216
224
  return JSONCopy(emptyTemplate);
217
225
  });
218
226
  emptyDataViewState[item.id] = emptyTemplate;
@@ -222,7 +230,7 @@ function buildDataBindMapping(data, dataViewId, // @ts-ignore
222
230
  item) {
223
231
  // if (item instanceof RuntimeFormControl) {
224
232
  if (item.controlType === CONTROL_BASE_TYPE.FORM) {
225
- var ref, ref1;
233
+ var _item_props, _item_props_dataBind;
226
234
  if (_instanceof(item.props.dataBind, ObjectDataBind)) {
227
235
  // 特殊的dataBind,比如:金额是currency+amount两个key组成的,日期区间,继承自ObjectDataBind的需要通过Object.keys拿到多个databind
228
236
  Object.keys(item.props.dataBind).map(function(key) {
@@ -246,7 +254,7 @@ item) {
246
254
  });
247
255
  }
248
256
  });
249
- } else if (((ref = item.props) === null || ref === void 0 ? void 0 : (ref1 = ref.dataBind) === null || ref1 === void 0 ? void 0 : ref1.dataCode) === undefined) {
257
+ } else if (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : (_item_props_dataBind = _item_props.dataBind) === null || _item_props_dataBind === void 0 ? void 0 : _item_props_dataBind.dataCode) === undefined) {
250
258
  //qiyu 2023-2-27 为空跳过。form自定义组件加载失败时,hack的组件props为空。
251
259
  } else {
252
260
  if (data[item.props.dataBind.dataCode] === undefined) {
@@ -326,9 +334,9 @@ item) {
326
334
  options: []
327
335
  };
328
336
  loopFormSchema(item.props.headers, function(formControl) {
329
- var ref;
330
- var ref1;
331
- Object.assign((ref1 = (ref = data[item.id]) === null || ref === void 0 ? void 0 : ref.children) !== null && ref1 !== void 0 ? ref1 : {}, _defineProperty({}, formControl.id, {
337
+ var _data_item_id;
338
+ var _data_item_id_children;
339
+ Object.assign((_data_item_id_children = (_data_item_id = data[item.id]) === null || _data_item_id === void 0 ? void 0 : _data_item_id.children) !== null && _data_item_id_children !== void 0 ? _data_item_id_children : {}, _defineProperty({}, formControl.id, {
332
340
  dataBind: formControl.props.dataBind
333
341
  }));
334
342
  });
@@ -520,8 +520,8 @@ function getFieldTypeFromKey(key) {
520
520
  }
521
521
  }
522
522
  export function checkerValue(fieldType, key, value, oldValue) {
523
- var ref;
524
- var getCheckerFieldType = (ref = getFieldTypeFromKey(key)) !== null && ref !== void 0 ? ref : fieldType;
523
+ var _getFieldTypeFromKey;
524
+ var getCheckerFieldType = (_getFieldTypeFromKey = getFieldTypeFromKey(key)) !== null && _getFieldTypeFromKey !== void 0 ? _getFieldTypeFromKey : fieldType;
525
525
  var checker = ValueCheckerFactory.getValueChecker(getCheckerFieldType);
526
526
  if (!checker || checker.validate(value)) {
527
527
  return value;
@@ -31,7 +31,7 @@ var proxyArrayApi = [
31
31
  "shift",
32
32
  "pop",
33
33
  "unshift",
34
- "reverse",
34
+ "reverse"
35
35
  ];
36
36
  export var engineProxyFlag = Symbol("__engineProxy__");
37
37
  export var engineTargetKey = Symbol("__engineTarget__");
@@ -78,7 +78,7 @@ function ArrayHandler(target, propertyKey, value, thisKey, callback) {
78
78
  return function() {
79
79
  return callback.call(null, target, thisKey, "splice", [
80
80
  newLength,
81
- oldLength - newLength,
81
+ oldLength - newLength
82
82
  ]);
83
83
  };
84
84
  // 直接操作下标
@@ -141,8 +141,8 @@ function ArrayHandler(target, propertyKey, value, thisKey, callback) {
141
141
  // @ts-ignore
142
142
  var oldValue = target[propertyKey];
143
143
  var concatKey = thisKey === "" ? propertyKey : thisKey + "." + propertyKey;
144
- var ref;
145
- newValue = (ref = reProxyState(value)) !== null && ref !== void 0 ? ref : newValue;
144
+ var _reProxyState;
145
+ newValue = (_reProxyState = reProxyState(value)) !== null && _reProxyState !== void 0 ? _reProxyState : newValue;
146
146
  // 先设置值,然后再进行触发回调,确保回调内拿到的是最新的值
147
147
  var setResult;
148
148
  // TODO 数组拦截操作需要重构,优化现有逻辑
@@ -242,10 +242,10 @@ function flatInstanceForChildren(controls) {
242
242
  // 最后一个key可能是值对象上边的key,比如金额的amount和currency,计算公式的result和unit,所以需要判断前一个控件是不是一个表单控件,是的话就返回最后一个表单控件
243
243
  return findEndItem ? findEndItem : prevItem.controlType === CONTROL_BASE_TYPE.FORM ? prevItem : undefined;
244
244
  } else {
245
- var ref;
246
- var ref1;
245
+ var _prevItem_children;
246
+ var _prevItem_children_index;
247
247
  // 如果有children,则取children中对应的下标,没有的话一直返回prevItem
248
- return (ref1 = prevItem === null || prevItem === void 0 ? void 0 : (ref = prevItem.children) === null || ref === void 0 ? void 0 : ref[index]) !== null && ref1 !== void 0 ? ref1 : prevItem;
248
+ return (_prevItem_children_index = prevItem === null || prevItem === void 0 ? void 0 : (_prevItem_children = prevItem.children) === null || _prevItem_children === void 0 ? void 0 : _prevItem_children[index]) !== null && _prevItem_children_index !== void 0 ? _prevItem_children_index : prevItem;
249
249
  }
250
250
  }, initInstance);
251
251
  }
@@ -285,9 +285,9 @@ function getArrayNewArgs(type, args, value) {
285
285
  var result;
286
286
  var addValue = getArrayNewValue(key, args);
287
287
  if (addValue.length) {
288
- var _obj, ref;
288
+ var _this, _this_engineArrayBeforeSetCallbackFlag;
289
289
  // @ts-ignore
290
- var newValue = (ref = (_obj = this)[engineArrayBeforeSetCallbackFlag]) === null || ref === void 0 ? void 0 : ref.call(_obj, // @ts-ignore
290
+ var newValue = (_this_engineArrayBeforeSetCallbackFlag = (_this = this)[engineArrayBeforeSetCallbackFlag]) === null || _this_engineArrayBeforeSetCallbackFlag === void 0 ? void 0 : _this_engineArrayBeforeSetCallbackFlag.call(_this, // @ts-ignore
291
291
  this[engineTargetKey], // @ts-ignore
292
292
  this[engineProxyThisKey], addValue);
293
293
  var newArgs = getArrayNewArgs(key, args, newValue);
@@ -64,8 +64,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
64
64
  /**
65
65
  * @description 获取显隐控制的需要被记住值的控件id
66
66
  * */ _proto.getNeedHideRememberControlIds = function getNeedHideRememberControlIds() {
67
- var ref;
68
- if (!((ref = this.options) === null || ref === void 0 ? void 0 : ref.displayBoList)) {
67
+ var _this_options;
68
+ if (!((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.displayBoList)) {
69
69
  return;
70
70
  }
71
71
  this.hideNotRememberControlIds = this.options.displayBoList.reduce(function(result, current) {
@@ -79,8 +79,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
79
79
  /**
80
80
  * @description 获取权限控制的隐藏的字段,不需要参与计算
81
81
  * */ _proto.getDontHasPermissionControlIds = function getDontHasPermissionControlIds() {
82
- var ref;
83
- if (!((ref = this.options) === null || ref === void 0 ? void 0 : ref.behavior)) {
82
+ var _this_options;
83
+ if (!((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.behavior)) {
84
84
  return;
85
85
  }
86
86
  this.dontHasPermissionControlIds = this.options.behavior.reduce(function(result, current) {
@@ -206,8 +206,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
206
206
  var _this = this;
207
207
  this.engine.on("schema-change", function(payload) {
208
208
  if (payload.props === "isHide") {
209
- var ref;
210
- var calcControls = (ref = _this.dependenciesTriggerMap.get(payload.instance.id)) !== null && ref !== void 0 ? ref : [];
209
+ var _this_dependenciesTriggerMap_get;
210
+ var calcControls = (_this_dependenciesTriggerMap_get = _this.dependenciesTriggerMap.get(payload.instance.id)) !== null && _this_dependenciesTriggerMap_get !== void 0 ? _this_dependenciesTriggerMap_get : [];
211
211
  calcControls.forEach(function(calc) {
212
212
  _this.computedCalcValue(calc);
213
213
  });
@@ -219,18 +219,18 @@ export var CalcPlugin = /*#__PURE__*/ function() {
219
219
  * */ _proto.watchSubtableChange = function watchSubtableChange() {
220
220
  var _this = this;
221
221
  this.engine.on("list-change", function(payload) {
222
- var ref;
222
+ var _payload_options;
223
223
  _this.resetDependencies();
224
- var ref1;
225
- var changedRows = (ref1 = (ref = payload.options) === null || ref === void 0 ? void 0 : ref.changed) !== null && ref1 !== void 0 ? ref1 : [];
224
+ var _payload_options_changed;
225
+ 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 : [];
226
226
  // 对发生改变的行进行重新计算
227
227
  var changedCalc = _this.getCalcControlsFromSubtableRows(changedRows);
228
228
  // @ts-ignore
229
229
  changedCalc.forEach(function(calcControl) {
230
230
  _this.computedCalcValue(calcControl);
231
231
  });
232
- var ref2;
233
- var calcControls = (ref2 = _this.dependenciesTriggerMap.get(payload.instance.id)) !== null && ref2 !== void 0 ? ref2 : [];
232
+ var _this_dependenciesTriggerMap_get;
233
+ var calcControls = (_this_dependenciesTriggerMap_get = _this.dependenciesTriggerMap.get(payload.instance.id)) !== null && _this_dependenciesTriggerMap_get !== void 0 ? _this_dependenciesTriggerMap_get : [];
234
234
  // @ts-ignore
235
235
  calcControls.forEach(function(calcControl) {
236
236
  _this.computedCalcValue(calcControl);
@@ -246,8 +246,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
246
246
  if (!_this.dependenciesTriggerMap.has(instance.id)) {
247
247
  return;
248
248
  }
249
- var ref;
250
- var calcControls = (ref = _this.dependenciesTriggerMap.get(instance.id)) !== null && ref !== void 0 ? ref : [];
249
+ var _this_dependenciesTriggerMap_get;
250
+ var calcControls = (_this_dependenciesTriggerMap_get = _this.dependenciesTriggerMap.get(instance.id)) !== null && _this_dependenciesTriggerMap_get !== void 0 ? _this_dependenciesTriggerMap_get : [];
251
251
  // 在明细子表中的控件,如果计算公式也在明细子表,那只触发同一行的计算公式的计算
252
252
  if (payload.rowIndex !== undefined && payload.rowIndex > -1) {
253
253
  // @ts-ignore
@@ -271,8 +271,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
271
271
  /**
272
272
  * @description 控件在明细子表内
273
273
  * */ _proto.controlInSubtable = function controlInSubtable(control) {
274
- var ref;
275
- return ((ref = control.parent) === null || ref === void 0 ? void 0 : ref.type) === CONTROL_TYPE.SUBTABLE_COLUMN;
274
+ var _control_parent;
275
+ return ((_control_parent = control.parent) === null || _control_parent === void 0 ? void 0 : _control_parent.type) === CONTROL_TYPE.SUBTABLE_COLUMN;
276
276
  };
277
277
  /**
278
278
  * @description 执行计算公式的计算
@@ -352,10 +352,10 @@ export var CalcPlugin = /*#__PURE__*/ function() {
352
352
  if (result === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.result)) {
353
353
  return;
354
354
  }
355
- var ref;
355
+ var _oldValue_unit;
356
356
  this.engine.setState(control.id, {
357
357
  result: result,
358
- unit: (ref = oldValue === null || oldValue === void 0 ? void 0 : oldValue.unit) !== null && ref !== void 0 ? ref : ""
358
+ unit: (_oldValue_unit = oldValue === null || oldValue === void 0 ? void 0 : oldValue.unit) !== null && _oldValue_unit !== void 0 ? _oldValue_unit : ""
359
359
  }, rowIndex);
360
360
  };
361
361
  /**
@@ -32,7 +32,101 @@ function _classCallCheck(instance, Constructor) {
32
32
  throw new TypeError("Cannot call a class as a function");
33
33
  }
34
34
  }
35
- import regeneratorRuntime from "regenerator-runtime";
35
+ var __generator = this && this.__generator || function(thisArg, body) {
36
+ var f, y, t, g, _ = {
37
+ label: 0,
38
+ sent: function() {
39
+ if (t[0] & 1) throw t[1];
40
+ return t[1];
41
+ },
42
+ trys: [],
43
+ ops: []
44
+ };
45
+ return(g = {
46
+ next: verb(0),
47
+ "throw": verb(1),
48
+ "return": verb(2)
49
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
50
+ return this;
51
+ }), g);
52
+ function verb(n) {
53
+ return function(v) {
54
+ return step([
55
+ n,
56
+ v
57
+ ]);
58
+ };
59
+ }
60
+ function step(op) {
61
+ if (f) throw new TypeError("Generator is already executing.");
62
+ while(_)try {
63
+ 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;
64
+ if (y = 0, t) op = [
65
+ op[0] & 2,
66
+ t.value
67
+ ];
68
+ switch(op[0]){
69
+ case 0:
70
+ case 1:
71
+ t = op;
72
+ break;
73
+ case 4:
74
+ _.label++;
75
+ return {
76
+ value: op[1],
77
+ done: false
78
+ };
79
+ case 5:
80
+ _.label++;
81
+ y = op[1];
82
+ op = [
83
+ 0
84
+ ];
85
+ continue;
86
+ case 7:
87
+ op = _.ops.pop();
88
+ _.trys.pop();
89
+ continue;
90
+ default:
91
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
92
+ _ = 0;
93
+ continue;
94
+ }
95
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
96
+ _.label = op[1];
97
+ break;
98
+ }
99
+ if (op[0] === 6 && _.label < t[1]) {
100
+ _.label = t[1];
101
+ t = op;
102
+ break;
103
+ }
104
+ if (t && _.label < t[2]) {
105
+ _.label = t[2];
106
+ _.ops.push(op);
107
+ break;
108
+ }
109
+ if (t[2]) _.ops.pop();
110
+ _.trys.pop();
111
+ continue;
112
+ }
113
+ op = body.call(thisArg, _);
114
+ } catch (e) {
115
+ op = [
116
+ 6,
117
+ e
118
+ ];
119
+ y = 0;
120
+ } finally{
121
+ f = t = 0;
122
+ }
123
+ if (op[0] & 5) throw op[1];
124
+ return {
125
+ value: op[0] ? op[1] : void 0,
126
+ done: true
127
+ };
128
+ }
129
+ };
36
130
  import { EventLogic } from "@byteluck-fe/model-driven-shared";
37
131
  // type EventKeyMap = {
38
132
  // [eventKey in EventKeys]?: string
@@ -80,30 +174,36 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
80
174
  _proto.engineAddEventListener = function engineAddEventListener(eventKey, controlEventKey) {
81
175
  var _this = this;
82
176
  this.engine.on(eventKey, function() {
83
- var _ref = _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime.mark(function _callee(payload) {
84
- return regeneratorRuntime.wrap(function _callee$(_ctx) {
85
- while(1)switch(_ctx.prev = _ctx.next){
177
+ var _ref = _asyncToGenerator(function(payload) {
178
+ return __generator(this, function(_state) {
179
+ switch(_state.label){
86
180
  case 0:
87
- if (!(eventKey === "change" && !_this.engine.isMounted)) {
88
- _ctx.next = 2;
89
- break;
181
+ // 初始化state的时候不触发change事件,必须在engine mounted以后才触发
182
+ if (eventKey === "change" && !_this.engine.isMounted) {
183
+ return [
184
+ 2
185
+ ];
90
186
  }
91
- return _ctx.abrupt("return");
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
+ ];
92
200
  case 2:
93
- if (!(payload.instance !== undefined)) {
94
- _ctx.next = 6;
95
- break;
96
- }
97
- _ctx.next = 5;
98
- return _this.callControlEvent(controlEventKey, payload);
99
- case 5:
100
- return _ctx.abrupt("return", _ctx.sent);
101
- case 6:
102
- case "end":
103
- return _ctx.stop();
201
+ return [
202
+ 2
203
+ ];
104
204
  }
105
- }, _callee);
106
- }));
205
+ });
206
+ });
107
207
  return function(payload) {
108
208
  return _ref.apply(this, arguments);
109
209
  };
@@ -111,58 +211,66 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
111
211
  };
112
212
  _proto.callControlEvent = function callControlEvent(name, payload) {
113
213
  var _this = this;
114
- return _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime.mark(function _callee() {
214
+ return _asyncToGenerator(function() {
115
215
  var events, result;
116
- return regeneratorRuntime.wrap(function _callee$(_ctx) {
117
- while(1)switch(_ctx.prev = _ctx.next){
216
+ return __generator(this, function(_state) {
217
+ switch(_state.label){
118
218
  case 0:
119
219
  events = _this.config[payload.instance.id];
120
- if (!(!events || !Array.isArray(events[name]))) {
121
- _ctx.next = 3;
122
- break;
220
+ if (!events || !Array.isArray(events[name])) {
221
+ return [
222
+ 2,
223
+ []
224
+ ];
123
225
  }
124
- return _ctx.abrupt("return", []);
125
- case 3:
126
- _ctx.next = 5;
127
- return Promise.all(events[name].map(function() {
128
- var _ref = _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime.mark(function _callee(eventName) {
129
- var execResult;
130
- return regeneratorRuntime.wrap(function _callee$(_ctx) {
131
- while(1)switch(_ctx.prev = _ctx.next){
132
- case 0:
133
- _ctx.next = 2;
134
- return _this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
135
- // this.engine,
136
- // this.engine.getAction().actionUtils, //以前是params,空的
137
- payload);
138
- case 2:
139
- execResult = _ctx.sent;
140
- return _ctx.abrupt("return", execResult);
141
- case 4:
142
- case "end":
143
- return _ctx.stop();
144
- }
145
- }, _callee);
146
- }));
147
- return function(eventName) {
148
- return _ref.apply(this, arguments);
149
- };
150
- }()));
151
- case 5:
152
- result = _ctx.sent;
153
- if (!result.includes(false)) {
154
- _ctx.next = 10;
155
- break;
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
+ ];
156
267
  }
157
- return _ctx.abrupt("return", false);
158
- case 10:
159
- return _ctx.abrupt("return", result);
160
- case 11:
161
- case "end":
162
- return _ctx.stop();
268
+ return [
269
+ 2
270
+ ];
163
271
  }
164
- }, _callee);
165
- }))();
272
+ });
273
+ })();
166
274
  };
167
275
  return ControlsEventPlugin;
168
276
  }();
@@ -72,7 +72,7 @@ export var ES6ModulePlugin = /*#__PURE__*/ function() {
72
72
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
73
73
  try {
74
74
  for(var _iterator = Object.entries(res.funcMap)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
75
- var _value = _slicedToArray(_step.value, 2), key = _value[0], value = _value[1];
75
+ var _step_value = _slicedToArray(_step.value, 2), key = _step_value[0], value = _step_value[1];
76
76
  actionManager.addAction(key, value);
77
77
  }
78
78
  } catch (err) {
@@ -119,7 +119,7 @@ export function parseModule(action, engine, env) {
119
119
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
120
120
  try {
121
121
  for(var _iterator = Object.entries(module.exports)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
122
- var _value = _slicedToArray(_step.value, 2), key = _value[0], value = _value[1];
122
+ var _step_value = _slicedToArray(_step.value, 2), key = _step_value[0], value = _step_value[1];
123
123
  if (typeof value === "function") {
124
124
  funcMap[key] = value;
125
125
  } else {