@byteluck-fe/model-driven-engine 2.7.0-beta.4 → 2.8.0-alpha.1a

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.
@@ -111,13 +111,6 @@ function _inherits(subClass, superClass) {
111
111
  });
112
112
  if (superClass) _set_prototype_of(subClass, superClass);
113
113
  }
114
- function _instanceof(left, right) {
115
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
116
- return !!right[Symbol.hasInstance](left);
117
- } else {
118
- return left instanceof right;
119
- }
120
- }
121
114
  function _iterable_to_array(iter) {
122
115
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
123
116
  }
@@ -347,8 +340,8 @@ function _ts_generator(thisArg, body) {
347
340
  };
348
341
  }
349
342
  }
350
- import { DataBind, ObjectDataBind, RuntimeListControl } from "@byteluck-fe/model-driven-core";
351
- import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher } from "@byteluck-fe/model-driven-shared";
343
+ import { isDataBind } from "@byteluck-fe/model-driven-core";
344
+ import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher, isBuiltInControls } from "@byteluck-fe/model-driven-shared";
352
345
  import { Runtime } from "./Runtime";
353
346
  import { Store } from "./Store";
354
347
  import { findItem, proxyState } from "./proxyState";
@@ -525,7 +518,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
525
518
  value: function _handlerArrayUpdate(state, key, type, args, result) {
526
519
  var _this = this;
527
520
  var subtable = findItem(this.runtime.flatInstances, key, this.runtime.instanceMap);
528
- if (!_instanceof(subtable, RuntimeListControl)) return;
521
+ // if (!(subtable instanceof RuntimeListControl)) return
522
+ if (!((subtable === null || subtable === void 0 ? void 0 : subtable.controlType) === CONTROL_BASE_TYPE.LIST)) return;
529
523
  // 新增多行方法
530
524
  var createRows = function(len) {
531
525
  // @ts-ignore
@@ -543,6 +537,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
543
537
  var createdNewRows = [];
544
538
  var createdNewRowsData = [];
545
539
  var deleted = [];
540
+ var isDeleteLastOne = false;
546
541
  if (type && args) {
547
542
  // const subtableOldLength = subtable.children.length
548
543
  switch(type){
@@ -579,6 +574,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
579
574
  } else {
580
575
  var // @ts-ignore
581
576
  _subtable_children2;
577
+ // 从哪儿开始
578
+ var start1 = args[0];
579
+ // 替换几个
580
+ var replace1 = args[1];
581
+ if (start1 + replace1 === subtable.children.length - 1) {
582
+ isDeleteLastOne = true;
583
+ }
582
584
  (_subtable_children2 = subtable.children)[type].apply(_subtable_children2, _to_consumable_array(args));
583
585
  this.runtime.getFlatInstances();
584
586
  }
@@ -607,7 +609,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
607
609
  changed: createdNewRows,
608
610
  data: createdNewRowsData,
609
611
  deleted: deleted !== null && deleted !== void 0 ? deleted : [],
610
- jsonValue: JSON.stringify(this.getState(subtable.id))
612
+ jsonValue: JSON.stringify(this.getState(subtable.id)),
613
+ isDeleteLastOne: isDeleteLastOne,
614
+ type: type,
615
+ args: args
611
616
  })
612
617
  });
613
618
  // 主动清空本次任务中的options
@@ -650,7 +655,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
650
655
  // @ts-ignore
651
656
  changed: newRows,
652
657
  data: newValue,
653
- deleted: oldValue !== null && oldValue !== void 0 ? oldValue : []
658
+ deleted: oldValue !== null && oldValue !== void 0 ? oldValue : [],
659
+ type: "push"
654
660
  })
655
661
  });
