@byteluck-fe/model-driven-engine 2.5.0-alpha.10 → 2.5.0-alpha.16

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.
@@ -113,7 +113,7 @@ function _inherits(subClass, superClass) {
113
113
  }
114
114
  function _instanceof(left, right) {
115
115
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
116
- return !!right[Symbol.hasInstance](left);
116
+ return right[Symbol.hasInstance](left);
117
117
  } else {
118
118
  return left instanceof right;
119
119
  }
@@ -166,30 +166,6 @@ function _objectSpread(target) {
166
166
  }
167
167
  return target;
168
168
  }
169
- function ownKeys(object, enumerableOnly) {
170
- var keys = Object.keys(object);
171
- if (Object.getOwnPropertySymbols) {
172
- var symbols = Object.getOwnPropertySymbols(object);
173
- if (enumerableOnly) {
174
- symbols = symbols.filter(function(sym) {
175
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
176
- });
177
- }
178
- keys.push.apply(keys, symbols);
179
- }
180
- return keys;
181
- }
182
- function _objectSpreadProps(target, source) {
183
- source = source != null ? source : {};
184
- if (Object.getOwnPropertyDescriptors) {
185
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
186
- } else {
187
- ownKeys(Object(source)).forEach(function(key) {
188
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
189
- });
190
- }
191
- return target;
192
- }
193
169
  function _possibleConstructorReturn(self, call) {
194
170
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
195
171
  return call;
@@ -252,147 +228,44 @@ function _createSuper(Derived) {
252
228
  return _possibleConstructorReturn(this, result);
253
229
  };
254
230
  }
255
- var __generator = this && this.__generator || function(thisArg, body) {
256
- var f, y, t, g, _ = {
257
- label: 0,
258
- sent: function() {
259
- if (t[0] & 1) throw t[1];
260
- return t[1];
261
- },
262
- trys: [],
263
- ops: []
264
- };
265
- return g = {
266
- next: verb(0),
267
- "throw": verb(1),
268
- "return": verb(2)
269
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
270
- return this;
271
- }), g;
272
- function verb(n) {
273
- return function(v) {
274
- return step([
275
- n,
276
- v
277
- ]);
278
- };
279
- }
280
- function step(op) {
281
- if (f) throw new TypeError("Generator is already executing.");
282
- while(_)try {
283
- 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;
284
- if (y = 0, t) op = [
285
- op[0] & 2,
286
- t.value
287
- ];
288
- switch(op[0]){
289
- case 0:
290
- case 1:
291
- t = op;
292
- break;
293
- case 4:
294
- _.label++;
295
- return {
296
- value: op[1],
297
- done: false
298
- };
299
- case 5:
300
- _.label++;
301
- y = op[1];
302
- op = [
303
- 0
304
- ];
305
- continue;
306
- case 7:
307
- op = _.ops.pop();
308
- _.trys.pop();
309
- continue;
310
- default:
311
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
312
- _ = 0;
313
- continue;
314
- }
315
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
316
- _.label = op[1];
317
- break;
318
- }
319
- if (op[0] === 6 && _.label < t[1]) {
320
- _.label = t[1];
321
- t = op;
322
- break;
323
- }
324
- if (t && _.label < t[2]) {
325
- _.label = t[2];
326
- _.ops.push(op);
327
- break;
328
- }
329
- if (t[2]) _.ops.pop();
330
- _.trys.pop();
331
- continue;
332
- }
333
- op = body.call(thisArg, _);
334
- } catch (e) {
335
- op = [
336
- 6,
337
- e
338
- ];
339
- y = 0;
340
- } finally{
341
- f = t = 0;
342
- }
343
- if (op[0] & 5) throw op[1];
344
- return {
345
- value: op[0] ? op[1] : void 0,
346
- done: true
347
- };
348
- }
349
- };
350
- import { DataBind, ObjectDataBind, RuntimeListControl } from "@byteluck-fe/model-driven-core";
351
- import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher } from "@byteluck-fe/model-driven-shared";
352
- import { Runtime } from "./Runtime";
353
- import { Store } from "./Store";
354
- import { findItem, proxyState } from "./proxyState";
355
- import { ActionManager } from "./ActionManager";
356
- import { DataManager } from "./DataManager";
357
- import { checkerSubtableValue, checkerValue } from "./checkerValue";
358
- if (typeof window !== "undefined") {
231
+ import regeneratorRuntime from "regenerator-runtime";
232
+ import { DataBind, ObjectDataBind, RuntimeListControl } from '@byteluck-fe/model-driven-core';
233
+ import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher } from '@byteluck-fe/model-driven-shared';
234
+ import { Runtime } from './Runtime';
235
+ import { Store } from './Store';
236
+ import { findItem, proxyState } from './proxyState';
237
+ import { ActionManager } from './ActionManager';
238
+ import { DataManager } from './DataManager';
239
+ import { checkerSubtableValue, checkerValue } from './checkerValue';
240
+ if (typeof window !== 'undefined') {
359
241
  // @ts-ignore
360
242
  window.engines = {};
361
243
  }
362
244
  // setState的时候,存储options中转变量
363
245
  var eventOptionsTemp = null;
364
246
  // 当前正在注册的插件名称
