@byteluck-fe/model-driven-engine 1.8.1-beta.3 → 2.0.1

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.
@@ -238,101 +238,7 @@ function _createSuper(Derived) {
238
238
  return _possibleConstructorReturn(this, result);
239
239
  };
240
240
  }
241
- var __generator = this && this.__generator || function(thisArg, body) {
242
- var f, y, t, g, _ = {
243
- label: 0,
244
- sent: function() {
245
- if (t[0] & 1) throw t[1];
246
- return t[1];
247
- },
248
- trys: [],
249
- ops: []
250
- };
251
- return g = {
252
- next: verb(0),
253
- "throw": verb(1),
254
- "return": verb(2)
255
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
256
- return this;
257
- }), g;
258
- function verb(n) {
259
- return function(v) {
260
- return step([
261
- n,
262
- v
263
- ]);
264
- };
265
- }
266
- function step(op) {
267
- if (f) throw new TypeError("Generator is already executing.");
268
- while(_)try {
269
- 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;
270
- if (y = 0, t) op = [
271
- op[0] & 2,
272
- t.value
273
- ];
274
- switch(op[0]){
275
- case 0:
276
- case 1:
277
- t = op;
278
- break;
279
- case 4:
280
- _.label++;
281
- return {
282
- value: op[1],
283
- done: false
284
- };
285
- case 5:
286
- _.label++;
287
- y = op[1];
288
- op = [
289
- 0
290
- ];
291
- continue;
292
- case 7:
293
- op = _.ops.pop();
294
- _.trys.pop();
295
- continue;
296
- default:
297
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
298
- _ = 0;
299
- continue;
300
- }
301
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
302
- _.label = op[1];
303
- break;
304
- }
305
- if (op[0] === 6 && _.label < t[1]) {
306
- _.label = t[1];
307
- t = op;
308
- break;
309
- }
310
- if (t && _.label < t[2]) {
311
- _.label = t[2];
312
- _.ops.push(op);
313
- break;
314
- }
315
- if (t[2]) _.ops.pop();
316
- _.trys.pop();
317
- continue;
318
- }
319
- op = body.call(thisArg, _);
320
- } catch (e) {
321
- op = [
322
- 6,
323
- e
324
- ];
325
- y = 0;
326
- } finally{
327
- f = t = 0;
328
- }
329
- if (op[0] & 5) throw op[1];
330
- return {
331
- value: op[0] ? op[1] : void 0,
332
- done: true
333
- };
334
- }
335
- };
241
+ import regeneratorRuntime from "regenerator-runtime";
336
242
  import { DataBind, ObjectDataBind, RuntimeFormControl, RuntimeLayoutControl, RuntimeListControl } from "@byteluck-fe/model-driven-core";
337
243
  import { CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher } from "@byteluck-fe/model-driven-shared";
338
244
  import { Runtime } from "./Runtime";
@@ -367,8 +273,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
367
273
  _this._jobTasks = [];
368
274
  _this.createControlInstance = _this.createInstance;
369
275
  _this.$options = Object.freeze(props);
370
- 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,
371
- 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;
276
+ 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,
277
+ language, language = _language === void 0 ? DEFAULT_LOCALE : _language, _debug = _$options.debug, debug = _debug === void 0 ? false : _debug;
372
278
  RulesMessage.setLocale(language);
373
279
  _this.debug = debug;
374
280
  _this.runtime = new Runtime({
@@ -402,13 +308,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
402
308
  for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
403
309
  arg[_key] = arguments[_key];
404
310
  }
405
- var _this_runtime;
406
- (_this_runtime = this.runtime).register.apply(_this_runtime, _toConsumableArray(arg));
311
+ var _runtime;
312
+ (_runtime = this.runtime).register.apply(_runtime, _toConsumableArray(arg));
407
313
  return this;
408
314
  };
