@byteluck-fe/model-driven-engine 2.3.1-beta.2 → 2.3.1-beta.6

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,7 +238,101 @@ function _createSuper(Derived) {
238
238
  return _possibleConstructorReturn(this, result);
239
239
  };
240
240
  }
241
- import regeneratorRuntime from "regenerator-runtime";
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
+ };
242
336
  import { DataBind, ObjectDataBind, RuntimeListControl } from "@byteluck-fe/model-driven-core";
243
337
  import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher } from "@byteluck-fe/model-driven-shared";
244
338
  import { Runtime } from "./Runtime";
@@ -274,8 +368,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
274
368
  _this._jobTasks = [];
275
369
  _this.createControlInstance = _this.createInstance;
276
370
  _this.$options = Object.freeze(props);
277
- 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,
278
- language, language = _language === void 0 ? DEFAULT_LOCALE : _language, _debug = _$options.debug, debug = _debug === void 0 ? false : _debug;
371
+ 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,
372
+ 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;
279
373
  RulesMessage.setLocale(language);
280
374
  _this.debug = debug;
281
375
  _this.runtime = new Runtime({
@@ -309,13 +403,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
309
403
  for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
310
404
  arg[_key] = arguments[_key];
311
405
  }
312
- var _runtime;
313
- (_runtime = this.runtime).register.apply(_runtime, _toConsumableArray(arg));
406
+ var _this_runtime;
407
+ (_this_runtime = this.runtime).register.apply(_this_runtime, _toConsumableArray(arg));
314
408
  return this;
315
409
  };
