@byteluck-fe/model-driven-engine 2.8.0-alpha.1e → 2.8.0-alpha.1g

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.
@@ -1237,7 +1237,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1237
1237
  value: function setData(dataSet, options) {
1238
1238
  var _this = this;
1239
1239
  this.debugLog("engine setData方法执行,参数为%o,%o。", dataSet, options);
1240
+ var onlySetData = options === null || options === void 0 ? void 0 : options.onlySetData;
1240
1241
  var newState = this.store.defaultState;
1242
+ if (onlySetData === true) {
1243
+ newState = {};
1244
+ }
1241
1245
  Object.keys(dataSet).map(function(dataCode) {
1242
1246
  var entity = dataSet[dataCode];
1243
1247
  if (Array.isArray(entity)) {
@@ -1460,15 +1464,42 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1460
1464
  // cc.timeEnd(label)
1461
1465
  return this.runtime.flatInstances;
1462
1466
  }
1463
- var instances = this.runtime.instanceMap[controlId] || [];
1467
+ var instances = Array.from(this.runtime.instanceMap[controlId] || []);
1464
1468
  if (header) {
1465
- var instance = instances[0];
1466
- if (instance) {
1467
- var _instance_parent;
1468
- // @ts-ignore
1469
- var parentId = (_instance_parent = instance.parent) === null || _instance_parent === void 0 ? void 0 : _instance_parent.id;
1470
- if (parentId) {
1471
- instances = this.runtime.instanceMap[parentId] || [];
1469
+ // 如果能从flatInstances里边取到,就通过getInstanceInSubtableHeader方法取,取不到则换一种方式
1470
+ if (instances.length) {
1471
+ var instance = instances[0];
1472
+ // if (this.inList(instance.id) === true) {
1473
+ if (this.inList(instance.id) !== undefined) {
1474
+ var headerInstance = this.getInstanceInSubtableHeader(instance);
1475
+ if (headerInstance) {
1476
+ instances.unshift(headerInstance);
1477
+ }
1478
+ }
1479
+ } else {
1480
+ var _this_getControlIdMapping;
1481
+ var controlIdMapping = (_this_getControlIdMapping = this.getControlIdMapping()) !== null && _this_getControlIdMapping !== void 0 ? _this_getControlIdMapping : {};
1482
+ var _Object_entries_find;
1483
+ var _ref = _sliced_to_array((_Object_entries_find = Object.entries(controlIdMapping).find(function(param) {
1484
+ var _param = _sliced_to_array(param, 2), _ = _param[0], mapping = _param[1];
1485
+ return mapping.children && controlId in mapping.children;
1486
+ })) !== null && _Object_entries_find !== void 0 ? _Object_entries_find : [], 1), subtableId = _ref[0];
1487
+ if (subtableId) {
1488
+ var subtable = this.getInstance(subtableId);
1489
+ // @ts-ignore
1490
+ var headerColumn = subtable.props.headers.find(function(column) {
1491
+ return column.children.find(function(item) {
1492
+ return item.id === controlId;
1493
+ });
1494
+ });
1495
+ if (headerColumn) {
1496
+ var headerInstance1 = headerColumn.children.find(function(item) {
1497
+ return item.id === controlId;
1498
+ });
1499
+ if (headerInstance1) {
1500
+ instances.unshift(headerInstance1);
1501
+ }
1502
+ }
1472
1503
  }
1473
1504
  }
1474
1505
  }