409
315
  _proto.mount = function mount() {
410
316
  this.debugLog("engine的mount方法开始调用");
411
- var _this_$options = this.$options, _this_$options_plugins = _this_$options.plugins, plugins = _this_$options_plugins === void 0 ? [] : _this_$options_plugins;
317
+ var _$options = this.$options, _plugins = _$options.plugins, plugins = _plugins === void 0 ? [] : _plugins;
412
318
  this._handlerProxyState();
413
319
  this.__plugins = plugins;
414
320
  this.applyPlugins();
@@ -496,17 +402,17 @@ var Engine = /*#__PURE__*/ function(Watcher) {
496
402
  switch(type){
497
403
  case "push":
498
404
  case "unshift":
499
- var _subtable_children;
405
+ var _children;
500
406
  var newRowLengths = args.length;
501
407
  createdNewRows = createRows(newRowLengths);
502
408
  createdNewRowsData = args;
503
- (_subtable_children = subtable.children)[type].apply(_subtable_children, _toConsumableArray(createdNewRows));
409
+ (_children = subtable.children)[type].apply(_children, _toConsumableArray(createdNewRows));
504
410
  this.runtime.getFlatInstances();
505
411
  break;
506
412
  case "splice":
507
413
  if (args.length > 2) {
508
414
  var // @ts-ignore
509
- _subtable_children1;
415
+ _children1;
510
416
  var newRowLengths1 = args.length - 2;
511
417
  var newValues = args.slice(2);
512
418
  createdNewRows = createRows(newRowLengths1);
@@ -515,7 +421,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
515
421
  var start = args[0];
516
422
  // 替换几个
517
423
  var replace = args[1];
518
- (_subtable_children1 = subtable.children)[type].apply(_subtable_children1, [
424
+ (_children1 = subtable.children)[type].apply(_children1, [
519
425
  start,
520
426
  replace
521
427
  ].concat(_toConsumableArray(createdNewRows)));
@@ -526,15 +432,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
526
432
  // })
527
433
  } else {
528
434
  var // @ts-ignore
529
- _subtable_children2;
530
- (_subtable_children2 = subtable.children)[type].apply(_subtable_children2, _toConsumableArray(args));
435
+ _children2;
436
+ (_children2 = subtable.children)[type].apply(_children2, _toConsumableArray(args));
531
437
  this.runtime.getFlatInstances();
532
438
  }
533
439
  break;
534
440
  default:
535
441
  var // @ts-ignore
536
- _subtable_children3;
537
- (_subtable_children3 = subtable.children)[type].apply(_subtable_children3, _toConsumableArray(args));
442
+ _children3;
443
+ (_children3 = subtable.children)[type].apply(_children3, _toConsumableArray(args));
538
444
  this.runtime.getFlatInstances();
539
445
  break;
540
446
  }
@@ -570,7 +476,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
570
476
  var options = eventOptionsTemp || {};
571
477
  if (_instanceof(instance, RuntimeListControl)) {
572
478
  var // @ts-ignore
573
- _instance_children;
479
+ _children;
574
480
  instance.children.length = 0;
575
481
  var newValue = value;
576
482
  // @ts-ignore
@@ -580,7 +486,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
580
486
  var row = this.listControlCreateRow(instance, "subtable-row");
581
487
  row && newRows.push(row);
582
488
  }
583
- (_instance_children = instance.children).push.apply(_instance_children, _toConsumableArray(newRows));
489
+ (_children = instance.children).push.apply(_children, _toConsumableArray(newRows));
584
490
  this.runtime.getFlatInstances();
585
491
  // 这里已经能拿到控件实例,所以在这里触发setStates,触发每一行每一个控件的change事件
586
492
  // for (let i = 0; i < newValue.length; i++) {
@@ -612,8 +518,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
612
518
  if (this.__pluginsApplied) return;
613
519
  this.__plugins.forEach(function(plugin) {
614
520
  try {
615
- var _plugin_pluginName;
616
- applyingPluginName = (_plugin_pluginName = plugin.pluginName) !== null && _plugin_pluginName !== void 0 ? _plugin_pluginName : plugin.constructor.name;
521
+ var _pluginName;
522
+ applyingPluginName = (_pluginName = plugin.pluginName) !== null && _pluginName !== void 0 ? _pluginName : plugin.constructor.name;
617
523
  plugin.apply(_this);
618
524
  } catch (e) {
619
525
  error("".concat(applyingPluginName, " Plugin apply Error \n ").concat(e));
@@ -627,11 +533,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
627
533
  var row = this.runtime.createControlInstance(rowType);
628
534
  if (!row) return;
629
535
  if (_instanceof(row, RuntimeLayoutControl)) {
630
- var _row_children;
536
+ var _children;
631
537
  var template = JSONCopy(instance.props.headers);
632
538
  // @ts-ignore
633
539
  var columns = this.createControl(template);
634
- (_row_children = row.children).push.apply(_row_children, _toConsumableArray(columns));
540
+ (_children = row.children).push.apply(_children, _toConsumableArray(columns));
635
541
  }
636
542
  return row;
637
543
  };
@@ -648,40 +554,37 @@ var Engine = /*#__PURE__*/ function(Watcher) {
648
554
  var _this1 = this, _superprop_get_emit = function() {
649
555
  return _get(_getPrototypeOf(Engine.prototype), "emit", _this);
650
556
  };
651
- return _asyncToGenerator(function() {
557
+ return _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime.mark(function _callee() {
652
558
  var needWait, promiseResolver, promise, results;
653
- return __generator(this, function(_state) {
654
- switch(_state.label){
559
+ return regeneratorRuntime.wrap(function _callee$(_ctx) {
560
+ while(1)switch(_ctx.prev = _ctx.next){
655
561
  case 0:
656
- if (!(eventKey === "engine-mounted")) return [
657
- 3,
658
- 3
659
- ];
660
- if (_this1.isMounted) {
661
- warn("The engine-mounted life cycle can only be triggered once");
662
- return [
663
- 2,
664
- Promise.resolve([])
665
- ];
562
+ if (!(eventKey === "engine-mounted")) {
563
+ _ctx.next = 11;
564
+ break;
565
+ }
566
+ if (!_this1.isMounted) {
567
+ _ctx.next = 4;
568
+ break;
569
+ }
570
+ warn("The engine-mounted life cycle can only be triggered once");
571
+ return _ctx.abrupt("return", Promise.resolve([]));
572
+ case 4:
573
+ if (!_this1._jobTasks.length) {
574
+ _ctx.next = 10;
575
+ break;
666
576
  }
667
- if (!_this1._jobTasks.length) return [
668
- 3,
669
- 2
670
- ];
671
577
  console.time("engine-mounted need wait");
672
578
  needWait = _toConsumableArray(_this1._jobTasks);
673
- return [
674
- 4,
675
- Promise.all(needWait)
676
- ];
677
- case 1:
678
- _state.sent();
579
+ _ctx.next = 9;
580
+ return Promise.all(needWait);
581
+ case 9:
679
582
  console.timeEnd("engine-mounted need wait");
680
- _state.label = 2;
681
- case 2:
583
+ case 10:
682
584
  _this1.isMounted = true;
683
- _state.label = 3;
684
- case 3:
585
+ case 11:
586
+ ;
587
+ ;
685
588
  // 如果没有挂载的话,需要记录在挂载之前触发的所有任务
686
589
  if (!_this1.isMounted) {
687
590
  promise = new Promise(function(resolve) {
@@ -689,24 +592,22 @@ var Engine = /*#__PURE__*/ function(Watcher) {
689
592
  });
690
593
  _this1._jobTasks.push(promise);
691
594
  }
692
- return [
693
- 4,
694
- _superprop_get_emit().call(_this1, eventKey, payload)
695
- ];
696
- case 4:
697
- results = _state.sent();
595
+ _ctx.next = 16;
596
+ return _superprop_get_emit().call(_this1, eventKey, payload);
597
+ case 16:
598
+ results = _ctx.sent;
698
599
  if (promiseResolver && promise) {
699
600
  // 每一个任务完成的时候,都把自己从task中去掉
700
601
  promiseResolver();
701
602
  _this1._jobTasks.splice(_this1._jobTasks.indexOf(promise), 1);
702
603
  }
703
- return [
704
- 2,
705
- results
706
- ];
604
+ return _ctx.abrupt("return", results);
605
+ case 19:
606
+ case "end":
607
+ return _ctx.stop();
707
608
  }
708
- });
709
- })();
609
+ }, _callee);
610
+ }))();
710
611
  };
711
612
  _proto.on = function on(key, callback) {
712
613
  if (applyingPluginName) {
@@ -718,8 +619,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
718
619
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
719
620
  args[_key] = arguments[_key];
720
621
  }
721
- var _this_runtime;
722
- return (_this_runtime = this.runtime).createControl.apply(_this_runtime, _toConsumableArray(args));
622
+ var _runtime;
623
+ return (_runtime = this.runtime).createControl.apply(_runtime, _toConsumableArray(args));
723
624
  };
724
625
  _proto.createInstance = function createInstance(type, initSchema) {
725
626
  return this.runtime.createControlInstance(type, initSchema);
@@ -734,16 +635,16 @@ var Engine = /*#__PURE__*/ function(Watcher) {
734
635
  if (controlId === undefined) {
735
636
  return this.runtime.rules;
736
637
  } else {
737
- var _this_runtime_rules_controlId;
738
- return (_this_runtime_rules_controlId = this.runtime.rules[controlId]) === null || _this_runtime_rules_controlId === void 0 ? void 0 : _this_runtime_rules_controlId.fields;
638
+ var ref;
639
+ return (ref = this.runtime.rules[controlId]) === null || ref === void 0 ? void 0 : ref.fields;
739
640
  }
740
641
  };
741
642
  _proto.getAntdRules = function getAntdRules(controlId) {
742
643
  if (controlId === undefined) {
743
644
  return this.runtime.antdRules;
744
645
  } else {
745
- var _this_runtime_antdRules_controlId;
746
- return (_this_runtime_antdRules_controlId = this.runtime.antdRules[controlId]) === null || _this_runtime_antdRules_controlId === void 0 ? void 0 : _this_runtime_antdRules_controlId.fields;
646
+ var ref;
647
+ return (ref = this.runtime.antdRules[controlId]) === null || ref === void 0 ? void 0 : ref.fields;
747
648
  }
748
649
  };
749
650
  _proto.getState = function getState(controlId, rowIndex) {
@@ -844,15 +745,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
844
745
  var data = getFieldData.map(function(item) {
845
746
  var obj = {};
846
747
  for(var key in item){
847
- var _controlIdMapping_controlId_children_key, _controlIdMapping_controlId, _controlIdMapping_controlId_children_key_dataBind, _controlIdMapping_controlId1;
848
- 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) {
849
- var _controlIdMapping_controlId_children_key1;
850
- 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];
851
- } else if ((_controlIdMapping_controlId1 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId1 === void 0 ? void 0 : _controlIdMapping_controlId1.children[key]) {
748
+ var ref, ref1, ref2, ref3;
749
+ if ((ref1 = (ref = controlIdMapping[controlId]) === null || ref === void 0 ? void 0 : ref.children[key]) === null || ref1 === void 0 ? void 0 : (ref2 = ref1.dataBind) === null || ref2 === void 0 ? void 0 : ref2.fieldCode) {
750
+ var ref4;
751
+ obj[(ref4 = controlIdMapping[controlId].children[key]) === null || ref4 === void 0 ? void 0 : ref4.dataBind.fieldCode] = item[key];
752
+ } else if ((ref3 = controlIdMapping[controlId]) === null || ref3 === void 0 ? void 0 : ref3.children[key]) {
852
753
  // 兼容一个控件需要绑定多个字段的情况
853
754
  for(var keyChi in item[key]){
854
- var _controlIdMapping_controlId_children_key2, _controlIdMapping_controlId2;
855
- 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];
755
+ var ref5, ref6;
756
+ 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];
856
757
  }
857
758
  }
858
759
  }
@@ -861,24 +762,24 @@ var Engine = /*#__PURE__*/ function(Watcher) {
861
762
  return data;
862
763
  } else {
863
764
  var _loop = function(key) {
864
- var _controlIdMapping_key, _controlIdMapping_key_dataBind, _controlIdMapping_key1, _controlIdMapping_key_dataBind1;
865
- 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) {
866
- var _controlIdMapping_key2;
867
- obj[(_controlIdMapping_key2 = controlIdMapping[key]) === null || _controlIdMapping_key2 === void 0 ? void 0 : _controlIdMapping_key2.dataBind.fieldCode] = getFieldData[key];
868
- } 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) {
869
- var _controlIdMapping_key3;
765
+ var ref, ref1, ref2, ref3;
766
+ if ((ref = controlIdMapping[key]) === null || ref === void 0 ? void 0 : (ref1 = ref.dataBind) === null || ref1 === void 0 ? void 0 : ref1.fieldCode) {
767
+ var ref4;
768
+ obj[(ref4 = controlIdMapping[key]) === null || ref4 === void 0 ? void 0 : ref4.dataBind.fieldCode] = getFieldData[key];
769
+ } else if ((ref2 = controlIdMapping[key]) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.dataBind) === null || ref3 === void 0 ? void 0 : ref3.dataCode) {
770
+ var ref5;
870
771
  // 明细字表只循环一层明细子表未递归
871
- obj[(_controlIdMapping_key3 = controlIdMapping[key]) === null || _controlIdMapping_key3 === void 0 ? void 0 : _controlIdMapping_key3.dataBind.dataCode] = getFieldData[key].map(function(item) {
772
+ obj[(ref5 = controlIdMapping[key]) === null || ref5 === void 0 ? void 0 : ref5.dataBind.dataCode] = getFieldData[key].map(function(item) {
872
773
  var objChi = {};
873
774
  for(var keyChi in item){
874
- var _controlIdMapping_key_children_keyChi;
875
- if ((_controlIdMapping_key_children_keyChi = controlIdMapping[key].children[keyChi]) === null || _controlIdMapping_key_children_keyChi === void 0 ? void 0 : _controlIdMapping_key_children_keyChi.dataBind.fieldCode) {
876
- var _controlIdMapping_key_children_keyChi1;
877
- 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];
775
+ var ref;
776
+ if ((ref = controlIdMapping[key].children[keyChi]) === null || ref === void 0 ? void 0 : ref.dataBind.fieldCode) {
777
+ var ref1;
778
+ objChi[(ref1 = controlIdMapping[key].children[keyChi]) === null || ref1 === void 0 ? void 0 : ref1.dataBind.fieldCode] = item[keyChi];
878
779
  } else {
879
780
  for(var keyChi1 in item[keyChi]){
880
- var _controlIdMapping_key_children_keyChi2;
881
- 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];
781
+ var ref2;
782
+ objChi[(ref2 = controlIdMapping[key].children[keyChi]) === null || ref2 === void 0 ? void 0 : ref2.dataBind[keyChi1].fieldCode] = item[keyChi][keyChi1];
882
783
  //
883
784
  }
884
785
  }
@@ -888,8 +789,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
888
789
  } else if (controlIdMapping[key]) {
889
790
  // 兼容一个控件需要绑定多个字段的情况
890
791
  for(var keyChi in getFieldData[key]){
891
- var _controlIdMapping_key_dataBind_keyChi, _controlIdMapping_key4;
892
- 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];
792
+ var ref6, ref7;
793
+ obj[(ref7 = (ref6 = controlIdMapping[key]) === null || ref6 === void 0 ? void 0 : ref6.dataBind[keyChi]) === null || ref7 === void 0 ? void 0 : ref7.fieldCode] = getFieldData[key][keyChi];
893
794
  }
894
795
  }
895
796
  };
@@ -915,8 +816,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
915
816
  }
916
817
  var dataBind = dataBindMapping.dataBind, controlId = dataBindMapping.controlId;
917
818
  if (_instanceof(dataBind, ObjectDataBind)) {
918
- var _JSONCopy;
919
- var oldState = (_JSONCopy = JSONCopy(this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : this.getEmptyState(controlId);
819
+ var ref;
820
+ var oldState = (ref = JSONCopy(this.getState(controlId, rowIndex))) !== null && ref !== void 0 ? ref : this.getEmptyState(controlId);
920
821
  // fieldCode不代表是key,所以需要找到对应的key
921
822
  var newState = Object.entries(dataBind).reduce(function(result, param) {
922
823
  var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
@@ -954,8 +855,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
954
855
  }
955
856
  // 对象类型的值
956
857
  if (_instanceof(dataBind, ObjectDataBind)) {
957
- var _JSONCopy;
958
- var oldState = (_JSONCopy = JSONCopy(_this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : _this.getEmptyState(controlId);
858
+ var ref;
859
+ var oldState = (ref = JSONCopy(_this.getState(controlId, rowIndex))) !== null && ref !== void 0 ? ref : _this.getEmptyState(controlId);
959
860
  // fieldCode不代表是key,所以需要找到对应的key
960
861
  var newState = Object.entries(dataBind).reduce(function(result, param) {
961
862
  var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
@@ -1033,19 +934,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1033
934
  var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1034
935
  ;
1035
936
  Object.keys(row).map(function(fieldCode) {
1036
- var _this_store_dataBindMapping_dataCode, _this_store_dataBindMapping_dataCode_fields;
937
+ var ref, ref1;
1037
938
  if (skipKey.includes(fieldCode)) {
1038
939
  return;
1039
940
  }
1040
- 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) {
941
+ var fieldMapping = (ref = _this.store.dataBindMapping[dataCode]) === null || ref === void 0 ? void 0 : (ref1 = ref.fields) === null || ref1 === void 0 ? void 0 : ref1.find(function(i) {
1041
942
  return i.fieldCode === fieldCode;
1042
943
  });
1043
944
  if (fieldMapping) {
1044
945
  if (_instanceof(fieldMapping.dataBind, DataBind) && row[fieldCode] !== undefined) {
1045
946
  newRow[fieldMapping.controlId] = row[fieldCode];
1046
947
  } else if (_instanceof(fieldMapping.dataBind, ObjectDataBind)) {
1047
- var _this_getEmptyState;
1048
- var objValue = JSONCopy((_this_getEmptyState = _this.getEmptyState(fieldMapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {});
948
+ var ref2;
949
+ var objValue = JSONCopy((ref2 = _this.getEmptyState(fieldMapping.controlId)) !== null && ref2 !== void 0 ? ref2 : {});
1049
950
  Object.keys(fieldMapping.dataBind).map(function(key) {
1050
951
  var dataBind = fieldMapping.dataBind[key];
1051
952
  if (row[dataBind.fieldCode] !== undefined) {
@@ -1080,8 +981,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1080
981
  if (_instanceof(mapping.dataBind, DataBind) && entity[fieldCode] !== undefined) {
1081
982
  newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode];
1082
983
  } else if (_instanceof(mapping.dataBind, ObjectDataBind)) {
1083
- var _this_getEmptyState;
1084
- var objValue = JSONCopy((_this_getEmptyState = _this.getEmptyState(mapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {});
984
+ var ref;
985
+ var objValue = JSONCopy((ref = _this.getEmptyState(mapping.controlId)) !== null && ref !== void 0 ? ref : {});
1085
986
  Object.keys(mapping.dataBind).map(function(key) {
1086
987
  var dataBind = mapping.dataBind[key];
1087
988
  if (entity[dataBind.fieldCode] !== undefined) {
@@ -1149,11 +1050,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1149
1050
  }
1150
1051
  } else {
1151
1052
  var controlIdMapping = this.getControlIdMapping();
1152
- var _Object_entries_find;
1153
- var _ref = _slicedToArray((_Object_entries_find = Object.entries(controlIdMapping).find(function(param) {
1053
+ var ref;
1054
+ var ref1 = _slicedToArray((ref = Object.entries(controlIdMapping).find(function(param) {
1154
1055
  var _param = _slicedToArray(param, 2), _ = _param[0], mapping = _param[1];
1155
1056
  return mapping.children && controlId in mapping.children;
1156
- })) !== null && _Object_entries_find !== void 0 ? _Object_entries_find : [], 1), subtableId = _ref[0];
1057
+ })) !== null && ref !== void 0 ? ref : [], 1), subtableId = ref1[0];
1157
1058
  if (subtableId) {
1158
1059
  var subtable = this.getInstance(subtableId);
1159
1060
  // @ts-ignore
@@ -1307,8 +1208,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1307
1208
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
1308
1209
  args[_key] = arguments[_key];
1309
1210
  }
1310
- var _this_runtime;
1311
- return (_this_runtime = this.runtime).registerControlConfig.apply(_this_runtime, _toConsumableArray(args));
1211
+ var _runtime;
1212
+ return (_runtime = this.runtime).registerControlConfig.apply(_runtime, _toConsumableArray(args));
1312
1213
  };
1313
1214
  _proto.getControlConfig = function getControlConfig(control) {
1314
1215
  return this.runtime.getControlConfig(control);
@@ -18,12 +18,12 @@ var OkWorker = /*#__PURE__*/ function() {
18
18
  });
19
19
  };
20
20
  _proto.destroy = function destroy() {
21
- var _this_worker;
22
- (_this_worker = this.worker) === null || _this_worker === void 0 ? void 0 : _this_worker.terminate();
21
+ var ref;
22
+ (ref = this.worker) === null || ref === void 0 ? void 0 : ref.terminate();
23
23
  };
24
24
  _proto.postMessage = function postMessage(message) {
25
- var _this_worker;
26
- (_this_worker = this.worker) === null || _this_worker === void 0 ? void 0 : _this_worker.postMessage(message);
25
+ var ref;
26
+ (ref = this.worker) === null || ref === void 0 ? void 0 : ref.postMessage(message);
27
27
  };
28
28
  OkWorker.createWorker = function createWorker() {
29
29
  var blob = new Blob([
@@ -64,7 +64,7 @@ var OkWorker = /*#__PURE__*/ function() {
64
64
  // return new Proxy(obj, createHandler(parentKey))
65
65
  // }
66
66
  _self.addEventListener("message", function(event) {
67
- var _event_data = event.data, action = _event_data.action, payload = _event_data.payload, fn = _event_data.fn;
67
+ var _data = event.data, action = _data.action, payload = _data.payload, fn = _data.fn;
68
68
  log(action, payload);
69
69
  // 通过proxy进行代理,每次修改的时候,自动向外抛出postMessage
70
70
  // data.key1 = 1
@@ -30,7 +30,7 @@ var Store = /*#__PURE__*/ function() {
30
30
  "use strict";
31
31
  function Store(props) {
32
32
  _classCallCheck(this, Store);
33
- var _init = init(props.instance), state = _init.state, emptyState = _init.emptyState, databindMapping = _init.databindMapping, controlidMapping = _init.controlidMapping;
33
+ var ref = init(props.instance), state = ref.state, emptyState = ref.emptyState, databindMapping = ref.databindMapping, controlidMapping = ref.controlidMapping;
34
34
  this.emptyState = emptyState;
35
35
  this.state = state;
36
36
  this.dataBindMapping = databindMapping;
@@ -96,8 +96,8 @@ var Store = /*#__PURE__*/ function() {
96
96
  if (children !== undefined) {
97
97
  Object.keys(children).map(function(childControlId) {
98
98
  if (childControlId === controlId) {
99
- var _this_state_dataViewId_subtableId_rowIndex;
100
- state = (_this_state_dataViewId_subtableId_rowIndex = _this.state[dataViewId][subtableId][rowIndex]) === null || _this_state_dataViewId_subtableId_rowIndex === void 0 ? void 0 : _this_state_dataViewId_subtableId_rowIndex[controlId];
99
+ var ref;
100
+ state = (ref = _this.state[dataViewId][subtableId][rowIndex]) === null || ref === void 0 ? void 0 : ref[controlId];
101
101
  }
102
102
  });
103
103
  }
@@ -210,8 +210,8 @@ item) {
210
210
  loopFormSchema(item.props.headers, function(headerItem) {
211
211
  emptyTemplate[headerItem.id] = JSONCopy(headerItem.props.defaultValue);
212
212
  });
213
- var _item_props_defaultRows;
214
- dataViewState[item.id] = new Array((_item_props_defaultRows = item.props.defaultRows) !== null && _item_props_defaultRows !== void 0 ? _item_props_defaultRows : 1).fill(0).map(function() {
213
+ var _defaultRows;
214
+ dataViewState[item.id] = new Array((_defaultRows = item.props.defaultRows) !== null && _defaultRows !== void 0 ? _defaultRows : 1).fill(0).map(function() {
215
215
  return JSONCopy(emptyTemplate);
216
216
  });
217
217
  emptyDataViewState[item.id] = emptyTemplate;
@@ -320,9 +320,9 @@ item) {
320
320
  options: []
321
321
  };
322
322
  loopFormSchema(item.props.headers, function(formControl) {
323
- var _data_item_id;
324
- var _data_item_id_children;
325
- Object.assign((_data_item_id_children = (_data_item_id = data[item.id]) === null || _data_item_id === void 0 ? void 0 : _data_item_id.children) !== null && _data_item_id_children !== void 0 ? _data_item_id_children : {}, _defineProperty({}, formControl.id, {
323
+ var ref;
324
+ var ref1;
325
+ Object.assign((ref1 = (ref = data[item.id]) === null || ref === void 0 ? void 0 : ref.children) !== null && ref1 !== void 0 ? ref1 : {}, _defineProperty({}, formControl.id, {
326
326
  dataBind: formControl.props.dataBind
327
327
  }));
328
328
  });
@@ -520,8 +520,8 @@ function getFieldTypeFromKey(key) {
520
520
  }
521
521
  }
522
522
  export function checkerValue(fieldType, key, value, oldValue) {
523
- var _getFieldTypeFromKey;
524
- var getCheckerFieldType = (_getFieldTypeFromKey = getFieldTypeFromKey(key)) !== null && _getFieldTypeFromKey !== void 0 ? _getFieldTypeFromKey : fieldType;
523
+ var ref;
524
+ var getCheckerFieldType = (ref = getFieldTypeFromKey(key)) !== null && ref !== void 0 ? ref : fieldType;
525
525
  var checker = ValueCheckerFactory.getValueChecker(getCheckerFieldType);
526
526
  if (!checker || checker.validate(value)) {
527
527
  return value;