@byteluck-fe/model-driven-engine 2.8.0-alpha.1f → 2.8.0-alpha.1h

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.
@@ -649,9 +649,6 @@ var Engine = /*#__PURE__*/ function(Watcher) {
649
649
  // this.setStates(newValue[i], i, options)
650
650
  // }
651
651
  var deleted = oldValue !== null && oldValue !== void 0 ? oldValue : [];
652
- if ((eventOptionsTemp === null || eventOptionsTemp === void 0 ? void 0 : eventOptionsTemp.listChange) === "noDelete") {
653
- deleted = [];
654
- }
655
652
  this.emit("list-change", {
656
653
  instance: instance,
657
654
  value: value,
@@ -1360,9 +1357,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1360
1357
  }
1361
1358
  });
1362
1359
  this.debugLog("engine setData方法数据组合完成,参数为%o。", newState);
1363
- this.setStates(newState, undefined, _object_spread({
1364
- listChange: "noDelete"
1365
- }, options));
1360
+ this.setStates(newState, undefined, options);
1366
1361
  this.debugLog("engine setData方法执行完成。");
1367
1362
  }
1368
1363
  },
@@ -1464,15 +1459,42 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1464
1459
  // cc.timeEnd(label)
1465
1460
  return this.runtime.flatInstances;
1466
1461
  }
1467
- var instances = this.runtime.instanceMap[controlId] || [];
1462
+ var instances = Array.from(this.runtime.instanceMap[controlId] || []);
1468
1463
  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] || [];
1464
+ // 如果能从flatInstances里边取到,就通过getInstanceInSubtableHeader方法取,取不到则换一种方式
1465
+ if (instances.length) {
1466
+ var instance = instances[0];
1467
+ // if (this.inList(instance.id) === true) {
1468
+ if (this.inList(instance.id) !== undefined) {
1469
+ var headerInstance = this.getInstanceInSubtableHeader(instance);
1470
+ if (headerInstance) {
1471
+ instances.unshift(headerInstance);
1472
+ }
1473
+ }
1474
+ } else {
1475
+ var _this_getControlIdMapping;
1476
+ var controlIdMapping = (_this_getControlIdMapping = this.getControlIdMapping()) !== null && _this_getControlIdMapping !== void 0 ? _this_getControlIdMapping : {};
1477
+ var _Object_entries_find;
1478
+ var _ref = _sliced_to_array((_Object_entries_find = Object.entries(controlIdMapping).find(function(param) {
1479
+ var _param = _sliced_to_array(param, 2), _ = _param[0], mapping = _param[1];
1480
+ return mapping.children && controlId in mapping.children;
1481
+ })) !== null && _Object_entries_find !== void 0 ? _Object_entries_find : [], 1), subtableId = _ref[0];
1482
+ if (subtableId) {
1483
+ var subtable = this.getInstance(subtableId);
1484
+ // @ts-ignore
1485
+ var headerColumn = subtable.props.headers.find(function(column) {
1486
+ return column.children.find(function(item) {
1487
+ return item.id === controlId;
1488
+ });
1489
+ });
1490
+ if (headerColumn) {
1491
+ var headerInstance1 = headerColumn.children.find(function(item) {
1492
+ return item.id === controlId;
1493
+ });
1494
+ if (headerInstance1) {
1495
+ instances.unshift(headerInstance1);
1496
+ }
1497
+ }
1476
1498
  }
1477
1499
  }
1478
1500
  }
@@ -1630,7 +1652,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1630
1652
  }
1631
1653
  var rowIndex;
1632
1654
  // @ts-ignore
1633
- if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
1655
+ if (this.assertInstance(instance.parent, CONTROL_TYPE.SUBTABLE_COLUMN) && this.assertInstance(instance.parent.parent, CONTROL_TYPE.SUBTABLE)) {
1634
1656
  rowIndex = -1;
1635
1657
  } else {
1636
1658
  var isColumnChild = this.getInstanceParentControl(instance, // @ts-ignore