@byteluck-fe/model-driven-engine 2.8.0-alpha.1f → 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.
@@ -1464,15 +1464,42 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1464
1464
  // cc.timeEnd(label)
1465
1465
  return this.runtime.flatInstances;
1466
1466
  }
1467
- var instances = this.runtime.instanceMap[controlId] || [];
1467
+ var instances = Array.from(this.runtime.instanceMap[controlId] || []);
1468
1468
  if (header) {
1469
- var instance = instances[0];
1470
- if (instance) {
1471
- var _instance_parent;
1472
- // @ts-ignore
1473
- var parentId = (_instance_parent = instance.parent) === null || _instance_parent === void 0 ? void 0 : _instance_parent.id;
1474
- if (parentId) {
1475
- 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
+ }
1476
1503
  }
1477
1504
  }
1478
1505
  }