@byteluck-fe/model-driven-engine 2.7.0-alpha.31b → 2.7.0-alpha.35

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.
Files changed (41) hide show
  1. package/README.md +30 -30
  2. package/dist/esm/common/ActionManager.js +177 -60
  3. package/dist/esm/common/DataManager.js +134 -25
  4. package/dist/esm/common/Engine.js +480 -406
  5. package/dist/esm/common/OkWorker.js +31 -17
  6. package/dist/esm/common/Plugin.js +2 -2
  7. package/dist/esm/common/Runtime.js +80 -104
  8. package/dist/esm/common/Store.js +63 -62
  9. package/dist/esm/common/checkerValue.js +108 -108
  10. package/dist/esm/common/index.js +2 -2
  11. package/dist/esm/common/proxyState.js +76 -76
  12. package/dist/esm/index.js +3 -3
  13. package/dist/esm/plugins/CalcPlugin.js +128 -120
  14. package/dist/esm/plugins/ControlsEventPlugin.js +196 -73
  15. package/dist/esm/plugins/ES6ModulePlugin.js +54 -66
  16. package/dist/esm/plugins/LifecycleEventPlugin.js +198 -79
  17. package/dist/esm/plugins/StylePlugin.js +26 -11
  18. package/dist/esm/plugins/index.js +5 -5
  19. package/dist/esm/utils/index.js +1 -1
  20. package/dist/esm/utils/runtimeUtils.js +5 -7
  21. package/dist/index.umd.js +8 -8
  22. package/dist/types/common/ActionManager.d.ts +14 -14
  23. package/dist/types/common/DataManager.d.ts +10 -10
  24. package/dist/types/common/Engine.d.ts +184 -181
  25. package/dist/types/common/OkWorker.d.ts +13 -13
  26. package/dist/types/common/Plugin.d.ts +6 -6
  27. package/dist/types/common/Runtime.d.ts +25 -26
  28. package/dist/types/common/Store.d.ts +50 -50
  29. package/dist/types/common/checkerValue.d.ts +3 -3
  30. package/dist/types/common/index.d.ts +2 -2
  31. package/dist/types/common/proxyState.d.ts +30 -30
  32. package/dist/types/index.d.ts +3 -3
  33. package/dist/types/plugins/CalcPlugin.d.ts +121 -121
  34. package/dist/types/plugins/ControlsEventPlugin.d.ts +15 -15
  35. package/dist/types/plugins/ES6ModulePlugin.d.ts +26 -27
  36. package/dist/types/plugins/LifecycleEventPlugin.d.ts +14 -14
  37. package/dist/types/plugins/StylePlugin.d.ts +12 -12
  38. package/dist/types/plugins/index.d.ts +5 -5
  39. package/dist/types/utils/index.d.ts +1 -1
  40. package/dist/types/utils/runtimeUtils.d.ts +5 -5
  41. package/package.json +4 -4