656
662
  } else {
@@ -687,7 +693,32 @@ var Engine = /*#__PURE__*/ function(Watcher) {
687
693
  {
688
694
  key: "listControlCreateRow",
689
695
  value: function listControlCreateRow(instance, rowType) {
690
- var row = this.runtime.createControlInstance(rowType);
696
+ var row;
697
+ if (rowType === "subtable-row") {
698
+ row = {
699
+ children: [],
700
+ controlType: CONTROL_BASE_TYPE.LAYOUT,
701
+ id: genNonDuplicateId(),
702
+ type: "subtable-row",
703
+ props: {
704
+ caption: "",
705
+ isHide: false,
706
+ style: {
707
+ height: "",
708
+ heightConfig: "fill",
709
+ width: "",
710
+ widthConfig: "fill"
711
+ }
712
+ },
713
+ fieldType: undefined,
714
+ customEvents: [],
715
+ pageStatus: 0,
716
+ rules: [],
717
+ parent: undefined
718
+ };
719
+ } else {
720
+ row = this.runtime.createControlInstance(rowType);
721
+ }
691
722
  if (!row) return;
692
723
  // if (row instanceof RuntimeLayoutControl) {
693
724
  // @ts-ignore
@@ -697,8 +728,32 @@ var Engine = /*#__PURE__*/ function(Watcher) {
697
728
  var template = JSONCopy(instance.props.headers);
698
729
  // @ts-ignore
699
730
  var columns = this.createControl(template);
731
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
732
+ try {
733
+ for(var _iterator = columns[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
734
+ var column = _step.value;
735
+ if (!column.parent) {
736
+ this.runtime.resetInstanceParent(column, inst);
737
+ }
738
+ }
739
+ } catch (err) {
740
+ _didIteratorError = true;
741
+ _iteratorError = err;
742
+ } finally{
743
+ try {
744
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
745
+ _iterator.return();
746
+ }
747
+ } finally{
748
+ if (_didIteratorError) {
749
+ throw _iteratorError;
750
+ }
751
+ }
752
+ }
700
753
  (_inst_children = inst.children).push.apply(_inst_children, _to_consumable_array(columns));
701
754
  }
755
+ //@ts-ignore
756
+ row.parent = instance;
702
757
  return row;
703
758
  }
704
759
  },
@@ -818,6 +873,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
818
873
  return this.setInstance(instance, props, value, rowIndex);
819
874
  }
820
875
  },
