@byteluck-fe/model-driven-engine 2.7.0-alpha.13 → 2.7.0-alpha.14

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.
@@ -159,30 +159,6 @@ function _objectSpread(target) {
159
159
  }
160
160
  return target;
161
161
  }
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 _objectSpreadProps(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
162
  function _possibleConstructorReturn(self, call) {
187
163
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
188
164
  return call;
@@ -245,147 +221,44 @@ function _createSuper(Derived) {
245
221
  return _possibleConstructorReturn(this, result);
246
222
  };
247
223
  }
248
- var __generator = this && this.__generator || function(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: []
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
- }
342
- };
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 } 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") {
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') {
352
234
  // @ts-ignore
353
235
  window.engines = {};
354
236
  }
355
237
  // setState的时候,存储options中转变量
356
238
  var eventOptionsTemp = null;
357
239
  // 当前正在注册的插件名称
358
- var applyingPluginName = "";
359
- // 整体渲染引擎 并且 提供发布订阅能力
360
- var Engine = /*#__PURE__*/ function(Watcher) {
240
+ var applyingPluginName = '';
241
+ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
242
+ /*#__PURE__*/ function(Watcher1) {
361
243
  "use strict";
362
- _inherits(Engine, Watcher);
244
+ _inherits(Engine, Watcher1);
363
245
  var _super = _createSuper(Engine);
364
246
  function Engine(props) {
365
247
  _classCallCheck(this, Engine);
366
248
  var _this;
367
249
  _this = _super.call(this);
368
- _defineProperty(_assertThisInitialized(_this), "store", void 0);
369
- _defineProperty(_assertThisInitialized(_this), "rawStore", {});
370
- _defineProperty(_assertThisInitialized(_this), "parent", void 0);
371
- // 提供注册运行态控件以及实例化控件的能力
372
- _defineProperty(_assertThisInitialized(_this), "runtime", void 0);
250
+ _this.rawStore = {};
373
251
  // 提供子线程处理脚本以及修改数据的能力
374
252
  // public worker: OkWorker
375
- _defineProperty(_assertThisInitialized(_this), "isMounted", false);
376
- _defineProperty(_assertThisInitialized(_this), "id", genNonDuplicateId(8));
377
- _defineProperty(_assertThisInitialized(_this), "externalParams", void 0);
378
- // 提供外部注册插件,在不同的hooks触发时执行固定函数的能力
379
- _defineProperty(_assertThisInitialized(_this), "__plugins", void 0);
380
- _defineProperty(_assertThisInitialized(_this), "__pluginsApplied", false);
381
- _defineProperty(_assertThisInitialized(_this), "$options", void 0);
382
- _defineProperty(_assertThisInitialized(_this), "actionManager", new ActionManager());
383
- _defineProperty(_assertThisInitialized(_this), "dataManager", void 0);
384
- _defineProperty(_assertThisInitialized(_this), "_jobTasks", []);
385
- _defineProperty(_assertThisInitialized(_this), "createControlInstance", _this.createInstance);
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;
386
259
  _this.$options = Object.freeze(props);
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;
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;
389
262
  RulesMessage.setLocale(language);
390
263
  _this.debug = debug;
391
264
  _this.runtime = new Runtime({
@@ -396,7 +269,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
396
269
  _this.store = new Store({
397
270
  instance: _this.runtime.instance
398
271
  });
399
- _this.debugLog("engine is Instantiation complete");
272
+ _this.debugLog('engine is Instantiation complete');
400
273
  // 自动执行挂载完成,也可以手动调用mount方法
401
274
  autoMount && _this.mount();
402
275
  return _this;
@@ -427,8 +300,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
427
300
  for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
428
301
  arg[_key] = arguments[_key];
429
302
  }
430
- var _this_runtime;
431
- (_this_runtime = this.runtime).register.apply(_this_runtime, _toConsumableArray(arg));
303
+ var _runtime;
304
+ (_runtime = this.runtime).register.apply(_runtime, _toConsumableArray(arg));
432
305
  return this;
433
306
  }
434
307
  },
@@ -436,14 +309,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
436
309
  key: "mount",
437
310
  value: function mount() {
438
311
  this.debugLog("engine的mount方法开始调用");
439
- var _this_$options = this.$options, _this_$options_plugins = _this_$options.plugins, plugins = _this_$options_plugins === void 0 ? [] : _this_$options_plugins;
312
+ var _$options = this.$options, _plugins = _$options.plugins, plugins = _plugins === void 0 ? [] : _plugins;
440
313
  this._handlerProxyState();
441
314
  this.__plugins = plugins;
442
315
  this.applyPlugins();
443
316
  // 触发所有控件的默认值的change事件
444
317
  this.setStates(this.getState());
445
318
  this.debugLog("engine的mount方法调用结束");
446
- if (this.debug && typeof window !== "undefined") {
319
+ if (this.debug && typeof window !== 'undefined') {
447
320
  // @ts-ignore
448
321
  window.engines[this.id] = this;
449
322
  }
@@ -452,7 +325,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
452
325
  {
453
326
  key: "destroy",
454
327
  value: function destroy() {
455
- if (this.debug && typeof window !== "undefined") {
328
+ if (this.debug && typeof window !== 'undefined') {
456
329
  // @ts-ignore
457
330
  delete window.engines[this.id];
458
331
  }
@@ -474,6 +347,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
474
347
  }
475
348
  // @ts-ignore
476
349
  if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE)) {
350
+ var ref;
477
351
  if (newValue === null) {
478
352
  return [];
479
353
  }
@@ -488,12 +362,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
488
362
  }, {});
489
363
  // @ts-ignore
490
364
  var emptyState = this.getEmptyState(instance.id);
491
- return newValue === null || newValue === void 0 ? void 0 : newValue.map(function(row) {
492
- return(// @ts-ignore
493
- checkerSubtableValue(fieldTypeMap, row, emptyState));
365
+ return (ref = newValue) === null || ref === void 0 ? void 0 : ref.map(function(row) {
366
+ // @ts-ignore
367
+ return checkerSubtableValue(fieldTypeMap, row, emptyState);
494
368
  });
495
369
  }
496
- var keys = key.split(".");
370
+ var keys = key.split('.');
497
371
  var lastKey = keys[keys.length - 1];
498
372
  try {
499
373
  return checkerValue(instance.fieldType, lastKey, newValue, oldValue);
@@ -526,7 +400,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
526
400
  var newRows = [];
527
401
  for(var i = 0; i < len; i++){
528
402
  // @ts-ignore
529
- var row = _this.listControlCreateRow(subtable, "subtable-row");
403
+ var row = _this.listControlCreateRow(subtable, 'subtable-row');
530
404
  row && newRows.push(row);
531
405
  }
532
406
  // @ts-ignore
@@ -537,22 +411,23 @@ var Engine = /*#__PURE__*/ function(Watcher) {
537
411
  var createdNewRows = [];
538
412
  var createdNewRowsData = [];
539
413
  var deleted = [];
414
+ var isDeleteLastOne = false;
540
415
  if (type && args) {
541
416
  // const subtableOldLength = subtable.children.length
542
417
  switch(type){
543
- case "push":
544
- case "unshift":
545
- var _subtable_children;
418
+ case 'push':
419
+ case 'unshift':
420
+ var _children;
546
421
  var newRowLengths = args.length;
547
422
  createdNewRows = createRows(newRowLengths);
548
423
  createdNewRowsData = args;
549
- (_subtable_children = subtable.children)[type].apply(_subtable_children, _toConsumableArray(createdNewRows));
424
+ (_children = subtable.children)[type].apply(_children, _toConsumableArray(createdNewRows));
550
425
  this.runtime.getFlatInstances();
551
426
  break;
552
- case "splice":
427
+ case 'splice':
553
428
  if (args.length > 2) {
554
429
  var // @ts-ignore
555
- _subtable_children1;
430
+ _children1;
556
431
  var newRowLengths1 = args.length - 2;
557
432
  var newValues = args.slice(2);
558
433
  createdNewRows = createRows(newRowLengths1);
@@ -561,7 +436,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
561
436
  var start = args[0];
562
437
  // 替换几个
563
438
  var replace = args[1];
564
- (_subtable_children1 = subtable.children)[type].apply(_subtable_children1, [
439
+ (_children1 = subtable.children)[type].apply(_children1, [
565
440
  start,
566
441
  replace
567
442
  ].concat(_toConsumableArray(createdNewRows)));
@@ -572,36 +447,44 @@ var Engine = /*#__PURE__*/ function(Watcher) {
572
447
  // })
573
448
  } else {
574
449
  var // @ts-ignore
575
- _subtable_children2;
576
- (_subtable_children2 = subtable.children)[type].apply(_subtable_children2, _toConsumableArray(args));
450
+ _children2;
451
+ // 从哪儿开始
452
+ var start1 = args[0];
453
+ // 替换几个
454
+ var replace1 = args[1];
455
+ if (start1 + replace1 === subtable.children.length - 1) {
456
+ isDeleteLastOne = true;
457
+ }
458
+ (_children2 = subtable.children)[type].apply(_children2, _toConsumableArray(args));
577
459
  this.runtime.getFlatInstances();
578
460
  }
579
461
  break;
580
462
  default:
581
463
  var // @ts-ignore
582
- _subtable_children3;
583
- (_subtable_children3 = subtable.children)[type].apply(_subtable_children3, _toConsumableArray(args));
464
+ _children3;
465
+ (_children3 = subtable.children)[type].apply(_children3, _toConsumableArray(args));
584
466
  this.runtime.getFlatInstances();
585
467
  break;
586
468
  }
587
- if (type === "splice") {
469
+ if (type === 'splice') {
588
470
  deleted = result;
589
471
  } else if ([
590
- "pop",
591
- "shift"
472
+ 'pop',
473
+ 'shift'
592
474
  ].includes(type)) {
593
475
  deleted = [
594
476
  result
595
477
  ];
596
478
  }
597
- this.emit("list-change", {
479
+ this.emit('list-change', {
598
480
  instance: subtable,
599
481
  value: this.getState(subtable.id),
600
482
  options: Object.assign({}, options, {
601
483
  changed: createdNewRows,
602
484
  data: createdNewRowsData,
603
485
  deleted: deleted !== null && deleted !== void 0 ? deleted : [],
604
- jsonValue: JSON.stringify(this.getState(subtable.id))
486
+ jsonValue: JSON.stringify(this.getState(subtable.id)),
487
+ isDeleteLastOne: isDeleteLastOne
605
488
  })
606
489
  });
607
490
  // 主动清空本次任务中的options
@@ -621,26 +504,26 @@ var Engine = /*#__PURE__*/ function(Watcher) {
621
504
  // if (instance instanceof RuntimeListControl) {
622
505
  if (instance.controlType === CONTROL_BASE_TYPE.LIST) {
623
506
  var // @ts-ignore
624
- _instance_children;
507
+ _children;
625
508
  instance.children.length = 0;
626
509
  var newValue = value;
627
510
  // @ts-ignore
628
511
  var newRows = [];
629
512
  for(var i = 0; i < newValue.length; i++){
630
513
  // @ts-ignore
631
- var row = this.listControlCreateRow(instance, "subtable-row");
514
+ var row = this.listControlCreateRow(instance, 'subtable-row');
632
515
  row && newRows.push(row);
633
516
  }
634
- (_instance_children = instance.children).push.apply(_instance_children, _toConsumableArray(newRows));
517
+ (_children = instance.children).push.apply(_children, _toConsumableArray(newRows));
635
518
  this.runtime.getFlatInstances();
636
519
  // 这里已经能拿到控件实例,所以在这里触发setStates,触发每一行每一个控件的change事件
637
520
  // for (let i = 0; i < newValue.length; i++) {
638
521
  // this.setStates(newValue[i], i, options)
639
522
  // }
640
- this.emit("list-change", {
523
+ this.emit('list-change', {
641
524
  instance: instance,
642
525
  value: value,
643
- options: _objectSpreadProps(_objectSpread({}, options), {
526
+ options: _objectSpread({}, options, {
644
527
  // @ts-ignore
645
528
  changed: newRows,
646
529
  data: newValue,
@@ -648,11 +531,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
648
531
  })
649
532
  });
650
533
  } else {
651
- this.emit("change", {
534
+ this.emit('change', {
652
535
  instance: instance,
653
536
  value: this.getState(instance.id, index),
654
537
  rowIndex: index,
655
- options: _objectSpreadProps(_objectSpread({}, options), {
538
+ options: _objectSpread({}, options, {
656
539
  oldValue: oldValue
657
540
  })
658
541
  });
@@ -666,13 +549,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
666
549
  if (this.__pluginsApplied) return;
667
550
  this.__plugins.forEach(function(plugin) {
668
551
  try {
669
- var _plugin_pluginName;
670
- applyingPluginName = (_plugin_pluginName = plugin.pluginName) !== null && _plugin_pluginName !== void 0 ? _plugin_pluginName : plugin.constructor.name;
552
+ var _pluginName;
553
+ applyingPluginName = (_pluginName = plugin.pluginName) !== null && _pluginName !== void 0 ? _pluginName : plugin.constructor.name;
671
554
  plugin.apply(_this);
672
555
  } catch (e) {
673
556
  error("".concat(applyingPluginName, " Plugin apply Error \n ").concat(e));
674
557
  } finally{
675
- applyingPluginName = "";
558
+ applyingPluginName = '';
676
559
  }
677
560
  });
678
561
  this.__pluginsApplied = true;
@@ -686,12 +569,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
686
569
  // if (row instanceof RuntimeLayoutControl) {
687
570
  // @ts-ignore
688
571
  if (row.controlType === CONTROL_BASE_TYPE.LAYOUT) {
689
- var _inst_children;
572
+ var _children;
690
573
  var inst = row;
691
574
  var template = JSONCopy(instance.props.headers);
692
575
  // @ts-ignore
693
576
  var columns = this.createControl(template);
694
- (_inst_children = inst.children).push.apply(_inst_children, _toConsumableArray(columns));
577
+ (_children = inst.children).push.apply(_children, _toConsumableArray(columns));
695
578
  }
696
579
  return row;
697
580
  }
@@ -700,7 +583,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
700
583
  key: "listControlAddRow",
701
584
  value: function listControlAddRow(instance) {
702
585
  var // @ts-ignore
703
- rowType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "subtable-row";
586
+ rowType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'subtable-row';
704
587
  var row = this.listControlCreateRow(instance, rowType);
705
588
  if (!row) return;
706
589
  instance.children.push(row);
@@ -714,40 +597,37 @@ var Engine = /*#__PURE__*/ function(Watcher) {
714
597
  var _this1 = this, _superprop_get_emit = function() {
715
598
  return _get(_getPrototypeOf(Engine.prototype), "emit", _this);
716
599
  };
717
- return _asyncToGenerator(function() {
600
+ return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
718
601
  var needWait, promiseResolver, promise, results;
719
- return __generator(this, function(_state) {
720
- switch(_state.label){
602
+ return regeneratorRuntime.wrap(function _callee$(_ctx) {
603
+ while(1)switch(_ctx.prev = _ctx.next){
721
604
  case 0:
722
- if (!(eventKey === "engine-mounted")) return [
723
- 3,
724
- 3
725
- ];
726
- if (_this1.isMounted) {
727
- warn("The engine-mounted life cycle can only be triggered once");
728
- return [
729
- 2,
730
- Promise.resolve([])
731
- ];
605
+ if (!(eventKey === 'engine-mounted')) {
606
+ _ctx.next = 11;
607
+ break;
732
608
  }
733
- if (!_this1._jobTasks.length) return [
734
- 3,
735
- 2
736
- ];
737
- console.time("engine-mounted need wait");
609
+ if (!_this1.isMounted) {
610
+ _ctx.next = 4;
611
+ break;
612
+ }
613
+ warn('The engine-mounted life cycle can only be triggered once');
614
+ return _ctx.abrupt("return", Promise.resolve([]));
615
+ case 4:
616
+ if (!_this1._jobTasks.length) {
617
+ _ctx.next = 10;
618
+ break;
619
+ }
620
+ console.time('engine-mounted need wait');
738
621
  needWait = _toConsumableArray(_this1._jobTasks);
739
- return [
740
- 4,
741
- Promise.all(needWait)
742
- ];
743
- case 1:
744
- _state.sent();
745
- console.timeEnd("engine-mounted need wait");
746
- _state.label = 2;
747
- case 2:
622
+ _ctx.next = 9;
623
+ return Promise.all(needWait);
624
+ case 9:
625
+ console.timeEnd('engine-mounted need wait');
626
+ case 10:
748
627
  _this1.isMounted = true;
749
- _state.label = 3;
750
- case 3:
628
+ case 11:
629
+ ;
630
+ ;
751
631
  // 如果没有挂载的话,需要记录在挂载之前触发的所有任务
752
632
  if (!_this1.isMounted) {
753
633
  promise = new Promise(function(resolve) {
@@ -755,24 +635,22 @@ var Engine = /*#__PURE__*/ function(Watcher) {
755
635
  });
756
636
  _this1._jobTasks.push(promise);
757
637
  }
758
- return [
759
- 4,
760
- _superprop_get_emit().call(_this1, eventKey, payload)
761
- ];
762
- case 4:
763
- results = _state.sent();
638
+ _ctx.next = 16;
639
+ return _superprop_get_emit().call(_this1, eventKey, payload);
640
+ case 16:
641
+ results = _ctx.sent;
764
642
  if (promiseResolver && promise) {
765
643
  // 每一个任务完成的时候,都把自己从task中去掉
766
644
  promiseResolver();
767
645
  _this1._jobTasks.splice(_this1._jobTasks.indexOf(promise), 1);
768
646
  }
769
- return [
770
- 2,
771
- results
772
- ];
647
+ return _ctx.abrupt("return", results);
648
+ case 19:
649
+ case "end":
650
+ return _ctx.stop();
773
651
  }
774
- });
775
- })();
652
+ }, _callee);
653
+ }))();
776
654
  }
777
655
  },
778
656
  {
@@ -790,8 +668,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
790
668
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
791
669
  args[_key] = arguments[_key];
792
670
  }
793
- var _this_runtime;
794
- return (_this_runtime = this.runtime).createControl.apply(_this_runtime, _toConsumableArray(args));
671
+ var _runtime;
672
+ return (_runtime = this.runtime).createControl.apply(_runtime, _toConsumableArray(args));
795
673
  }
796
674
  },
797
675
  {
@@ -819,10 +697,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
819
697
  if (controlId === undefined) {
820
698
  return rules;
821
699
  } else {
822
- var _rules_rules_controlId, _rules_antdRules_controlId;
700
+ var ref, ref1;
823
701
  return {
824
- rules: (_rules_rules_controlId = rules.rules[controlId]) === null || _rules_rules_controlId === void 0 ? void 0 : _rules_rules_controlId.fields,
825
- antdRules: (_rules_antdRules_controlId = rules.antdRules[controlId]) === null || _rules_antdRules_controlId === void 0 ? void 0 : _rules_antdRules_controlId.fields
702
+ rules: (ref = rules.rules[controlId]) === null || ref === void 0 ? void 0 : ref.fields,
703
+ antdRules: (ref1 = rules.antdRules[controlId]) === null || ref1 === void 0 ? void 0 : ref1.fields
826
704
  };
827
705
  }
828
706
  }
@@ -833,8 +711,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
833
711
  if (controlId === undefined) {
834
712
  return this.runtime.rules;
835
713
  } else {
836
- var _this_runtime_rules_controlId;
837
- return (_this_runtime_rules_controlId = this.runtime.rules[controlId]) === null || _this_runtime_rules_controlId === void 0 ? void 0 : _this_runtime_rules_controlId.fields;
714
+ var ref;
715
+ return (ref = this.runtime.rules[controlId]) === null || ref === void 0 ? void 0 : ref.fields;
838
716
  }
839
717
  }
840
718
  },
@@ -844,8 +722,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
844
722
  if (controlId === undefined) {
845
723
  return this.runtime.antdRules;
846
724
  } else {
847
- var _this_runtime_antdRules_controlId;
848
- return (_this_runtime_antdRules_controlId = this.runtime.antdRules[controlId]) === null || _this_runtime_antdRules_controlId === void 0 ? void 0 : _this_runtime_antdRules_controlId.fields;
725
+ var ref;
726
+ return (ref = this.runtime.antdRules[controlId]) === null || ref === void 0 ? void 0 : ref.fields;
849
727
  }
850
728
  }
851
729
  },
@@ -882,9 +760,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
882
760
  key: "setState",
883
761
  value: function setState(controlId, value, rowIndex, options) {
884
762
  eventOptionsTemp = options;
885
- this.debugLog("[%o]: 触发setState, 修改的值为%o, rowIndex=%o, options=%o", controlId, value, rowIndex, options);
763
+ this.debugLog('[%o]: 触发setState, 修改的值为%o, rowIndex=%o, options=%o', controlId, value, rowIndex, options);
886
764
  this.store.setState(controlId, value, rowIndex);
887
- this.debugLog("[%o]: setState完成, 修改的值为%o, rowIndex=%o", controlId, value, rowIndex);
765
+ this.debugLog('[%o]: setState完成, 修改的值为%o, rowIndex=%o', controlId, value, rowIndex);
888
766
  eventOptionsTemp = null;
889
767
  }
890
768
  },
@@ -897,19 +775,20 @@ var Engine = /*#__PURE__*/ function(Watcher) {
897
775
  var _this = this;
898
776
  var newStates = states !== null && states !== void 0 ? states : {};
899
777
  Object.keys(newStates).forEach(function(stateId) {
778
+ var _this2 = _this;
900
779
  Object.entries(_this.store.controlIdMapping).forEach(function(param) {
901
780
  var _param = _slicedToArray(param, 2), controlId = _param[0], controlIdMapping = _param[1];
902
781
  if (controlIdMapping.dataView === stateId) {
903
782
  // state对象是dataView包裹的
904
783
  var value = newStates[stateId][controlId];
905
784
  if (value !== undefined) {
906
- _this.setState(controlId, value, rowIndex, options);
785
+ _this2.setState(controlId, value, rowIndex, options);
907
786
  }
908
787
  } else {
909
788
  // state对象是单独的,没有被dataView包裹的
910
789
  if (controlId === stateId || controlIdMapping.children && controlIdMapping.children[stateId]) {
911
790
  if (newStates[stateId] !== undefined) {
912
- _this.setState(stateId, newStates[stateId], rowIndex, options);
791
+ _this2.setState(stateId, newStates[stateId], rowIndex, options);
913
792
  }
914
793
  }
915
794
  }
@@ -937,11 +816,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
937
816
  if (!dataBindMapping1) {
938
817
  return;
939
818
  }
940
- var dataBind = dataBindMapping1.dataBind, controlId1 = dataBindMapping1.controlId;
819
+ var dataBind1 = dataBindMapping1.dataBind, controlId1 = dataBindMapping1.controlId;
941
820
  var state = this.getState(controlId1, rowIndex);
942
821
  //if (dataBind instanceof ObjectDataBind) {
943
- if (!isDataBind(dataBind)) {
944
- return Object.entries(dataBind).reduce(function(result, param) {
822
+ if (!isDataBind(dataBind1)) {
823
+ return Object.entries(dataBind1).reduce(function(result, param) {
945
824
  var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
946
825
  // objectDataBind的元素,跳过下一次赋值
947
826
  if (dataBind.fieldCode === fieldCode) {
@@ -968,18 +847,18 @@ var Engine = /*#__PURE__*/ function(Watcher) {
968
847
  var data = getFieldData.map(function(item) {
969
848
  var obj = {};
970
849
  for(var key in item){
971
- var _controlIdMapping_controlId_children_key, _controlIdMapping_controlId, _controlIdMapping_controlId_children_key_dataBind;
972
- var fieldCode = (_controlIdMapping_controlId_children_key = (_controlIdMapping_controlId = controlIdMapping[controlId]) === null || _controlIdMapping_controlId === void 0 ? void 0 : _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;
850
+ var ref, ref2, ref3;
851
+ 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;
973
852
  //未绑定字段的控件,直接抛弃
974
- if (fieldCode !== "") {
975
- var _controlIdMapping_controlId1;
853
+ if (fieldCode !== '') {
854
+ var ref4;
976
855
  if (fieldCode) {
977
856
  obj[fieldCode] = item[key];
978
- } else if ((_controlIdMapping_controlId1 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId1 === void 0 ? void 0 : _controlIdMapping_controlId1.children[key]) {
857
+ } else if ((ref4 = controlIdMapping[controlId]) === null || ref4 === void 0 ? void 0 : ref4.children[key]) {
979
858
  // 兼容一个控件需要绑定多个字段的情况
980
859
  for(var keyChi in item[key]){
981
- var _controlIdMapping_controlId_children_key1, _controlIdMapping_controlId2;
982
- obj[(_controlIdMapping_controlId_children_key1 = (_controlIdMapping_controlId2 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId2 === void 0 ? void 0 : _controlIdMapping_controlId2.children[key]) === null || _controlIdMapping_controlId_children_key1 === void 0 ? void 0 : _controlIdMapping_controlId_children_key1.dataBind[keyChi].fieldCode] = item[key][keyChi];
860
+ var ref5, ref6;
861
+ 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];
983
862
  }
984
863
  }
985
864
  }
@@ -988,45 +867,45 @@ var Engine = /*#__PURE__*/ function(Watcher) {
988
867
  });
989
868
  return data;
990
869
  } else {
991
- var _loop = function(key) {
992
- var _controlIdMapping_key, _controlIdMapping_key_dataBind, _controlIdMapping_key1, _controlIdMapping_key_dataBind1;
993
- 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) {
994
- var _controlIdMapping_key2;
995
- obj[(_controlIdMapping_key2 = controlIdMapping[key]) === null || _controlIdMapping_key2 === void 0 ? void 0 : _controlIdMapping_key2.dataBind.fieldCode] = getFieldData[key];
996
- } 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) {
997
- var _controlIdMapping_key3;
870
+ var _loop = function(key1) {
871
+ var ref15, ref7, ref8, ref9;
872
+ if ((ref15 = controlIdMapping[key1]) === null || ref15 === void 0 ? void 0 : (ref7 = ref15.dataBind) === null || ref7 === void 0 ? void 0 : ref7.fieldCode) {
873
+ var ref10;
874
+ obj1[(ref10 = controlIdMapping[key1]) === null || ref10 === void 0 ? void 0 : ref10.dataBind.fieldCode] = getFieldData[key1];
875
+ } else if ((ref8 = controlIdMapping[key1]) === null || ref8 === void 0 ? void 0 : (ref9 = ref8.dataBind) === null || ref9 === void 0 ? void 0 : ref9.dataCode) {
876
+ var ref11;
998
877
  // 明细字表只循环一层明细子表未递归
999
- obj[(_controlIdMapping_key3 = controlIdMapping[key]) === null || _controlIdMapping_key3 === void 0 ? void 0 : _controlIdMapping_key3.dataBind.dataCode] = getFieldData[key].map(function(item) {
878
+ obj1[(ref11 = controlIdMapping[key1]) === null || ref11 === void 0 ? void 0 : ref11.dataBind.dataCode] = getFieldData[key1].map(function(item) {
1000
879
  var objChi = {};
1001
880
  for(var keyChi in item){
1002
- var _controlIdMapping_key_children_keyChi;
1003
- 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;
881
+ var ref;
882
+ var fieldCode = (ref = controlIdMapping[key1].children[keyChi]) === null || ref === void 0 ? void 0 : ref.dataBind.fieldCode;
1004
883
  //未绑定字段的控件,直接抛弃
1005
- if (fieldCode !== "") {
884
+ if (fieldCode !== '') {
1006
885
  if (fieldCode) {
1007
886
  objChi[fieldCode] = item[keyChi];
1008
887
  } else {
1009
888
  for(var keyChi1 in item[keyChi]){
1010
- var _controlIdMapping_key_children_keyChi1;
1011
- 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];
889
+ var ref14;
890
+ objChi[(ref14 = controlIdMapping[key1].children[keyChi]) === null || ref14 === void 0 ? void 0 : ref14.dataBind[keyChi1].fieldCode] = item[keyChi][keyChi1];
1012
891
  }
1013
892
  }
1014
893
  }
1015
894
  }
1016
895
  return objChi;
1017
896
  });
1018
- } else if (controlIdMapping[key]) {
897
+ } else if (controlIdMapping[key1]) {
1019
898
  // 兼容一个控件需要绑定多个字段的情况
1020
- for(var keyChi in getFieldData[key]){
1021
- var _controlIdMapping_key_dataBind_keyChi, _controlIdMapping_key4;
1022
- obj[(_controlIdMapping_key_dataBind_keyChi = (_controlIdMapping_key4 = controlIdMapping[key]) === null || _controlIdMapping_key4 === void 0 ? void 0 : _controlIdMapping_key4.dataBind[keyChi]) === null || _controlIdMapping_key_dataBind_keyChi === void 0 ? void 0 : _controlIdMapping_key_dataBind_keyChi.fieldCode] = getFieldData[key][keyChi];
899
+ for(var keyChi2 in getFieldData[key1]){
900
+ var ref12, ref13;
901
+ 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];
1023
902
  }
1024
903
  }
1025
904
  };
1026
905
  // 主表
1027
- var obj = {};
1028
- for(var key in getFieldData)_loop(key);
1029
- return obj;
906
+ var obj1 = {};
907
+ for(var key1 in getFieldData)_loop(key1);
908
+ return obj1;
1030
909
  }
1031
910
  }
1032
911
  return;
@@ -1046,13 +925,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1046
925
  if (!dataBindMapping) {
1047
926
  return;
1048
927
  }
1049
- var dataBind = dataBindMapping.dataBind, controlId = dataBindMapping.controlId;
928
+ var dataBind2 = dataBindMapping.dataBind, controlId = dataBindMapping.controlId;
1050
929
  // if (dataBind instanceof ObjectDataBind) {
1051
- if (!isDataBind(dataBind)) {
1052
- var _JSONCopy;
1053
- var oldState = (_JSONCopy = JSONCopy(this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : this.getEmptyState(controlId);
930
+ if (!isDataBind(dataBind2)) {
931
+ var ref;
932
+ var oldState = (ref = JSONCopy(this.getState(controlId, rowIndex))) !== null && ref !== void 0 ? ref : this.getEmptyState(controlId);
1054
933
  // fieldCode不代表是key,所以需要找到对应的key
1055
- var newState = Object.entries(dataBind).reduce(function(result, param) {
934
+ var newState = Object.entries(dataBind2).reduce(function(result, param) {
1056
935
  var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
1057
936
  // objectDataBind的元素,跳过下一次赋值
1058
937
  if (dataBind.fieldCode === fieldCode) {
@@ -1082,7 +961,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1082
961
  }
1083
962
  var skipKeys = [];
1084
963
  mapping.fields.forEach(function(item) {
1085
- var dataBind = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
964
+ var dataBind3 = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
1086
965
  if (skipKeys.includes(fieldCode)) {
1087
966
  return;
1088
967
  }
@@ -1091,11 +970,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1091
970
  }
1092
971
  // 对象类型的值
1093
972
  // if (dataBind instanceof ObjectDataBind) {
1094
- if (!isDataBind(dataBind)) {
1095
- var _JSONCopy;
1096
- var oldState = (_JSONCopy = JSONCopy(_this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : _this.getEmptyState(controlId);
973
+ if (!isDataBind(dataBind3)) {
974
+ var ref;
975
+ var oldState = (ref = JSONCopy(_this.getState(controlId, rowIndex))) !== null && ref !== void 0 ? ref : _this.getEmptyState(controlId);
1097
976
  // fieldCode不代表是key,所以需要找到对应的key
1098
- var newState = Object.entries(dataBind).reduce(function(result, param) {
977
+ var newState = Object.entries(dataBind3).reduce(function(result, param) {
1099
978
  var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
1100
979
  // objectDataBind的元素,跳过下一次赋值
1101
980
  skipKeys.push(dataBind.fieldCode);
@@ -1125,9 +1004,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1125
1004
  return;
1126
1005
  }
1127
1006
  var skipKeys = [];
1128
- var result = {};
1007
+ var result1 = {};
1129
1008
  mapping.fields.forEach(function(item) {
1130
- var dataBind = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
1009
+ var dataBind4 = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
1131
1010
  if (skipKeys.includes(fieldCode)) {
1132
1011
  return;
1133
1012
  }
@@ -1136,10 +1015,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1136
1015
  }
1137
1016
  // 对象类型的值
1138
1017
  // if (dataBind instanceof ObjectDataBind) {
1139
- if (!isDataBind(dataBind)) {
1018
+ if (!isDataBind(dataBind4)) {
1140
1019
  var oldState = _this.getEmptyState(controlId);
1141
1020
  // fieldCode不代表是key,所以需要找到对应的key
1142
- result[item.controlId] = Object.entries(dataBind).reduce(function(result, param) {
1021
+ result1[item.controlId] = Object.entries(dataBind4).reduce(function(result, param) {
1143
1022
  var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
1144
1023
  // objectDataBind的元素,跳过下一次赋值
1145
1024
  skipKeys.push(dataBind.fieldCode);
@@ -1150,10 +1029,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1150
1029
  return result;
1151
1030
  }, oldState);
1152
1031
  } else {
1153
- result[controlId] = state[fieldCode];
1032
+ result1[controlId] = state[fieldCode];
1154
1033
  }
1155
1034
  });
1156
- return result;
1035
+ return result1;
1157
1036
  }
1158
1037
  },
1159
1038
  {
@@ -1163,13 +1042,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1163
1042
  * @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
1164
1043
  */ key: "setData",
1165
1044
  value: function setData(dataSet, options) {
1166
- var _this = this;
1045
+ var _this6 = this;
1167
1046
  this.debugLog("engine setData方法执行,参数为%o,%o。", dataSet, options);
1168
1047
  var newState = this.store.defaultState;
1169
1048
  Object.keys(dataSet).map(function(dataCode) {
1170
1049
  var entity = dataSet[dataCode];
1171
1050
  if (Array.isArray(entity)) {
1172
- var mapping = _this.getDataBindMapping(dataCode);
1051
+ var _this4 = _this6;
1052
+ var mapping = _this6.getDataBindMapping(dataCode);
1173
1053
  if (!mapping) {
1174
1054
  return;
1175
1055
  }
@@ -1177,21 +1057,22 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1177
1057
  newState[mapping.dataViewId] = {};
1178
1058
  }
1179
1059
  if (!entity.length) {
1180
- var _newState_mapping_dataViewId_mapping_controlId;
1181
- 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 : [];
1060
+ var _controlId;
1061
+ newState[mapping.dataViewId][mapping.controlId] = (_controlId = newState[mapping.dataViewId][mapping.controlId]) !== null && _controlId !== void 0 ? _controlId : [];
1182
1062
  } else {
1183
1063
  newState[mapping.dataViewId][mapping.controlId] = [];
1184
1064
  }
1185
1065
  entity.map(function(row) {
1186
- var newRow = JSONCopy(_this.store.emptyState[mapping.dataViewId][mapping.controlId]);
1066
+ var _this = _this4;
1067
+ var newRow = JSONCopy(_this4.store.emptyState[mapping.dataViewId][mapping.controlId]);
1187
1068
  var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1188
1069
  ;
1189
1070
  Object.keys(row).map(function(fieldCode) {
1190
- var _this_store_dataBindMapping_dataCode, _this_store_dataBindMapping_dataCode_fields;
1071
+ var ref, ref18;
1191
1072
  if (skipKey.includes(fieldCode)) {
1192
1073
  return;
1193
1074
  }
1194
- 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) {
1075
+ 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) {
1195
1076
  return i.fieldCode === fieldCode;
1196
1077
  });
1197
1078
  if (fieldMapping) {
@@ -1200,8 +1081,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1200
1081
  newRow[fieldMapping.controlId] = row[fieldCode];
1201
1082
  // } else if (fieldMapping.dataBind instanceof ObjectDataBind) {
1202
1083
  } else if (!isDataBind(fieldMapping.dataBind)) {
1203
- var _this_getEmptyState;
1204
- var objValue = JSONCopy((_this_getEmptyState = _this.getEmptyState(fieldMapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {});
1084
+ var ref19;
1085
+ var objValue = JSONCopy((ref19 = _this.getEmptyState(fieldMapping.controlId)) !== null && ref19 !== void 0 ? ref19 : {});
1205
1086
  Object.keys(fieldMapping.dataBind).map(function(key) {
1206
1087
  var dataBind = fieldMapping.dataBind[key];
1207
1088
  if (row[dataBind.fieldCode] !== undefined) {
@@ -1216,18 +1097,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1216
1097
  newState[mapping.dataViewId][mapping.controlId].push(newRow);
1217
1098
  });
1218
1099
  } else if (entity) {
1219
- var _Object_keys;
1220
- var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1100
+ var ref20;
1101
+ var skipKey1 = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1221
1102
  ;
1222
- var emptyState = JSONCopy(_this.store.emptyState);
1223
- if (!((_Object_keys = Object.keys(entity)) === null || _Object_keys === void 0 ? void 0 : _Object_keys.length)) {
1103
+ var emptyState = JSONCopy(_this6.store.emptyState);
1104
+ if (!((ref20 = Object.keys(entity)) === null || ref20 === void 0 ? void 0 : ref20.length)) {
1224
1105
  // newState = this.store.defaultState
1225
1106
  } else {
1107
+ var _this3 = _this6;
1226
1108
  Object.keys(entity).map(function(fieldCode) {
1227
- if (skipKey.includes(fieldCode)) {
1109
+ if (skipKey1.includes(fieldCode)) {
1228
1110
  return;
1229
1111
  }
1230
- var mapping = _this.getDataBindMapping(dataCode, fieldCode);
1112
+ var mapping = _this3.getDataBindMapping(dataCode, fieldCode);
1231
1113
  if (mapping) {
1232
1114
  if (!newState[mapping.dataViewId[0]]) {
1233
1115
  newState[mapping.dataViewId[0]] = {};
@@ -1237,31 +1119,31 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1237
1119
  newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode] !== undefined ? entity[fieldCode] : emptyState[mapping.dataViewId[0]][mapping.controlId];
1238
1120
  // } else if (mapping.dataBind instanceof ObjectDataBind) {
1239
1121
  } else if (!isDataBind(mapping.dataBind)) {
1240
- var _this_getEmptyState;
1241
- var objValue = (_this_getEmptyState = _this.getEmptyState(mapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {};
1122
+ var ref;
1123
+ var objValue = (ref = _this3.getEmptyState(mapping.controlId)) !== null && ref !== void 0 ? ref : {};
1242
1124
  Object.keys(mapping.dataBind).map(function(key) {
1243
1125
  var dataBind = mapping.dataBind[key];
1244
1126
  if (entity[dataBind.fieldCode] !== undefined) {
1245
1127
  objValue[key] = entity[dataBind.fieldCode];
1246
1128
  }
1247
- skipKey.push(dataBind.fieldCode);
1129
+ skipKey1.push(dataBind.fieldCode);
1248
1130
  });
1249
1131
  newState[mapping.dataViewId[0]][mapping.controlId] = objValue;
1250
1132
  }
1251
1133
  }
1252
1134
  });
1253
1135
  }
1254
- var newMapping = _this.getDataBindMapping(dataCode);
1136
+ var newMapping = _this6.getDataBindMapping(dataCode);
1255
1137
  if (newMapping) {
1256
- var _newMapping_fields;
1257
- 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) {
1138
+ var ref16;
1139
+ var mappingKeys = newMapping === null || newMapping === void 0 ? void 0 : (ref16 = newMapping.fields) === null || ref16 === void 0 ? void 0 : ref16.map(function(item) {
1258
1140
  return item === null || item === void 0 ? void 0 : item.controlId;
1259
1141
  });
1260
- var mappingValue = _this.getEmptyState(newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId);
1261
- var _newState_newMapping_controlId;
1262
- 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 : {});
1142
+ var mappingValue = _this6.getEmptyState(newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId);
1143
+ var ref17;
1144
+ 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 : {});
1263
1145
  mappingKeys === null || mappingKeys === void 0 ? void 0 : mappingKeys.forEach(function(key) {
1264
- if (!mainStateKeys.includes(key) && key !== "uid" && newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) {
1146
+ if (!mainStateKeys.includes(key) && key !== 'uid' && newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) {
1265
1147
  if (Object.keys(newState).length) {
1266
1148
  Object.assign(newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId], _defineProperty({}, key, mappingValue[key]));
1267
1149
  } else {
@@ -1269,7 +1151,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1269
1151
  }
1270
1152
  }
1271
1153
  });
1272
- _this.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
1154
+ _this6.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
1273
1155
  }
1274
1156
  }
1275
1157
  });
@@ -1337,13 +1219,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1337
1219
  }
1338
1220
  }
1339
1221
  } else {
1340
- var _this_getControlIdMapping;
1341
- var controlIdMapping = (_this_getControlIdMapping = this.getControlIdMapping()) !== null && _this_getControlIdMapping !== void 0 ? _this_getControlIdMapping : {};
1342
- var _Object_entries_find;
1343
- var _ref = _slicedToArray((_Object_entries_find = Object.entries(controlIdMapping).find(function(param) {
1222
+ var ref;
1223
+ var controlIdMapping = (ref = this.getControlIdMapping()) !== null && ref !== void 0 ? ref : {};
1224
+ var ref21;
1225
+ var ref22 = _slicedToArray((ref21 = Object.entries(controlIdMapping).find(function(param) {
1344
1226
  var _param = _slicedToArray(param, 2), _ = _param[0], mapping = _param[1];
1345
1227
  return mapping.children && controlId in mapping.children;
1346
- })) !== null && _Object_entries_find !== void 0 ? _Object_entries_find : [], 1), subtableId = _ref[0];
1228
+ })) !== null && ref21 !== void 0 ? ref21 : [], 1), subtableId = ref22[0];
1347
1229
  if (subtableId) {
1348
1230
  var subtable = this.getInstance(subtableId);
1349
1231
  // @ts-ignore
@@ -1370,16 +1252,16 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1370
1252
  {
1371
1253
  key: "setInstance",
1372
1254
  value: function setInstance(instance, props, value, rowIndex) {
1373
- var _this = this;
1374
1255
  try {
1375
- if (typeof instance === "string" && rowIndex === -1) {
1256
+ if (typeof instance === 'string' && rowIndex === -1) {
1257
+ var _this = this;
1376
1258
  //修改明细表整列属性的逻辑
1377
1259
  var instances = this.getInstances(instance, rowIndex === -1);
1378
1260
  instances.map(function(_instance) {
1379
1261
  if (_instance) {
1380
1262
  _this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
1381
1263
  updateValueFromKeys(_instance.props, props, value);
1382
- _this.schemaEvent("schema-change", {
1264
+ _this.schemaEvent('schema-change', {
1383
1265
  instance: _instance,
1384
1266
  props: props,
1385
1267
  value: value,
@@ -1388,19 +1270,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1388
1270
  }
1389
1271
  });
1390
1272
  } else {
1391
- var _instance;
1392
- if (typeof instance === "string") {
1393
- _instance = this.getInstance(instance, rowIndex);
1273
+ var _instance1;
1274
+ if (typeof instance === 'string') {
1275
+ _instance1 = this.getInstance(instance, rowIndex);
1394
1276
  } else {
1395
- _instance = instance;
1277
+ _instance1 = instance;
1396
1278
  }
1397
- if (!_instance) {
1279
+ if (!_instance1) {
1398
1280
  return;
1399
1281
  }
1400
- this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
1401
- updateValueFromKeys(_instance.props, props, value);
1402
- this.schemaEvent("schema-change", {
1403
- instance: _instance,
1282
+ this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance1.id, _instance1, props, value);
1283
+ updateValueFromKeys(_instance1.props, props, value);
1284
+ this.schemaEvent('schema-change', {
1285
+ instance: _instance1,
1404
1286
  props: props,
1405
1287
  value: value,
1406
1288
  rowIndex: rowIndex
@@ -1570,8 +1452,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1570
1452
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
1571
1453
  args[_key] = arguments[_key];
1572
1454
  }
1573
- var _this_runtime;
1574
- return (_this_runtime = this.runtime).registerControlConfig.apply(_this_runtime, _toConsumableArray(args));
1455
+ var _runtime;
1456
+ return (_runtime = this.runtime).registerControlConfig.apply(_runtime, _toConsumableArray(args));
1575
1457
  }
1576
1458
  },
1577
1459
  {
@@ -1583,12 +1465,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1583
1465
  {
1584
1466
  key: "inList",
1585
1467
  value: function inList(controlId) {
1586
- var _this_store_controlIdMapping;
1587
- var mapping = (_this_store_controlIdMapping = this.store.controlIdMapping) !== null && _this_store_controlIdMapping !== void 0 ? _this_store_controlIdMapping : {};
1468
+ var _controlIdMapping;
1469
+ var mapping = (_controlIdMapping = this.store.controlIdMapping) !== null && _controlIdMapping !== void 0 ? _controlIdMapping : {};
1588
1470
  var listKey = undefined;
1589
1471
  Object.keys(mapping).some(function(key) {
1590
- var _mapping_key, _mapping_key_children;
1591
- 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);
1472
+ var ref, ref23;
1473
+ var matched = (ref = mapping[key]) === null || ref === void 0 ? void 0 : (ref23 = ref.children) === null || ref23 === void 0 ? void 0 : ref23.hasOwnProperty(controlId);
1592
1474
  if (matched) {
1593
1475
  listKey = key;
1594
1476
  }