@byteluck-fe/model-driven-engine 2.6.0-alpha.17e → 2.6.0-alpha.17f

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.
@@ -1343,55 +1343,59 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1343
1343
  * 如果控件在表头内,则返回-1
1344
1344
  * 如果控件在表内,则返回行下标
1345
1345
  * 如果控件不在明细表内,则返回undefined
1346
- * */ // public getInstanceRowIndex(
1347
- // instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl
1348
- // ) {
1349
- // if (!instance.parent) {
1350
- // return
1351
- // }
1352
- // let rowIndex: number | undefined
1353
- // // @ts-ignore
1354
- // if (this.assertInstance(instance.parent, CONTROL_TYPE.SUBTABLE)) {
1355
- // // 表头内的控件
1356
- // // @ts-ignore
1357
- // if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
1358
- // rowIndex = -1
1359
- // } else {
1360
- // // @ts-ignore
1361
- // const index = instance.parent.children.findIndex(
1362
- // (item: any) => item === instance
1363
- // )
1364
- // if (index > -1) {
1365
- // rowIndex = index
1366
- // }
1367
- // }
1368
- // } else {
1369
- // rowIndex = this.getInstanceRowIndex(instance.parent)
1370
- // }
1371
- // return rowIndex
1372
- // }
1373
- function getInstanceRowIndex(instance) {
1346
+ * */ function getInstanceRowIndex(instance) {
1347
+ if (!instance.parent) {
1348
+ return;
1349
+ }
1374
1350
  var rowIndex;
1375
1351
  // @ts-ignore
1376
- if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
1377
- rowIndex = -1;
1378
- } else {
1379
- var instanceList = this.runtime.instanceMap[instance.id];
1380
- if (Object.prototype.toString.call(instanceList) === '[object Array]') {
1381
- var index = instanceList.findIndex(function(item) {
1352
+ if (this.assertInstance(instance.parent, CONTROL_TYPE.SUBTABLE) || this.assertInstance(instance.parent, CONTROL_TYPE.SUBTABLE_COLUMN)) {
1353
+ // 表头内的控件
1354
+ // @ts-ignore
1355
+ if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
1356
+ rowIndex = -1;
1357
+ } else {
1358
+ // @ts-ignore
1359
+ // const index = instance.parent.children.findIndex(
1360
+ // (item: any) => item === instance
1361
+ // )
1362
+ var instances = this.runtime.instanceMap[instance.id] || [];
1363
+ var index = instances.findIndex(function(item) {
1382
1364
  return item === instance;
1383
1365
  });
1384
1366
  if (index > -1) {
1385
1367
  rowIndex = index;
1386
1368
  }
1387
1369
  }
1370
+ } else {
1371
+ rowIndex = this.getInstanceRowIndex(instance.parent);
1388
1372
  }
1389
1373
  return rowIndex;
1390
1374
  }
1391
1375
  },
1392
1376
  {
1393
1377
  key: "getInstanceParentControl",
1394
- value: function getInstanceParentControl(instance, controlType) {
1378
+ value: // public getInstanceRowIndex(
1379
+ // instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl
1380
+ // ) {
1381
+ // let rowIndex: number | undefined
1382
+ // // @ts-ignore
1383
+ // if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
1384
+ // rowIndex = -1
1385
+ // }else{
1386
+ // const instanceList = this.runtime.instanceMap[instance.id]
1387
+ // if(Object.prototype.toString.call(instanceList) === '[object Array]'){
1388
+ // const index = instanceList.findIndex(
1389
+ // (item: any) => item === instance
1390
+ // )
1391
+ // if (index > -1) {
1392
+ // rowIndex = index
1393
+ // }
1394
+ // }
1395
+ // }
1396
+ // return rowIndex
1397
+ // }
1398
+ function getInstanceParentControl(instance, controlType) {
1395
1399
  if (!instance.parent) {
1396
1400
  return;
1397
1401
  }
@@ -1485,5 +1489,5 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1485
1489
  ]);
1486
1490
  return Engine;
1487
1491
  }(Watcher);
1492
+ // @ts-ignore
1488
1493
  export { Engine };
1489
- console.log('a');