876
+ {
877
+ key: "getRule",
878
+ value: function getRule(controlType, props) {
879
+ return Runtime.staticGetRules(controlType, props);
880
+ }
881
+ },
821
882
  {
822
883
  key: "getAllRules",
823
884
  value: function getAllRules(controlId) {
@@ -945,7 +1006,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
945
1006
  }
946
1007
  var dataBind = dataBindMapping1.dataBind, controlId1 = dataBindMapping1.controlId;
947
1008
  var state = this.getState(controlId1, rowIndex);
948
- if (_instanceof(dataBind, ObjectDataBind)) {
1009
+ //if (dataBind instanceof ObjectDataBind) {
1010
+ if (!isDataBind(dataBind)) {
949
1011
  return Object.entries(dataBind).reduce(function(result, param) {
950
1012
  var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
951
1013
  // objectDataBind的元素,跳过下一次赋值
@@ -1052,7 +1114,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1052
1114
  return;
1053
1115
  }
1054
1116
  var dataBind = dataBindMapping.dataBind, controlId = dataBindMapping.controlId;
1055
- if (_instanceof(dataBind, ObjectDataBind)) {
1117
+ // if (dataBind instanceof ObjectDataBind) {
1118
+ if (!isDataBind(dataBind)) {
1056
1119
  var _JSONCopy;
1057
1120
  var oldState = (_JSONCopy = JSONCopy(this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : this.getEmptyState(controlId);
1058
1121
  // fieldCode不代表是key,所以需要找到对应的key
@@ -1094,7 +1157,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1094
1157
  return;
1095
1158
  }
1096
1159
  // 对象类型的值
1097
- if (_instanceof(dataBind, ObjectDataBind)) {
1160
+ // if (dataBind instanceof ObjectDataBind) {
1161
+ if (!isDataBind(dataBind)) {
1098
1162
  var _JSONCopy;
1099
1163
  var oldState = (_JSONCopy = JSONCopy(_this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : _this.getEmptyState(controlId);
1100
1164
  // fieldCode不代表是key,所以需要找到对应的key
@@ -1124,7 +1188,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1124
1188
  value: function buildFields(dataCode, state) {
1125
1189
  var _this = this;
1126
1190
  var mapping = this.getDataBindMapping(dataCode);
1127
- if (!mapping) {
1191
+ if (!mapping || !mapping.fields) {
1128
1192
  return;
1129
1193
  }
1130
1194
  var skipKeys = [];
@@ -1138,7 +1202,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1138
1202
  return;
1139
1203
  }
1140
1204
  // 对象类型的值
1141
- if (_instanceof(dataBind, ObjectDataBind)) {
1205
+ // if (dataBind instanceof ObjectDataBind) {
1206
+ if (!isDataBind(dataBind)) {
1142
1207
  var oldState = _this.getEmptyState(controlId);
1143
1208
  // fieldCode不代表是key,所以需要找到对应的key
1144
1209
  result[item.controlId] = Object.entries(dataBind).reduce(function(result, param) {
@@ -1184,24 +1249,34 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1184
1249
  } else {
1185
1250
  newState[mapping.dataViewId][mapping.controlId] = [];
1186
1251
  }
1252
+ var cacheEmptyState = {};
1253
+ var cacheFieldMapping = {};
1187
1254
  entity.map(function(row) {
1188
1255
  var newRow = JSONCopy(_this.store.emptyState[mapping.dataViewId][mapping.controlId]);
1189
1256
  var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1190
1257
  ;
1191
1258
  Object.keys(row).map(function(fieldCode) {
1192
- var _this_store_dataBindMapping_dataCode_fields, _this_store_dataBindMapping_dataCode;
1193
1259
  if (skipKey.includes(fieldCode)) {
1194
1260
  return;
1195
1261
  }
1196
- 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) {
1197
- return i.fieldCode === fieldCode;
1198
- });
1262
+ if (cacheFieldMapping.hasOwnProperty(fieldCode) === false) {
1263
+ var _this_store_dataBindMapping_dataCode_fields, _this_store_dataBindMapping_dataCode;
1264
+ cacheFieldMapping[fieldCode] = (_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) {
1265
+ return i.fieldCode === fieldCode;
1266
+ });
1267
+ }
1268
+ var fieldMapping = cacheFieldMapping[fieldCode];
1199
1269
  if (fieldMapping) {
1200
- if (_instanceof(fieldMapping.dataBind, DataBind) && row[fieldCode] !== undefined) {
1270
+ if (// fieldMapping.dataBind instanceof DataBind &&
1271
+ isDataBind(fieldMapping.dataBind) && row[fieldCode] !== undefined) {
1201
1272
  newRow[fieldMapping.controlId] = row[fieldCode];
1202
- } else if (_instanceof(fieldMapping.dataBind, ObjectDataBind)) {
1203
- var _this_getEmptyState;
1204
- var objValue = JSONCopy((_this_getEmptyState = _this.getEmptyState(fieldMapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {});
1273
+ // } else if (fieldMapping.dataBind instanceof ObjectDataBind) {
1274
+ } else if (!isDataBind(fieldMapping.dataBind)) {
1275
+ if (cacheEmptyState.hasOwnProperty(fieldMapping.controlId) === false) {
1276
+ var _this_getEmptyState;
1277
+ cacheEmptyState[fieldMapping.controlId] = JSONCopy((_this_getEmptyState = _this.getEmptyState(fieldMapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {});
1278
+ }
1279
+ var objValue = cacheEmptyState[fieldMapping.controlId];
1205
1280
  Object.keys(fieldMapping.dataBind).map(function(key) {
1206
1281
  var dataBind = fieldMapping.dataBind[key];
1207
1282
  if (row[dataBind.fieldCode] !== undefined) {
@@ -1232,9 +1307,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1232
1307
  if (!newState[mapping.dataViewId[0]]) {
1233
1308
  newState[mapping.dataViewId[0]] = {};
1234
1309
  }
1235
- if (_instanceof(mapping.dataBind, DataBind) && entity[fieldCode] !== undefined) {
1310
+ if (// mapping.dataBind instanceof DataBind &&
1311
+ isDataBind(mapping.dataBind) && entity[fieldCode] !== undefined) {
1236
1312
  newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode] !== undefined ? entity[fieldCode] : emptyState[mapping.dataViewId[0]][mapping.controlId];
1237
- } else if (_instanceof(mapping.dataBind, ObjectDataBind)) {
1313
+ // } else if (mapping.dataBind instanceof ObjectDataBind) {
1314
+ } else if (!isDataBind(mapping.dataBind)) {
1238
1315
  var _this_getEmptyState;
1239
1316
  var objValue = (_this_getEmptyState = _this.getEmptyState(mapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {};
1240
1317
  Object.keys(mapping.dataBind).map(function(key) {
@@ -1312,7 +1389,59 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1312
1389
  * 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
1313
1390
  * @param controlId
1314
1391
  * @param header 明细表内是否获取表头的控件
1315
- */ key: "getInstances",
1392
+ */ // getInstances(
1393
+ // controlId?: string,
1394
+ // header: boolean = false
1395
+ // ): ControlRuntimeInstance<ControlsKeys>[] {
1396
+ // // const cc = console
1397
+ // // const label = '🐑 genInstances ' + controlId + ' ' + Date.now()
1398
+ // // cc.time(label)
1399
+ //
1400
+ // if (controlId === undefined) {
1401
+ // // cc.timeEnd(label)
1402
+ // return this.runtime.flatInstances
1403
+ // }
1404
+ // const instances = Array.from(this.runtime.instanceMap[controlId] || [])
1405
+ // if (header) {
1406
+ // // 如果能从flatInstances里边取到,就通过getInstanceInSubtableHeader方法取,取不到则换一种方式
1407
+ // if (instances.length) {
1408
+ // const instance: RuntimeControl = instances[0]
1409
+ // // if (this.inList(instance.id) === true) {
1410
+ // if (this.inList(instance.id) !== undefined) {
1411
+ // const headerInstance = this.getInstanceInSubtableHeader(instance)
1412
+ // if (headerInstance) {
1413
+ // instances.unshift(headerInstance)
1414
+ // }
1415
+ // }
1416
+ // } else {
1417
+ // const controlIdMapping = this.getControlIdMapping()
1418
+ // const [subtableId] =
1419
+ // Object.entries(controlIdMapping).find(
1420
+ // ([_, mapping]) => mapping.children && controlId in mapping.children
1421
+ // ) ?? []
1422
+ // if (subtableId) {
1423
+ // const subtable = this.getInstance(subtableId)
1424
+ // // @ts-ignore
1425
+ // const headerColumn = subtable.props.headers.find((column: any) =>
1426
+ // column.children.find((item: any) => item.id === controlId)
1427
+ // )
1428
+ // if (headerColumn) {
1429
+ // const headerInstance = headerColumn.children.find(
1430
+ // (item: any) => item.id === controlId
1431
+ // )
1432
+ // if (headerInstance) {
1433
+ // instances.unshift(
1434
+ // headerInstance as ControlRuntimeInstance<ControlsKeys>
1435
+ // )
1436
+ // }
1437
+ // }
1438
+ // }
1439
+ // }
1440
+ // }
1441
+ // // @ts-ignore
1442
+ // return instances
1443
+ // }
1444
+ key: "getInstances",
1316
1445
  value: function getInstances(controlId) {
1317
1446
  var header = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
1318
1447
  // const cc = console
@@ -1322,41 +1451,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1322
1451
  // cc.timeEnd(label)
1323
1452
  return this.runtime.flatInstances;
1324
1453
  }
1325
- var instances = Array.from(this.runtime.instanceMap[controlId] || []);
1454
+ var instances = this.runtime.instanceMap[controlId] || [];
1326
1455
  if (header) {
1327
- // 如果能从flatInstances里边取到,就通过getInstanceInSubtableHeader方法取,取不到则换一种方式
1328
- if (instances.length) {
1329
- var instance = instances[0];
1330
- if (this.inList(instance.id) !== undefined) {
1331
- var headerInstance = this.getInstanceInSubtableHeader(instance);
1332
- if (headerInstance) {
1333
- instances.unshift(headerInstance);
1334
- }
1335
- }
1336
- } else {
1337
- var _this_getControlIdMapping;
1338
- var controlIdMapping = (_this_getControlIdMapping = this.getControlIdMapping()) !== null && _this_getControlIdMapping !== void 0 ? _this_getControlIdMapping : {};
1339
- var _Object_entries_find;
1340
- var _ref = _sliced_to_array((_Object_entries_find = Object.entries(controlIdMapping).find(function(param) {
1341
- var _param = _sliced_to_array(param, 2), _ = _param[0], mapping = _param[1];
1342
- return mapping.children && controlId in mapping.children;
1343
- })) !== null && _Object_entries_find !== void 0 ? _Object_entries_find : [], 1), subtableId = _ref[0];
1344
- if (subtableId) {
1345
- var subtable = this.getInstance(subtableId);
1346
- // @ts-ignore
1347
- var headerColumn = subtable.props.headers.find(function(column) {
1348
- return column.children.find(function(item) {
1349
- return item.id === controlId;
1350
- });
1351
- });
1352
- if (headerColumn) {
1353
- var headerInstance1 = headerColumn.children.find(function(item) {
1354
- return item.id === controlId;
1355
- });
1356
- if (headerInstance1) {
1357
- instances.unshift(headerInstance1);
1358
- }
1359
- }
1456
+ var instance = instances[0];
1457
+ if (instance) {
1458
+ var _instance_parent;
1459
+ // @ts-ignore
1460
+ var parentId = (_instance_parent = instance.parent) === null || _instance_parent === void 0 ? void 0 : _instance_parent.id;
1461
+ if (parentId) {
1462
+ instances = this.runtime.instanceMap[parentId] || [];
1360
1463
  }
1361
1464
  }
1362
1465
  }
@@ -1464,6 +1567,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1464
1567
  return isString(types) ? instance.type === types : types.includes(instance.type);
1465
1568
  }
1466
1569
  },
1570
+ {
1571
+ key: "assertInstanceIsCustomControl",
1572
+ value: /**
1573
+ * 判断控件或控件类型是一个自定义控件
1574
+ * */ function assertInstanceIsCustomControl(instance) {
1575
+ return !isBuiltInControls(isString(instance) ? instance : instance.type);
1576
+ }
1577
+ },
1467
1578
  {
1468
1579
  key: "getInstanceRowIndex",
1469
1580
  value: /**
@@ -1471,28 +1582,57 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1471
1582
  * 如果控件在表头内,则返回-1
1472
1583
  * 如果控件在表内,则返回行下标
1473
1584
  * 如果控件不在明细表内,则返回undefined
1474
- * */ function getInstanceRowIndex(instance) {
1585
+ * */ // public getInstanceRowIndex(
1586
+ // instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl
1587
+ // ) {
1588
+ // if (!instance.parent) {
1589
+ // return
1590
+ // }
1591
+ // let rowIndex: number | undefined
1592
+ // // @ts-ignore
1593
+ // if (this.assertInstance(instance.parent, CONTROL_TYPE.SUBTABLE)) {
1594
+ // // 表头内的控件
1595
+ // // @ts-ignore
1596
+ // if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
1597
+ // rowIndex = -1
1598
+ // } else {
1599
+ // // @ts-ignore
1600
+ // // const index = instance.parent.children.findIndex(
1601
+ // // (item: any) => item === instance
1602
+ // // )
1603
+ // let instances = this.runtime.instanceMap[instance.id] || []
1604
+ // const index = instances.findIndex((item: any) => item === instance)
1605
+ // if (index > -1) {
1606
+ // rowIndex = index
1607
+ // }
1608
+ // }
1609
+ // } else {
1610
+ // rowIndex = this.getInstanceRowIndex(instance.parent)
1611
+ // }
1612
+ // return rowIndex
1613
+ // }
1614
+ function getInstanceRowIndex(instance) {
1475
1615
  if (!instance.parent) {
1476
1616
  return;
1477
1617
  }
1478
1618
  var rowIndex;
1479
1619
  // @ts-ignore
1480
- if (this.assertInstance(instance.parent, CONTROL_TYPE.SUBTABLE)) {
1481
- // 表头内的控件
1482
- // @ts-ignore
1483
- if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
1484
- rowIndex = -1;
1485
- } else {
1486
- // @ts-ignore
1487
- var index = instance.parent.children.findIndex(function(item) {
1488
- return item === instance;
1489
- });
1490
- if (index > -1) {
1491
- rowIndex = index;
1620
+ if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
1621
+ rowIndex = -1;
1622
+ } else {
1623
+ var isColumnChild = this.getInstanceParentControl(instance, // @ts-ignore
1624
+ CONTROL_TYPE.SUBTABLE_COLUMN);
1625
+ if (isColumnChild) {
1626
+ var instanceList = this.runtime.instanceMap[instance.id];
1627
+ if (Object.prototype.toString.call(instanceList) === "[object Array]") {
1628
+ var index = instanceList.findIndex(function(item) {
1629
+ return item === instance;
1630
+ });
1631
+ if (index > -1) {
1632
+ rowIndex = index;
1633
+ }
1492
1634
  }
1493
1635
  }
1494
- } else {
1495
- rowIndex = this.getInstanceRowIndex(instance.parent);
1496
1636
  }
1497
1637
  return rowIndex;
1498
1638
  }
@@ -1578,12 +1718,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1578
1718
  {
1579
1719
  key: "register",
1580
1720
  value: // 注册外部控件
1581
- function register() {
1582
- for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
1583
- arg[_key] = arguments[_key];
1584
- }
1585
- var _Runtime;
1586
- return (_Runtime = Runtime).register.apply(_Runtime, _to_consumable_array(arg));
1721
+ function register(control) {
1722
+ return Runtime.register(control, "Runtime");
1587
1723
  }
1588
1724
  },
1589
1725
  {
@@ -1595,4 +1731,5 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1595
1731
  ]);
1596
1732
  return Engine;
1597
1733
  }(Watcher);
1734
+ // @ts-ignore
1598
1735
  export { Engine };
@@ -77,7 +77,9 @@ var OkWorker = /*#__PURE__*/ function() {
77
77
  key: "createWorkerFunction",
78
78
  value: function createWorkerFunction() {
79
79
  return function() {
80
- var createHandler = function createHandler(parentKey) {
80
+ log("‍\uD83D\uDE80 worker running");
81
+ var _self = self;
82
+ function createHandler(parentKey) {
81
83
  return {
82
84
  get: function get(target, key, value) {
83
85
  return Reflect.get(target, key, value);
@@ -92,9 +94,7 @@ var OkWorker = /*#__PURE__*/ function() {
92
94
  return Reflect.set(target, key, value);
93
95
  }
94
96
  };
95
- };
96
- log("‍\uD83D\uDE80 worker running");
97
- var _self = self;
97
+ }
98
98
  // function createProxy(
99
99
  // obj: Record<string, unknown> | Array<Record<string, unknown>>,
100
100
  // parentKey?: string