@@ -1,15 +1,15 @@
1
- function _arrayLikeToArray(arr, len) {
1
+ function _array_like_to_array(arr, len) {
2
2
  if (len == null || len > arr.length) len = arr.length;
3
3
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
4
  return arr2;
5
5
  }
6
- function _arrayWithHoles(arr) {
6
+ function _array_with_holes(arr) {
7
7
  if (Array.isArray(arr)) return arr;
8
8
  }
9
- function _arrayWithoutHoles(arr) {
10
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
9
+ function _array_without_holes(arr) {
10
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
11
11
  }
12
- function _assertThisInitialized(self) {
12
+ function _assert_this_initialized(self) {
13
13
  if (self === void 0) {
14
14
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15
15
  }
@@ -29,7 +29,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
29
29
  Promise.resolve(value).then(_next, _throw);
30
30
  }
31
31
  }
32
- function _asyncToGenerator(fn) {
32
+ function _async_to_generator(fn) {
33
33
  return function() {
34
34
  var self = this, args = arguments;
35
35
  return new Promise(function(resolve, reject) {
@@ -44,7 +44,7 @@ function _asyncToGenerator(fn) {
44
44
  });
45
45
  };
46
46
  }
47
- function _classCallCheck(instance, Constructor) {
47
+ function _class_call_check(instance, Constructor) {
48
48
  if (!(instance instanceof Constructor)) {
49
49
  throw new TypeError("Cannot call a class as a function");
50
50
  }
@@ -58,12 +58,12 @@ function _defineProperties(target, props) {
58
58
  Object.defineProperty(target, descriptor.key, descriptor);
59
59
  }
60
60
  }
61
- function _createClass(Constructor, protoProps, staticProps) {
61
+ function _create_class(Constructor, protoProps, staticProps) {
62
62
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
63
63
  if (staticProps) _defineProperties(Constructor, staticProps);
64
64
  return Constructor;
65
65
  }
66
- function _defineProperty(obj, key, value) {
66
+ function _define_property(obj, key, value) {
67
67
  if (key in obj) {
68
68
  Object.defineProperty(obj, key, {
69
69
  value: value,
@@ -80,23 +80,23 @@ function _get(target, property, receiver) {
80
80
  if (typeof Reflect !== "undefined" && Reflect.get) {
81
81
  _get = Reflect.get;
82
82
  } else {
83
- _get = function _get(target, property, receiver) {
84
- var base = _superPropBase(target, property);
83
+ _get = function get(target, property, receiver) {
84
+ var base = _super_prop_base(target, property);
85
85
  if (!base) return;
86
86
  var desc = Object.getOwnPropertyDescriptor(base, property);
87
87
  if (desc.get) {
88
- return desc.get.call(receiver);
88
+ return desc.get.call(receiver || target);
89
89
  }
90
90
  return desc.value;
91
91
  };
92
92
  }
93
93
  return _get(target, property, receiver || target);
94
94
  }
95
- function _getPrototypeOf(o) {
96
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
95
+ function _get_prototype_of(o) {
96
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
97
97
  return o.__proto__ || Object.getPrototypeOf(o);
98
98
  };
99
- return _getPrototypeOf(o);
99
+ return _get_prototype_of(o);
100
100
  }
101
101
  function _inherits(subClass, superClass) {
102
102
  if (typeof superClass !== "function" && superClass !== null) {
@@ -109,12 +109,12 @@ function _inherits(subClass, superClass) {
109
109
  configurable: true
110
110
  }
111
111
  });
112
- if (superClass) _setPrototypeOf(subClass, superClass);
112
+ if (superClass) _set_prototype_of(subClass, superClass);
113
113
  }
114
- function _iterableToArray(iter) {
114
+ function _iterable_to_array(iter) {
115
115
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
116
116
  }
117
- function _iterableToArrayLimit(arr, i) {
117
+ function _iterable_to_array_limit(arr, i) {
118
118
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
119
119
  if (_i == null) return;
120
120
  var _arr = [];
@@ -138,13 +138,13 @@ function _iterableToArrayLimit(arr, i) {
138
138
  }
139
139
  return _arr;
140
140
  }
141
- function _nonIterableRest() {
141
+ function _non_iterable_rest() {
142
142
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
143
143
  }
144
- function _nonIterableSpread() {
144
+ function _non_iterable_spread() {
145
145
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
146
146
  }
147
- function _objectSpread(target) {
147
+ function _object_spread(target) {
148
148
  for(var i = 1; i < arguments.length; i++){
149
149
  var source = arguments[i] != null ? arguments[i] : {};
150
150
  var ownKeys = Object.keys(source);
@@ -154,50 +154,74 @@ function _objectSpread(target) {
154
154
  }));
155
155
  }
156
156
  ownKeys.forEach(function(key) {
157
- _defineProperty(target, key, source[key]);
157
+ _define_property(target, key, source[key]);
158
158
  });
159
159
  }
160
160
  return target;
161
161
  }
162
- function _possibleConstructorReturn(self, call) {
163
- if (call && (_typeof(call) === "object" || typeof call === "function")) {
162
+ function ownKeys(object, enumerableOnly) {
163
+ var keys = Object.keys(object);
164
+ if (Object.getOwnPropertySymbols) {
165
+ var symbols = Object.getOwnPropertySymbols(object);
166
+ if (enumerableOnly) {
167
+ symbols = symbols.filter(function(sym) {
168
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
169
+ });
170
+ }
171
+ keys.push.apply(keys, symbols);
172
+ }
173
+ return keys;
174
+ }
175
+ function _object_spread_props(target, source) {
176
+ source = source != null ? source : {};
177
+ if (Object.getOwnPropertyDescriptors) {
178
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
179
+ } else {
180
+ ownKeys(Object(source)).forEach(function(key) {
181
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
182
+ });
183
+ }
184
+ return target;
185
+ }
186
+ function _possible_constructor_return(self, call) {
187
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
164
188
  return call;
165
189
  }
166
- return _assertThisInitialized(self);
190
+ return _assert_this_initialized(self);
167
191
  }
168
- function _setPrototypeOf(o, p) {
169
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
192
+ function _set_prototype_of(o, p) {
193
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
170
194
  o.__proto__ = p;
171
195
  return o;
172
196
  };
173
- return _setPrototypeOf(o, p);
197
+ return _set_prototype_of(o, p);
174
198
  }
175
- function _slicedToArray(arr, i) {
176
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
199
+ function _sliced_to_array(arr, i) {
200
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
177
201
  }
178
- function _superPropBase(object, property) {
202
+ function _super_prop_base(object, property) {
179
203
  while(!Object.prototype.hasOwnProperty.call(object, property)){
180
- object = _getPrototypeOf(object);
204
+ object = _get_prototype_of(object);
181
205
  if (object === null) break;
182
206
  }
183
207
  return object;
184
208
  }
185
- function _toConsumableArray(arr) {
186
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
209
+ function _to_consumable_array(arr) {
210
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
187
211
  }
188
- var _typeof = function(obj) {
212
+ function _type_of(obj) {
189
213
  "@swc/helpers - typeof";
190
214
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
191
- };
192
- function _unsupportedIterableToArray(o, minLen) {
215
+ }
216
+ function _unsupported_iterable_to_array(o, minLen) {
193
217
  if (!o) return;
194
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
218
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
195
219
  var n = Object.prototype.toString.call(o).slice(8, -1);
196
220
  if (n === "Object" && o.constructor) n = o.constructor.name;
197
221
  if (n === "Map" || n === "Set") return Array.from(n);
198
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
222
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
199
223
  }
200
- function _isNativeReflectConstruct() {
224
+ function _is_native_reflect_construct() {
201
225
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
202
226
  if (Reflect.construct.sham) return false;
203
227
  if (typeof Proxy === "function") return true;
@@ -208,57 +232,160 @@ function _isNativeReflectConstruct() {
208
232
  return false;
209
233
  }
210
234
  }
211
- function _createSuper(Derived) {
212
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
235
+ function _create_super(Derived) {
236
+ var hasNativeReflectConstruct = _is_native_reflect_construct();
213
237
  return function _createSuperInternal() {
214
- var Super = _getPrototypeOf(Derived), result;
238
+ var Super = _get_prototype_of(Derived), result;
215
239
  if (hasNativeReflectConstruct) {
216
- var NewTarget = _getPrototypeOf(this).constructor;
240
+ var NewTarget = _get_prototype_of(this).constructor;
217
241
  result = Reflect.construct(Super, arguments, NewTarget);
218
242
  } else {
219
243
  result = Super.apply(this, arguments);
220
244
  }
221
- return _possibleConstructorReturn(this, result);
245
+ return _possible_constructor_return(this, result);
246
+ };
247
+ }
248
+ function _ts_generator(thisArg, body) {
249
+ var f, y, t, g, _ = {
250
+ label: 0,
251
+ sent: function() {
252
+ if (t[0] & 1) throw t[1];
253
+ return t[1];
254
+ },
255
+ trys: [],
256
+ ops: []
222
257
  };
258
+ return g = {
259
+ next: verb(0),
260
+ "throw": verb(1),
261
+ "return": verb(2)
262
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
263
+ return this;
264
+ }), g;
265
+ function verb(n) {
266
+ return function(v) {
267
+ return step([
268
+ n,
269
+ v
270
+ ]);
271
+ };
272
+ }
273
+ function step(op) {
274
+ if (f) throw new TypeError("Generator is already executing.");
275
+ while(_)try {
276
+ 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;
277
+ if (y = 0, t) op = [
278
+ op[0] & 2,
279
+ t.value
280
+ ];
281
+ switch(op[0]){
282
+ case 0:
283
+ case 1:
284
+ t = op;
285
+ break;
286
+ case 4:
287
+ _.label++;
288
+ return {
289
+ value: op[1],
290
+ done: false
291
+ };
292
+ case 5:
293
+ _.label++;
294
+ y = op[1];
295
+ op = [
296
+ 0
297
+ ];
298
+ continue;
299
+ case 7:
300
+ op = _.ops.pop();
301
+ _.trys.pop();
302
+ continue;
303
+ default:
304
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
305
+ _ = 0;
306
+ continue;
307
+ }
308
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
309
+ _.label = op[1];
310
+ break;
311
+ }
312
+ if (op[0] === 6 && _.label < t[1]) {
313
+ _.label = t[1];
314
+ t = op;
315
+ break;
316
+ }
317
+ if (t && _.label < t[2]) {
318
+ _.label = t[2];
319
+ _.ops.push(op);
320
+ break;
321
+ }
322
+ if (t[2]) _.ops.pop();
323
+ _.trys.pop();
324
+ continue;
325
+ }
326
+ op = body.call(thisArg, _);
327
+ } catch (e) {
328
+ op = [
329
+ 6,
330
+ e
331
+ ];
332
+ y = 0;
333
+ } finally{
334
+ f = t = 0;
335
+ }
336
+ if (op[0] & 5) throw op[1];
337
+ return {
338
+ value: op[0] ? op[1] : void 0,
339
+ done: true
340
+ };
341
+ }
223
342
  }
224
- import regeneratorRuntime from "regenerator-runtime";
225
- import { isDataBind } from '@byteluck-fe/model-driven-core';
226
- import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher } from '@byteluck-fe/model-driven-shared';
227
- import { Runtime } from './Runtime';
228
- import { Store } from './Store';
229
- import { findItem, proxyState } from './proxyState';
230
- import { ActionManager } from './ActionManager';
231
- import { DataManager } from './DataManager';
232
- import { checkerSubtableValue, checkerValue } from './checkerValue';
233
- if (typeof window !== 'undefined') {
343
+ import { isDataBind } from "@byteluck-fe/model-driven-core";
344
+ import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher, isBuiltInControls } from "@byteluck-fe/model-driven-shared";
345
+ import { Runtime } from "./Runtime";
346
+ import { Store } from "./Store";
347
+ import { findItem, proxyState } from "./proxyState";
348
+ import { ActionManager } from "./ActionManager";
349
+ import { DataManager } from "./DataManager";
350
+ import { checkerSubtableValue, checkerValue } from "./checkerValue";
351
+ if (typeof window !== "undefined") {
234
352
  // @ts-ignore
235
353
  window.engines = {};
236
354
  }
237
355
  // setState的时候,存储options中转变量
238
356
  var eventOptionsTemp = null;
239
357
  // 当前正在注册的插件名称
240
- var applyingPluginName = '';
241
- var Engine = // 整体渲染引擎 并且 提供发布订阅能力
242
- /*#__PURE__*/ function(Watcher1) {
358
+ var applyingPluginName = "";
359
+ // 整体渲染引擎 并且 提供发布订阅能力
360
+ var Engine = /*#__PURE__*/ function(Watcher) {
243
361
  "use strict";
244
- _inherits(Engine, Watcher1);
245
- var _super = _createSuper(Engine);
362
+ _inherits(Engine, Watcher);
363
+ var _super = _create_super(Engine);
246
364
  function Engine(props) {
247
- _classCallCheck(this, Engine);
365
+ _class_call_check(this, Engine);
248
366
  var _this;
249
367
  _this = _super.call(this);
250
- _this.rawStore = {};
368
+ _define_property(_assert_this_initialized(_this), "store", void 0);
369
+ _define_property(_assert_this_initialized(_this), "rawStore", {});
370
+ _define_property(_assert_this_initialized(_this), "parent", void 0);
371
+ // 提供注册运行态控件以及实例化控件的能力
372
+ _define_property(_assert_this_initialized(_this), "runtime", void 0);
251
373
  // 提供子线程处理脚本以及修改数据的能力
252
374
  // public worker: OkWorker
253
- _this.isMounted = false;
254
- _this.id = genNonDuplicateId(8);
255
- _this.__pluginsApplied = false;
256
- _this.actionManager = new ActionManager();
257
- _this._jobTasks = [];
258
- _this.createControlInstance = _this.createInstance;
375
+ _define_property(_assert_this_initialized(_this), "isMounted", false);
376
+ _define_property(_assert_this_initialized(_this), "id", genNonDuplicateId(8));
377
+ _define_property(_assert_this_initialized(_this), "externalParams", void 0);
378
+ // 提供外部注册插件,在不同的hooks触发时执行固定函数的能力
379
+ _define_property(_assert_this_initialized(_this), "__plugins", void 0);
380
+ _define_property(_assert_this_initialized(_this), "__pluginsApplied", false);
381
+ _define_property(_assert_this_initialized(_this), "$options", void 0);
382
+ _define_property(_assert_this_initialized(_this), "actionManager", new ActionManager());
383
+ _define_property(_assert_this_initialized(_this), "dataManager", void 0);
384
+ _define_property(_assert_this_initialized(_this), "_jobTasks", []);
385
+ _define_property(_assert_this_initialized(_this), "createControlInstance", _this.createInstance);
259
386
  _this.$options = Object.freeze(props);
260
- var _$options = _this.$options, _autoMount = _$options.autoMount, autoMount = _autoMount === void 0 ? true : _autoMount, schema = _$options.schema, beforeCreateInstance = _$options.beforeCreateInstance, externalParams = _$options.externalParams, _language = _$options.// fieldModel,
261
- language, language = _language === void 0 ? DEFAULT_LOCALE : _language, _debug = _$options.debug, debug = _debug === void 0 ? false : _debug;
387
+ var _this_$options = _this.$options, _this_$options_autoMount = _this_$options.autoMount, autoMount = _this_$options_autoMount === void 0 ? true : _this_$options_autoMount, schema = _this_$options.schema, beforeCreateInstance = _this_$options.beforeCreateInstance, externalParams = _this_$options.externalParams, _this_$options_language = _this_$options.// fieldModel,
388
+ language, language = _this_$options_language === void 0 ? DEFAULT_LOCALE : _this_$options_language, _this_$options_debug = _this_$options.debug, debug = _this_$options_debug === void 0 ? false : _this_$options_debug;
262
389
  RulesMessage.setLocale(language);
263
390
  _this.debug = debug;
264
391
  _this.runtime = new Runtime({
@@ -269,19 +396,19 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
269
396
  _this.store = new Store({
270
397
  instance: _this.runtime.instance
271
398
  });
272
- _this.debugLog('engine is Instantiation complete');
399
+ _this.debugLog("engine is Instantiation complete");
273
400
  // 自动执行挂载完成,也可以手动调用mount方法
274
401
  autoMount && _this.mount();
275
402
  return _this;
276
403
  }
277
- _createClass(Engine, [
404
+ _create_class(Engine, [
278
405
  {
279
406
  key: "debugLog",
280
407
  value: function debugLog() {
281
408
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
282
409
  args[_key] = arguments[_key];
283
410
  }
284
- this.debug && log.apply(void 0, _toConsumableArray(args));
411
+ this.debug && log.apply(void 0, _to_consumable_array(args));
285
412
  }
286
413
  },
287
414
  {
@@ -300,8 +427,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
300
427
  for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
301
428
  arg[_key] = arguments[_key];
302
429
  }
303
- var _runtime;
304
- (_runtime = this.runtime).register.apply(_runtime, _toConsumableArray(arg));
430
+ var _this_runtime;
431
+ (_this_runtime = this.runtime).register.apply(_this_runtime, _to_consumable_array(arg));
305
432
  return this;
306
433
  }
307
434
  },
@@ -309,14 +436,14 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
309
436
  key: "mount",
310
437
  value: function mount() {
311
438
  this.debugLog("engine的mount方法开始调用");
312
- var _$options = this.$options, _plugins = _$options.plugins, plugins = _plugins === void 0 ? [] : _plugins;
439
+ var _this_$options = this.$options, _this_$options_plugins = _this_$options.plugins, plugins = _this_$options_plugins === void 0 ? [] : _this_$options_plugins;
313
440
  this._handlerProxyState();
314
441
  this.__plugins = plugins;
315
442
  this.applyPlugins();
316
443
  // 触发所有控件的默认值的change事件
317
444
  this.setStates(this.getState());
318
445
  this.debugLog("engine的mount方法调用结束");
319
- if (this.debug && typeof window !== 'undefined') {
446
+ if (this.debug && typeof window !== "undefined") {
320
447
  // @ts-ignore
321
448
  window.engines[this.id] = this;
322
449
  }
@@ -325,7 +452,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
325
452
  {
326
453
  key: "destroy",
327
454
  value: function destroy() {
328
- if (this.debug && typeof window !== 'undefined') {
455
+ if (this.debug && typeof window !== "undefined") {
329
456
  // @ts-ignore
330
457
  delete window.engines[this.id];
331
458
  }
@@ -347,7 +474,6 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
347
474
  }
348
475
  // @ts-ignore
349
476
  if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE)) {
350
- var ref;
351
477
  if (newValue === null) {
352
478
  return [];
353
479
  }
@@ -362,12 +488,12 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
362
488
  }, {});
363
489
  // @ts-ignore
364
490
  var emptyState = this.getEmptyState(instance.id);
365
- return (ref = newValue) === null || ref === void 0 ? void 0 : ref.map(function(row) {
366
- // @ts-ignore
367
- return checkerSubtableValue(fieldTypeMap, row, emptyState);
491
+ return newValue === null || newValue === void 0 ? void 0 : newValue.map(function(row) {
492
+ return(// @ts-ignore
493
+ checkerSubtableValue(fieldTypeMap, row, emptyState));
368
494
  });
369
495
  }
370
- var keys = key.split('.');
496
+ var keys = key.split(".");
371
497
  var lastKey = keys[keys.length - 1];
372
498
  try {
373
499
  return checkerValue(instance.fieldType, lastKey, newValue, oldValue);
@@ -400,7 +526,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
400
526
  var newRows = [];
401
527
  for(var i = 0; i < len; i++){
402
528
  // @ts-ignore
403
- var row = _this.listControlCreateRow(subtable, 'subtable-row');
529
+ var row = _this.listControlCreateRow(subtable, "subtable-row");
404
530
  row && newRows.push(row);
405
531
  }
406
532
  // @ts-ignore
@@ -415,19 +541,19 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
415
541
  if (type && args) {
416
542
  // const subtableOldLength = subtable.children.length
417
543
  switch(type){
418
- case 'push':
419
- case 'unshift':
420
- var _children;
544
+ case "push":
545
+ case "unshift":
546
+ var _subtable_children;
421
547
  var newRowLengths = args.length;
422
548
  createdNewRows = createRows(newRowLengths);
423
549
  createdNewRowsData = args;
424
- (_children = subtable.children)[type].apply(_children, _toConsumableArray(createdNewRows));
550
+ (_subtable_children = subtable.children)[type].apply(_subtable_children, _to_consumable_array(createdNewRows));
425
551
  this.runtime.getFlatInstances();
426
552
  break;
427
- case 'splice':
553
+ case "splice":
428
554
  if (args.length > 2) {
429
555
  var // @ts-ignore
430
- _children1;
556
+ _subtable_children1;
431
557
  var newRowLengths1 = args.length - 2;
432
558
  var newValues = args.slice(2);
433
559
  createdNewRows = createRows(newRowLengths1);
@@ -436,10 +562,10 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
436
562
  var start = args[0];
437
563
  // 替换几个
438
564
  var replace = args[1];
439
- (_children1 = subtable.children)[type].apply(_children1, [
565
+ (_subtable_children1 = subtable.children)[type].apply(_subtable_children1, [
440
566
  start,
441
567
  replace
442
- ].concat(_toConsumableArray(createdNewRows)));
568
+ ].concat(_to_consumable_array(createdNewRows)));
443
569
  this.runtime.getFlatInstances();
444
570
  // newValues.forEach((item: any, index) => {
445
571
  // let newIndex = start + index
@@ -447,7 +573,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
447
573
  // })
448
574
  } else {
449
575
  var // @ts-ignore
450
- _children2;
576
+ _subtable_children2;
451
577
  // 从哪儿开始
452
578
  var start1 = args[0];
453
579
  // 替换几个
@@ -455,28 +581,28 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
455
581
  if (start1 + replace1 === subtable.children.length - 1) {
456
582
  isDeleteLastOne = true;
457
583
  }
458
- (_children2 = subtable.children)[type].apply(_children2, _toConsumableArray(args));
584
+ (_subtable_children2 = subtable.children)[type].apply(_subtable_children2, _to_consumable_array(args));
459
585
  this.runtime.getFlatInstances();
460
586
  }
461
587
  break;
462
588
  default:
463
589
  var // @ts-ignore
464
- _children3;
465
- (_children3 = subtable.children)[type].apply(_children3, _toConsumableArray(args));
590
+ _subtable_children3;
591
+ (_subtable_children3 = subtable.children)[type].apply(_subtable_children3, _to_consumable_array(args));
466
592
  this.runtime.getFlatInstances();
467
593
  break;
468
594
  }
469
- if (type === 'splice') {
595
+ if (type === "splice") {
470
596
  deleted = result;
471
597
  } else if ([
472
- 'pop',
473
- 'shift'
598
+ "pop",
599
+ "shift"
474
600
  ].includes(type)) {
475
601
  deleted = [
476
602
  result
477
603
  ];
478
604
  }
479
- this.emit('list-change', {
605
+ this.emit("list-change", {
480
606
  instance: subtable,
481
607
  value: this.getState(subtable.id),
482
608
  options: Object.assign({}, options, {
@@ -504,26 +630,26 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
504
630
  // if (instance instanceof RuntimeListControl) {
505
631
  if (instance.controlType === CONTROL_BASE_TYPE.LIST) {
506
632
  var // @ts-ignore
507
- _children;
633
+ _instance_children;
508
634
  instance.children.length = 0;
509
635
  var newValue = value;
510
636
  // @ts-ignore
511
637
  var newRows = [];
512
638
  for(var i = 0; i < newValue.length; i++){
513
639
  // @ts-ignore
514
- var row = this.listControlCreateRow(instance, 'subtable-row');
640
+ var row = this.listControlCreateRow(instance, "subtable-row");
515
641
  row && newRows.push(row);
516
642
  }
517
- (_children = instance.children).push.apply(_children, _toConsumableArray(newRows));
643
+ (_instance_children = instance.children).push.apply(_instance_children, _to_consumable_array(newRows));
518
644
  this.runtime.getFlatInstances();
519
645
  // 这里已经能拿到控件实例,所以在这里触发setStates,触发每一行每一个控件的change事件
520
646
  // for (let i = 0; i < newValue.length; i++) {
521
647
  // this.setStates(newValue[i], i, options)
522
648
  // }
523
- this.emit('list-change', {
649
+ this.emit("list-change", {
524
650
  instance: instance,
525
651
  value: value,
526
- options: _objectSpread({}, options, {
652
+ options: _object_spread_props(_object_spread({}, options), {
527
653
  // @ts-ignore
528
654
  changed: newRows,
529
655
  data: newValue,
@@ -531,11 +657,11 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
531
657
  })
532
658
  });
533
659
  } else {
534
- this.emit('change', {
660
+ this.emit("change", {
535
661
  instance: instance,
536
662
  value: this.getState(instance.id, index),
537
663
  rowIndex: index,
538
- options: _objectSpread({}, options, {
664
+ options: _object_spread_props(_object_spread({}, options), {
539
665
  oldValue: oldValue
540
666
  })
541
667
  });
@@ -549,13 +675,13 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
549
675
  if (this.__pluginsApplied) return;
550
676
  this.__plugins.forEach(function(plugin) {
551
677
  try {
552
- var _pluginName;
553
- applyingPluginName = (_pluginName = plugin.pluginName) !== null && _pluginName !== void 0 ? _pluginName : plugin.constructor.name;
678
+ var _plugin_pluginName;
679
+ applyingPluginName = (_plugin_pluginName = plugin.pluginName) !== null && _plugin_pluginName !== void 0 ? _plugin_pluginName : plugin.constructor.name;
554
680
  plugin.apply(_this);
555
681
  } catch (e) {
556
682
  error("".concat(applyingPluginName, " Plugin apply Error \n ").concat(e));
557
683
  } finally{
558
- applyingPluginName = '';
684
+ applyingPluginName = "";
559
685
  }
560
686
  });
561
687
  this.__pluginsApplied = true;
@@ -569,37 +695,13 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
569
695
  // if (row instanceof RuntimeLayoutControl) {
570
696
  // @ts-ignore
571
697
  if (row.controlType === CONTROL_BASE_TYPE.LAYOUT) {
572
- var _children;
698
+ var _inst_children;
573
699
  var inst = row;
574
700
  var template = JSONCopy(instance.props.headers);
575
701
  // @ts-ignore
576
702
  var columns = this.createControl(template);
577
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
578
- try {
579
- for(var _iterator = columns[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
580
- var column = _step.value;
581
- if (!column.parent) {
582
- this.runtime.resetInstanceParent(column, inst);
583
- }
584
- }
585
- } catch (err) {
586
- _didIteratorError = true;
587
- _iteratorError = err;
588
- } finally{
589
- try {
590
- if (!_iteratorNormalCompletion && _iterator.return != null) {
591
- _iterator.return();
592
- }
593
- } finally{
594
- if (_didIteratorError) {
595
- throw _iteratorError;
596
- }
597
- }
598
- }
599
- (_children = inst.children).push.apply(_children, _toConsumableArray(columns));
703
+ (_inst_children = inst.children).push.apply(_inst_children, _to_consumable_array(columns));
600
704
  }
601
- //@ts-ignore
602
- row.parent = instance;
603
705
  return row;
604
706
  }
605
707
  },
@@ -607,7 +709,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
607
709
  key: "listControlAddRow",
608
710
  value: function listControlAddRow(instance) {
609
711
  var // @ts-ignore
610
- rowType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'subtable-row';
712
+ rowType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "subtable-row";
611
713
  var row = this.listControlCreateRow(instance, rowType);
612
714
  if (!row) return;
613
715
  instance.children.push(row);
@@ -619,39 +721,42 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
619
721
  function emit(eventKey, payload) {
620
722
  var _this = this;
621
723
  var _this1 = this, _superprop_get_emit = function() {
622
- return _get(_getPrototypeOf(Engine.prototype), "emit", _this);
724
+ return _get(_get_prototype_of(Engine.prototype), "emit", _this);
623
725
  };
624
- return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
726
+ return _async_to_generator(function() {
625
727
  var needWait, promiseResolver, promise, results;
626
- return regeneratorRuntime.wrap(function _callee$(_ctx) {
627
- while(1)switch(_ctx.prev = _ctx.next){
728
+ return _ts_generator(this, function(_state) {
729
+ switch(_state.label){
628
730
  case 0:
629
- if (!(eventKey === 'engine-mounted')) {
630
- _ctx.next = 11;
631
- break;
632
- }
633
- if (!_this1.isMounted) {
634
- _ctx.next = 4;
635
- break;
731
+ if (!(eventKey === "engine-mounted")) return [
732
+ 3,
733
+ 3
734
+ ];
735
+ if (_this1.isMounted) {
736
+ warn("The engine-mounted life cycle can only be triggered once");
737
+ return [
738
+ 2,
739
+ Promise.resolve([])
740
+ ];
636
741
  }
637
- warn('The engine-mounted life cycle can only be triggered once');
638
- return _ctx.abrupt("return", Promise.resolve([]));
639
- case 4:
640
- if (!_this1._jobTasks.length) {
641
- _ctx.next = 10;
642
- break;
643
- }
644
- console.time('engine-mounted need wait');
645
- needWait = _toConsumableArray(_this1._jobTasks);
646
- _ctx.next = 9;
647
- return Promise.all(needWait);
648
- case 9:
649
- console.timeEnd('engine-mounted need wait');
650
- case 10:
742
+ if (!_this1._jobTasks.length) return [
743
+ 3,
744
+ 2
745
+ ];
746
+ console.time("engine-mounted need wait");
747
+ needWait = _to_consumable_array(_this1._jobTasks);
748
+ return [
749
+ 4,
750
+ Promise.all(needWait)
751
+ ];
752
+ case 1:
753
+ _state.sent();
754
+ console.timeEnd("engine-mounted need wait");
755
+ _state.label = 2;
756
+ case 2:
651
757
  _this1.isMounted = true;
652
- case 11:
653
- ;
654
- ;
758
+ _state.label = 3;
759
+ case 3:
655
760
  // 如果没有挂载的话,需要记录在挂载之前触发的所有任务
656
761
  if (!_this1.isMounted) {
657
762
  promise = new Promise(function(resolve) {
@@ -659,22 +764,24 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
659
764
  });
660
765
  _this1._jobTasks.push(promise);
661
766
  }
662
- _ctx.next = 16;
663
- return _superprop_get_emit().call(_this1, eventKey, payload);
664
- case 16:
665
- results = _ctx.sent;
767
+ return [
768
+ 4,
769
+ _superprop_get_emit().call(_this1, eventKey, payload)
770
+ ];
771
+ case 4:
772
+ results = _state.sent();
666
773
  if (promiseResolver && promise) {
667
774
  // 每一个任务完成的时候,都把自己从task中去掉
668
775
  promiseResolver();
669
776
  _this1._jobTasks.splice(_this1._jobTasks.indexOf(promise), 1);
670
777
  }
671
- return _ctx.abrupt("return", results);
672
- case 19:
673
- case "end":
674
- return _ctx.stop();
778
+ return [
779
+ 2,
780
+ results
781
+ ];
675
782
  }
676
- }, _callee);
677
- }))();
783
+ });
784
+ })();
678
785
  }
679
786
  },
680
787
  {
@@ -683,7 +790,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
683
790
  if (applyingPluginName) {
684
791
  callback.applyingPluginName = applyingPluginName;
685
792
  }
686
- return _get(_getPrototypeOf(Engine.prototype), "on", this).call(this, key, callback);
793
+ return _get(_get_prototype_of(Engine.prototype), "on", this).call(this, key, callback);
687
794
  }
688
795
  },
689
796
  {
@@ -692,8 +799,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
692
799
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
693
800
  args[_key] = arguments[_key];
694
801
  }
695
- var _runtime;
696
- return (_runtime = this.runtime).createControl.apply(_runtime, _toConsumableArray(args));
802
+ var _this_runtime;
803
+ return (_this_runtime = this.runtime).createControl.apply(_this_runtime, _to_consumable_array(args));
697
804
  }
698
805
  },
699
806
  {
@@ -714,12 +821,6 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
714
821
  return this.setInstance(instance, props, value, rowIndex);
715
822
  }
716
823
  },
717
- {
718
- key: "getRule",
719
- value: function getRule(controlType, props) {
720
- return Runtime.staticGetRules(controlType, props);
721
- }
722
- },
723
824
  {
724
825
  key: "getAllRules",
725
826
  value: function getAllRules(controlId) {
@@ -727,10 +828,10 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
727
828
  if (controlId === undefined) {
728
829
  return rules;
729
830
  } else {
730
- var ref, ref1;
831
+ var _rules_rules_controlId, _rules_antdRules_controlId;
731
832
  return {
732
- rules: (ref = rules.rules[controlId]) === null || ref === void 0 ? void 0 : ref.fields,
733
- antdRules: (ref1 = rules.antdRules[controlId]) === null || ref1 === void 0 ? void 0 : ref1.fields
833
+ rules: (_rules_rules_controlId = rules.rules[controlId]) === null || _rules_rules_controlId === void 0 ? void 0 : _rules_rules_controlId.fields,
834
+ antdRules: (_rules_antdRules_controlId = rules.antdRules[controlId]) === null || _rules_antdRules_controlId === void 0 ? void 0 : _rules_antdRules_controlId.fields
734
835
  };
735
836
  }
736
837
  }
@@ -741,8 +842,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
741
842
  if (controlId === undefined) {
742
843
  return this.runtime.rules;
743
844
  } else {
744
- var ref;
745
- return (ref = this.runtime.rules[controlId]) === null || ref === void 0 ? void 0 : ref.fields;
845
+ var _this_runtime_rules_controlId;
846
+ return (_this_runtime_rules_controlId = this.runtime.rules[controlId]) === null || _this_runtime_rules_controlId === void 0 ? void 0 : _this_runtime_rules_controlId.fields;
746
847
  }
747
848
  }
748
849
  },
@@ -752,8 +853,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
752
853
  if (controlId === undefined) {
753
854
  return this.runtime.antdRules;
754
855
  } else {
755
- var ref;
756
- return (ref = this.runtime.antdRules[controlId]) === null || ref === void 0 ? void 0 : ref.fields;
856
+ var _this_runtime_antdRules_controlId;
857
+ return (_this_runtime_antdRules_controlId = this.runtime.antdRules[controlId]) === null || _this_runtime_antdRules_controlId === void 0 ? void 0 : _this_runtime_antdRules_controlId.fields;
757
858
  }
758
859
  }
759
860
  },
@@ -790,9 +891,9 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
790
891
  key: "setState",
791
892
  value: function setState(controlId, value, rowIndex, options) {
792
893
  eventOptionsTemp = options;
793
- this.debugLog('[%o]: 触发setState, 修改的值为%o, rowIndex=%o, options=%o', controlId, value, rowIndex, options);
894
+ this.debugLog("[%o]: 触发setState, 修改的值为%o, rowIndex=%o, options=%o", controlId, value, rowIndex, options);
794
895
  this.store.setState(controlId, value, rowIndex);
795
- this.debugLog('[%o]: setState完成, 修改的值为%o, rowIndex=%o', controlId, value, rowIndex);
896
+ this.debugLog("[%o]: setState完成, 修改的值为%o, rowIndex=%o", controlId, value, rowIndex);
796
897
  eventOptionsTemp = null;
797
898
  }
798
899
  },
@@ -805,20 +906,19 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
805
906
  var _this = this;
806
907
  var newStates = states !== null && states !== void 0 ? states : {};
807
908
  Object.keys(newStates).forEach(function(stateId) {
808
- var _this2 = _this;
809
909
  Object.entries(_this.store.controlIdMapping).forEach(function(param) {
810
- var _param = _slicedToArray(param, 2), controlId = _param[0], controlIdMapping = _param[1];
910
+ var _param = _sliced_to_array(param, 2), controlId = _param[0], controlIdMapping = _param[1];
811
911
  if (controlIdMapping.dataView === stateId) {
812
912
  // state对象是dataView包裹的
813
913
  var value = newStates[stateId][controlId];
814
914
  if (value !== undefined) {
815
- _this2.setState(controlId, value, rowIndex, options);
915
+ _this.setState(controlId, value, rowIndex, options);
816
916
  }
817
917
  } else {
818
918
  // state对象是单独的,没有被dataView包裹的
819
919
  if (controlId === stateId || controlIdMapping.children && controlIdMapping.children[stateId]) {
820
920
  if (newStates[stateId] !== undefined) {
821
- _this2.setState(stateId, newStates[stateId], rowIndex, options);
921
+ _this.setState(stateId, newStates[stateId], rowIndex, options);
822
922
  }
823
923
  }
824
924
  }
@@ -846,12 +946,12 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
846
946
  if (!dataBindMapping1) {
847
947
  return;
848
948
  }
849
- var dataBind1 = dataBindMapping1.dataBind, controlId1 = dataBindMapping1.controlId;
949
+ var dataBind = dataBindMapping1.dataBind, controlId1 = dataBindMapping1.controlId;
850
950
  var state = this.getState(controlId1, rowIndex);
851
951
  //if (dataBind instanceof ObjectDataBind) {
852
- if (!isDataBind(dataBind1)) {
853
- return Object.entries(dataBind1).reduce(function(result, param) {
854
- var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
952
+ if (!isDataBind(dataBind)) {
953
+ return Object.entries(dataBind).reduce(function(result, param) {
954
+ var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
855
955
  // objectDataBind的元素,跳过下一次赋值
856
956
  if (dataBind.fieldCode === fieldCode) {
857
957
  return result[key];
@@ -877,18 +977,18 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
877
977
  var data = getFieldData.map(function(item) {
878
978
  var obj = {};
879
979
  for(var key in item){
880
- var ref, ref2, ref3;
881
- var fieldCode = (ref2 = (ref = controlIdMapping[controlId]) === null || ref === void 0 ? void 0 : ref.children[key]) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.dataBind) === null || ref3 === void 0 ? void 0 : ref3.fieldCode;
980
+ var _controlIdMapping_controlId_children_key_dataBind, _controlIdMapping_controlId_children_key, _controlIdMapping_controlId;
981
+ var fieldCode = (_controlIdMapping_controlId = controlIdMapping[controlId]) === null || _controlIdMapping_controlId === void 0 ? void 0 : (_controlIdMapping_controlId_children_key = _controlIdMapping_controlId.children[key]) === null || _controlIdMapping_controlId_children_key === void 0 ? void 0 : (_controlIdMapping_controlId_children_key_dataBind = _controlIdMapping_controlId_children_key.dataBind) === null || _controlIdMapping_controlId_children_key_dataBind === void 0 ? void 0 : _controlIdMapping_controlId_children_key_dataBind.fieldCode;
882
982
  //未绑定字段的控件,直接抛弃
883
- if (fieldCode !== '') {
884
- var ref4;
983
+ if (fieldCode !== "") {
984
+ var _controlIdMapping_controlId1;
885
985
  if (fieldCode) {
886
986
  obj[fieldCode] = item[key];
887
- } else if ((ref4 = controlIdMapping[controlId]) === null || ref4 === void 0 ? void 0 : ref4.children[key]) {
987
+ } else if ((_controlIdMapping_controlId1 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId1 === void 0 ? void 0 : _controlIdMapping_controlId1.children[key]) {
888
988
  // 兼容一个控件需要绑定多个字段的情况
889
989
  for(var keyChi in item[key]){
890
- var ref5, ref6;
891
- obj[(ref6 = (ref5 = controlIdMapping[controlId]) === null || ref5 === void 0 ? void 0 : ref5.children[key]) === null || ref6 === void 0 ? void 0 : ref6.dataBind[keyChi].fieldCode] = item[key][keyChi];
990
+ var _controlIdMapping_controlId_children_key1, _controlIdMapping_controlId2;
991
+ obj[(_controlIdMapping_controlId2 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId2 === void 0 ? void 0 : (_controlIdMapping_controlId_children_key1 = _controlIdMapping_controlId2.children[key]) === null || _controlIdMapping_controlId_children_key1 === void 0 ? void 0 : _controlIdMapping_controlId_children_key1.dataBind[keyChi].fieldCode] = item[key][keyChi];
892
992
  }
893
993
  }
894
994
  }
@@ -897,45 +997,45 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
897
997
  });
898
998
  return data;
899
999
  } else {
900
- var _loop = function(key1) {
901
- var ref15, ref7, ref8, ref9;
902
- if ((ref15 = controlIdMapping[key1]) === null || ref15 === void 0 ? void 0 : (ref7 = ref15.dataBind) === null || ref7 === void 0 ? void 0 : ref7.fieldCode) {
903
- var ref10;
904
- obj1[(ref10 = controlIdMapping[key1]) === null || ref10 === void 0 ? void 0 : ref10.dataBind.fieldCode] = getFieldData[key1];
905
- } else if ((ref8 = controlIdMapping[key1]) === null || ref8 === void 0 ? void 0 : (ref9 = ref8.dataBind) === null || ref9 === void 0 ? void 0 : ref9.dataCode) {
906
- var ref11;
1000
+ var _loop = function(key) {
1001
+ var _controlIdMapping_key_dataBind, _controlIdMapping_key, _controlIdMapping_key_dataBind1, _controlIdMapping_key1;
1002
+ if ((_controlIdMapping_key = controlIdMapping[key]) === null || _controlIdMapping_key === void 0 ? void 0 : (_controlIdMapping_key_dataBind = _controlIdMapping_key.dataBind) === null || _controlIdMapping_key_dataBind === void 0 ? void 0 : _controlIdMapping_key_dataBind.fieldCode) {
1003
+ var _controlIdMapping_key2;
1004
+ obj[(_controlIdMapping_key2 = controlIdMapping[key]) === null || _controlIdMapping_key2 === void 0 ? void 0 : _controlIdMapping_key2.dataBind.fieldCode] = getFieldData[key];
1005
+ } else if ((_controlIdMapping_key1 = controlIdMapping[key]) === null || _controlIdMapping_key1 === void 0 ? void 0 : (_controlIdMapping_key_dataBind1 = _controlIdMapping_key1.dataBind) === null || _controlIdMapping_key_dataBind1 === void 0 ? void 0 : _controlIdMapping_key_dataBind1.dataCode) {
1006
+ var _controlIdMapping_key3;
907
1007
  // 明细字表只循环一层明细子表未递归
908
- obj1[(ref11 = controlIdMapping[key1]) === null || ref11 === void 0 ? void 0 : ref11.dataBind.dataCode] = getFieldData[key1].map(function(item) {
1008
+ obj[(_controlIdMapping_key3 = controlIdMapping[key]) === null || _controlIdMapping_key3 === void 0 ? void 0 : _controlIdMapping_key3.dataBind.dataCode] = getFieldData[key].map(function(item) {
909
1009
  var objChi = {};
910
1010
  for(var keyChi in item){
911
- var ref;
912
- var fieldCode = (ref = controlIdMapping[key1].children[keyChi]) === null || ref === void 0 ? void 0 : ref.dataBind.fieldCode;
1011
+ var _controlIdMapping_key_children_keyChi;
1012
+ var fieldCode = (_controlIdMapping_key_children_keyChi = controlIdMapping[key].children[keyChi]) === null || _controlIdMapping_key_children_keyChi === void 0 ? void 0 : _controlIdMapping_key_children_keyChi.dataBind.fieldCode;
913
1013
  //未绑定字段的控件,直接抛弃
914
- if (fieldCode !== '') {
1014
+ if (fieldCode !== "") {
915
1015
  if (fieldCode) {
916
1016
  objChi[fieldCode] = item[keyChi];
917
1017
  } else {
918
1018
  for(var keyChi1 in item[keyChi]){
919
- var ref14;
920
- objChi[(ref14 = controlIdMapping[key1].children[keyChi]) === null || ref14 === void 0 ? void 0 : ref14.dataBind[keyChi1].fieldCode] = item[keyChi][keyChi1];
1019
+ var _controlIdMapping_key_children_keyChi1;
1020
+ objChi[(_controlIdMapping_key_children_keyChi1 = controlIdMapping[key].children[keyChi]) === null || _controlIdMapping_key_children_keyChi1 === void 0 ? void 0 : _controlIdMapping_key_children_keyChi1.dataBind[keyChi1].fieldCode] = item[keyChi][keyChi1];
921
1021
  }
922
1022
  }
923
1023
  }
924
1024
  }
925
1025
  return objChi;
926
1026
  });
927
- } else if (controlIdMapping[key1]) {
1027
+ } else if (controlIdMapping[key]) {
928
1028
  // 兼容一个控件需要绑定多个字段的情况
929
- for(var keyChi2 in getFieldData[key1]){
930
- var ref12, ref13;
931
- obj1[(ref13 = (ref12 = controlIdMapping[key1]) === null || ref12 === void 0 ? void 0 : ref12.dataBind[keyChi2]) === null || ref13 === void 0 ? void 0 : ref13.fieldCode] = getFieldData[key1][keyChi2];
1029
+ for(var keyChi in getFieldData[key]){
1030
+ var _controlIdMapping_key_dataBind_keyChi, _controlIdMapping_key4;
1031
+ obj[(_controlIdMapping_key4 = controlIdMapping[key]) === null || _controlIdMapping_key4 === void 0 ? void 0 : (_controlIdMapping_key_dataBind_keyChi = _controlIdMapping_key4.dataBind[keyChi]) === null || _controlIdMapping_key_dataBind_keyChi === void 0 ? void 0 : _controlIdMapping_key_dataBind_keyChi.fieldCode] = getFieldData[key][keyChi];
932
1032
  }
933
1033
  }
934
1034
  };
935
1035
  // 主表
936
- var obj1 = {};
937
- for(var key1 in getFieldData)_loop(key1);
938
- return obj1;
1036
+ var obj = {};
1037
+ for(var key in getFieldData)_loop(key);
1038
+ return obj;
939
1039
  }
940
1040
  }
941
1041
  return;
@@ -955,14 +1055,14 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
955
1055
  if (!dataBindMapping) {
956
1056
  return;
957
1057
  }
958
- var dataBind2 = dataBindMapping.dataBind, controlId = dataBindMapping.controlId;
1058
+ var dataBind = dataBindMapping.dataBind, controlId = dataBindMapping.controlId;
959
1059
  // if (dataBind instanceof ObjectDataBind) {
960
- if (!isDataBind(dataBind2)) {
961
- var ref;
962
- var oldState = (ref = JSONCopy(this.getState(controlId, rowIndex))) !== null && ref !== void 0 ? ref : this.getEmptyState(controlId);
1060
+ if (!isDataBind(dataBind)) {
1061
+ var _JSONCopy;
1062
+ var oldState = (_JSONCopy = JSONCopy(this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : this.getEmptyState(controlId);
963
1063
  // fieldCode不代表是key,所以需要找到对应的key
964
- var newState = Object.entries(dataBind2).reduce(function(result, param) {
965
- var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
1064
+ var newState = Object.entries(dataBind).reduce(function(result, param) {
1065
+ var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
966
1066
  // objectDataBind的元素,跳过下一次赋值
967
1067
  if (dataBind.fieldCode === fieldCode) {
968
1068
  result[key] = value;
@@ -991,7 +1091,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
991
1091
  }
992
1092
  var skipKeys = [];
993
1093
  mapping.fields.forEach(function(item) {
994
- var dataBind3 = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
1094
+ var dataBind = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
995
1095
  if (skipKeys.includes(fieldCode)) {
996
1096
  return;
997
1097
  }
@@ -1000,12 +1100,12 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1000
1100
  }
1001
1101
  // 对象类型的值
1002
1102
  // if (dataBind instanceof ObjectDataBind) {
1003
- if (!isDataBind(dataBind3)) {
1004
- var ref;
1005
- var oldState = (ref = JSONCopy(_this.getState(controlId, rowIndex))) !== null && ref !== void 0 ? ref : _this.getEmptyState(controlId);
1103
+ if (!isDataBind(dataBind)) {
1104
+ var _JSONCopy;
1105
+ var oldState = (_JSONCopy = JSONCopy(_this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : _this.getEmptyState(controlId);
1006
1106
  // fieldCode不代表是key,所以需要找到对应的key
1007
- var newState = Object.entries(dataBind3).reduce(function(result, param) {
1008
- var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
1107
+ var newState = Object.entries(dataBind).reduce(function(result, param) {
1108
+ var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
1009
1109
  // objectDataBind的元素,跳过下一次赋值
1010
1110
  skipKeys.push(dataBind.fieldCode);
1011
1111
  var value = state[dataBind.fieldCode];
@@ -1030,13 +1130,13 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1030
1130
  value: function buildFields(dataCode, state) {
1031
1131
  var _this = this;
1032
1132
  var mapping = this.getDataBindMapping(dataCode);
1033
- if (!mapping || !mapping.fields) {
1133
+ if (!mapping) {
1034
1134
  return;
1035
1135
  }
1036
1136
  var skipKeys = [];
1037
- var result1 = {};
1137
+ var result = {};
1038
1138
  mapping.fields.forEach(function(item) {
1039
- var dataBind4 = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
1139
+ var dataBind = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
1040
1140
  if (skipKeys.includes(fieldCode)) {
1041
1141
  return;
1042
1142
  }
@@ -1045,11 +1145,11 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1045
1145
  }
1046
1146
  // 对象类型的值
1047
1147
  // if (dataBind instanceof ObjectDataBind) {
1048
- if (!isDataBind(dataBind4)) {
1148
+ if (!isDataBind(dataBind)) {
1049
1149
  var oldState = _this.getEmptyState(controlId);
1050
1150
  // fieldCode不代表是key,所以需要找到对应的key
1051
- result1[item.controlId] = Object.entries(dataBind4).reduce(function(result, param) {
1052
- var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
1151
+ result[item.controlId] = Object.entries(dataBind).reduce(function(result, param) {
1152
+ var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
1053
1153
  // objectDataBind的元素,跳过下一次赋值
1054
1154
  skipKeys.push(dataBind.fieldCode);
1055
1155
  var value = state[dataBind.fieldCode];
@@ -1059,10 +1159,10 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1059
1159
  return result;
1060
1160
  }, oldState);
1061
1161
  } else {
1062
- result1[controlId] = state[fieldCode];
1162
+ result[controlId] = state[fieldCode];
1063
1163
  }
1064
1164
  });
1065
- return result1;
1165
+ return result;
1066
1166
  }
1067
1167
  },
1068
1168
  {
@@ -1072,14 +1172,13 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1072
1172
  * @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
1073
1173
  */ key: "setData",
1074
1174
  value: function setData(dataSet, options) {
1075
- var _this6 = this;
1175
+ var _this = this;
1076
1176
  this.debugLog("engine setData方法执行,参数为%o,%o。", dataSet, options);
1077
1177
  var newState = this.store.defaultState;
1078
1178
  Object.keys(dataSet).map(function(dataCode) {
1079
1179
  var entity = dataSet[dataCode];
1080
1180
  if (Array.isArray(entity)) {
1081
- var _this4 = _this6;
1082
- var mapping = _this6.getDataBindMapping(dataCode);
1181
+ var mapping = _this.getDataBindMapping(dataCode);
1083
1182
  if (!mapping) {
1084
1183
  return;
1085
1184
  }
@@ -1087,22 +1186,21 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1087
1186
  newState[mapping.dataViewId] = {};
1088
1187
  }
1089
1188
  if (!entity.length) {
1090
- var _controlId;
1091
- newState[mapping.dataViewId][mapping.controlId] = (_controlId = newState[mapping.dataViewId][mapping.controlId]) !== null && _controlId !== void 0 ? _controlId : [];
1189
+ var _newState_mapping_dataViewId_mapping_controlId;
1190
+ newState[mapping.dataViewId][mapping.controlId] = (_newState_mapping_dataViewId_mapping_controlId = newState[mapping.dataViewId][mapping.controlId]) !== null && _newState_mapping_dataViewId_mapping_controlId !== void 0 ? _newState_mapping_dataViewId_mapping_controlId : [];
1092
1191
  } else {
1093
1192
  newState[mapping.dataViewId][mapping.controlId] = [];
1094
1193
  }
1095
1194
  entity.map(function(row) {
1096
- var _this = _this4;
1097
- var newRow = JSONCopy(_this4.store.emptyState[mapping.dataViewId][mapping.controlId]);
1195
+ var newRow = JSONCopy(_this.store.emptyState[mapping.dataViewId][mapping.controlId]);
1098
1196
  var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1099
1197
  ;
1100
1198
  Object.keys(row).map(function(fieldCode) {
1101
- var ref, ref18;
1199
+ var _this_store_dataBindMapping_dataCode_fields, _this_store_dataBindMapping_dataCode;
1102
1200
  if (skipKey.includes(fieldCode)) {
1103
1201
  return;
1104
1202
  }
1105
- var fieldMapping = (ref = _this.store.dataBindMapping[dataCode]) === null || ref === void 0 ? void 0 : (ref18 = ref.fields) === null || ref18 === void 0 ? void 0 : ref18.find(function(i) {
1203
+ var fieldMapping = (_this_store_dataBindMapping_dataCode = _this.store.dataBindMapping[dataCode]) === null || _this_store_dataBindMapping_dataCode === void 0 ? void 0 : (_this_store_dataBindMapping_dataCode_fields = _this_store_dataBindMapping_dataCode.fields) === null || _this_store_dataBindMapping_dataCode_fields === void 0 ? void 0 : _this_store_dataBindMapping_dataCode_fields.find(function(i) {
1106
1204
  return i.fieldCode === fieldCode;
1107
1205
  });
1108
1206
  if (fieldMapping) {
@@ -1111,8 +1209,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1111
1209
  newRow[fieldMapping.controlId] = row[fieldCode];
1112
1210
  // } else if (fieldMapping.dataBind instanceof ObjectDataBind) {
1113
1211
  } else if (!isDataBind(fieldMapping.dataBind)) {
1114
- var ref19;
1115
- var objValue = JSONCopy((ref19 = _this.getEmptyState(fieldMapping.controlId)) !== null && ref19 !== void 0 ? ref19 : {});
1212
+ var _this_getEmptyState;
1213
+ var objValue = JSONCopy((_this_getEmptyState = _this.getEmptyState(fieldMapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {});
1116
1214
  Object.keys(fieldMapping.dataBind).map(function(key) {
1117
1215
  var dataBind = fieldMapping.dataBind[key];
1118
1216
  if (row[dataBind.fieldCode] !== undefined) {
@@ -1127,19 +1225,18 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1127
1225
  newState[mapping.dataViewId][mapping.controlId].push(newRow);
1128
1226
  });
1129
1227
  } else if (entity) {
1130
- var ref20;
1131
- var skipKey1 = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1228
+ var _Object_keys;
1229
+ var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1132
1230
  ;
1133
- var emptyState = JSONCopy(_this6.store.emptyState);
1134
- if (!((ref20 = Object.keys(entity)) === null || ref20 === void 0 ? void 0 : ref20.length)) {
1231
+ var emptyState = JSONCopy(_this.store.emptyState);
1232
+ if (!((_Object_keys = Object.keys(entity)) === null || _Object_keys === void 0 ? void 0 : _Object_keys.length)) {
1135
1233
  // newState = this.store.defaultState
1136
1234
  } else {
1137
- var _this3 = _this6;
1138
1235
  Object.keys(entity).map(function(fieldCode) {
1139
- if (skipKey1.includes(fieldCode)) {
1236
+ if (skipKey.includes(fieldCode)) {
1140
1237
  return;
1141
1238
  }
1142
- var mapping = _this3.getDataBindMapping(dataCode, fieldCode);
1239
+ var mapping = _this.getDataBindMapping(dataCode, fieldCode);
1143
1240
  if (mapping) {
1144
1241
  if (!newState[mapping.dataViewId[0]]) {
1145
1242
  newState[mapping.dataViewId[0]] = {};
@@ -1149,39 +1246,39 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1149
1246
  newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode] !== undefined ? entity[fieldCode] : emptyState[mapping.dataViewId[0]][mapping.controlId];
1150
1247
  // } else if (mapping.dataBind instanceof ObjectDataBind) {
1151
1248
  } else if (!isDataBind(mapping.dataBind)) {
1152
- var ref;
1153
- var objValue = (ref = _this3.getEmptyState(mapping.controlId)) !== null && ref !== void 0 ? ref : {};
1249
+ var _this_getEmptyState;
1250
+ var objValue = (_this_getEmptyState = _this.getEmptyState(mapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {};
1154
1251
  Object.keys(mapping.dataBind).map(function(key) {
1155
1252
  var dataBind = mapping.dataBind[key];
1156
1253
  if (entity[dataBind.fieldCode] !== undefined) {
1157
1254
  objValue[key] = entity[dataBind.fieldCode];
1158
1255
  }
1159
- skipKey1.push(dataBind.fieldCode);
1256
+ skipKey.push(dataBind.fieldCode);
1160
1257
  });
1161
1258
  newState[mapping.dataViewId[0]][mapping.controlId] = objValue;
1162
1259
  }
1163
1260
  }
1164
1261
  });
1165
1262
  }
1166
- var newMapping = _this6.getDataBindMapping(dataCode);
1263
+ var newMapping = _this.getDataBindMapping(dataCode);
1167
1264
  if (newMapping) {
1168
- var ref16;
1169
- var mappingKeys = newMapping === null || newMapping === void 0 ? void 0 : (ref16 = newMapping.fields) === null || ref16 === void 0 ? void 0 : ref16.map(function(item) {
1265
+ var _newMapping_fields;
1266
+ var mappingKeys = newMapping === null || newMapping === void 0 ? void 0 : (_newMapping_fields = newMapping.fields) === null || _newMapping_fields === void 0 ? void 0 : _newMapping_fields.map(function(item) {
1170
1267
  return item === null || item === void 0 ? void 0 : item.controlId;
1171
1268
  });
1172
- var mappingValue = _this6.getEmptyState(newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId);
1173
- var ref17;
1174
- var mainStateKeys = Object.keys((ref17 = newState === null || newState === void 0 ? void 0 : newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) !== null && ref17 !== void 0 ? ref17 : {});
1269
+ var mappingValue = _this.getEmptyState(newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId);
1270
+ var _newState_newMapping_controlId;
1271
+ var mainStateKeys = Object.keys((_newState_newMapping_controlId = newState === null || newState === void 0 ? void 0 : newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) !== null && _newState_newMapping_controlId !== void 0 ? _newState_newMapping_controlId : {});
1175
1272
  mappingKeys === null || mappingKeys === void 0 ? void 0 : mappingKeys.forEach(function(key) {
1176
- if (!mainStateKeys.includes(key) && key !== 'uid' && newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) {
1273
+ if (!mainStateKeys.includes(key) && key !== "uid" && newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) {
1177
1274
  if (Object.keys(newState).length) {
1178
- Object.assign(newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId], _defineProperty({}, key, mappingValue[key]));
1275
+ Object.assign(newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId], _define_property({}, key, mappingValue[key]));
1179
1276
  } else {
1180
- Object.assign(newState, _defineProperty({}, newMapping.controlId, _defineProperty({}, key, mappingValue[key])));
1277
+ Object.assign(newState, _define_property({}, newMapping.controlId, _define_property({}, key, mappingValue[key])));
1181
1278
  }
1182
1279
  }
1183
1280
  });
1184
- _this6.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
1281
+ _this.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
1185
1282
  }
1186
1283
  }
1187
1284
  });
@@ -1226,59 +1323,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1226
1323
  * 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
1227
1324
  * @param controlId
1228
1325
  * @param header 明细表内是否获取表头的控件
1229
- */ // getInstances(
1230
- // controlId?: string,
1231
- // header: boolean = false
1232
- // ): ControlRuntimeInstance<ControlsKeys>[] {
1233
- // // const cc = console
1234
- // // const label = '🐑 genInstances ' + controlId + ' ' + Date.now()
1235
- // // cc.time(label)
1236
- //
1237
- // if (controlId === undefined) {
1238
- // // cc.timeEnd(label)
1239
- // return this.runtime.flatInstances
1240
- // }
1241
- // const instances = Array.from(this.runtime.instanceMap[controlId] || [])
1242
- // if (header) {
1243
- // // 如果能从flatInstances里边取到,就通过getInstanceInSubtableHeader方法取,取不到则换一种方式
1244
- // if (instances.length) {
1245
- // const instance: RuntimeControl = instances[0]
1246
- // // if (this.inList(instance.id) === true) {
1247
- // if (this.inList(instance.id) !== undefined) {
1248
- // const headerInstance = this.getInstanceInSubtableHeader(instance)
1249
- // if (headerInstance) {
1250
- // instances.unshift(headerInstance)
1251
- // }
1252
- // }
1253
- // } else {
1254
- // const controlIdMapping = this.getControlIdMapping()
1255
- // const [subtableId] =
1256
- // Object.entries(controlIdMapping).find(
1257
- // ([_, mapping]) => mapping.children && controlId in mapping.children
1258
- // ) ?? []
1259
- // if (subtableId) {
1260
- // const subtable = this.getInstance(subtableId)
1261
- // // @ts-ignore
1262
- // const headerColumn = subtable.props.headers.find((column: any) =>
1263
- // column.children.find((item: any) => item.id === controlId)
1264
- // )
1265
- // if (headerColumn) {
1266
- // const headerInstance = headerColumn.children.find(
1267
- // (item: any) => item.id === controlId
1268
- // )
1269
- // if (headerInstance) {
1270
- // instances.unshift(
1271
- // headerInstance as ControlRuntimeInstance<ControlsKeys>
1272
- // )
1273
- // }
1274
- // }
1275
- // }
1276
- // }
1277
- // }
1278
- // // @ts-ignore
1279
- // return instances
1280
- // }
1281
- key: "getInstances",
1326
+ */ key: "getInstances",
1282
1327
  value: function getInstances(controlId) {
1283
1328
  var header = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
1284
1329
  // const cc = console
@@ -1288,15 +1333,42 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1288
1333
  // cc.timeEnd(label)
1289
1334
  return this.runtime.flatInstances;
1290
1335
  }
1291
- var instances = this.runtime.instanceMap[controlId] || [];
1336
+ var instances = Array.from(this.runtime.instanceMap[controlId] || []);
1292
1337
  if (header) {
1293
- var instance = instances[0];
1294
- if (instance) {
1295
- var ref;
1296
- // @ts-ignore
1297
- var parentId = (ref = instance.parent) === null || ref === void 0 ? void 0 : ref.id;
1298
- if (parentId) {
1299
- instances = this.runtime.instanceMap[parentId] || [];
1338
+ // 如果能从flatInstances里边取到,就通过getInstanceInSubtableHeader方法取,取不到则换一种方式
1339
+ if (instances.length) {
1340
+ var instance = instances[0];
1341
+ // if (this.inList(instance.id) === true) {
1342
+ if (this.inList(instance.id) !== undefined) {
1343
+ var headerInstance = this.getInstanceInSubtableHeader(instance);
1344
+ if (headerInstance) {
1345
+ instances.unshift(headerInstance);
1346
+ }
1347
+ }
1348
+ } else {
1349
+ var _this_getControlIdMapping;
1350
+ var controlIdMapping = (_this_getControlIdMapping = this.getControlIdMapping()) !== null && _this_getControlIdMapping !== void 0 ? _this_getControlIdMapping : {};
1351
+ var _Object_entries_find;
1352
+ var _ref = _sliced_to_array((_Object_entries_find = Object.entries(controlIdMapping).find(function(param) {
1353
+ var _param = _sliced_to_array(param, 2), _ = _param[0], mapping = _param[1];
1354
+ return mapping.children && controlId in mapping.children;
1355
+ })) !== null && _Object_entries_find !== void 0 ? _Object_entries_find : [], 1), subtableId = _ref[0];
1356
+ if (subtableId) {
1357
+ var subtable = this.getInstance(subtableId);
1358
+ // @ts-ignore
1359
+ var headerColumn = subtable.props.headers.find(function(column) {
1360
+ return column.children.find(function(item) {
1361
+ return item.id === controlId;
1362
+ });
1363
+ });
1364
+ if (headerColumn) {
1365
+ var headerInstance1 = headerColumn.children.find(function(item) {
1366
+ return item.id === controlId;
1367
+ });
1368
+ if (headerInstance1) {
1369
+ instances.unshift(headerInstance1);
1370
+ }
1371
+ }
1300
1372
  }
1301
1373
  }
1302
1374
  }
@@ -1307,16 +1379,16 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1307
1379
  {
1308
1380
  key: "setInstance",
1309
1381
  value: function setInstance(instance, props, value, rowIndex) {
1382
+ var _this = this;
1310
1383
  try {
1311
- if (typeof instance === 'string' && rowIndex === -1) {
1312
- var _this = this;
1384
+ if (typeof instance === "string" && rowIndex === -1) {
1313
1385
  //修改明细表整列属性的逻辑
1314
1386
  var instances = this.getInstances(instance, rowIndex === -1);
1315
1387
  instances.map(function(_instance) {
1316
1388
  if (_instance) {
1317
1389
  _this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
1318
1390
  updateValueFromKeys(_instance.props, props, value);
1319
- _this.schemaEvent('schema-change', {
1391
+ _this.schemaEvent("schema-change", {
1320
1392
  instance: _instance,
1321
1393
  props: props,
1322
1394
  value: value,
@@ -1325,19 +1397,19 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1325
1397
  }
1326
1398
  });
1327
1399
  } else {
1328
- var _instance1;
1329
- if (typeof instance === 'string') {
1330
- _instance1 = this.getInstance(instance, rowIndex);
1400
+ var _instance;
1401
+ if (typeof instance === "string") {
1402
+ _instance = this.getInstance(instance, rowIndex);
1331
1403
  } else {
1332
- _instance1 = instance;
1404
+ _instance = instance;
1333
1405
  }
1334
- if (!_instance1) {
1406
+ if (!_instance) {
1335
1407
  return;
1336
1408
  }
1337
- this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance1.id, _instance1, props, value);
1338
- updateValueFromKeys(_instance1.props, props, value);
1339
- this.schemaEvent('schema-change', {
1340
- instance: _instance1,
1409
+ this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
1410
+ updateValueFromKeys(_instance.props, props, value);
1411
+ this.schemaEvent("schema-change", {
1412
+ instance: _instance,
1341
1413
  props: props,
1342
1414
  value: value,
1343
1415
  rowIndex: rowIndex
@@ -1404,6 +1476,14 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1404
1476
  return isString(types) ? instance.type === types : types.includes(instance.type);
1405
1477
  }
1406
1478
  },
1479
+ {
1480
+ key: "assertInstanceIsCustomControl",
1481
+ value: /**
1482
+ * 判断控件或控件类型是一个自定义控件
1483
+ * */ function assertInstanceIsCustomControl(instance) {
1484
+ return !isBuiltInControls(isString(instance) ? instance : instance.type);
1485
+ }
1486
+ },
1407
1487
  {
1408
1488
  key: "getInstanceRowIndex",
1409
1489
  value: /**
@@ -1411,64 +1491,55 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1411
1491
  * 如果控件在表头内,则返回-1
1412
1492
  * 如果控件在表内,则返回行下标
1413
1493
  * 如果控件不在明细表内,则返回undefined
1414
- * */ // public getInstanceRowIndex(
1415
- // instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl
1416
- // ) {
1417
- // if (!instance.parent) {
1418
- // return
1419
- // }
1420
- // let rowIndex: number | undefined
1421
- // // @ts-ignore
1422
- // if (this.assertInstance(instance.parent, CONTROL_TYPE.SUBTABLE)) {
1423
- // // 表头内的控件
1424
- // // @ts-ignore
1425
- // if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
1426
- // rowIndex = -1
1427
- // } else {
1428
- // // @ts-ignore
1429
- // // const index = instance.parent.children.findIndex(
1430
- // // (item: any) => item === instance
1431
- // // )
1432
- // let instances = this.runtime.instanceMap[instance.id] || []
1433
- // const index = instances.findIndex((item: any) => item === instance)
1434
- // if (index > -1) {
1435
- // rowIndex = index
1436
- // }
1437
- // }
1438
- // } else {
1439
- // rowIndex = this.getInstanceRowIndex(instance.parent)
1440
- // }
1441
- // return rowIndex
1442
- // }
1443
- function getInstanceRowIndex(instance) {
1494
+ * */ function getInstanceRowIndex(instance) {
1444
1495
  if (!instance.parent) {
1445
1496
  return;
1446
1497
  }
1447
1498
  var rowIndex;
1448
1499
  // @ts-ignore
1449
- if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
1450
- rowIndex = -1;
1451
- } else {
1452
- var isColumnChild = this.getInstanceParentControl(instance, // @ts-ignore
1453
- CONTROL_TYPE.SUBTABLE_COLUMN);
1454
- if (isColumnChild) {
1455
- var instanceList = this.runtime.instanceMap[instance.id];
1456
- if (Object.prototype.toString.call(instanceList) === '[object Array]') {
1457
- var index = instanceList.findIndex(function(item) {
1458
- return item === instance;
1459
- });
1460
- if (index > -1) {
1461
- rowIndex = index;
1462
- }
1500
+ if (this.assertInstance(instance.parent, CONTROL_TYPE.SUBTABLE)) {
1501
+ // 表头内的控件
1502
+ // @ts-ignore
1503
+ if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
1504
+ rowIndex = -1;
1505
+ } else {
1506
+ // @ts-ignore
1507
+ var index = instance.parent.children.findIndex(function(item) {
1508
+ return item === instance;
1509
+ });
1510
+ if (index > -1) {
1511
+ rowIndex = index;
1463
1512
  }
1464
1513
  }
1514
+ } else {
1515
+ rowIndex = this.getInstanceRowIndex(instance.parent);
1465
1516
  }
1466
1517
  return rowIndex;
1467
1518
  }
1468
1519
  },
1469
1520
  {
1470
1521
  key: "getInstanceParentControl",
1471
- value: function getInstanceParentControl(instance, controlType) {
1522
+ value: // public getInstanceRowIndex(
1523
+ // instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl
1524
+ // ) {
1525
+ // let rowIndex: number | undefined
1526
+ // // @ts-ignore
1527
+ // if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
1528
+ // rowIndex = -1
1529
+ // }else{
1530
+ // const instanceList = this.runtime.instanceMap[instance.id]
1531
+ // if(Object.prototype.toString.call(instanceList) === '[object Array]'){
1532
+ // const index = instanceList.findIndex(
1533
+ // (item: any) => item === instance
1534
+ // )
1535
+ // if (index > -1) {
1536
+ // rowIndex = index
1537
+ // }
1538
+ // }
1539
+ // }
1540
+ // return rowIndex
1541
+ // }
1542
+ function getInstanceParentControl(instance, controlType) {
1472
1543
  if (!instance.parent) {
1473
1544
  return;
1474
1545
  }
@@ -1516,8 +1587,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1516
1587
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
1517
1588
  args[_key] = arguments[_key];
1518
1589
  }
1519
- var _runtime;
1520
- return (_runtime = this.runtime).registerControlConfig.apply(_runtime, _toConsumableArray(args));
1590
+ var _this_runtime;
1591
+ return (_this_runtime = this.runtime).registerControlConfig.apply(_this_runtime, _to_consumable_array(args));
1521
1592
  }
1522
1593
  },
1523
1594
  {
@@ -1529,12 +1600,12 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1529
1600
  {
1530
1601
  key: "inList",
1531
1602
  value: function inList(controlId) {
1532
- var _controlIdMapping;
1533
- var mapping = (_controlIdMapping = this.store.controlIdMapping) !== null && _controlIdMapping !== void 0 ? _controlIdMapping : {};
1603
+ var _this_store_controlIdMapping;
1604
+ var mapping = (_this_store_controlIdMapping = this.store.controlIdMapping) !== null && _this_store_controlIdMapping !== void 0 ? _this_store_controlIdMapping : {};
1534
1605
  var listKey = undefined;
1535
1606
  Object.keys(mapping).some(function(key) {
1536
- var ref, ref21;
1537
- var matched = (ref = mapping[key]) === null || ref === void 0 ? void 0 : (ref21 = ref.children) === null || ref21 === void 0 ? void 0 : ref21.hasOwnProperty(controlId);
1607
+ var _mapping_key_children, _mapping_key;
1608
+ var matched = (_mapping_key = mapping[key]) === null || _mapping_key === void 0 ? void 0 : (_mapping_key_children = _mapping_key.children) === null || _mapping_key_children === void 0 ? void 0 : _mapping_key_children.hasOwnProperty(controlId);
1538
1609
  if (matched) {
1539
1610
  listKey = key;
1540
1611
  }
@@ -1547,8 +1618,12 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1547
1618
  {
1548
1619
  key: "register",
1549
1620
  value: // 注册外部控件
1550
- function register(control) {
1551
- return Runtime.register(control, 'Runtime');
1621
+ function register() {
1622
+ for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
1623
+ arg[_key] = arguments[_key];
1624
+ }
1625
+ var _Runtime;
1626
+ return (_Runtime = Runtime).register.apply(_Runtime, _to_consumable_array(arg));
1552
1627
  }
1553
1628
  },
1554
1629
  {
@@ -1560,5 +1635,4 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1560
1635
  ]);
1561
1636
  return Engine;
1562
1637
  }(Watcher);
1563
- // @ts-ignore
1564
1638
  export { Engine };