316
410
  _proto.mount = function mount() {
317
411
  this.debugLog("engine的mount方法开始调用");
318
- var _$options = this.$options, _plugins = _$options.plugins, plugins = _plugins === void 0 ? [] : _plugins;
412
+ var _this_$options = this.$options, _this_$options_plugins = _this_$options.plugins, plugins = _this_$options_plugins === void 0 ? [] : _this_$options_plugins;
319
413
  this._handlerProxyState();
320
414
  this.__plugins = plugins;
321
415
  this.applyPlugins();
@@ -405,17 +499,17 @@ var Engine = /*#__PURE__*/ function(Watcher) {
405
499
  switch(type){
406
500
  case "push":
407
501
  case "unshift":
408
- var _children;
502
+ var _subtable_children;
409
503
  var newRowLengths = args.length;
410
504
  createdNewRows = createRows(newRowLengths);
411
505
  createdNewRowsData = args;
412
- (_children = subtable.children)[type].apply(_children, _toConsumableArray(createdNewRows));
506
+ (_subtable_children = subtable.children)[type].apply(_subtable_children, _toConsumableArray(createdNewRows));
413
507
  this.runtime.getFlatInstances();
414
508
  break;
415
509
  case "splice":
416
510
  if (args.length > 2) {
417
511
  var // @ts-ignore
418
- _children1;
512
+ _subtable_children1;
419
513
  var newRowLengths1 = args.length - 2;
420
514
  var newValues = args.slice(2);
421
515
  createdNewRows = createRows(newRowLengths1);
@@ -424,7 +518,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
424
518
  var start = args[0];
425
519
  // 替换几个
426
520
  var replace = args[1];
427
- (_children1 = subtable.children)[type].apply(_children1, [
521
+ (_subtable_children1 = subtable.children)[type].apply(_subtable_children1, [
428
522
  start,
429
523
  replace
430
524
  ].concat(_toConsumableArray(createdNewRows)));
@@ -435,15 +529,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
435
529
  // })
436
530
  } else {
437
531
  var // @ts-ignore
438
- _children2;
439
- (_children2 = subtable.children)[type].apply(_children2, _toConsumableArray(args));
532
+ _subtable_children2;
533
+ (_subtable_children2 = subtable.children)[type].apply(_subtable_children2, _toConsumableArray(args));
440
534
  this.runtime.getFlatInstances();
441
535
  }
442
536
  break;
443
537
  default:
444
538
  var // @ts-ignore
445
- _children3;
446
- (_children3 = subtable.children)[type].apply(_children3, _toConsumableArray(args));
539
+ _subtable_children3;
540
+ (_subtable_children3 = subtable.children)[type].apply(_subtable_children3, _toConsumableArray(args));
447
541
  this.runtime.getFlatInstances();
448
542
  break;
449
543
  }
@@ -481,7 +575,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
481
575
  // if (instance instanceof RuntimeListControl) {
482
576
  if (instance.controlType === CONTROL_BASE_TYPE.LIST) {
483
577
  var // @ts-ignore
484
- _children;
578
+ _instance_children;
485
579
  instance.children.length = 0;
486
580
  var newValue = value;
487
581
  // @ts-ignore
@@ -491,7 +585,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
491
585
  var row = this.listControlCreateRow(instance, "subtable-row");
492
586
  row && newRows.push(row);
493
587
  }
494
- (_children = instance.children).push.apply(_children, _toConsumableArray(newRows));
588
+ (_instance_children = instance.children).push.apply(_instance_children, _toConsumableArray(newRows));
495
589
  this.runtime.getFlatInstances();
496
590
  // 这里已经能拿到控件实例,所以在这里触发setStates,触发每一行每一个控件的change事件
497
591
  // for (let i = 0; i < newValue.length; i++) {
@@ -523,8 +617,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
523
617
  if (this.__pluginsApplied) return;
524
618
  this.__plugins.forEach(function(plugin) {
525
619
  try {
526
- var _pluginName;
527
- applyingPluginName = (_pluginName = plugin.pluginName) !== null && _pluginName !== void 0 ? _pluginName : plugin.constructor.name;
620
+ var _plugin_pluginName;
621
+ applyingPluginName = (_plugin_pluginName = plugin.pluginName) !== null && _plugin_pluginName !== void 0 ? _plugin_pluginName : plugin.constructor.name;
528
622
  plugin.apply(_this);
529
623
  } catch (e) {
530
624
  error("".concat(applyingPluginName, " Plugin apply Error \n ").concat(e));
@@ -540,12 +634,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
540
634
  // if (row instanceof RuntimeLayoutControl) {
541
635
  // @ts-ignore
542
636
  if (row.controlType === CONTROL_BASE_TYPE.LAYOUT) {
543
- var _children;
637
+ var _inst_children;
544
638
  var inst = row;
545
639
  var template = JSONCopy(instance.props.headers);
546
640
  // @ts-ignore
547
641
  var columns = this.createControl(template);
548
- (_children = inst.children).push.apply(_children, _toConsumableArray(columns));
642
+ (_inst_children = inst.children).push.apply(_inst_children, _toConsumableArray(columns));
549
643
  }
550
644
  return row;
551
645
  };
@@ -562,37 +656,40 @@ var Engine = /*#__PURE__*/ function(Watcher) {
562
656
  var _this1 = this, _superprop_get_emit = function() {
563
657
  return _get(_getPrototypeOf(Engine.prototype), "emit", _this);
564
658
  };
565
- return _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime.mark(function _callee() {
659
+ return _asyncToGenerator(function() {
566
660
  var needWait, promiseResolver, promise, results;
567
- return regeneratorRuntime.wrap(function _callee$(_ctx) {
568
- while(1)switch(_ctx.prev = _ctx.next){
661
+ return __generator(this, function(_state) {
662
+ switch(_state.label){
569
663
  case 0:
570
- if (!(eventKey === "engine-mounted")) {
571
- _ctx.next = 11;
572
- break;
573
- }
574
- if (!_this1.isMounted) {
575
- _ctx.next = 4;
576
- break;
577
- }
578
- warn("The engine-mounted life cycle can only be triggered once");
579
- return _ctx.abrupt("return", Promise.resolve([]));
580
- case 4:
581
- if (!_this1._jobTasks.length) {
582
- _ctx.next = 10;
583
- break;
664
+ if (!(eventKey === "engine-mounted")) return [
665
+ 3,
666
+ 3
667
+ ];
668
+ if (_this1.isMounted) {
669
+ warn("The engine-mounted life cycle can only be triggered once");
670
+ return [
671
+ 2,
672
+ Promise.resolve([])
673
+ ];
584
674
  }
675
+ if (!_this1._jobTasks.length) return [
676
+ 3,
677
+ 2
678
+ ];
585
679
  console.time("engine-mounted need wait");
586
680
  needWait = _toConsumableArray(_this1._jobTasks);
587
- _ctx.next = 9;
588
- return Promise.all(needWait);
589
- case 9:
681
+ return [
682
+ 4,
683
+ Promise.all(needWait)
684
+ ];
685
+ case 1:
686
+ _state.sent();
590
687
  console.timeEnd("engine-mounted need wait");
591
- case 10:
688
+ _state.label = 2;
689
+ case 2:
592
690
  _this1.isMounted = true;
593
- case 11:
594
- ;
595
- ;
691
+ _state.label = 3;
692
+ case 3:
596
693
  // 如果没有挂载的话,需要记录在挂载之前触发的所有任务
597
694
  if (!_this1.isMounted) {
598
695
  promise = new Promise(function(resolve) {
@@ -600,22 +697,24 @@ var Engine = /*#__PURE__*/ function(Watcher) {
600
697
  });
601
698
  _this1._jobTasks.push(promise);
602
699
  }
603
- _ctx.next = 16;
604
- return _superprop_get_emit().call(_this1, eventKey, payload);
605
- case 16:
606
- results = _ctx.sent;
700
+ return [
701
+ 4,
702
+ _superprop_get_emit().call(_this1, eventKey, payload)
703
+ ];
704
+ case 4:
705
+ results = _state.sent();
607
706
  if (promiseResolver && promise) {
608
707
  // 每一个任务完成的时候,都把自己从task中去掉
609
708
  promiseResolver();
610
709
  _this1._jobTasks.splice(_this1._jobTasks.indexOf(promise), 1);
611
710
  }
612
- return _ctx.abrupt("return", results);
613
- case 19:
614
- case "end":
615
- return _ctx.stop();
711
+ return [
712
+ 2,
713
+ results
714
+ ];
616
715
  }
617
- }, _callee);
618
- }))();
716
+ });
717
+ })();
619
718
  };
620
719
  _proto.on = function on(key, callback) {
621
720
  if (applyingPluginName) {
@@ -627,8 +726,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
627
726
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
628
727
  args[_key] = arguments[_key];
629
728
  }
630
- var _runtime;
631
- return (_runtime = this.runtime).createControl.apply(_runtime, _toConsumableArray(args));
729
+ var _this_runtime;
730
+ return (_this_runtime = this.runtime).createControl.apply(_this_runtime, _toConsumableArray(args));
632
731
  };
633
732
  _proto.createInstance = function createInstance(type, initSchema) {
634
733
  return this.runtime.createControlInstance(type, initSchema);
@@ -644,10 +743,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
644
743
  if (controlId === undefined) {
645
744
  return rules;
646
745
  } else {
647
- var ref, ref1;
746
+ var _rules_rules_controlId, _rules_antdRules_controlId;
648
747
  return {
649
- rules: (ref = rules.rules[controlId]) === null || ref === void 0 ? void 0 : ref.fields,
650
- antdRules: (ref1 = rules.antdRules[controlId]) === null || ref1 === void 0 ? void 0 : ref1.fields
748
+ rules: (_rules_rules_controlId = rules.rules[controlId]) === null || _rules_rules_controlId === void 0 ? void 0 : _rules_rules_controlId.fields,
749
+ antdRules: (_rules_antdRules_controlId = rules.antdRules[controlId]) === null || _rules_antdRules_controlId === void 0 ? void 0 : _rules_antdRules_controlId.fields
651
750
  };
652
751
  }
653
752
  };
@@ -655,16 +754,16 @@ var Engine = /*#__PURE__*/ function(Watcher) {
655
754
  if (controlId === undefined) {
656
755
  return this.runtime.rules;
657
756
  } else {
658
- var ref;
659
- return (ref = this.runtime.rules[controlId]) === null || ref === void 0 ? void 0 : ref.fields;
757
+ var _this_runtime_rules_controlId;
758
+ return (_this_runtime_rules_controlId = this.runtime.rules[controlId]) === null || _this_runtime_rules_controlId === void 0 ? void 0 : _this_runtime_rules_controlId.fields;
660
759
  }
661
760
  };
662
761
  _proto.getAntdRules = function getAntdRules(controlId) {
663
762
  if (controlId === undefined) {
664
763
  return this.runtime.antdRules;
665
764
  } else {
666
- var ref;
667
- return (ref = this.runtime.antdRules[controlId]) === null || ref === void 0 ? void 0 : ref.fields;
765
+ var _this_runtime_antdRules_controlId;
766
+ return (_this_runtime_antdRules_controlId = this.runtime.antdRules[controlId]) === null || _this_runtime_antdRules_controlId === void 0 ? void 0 : _this_runtime_antdRules_controlId.fields;
668
767
  }
669
768
  };
670
769
  _proto.getState = function getState(controlId, rowIndex) {
@@ -765,15 +864,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
765
864
  var data = getFieldData.map(function(item) {
766
865
  var obj = {};
767
866
  for(var key in item){
768
- var ref, ref1, ref2, ref3;
769
- 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) {
770
- var ref4;
771
- obj[(ref4 = controlIdMapping[controlId].children[key]) === null || ref4 === void 0 ? void 0 : ref4.dataBind.fieldCode] = item[key];
772
- } else if ((ref3 = controlIdMapping[controlId]) === null || ref3 === void 0 ? void 0 : ref3.children[key]) {
867
+ var _controlIdMapping_controlId_children_key, _controlIdMapping_controlId, _controlIdMapping_controlId_children_key_dataBind, _controlIdMapping_controlId1;
868
+ 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) {
869
+ var _controlIdMapping_controlId_children_key1;
870
+ 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];
871
+ } else if ((_controlIdMapping_controlId1 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId1 === void 0 ? void 0 : _controlIdMapping_controlId1.children[key]) {
773
872
  // 兼容一个控件需要绑定多个字段的情况
774
873
  for(var keyChi in item[key]){
775
- var ref5, ref6;
776
- 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];
874
+ var _controlIdMapping_controlId_children_key2, _controlIdMapping_controlId2;
875
+ 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];
777
876
  }
778
877
  }
779
878
  }
@@ -782,24 +881,24 @@ var Engine = /*#__PURE__*/ function(Watcher) {
782
881
  return data;
783
882
  } else {
784
883
  var _loop = function(key) {
785
- var ref, ref1, ref2, ref3;
786
- if ((ref = controlIdMapping[key]) === null || ref === void 0 ? void 0 : (ref1 = ref.dataBind) === null || ref1 === void 0 ? void 0 : ref1.fieldCode) {
787
- var ref4;
788
- obj[(ref4 = controlIdMapping[key]) === null || ref4 === void 0 ? void 0 : ref4.dataBind.fieldCode] = getFieldData[key];
789
- } else if ((ref2 = controlIdMapping[key]) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.dataBind) === null || ref3 === void 0 ? void 0 : ref3.dataCode) {
790
- var ref5;
884
+ var _controlIdMapping_key, _controlIdMapping_key_dataBind, _controlIdMapping_key1, _controlIdMapping_key_dataBind1;
885
+ 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) {
886
+ var _controlIdMapping_key2;
887
+ obj[(_controlIdMapping_key2 = controlIdMapping[key]) === null || _controlIdMapping_key2 === void 0 ? void 0 : _controlIdMapping_key2.dataBind.fieldCode] = getFieldData[key];
888
+ } 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) {
889
+ var _controlIdMapping_key3;
791
890
  // 明细字表只循环一层明细子表未递归
792
- obj[(ref5 = controlIdMapping[key]) === null || ref5 === void 0 ? void 0 : ref5.dataBind.dataCode] = getFieldData[key].map(function(item) {
891
+ obj[(_controlIdMapping_key3 = controlIdMapping[key]) === null || _controlIdMapping_key3 === void 0 ? void 0 : _controlIdMapping_key3.dataBind.dataCode] = getFieldData[key].map(function(item) {
793
892
  var objChi = {};
794
893
  for(var keyChi in item){
795
- var ref;
796
- if ((ref = controlIdMapping[key].children[keyChi]) === null || ref === void 0 ? void 0 : ref.dataBind.fieldCode) {
797
- var ref1;
798
- objChi[(ref1 = controlIdMapping[key].children[keyChi]) === null || ref1 === void 0 ? void 0 : ref1.dataBind.fieldCode] = item[keyChi];
894
+ var _controlIdMapping_key_children_keyChi;
895
+ if ((_controlIdMapping_key_children_keyChi = controlIdMapping[key].children[keyChi]) === null || _controlIdMapping_key_children_keyChi === void 0 ? void 0 : _controlIdMapping_key_children_keyChi.dataBind.fieldCode) {
896
+ var _controlIdMapping_key_children_keyChi1;
897
+ 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];
799
898
  } else {
800
899
  for(var keyChi1 in item[keyChi]){
801
- var ref2;
802
- objChi[(ref2 = controlIdMapping[key].children[keyChi]) === null || ref2 === void 0 ? void 0 : ref2.dataBind[keyChi1].fieldCode] = item[keyChi][keyChi1];
900
+ var _controlIdMapping_key_children_keyChi2;
901
+ 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];
803
902
  //
804
903
  }
805
904
  }
@@ -809,8 +908,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
809
908
  } else if (controlIdMapping[key]) {
810
909
  // 兼容一个控件需要绑定多个字段的情况
811
910
  for(var keyChi in getFieldData[key]){
812
- var ref6, ref7;
813
- 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];
911
+ var _controlIdMapping_key_dataBind_keyChi, _controlIdMapping_key4;
912
+ 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];
814
913
  }
815
914
  }
816
915
  };
@@ -836,8 +935,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
836
935
  }
837
936
  var dataBind = dataBindMapping.dataBind, controlId = dataBindMapping.controlId;
838
937
  if (_instanceof(dataBind, ObjectDataBind)) {
839
- var ref;
840
- var oldState = (ref = JSONCopy(this.getState(controlId, rowIndex))) !== null && ref !== void 0 ? ref : this.getEmptyState(controlId);
938
+ var _JSONCopy;
939
+ var oldState = (_JSONCopy = JSONCopy(this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : this.getEmptyState(controlId);
841
940
  // fieldCode不代表是key,所以需要找到对应的key
842
941
  var newState = Object.entries(dataBind).reduce(function(result, param) {
843
942
  var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
@@ -875,8 +974,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
875
974
  }
876
975
  // 对象类型的值
877
976
  if (_instanceof(dataBind, ObjectDataBind)) {
878
- var ref;
879
- var oldState = (ref = JSONCopy(_this.getState(controlId, rowIndex))) !== null && ref !== void 0 ? ref : _this.getEmptyState(controlId);
977
+ var _JSONCopy;
978
+ var oldState = (_JSONCopy = JSONCopy(_this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : _this.getEmptyState(controlId);
880
979
  // fieldCode不代表是key,所以需要找到对应的key
881
980
  var newState = Object.entries(dataBind).reduce(function(result, param) {
882
981
  var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
@@ -954,19 +1053,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
954
1053
  var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
955
1054
  ;
956
1055
  Object.keys(row).map(function(fieldCode) {
957
- var ref, ref1;
1056
+ var _this_store_dataBindMapping_dataCode, _this_store_dataBindMapping_dataCode_fields;
958
1057
  if (skipKey.includes(fieldCode)) {
959
1058
  return;
960
1059
  }
961
- 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) {
1060
+ 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) {
962
1061
  return i.fieldCode === fieldCode;
963
1062
  });
964
1063
  if (fieldMapping) {
965
1064
  if (_instanceof(fieldMapping.dataBind, DataBind) && row[fieldCode] !== undefined) {
966
1065
  newRow[fieldMapping.controlId] = row[fieldCode];
967
1066
  } else if (_instanceof(fieldMapping.dataBind, ObjectDataBind)) {
968
- var ref2;
969
- var objValue = JSONCopy((ref2 = _this.getEmptyState(fieldMapping.controlId)) !== null && ref2 !== void 0 ? ref2 : {});
1067
+ var _this_getEmptyState;
1068
+ var objValue = JSONCopy((_this_getEmptyState = _this.getEmptyState(fieldMapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {});
970
1069
  Object.keys(fieldMapping.dataBind).map(function(key) {
971
1070
  var dataBind = fieldMapping.dataBind[key];
972
1071
  if (row[dataBind.fieldCode] !== undefined) {
@@ -1001,8 +1100,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1001
1100
  if (_instanceof(mapping.dataBind, DataBind) && entity[fieldCode] !== undefined) {
1002
1101
  newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode];
1003
1102
  } else if (_instanceof(mapping.dataBind, ObjectDataBind)) {
1004
- var ref;
1005
- var objValue = JSONCopy((ref = _this.getEmptyState(mapping.controlId)) !== null && ref !== void 0 ? ref : {});
1103
+ var _this_getEmptyState;
1104
+ var objValue = JSONCopy((_this_getEmptyState = _this.getEmptyState(mapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {});
1006
1105
  Object.keys(mapping.dataBind).map(function(key) {
1007
1106
  var dataBind = mapping.dataBind[key];
1008
1107
  if (entity[dataBind.fieldCode] !== undefined) {
@@ -1071,11 +1170,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1071
1170
  }
1072
1171
  } else {
1073
1172
  var controlIdMapping = this.getControlIdMapping();
1074
- var ref;
1075
- var ref1 = _slicedToArray((ref = Object.entries(controlIdMapping).find(function(param) {
1173
+ var _Object_entries_find;
1174
+ var _ref = _slicedToArray((_Object_entries_find = Object.entries(controlIdMapping).find(function(param) {
1076
1175
  var _param = _slicedToArray(param, 2), _ = _param[0], mapping = _param[1];
1077
1176
  return mapping.children && controlId in mapping.children;
1078
- })) !== null && ref !== void 0 ? ref : [], 1), subtableId = ref1[0];
1177
+ })) !== null && _Object_entries_find !== void 0 ? _Object_entries_find : [], 1), subtableId = _ref[0];
1079
1178
  if (subtableId) {
1080
1179
  var subtable = this.getInstance(subtableId);
1081
1180
  // @ts-ignore
@@ -1099,24 +1198,42 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1099
1198
  return instances;
1100
1199
  };
1101
1200
  _proto.setInstance = function setInstance(instance, props, value, rowIndex) {
1201
+ var _this = this;
1102
1202
  try {
1103
- var _instance;
1104
- if (typeof instance === "string") {
1105
- _instance = this.getInstance(instance, rowIndex);
1203
+ if (typeof instance === "string" && rowIndex === -1) {
1204
+ //修改明细表整列属性的逻辑
1205
+ var instances = this.getInstances(instance, rowIndex === -1);
1206
+ instances.map(function(_instance) {
1207
+ if (_instance) {
1208
+ _this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
1209
+ updateValueFromKeys(_instance.props, props, value);
1210
+ _this.schemaEvent("schema-change", {
1211
+ instance: _instance,
1212
+ props: props,
1213
+ value: value,
1214
+ rowIndex: rowIndex
1215
+ });
1216
+ }
1217
+ });
1106
1218
  } else {
1107
- _instance = instance;
1108
- }
1109
- if (!_instance) {
1110
- return;
1219
+ var _instance;
1220
+ if (typeof instance === "string") {
1221
+ _instance = this.getInstance(instance, rowIndex);
1222
+ } else {
1223
+ _instance = instance;
1224
+ }
1225
+ if (!_instance) {
1226
+ return;
1227
+ }
1228
+ this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
1229
+ updateValueFromKeys(_instance.props, props, value);
1230
+ this.schemaEvent("schema-change", {
1231
+ instance: _instance,
1232
+ props: props,
1233
+ value: value,
1234
+ rowIndex: rowIndex
1235
+ });
1111
1236
  }
1112
- this.debugLog("[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
1113
- updateValueFromKeys(_instance.props, props, value);
1114
- this.schemaEvent("schema-change", {
1115
- instance: _instance,
1116
- props: props,
1117
- value: value,
1118
- rowIndex: rowIndex
1119
- });
1120
1237
  } catch (e) {
1121
1238
  throw e;
1122
1239
  }
@@ -1231,8 +1348,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1231
1348
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
1232
1349
  args[_key] = arguments[_key];
1233
1350
  }
1234
- var _runtime;
1235
- return (_runtime = this.runtime).registerControlConfig.apply(_runtime, _toConsumableArray(args));
1351
+ var _this_runtime;
1352
+ return (_this_runtime = this.runtime).registerControlConfig.apply(_this_runtime, _toConsumableArray(args));
1236
1353
  };
1237
1354
  _proto.getControlConfig = function getControlConfig(control) {
1238
1355
  return this.runtime.getControlConfig(control);
@@ -1240,8 +1357,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1240
1357
  _proto.inList = function inList(controlId) {
1241
1358
  var mapping = this.store.controlIdMapping;
1242
1359
  var result = Object.keys(mapping).some(function(key) {
1243
- var ref, ref1;
1244
- return (ref = mapping[key]) === null || ref === void 0 ? void 0 : (ref1 = ref.children) === null || ref1 === void 0 ? void 0 : ref1.hasOwnProperty(controlId);
1360
+ var _mapping_key, _mapping_key_children;
1361
+ 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);
1245
1362
  });
1246
1363
  return result;
1247
1364
  };
@@ -18,12 +18,12 @@ var OkWorker = /*#__PURE__*/ function() {
18
18
  });
19
19
  };
20
20
  _proto.destroy = function destroy() {
21
- var ref;
22
- (ref = this.worker) === null || ref === void 0 ? void 0 : ref.terminate();
21
+ var _this_worker;
22
+ (_this_worker = this.worker) === null || _this_worker === void 0 ? void 0 : _this_worker.terminate();
23
23
  };
24
24
  _proto.postMessage = function postMessage(message) {
25
- var ref;
26
- (ref = this.worker) === null || ref === void 0 ? void 0 : ref.postMessage(message);
25
+ var _this_worker;
26
+ (_this_worker = this.worker) === null || _this_worker === void 0 ? void 0 : _this_worker.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 _data = event.data, action = _data.action, payload = _data.payload, fn = _data.fn;
67
+ var _event_data = event.data, action = _event_data.action, payload = _event_data.payload, fn = _event_data.fn;
68
68
  log(action, payload);
69
69
  // 通过proxy进行代理,每次修改的时候,自动向外抛出postMessage
70
70
  // data.key1 = 1