365
- var applyingPluginName = "";
366
- // 整体渲染引擎 并且 提供发布订阅能力
367
- var Engine = /*#__PURE__*/ function(Watcher) {
247
+ var applyingPluginName = '';
248
+ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
249
+ /*#__PURE__*/ function(Watcher1) {
368
250
  "use strict";
369
- _inherits(Engine, Watcher);
251
+ _inherits(Engine, Watcher1);
370
252
  var _super = _createSuper(Engine);
371
253
  function Engine(props) {
372
254
  _classCallCheck(this, Engine);
373
255
  var _this;
374
256
  _this = _super.call(this);
375
- _defineProperty(_assertThisInitialized(_this), "store", void 0);
376
- _defineProperty(_assertThisInitialized(_this), "rawStore", {});
377
- _defineProperty(_assertThisInitialized(_this), "parent", void 0);
378
- // 提供注册运行态控件以及实例化控件的能力
379
- _defineProperty(_assertThisInitialized(_this), "runtime", void 0);
257
+ _this.rawStore = {};
380
258
  // 提供子线程处理脚本以及修改数据的能力
381
259
  // public worker: OkWorker
382
- _defineProperty(_assertThisInitialized(_this), "isMounted", false);
383
- _defineProperty(_assertThisInitialized(_this), "id", genNonDuplicateId(8));
384
- _defineProperty(_assertThisInitialized(_this), "externalParams", void 0);
385
- // 提供外部注册插件,在不同的hooks触发时执行固定函数的能力
386
- _defineProperty(_assertThisInitialized(_this), "__plugins", void 0);
387
- _defineProperty(_assertThisInitialized(_this), "__pluginsApplied", false);
388
- _defineProperty(_assertThisInitialized(_this), "$options", void 0);
389
- _defineProperty(_assertThisInitialized(_this), "actionManager", new ActionManager());
390
- _defineProperty(_assertThisInitialized(_this), "dataManager", void 0);
391
- _defineProperty(_assertThisInitialized(_this), "_jobTasks", []);
392
- _defineProperty(_assertThisInitialized(_this), "createControlInstance", _this.createInstance);
260
+ _this.isMounted = false;
261
+ _this.id = genNonDuplicateId(8);
262
+ _this.__pluginsApplied = false;
263
+ _this.actionManager = new ActionManager();
264
+ _this._jobTasks = [];
265
+ _this.createControlInstance = _this.createInstance;
393
266
  _this.$options = Object.freeze(props);
394
- 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,
395
- 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;
267
+ 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,
268
+ language, language = _language === void 0 ? DEFAULT_LOCALE : _language, _debug = _$options.debug, debug = _debug === void 0 ? false : _debug;
396
269
  RulesMessage.setLocale(language);
397
270
  _this.debug = debug;
398
271
  _this.runtime = new Runtime({
@@ -403,7 +276,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
403
276
  _this.store = new Store({
404
277
  instance: _this.runtime.instance
405
278
  });
406
- _this.debugLog("engine is Instantiation complete");
279
+ _this.debugLog('engine is Instantiation complete');
407
280
  // 自动执行挂载完成,也可以手动调用mount方法
408
281
  autoMount && _this.mount();
409
282
  return _this;
@@ -434,8 +307,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
434
307
  for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
435
308
  arg[_key] = arguments[_key];
436
309
  }
437
- var _this_runtime;
438
- (_this_runtime = this.runtime).register.apply(_this_runtime, _toConsumableArray(arg));
310
+ var _runtime;
311
+ (_runtime = this.runtime).register.apply(_runtime, _toConsumableArray(arg));
439
312
  return this;
440
313
  }
441
314
  },
@@ -443,14 +316,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
443
316
  key: "mount",
444
317
  value: function mount() {
445
318
  this.debugLog("engine的mount方法开始调用");
446
- var _this_$options = this.$options, _this_$options_plugins = _this_$options.plugins, plugins = _this_$options_plugins === void 0 ? [] : _this_$options_plugins;
319
+ var _$options = this.$options, _plugins = _$options.plugins, plugins = _plugins === void 0 ? [] : _plugins;
447
320
  this._handlerProxyState();
448
321
  this.__plugins = plugins;
449
322
  this.applyPlugins();
450
323
  // 触发所有控件的默认值的change事件
451
324
  this.setStates(this.getState());
452
325
  this.debugLog("engine的mount方法调用结束");
453
- if (this.debug && typeof window !== "undefined") {
326
+ if (this.debug && typeof window !== 'undefined') {
454
327
  // @ts-ignore
455
328
  window.engines[this.id] = this;
456
329
  }
@@ -459,7 +332,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
459
332
  {
460
333
  key: "destroy",
461
334
  value: function destroy() {
462
- if (this.debug && typeof window !== "undefined") {
335
+ if (this.debug && typeof window !== 'undefined') {
463
336
  // @ts-ignore
464
337
  delete window.engines[this.id];
465
338
  }
@@ -496,11 +369,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
496
369
  // @ts-ignore
497
370
  var emptyState = this.getEmptyState(instance.id);
498
371
  return newValue.map(function(row) {
499
- return(// @ts-ignore
500
- checkerSubtableValue(fieldTypeMap, row, emptyState));
372
+ // @ts-ignore
373
+ return checkerSubtableValue(fieldTypeMap, row, emptyState);
501
374
  });
502
375
  }
503
- var keys = key.split(".");
376
+ var keys = key.split('.');
504
377
  var lastKey = keys[keys.length - 1];
505
378
  try {
506
379
  return checkerValue(instance.fieldType, lastKey, newValue, oldValue);
@@ -532,7 +405,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
532
405
  var newRows = [];
533
406
  for(var i = 0; i < len; i++){
534
407
  // @ts-ignore
535
- var row = _this.listControlCreateRow(subtable, "subtable-row");
408
+ var row = _this.listControlCreateRow(subtable, 'subtable-row');
536
409
  row && newRows.push(row);
537
410
  }
538
411
  // @ts-ignore
@@ -546,19 +419,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
546
419
  if (type && args) {
547
420
  // const subtableOldLength = subtable.children.length
548
421
  switch(type){
549
- case "push":
550
- case "unshift":
551
- var _subtable_children;
422
+ case 'push':
423
+ case 'unshift':
424
+ var _children;
552
425
  var newRowLengths = args.length;
553
426
  createdNewRows = createRows(newRowLengths);
554
427
  createdNewRowsData = args;
555
- (_subtable_children = subtable.children)[type].apply(_subtable_children, _toConsumableArray(createdNewRows));
428
+ (_children = subtable.children)[type].apply(_children, _toConsumableArray(createdNewRows));
556
429
  this.runtime.getFlatInstances();
557
430
  break;
558
- case "splice":
431
+ case 'splice':
559
432
  if (args.length > 2) {
560
433
  var // @ts-ignore
561
- _subtable_children1;
434
+ _children1;
562
435
  var newRowLengths1 = args.length - 2;
563
436
  var newValues = args.slice(2);
564
437
  createdNewRows = createRows(newRowLengths1);
@@ -567,7 +440,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
567
440
  var start = args[0];
568
441
  // 替换几个
569
442
  var replace = args[1];
570
- (_subtable_children1 = subtable.children)[type].apply(_subtable_children1, [
443
+ (_children1 = subtable.children)[type].apply(_children1, [
571
444
  start,
572
445
  replace
573
446
  ].concat(_toConsumableArray(createdNewRows)));
@@ -578,29 +451,29 @@ var Engine = /*#__PURE__*/ function(Watcher) {
578
451
  // })
579
452
  } else {
580
453
  var // @ts-ignore
581
- _subtable_children2;
582
- (_subtable_children2 = subtable.children)[type].apply(_subtable_children2, _toConsumableArray(args));
454
+ _children2;
455
+ (_children2 = subtable.children)[type].apply(_children2, _toConsumableArray(args));
583
456
  this.runtime.getFlatInstances();
584
457
  }
585
458
  break;
586
459
  default:
587
460
  var // @ts-ignore
588
- _subtable_children3;
589
- (_subtable_children3 = subtable.children)[type].apply(_subtable_children3, _toConsumableArray(args));
461
+ _children3;
462
+ (_children3 = subtable.children)[type].apply(_children3, _toConsumableArray(args));
590
463
  this.runtime.getFlatInstances();
591
464
  break;
592
465
  }
593
- if (type === "splice") {
466
+ if (type === 'splice') {
594
467
  deleted = result;
595
468
  } else if ([
596
- "pop",
597
- "shift"
469
+ 'pop',
470
+ 'shift'
598
471
  ].includes(type)) {
599
472
  deleted = [
600
473
  result
601
474
  ];
602
475
  }
603
- this.emit("list-change", {
476
+ this.emit('list-change', {
604
477
  instance: subtable,
605
478
  value: this.getState(subtable.id),
606
479
  options: Object.assign({}, options, {
@@ -627,26 +500,26 @@ var Engine = /*#__PURE__*/ function(Watcher) {
627
500
  // if (instance instanceof RuntimeListControl) {
628
501
  if (instance.controlType === CONTROL_BASE_TYPE.LIST) {
629
502
  var // @ts-ignore
630
- _instance_children;
503
+ _children;
631
504
  instance.children.length = 0;
632
505
  var newValue = value;
633
506
  // @ts-ignore
634
507
  var newRows = [];
635
508
  for(var i = 0; i < newValue.length; i++){
636
509
  // @ts-ignore
637
- var row = this.listControlCreateRow(instance, "subtable-row");
510
+ var row = this.listControlCreateRow(instance, 'subtable-row');
638
511
  row && newRows.push(row);
639
512
  }
640
- (_instance_children = instance.children).push.apply(_instance_children, _toConsumableArray(newRows));
513
+ (_children = instance.children).push.apply(_children, _toConsumableArray(newRows));
641
514
  this.runtime.getFlatInstances();
642
515
  // 这里已经能拿到控件实例,所以在这里触发setStates,触发每一行每一个控件的change事件
643
516
  // for (let i = 0; i < newValue.length; i++) {
644
517
  // this.setStates(newValue[i], i, options)
645
518
  // }
646
- this.emit("list-change", {
519
+ this.emit('list-change', {
647
520
  instance: instance,
648
521
  value: value,
649
- options: _objectSpreadProps(_objectSpread({}, options), {
522
+ options: _objectSpread({}, options, {
650
523
  // @ts-ignore
651
524
  changed: newRows,
652
525
  data: newValue,
@@ -654,11 +527,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
654
527
  })
655
528
  });
656
529
  } else {
657
- this.emit("change", {
530
+ this.emit('change', {
658
531
  instance: instance,
659
532
  value: this.getState(instance.id, index),
660
533
  rowIndex: index,
661
- options: _objectSpreadProps(_objectSpread({}, options), {
534
+ options: _objectSpread({}, options, {
662
535
  oldValue: oldValue
663
536
  })
664
537
  });
@@ -672,13 +545,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
672
545
  if (this.__pluginsApplied) return;
673
546
  this.__plugins.forEach(function(plugin) {
674
547
  try {
675
- var _plugin_pluginName;
676
- applyingPluginName = (_plugin_pluginName = plugin.pluginName) !== null && _plugin_pluginName !== void 0 ? _plugin_pluginName : plugin.constructor.name;
548
+ var _pluginName;
549
+ applyingPluginName = (_pluginName = plugin.pluginName) !== null && _pluginName !== void 0 ? _pluginName : plugin.constructor.name;
677
550
  plugin.apply(_this);
678
551
  } catch (e) {
679
552
  error("".concat(applyingPluginName, " Plugin apply Error \n ").concat(e));
680
553
  } finally{
681
- applyingPluginName = "";
554
+ applyingPluginName = '';
682
555
  }
683
556
  });
684
557
  this.__pluginsApplied = true;
@@ -692,12 +565,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
692
565
  // if (row instanceof RuntimeLayoutControl) {
693
566
  // @ts-ignore
694
567
  if (row.controlType === CONTROL_BASE_TYPE.LAYOUT) {
695
- var _inst_children;
568
+ var _children;
696
569
  var inst = row;
697
570
  var template = JSONCopy(instance.props.headers);
698
571
  // @ts-ignore
699
572
  var columns = this.createControl(template);
700
- (_inst_children = inst.children).push.apply(_inst_children, _toConsumableArray(columns));
573
+ (_children = inst.children).push.apply(_children, _toConsumableArray(columns));
701
574
  }
702
575
  return row;
703
576
  }
@@ -706,7 +579,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
706
579
  key: "listControlAddRow",
707
580
  value: function listControlAddRow(instance) {
708
581
  var // @ts-ignore
709
- rowType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "subtable-row";
582
+ rowType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'subtable-row';
710
583
  var row = this.listControlCreateRow(instance, rowType);
711
584
  if (!row) return;
712
585
  instance.children.push(row);
@@ -720,40 +593,37 @@ var Engine = /*#__PURE__*/ function(Watcher) {
720
593
  var _this1 = this, _superprop_get_emit = function() {
721
594
  return _get(_getPrototypeOf(Engine.prototype), "emit", _this);
722
595
  };
723
- return _asyncToGenerator(function() {
596
+ return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
724
597
  var needWait, promiseResolver, promise, results;
725
- return __generator(this, function(_state) {
726
- switch(_state.label){
598
+ return regeneratorRuntime.wrap(function _callee$(_ctx) {
599
+ while(1)switch(_ctx.prev = _ctx.next){
727
600
  case 0:
728
- if (!(eventKey === "engine-mounted")) return [
729
- 3,
730
- 3
731
- ];
732
- if (_this1.isMounted) {
733
- warn("The engine-mounted life cycle can only be triggered once");
734
- return [
735
- 2,
736
- Promise.resolve([])
737
- ];
601
+ if (!(eventKey === 'engine-mounted')) {
602
+ _ctx.next = 11;
603
+ break;
738
604
  }
739
- if (!_this1._jobTasks.length) return [
740
- 3,
741
- 2
742
- ];
743
- console.time("engine-mounted need wait");
605
+ if (!_this1.isMounted) {
606
+ _ctx.next = 4;
607
+ break;
608
+ }
609
+ warn('The engine-mounted life cycle can only be triggered once');
610
+ return _ctx.abrupt("return", Promise.resolve([]));
611
+ case 4:
612
+ if (!_this1._jobTasks.length) {
613
+ _ctx.next = 10;
614
+ break;
615
+ }
616
+ console.time('engine-mounted need wait');
744
617
  needWait = _toConsumableArray(_this1._jobTasks);
745
- return [
746
- 4,
747
- Promise.all(needWait)
748
- ];
749
- case 1:
750
- _state.sent();
751
- console.timeEnd("engine-mounted need wait");
752
- _state.label = 2;
753
- case 2:
618
+ _ctx.next = 9;
619
+ return Promise.all(needWait);
620
+ case 9:
621
+ console.timeEnd('engine-mounted need wait');
622
+ case 10:
754
623
  _this1.isMounted = true;
755
- _state.label = 3;
756
- case 3:
624
+ case 11:
625
+ ;
626
+ ;
757
627
  // 如果没有挂载的话,需要记录在挂载之前触发的所有任务
758
628
  if (!_this1.isMounted) {
759
629
  promise = new Promise(function(resolve) {
@@ -761,24 +631,22 @@ var Engine = /*#__PURE__*/ function(Watcher) {
761
631
  });
762
632
  _this1._jobTasks.push(promise);
763
633
  }
764
- return [
765
- 4,
766
- _superprop_get_emit().call(_this1, eventKey, payload)
767
- ];
768
- case 4:
769
- results = _state.sent();
634
+ _ctx.next = 16;
635
+ return _superprop_get_emit().call(_this1, eventKey, payload);
636
+ case 16:
637
+ results = _ctx.sent;
770
638
  if (promiseResolver && promise) {
771
639
  // 每一个任务完成的时候,都把自己从task中去掉
772
640
  promiseResolver();
773
641
  _this1._jobTasks.splice(_this1._jobTasks.indexOf(promise), 1);
774
642
  }
775
- return [
776
- 2,
777
- results
778
- ];
643
+ return _ctx.abrupt("return", results);
644
+ case 19:
645
+ case "end":
646
+ return _ctx.stop();
779
647
  }
780
- });
781
- })();
648
+ }, _callee);
649
+ }))();
782
650
  }
783
651
  },
784
652
  {
@@ -796,8 +664,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
796
664
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
797
665
  args[_key] = arguments[_key];
798
666
  }
799
- var _this_runtime;
800
- return (_this_runtime = this.runtime).createControl.apply(_this_runtime, _toConsumableArray(args));
667
+ var _runtime;
668
+ return (_runtime = this.runtime).createControl.apply(_runtime, _toConsumableArray(args));
801
669
  }
802
670
  },
803
671
  {
@@ -825,10 +693,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
825
693
  if (controlId === undefined) {
826
694
  return rules;
827
695
  } else {
828
- var _rules_rules_controlId, _rules_antdRules_controlId;
696
+ var ref, ref1;
829
697
  return {
830
- rules: (_rules_rules_controlId = rules.rules[controlId]) === null || _rules_rules_controlId === void 0 ? void 0 : _rules_rules_controlId.fields,
831
- antdRules: (_rules_antdRules_controlId = rules.antdRules[controlId]) === null || _rules_antdRules_controlId === void 0 ? void 0 : _rules_antdRules_controlId.fields
698
+ rules: (ref = rules.rules[controlId]) === null || ref === void 0 ? void 0 : ref.fields,
699
+ antdRules: (ref1 = rules.antdRules[controlId]) === null || ref1 === void 0 ? void 0 : ref1.fields
832
700
  };
833
701
  }
834
702
  }
@@ -839,8 +707,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
839
707
  if (controlId === undefined) {
840
708
  return this.runtime.rules;
841
709
  } else {
842
- var _this_runtime_rules_controlId;
843
- return (_this_runtime_rules_controlId = this.runtime.rules[controlId]) === null || _this_runtime_rules_controlId === void 0 ? void 0 : _this_runtime_rules_controlId.fields;
710
+ var ref;
711
+ return (ref = this.runtime.rules[controlId]) === null || ref === void 0 ? void 0 : ref.fields;
844
712
  }
845
713
  }
846
714
  },
@@ -850,8 +718,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
850
718
  if (controlId === undefined) {
851
719
  return this.runtime.antdRules;
852
720
  } else {
853
- var _this_runtime_antdRules_controlId;
854
- return (_this_runtime_antdRules_controlId = this.runtime.antdRules[controlId]) === null || _this_runtime_antdRules_controlId === void 0 ? void 0 : _this_runtime_antdRules_controlId.fields;
721
+ var ref;
722
+ return (ref = this.runtime.antdRules[controlId]) === null || ref === void 0 ? void 0 : ref.fields;
855
723
  }
856
724
  }
857
725
  },
@@ -888,9 +756,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
888
756
  key: "setState",
889
757
  value: function setState(controlId, value, rowIndex, options) {
890
758
  eventOptionsTemp = options;
891
- this.debugLog("[%o]: 触发setState, 修改的值为%o, rowIndex=%o, options=%o", controlId, value, rowIndex, options);
759
+ this.debugLog('[%o]: 触发setState, 修改的值为%o, rowIndex=%o, options=%o', controlId, value, rowIndex, options);
892
760
  this.store.setState(controlId, value, rowIndex);
893
- this.debugLog("[%o]: setState完成, 修改的值为%o, rowIndex=%o", controlId, value, rowIndex);
761
+ this.debugLog('[%o]: setState完成, 修改的值为%o, rowIndex=%o', controlId, value, rowIndex);
894
762
  eventOptionsTemp = null;
895
763
  }
896
764
  },
@@ -903,19 +771,20 @@ var Engine = /*#__PURE__*/ function(Watcher) {
903
771
  var _this = this;
904
772
  var newStates = states;
905
773
  Object.keys(newStates).forEach(function(stateId) {
774
+ var _this2 = _this;
906
775
  Object.entries(_this.store.controlIdMapping).forEach(function(param) {
907
776
  var _param = _slicedToArray(param, 2), controlId = _param[0], controlIdMapping = _param[1];
908
777
  if (controlIdMapping.dataView === stateId) {
909
778
  // state对象是dataView包裹的
910
779
  var value = newStates[stateId][controlId];
911
780
  if (value !== undefined) {
912
- _this.setState(controlId, value, rowIndex, options);
781
+ _this2.setState(controlId, value, rowIndex, options);
913
782
  }
914
783
  } else {
915
784
  // state对象是单独的,没有被dataView包裹的
916
785
  if (controlId === stateId || controlIdMapping.children && controlIdMapping.children[stateId]) {
917
786
  if (newStates[stateId] !== undefined) {
918
- _this.setState(stateId, newStates[stateId], rowIndex, options);
787
+ _this2.setState(stateId, newStates[stateId], rowIndex, options);
919
788
  }
920
789
  }
921
790
  }
@@ -943,10 +812,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
943
812
  if (!dataBindMapping1) {
944
813
  return;
945
814
  }
946
- var dataBind = dataBindMapping1.dataBind, controlId1 = dataBindMapping1.controlId;
815
+ var dataBind1 = dataBindMapping1.dataBind, controlId1 = dataBindMapping1.controlId;
947
816
  var state = this.getState(controlId1, rowIndex);
948
- if (_instanceof(dataBind, ObjectDataBind)) {
949
- return Object.entries(dataBind).reduce(function(result, param) {
817
+ if (_instanceof(dataBind1, ObjectDataBind)) {
818
+ return Object.entries(dataBind1).reduce(function(result, param) {
950
819
  var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
951
820
  // objectDataBind的元素,跳过下一次赋值
952
821
  if (dataBind.fieldCode === fieldCode) {
@@ -973,15 +842,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
973
842
  var data = getFieldData.map(function(item) {
974
843
  var obj = {};
975
844
  for(var key in item){
976
- var _controlIdMapping_controlId_children_key, _controlIdMapping_controlId, _controlIdMapping_controlId_children_key_dataBind, _controlIdMapping_controlId1;
977
- if ((_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) {
978
- var _controlIdMapping_controlId_children_key1;
979
- obj[(_controlIdMapping_controlId_children_key1 = controlIdMapping[controlId].children[key]) === null || _controlIdMapping_controlId_children_key1 === void 0 ? void 0 : _controlIdMapping_controlId_children_key1.dataBind.fieldCode] = item[key];
980
- } else if ((_controlIdMapping_controlId1 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId1 === void 0 ? void 0 : _controlIdMapping_controlId1.children[key]) {
845
+ var ref, ref2, ref3, ref4;
846
+ if ((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) {
847
+ var ref5;
848
+ obj[(ref5 = controlIdMapping[controlId].children[key]) === null || ref5 === void 0 ? void 0 : ref5.dataBind.fieldCode] = item[key];
849
+ } else if ((ref4 = controlIdMapping[controlId]) === null || ref4 === void 0 ? void 0 : ref4.children[key]) {
981
850
  // 兼容一个控件需要绑定多个字段的情况
982
851
  for(var keyChi in item[key]){
983
- var _controlIdMapping_controlId_children_key2, _controlIdMapping_controlId2;
984
- obj[(_controlIdMapping_controlId_children_key2 = (_controlIdMapping_controlId2 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId2 === void 0 ? void 0 : _controlIdMapping_controlId2.children[key]) === null || _controlIdMapping_controlId_children_key2 === void 0 ? void 0 : _controlIdMapping_controlId_children_key2.dataBind[keyChi].fieldCode] = item[key][keyChi];
852
+ var ref6, ref7;
853
+ obj[(ref7 = (ref6 = controlIdMapping[controlId]) === null || ref6 === void 0 ? void 0 : ref6.children[key]) === null || ref7 === void 0 ? void 0 : ref7.dataBind[keyChi].fieldCode] = item[key][keyChi];
985
854
  }
986
855
  }
987
856
  }
@@ -989,43 +858,43 @@ var Engine = /*#__PURE__*/ function(Watcher) {
989
858
  });
990
859
  return data;
991
860
  } else {
992
- var _loop = function(key) {
993
- var _controlIdMapping_key, _controlIdMapping_key_dataBind, _controlIdMapping_key1, _controlIdMapping_key_dataBind1;
994
- 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) {
995
- var _controlIdMapping_key2;
996
- obj[(_controlIdMapping_key2 = controlIdMapping[key]) === null || _controlIdMapping_key2 === void 0 ? void 0 : _controlIdMapping_key2.dataBind.fieldCode] = getFieldData[key];
997
- } 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) {
998
- var _controlIdMapping_key3;
861
+ var _loop = function(key1) {
862
+ var ref17, ref8, ref9, ref10;
863
+ if ((ref17 = controlIdMapping[key1]) === null || ref17 === void 0 ? void 0 : (ref8 = ref17.dataBind) === null || ref8 === void 0 ? void 0 : ref8.fieldCode) {
864
+ var ref11;
865
+ obj1[(ref11 = controlIdMapping[key1]) === null || ref11 === void 0 ? void 0 : ref11.dataBind.fieldCode] = getFieldData[key1];
866
+ } else if ((ref9 = controlIdMapping[key1]) === null || ref9 === void 0 ? void 0 : (ref10 = ref9.dataBind) === null || ref10 === void 0 ? void 0 : ref10.dataCode) {
867
+ var ref12;
999
868
  // 明细字表只循环一层明细子表未递归
1000
- obj[(_controlIdMapping_key3 = controlIdMapping[key]) === null || _controlIdMapping_key3 === void 0 ? void 0 : _controlIdMapping_key3.dataBind.dataCode] = getFieldData[key].map(function(item) {
869
+ obj1[(ref12 = controlIdMapping[key1]) === null || ref12 === void 0 ? void 0 : ref12.dataBind.dataCode] = getFieldData[key1].map(function(item) {
1001
870
  var objChi = {};
1002
871
  for(var keyChi in item){
1003
- var _controlIdMapping_key_children_keyChi;
1004
- if ((_controlIdMapping_key_children_keyChi = controlIdMapping[key].children[keyChi]) === null || _controlIdMapping_key_children_keyChi === void 0 ? void 0 : _controlIdMapping_key_children_keyChi.dataBind.fieldCode) {
1005
- var _controlIdMapping_key_children_keyChi1;
1006
- objChi[(_controlIdMapping_key_children_keyChi1 = controlIdMapping[key].children[keyChi]) === null || _controlIdMapping_key_children_keyChi1 === void 0 ? void 0 : _controlIdMapping_key_children_keyChi1.dataBind.fieldCode] = item[keyChi];
872
+ var ref;
873
+ if ((ref = controlIdMapping[key1].children[keyChi]) === null || ref === void 0 ? void 0 : ref.dataBind.fieldCode) {
874
+ var ref15;
875
+ objChi[(ref15 = controlIdMapping[key1].children[keyChi]) === null || ref15 === void 0 ? void 0 : ref15.dataBind.fieldCode] = item[keyChi];
1007
876
  } else {
1008
877
  for(var keyChi1 in item[keyChi]){
1009
- var _controlIdMapping_key_children_keyChi2;
1010
- objChi[(_controlIdMapping_key_children_keyChi2 = controlIdMapping[key].children[keyChi]) === null || _controlIdMapping_key_children_keyChi2 === void 0 ? void 0 : _controlIdMapping_key_children_keyChi2.dataBind[keyChi1].fieldCode] = item[keyChi][keyChi1];
878
+ var ref16;
879
+ objChi[(ref16 = controlIdMapping[key1].children[keyChi]) === null || ref16 === void 0 ? void 0 : ref16.dataBind[keyChi1].fieldCode] = item[keyChi][keyChi1];
1011
880
  //
1012
881
  }
1013
882
  }
1014
883
  }
1015
884
  return objChi;
1016
885
  });
1017
- } else if (controlIdMapping[key]) {
886
+ } else if (controlIdMapping[key1]) {
1018
887
  // 兼容一个控件需要绑定多个字段的情况
1019
- for(var keyChi in getFieldData[key]){
1020
- var _controlIdMapping_key_dataBind_keyChi, _controlIdMapping_key4;
1021
- 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];
888
+ for(var keyChi2 in getFieldData[key1]){
889
+ var ref13, ref14;
890
+ obj1[(ref14 = (ref13 = controlIdMapping[key1]) === null || ref13 === void 0 ? void 0 : ref13.dataBind[keyChi2]) === null || ref14 === void 0 ? void 0 : ref14.fieldCode] = getFieldData[key1][keyChi2];
1022
891
  }
1023
892
  }
1024
893
  };
1025
894
  // 主表
1026
- var obj = {};
1027
- for(var key in getFieldData)_loop(key);
1028
- return obj;
895
+ var obj1 = {};
896
+ for(var key1 in getFieldData)_loop(key1);
897
+ return obj1;
1029
898
  }
1030
899
  }
1031
900
  return;
@@ -1045,12 +914,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1045
914
  if (!dataBindMapping) {
1046
915
  return;
1047
916
  }
1048
- var dataBind = dataBindMapping.dataBind, controlId = dataBindMapping.controlId;
1049
- if (_instanceof(dataBind, ObjectDataBind)) {
1050
- var _JSONCopy;
1051
- var oldState = (_JSONCopy = JSONCopy(this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : this.getEmptyState(controlId);
917
+ var dataBind2 = dataBindMapping.dataBind, controlId = dataBindMapping.controlId;
918
+ if (_instanceof(dataBind2, ObjectDataBind)) {
919
+ var ref;
920
+ var oldState = (ref = JSONCopy(this.getState(controlId, rowIndex))) !== null && ref !== void 0 ? ref : this.getEmptyState(controlId);
1052
921
  // fieldCode不代表是key,所以需要找到对应的key
1053
- var newState = Object.entries(dataBind).reduce(function(result, param) {
922
+ var newState = Object.entries(dataBind2).reduce(function(result, param) {
1054
923
  var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
1055
924
  // objectDataBind的元素,跳过下一次赋值
1056
925
  if (dataBind.fieldCode === fieldCode) {
@@ -1080,7 +949,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1080
949
  }
1081
950
  var skipKeys = [];
1082
951
  mapping.fields.forEach(function(item) {
1083
- var dataBind = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
952
+ var dataBind3 = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
1084
953
  if (skipKeys.includes(fieldCode)) {
1085
954
  return;
1086
955
  }
@@ -1088,11 +957,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1088
957
  return;
1089
958
  }
1090
959
  // 对象类型的值
1091
- if (_instanceof(dataBind, ObjectDataBind)) {
1092
- var _JSONCopy;
1093
- var oldState = (_JSONCopy = JSONCopy(_this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : _this.getEmptyState(controlId);
960
+ if (_instanceof(dataBind3, ObjectDataBind)) {
961
+ var ref;
962
+ var oldState = (ref = JSONCopy(_this.getState(controlId, rowIndex))) !== null && ref !== void 0 ? ref : _this.getEmptyState(controlId);
1094
963
  // fieldCode不代表是key,所以需要找到对应的key
1095
- var newState = Object.entries(dataBind).reduce(function(result, param) {
964
+ var newState = Object.entries(dataBind3).reduce(function(result, param) {
1096
965
  var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
1097
966
  // objectDataBind的元素,跳过下一次赋值
1098
967
  skipKeys.push(dataBind.fieldCode);
@@ -1122,9 +991,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1122
991
  return;
1123
992
  }
1124
993
  var skipKeys = [];
1125
- var result = {};
994
+ var result1 = {};
1126
995
  mapping.fields.forEach(function(item) {
1127
- var dataBind = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
996
+ var dataBind4 = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
1128
997
  if (skipKeys.includes(fieldCode)) {
1129
998
  return;
1130
999
  }
@@ -1132,10 +1001,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1132
1001
  return;
1133
1002
  }
1134
1003
  // 对象类型的值
1135
- if (_instanceof(dataBind, ObjectDataBind)) {
1004
+ if (_instanceof(dataBind4, ObjectDataBind)) {
1136
1005
  var oldState = _this.getEmptyState(controlId);
1137
1006
  // fieldCode不代表是key,所以需要找到对应的key
1138
- result[item.controlId] = Object.entries(dataBind).reduce(function(result, param) {
1007
+ result1[item.controlId] = Object.entries(dataBind4).reduce(function(result, param) {
1139
1008
  var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
1140
1009
  // objectDataBind的元素,跳过下一次赋值
1141
1010
  skipKeys.push(dataBind.fieldCode);
@@ -1146,10 +1015,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1146
1015
  return result;
1147
1016
  }, oldState);
1148
1017
  } else {
1149
- result[controlId] = state[fieldCode];
1018
+ result1[controlId] = state[fieldCode];
1150
1019
  }
1151
1020
  });
1152
- return result;
1021
+ return result1;
1153
1022
  }
1154
1023
  },
1155
1024
  {
@@ -1159,7 +1028,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1159
1028
  * @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
1160
1029
  */ key: "setData",
1161
1030
  value: function setData(dataSet, options) {
1162
- var _this = this;
1031
+ var _this6 = this;
1163
1032
  this.debugLog("engine setData方法执行,参数为%o,%o。", dataSet, options);
1164
1033
  var isEmpty = function(value) {
1165
1034
  if (isString(value) || Array.isArray(value)) {
@@ -1171,28 +1040,30 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1171
1040
  Object.keys(dataSet).map(function(dataCode) {
1172
1041
  var entity = dataSet[dataCode];
1173
1042
  if (Array.isArray(entity)) {
1043
+ var _this4 = _this6;
1174
1044
  entity.map(function(row) {
1175
- var mapping = _this.getDataBindMapping(dataCode);
1045
+ var _this = _this4;
1046
+ var mapping = _this4.getDataBindMapping(dataCode);
1176
1047
  if (!mapping) {
1177
1048
  return;
1178
1049
  }
1179
- var newRow = JSONCopy(_this.store.emptyState[mapping.dataViewId][mapping.controlId]);
1050
+ var newRow = JSONCopy(_this4.store.emptyState[mapping.dataViewId][mapping.controlId]);
1180
1051
  var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1181
1052
  ;
1182
1053
  Object.keys(row).map(function(fieldCode) {
1183
- var _this_store_dataBindMapping_dataCode, _this_store_dataBindMapping_dataCode_fields;
1054
+ var ref, ref19;
1184
1055
  if (skipKey.includes(fieldCode)) {
1185
1056
  return;
1186
1057
  }
1187
- 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) {
1058
+ var fieldMapping = (ref = _this.store.dataBindMapping[dataCode]) === null || ref === void 0 ? void 0 : (ref19 = ref.fields) === null || ref19 === void 0 ? void 0 : ref19.find(function(i) {
1188
1059
  return i.fieldCode === fieldCode;
1189
1060
  });
1190
1061
  if (fieldMapping) {
1191
1062
  if (_instanceof(fieldMapping.dataBind, DataBind) && row[fieldCode] !== undefined) {
1192
1063
  newRow[fieldMapping.controlId] = row[fieldCode];
1193
1064
  } else if (_instanceof(fieldMapping.dataBind, ObjectDataBind)) {
1194
- var _this_getEmptyState;
1195
- var objValue = JSONCopy((_this_getEmptyState = _this.getEmptyState(fieldMapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {});
1065
+ var ref20;
1066
+ var objValue = JSONCopy((ref20 = _this.getEmptyState(fieldMapping.controlId)) !== null && ref20 !== void 0 ? ref20 : {});
1196
1067
  Object.keys(fieldMapping.dataBind).map(function(key) {
1197
1068
  var dataBind = fieldMapping.dataBind[key];
1198
1069
  if (row[dataBind.fieldCode] !== undefined) {
@@ -1213,14 +1084,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1213
1084
  newState[mapping.dataViewId][mapping.controlId].push(newRow);
1214
1085
  });
1215
1086
  } else if (entity) {
1216
- var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1087
+ var _this3 = _this6;
1088
+ var skipKey1 = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1217
1089
  ;
1218
- var emptyState = JSONCopy(_this.store.emptyState);
1090
+ var emptyState = JSONCopy(_this6.store.emptyState);
1219
1091
  Object.keys(entity).map(function(fieldCode) {
1220
- if (skipKey.includes(fieldCode)) {
1092
+ if (skipKey1.includes(fieldCode)) {
1221
1093
  return;
1222
1094
  }
1223
- var mapping = _this.getDataBindMapping(dataCode, fieldCode);
1095
+ var mapping = _this3.getDataBindMapping(dataCode, fieldCode);
1224
1096
  if (mapping) {
1225
1097
  if (!newState[mapping.dataViewId[0]]) {
1226
1098
  newState[mapping.dataViewId[0]] = {};
@@ -1228,30 +1100,30 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1228
1100
  if (_instanceof(mapping.dataBind, DataBind) && entity[fieldCode] !== undefined) {
1229
1101
  newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode] !== undefined ? entity[fieldCode] : emptyState[mapping.dataViewId[0]][mapping.controlId];
1230
1102
  } else if (_instanceof(mapping.dataBind, ObjectDataBind)) {
1231
- var _this_getEmptyState;
1232
- var objValue = (_this_getEmptyState = _this.getEmptyState(mapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {};
1103
+ var ref;
1104
+ var objValue = (ref = _this3.getEmptyState(mapping.controlId)) !== null && ref !== void 0 ? ref : {};
1233
1105
  Object.keys(mapping.dataBind).map(function(key) {
1234
1106
  var dataBind = mapping.dataBind[key];
1235
1107
  if (entity[dataBind.fieldCode] !== undefined) {
1236
1108
  objValue[key] = entity[dataBind.fieldCode];
1237
1109
  }
1238
- skipKey.push(dataBind.fieldCode);
1110
+ skipKey1.push(dataBind.fieldCode);
1239
1111
  });
1240
1112
  newState[mapping.dataViewId[0]][mapping.controlId] = objValue;
1241
1113
  }
1242
1114
  }
1243
1115
  });
1244
- var newMapping = _this.getDataBindMapping(dataCode);
1116
+ var newMapping = _this6.getDataBindMapping(dataCode);
1245
1117
  if (newMapping) {
1246
- var _newMapping_fields;
1247
- 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) {
1118
+ var ref21;
1119
+ var mappingKeys = newMapping === null || newMapping === void 0 ? void 0 : (ref21 = newMapping.fields) === null || ref21 === void 0 ? void 0 : ref21.map(function(item) {
1248
1120
  return item === null || item === void 0 ? void 0 : item.controlId;
1249
1121
  });
1250
- var mappingValue = _this.getEmptyState(newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId);
1251
- var _newState_newMapping_controlId;
1252
- 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 : {});
1122
+ var mappingValue = _this6.getEmptyState(newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId);
1123
+ var ref18;
1124
+ var mainStateKeys = Object.keys((ref18 = newState === null || newState === void 0 ? void 0 : newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) !== null && ref18 !== void 0 ? ref18 : {});
1253
1125
  mappingKeys === null || mappingKeys === void 0 ? void 0 : mappingKeys.forEach(function(key) {
1254
- if (!mainStateKeys.includes(key) && key !== "uid") {
1126
+ if (!mainStateKeys.includes(key) && key !== 'uid') {
1255
1127
  if (Object.keys(newState).length && newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) {
1256
1128
  Object.assign(newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId], _defineProperty({}, key, mappingValue[key]));
1257
1129
  } else {
@@ -1259,7 +1131,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1259
1131
  }
1260
1132
  }
1261
1133
  });
1262
- _this.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
1134
+ _this6.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
1263
1135
  }
1264
1136
  }
1265
1137
  });
@@ -1327,11 +1199,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1327
1199
  }
1328
1200
  } else {
1329
1201
  var controlIdMapping = this.getControlIdMapping();
1330
- var _Object_entries_find;
1331
- var _ref = _slicedToArray((_Object_entries_find = Object.entries(controlIdMapping).find(function(param) {
1202
+ var ref;
1203
+ var ref22 = _slicedToArray((ref = Object.entries(controlIdMapping).find(function(param) {
1332
1204
  var _param = _slicedToArray(param, 2), _ = _param[0], mapping = _param[1];
1333
1205
  return mapping.children && controlId in mapping.children;
1334
- })) !== null && _Object_entries_find !== void 0 ? _Object_entries_find : [], 1), subtableId = _ref[0];
1206
+ })) !== null && ref !== void 0 ? ref : [], 1), subtableId = ref22[0];
1335
1207
  if (subtableId) {
1336
1208
  var subtable = this.getInstance(subtableId);
1337
1209
  // @ts-ignore
@@ -1358,16 +1230,16 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1358
1230
  {
1359
1231
  key: "setInstance",
1360
1232
  value: function setInstance(instance, props, value, rowIndex) {
1361
- var _this = this;
1362
1233
  try {
1363
- if (typeof instance === "string" && rowIndex === -1) {
1234
+ if (typeof instance === 'string' && rowIndex === -1) {
1235
+ var _this = this;
1364
1236
  //修改明细表整列属性的逻辑
1365
1237
  var instances = this.getInstances(instance, rowIndex === -1);
1366
1238
  instances.map(function(_instance) {
1367
1239
  if (_instance) {
1368
1240
  _this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
1369
1241
  updateValueFromKeys(_instance.props, props, value);
1370
- _this.schemaEvent("schema-change", {
1242
+ _this.schemaEvent('schema-change', {
1371
1243
  instance: _instance,
1372
1244
  props: props,
1373
1245
  value: value,
@@ -1376,19 +1248,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1376
1248
  }
1377
1249
  });
1378
1250
  } else {
1379
- var _instance;
1380
- if (typeof instance === "string") {
1381
- _instance = this.getInstance(instance, rowIndex);
1251
+ var _instance1;
1252
+ if (typeof instance === 'string') {
1253
+ _instance1 = this.getInstance(instance, rowIndex);
1382
1254
  } else {
1383
- _instance = instance;
1255
+ _instance1 = instance;
1384
1256
  }
1385
- if (!_instance) {
1257
+ if (!_instance1) {
1386
1258
  return;
1387
1259
  }
1388
- this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
1389
- updateValueFromKeys(_instance.props, props, value);
1390
- this.schemaEvent("schema-change", {
1391
- instance: _instance,
1260
+ this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance1.id, _instance1, props, value);
1261
+ updateValueFromKeys(_instance1.props, props, value);
1262
+ this.schemaEvent('schema-change', {
1263
+ instance: _instance1,
1392
1264
  props: props,
1393
1265
  value: value,
1394
1266
  rowIndex: rowIndex
@@ -1538,8 +1410,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1538
1410
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
1539
1411
  args[_key] = arguments[_key];
1540
1412
  }
1541
- var _this_runtime;
1542
- return (_this_runtime = this.runtime).registerControlConfig.apply(_this_runtime, _toConsumableArray(args));
1413
+ var _runtime;
1414
+ return (_runtime = this.runtime).registerControlConfig.apply(_runtime, _toConsumableArray(args));
1543
1415
  }
1544
1416
  },
1545
1417
  {
@@ -1553,8 +1425,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1553
1425
  value: function inList(controlId) {
1554
1426
  var mapping = this.store.controlIdMapping;
1555
1427
  var result = Object.keys(mapping).some(function(key) {
1556
- var _mapping_key, _mapping_key_children;
1557
- return (_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);
1428
+ var ref, ref23;
1429
+ return (ref = mapping[key]) === null || ref === void 0 ? void 0 : (ref23 = ref.children) === null || ref23 === void 0 ? void 0 : ref23.hasOwnProperty(controlId);
1558
1430
  });
1559
1431
  return result;
1560
1432
  }
@@ -1581,4 +1453,4 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1581
1453
  return Engine;
1582
1454
  }(Watcher);
1583
1455
  export { Engine };
1584
- console.log("a");
1456
+ console.log('a');