@byteluck-fe/model-driven-engine 2.7.0-alpha.15 → 2.7.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.
@@ -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
@@ -541,19 +415,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
541
415
  if (type && args) {
542
416
  // const subtableOldLength = subtable.children.length
543
417
  switch(type){
544
- case "push":
545
- case "unshift":
546
- var _subtable_children;
418
+ case 'push':
419
+ case 'unshift':
420
+ var _children;
547
421
  var newRowLengths = args.length;
548
422
  createdNewRows = createRows(newRowLengths);
549
423
  createdNewRowsData = args;
550
- (_subtable_children = subtable.children)[type].apply(_subtable_children, _toConsumableArray(createdNewRows));
424
+ (_children = subtable.children)[type].apply(_children, _toConsumableArray(createdNewRows));
551
425
  this.runtime.getFlatInstances();
552
426
  break;
553
- case "splice":
427
+ case 'splice':
554
428
  if (args.length > 2) {
555
429
  var // @ts-ignore
556
- _subtable_children1;
430
+ _children1;
557
431
  var newRowLengths1 = args.length - 2;
558
432
  var newValues = args.slice(2);
559
433
  createdNewRows = createRows(newRowLengths1);
@@ -562,7 +436,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
562
436
  var start = args[0];
563
437
  // 替换几个
564
438
  var replace = args[1];
565
- (_subtable_children1 = subtable.children)[type].apply(_subtable_children1, [
439
+ (_children1 = subtable.children)[type].apply(_children1, [
566
440
  start,
567
441
  replace
568
442
  ].concat(_toConsumableArray(createdNewRows)));
@@ -573,7 +447,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
573
447
  // })
574
448
  } else {
575
449
  var // @ts-ignore
576
- _subtable_children2;
450
+ _children2;
577
451
  // 从哪儿开始
578
452
  var start1 = args[0];
579
453
  // 替换几个
@@ -581,28 +455,28 @@ var Engine = /*#__PURE__*/ function(Watcher) {
581
455
  if (start1 + replace1 === subtable.children.length - 1) {
582
456
  isDeleteLastOne = true;
583
457
  }
584
- (_subtable_children2 = subtable.children)[type].apply(_subtable_children2, _toConsumableArray(args));
458
+ (_children2 = subtable.children)[type].apply(_children2, _toConsumableArray(args));
585
459
  this.runtime.getFlatInstances();
586
460
  }
587
461
  break;
588
462
  default:
589
463
  var // @ts-ignore
590
- _subtable_children3;
591
- (_subtable_children3 = subtable.children)[type].apply(_subtable_children3, _toConsumableArray(args));
464
+ _children3;
465
+ (_children3 = subtable.children)[type].apply(_children3, _toConsumableArray(args));
592
466
  this.runtime.getFlatInstances();
593
467
  break;
594
468
  }
595
- if (type === "splice") {
469
+ if (type === 'splice') {
596
470
  deleted = result;
597
471
  } else if ([
598
- "pop",
599
- "shift"
472
+ 'pop',
473
+ 'shift'
600
474
  ].includes(type)) {
601
475
  deleted = [
602
476
  result
603
477
  ];
604
478
  }
605
- this.emit("list-change", {
479
+ this.emit('list-change', {
606
480
  instance: subtable,
607
481
  value: this.getState(subtable.id),
608
482
  options: Object.assign({}, options, {
@@ -630,26 +504,26 @@ var Engine = /*#__PURE__*/ function(Watcher) {
630
504
  // if (instance instanceof RuntimeListControl) {
631
505
  if (instance.controlType === CONTROL_BASE_TYPE.LIST) {
632
506
  var // @ts-ignore
633
- _instance_children;
507
+ _children;
634
508
  instance.children.length = 0;
635
509
  var newValue = value;
636
510
  // @ts-ignore
637
511
  var newRows = [];
638
512
  for(var i = 0; i < newValue.length; i++){
639
513
  // @ts-ignore
640
- var row = this.listControlCreateRow(instance, "subtable-row");
514
+ var row = this.listControlCreateRow(instance, 'subtable-row');
641
515
  row && newRows.push(row);
642
516
  }
643
- (_instance_children = instance.children).push.apply(_instance_children, _toConsumableArray(newRows));
517
+ (_children = instance.children).push.apply(_children, _toConsumableArray(newRows));
644
518
  this.runtime.getFlatInstances();
645
519
  // 这里已经能拿到控件实例,所以在这里触发setStates,触发每一行每一个控件的change事件
646
520
  // for (let i = 0; i < newValue.length; i++) {
647
521
  // this.setStates(newValue[i], i, options)
648
522
  // }
649
- this.emit("list-change", {
523
+ this.emit('list-change', {
650
524
  instance: instance,
651
525
  value: value,
652
- options: _objectSpreadProps(_objectSpread({}, options), {
526
+ options: _objectSpread({}, options, {
653
527
  // @ts-ignore
654
528
  changed: newRows,
655
529
  data: newValue,
@@ -657,11 +531,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
657
531
  })
658
532
  });
659
533
  } else {
660
- this.emit("change", {
534
+ this.emit('change', {
661
535
  instance: instance,
662
536
  value: this.getState(instance.id, index),
663
537
  rowIndex: index,
664
- options: _objectSpreadProps(_objectSpread({}, options), {
538
+ options: _objectSpread({}, options, {
665
539
  oldValue: oldValue
666
540
  })
667
541
  });
@@ -675,13 +549,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
675
549
  if (this.__pluginsApplied) return;
676
550
  this.__plugins.forEach(function(plugin) {
677
551
  try {
678
- var _plugin_pluginName;
679
- 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;
680
554
  plugin.apply(_this);
681
555
  } catch (e) {
682
556
  error("".concat(applyingPluginName, " Plugin apply Error \n ").concat(e));
683
557
  } finally{
684
- applyingPluginName = "";
558
+ applyingPluginName = '';
685
559
  }
686
560
  });
687
561
  this.__pluginsApplied = true;
@@ -695,12 +569,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
695
569
  // if (row instanceof RuntimeLayoutControl) {
696
570
  // @ts-ignore
697
571
  if (row.controlType === CONTROL_BASE_TYPE.LAYOUT) {
698
- var _inst_children;
572
+ var _children;
699
573
  var inst = row;
700
574
  var template = JSONCopy(instance.props.headers);
701
575
  // @ts-ignore
702
576
  var columns = this.createControl(template);
703
- (_inst_children = inst.children).push.apply(_inst_children, _toConsumableArray(columns));
577
+ (_children = inst.children).push.apply(_children, _toConsumableArray(columns));
704
578
  }
705
579
  return row;
706
580
  }
@@ -709,7 +583,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
709
583
  key: "listControlAddRow",
710
584
  value: function listControlAddRow(instance) {
711
585
  var // @ts-ignore
712
- 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';
713
587
  var row = this.listControlCreateRow(instance, rowType);
714
588
  if (!row) return;
715
589
  instance.children.push(row);
@@ -723,40 +597,37 @@ var Engine = /*#__PURE__*/ function(Watcher) {
723
597
  var _this1 = this, _superprop_get_emit = function() {
724
598
  return _get(_getPrototypeOf(Engine.prototype), "emit", _this);
725
599
  };
726
- return _asyncToGenerator(function() {
600
+ return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
727
601
  var needWait, promiseResolver, promise, results;
728
- return __generator(this, function(_state) {
729
- switch(_state.label){
602
+ return regeneratorRuntime.wrap(function _callee$(_ctx) {
603
+ while(1)switch(_ctx.prev = _ctx.next){
730
604
  case 0:
731
- if (!(eventKey === "engine-mounted")) return [
732
- 3,
733
- 3
734
- ];
735
- if (_this1.isMounted) {
736
- warn("The engine-mounted life cycle can only be triggered once");
737
- return [
738
- 2,
739
- Promise.resolve([])
740
- ];
605
+ if (!(eventKey === 'engine-mounted')) {
606
+ _ctx.next = 11;
607
+ break;
608
+ }
609
+ if (!_this1.isMounted) {
610
+ _ctx.next = 4;
611
+ break;
741
612
  }
742
- if (!_this1._jobTasks.length) return [
743
- 3,
744
- 2
745
- ];
746
- console.time("engine-mounted need wait");
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');
747
621
  needWait = _toConsumableArray(_this1._jobTasks);
748
- return [
749
- 4,
750
- Promise.all(needWait)
751
- ];
752
- case 1:
753
- _state.sent();
754
- console.timeEnd("engine-mounted need wait");
755
- _state.label = 2;
756
- case 2:
622
+ _ctx.next = 9;
623
+ return Promise.all(needWait);
624
+ case 9:
625
+ console.timeEnd('engine-mounted need wait');
626
+ case 10:
757
627
  _this1.isMounted = true;
758
- _state.label = 3;
759
- case 3:
628
+ case 11:
629
+ ;
630
+ ;
760
631
  // 如果没有挂载的话,需要记录在挂载之前触发的所有任务
761
632
  if (!_this1.isMounted) {
762
633
  promise = new Promise(function(resolve) {
@@ -764,24 +635,22 @@ var Engine = /*#__PURE__*/ function(Watcher) {
764
635
  });
765
636
  _this1._jobTasks.push(promise);
766
637
  }
767
- return [
768
- 4,
769
- _superprop_get_emit().call(_this1, eventKey, payload)
770
- ];
771
- case 4:
772
- results = _state.sent();
638
+ _ctx.next = 16;
639
+ return _superprop_get_emit().call(_this1, eventKey, payload);
640
+ case 16:
641
+ results = _ctx.sent;
773
642
  if (promiseResolver && promise) {
774
643
  // 每一个任务完成的时候,都把自己从task中去掉
775
644
  promiseResolver();
776
645
  _this1._jobTasks.splice(_this1._jobTasks.indexOf(promise), 1);
777
646
  }
778
- return [
779
- 2,
780
- results
781
- ];
647
+ return _ctx.abrupt("return", results);
648
+ case 19:
649
+ case "end":
650
+ return _ctx.stop();
782
651
  }
783
- });
784
- })();
652
+ }, _callee);
653
+ }))();
785
654
  }
786
655
  },
787
656
  {
@@ -799,8 +668,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
799
668
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
800
669
  args[_key] = arguments[_key];
801
670
  }
802
- var _this_runtime;
803
- return (_this_runtime = this.runtime).createControl.apply(_this_runtime, _toConsumableArray(args));
671
+ var _runtime;
672
+ return (_runtime = this.runtime).createControl.apply(_runtime, _toConsumableArray(args));
804
673
  }
805
674
  },
806
675
  {
@@ -828,10 +697,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
828
697
  if (controlId === undefined) {
829
698
  return rules;
830
699
  } else {
831
- var _rules_rules_controlId, _rules_antdRules_controlId;
700
+ var ref, ref1;
832
701
  return {
833
- rules: (_rules_rules_controlId = rules.rules[controlId]) === null || _rules_rules_controlId === void 0 ? void 0 : _rules_rules_controlId.fields,
834
- antdRules: (_rules_antdRules_controlId = rules.antdRules[controlId]) === null || _rules_antdRules_controlId === void 0 ? void 0 : _rules_antdRules_controlId.fields
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
835
704
  };
836
705
  }
837
706
  }
@@ -842,8 +711,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
842
711
  if (controlId === undefined) {
843
712
  return this.runtime.rules;
844
713
  } else {
845
- var _this_runtime_rules_controlId;
846
- return (_this_runtime_rules_controlId = this.runtime.rules[controlId]) === null || _this_runtime_rules_controlId === void 0 ? void 0 : _this_runtime_rules_controlId.fields;
714
+ var ref;
715
+ return (ref = this.runtime.rules[controlId]) === null || ref === void 0 ? void 0 : ref.fields;
847
716
  }
848
717
  }
849
718
  },
@@ -853,8 +722,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
853
722
  if (controlId === undefined) {
854
723
  return this.runtime.antdRules;
855
724
  } else {
856
- var _this_runtime_antdRules_controlId;
857
- return (_this_runtime_antdRules_controlId = this.runtime.antdRules[controlId]) === null || _this_runtime_antdRules_controlId === void 0 ? void 0 : _this_runtime_antdRules_controlId.fields;
725
+ var ref;
726
+ return (ref = this.runtime.antdRules[controlId]) === null || ref === void 0 ? void 0 : ref.fields;
858
727
  }
859
728
  }
860
729
  },
@@ -891,9 +760,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
891
760
  key: "setState",
892
761
  value: function setState(controlId, value, rowIndex, options) {
893
762
  eventOptionsTemp = options;
894
- 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);
895
764
  this.store.setState(controlId, value, rowIndex);
896
- this.debugLog("[%o]: setState完成, 修改的值为%o, rowIndex=%o", controlId, value, rowIndex);
765
+ this.debugLog('[%o]: setState完成, 修改的值为%o, rowIndex=%o', controlId, value, rowIndex);
897
766
  eventOptionsTemp = null;
898
767
  }
899
768
  },
@@ -906,19 +775,20 @@ var Engine = /*#__PURE__*/ function(Watcher) {
906
775
  var _this = this;
907
776
  var newStates = states !== null && states !== void 0 ? states : {};
908
777
  Object.keys(newStates).forEach(function(stateId) {
778
+ var _this2 = _this;
909
779
  Object.entries(_this.store.controlIdMapping).forEach(function(param) {
910
780
  var _param = _slicedToArray(param, 2), controlId = _param[0], controlIdMapping = _param[1];
911
781
  if (controlIdMapping.dataView === stateId) {
912
782
  // state对象是dataView包裹的
913
783
  var value = newStates[stateId][controlId];
914
784
  if (value !== undefined) {
915
- _this.setState(controlId, value, rowIndex, options);
785
+ _this2.setState(controlId, value, rowIndex, options);
916
786
  }
917
787
  } else {
918
788
  // state对象是单独的,没有被dataView包裹的
919
789
  if (controlId === stateId || controlIdMapping.children && controlIdMapping.children[stateId]) {
920
790
  if (newStates[stateId] !== undefined) {
921
- _this.setState(stateId, newStates[stateId], rowIndex, options);
791
+ _this2.setState(stateId, newStates[stateId], rowIndex, options);
922
792
  }
923
793
  }
924
794
  }
@@ -946,11 +816,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
946
816
  if (!dataBindMapping1) {
947
817
  return;
948
818
  }
949
- var dataBind = dataBindMapping1.dataBind, controlId1 = dataBindMapping1.controlId;
819
+ var dataBind1 = dataBindMapping1.dataBind, controlId1 = dataBindMapping1.controlId;
950
820
  var state = this.getState(controlId1, rowIndex);
951
821
  //if (dataBind instanceof ObjectDataBind) {
952
- if (!isDataBind(dataBind)) {
953
- return Object.entries(dataBind).reduce(function(result, param) {
822
+ if (!isDataBind(dataBind1)) {
823
+ return Object.entries(dataBind1).reduce(function(result, param) {
954
824
  var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
955
825
  // objectDataBind的元素,跳过下一次赋值
956
826
  if (dataBind.fieldCode === fieldCode) {
@@ -977,18 +847,18 @@ var Engine = /*#__PURE__*/ function(Watcher) {
977
847
  var data = getFieldData.map(function(item) {
978
848
  var obj = {};
979
849
  for(var key in item){
980
- var _controlIdMapping_controlId_children_key, _controlIdMapping_controlId, _controlIdMapping_controlId_children_key_dataBind;
981
- 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;
982
852
  //未绑定字段的控件,直接抛弃
983
- if (fieldCode !== "") {
984
- var _controlIdMapping_controlId1;
853
+ if (fieldCode !== '') {
854
+ var ref4;
985
855
  if (fieldCode) {
986
856
  obj[fieldCode] = item[key];
987
- } 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]) {
988
858
  // 兼容一个控件需要绑定多个字段的情况
989
859
  for(var keyChi in item[key]){
990
- var _controlIdMapping_controlId_children_key1, _controlIdMapping_controlId2;
991
- 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];
992
862
  }
993
863
  }
994
864
  }
@@ -997,45 +867,45 @@ var Engine = /*#__PURE__*/ function(Watcher) {
997
867
  });
998
868
  return data;
999
869
  } else {
1000
- var _loop = function(key) {
1001
- var _controlIdMapping_key, _controlIdMapping_key_dataBind, _controlIdMapping_key1, _controlIdMapping_key_dataBind1;
1002
- if ((_controlIdMapping_key = controlIdMapping[key]) === null || _controlIdMapping_key === void 0 ? void 0 : (_controlIdMapping_key_dataBind = _controlIdMapping_key.dataBind) === null || _controlIdMapping_key_dataBind === void 0 ? void 0 : _controlIdMapping_key_dataBind.fieldCode) {
1003
- var _controlIdMapping_key2;
1004
- obj[(_controlIdMapping_key2 = controlIdMapping[key]) === null || _controlIdMapping_key2 === void 0 ? void 0 : _controlIdMapping_key2.dataBind.fieldCode] = getFieldData[key];
1005
- } else if ((_controlIdMapping_key1 = controlIdMapping[key]) === null || _controlIdMapping_key1 === void 0 ? void 0 : (_controlIdMapping_key_dataBind1 = _controlIdMapping_key1.dataBind) === null || _controlIdMapping_key_dataBind1 === void 0 ? void 0 : _controlIdMapping_key_dataBind1.dataCode) {
1006
- var _controlIdMapping_key3;
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;
1007
877
  // 明细字表只循环一层明细子表未递归
1008
- 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) {
1009
879
  var objChi = {};
1010
880
  for(var keyChi in item){
1011
- var _controlIdMapping_key_children_keyChi;
1012
- var fieldCode = (_controlIdMapping_key_children_keyChi = controlIdMapping[key].children[keyChi]) === null || _controlIdMapping_key_children_keyChi === void 0 ? void 0 : _controlIdMapping_key_children_keyChi.dataBind.fieldCode;
881
+ var ref;
882
+ var fieldCode = (ref = controlIdMapping[key1].children[keyChi]) === null || ref === void 0 ? void 0 : ref.dataBind.fieldCode;
1013
883
  //未绑定字段的控件,直接抛弃
1014
- if (fieldCode !== "") {
884
+ if (fieldCode !== '') {
1015
885
  if (fieldCode) {
1016
886
  objChi[fieldCode] = item[keyChi];
1017
887
  } else {
1018
888
  for(var keyChi1 in item[keyChi]){
1019
- var _controlIdMapping_key_children_keyChi1;
1020
- objChi[(_controlIdMapping_key_children_keyChi1 = controlIdMapping[key].children[keyChi]) === null || _controlIdMapping_key_children_keyChi1 === void 0 ? void 0 : _controlIdMapping_key_children_keyChi1.dataBind[keyChi1].fieldCode] = item[keyChi][keyChi1];
889
+ var ref14;
890
+ objChi[(ref14 = controlIdMapping[key1].children[keyChi]) === null || ref14 === void 0 ? void 0 : ref14.dataBind[keyChi1].fieldCode] = item[keyChi][keyChi1];
1021
891
  }
1022
892
  }
1023
893
  }
1024
894
  }
1025
895
  return objChi;
1026
896
  });
1027
- } else if (controlIdMapping[key]) {
897
+ } else if (controlIdMapping[key1]) {
1028
898
  // 兼容一个控件需要绑定多个字段的情况
1029
- for(var keyChi in getFieldData[key]){
1030
- var _controlIdMapping_key_dataBind_keyChi, _controlIdMapping_key4;
1031
- 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];
1032
902
  }
1033
903
  }
1034
904
  };
1035
905
  // 主表
1036
- var obj = {};
1037
- for(var key in getFieldData)_loop(key);
1038
- return obj;
906
+ var obj1 = {};
907
+ for(var key1 in getFieldData)_loop(key1);
908
+ return obj1;
1039
909
  }
1040
910
  }
1041
911
  return;
@@ -1055,13 +925,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1055
925
  if (!dataBindMapping) {
1056
926
  return;
1057
927
  }
1058
- var dataBind = dataBindMapping.dataBind, controlId = dataBindMapping.controlId;
928
+ var dataBind2 = dataBindMapping.dataBind, controlId = dataBindMapping.controlId;
1059
929
  // if (dataBind instanceof ObjectDataBind) {
1060
- if (!isDataBind(dataBind)) {
1061
- var _JSONCopy;
1062
- 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);
1063
933
  // fieldCode不代表是key,所以需要找到对应的key
1064
- var newState = Object.entries(dataBind).reduce(function(result, param) {
934
+ var newState = Object.entries(dataBind2).reduce(function(result, param) {
1065
935
  var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
1066
936
  // objectDataBind的元素,跳过下一次赋值
1067
937
  if (dataBind.fieldCode === fieldCode) {
@@ -1091,7 +961,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1091
961
  }
1092
962
  var skipKeys = [];
1093
963
  mapping.fields.forEach(function(item) {
1094
- var dataBind = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
964
+ var dataBind3 = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
1095
965
  if (skipKeys.includes(fieldCode)) {
1096
966
  return;
1097
967
  }
@@ -1100,11 +970,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1100
970
  }
1101
971
  // 对象类型的值
1102
972
  // if (dataBind instanceof ObjectDataBind) {
1103
- if (!isDataBind(dataBind)) {
1104
- var _JSONCopy;
1105
- 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);
1106
976
  // fieldCode不代表是key,所以需要找到对应的key
1107
- var newState = Object.entries(dataBind).reduce(function(result, param) {
977
+ var newState = Object.entries(dataBind3).reduce(function(result, param) {
1108
978
  var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
1109
979
  // objectDataBind的元素,跳过下一次赋值
1110
980
  skipKeys.push(dataBind.fieldCode);
@@ -1134,9 +1004,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1134
1004
  return;
1135
1005
  }
1136
1006
  var skipKeys = [];
1137
- var result = {};
1007
+ var result1 = {};
1138
1008
  mapping.fields.forEach(function(item) {
1139
- var dataBind = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
1009
+ var dataBind4 = item.dataBind, controlId = item.controlId, fieldCode = item.fieldCode;
1140
1010
  if (skipKeys.includes(fieldCode)) {
1141
1011
  return;
1142
1012
  }
@@ -1145,10 +1015,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1145
1015
  }
1146
1016
  // 对象类型的值
1147
1017
  // if (dataBind instanceof ObjectDataBind) {
1148
- if (!isDataBind(dataBind)) {
1018
+ if (!isDataBind(dataBind4)) {
1149
1019
  var oldState = _this.getEmptyState(controlId);
1150
1020
  // fieldCode不代表是key,所以需要找到对应的key
1151
- result[item.controlId] = Object.entries(dataBind).reduce(function(result, param) {
1021
+ result1[item.controlId] = Object.entries(dataBind4).reduce(function(result, param) {
1152
1022
  var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
1153
1023
  // objectDataBind的元素,跳过下一次赋值
1154
1024
  skipKeys.push(dataBind.fieldCode);
@@ -1159,10 +1029,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1159
1029
  return result;
1160
1030
  }, oldState);
1161
1031
  } else {
1162
- result[controlId] = state[fieldCode];
1032
+ result1[controlId] = state[fieldCode];
1163
1033
  }
1164
1034
  });
1165
- return result;
1035
+ return result1;
1166
1036
  }
1167
1037
  },
1168
1038
  {
@@ -1172,13 +1042,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1172
1042
  * @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
1173
1043
  */ key: "setData",
1174
1044
  value: function setData(dataSet, options) {
1175
- var _this = this;
1045
+ var _this6 = this;
1176
1046
  this.debugLog("engine setData方法执行,参数为%o,%o。", dataSet, options);
1177
1047
  var newState = this.store.defaultState;
1178
1048
  Object.keys(dataSet).map(function(dataCode) {
1179
1049
  var entity = dataSet[dataCode];
1180
1050
  if (Array.isArray(entity)) {
1181
- var mapping = _this.getDataBindMapping(dataCode);
1051
+ var _this4 = _this6;
1052
+ var mapping = _this6.getDataBindMapping(dataCode);
1182
1053
  if (!mapping) {
1183
1054
  return;
1184
1055
  }
@@ -1186,21 +1057,22 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1186
1057
  newState[mapping.dataViewId] = {};
1187
1058
  }
1188
1059
  if (!entity.length) {
1189
- var _newState_mapping_dataViewId_mapping_controlId;
1190
- newState[mapping.dataViewId][mapping.controlId] = (_newState_mapping_dataViewId_mapping_controlId = newState[mapping.dataViewId][mapping.controlId]) !== null && _newState_mapping_dataViewId_mapping_controlId !== void 0 ? _newState_mapping_dataViewId_mapping_controlId : [];
1060
+ var _controlId;
1061
+ newState[mapping.dataViewId][mapping.controlId] = (_controlId = newState[mapping.dataViewId][mapping.controlId]) !== null && _controlId !== void 0 ? _controlId : [];
1191
1062
  } else {
1192
1063
  newState[mapping.dataViewId][mapping.controlId] = [];
1193
1064
  }
1194
1065
  entity.map(function(row) {
1195
- 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]);
1196
1068
  var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1197
1069
  ;
1198
1070
  Object.keys(row).map(function(fieldCode) {
1199
- var _this_store_dataBindMapping_dataCode, _this_store_dataBindMapping_dataCode_fields;
1071
+ var ref, ref18;
1200
1072
  if (skipKey.includes(fieldCode)) {
1201
1073
  return;
1202
1074
  }
1203
- var fieldMapping = (_this_store_dataBindMapping_dataCode = _this.store.dataBindMapping[dataCode]) === null || _this_store_dataBindMapping_dataCode === void 0 ? void 0 : (_this_store_dataBindMapping_dataCode_fields = _this_store_dataBindMapping_dataCode.fields) === null || _this_store_dataBindMapping_dataCode_fields === void 0 ? void 0 : _this_store_dataBindMapping_dataCode_fields.find(function(i) {
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) {
1204
1076
  return i.fieldCode === fieldCode;
1205
1077
  });
1206
1078
  if (fieldMapping) {
@@ -1209,8 +1081,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1209
1081
  newRow[fieldMapping.controlId] = row[fieldCode];
1210
1082
  // } else if (fieldMapping.dataBind instanceof ObjectDataBind) {
1211
1083
  } else if (!isDataBind(fieldMapping.dataBind)) {
1212
- var _this_getEmptyState;
1213
- 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 : {});
1214
1086
  Object.keys(fieldMapping.dataBind).map(function(key) {
1215
1087
  var dataBind = fieldMapping.dataBind[key];
1216
1088
  if (row[dataBind.fieldCode] !== undefined) {
@@ -1225,18 +1097,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1225
1097
  newState[mapping.dataViewId][mapping.controlId].push(newRow);
1226
1098
  });
1227
1099
  } else if (entity) {
1228
- var _Object_keys;
1229
- var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1100
+ var ref20;
1101
+ var skipKey1 = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1230
1102
  ;
1231
- var emptyState = JSONCopy(_this.store.emptyState);
1232
- 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)) {
1233
1105
  // newState = this.store.defaultState
1234
1106
  } else {
1107
+ var _this3 = _this6;
1235
1108
  Object.keys(entity).map(function(fieldCode) {
1236
- if (skipKey.includes(fieldCode)) {
1109
+ if (skipKey1.includes(fieldCode)) {
1237
1110
  return;
1238
1111
  }
1239
- var mapping = _this.getDataBindMapping(dataCode, fieldCode);
1112
+ var mapping = _this3.getDataBindMapping(dataCode, fieldCode);
1240
1113
  if (mapping) {
1241
1114
  if (!newState[mapping.dataViewId[0]]) {
1242
1115
  newState[mapping.dataViewId[0]] = {};
@@ -1246,31 +1119,31 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1246
1119
  newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode] !== undefined ? entity[fieldCode] : emptyState[mapping.dataViewId[0]][mapping.controlId];
1247
1120
  // } else if (mapping.dataBind instanceof ObjectDataBind) {
1248
1121
  } else if (!isDataBind(mapping.dataBind)) {
1249
- var _this_getEmptyState;
1250
- 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 : {};
1251
1124
  Object.keys(mapping.dataBind).map(function(key) {
1252
1125
  var dataBind = mapping.dataBind[key];
1253
1126
  if (entity[dataBind.fieldCode] !== undefined) {
1254
1127
  objValue[key] = entity[dataBind.fieldCode];
1255
1128
  }
1256
- skipKey.push(dataBind.fieldCode);
1129
+ skipKey1.push(dataBind.fieldCode);
1257
1130
  });
1258
1131
  newState[mapping.dataViewId[0]][mapping.controlId] = objValue;
1259
1132
  }
1260
1133
  }
1261
1134
  });
1262
1135
  }
1263
- var newMapping = _this.getDataBindMapping(dataCode);
1136
+ var newMapping = _this6.getDataBindMapping(dataCode);
1264
1137
  if (newMapping) {
1265
- var _newMapping_fields;
1266
- var mappingKeys = newMapping === null || newMapping === void 0 ? void 0 : (_newMapping_fields = newMapping.fields) === null || _newMapping_fields === void 0 ? void 0 : _newMapping_fields.map(function(item) {
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) {
1267
1140
  return item === null || item === void 0 ? void 0 : item.controlId;
1268
1141
  });
1269
- var mappingValue = _this.getEmptyState(newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId);
1270
- var _newState_newMapping_controlId;
1271
- var mainStateKeys = Object.keys((_newState_newMapping_controlId = newState === null || newState === void 0 ? void 0 : newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) !== null && _newState_newMapping_controlId !== void 0 ? _newState_newMapping_controlId : {});
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 : {});
1272
1145
  mappingKeys === null || mappingKeys === void 0 ? void 0 : mappingKeys.forEach(function(key) {
1273
- 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]) {
1274
1147
  if (Object.keys(newState).length) {
1275
1148
  Object.assign(newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId], _defineProperty({}, key, mappingValue[key]));
1276
1149
  } else {
@@ -1278,7 +1151,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1278
1151
  }
1279
1152
  }
1280
1153
  });
1281
- _this.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
1154
+ _this6.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
1282
1155
  }
1283
1156
  }
1284
1157
  });
@@ -1346,13 +1219,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1346
1219
  }
1347
1220
  }
1348
1221
  } else {
1349
- var _this_getControlIdMapping;
1350
- var controlIdMapping = (_this_getControlIdMapping = this.getControlIdMapping()) !== null && _this_getControlIdMapping !== void 0 ? _this_getControlIdMapping : {};
1351
- var _Object_entries_find;
1352
- var _ref = _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) {
1353
1226
  var _param = _slicedToArray(param, 2), _ = _param[0], mapping = _param[1];
1354
1227
  return mapping.children && controlId in mapping.children;
1355
- })) !== null && _Object_entries_find !== void 0 ? _Object_entries_find : [], 1), subtableId = _ref[0];
1228
+ })) !== null && ref21 !== void 0 ? ref21 : [], 1), subtableId = ref22[0];
1356
1229
  if (subtableId) {
1357
1230
  var subtable = this.getInstance(subtableId);
1358
1231
  // @ts-ignore
@@ -1379,16 +1252,16 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1379
1252
  {
1380
1253
  key: "setInstance",
1381
1254
  value: function setInstance(instance, props, value, rowIndex) {
1382
- var _this = this;
1383
1255
  try {
1384
- if (typeof instance === "string" && rowIndex === -1) {
1256
+ if (typeof instance === 'string' && rowIndex === -1) {
1257
+ var _this = this;
1385
1258
  //修改明细表整列属性的逻辑
1386
1259
  var instances = this.getInstances(instance, rowIndex === -1);
1387
1260
  instances.map(function(_instance) {
1388
1261
  if (_instance) {
1389
1262
  _this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
1390
1263
  updateValueFromKeys(_instance.props, props, value);
1391
- _this.schemaEvent("schema-change", {
1264
+ _this.schemaEvent('schema-change', {
1392
1265
  instance: _instance,
1393
1266
  props: props,
1394
1267
  value: value,
@@ -1397,19 +1270,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1397
1270
  }
1398
1271
  });
1399
1272
  } else {
1400
- var _instance;
1401
- if (typeof instance === "string") {
1402
- _instance = this.getInstance(instance, rowIndex);
1273
+ var _instance1;
1274
+ if (typeof instance === 'string') {
1275
+ _instance1 = this.getInstance(instance, rowIndex);
1403
1276
  } else {
1404
- _instance = instance;
1277
+ _instance1 = instance;
1405
1278
  }
1406
- if (!_instance) {
1279
+ if (!_instance1) {
1407
1280
  return;
1408
1281
  }
1409
- this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
1410
- updateValueFromKeys(_instance.props, props, value);
1411
- this.schemaEvent("schema-change", {
1412
- instance: _instance,
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,
1413
1286
  props: props,
1414
1287
  value: value,
1415
1288
  rowIndex: rowIndex
@@ -1579,8 +1452,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1579
1452
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
1580
1453
  args[_key] = arguments[_key];
1581
1454
  }
1582
- var _this_runtime;
1583
- return (_this_runtime = this.runtime).registerControlConfig.apply(_this_runtime, _toConsumableArray(args));
1455
+ var _runtime;
1456
+ return (_runtime = this.runtime).registerControlConfig.apply(_runtime, _toConsumableArray(args));
1584
1457
  }
1585
1458
  },
1586
1459
  {
@@ -1592,12 +1465,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1592
1465
  {
1593
1466
  key: "inList",
1594
1467
  value: function inList(controlId) {
1595
- var _this_store_controlIdMapping;
1596
- 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 : {};
1597
1470
  var listKey = undefined;
1598
1471
  Object.keys(mapping).some(function(key) {
1599
- var _mapping_key, _mapping_key_children;
1600
- 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);
1601
1474
  if (matched) {
1602
1475
  listKey = key;
1603
1476
  }