vxe-table 3.4.7-beta.0 → 3.4.8

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.
@@ -416,7 +416,7 @@ var Methods = {
416
416
  },
417
417
 
418
418
  /**
419
- * 同步 data 数据
419
+ * 同步 data 数据(即将废弃)
420
420
  * 如果用了该方法,那么组件将不再记录增删改的状态,只能自行实现对应逻辑
421
421
  * 对于某些特殊的场景,比如深层树节点元素发生变动时可能会用到
422
422
  */
@@ -439,10 +439,31 @@ var Methods = {
439
439
  return this.handleTableData(true).then(this.updateFooter).then(this.recalculate);
440
440
  },
441
441
  handleTableData: function handleTableData(force) {
442
+ var _this2 = this;
443
+
442
444
  var scrollYLoad = this.scrollYLoad,
443
- scrollYStore = this.scrollYStore;
444
- var fullData = force ? this.updateAfterFullData() : this.afterFullData;
445
- this.tableData = scrollYLoad ? fullData.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullData.slice(0);
445
+ scrollYStore = this.scrollYStore,
446
+ fullDataRowIdData = this.fullDataRowIdData,
447
+ afterFullData = this.afterFullData;
448
+ var fullList = afterFullData; // 是否进行数据处理
449
+
450
+ if (force) {
451
+ // 更新数据,处理筛选和排序
452
+ this.updateAfterFullData(); // 如果为虚拟树,将树结构拍平
453
+
454
+ fullList = this.handleVirtualTreeToList();
455
+ }
456
+
457
+ var tableData = scrollYLoad ? fullList.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullList.slice(0);
458
+ tableData.forEach(function (row, $index) {
459
+ var rowid = getRowid(_this2, row);
460
+ var rest = fullDataRowIdData[rowid];
461
+
462
+ if (rest) {
463
+ rest.$index = $index;
464
+ }
465
+ });
466
+ this.tableData = tableData;
446
467
  return this.$nextTick();
447
468
  },
448
469
  updateScrollYStatus: function updateScrollYStatus(fullData) {
@@ -460,7 +481,7 @@ var Methods = {
460
481
  * @param {Array} datas 数据
461
482
  */
462
483
  loadTableData: function loadTableData(datas) {
463
- var _this2 = this;
484
+ var _this3 = this;
464
485
 
465
486
  var keepSource = this.keepSource,
466
487
  treeConfig = this.treeConfig,
@@ -490,6 +511,14 @@ var Methods = {
490
511
  _tools.UtilTools.error('vxe.error.reqProp', ['tree-config.children']);
491
512
  }
492
513
 
514
+ if (!treeOpts.mapChildren) {
515
+ _tools.UtilTools.error('vxe.error.reqProp', ['tree-config.mapChildren']);
516
+ }
517
+
518
+ if (treeOpts.children === treeOpts.mapChildren) {
519
+ _tools.UtilTools.error('vxe.error.errConflicts', ['tree-config.children', 'tree-config.mapChildren']);
520
+ }
521
+
493
522
  fullData.forEach(function (row) {
494
523
  if (row[treeOpts.children] && row[treeOpts.children].length) {
495
524
  _tools.UtilTools.warn('vxe.error.errConflicts', ['tree-config.transform', "row.".concat(treeOpts.children)]);
@@ -500,7 +529,8 @@ var Methods = {
500
529
  treeData = _xeUtils.default.toArrayTree(fullData, {
501
530
  key: treeOpts.rowField,
502
531
  parentKey: treeOpts.parentField,
503
- children: treeOpts.children
532
+ children: treeOpts.children,
533
+ mapChildren: treeOpts.mapChildren
504
534
  });
505
535
  fullData = treeData.slice(0);
506
536
  } else {
@@ -518,7 +548,7 @@ var Methods = {
518
548
  this.scrollYLoad = sYLoad; // 全量数据
519
549
 
520
550
  this.tableFullData = fullData;
521
- this.treeFullData = treeData; // 缓存数据
551
+ this.tableFullTreeData = treeData; // 缓存数据
522
552
 
523
553
  this.cacheRowMap(true); // 原始数据
524
554
 
@@ -554,31 +584,31 @@ var Methods = {
554
584
  this.handleTableData(true);
555
585
  this.updateFooter();
556
586
  return this.$nextTick().then(function () {
557
- _this2.updateHeight();
587
+ _this3.updateHeight();
558
588
 
559
- _this2.updateStyle();
589
+ _this3.updateStyle();
560
590
  }).then(function () {
561
- _this2.computeScrollLoad();
591
+ _this3.computeScrollLoad();
562
592
  }).then(function () {
563
593
  // 是否启用了虚拟滚动
564
594
  if (sYLoad) {
565
595
  scrollYStore.endIndex = scrollYStore.visibleSize;
566
596
  }
567
597
 
568
- _this2.handleReserveStatus();
598
+ _this3.handleReserveStatus();
569
599
 
570
- _this2.checkSelectionStatus();
600
+ _this3.checkSelectionStatus();
571
601
 
572
602
  return new Promise(function (resolve) {
573
- _this2.$nextTick().then(function () {
574
- return _this2.recalculate();
603
+ _this3.$nextTick().then(function () {
604
+ return _this3.recalculate();
575
605
  }).then(function () {
576
606
  // 是否变更虚拟滚动
577
607
  if (oldScrollYLoad === sYLoad) {
578
- (0, _util.restoreScrollLocation)(_this2, lastScrollLeft, lastScrollTop).then(resolve);
608
+ (0, _util.restoreScrollLocation)(_this3, lastScrollLeft, lastScrollTop).then(resolve);
579
609
  } else {
580
610
  setTimeout(function () {
581
- return (0, _util.restoreScrollLocation)(_this2, lastScrollLeft, lastScrollTop).then(resolve);
611
+ return (0, _util.restoreScrollLocation)(_this3, lastScrollLeft, lastScrollTop).then(resolve);
582
612
  });
583
613
  }
584
614
  });
@@ -591,23 +621,23 @@ var Methods = {
591
621
  * @param {Array} datas 数据
592
622
  */
593
623
  loadData: function loadData(datas) {
594
- var _this3 = this;
624
+ var _this4 = this;
595
625
 
596
626
  var inited = this.inited,
597
627
  initStatus = this.initStatus;
598
628
  return this.loadTableData(datas).then(function () {
599
- _this3.inited = true;
600
- _this3.initStatus = true;
629
+ _this4.inited = true;
630
+ _this4.initStatus = true;
601
631
 
602
632
  if (!initStatus) {
603
- _this3.handleLoadDefaults();
633
+ _this4.handleLoadDefaults();
604
634
  }
605
635
 
606
636
  if (!inited) {
607
- _this3.handleInitDefaults();
637
+ _this4.handleInitDefaults();
608
638
  }
609
639
 
610
- return _this3.recalculate();
640
+ return _this4.recalculate();
611
641
  });
612
642
  },
613
643
 
@@ -616,21 +646,21 @@ var Methods = {
616
646
  * @param {Array} datas 数据
617
647
  */
618
648
  reloadData: function reloadData(datas) {
619
- var _this4 = this;
649
+ var _this5 = this;
620
650
 
621
651
  var inited = this.inited;
622
652
  return this.clearAll().then(function () {
623
- _this4.inited = true;
624
- _this4.initStatus = true;
625
- return _this4.loadTableData(datas);
653
+ _this5.inited = true;
654
+ _this5.initStatus = true;
655
+ return _this5.loadTableData(datas);
626
656
  }).then(function () {
627
- _this4.handleLoadDefaults();
657
+ _this5.handleLoadDefaults();
628
658
 
629
659
  if (!inited) {
630
- _this4.handleInitDefaults();
660
+ _this5.handleInitDefaults();
631
661
  }
632
662
 
633
- return _this4.recalculate();
663
+ return _this5.recalculate();
634
664
  });
635
665
  },
636
666
 
@@ -680,10 +710,10 @@ var Methods = {
680
710
  * @param {ColumnInfo} columns 列配置
681
711
  */
682
712
  loadColumn: function loadColumn(columns) {
683
- var _this5 = this;
713
+ var _this6 = this;
684
714
 
685
715
  var collectColumn = _xeUtils.default.mapTree(columns, function (column) {
686
- return _cell.default.createColumn(_this5, column);
716
+ return _cell.default.createColumn(_this6, column);
687
717
  }, {
688
718
  children: 'children'
689
719
  });
@@ -697,14 +727,14 @@ var Methods = {
697
727
  * @param {ColumnInfo} columns 列配置
698
728
  */
699
729
  reloadColumn: function reloadColumn(columns) {
700
- var _this6 = this;
730
+ var _this7 = this;
701
731
 
702
732
  return this.clearAll().then(function () {
703
- return _this6.loadColumn(columns);
733
+ return _this7.loadColumn(columns);
704
734
  });
705
735
  },
706
736
  handleColumn: function handleColumn(collectColumn) {
707
- var _this7 = this;
737
+ var _this8 = this;
708
738
 
709
739
  this.collectColumn = collectColumn;
710
740
  var tableFullColumn = getColumnList(collectColumn);
@@ -712,8 +742,8 @@ var Methods = {
712
742
  this.cacheColumnMap();
713
743
  this.restoreCustomStorage();
714
744
  this.parseColumns().then(function () {
715
- if (_this7.scrollXLoad) {
716
- _this7.loadScrollXData(true);
745
+ if (_this8.scrollXLoad) {
746
+ _this8.loadScrollXData(true);
717
747
  }
718
748
  });
719
749
  this.clearMergeCells();
@@ -727,14 +757,14 @@ var Methods = {
727
757
  }
728
758
 
729
759
  return this.$nextTick().then(function () {
730
- if (_this7.$toolbar) {
731
- _this7.$toolbar.syncUpdate({
760
+ if (_this8.$toolbar) {
761
+ _this8.$toolbar.syncUpdate({
732
762
  collectColumn: collectColumn,
733
- $table: _this7
763
+ $table: _this8
734
764
  });
735
765
  }
736
766
 
737
- return _this7.recalculate();
767
+ return _this8.recalculate();
738
768
  });
739
769
  },
740
770
 
@@ -743,20 +773,21 @@ var Methods = {
743
773
  * 牺牲数据组装的耗时,用来换取使用过程中的流畅
744
774
  */
745
775
  cacheRowMap: function cacheRowMap(source) {
746
- var _this8 = this;
776
+ var _this9 = this;
747
777
 
748
778
  var treeConfig = this.treeConfig,
749
779
  treeOpts = this.treeOpts,
750
780
  tableFullData = this.tableFullData,
751
781
  fullDataRowMap = this.fullDataRowMap,
752
- fullAllDataRowMap = this.fullAllDataRowMap;
782
+ fullAllDataRowMap = this.fullAllDataRowMap,
783
+ tableFullTreeData = this.tableFullTreeData;
753
784
  var fullDataRowIdData = this.fullDataRowIdData,
754
785
  fullAllDataRowIdData = this.fullAllDataRowIdData;
755
786
  var rowkey = getRowkey(this);
756
787
  var isLazy = treeConfig && treeOpts.lazy;
757
788
 
758
789
  var handleCache = function handleCache(row, index, items, path, parent, nodes) {
759
- var rowid = getRowid(_this8, row);
790
+ var rowid = getRowid(_this9, row);
760
791
  var seq = treeConfig && path ? (0, _util.toTreePathSeq)(path) : index + 1;
761
792
  var level = nodes ? nodes.length - 1 : 0;
762
793
 
@@ -800,13 +831,13 @@ var Methods = {
800
831
  fullAllDataRowMap.clear();
801
832
 
802
833
  if (treeConfig) {
803
- _xeUtils.default.eachTree(tableFullData, handleCache, treeOpts);
834
+ _xeUtils.default.eachTree(tableFullTreeData, handleCache, treeOpts);
804
835
  } else {
805
836
  tableFullData.forEach(handleCache);
806
837
  }
807
838
  },
808
839
  loadTreeChildren: function loadTreeChildren(row, childRecords) {
809
- var _this9 = this;
840
+ var _this10 = this;
810
841
 
811
842
  var keepSource = this.keepSource,
812
843
  tableSourceData = this.tableSourceData,
@@ -815,15 +846,17 @@ var Methods = {
815
846
  fullDataRowMap = this.fullDataRowMap,
816
847
  fullAllDataRowMap = this.fullAllDataRowMap,
817
848
  fullAllDataRowIdData = this.fullAllDataRowIdData;
818
- var children = treeOpts.children;
849
+ var transform = treeOpts.transform,
850
+ children = treeOpts.children,
851
+ mapChildren = treeOpts.mapChildren;
819
852
  var rest = fullAllDataRowIdData[getRowid(this, row)];
820
853
  var parentLevel = rest ? rest.level : 0;
821
854
  return this.createData(childRecords).then(function (rows) {
822
855
  if (keepSource) {
823
- var rowid = getRowid(_this9, row);
856
+ var rowid = getRowid(_this10, row);
824
857
 
825
858
  var matchObj = _xeUtils.default.findTree(tableSourceData, function (item) {
826
- return rowid === getRowid(_this9, item);
859
+ return rowid === getRowid(_this10, item);
827
860
  }, treeOpts);
828
861
 
829
862
  if (matchObj) {
@@ -832,7 +865,7 @@ var Methods = {
832
865
  }
833
866
 
834
867
  _xeUtils.default.eachTree(rows, function (childRow, index, items, path, parent, nodes) {
835
- var rowid = getRowid(_this9, childRow);
868
+ var rowid = getRowid(_this10, childRow);
836
869
  var rest = {
837
870
  row: childRow,
838
871
  rowid: rowid,
@@ -851,6 +884,11 @@ var Methods = {
851
884
  }, treeOpts);
852
885
 
853
886
  row[children] = rows;
887
+
888
+ if (transform) {
889
+ row[mapChildren] = rows;
890
+ }
891
+
854
892
  return rows;
855
893
  });
856
894
  },
@@ -860,7 +898,7 @@ var Methods = {
860
898
  * 牺牲数据组装的耗时,用来换取使用过程中的流畅
861
899
  */
862
900
  cacheColumnMap: function cacheColumnMap() {
863
- var _this10 = this;
901
+ var _this11 = this;
864
902
 
865
903
  var tableFullColumn = this.tableFullColumn,
866
904
  collectColumn = this.collectColumn,
@@ -947,16 +985,16 @@ var Methods = {
947
985
  }
948
986
 
949
987
  if (process.env.NODE_ENV === 'development') {
950
- if (_this10.showOverflow && column.showOverflow === false) {
951
- _tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-overflow=".concat(_this10.showOverflow), "column.show-overflow=".concat(column.showOverflow)]);
988
+ if (_this11.showOverflow && column.showOverflow === false) {
989
+ _tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-overflow=".concat(_this11.showOverflow), "column.show-overflow=".concat(column.showOverflow)]);
952
990
  }
953
991
 
954
- if (_this10.showHeaderOverflow && column.showHeaderOverflow === false) {
955
- _tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-header-overflow=".concat(_this10.showHeaderOverflow), "column.show-header-overflow=".concat(column.showHeaderOverflow)]);
992
+ if (_this11.showHeaderOverflow && column.showHeaderOverflow === false) {
993
+ _tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-header-overflow=".concat(_this11.showHeaderOverflow), "column.show-header-overflow=".concat(column.showHeaderOverflow)]);
956
994
  }
957
995
 
958
- if (_this10.showFooterOverflow && column.showFooterOverflow === false) {
959
- _tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-footer-overflow=".concat(_this10.showFooterOverflow), "column.show-footer-overflow=".concat(column.showFooterOverflow)]);
996
+ if (_this11.showFooterOverflow && column.showFooterOverflow === false) {
997
+ _tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-footer-overflow=".concat(_this11.showFooterOverflow), "column.show-footer-overflow=".concat(column.showFooterOverflow)]);
960
998
  }
961
999
  }
962
1000
 
@@ -1208,13 +1246,13 @@ var Methods = {
1208
1246
  * @param {Array} records 新数据
1209
1247
  */
1210
1248
  createData: function createData(records) {
1211
- var _this11 = this;
1249
+ var _this12 = this;
1212
1250
 
1213
1251
  var treeConfig = this.treeConfig,
1214
1252
  treeOpts = this.treeOpts;
1215
1253
 
1216
1254
  var handleRrecord = function handleRrecord(record) {
1217
- return _this11.defineField(Object.assign({}, record));
1255
+ return _this12.defineField(Object.assign({}, record));
1218
1256
  };
1219
1257
 
1220
1258
  var rows = treeConfig ? _xeUtils.default.mapTree(records, handleRrecord, treeOpts) : records.map(handleRrecord);
@@ -1229,7 +1267,7 @@ var Methods = {
1229
1267
  * @param {Array/Object} records 新数据
1230
1268
  */
1231
1269
  createRow: function createRow(records) {
1232
- var _this12 = this;
1270
+ var _this13 = this;
1233
1271
 
1234
1272
  var isArr = _xeUtils.default.isArray(records);
1235
1273
 
@@ -1238,7 +1276,7 @@ var Methods = {
1238
1276
  }
1239
1277
 
1240
1278
  return this.$nextTick().then(function () {
1241
- return _this12.createData(records).then(function (rows) {
1279
+ return _this13.createData(records).then(function (rows) {
1242
1280
  return isArr ? rows : rows[0];
1243
1281
  });
1244
1282
  });
@@ -1252,7 +1290,7 @@ var Methods = {
1252
1290
  * 如果还额外传了 field 则还原指定的单元格数据
1253
1291
  */
1254
1292
  revertData: function revertData(rows, field) {
1255
- var _this13 = this;
1293
+ var _this14 = this;
1256
1294
 
1257
1295
  var keepSource = this.keepSource,
1258
1296
  tableSourceData = this.tableSourceData,
@@ -1278,8 +1316,8 @@ var Methods = {
1278
1316
 
1279
1317
  if (targetRows.length) {
1280
1318
  targetRows.forEach(function (row) {
1281
- if (!_this13.isInsertByRow(row)) {
1282
- var rowIndex = _this13.getRowIndex(row);
1319
+ if (!_this14.isInsertByRow(row)) {
1320
+ var rowIndex = _this14.getRowIndex(row);
1283
1321
 
1284
1322
  if (treeConfig && rowIndex === -1) {
1285
1323
  throw new Error(_tools.UtilTools.getLog('vxe.error.noTree', ['revertData']));
@@ -1363,7 +1401,7 @@ var Methods = {
1363
1401
  * @param {String} field 字段名
1364
1402
  */
1365
1403
  isUpdateByRow: function isUpdateByRow(row, field) {
1366
- var _this14 = this;
1404
+ var _this15 = this;
1367
1405
 
1368
1406
  var visibleColumn = this.visibleColumn,
1369
1407
  keepSource = this.keepSource,
@@ -1384,7 +1422,7 @@ var Methods = {
1384
1422
  var children = treeOpts.children;
1385
1423
 
1386
1424
  var matchObj = _xeUtils.default.findTree(tableSourceData, function (item) {
1387
- return rowid === getRowid(_this14, item);
1425
+ return rowid === getRowid(_this15, item);
1388
1426
  }, treeOpts);
1389
1427
 
1390
1428
  row = Object.assign({}, row, _defineProperty({}, children, null));
@@ -1503,23 +1541,60 @@ var Methods = {
1503
1541
  return rowList;
1504
1542
  },
1505
1543
 
1544
+ /**
1545
+ * 如果为虚拟树,将树结构拍平
1546
+ * @returns
1547
+ */
1548
+ handleVirtualTreeToList: function handleVirtualTreeToList() {
1549
+ var treeOpts = this.treeOpts,
1550
+ treeConfig = this.treeConfig,
1551
+ treeExpandeds = this.treeExpandeds,
1552
+ afterTreeFullData = this.afterTreeFullData,
1553
+ afterFullData = this.afterFullData;
1554
+
1555
+ if (treeConfig && treeOpts.transform) {
1556
+ var fullData = [];
1557
+ var expandMaps = new Map();
1558
+
1559
+ _xeUtils.default.eachTree(afterTreeFullData, function (row, index, items, path, parent) {
1560
+ if (!parent || expandMaps.has(parent) && treeExpandeds.indexOf(parent) > -1) {
1561
+ expandMaps.set(row, 1);
1562
+ fullData.push(row);
1563
+ }
1564
+ }, {
1565
+ children: treeOpts.mapChildren
1566
+ });
1567
+
1568
+ this.afterFullData = fullData;
1569
+ this.updateScrollYStatus(fullData);
1570
+ return fullData;
1571
+ }
1572
+
1573
+ return afterFullData;
1574
+ },
1575
+
1506
1576
  /**
1507
1577
  * 获取处理后全量的表格数据
1508
1578
  * 如果存在筛选条件,继续处理
1509
1579
  */
1510
1580
  updateAfterFullData: function updateAfterFullData() {
1511
- var _this15 = this;
1581
+ var _this16 = this;
1512
1582
 
1513
1583
  var tableFullColumn = this.tableFullColumn,
1514
1584
  tableFullData = this.tableFullData,
1515
1585
  filterOpts = this.filterOpts,
1516
- sortOpts = this.sortOpts;
1586
+ sortOpts = this.sortOpts,
1587
+ treeConfig = this.treeConfig,
1588
+ treeOpts = this.treeOpts,
1589
+ tableFullTreeData = this.tableFullTreeData;
1517
1590
  var allRemoteFilter = filterOpts.remote,
1518
1591
  allFilterMethod = filterOpts.filterMethod;
1519
1592
  var allRemoteSort = sortOpts.remote,
1520
1593
  allSortMethod = sortOpts.sortMethod,
1521
1594
  sortMultiple = sortOpts.multiple;
1522
- var tableData = tableFullData.slice(0);
1595
+ var transform = treeOpts.transform;
1596
+ var tableData = [];
1597
+ var tableTree = [];
1523
1598
  var filterColumns = [];
1524
1599
  var orderColumns = [];
1525
1600
  tableFullColumn.forEach(function (column) {
@@ -1556,7 +1631,7 @@ var Methods = {
1556
1631
  });
1557
1632
 
1558
1633
  if (filterColumns.length) {
1559
- tableData = tableData.filter(function (row) {
1634
+ var handleFilter = function handleFilter(row) {
1560
1635
  return filterColumns.every(function (_ref) {
1561
1636
  var column = _ref.column,
1562
1637
  valueList = _ref.valueList,
@@ -1579,7 +1654,7 @@ var Methods = {
1579
1654
  cellValue: cellValue,
1580
1655
  row: row,
1581
1656
  column: column,
1582
- $table: _this15
1657
+ $table: _this16
1583
1658
  });
1584
1659
  });
1585
1660
  } else if (compFilterMethod) {
@@ -1590,7 +1665,7 @@ var Methods = {
1590
1665
  cellValue: cellValue,
1591
1666
  row: row,
1592
1667
  column: column,
1593
- $table: _this15
1668
+ $table: _this16
1594
1669
  });
1595
1670
  });
1596
1671
  } else if (allFilterMethod) {
@@ -1609,7 +1684,7 @@ var Methods = {
1609
1684
  cellValue: cellValue,
1610
1685
  row: row,
1611
1686
  column: column,
1612
- $table: _this15
1687
+ $table: _this16
1613
1688
  });
1614
1689
  });
1615
1690
  }
@@ -1619,51 +1694,99 @@ var Methods = {
1619
1694
 
1620
1695
  return true;
1621
1696
  });
1622
- });
1697
+ };
1698
+
1699
+ if (treeConfig && transform) {
1700
+ // 筛选虚拟树
1701
+ tableTree = _xeUtils.default.searchTree(tableFullTreeData, handleFilter, _objectSpread(_objectSpread({}, treeOpts), {}, {
1702
+ original: true
1703
+ }));
1704
+ tableData = tableTree;
1705
+ } else {
1706
+ tableData = treeConfig ? tableFullTreeData.filter(handleFilter) : tableFullData.filter(handleFilter);
1707
+ tableTree = tableData;
1708
+ }
1709
+ } else {
1710
+ if (treeConfig && transform) {
1711
+ // 还原虚拟树
1712
+ tableTree = _xeUtils.default.searchTree(tableFullTreeData, function () {
1713
+ return true;
1714
+ }, _objectSpread(_objectSpread({}, treeOpts), {}, {
1715
+ original: true
1716
+ }));
1717
+ tableData = tableTree;
1718
+ } else {
1719
+ tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0);
1720
+ tableTree = tableData;
1721
+ }
1623
1722
  }
1624
1723
 
1625
1724
  var firstOrderColumn = orderColumns[0];
1626
1725
 
1627
1726
  if (!allRemoteSort && firstOrderColumn) {
1628
- if (allSortMethod) {
1629
- var sortRests = allSortMethod({
1630
- data: tableData,
1631
- column: firstOrderColumn.column,
1632
- property: firstOrderColumn.property,
1633
- order: firstOrderColumn.order,
1634
- sortList: orderColumns,
1635
- $table: this
1636
- });
1637
- tableData = _xeUtils.default.isArray(sortRests) ? sortRests : tableData;
1638
- } else {
1639
- // 兼容 v4
1640
- if (sortMultiple) {
1641
- tableData = _xeUtils.default.orderBy(tableData, orderColumns.map(function (_ref2) {
1727
+ if (treeConfig && transform) {
1728
+ // 虚拟树和列表一样,只能排序根级节点
1729
+ if (allSortMethod) {
1730
+ var sortRests = allSortMethod({
1731
+ data: tableTree,
1732
+ sortList: orderColumns,
1733
+ $table: this
1734
+ });
1735
+ tableTree = _xeUtils.default.isArray(sortRests) ? sortRests : tableTree;
1736
+ } else {
1737
+ tableTree = _xeUtils.default.orderBy(tableTree, orderColumns.map(function (_ref2) {
1642
1738
  var column = _ref2.column,
1643
1739
  order = _ref2.order;
1644
- return [getOrderField(_this15, column), order];
1740
+ return [getOrderField(_this16, column), order];
1645
1741
  }));
1742
+ }
1743
+
1744
+ tableData = tableTree;
1745
+ } else {
1746
+ if (allSortMethod) {
1747
+ var _sortRests = allSortMethod({
1748
+ data: tableData,
1749
+ column: firstOrderColumn.column,
1750
+ property: firstOrderColumn.property,
1751
+ order: firstOrderColumn.order,
1752
+ sortList: orderColumns,
1753
+ $table: this
1754
+ });
1755
+
1756
+ tableData = _xeUtils.default.isArray(_sortRests) ? _sortRests : tableData;
1646
1757
  } else {
1647
- // 兼容 v2,在 v4 中废弃, sortBy 不能为数组
1648
- var sortByConfs;
1758
+ // 兼容 v4
1759
+ if (sortMultiple) {
1760
+ tableData = _xeUtils.default.orderBy(tableData, orderColumns.map(function (_ref3) {
1761
+ var column = _ref3.column,
1762
+ order = _ref3.order;
1763
+ return [getOrderField(_this16, column), order];
1764
+ }));
1765
+ } else {
1766
+ // 兼容 v2,在 v4 中废弃, sortBy 不能为数组
1767
+ var sortByConfs;
1649
1768
 
1650
- if (_xeUtils.default.isArray(firstOrderColumn.sortBy)) {
1651
- sortByConfs = firstOrderColumn.sortBy.map(function (item) {
1652
- return [item, firstOrderColumn.order];
1653
- });
1654
- }
1769
+ if (_xeUtils.default.isArray(firstOrderColumn.sortBy)) {
1770
+ sortByConfs = firstOrderColumn.sortBy.map(function (item) {
1771
+ return [item, firstOrderColumn.order];
1772
+ });
1773
+ }
1655
1774
 
1656
- tableData = _xeUtils.default.orderBy(tableData, sortByConfs || [firstOrderColumn].map(function (_ref3) {
1657
- var column = _ref3.column,
1658
- order = _ref3.order;
1659
- return [getOrderField(_this15, column), order];
1660
- }));
1775
+ tableData = _xeUtils.default.orderBy(tableData, sortByConfs || [firstOrderColumn].map(function (_ref4) {
1776
+ var column = _ref4.column,
1777
+ order = _ref4.order;
1778
+ return [getOrderField(_this16, column), order];
1779
+ }));
1780
+ }
1661
1781
  }
1782
+
1783
+ tableTree = tableData;
1662
1784
  }
1663
1785
  }
1664
1786
 
1665
1787
  this.afterFullData = tableData;
1666
- return tableData;
1788
+ this.afterTreeFullData = tableTree;
1789
+ this.updateAfterDataIndex();
1667
1790
  },
1668
1791
 
1669
1792
  /**
@@ -1671,18 +1794,18 @@ var Methods = {
1671
1794
  * 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
1672
1795
  */
1673
1796
  updateAfterDataIndex: function updateAfterDataIndex() {
1674
- var _this16 = this;
1797
+ var _this17 = this;
1675
1798
 
1676
1799
  var treeConfig = this.treeConfig,
1677
1800
  afterFullData = this.afterFullData,
1678
1801
  fullDataRowIdData = this.fullDataRowIdData,
1679
1802
  fullAllDataRowIdData = this.fullAllDataRowIdData,
1680
- treeFullData = this.treeFullData,
1803
+ afterTreeFullData = this.afterTreeFullData,
1681
1804
  treeOpts = this.treeOpts;
1682
1805
 
1683
1806
  if (treeConfig) {
1684
- _xeUtils.default.eachTree(treeFullData, function (row, index, items, path) {
1685
- var rowid = getRowid(_this16, row);
1807
+ _xeUtils.default.eachTree(afterTreeFullData, function (row, index, items, path) {
1808
+ var rowid = getRowid(_this17, row);
1686
1809
  var allrest = fullAllDataRowIdData[rowid];
1687
1810
  var fullrest = fullDataRowIdData[rowid];
1688
1811
  var seq = path.map(function (num, i) {
@@ -1691,10 +1814,12 @@ var Methods = {
1691
1814
 
1692
1815
  if (allrest) {
1693
1816
  allrest.seq = seq;
1817
+ allrest._index = index;
1694
1818
  }
1695
1819
 
1696
1820
  if (fullrest) {
1697
1821
  fullrest.seq = seq;
1822
+ fullrest._index = index;
1698
1823
  } else {
1699
1824
  fullAllDataRowIdData[rowid] = {
1700
1825
  row: row,
@@ -1719,16 +1844,19 @@ var Methods = {
1719
1844
  level: 0
1720
1845
  };
1721
1846
  }
1722
- }, treeOpts);
1847
+ }, {
1848
+ children: treeOpts.mapChildren
1849
+ });
1723
1850
  } else {
1724
1851
  afterFullData.forEach(function (row, index) {
1725
- var rowid = getRowid(_this16, row);
1852
+ var rowid = getRowid(_this17, row);
1726
1853
  var allrest = fullAllDataRowIdData[rowid];
1727
1854
  var fullrest = fullDataRowIdData[rowid];
1728
1855
  var seq = index + 1;
1729
1856
 
1730
1857
  if (allrest) {
1731
1858
  allrest.seq = seq;
1859
+ allrest._index = index;
1732
1860
  }
1733
1861
 
1734
1862
  if (fullrest) {
@@ -1803,7 +1931,7 @@ var Methods = {
1803
1931
  * 默认执行一次,除非被重置
1804
1932
  */
1805
1933
  handleLoadDefaults: function handleLoadDefaults() {
1806
- var _this17 = this;
1934
+ var _this18 = this;
1807
1935
 
1808
1936
  if (this.checkboxConfig) {
1809
1937
  this.handleDefaultSelectionChecked();
@@ -1830,7 +1958,7 @@ var Methods = {
1830
1958
  }
1831
1959
 
1832
1960
  this.$nextTick(function () {
1833
- return setTimeout(_this17.recalculate);
1961
+ return setTimeout(_this18.recalculate);
1834
1962
  });
1835
1963
  },
1836
1964
 
@@ -1983,9 +2111,9 @@ var Methods = {
1983
2111
  }
1984
2112
  });
1985
2113
 
1986
- _xeUtils.default.each(customMap, function (_ref4, field) {
1987
- var visible = _ref4.visible,
1988
- resizeWidth = _ref4.resizeWidth;
2114
+ _xeUtils.default.each(customMap, function (_ref5, field) {
2115
+ var visible = _ref5.visible,
2116
+ resizeWidth = _ref5.resizeWidth;
1989
2117
  var column = keyMap[field];
1990
2118
 
1991
2119
  if (column) {
@@ -2087,12 +2215,12 @@ var Methods = {
2087
2215
  * 刷新列配置
2088
2216
  */
2089
2217
  refreshColumn: function refreshColumn() {
2090
- var _this18 = this;
2218
+ var _this19 = this;
2091
2219
 
2092
2220
  return this.parseColumns().then(function () {
2093
- return _this18.refreshScroll();
2221
+ return _this19.refreshScroll();
2094
2222
  }).then(function () {
2095
- return _this18.recalculate();
2223
+ return _this19.recalculate();
2096
2224
  });
2097
2225
  },
2098
2226
 
@@ -2101,7 +2229,7 @@ var Methods = {
2101
2229
  * 将固定的列左边、右边分别靠边
2102
2230
  */
2103
2231
  parseColumns: function parseColumns() {
2104
- var _this19 = this;
2232
+ var _this20 = this;
2105
2233
 
2106
2234
  var leftList = [];
2107
2235
  var centerList = [];
@@ -2228,11 +2356,11 @@ var Methods = {
2228
2356
  this.visibleColumn = visibleColumn;
2229
2357
  this.handleTableColumn();
2230
2358
  return this.updateFooter().then(function () {
2231
- return _this19.recalculate();
2359
+ return _this20.recalculate();
2232
2360
  }).then(function () {
2233
- _this19.updateCellAreas();
2361
+ _this20.updateCellAreas();
2234
2362
 
2235
- return _this19.recalculate();
2363
+ return _this20.recalculate();
2236
2364
  });
2237
2365
  },
2238
2366
 
@@ -2316,7 +2444,7 @@ var Methods = {
2316
2444
  * 支持 width=? width=?px width=?% min-width=? min-width=?px min-width=?%
2317
2445
  */
2318
2446
  recalculate: function recalculate(refull) {
2319
- var _this20 = this;
2447
+ var _this21 = this;
2320
2448
 
2321
2449
  var $refs = this.$refs;
2322
2450
  var tableBody = $refs.tableBody,
@@ -2332,9 +2460,9 @@ var Methods = {
2332
2460
  if (refull === true) {
2333
2461
  // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
2334
2462
  return this.computeScrollLoad().then(function () {
2335
- _this20.autoCellWidth(headerElem, bodyElem, footerElem);
2463
+ _this21.autoCellWidth(headerElem, bodyElem, footerElem);
2336
2464
 
2337
- return _this20.computeScrollLoad();
2465
+ return _this21.computeScrollLoad();
2338
2466
  });
2339
2467
  }
2340
2468
  }
@@ -2482,7 +2610,7 @@ var Methods = {
2482
2610
  this.customMaxHeight = calcHeight(this, 'maxHeight');
2483
2611
  },
2484
2612
  updateStyle: function updateStyle() {
2485
- var _this21 = this;
2613
+ var _this22 = this;
2486
2614
 
2487
2615
  var $refs = this.$refs,
2488
2616
  isGroup = this.isGroup,
@@ -2586,7 +2714,7 @@ var Methods = {
2586
2714
 
2587
2715
  if (isGroup && listElem) {
2588
2716
  _xeUtils.default.arrayEach(listElem.querySelectorAll('.col--group'), function (thElem) {
2589
- var colNode = _this21.getColumnNode(thElem);
2717
+ var colNode = _this22.getColumnNode(thElem);
2590
2718
 
2591
2719
  if (colNode) {
2592
2720
  var column = colNode.item;
@@ -2767,10 +2895,10 @@ var Methods = {
2767
2895
 
2768
2896
  if (cellElem) {
2769
2897
  if (colspan > 1) {
2770
- var columnIndex = _this21.getColumnIndex(column);
2898
+ var columnIndex = _this22.getColumnIndex(column);
2771
2899
 
2772
2900
  for (var _index = 1; _index < colspan; _index++) {
2773
- var nextColumn = _this21.getColumns(columnIndex + _index);
2901
+ var nextColumn = _this22.getColumns(columnIndex + _index);
2774
2902
 
2775
2903
  if (nextColumn) {
2776
2904
  colWidth += nextColumn.renderWidth;
@@ -2820,7 +2948,7 @@ var Methods = {
2820
2948
  }
2821
2949
  },
2822
2950
  preventEvent: function preventEvent(evnt, type, args, next, end) {
2823
- var _this22 = this;
2951
+ var _this23 = this;
2824
2952
 
2825
2953
  var evntList = _vXETable.default.interceptor.get(type);
2826
2954
 
@@ -2828,8 +2956,8 @@ var Methods = {
2828
2956
 
2829
2957
  if (!evntList.some(function (func) {
2830
2958
  return func(Object.assign({
2831
- $grid: _this22.$xegrid,
2832
- $table: _this22,
2959
+ $grid: _this23.$xegrid,
2960
+ $table: _this23,
2833
2961
  $event: evnt
2834
2962
  }, args)) === false;
2835
2963
  })) {
@@ -2849,7 +2977,7 @@ var Methods = {
2849
2977
  * 全局按下事件处理
2850
2978
  */
2851
2979
  handleGlobalMousedownEvent: function handleGlobalMousedownEvent(evnt) {
2852
- var _this23 = this;
2980
+ var _this24 = this;
2853
2981
 
2854
2982
  var $el = this.$el,
2855
2983
  $refs = this.$refs,
@@ -2910,7 +3038,7 @@ var Methods = {
2910
3038
  } // 如果固定了高度且点击了行之外的空白处,则清除激活状态
2911
3039
 
2912
3040
 
2913
- if (!isClearActived && _this23.height && !_this23.overflowY) {
3041
+ if (!isClearActived && _this24.height && !_this24.overflowY) {
2914
3042
  var bodyWrapperElem = evnt.target;
2915
3043
 
2916
3044
  if (hasClass(bodyWrapperElem, 'vxe-table--body-wrapper')) {
@@ -2921,7 +3049,7 @@ var Methods = {
2921
3049
  if (isClearActived || // 如果点击了当前表格之外
2922
3050
  !getEventTargetNode(evnt, $el).flag) {
2923
3051
  setTimeout(function () {
2924
- return _this23.clearActived(evnt);
3052
+ return _this24.clearActived(evnt);
2925
3053
  });
2926
3054
  }
2927
3055
  });
@@ -2935,9 +3063,9 @@ var Methods = {
2935
3063
 
2936
3064
  if (!getEventTargetNode(evnt, document.body, 'vxe-table--ignore-areas-clear').flag) {
2937
3065
  this.preventEvent(evnt, 'event.clearAreas', {}, function () {
2938
- _this23.clearCellAreas();
3066
+ _this24.clearCellAreas();
2939
3067
 
2940
- _this23.clearCopyCellArea();
3068
+ _this24.clearCopyCellArea();
2941
3069
  });
2942
3070
  }
2943
3071
  }
@@ -2972,7 +3100,7 @@ var Methods = {
2972
3100
  * 表格键盘事件
2973
3101
  */
2974
3102
  keydownEvent: function keydownEvent(evnt) {
2975
- var _this24 = this;
3103
+ var _this25 = this;
2976
3104
 
2977
3105
  var filterStore = this.filterStore,
2978
3106
  ctxMenuStore = this.ctxMenuStore,
@@ -2987,33 +3115,33 @@ var Methods = {
2987
3115
 
2988
3116
  if (isEsc) {
2989
3117
  this.preventEvent(evnt, 'event.keydown', null, function () {
2990
- if (keyboardConfig && mouseConfig && mouseOpts.area && _this24.handleKeyboardEvent) {
2991
- _this24.handleKeyboardEvent(evnt);
3118
+ if (keyboardConfig && mouseConfig && mouseOpts.area && _this25.handleKeyboardEvent) {
3119
+ _this25.handleKeyboardEvent(evnt);
2992
3120
  } else if (actived.row || filterStore.visible || ctxMenuStore.visible) {
2993
3121
  evnt.stopPropagation(); // 如果按下了 Esc 键,关闭快捷菜单、筛选
2994
3122
 
2995
- _this24.closeFilter();
3123
+ _this25.closeFilter();
2996
3124
 
2997
- _this24.closeMenu();
3125
+ _this25.closeMenu();
2998
3126
 
2999
3127
  if (keyboardConfig && keyboardOpts.isEsc) {
3000
3128
  // 如果是激活编辑状态,则取消编辑
3001
3129
  if (actived.row) {
3002
3130
  var params = actived.args;
3003
3131
 
3004
- _this24.clearActived(evnt); // 如果配置了选中功能,则为选中状态
3132
+ _this25.clearActived(evnt); // 如果配置了选中功能,则为选中状态
3005
3133
 
3006
3134
 
3007
3135
  if (mouseConfig && mouseOpts.selected) {
3008
- _this24.$nextTick(function () {
3009
- return _this24.handleSelected(params, evnt);
3136
+ _this25.$nextTick(function () {
3137
+ return _this25.handleSelected(params, evnt);
3010
3138
  });
3011
3139
  }
3012
3140
  }
3013
3141
  }
3014
3142
  }
3015
3143
 
3016
- _this24.emitEvent('keydown', {}, evnt);
3144
+ _this25.emitEvent('keydown', {}, evnt);
3017
3145
  });
3018
3146
  }
3019
3147
  },
@@ -3022,27 +3150,27 @@ var Methods = {
3022
3150
  * 全局键盘事件
3023
3151
  */
3024
3152
  handleGlobalKeydownEvent: function handleGlobalKeydownEvent(evnt) {
3025
- var _this25 = this;
3153
+ var _this26 = this;
3026
3154
 
3027
3155
  // 该行为只对当前激活的表格有效
3028
3156
  if (this.isActivated) {
3029
3157
  this.preventEvent(evnt, 'event.keydown', null, function () {
3030
- var filterStore = _this25.filterStore,
3031
- isCtxMenu = _this25.isCtxMenu,
3032
- ctxMenuStore = _this25.ctxMenuStore,
3033
- editStore = _this25.editStore,
3034
- editOpts = _this25.editOpts,
3035
- editConfig = _this25.editConfig,
3036
- mouseConfig = _this25.mouseConfig,
3037
- mouseOpts = _this25.mouseOpts,
3038
- keyboardConfig = _this25.keyboardConfig,
3039
- keyboardOpts = _this25.keyboardOpts,
3040
- treeConfig = _this25.treeConfig,
3041
- treeOpts = _this25.treeOpts,
3042
- highlightCurrentRow = _this25.highlightCurrentRow,
3043
- currentRow = _this25.currentRow,
3044
- bodyCtxMenu = _this25.bodyCtxMenu,
3045
- rowOpts = _this25.rowOpts;
3158
+ var filterStore = _this26.filterStore,
3159
+ isCtxMenu = _this26.isCtxMenu,
3160
+ ctxMenuStore = _this26.ctxMenuStore,
3161
+ editStore = _this26.editStore,
3162
+ editOpts = _this26.editOpts,
3163
+ editConfig = _this26.editConfig,
3164
+ mouseConfig = _this26.mouseConfig,
3165
+ mouseOpts = _this26.mouseOpts,
3166
+ keyboardConfig = _this26.keyboardConfig,
3167
+ keyboardOpts = _this26.keyboardOpts,
3168
+ treeConfig = _this26.treeConfig,
3169
+ treeOpts = _this26.treeOpts,
3170
+ highlightCurrentRow = _this26.highlightCurrentRow,
3171
+ currentRow = _this26.currentRow,
3172
+ bodyCtxMenu = _this26.bodyCtxMenu,
3173
+ rowOpts = _this26.rowOpts;
3046
3174
  var selected = editStore.selected,
3047
3175
  actived = editStore.actived;
3048
3176
  var keyCode = evnt.keyCode;
@@ -3069,7 +3197,7 @@ var Methods = {
3069
3197
 
3070
3198
  if (filterStore.visible) {
3071
3199
  if (isEsc) {
3072
- _this25.closeFilter();
3200
+ _this26.closeFilter();
3073
3201
  }
3074
3202
 
3075
3203
  return;
@@ -3080,20 +3208,20 @@ var Methods = {
3080
3208
  evnt.preventDefault();
3081
3209
 
3082
3210
  if (ctxMenuStore.showChild && hasChildrenList(ctxMenuStore.selected)) {
3083
- _this25.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selectChild', 37, false, ctxMenuStore.selected.children);
3211
+ _this26.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selectChild', 37, false, ctxMenuStore.selected.children);
3084
3212
  } else {
3085
- _this25.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selected', 39, true, _this25.ctxMenuList);
3213
+ _this26.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selected', 39, true, _this26.ctxMenuList);
3086
3214
  }
3087
- } else if (keyboardConfig && mouseConfig && mouseOpts.area && _this25.handleKeyboardEvent) {
3088
- _this25.handleKeyboardEvent(evnt);
3215
+ } else if (keyboardConfig && mouseConfig && mouseOpts.area && _this26.handleKeyboardEvent) {
3216
+ _this26.handleKeyboardEvent(evnt);
3089
3217
  } else if (keyboardConfig && isSpacebar && keyboardOpts.isChecked && selected.row && selected.column && (selected.column.type === 'checkbox' || selected.column.type === 'radio')) {
3090
3218
  // 空格键支持选中复选框
3091
3219
  evnt.preventDefault();
3092
3220
 
3093
3221
  if (selected.column.type === 'checkbox') {
3094
- _this25.handleToggleCheckRowEvent(evnt, selected.args);
3222
+ _this26.handleToggleCheckRowEvent(evnt, selected.args);
3095
3223
  } else {
3096
- _this25.triggerRadioRowEvent(evnt, selected.args);
3224
+ _this26.triggerRadioRowEvent(evnt, selected.args);
3097
3225
  }
3098
3226
  } else if (isF2 && (0, _utils.isEnableConf)(editConfig)) {
3099
3227
  if (!isEditStatus) {
@@ -3102,15 +3230,15 @@ var Methods = {
3102
3230
  evnt.stopPropagation();
3103
3231
  evnt.preventDefault();
3104
3232
 
3105
- _this25.handleActived(selected.args, evnt);
3233
+ _this26.handleActived(selected.args, evnt);
3106
3234
  }
3107
3235
  }
3108
3236
  } else if (isContextMenu) {
3109
3237
  // 如果按下上下文键
3110
- _this25._keyCtx = selected.row && selected.column && bodyCtxMenu.length;
3111
- clearTimeout(_this25.keyCtxTimeout);
3112
- _this25.keyCtxTimeout = setTimeout(function () {
3113
- _this25._keyCtx = false;
3238
+ _this26._keyCtx = selected.row && selected.column && bodyCtxMenu.length;
3239
+ clearTimeout(_this26.keyCtxTimeout);
3240
+ _this26.keyCtxTimeout = setTimeout(function () {
3241
+ _this26._keyCtx = false;
3114
3242
  }, 1000);
3115
3243
  } else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow)) {
3116
3244
  // 退出选中
@@ -3119,12 +3247,12 @@ var Methods = {
3119
3247
  if (actived.row) {
3120
3248
  params = actived.args;
3121
3249
 
3122
- _this25.clearActived(evnt); // 如果配置了选中功能,则为选中状态
3250
+ _this26.clearActived(evnt); // 如果配置了选中功能,则为选中状态
3123
3251
 
3124
3252
 
3125
3253
  if (mouseConfig && mouseOpts.selected) {
3126
- _this25.$nextTick(function () {
3127
- return _this25.handleSelected(params, evnt);
3254
+ _this26.$nextTick(function () {
3255
+ return _this26.handleSelected(params, evnt);
3128
3256
  });
3129
3257
  }
3130
3258
  }
@@ -3135,15 +3263,15 @@ var Methods = {
3135
3263
 
3136
3264
  if (hasShiftKey) {
3137
3265
  if (keyboardOpts.enterToTab) {
3138
- _this25.moveTabSelected(targetArgs, hasShiftKey, evnt);
3266
+ _this26.moveTabSelected(targetArgs, hasShiftKey, evnt);
3139
3267
  } else {
3140
- _this25.moveSelected(targetArgs, isLeftArrow, true, isRightArrow, false, evnt);
3268
+ _this26.moveSelected(targetArgs, isLeftArrow, true, isRightArrow, false, evnt);
3141
3269
  }
3142
3270
  } else {
3143
3271
  if (keyboardOpts.enterToTab) {
3144
- _this25.moveTabSelected(targetArgs, hasShiftKey, evnt);
3272
+ _this26.moveTabSelected(targetArgs, hasShiftKey, evnt);
3145
3273
  } else {
3146
- _this25.moveSelected(targetArgs, isLeftArrow, false, isRightArrow, true, evnt);
3274
+ _this26.moveSelected(targetArgs, isLeftArrow, false, isRightArrow, true, evnt);
3147
3275
  }
3148
3276
  }
3149
3277
  } else if (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
@@ -3154,14 +3282,14 @@ var Methods = {
3154
3282
  evnt.preventDefault();
3155
3283
  var targetRow = childrens[0];
3156
3284
  params = {
3157
- $table: _this25,
3285
+ $table: _this26,
3158
3286
  row: targetRow
3159
3287
  };
3160
3288
 
3161
- _this25.setTreeExpand(currentRow, true).then(function () {
3162
- return _this25.scrollToRow(targetRow);
3289
+ _this26.setTreeExpand(currentRow, true).then(function () {
3290
+ return _this26.scrollToRow(targetRow);
3163
3291
  }).then(function () {
3164
- return _this25.triggerCurrentRowEvent(evnt, params);
3292
+ return _this26.triggerCurrentRowEvent(evnt, params);
3165
3293
  });
3166
3294
  }
3167
3295
  }
@@ -3170,18 +3298,18 @@ var Methods = {
3170
3298
  if (!isEditStatus) {
3171
3299
  // 如果按下了方向键
3172
3300
  if (selected.row && selected.column) {
3173
- _this25.moveSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
3301
+ _this26.moveSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
3174
3302
  } else if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
3175
3303
  // 当前行按键上下移动
3176
- _this25.moveCurrentRow(isUpArrow, isDwArrow, evnt);
3304
+ _this26.moveCurrentRow(isUpArrow, isDwArrow, evnt);
3177
3305
  }
3178
3306
  }
3179
3307
  } else if (isTab && keyboardConfig && keyboardOpts.isTab) {
3180
3308
  // 如果按下了 Tab 键切换
3181
3309
  if (selected.row || selected.column) {
3182
- _this25.moveTabSelected(selected.args, hasShiftKey, evnt);
3310
+ _this26.moveTabSelected(selected.args, hasShiftKey, evnt);
3183
3311
  } else if (actived.row || actived.column) {
3184
- _this25.moveTabSelected(actived.args, hasShiftKey, evnt);
3312
+ _this26.moveTabSelected(actived.args, hasShiftKey, evnt);
3185
3313
  }
3186
3314
  } else if (keyboardConfig && (isDel || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow ? isBack && keyboardOpts.isArrow : isBack))) {
3187
3315
  if (!isEditStatus) {
@@ -3192,10 +3320,10 @@ var Methods = {
3192
3320
  if (delMethod) {
3193
3321
  delMethod({
3194
3322
  row: selected.row,
3195
- rowIndex: _this25.getRowIndex(selected.row),
3323
+ rowIndex: _this26.getRowIndex(selected.row),
3196
3324
  column: selected.column,
3197
- columnIndex: _this25.getColumnIndex(selected.column),
3198
- $table: _this25
3325
+ columnIndex: _this26.getColumnIndex(selected.column),
3326
+ $table: _this26
3199
3327
  });
3200
3328
  } else {
3201
3329
  setCellValue(selected.row, selected.column, null);
@@ -3205,21 +3333,21 @@ var Methods = {
3205
3333
  if (backMethod) {
3206
3334
  backMethod({
3207
3335
  row: selected.row,
3208
- rowIndex: _this25.getRowIndex(selected.row),
3336
+ rowIndex: _this26.getRowIndex(selected.row),
3209
3337
  column: selected.column,
3210
- columnIndex: _this25.getColumnIndex(selected.column),
3211
- $table: _this25
3338
+ columnIndex: _this26.getColumnIndex(selected.column),
3339
+ $table: _this26
3212
3340
  });
3213
3341
  } else {
3214
- _this25.handleActived(selected.args, evnt);
3342
+ _this26.handleActived(selected.args, evnt);
3215
3343
  }
3216
3344
  } else if (isDel) {
3217
3345
  // 如果按下 del 键,更新表尾数据
3218
- _this25.updateFooter();
3346
+ _this26.updateFooter();
3219
3347
  }
3220
3348
  } else if (isBack && keyboardOpts.isArrow && treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
3221
3349
  // 如果树形表格回退键关闭当前行返回父节点
3222
- var _XEUtils$findTree = _xeUtils.default.findTree(_this25.afterFullData, function (item) {
3350
+ var _XEUtils$findTree = _xeUtils.default.findTree(_this26.afterFullData, function (item) {
3223
3351
  return item === currentRow;
3224
3352
  }, treeOpts),
3225
3353
  parentRow = _XEUtils$findTree.parent;
@@ -3227,14 +3355,14 @@ var Methods = {
3227
3355
  if (parentRow) {
3228
3356
  evnt.preventDefault();
3229
3357
  params = {
3230
- $table: _this25,
3358
+ $table: _this26,
3231
3359
  row: parentRow
3232
3360
  };
3233
3361
 
3234
- _this25.setTreeExpand(parentRow, false).then(function () {
3235
- return _this25.scrollToRow(parentRow);
3362
+ _this26.setTreeExpand(parentRow, false).then(function () {
3363
+ return _this26.scrollToRow(parentRow);
3236
3364
  }).then(function () {
3237
- return _this25.triggerCurrentRowEvent(evnt, params);
3365
+ return _this26.triggerCurrentRowEvent(evnt, params);
3238
3366
  });
3239
3367
  }
3240
3368
  }
@@ -3251,21 +3379,21 @@ var Methods = {
3251
3379
  if (editMethod) {
3252
3380
  editMethod({
3253
3381
  row: selected.row,
3254
- rowIndex: _this25.getRowIndex(selected.row),
3382
+ rowIndex: _this26.getRowIndex(selected.row),
3255
3383
  column: selected.column,
3256
- columnIndex: _this25.getColumnIndex(selected.column),
3257
- $table: _this25
3384
+ columnIndex: _this26.getColumnIndex(selected.column),
3385
+ $table: _this26
3258
3386
  });
3259
3387
  } else {
3260
3388
  setCellValue(selected.row, selected.column, null);
3261
3389
 
3262
- _this25.handleActived(selected.args, evnt);
3390
+ _this26.handleActived(selected.args, evnt);
3263
3391
  }
3264
3392
  }
3265
3393
  }
3266
3394
  }
3267
3395
 
3268
- _this25.emitEvent('keydown', {}, evnt);
3396
+ _this26.emitEvent('keydown', {}, evnt);
3269
3397
  });
3270
3398
  }
3271
3399
  },
@@ -3335,12 +3463,12 @@ var Methods = {
3335
3463
  this.recalculate(true);
3336
3464
  },
3337
3465
  handleTooltipLeaveMethod: function handleTooltipLeaveMethod() {
3338
- var _this26 = this;
3466
+ var _this27 = this;
3339
3467
 
3340
3468
  var tooltipOpts = this.tooltipOpts;
3341
3469
  setTimeout(function () {
3342
- if (!_this26.tooltipActive) {
3343
- _this26.closeTooltip();
3470
+ if (!_this27.tooltipActive) {
3471
+ _this27.closeTooltip();
3344
3472
  }
3345
3473
  }, tooltipOpts.leaveDelay);
3346
3474
  return false;
@@ -3351,17 +3479,17 @@ var Methods = {
3351
3479
  this.closeTooltip();
3352
3480
  },
3353
3481
  handleTargetLeaveEvent: function handleTargetLeaveEvent() {
3354
- var _this27 = this;
3482
+ var _this28 = this;
3355
3483
 
3356
3484
  var tooltipOpts = this.tooltipOpts;
3357
3485
  this.tooltipActive = false;
3358
3486
 
3359
3487
  if (tooltipOpts.enterable) {
3360
3488
  this.tooltipTimeout = setTimeout(function () {
3361
- var tooltip = _this27.$refs.tooltip;
3489
+ var tooltip = _this28.$refs.tooltip;
3362
3490
 
3363
3491
  if (tooltip && !tooltip.isHover) {
3364
- _this27.closeTooltip();
3492
+ _this28.closeTooltip();
3365
3493
  }
3366
3494
  }, tooltipOpts.leaveDelay);
3367
3495
  } else {
@@ -3594,14 +3722,14 @@ var Methods = {
3594
3722
  * @param {Boolean} value 是否选中
3595
3723
  */
3596
3724
  setCheckboxRow: function setCheckboxRow(rows, value) {
3597
- var _this28 = this;
3725
+ var _this29 = this;
3598
3726
 
3599
3727
  if (rows && !_xeUtils.default.isArray(rows)) {
3600
3728
  rows = [rows];
3601
3729
  }
3602
3730
 
3603
3731
  rows.forEach(function (row) {
3604
- return _this28.handleSelectRow({
3732
+ return _this29.handleSelectRow({
3605
3733
  row: row
3606
3734
  }, !!value);
3607
3735
  });
@@ -3624,10 +3752,10 @@ var Methods = {
3624
3752
  * 多选,行选中事件
3625
3753
  * value 选中true 不选false 半选-1
3626
3754
  */
3627
- handleSelectRow: function handleSelectRow(_ref5, value) {
3628
- var _this29 = this;
3755
+ handleSelectRow: function handleSelectRow(_ref6, value) {
3756
+ var _this30 = this;
3629
3757
 
3630
- var row = _ref5.row;
3758
+ var row = _ref6.row;
3631
3759
  var selection = this.selection,
3632
3760
  afterFullData = this.afterFullData,
3633
3761
  treeConfig = this.treeConfig,
@@ -3658,7 +3786,7 @@ var Methods = {
3658
3786
  return half === item;
3659
3787
  });
3660
3788
 
3661
- _this29.handleCheckboxReserveRow(row, value);
3789
+ _this30.handleCheckboxReserveRow(row, value);
3662
3790
  }
3663
3791
  }, treeOpts);
3664
3792
  } // 如果存在父节点,更新父节点状态
@@ -3732,7 +3860,7 @@ var Methods = {
3732
3860
  return half === item;
3733
3861
  });
3734
3862
 
3735
- _this29.handleCheckboxReserveRow(row, value);
3863
+ _this30.handleCheckboxReserveRow(row, value);
3736
3864
  }
3737
3865
  }, treeOpts);
3738
3866
  } // 如果存在父节点,更新父节点状态
@@ -3836,7 +3964,7 @@ var Methods = {
3836
3964
  * @param {Boolean} value 是否选中
3837
3965
  */
3838
3966
  setAllCheckboxRow: function setAllCheckboxRow(value) {
3839
- var _this30 = this;
3967
+ var _this31 = this;
3840
3968
 
3841
3969
  var afterFullData = this.afterFullData,
3842
3970
  treeConfig = this.treeConfig,
@@ -3949,11 +4077,11 @@ var Methods = {
3949
4077
  if (reserve) {
3950
4078
  if (value) {
3951
4079
  selectRows.forEach(function (row) {
3952
- checkboxReserveRowMap[getRowid(_this30, row)] = row;
4080
+ checkboxReserveRowMap[getRowid(_this31, row)] = row;
3953
4081
  });
3954
4082
  } else {
3955
4083
  afterFullData.forEach(function (row) {
3956
- return _this30.handleCheckboxReserveRow(row, false);
4084
+ return _this31.handleCheckboxReserveRow(row, false);
3957
4085
  });
3958
4086
  }
3959
4087
  }
@@ -4148,7 +4276,7 @@ var Methods = {
4148
4276
  * 获取复选框保留选中的行
4149
4277
  */
4150
4278
  getCheckboxReserveRecords: function getCheckboxReserveRecords(isFull) {
4151
- var _this31 = this;
4279
+ var _this32 = this;
4152
4280
 
4153
4281
  var fullDataRowIdData = this.fullDataRowIdData,
4154
4282
  afterFullData = this.afterFullData,
@@ -4163,11 +4291,11 @@ var Methods = {
4163
4291
 
4164
4292
  if (treeConfig) {
4165
4293
  _xeUtils.default.eachTree(afterFullData, function (row) {
4166
- afterFullIdMaps[getRowid(_this31, row)] = 1;
4294
+ afterFullIdMaps[getRowid(_this32, row)] = 1;
4167
4295
  }, treeOpts);
4168
4296
  } else {
4169
4297
  afterFullData.forEach(function (row) {
4170
- afterFullIdMaps[getRowid(_this31, row)] = 1;
4298
+ afterFullIdMaps[getRowid(_this32, row)] = 1;
4171
4299
  });
4172
4300
  }
4173
4301
 
@@ -4233,7 +4361,7 @@ var Methods = {
4233
4361
  * 清空行为不管是否被禁用还是保留记录,都将彻底清空选中状态
4234
4362
  */
4235
4363
  clearCheckboxRow: function clearCheckboxRow() {
4236
- var _this32 = this;
4364
+ var _this33 = this;
4237
4365
 
4238
4366
  var tableFullData = this.tableFullData,
4239
4367
  treeConfig = this.treeConfig,
@@ -4256,7 +4384,7 @@ var Methods = {
4256
4384
 
4257
4385
  if (reserve) {
4258
4386
  tableFullData.forEach(function (row) {
4259
- return _this32.handleCheckboxReserveRow(row, false);
4387
+ return _this33.handleCheckboxReserveRow(row, false);
4260
4388
  });
4261
4389
  }
4262
4390
 
@@ -4447,8 +4575,8 @@ var Methods = {
4447
4575
  /**
4448
4576
  * 行 hover 事件
4449
4577
  */
4450
- triggerHoverEvent: function triggerHoverEvent(evnt, _ref6) {
4451
- var row = _ref6.row;
4578
+ triggerHoverEvent: function triggerHoverEvent(evnt, _ref7) {
4579
+ var row = _ref7.row;
4452
4580
  this.setHoverRow(row);
4453
4581
  },
4454
4582
  setHoverRow: function setHoverRow(row) {
@@ -4548,13 +4676,13 @@ var Methods = {
4548
4676
  * 如果存在规则,则校验
4549
4677
  */
4550
4678
  handleChangeCell: function handleChangeCell(evnt, params) {
4551
- var _this33 = this;
4679
+ var _this34 = this;
4552
4680
 
4553
4681
  this.checkValidate('blur').catch(function (e) {
4554
4682
  return e;
4555
4683
  }).then(function () {
4556
- _this33.handleActived(params, evnt).then(function () {
4557
- return _this33.checkValidate('change');
4684
+ _this34.handleActived(params, evnt).then(function () {
4685
+ return _this34.checkValidate('change');
4558
4686
  }).catch(function (e) {
4559
4687
  return e;
4560
4688
  });
@@ -4657,7 +4785,7 @@ var Methods = {
4657
4785
  * 如果是双击模式,则激活为编辑状态
4658
4786
  */
4659
4787
  triggerCellDblclickEvent: function triggerCellDblclickEvent(evnt, params) {
4660
- var _this34 = this;
4788
+ var _this35 = this;
4661
4789
 
4662
4790
  var editStore = this.editStore,
4663
4791
  editConfig = this.editConfig,
@@ -4672,15 +4800,15 @@ var Methods = {
4672
4800
  this.checkValidate('blur').catch(function (e) {
4673
4801
  return e;
4674
4802
  }).then(function () {
4675
- _this34.handleActived(params, evnt).then(function () {
4676
- return _this34.checkValidate('change');
4803
+ _this35.handleActived(params, evnt).then(function () {
4804
+ return _this35.checkValidate('change');
4677
4805
  }).catch(function (e) {
4678
4806
  return e;
4679
4807
  });
4680
4808
  });
4681
4809
  } else if (editOpts.mode === 'cell') {
4682
4810
  this.handleActived(params, evnt).then(function () {
4683
- return _this34.checkValidate('change');
4811
+ return _this35.checkValidate('change');
4684
4812
  }).catch(function (e) {
4685
4813
  return e;
4686
4814
  });
@@ -4691,7 +4819,7 @@ var Methods = {
4691
4819
  this.emitEvent('cell-dblclick', params, evnt);
4692
4820
  },
4693
4821
  handleDefaultSort: function handleDefaultSort() {
4694
- var _this35 = this;
4822
+ var _this36 = this;
4695
4823
 
4696
4824
  var sortConfig = this.sortConfig,
4697
4825
  sortOpts = this.sortOpts;
@@ -4708,7 +4836,7 @@ var Methods = {
4708
4836
  order = item.order;
4709
4837
 
4710
4838
  if (field && order) {
4711
- var column = _this35.getColumnByField(field);
4839
+ var column = _this36.getColumnByField(field);
4712
4840
 
4713
4841
  if (column && column.sortable) {
4714
4842
  column.order = order;
@@ -4751,7 +4879,7 @@ var Methods = {
4751
4879
  }
4752
4880
  },
4753
4881
  sort: function sort(sortConfs, sortOrder) {
4754
- var _this36 = this;
4882
+ var _this37 = this;
4755
4883
 
4756
4884
  var sortOpts = this.sortOpts;
4757
4885
  var multiple = sortOpts.multiple,
@@ -4784,7 +4912,7 @@ var Methods = {
4784
4912
  var column = field;
4785
4913
 
4786
4914
  if (_xeUtils.default.isString(field)) {
4787
- column = _this36.getColumnByField(field);
4915
+ column = _this37.getColumnByField(field);
4788
4916
  }
4789
4917
 
4790
4918
  if (column && (column.sortable || column.remoteSort)) {
@@ -4793,7 +4921,7 @@ var Methods = {
4793
4921
  }
4794
4922
 
4795
4923
  if (orders.indexOf(order) === -1) {
4796
- order = getNextSortOrder(_this36, column);
4924
+ order = getNextSortOrder(_this37, column);
4797
4925
  }
4798
4926
 
4799
4927
  if (column.order !== order) {
@@ -4944,7 +5072,7 @@ var Methods = {
4944
5072
  * @param {Row} row 行对象
4945
5073
  */
4946
5074
  reloadRowExpand: function reloadRowExpand(row) {
4947
- var _this37 = this;
5075
+ var _this38 = this;
4948
5076
 
4949
5077
  var expandOpts = this.expandOpts,
4950
5078
  expandLazyLoadeds = this.expandLazyLoadeds;
@@ -4952,7 +5080,7 @@ var Methods = {
4952
5080
 
4953
5081
  if (lazy && expandLazyLoadeds.indexOf(row) === -1) {
4954
5082
  this.clearRowExpandLoaded(row).then(function () {
4955
- return _this37.handleAsyncRowExpand(row);
5083
+ return _this38.handleAsyncRowExpand(row);
4956
5084
  });
4957
5085
  }
4958
5086
 
@@ -5031,29 +5159,29 @@ var Methods = {
5031
5159
  return this.setRowExpand(this.expandOpts.lazy ? this.tableData : this.tableFullData, expanded);
5032
5160
  },
5033
5161
  handleAsyncRowExpand: function handleAsyncRowExpand(row) {
5034
- var _this38 = this;
5162
+ var _this39 = this;
5035
5163
 
5036
5164
  var rest = this.fullAllDataRowMap.get(row);
5037
5165
  return new Promise(function (resolve) {
5038
- _this38.expandLazyLoadeds.push(row);
5166
+ _this39.expandLazyLoadeds.push(row);
5039
5167
 
5040
- _this38.expandOpts.loadMethod({
5041
- $table: _this38,
5168
+ _this39.expandOpts.loadMethod({
5169
+ $table: _this39,
5042
5170
  row: row,
5043
- rowIndex: _this38.getRowIndex(row),
5044
- $rowIndex: _this38.getVMRowIndex(row)
5171
+ rowIndex: _this39.getRowIndex(row),
5172
+ $rowIndex: _this39.getVMRowIndex(row)
5045
5173
  }).catch(function (e) {
5046
5174
  return e;
5047
5175
  }).then(function () {
5048
5176
  rest.expandLoaded = true;
5049
5177
 
5050
- _xeUtils.default.remove(_this38.expandLazyLoadeds, function (item) {
5178
+ _xeUtils.default.remove(_this39.expandLazyLoadeds, function (item) {
5051
5179
  return item === row;
5052
5180
  });
5053
5181
 
5054
- _this38.rowExpandeds.push(row);
5182
+ _this39.rowExpandeds.push(row);
5055
5183
 
5056
- resolve(_this38.$nextTick().then(_this38.recalculate));
5184
+ resolve(_this39.$nextTick().then(_this39.recalculate));
5057
5185
  });
5058
5186
  });
5059
5187
  },
@@ -5066,7 +5194,7 @@ var Methods = {
5066
5194
  * @param {Boolean} expanded 是否展开
5067
5195
  */
5068
5196
  setRowExpand: function setRowExpand(rows, expanded) {
5069
- var _this39 = this;
5197
+ var _this40 = this;
5070
5198
 
5071
5199
  var fullAllDataRowMap = this.fullAllDataRowMap,
5072
5200
  expandLazyLoadeds = this.expandLazyLoadeds,
@@ -5099,8 +5227,8 @@ var Methods = {
5099
5227
  columnIndex: columnIndex,
5100
5228
  $columnIndex: $columnIndex,
5101
5229
  row: row,
5102
- rowIndex: _this39.getRowIndex(row),
5103
- $rowIndex: _this39.getVMRowIndex(row)
5230
+ rowIndex: _this40.getRowIndex(row),
5231
+ $rowIndex: _this40.getVMRowIndex(row)
5104
5232
  });
5105
5233
  }) : rows;
5106
5234
 
@@ -5111,7 +5239,7 @@ var Methods = {
5111
5239
  var isLoad = lazy && !rest.expandLoaded && expandLazyLoadeds.indexOf(row) === -1;
5112
5240
 
5113
5241
  if (isLoad) {
5114
- lazyRests.push(_this39.handleAsyncRowExpand(row));
5242
+ lazyRests.push(_this40.handleAsyncRowExpand(row));
5115
5243
  } else {
5116
5244
  rowExpandeds.push(row);
5117
5245
  }
@@ -5125,7 +5253,7 @@ var Methods = {
5125
5253
 
5126
5254
  if (reserve) {
5127
5255
  validRows.forEach(function (row) {
5128
- return _this39.handleRowExpandReserve(row, expanded);
5256
+ return _this40.handleRowExpandReserve(row, expanded);
5129
5257
  });
5130
5258
  }
5131
5259
  }
@@ -5146,7 +5274,7 @@ var Methods = {
5146
5274
  * 手动清空展开行状态,数据会恢复成未展开的状态
5147
5275
  */
5148
5276
  clearRowExpand: function clearRowExpand() {
5149
- var _this40 = this;
5277
+ var _this41 = this;
5150
5278
 
5151
5279
  var expandOpts = this.expandOpts,
5152
5280
  rowExpandeds = this.rowExpandeds,
@@ -5157,13 +5285,13 @@ var Methods = {
5157
5285
 
5158
5286
  if (reserve) {
5159
5287
  tableFullData.forEach(function (row) {
5160
- return _this40.handleRowExpandReserve(row, false);
5288
+ return _this41.handleRowExpandReserve(row, false);
5161
5289
  });
5162
5290
  }
5163
5291
 
5164
5292
  return this.$nextTick().then(function () {
5165
5293
  if (isExists) {
5166
- _this40.recalculate();
5294
+ _this41.recalculate();
5167
5295
  }
5168
5296
  });
5169
5297
  },
@@ -5218,7 +5346,8 @@ var Methods = {
5218
5346
  var treeOpts = this.treeOpts,
5219
5347
  treeExpandeds = this.treeExpandeds,
5220
5348
  fullAllDataRowMap = this.fullAllDataRowMap;
5221
- var lazy = treeOpts.lazy;
5349
+ var transform = treeOpts.transform,
5350
+ lazy = treeOpts.lazy;
5222
5351
  var rest = fullAllDataRowMap.get(row);
5223
5352
 
5224
5353
  if (lazy && rest) {
@@ -5229,6 +5358,11 @@ var Methods = {
5229
5358
  });
5230
5359
  }
5231
5360
 
5361
+ if (transform) {
5362
+ this.handleVirtualTreeToList();
5363
+ return this.handleTableData();
5364
+ }
5365
+
5232
5366
  return this.$nextTick();
5233
5367
  },
5234
5368
 
@@ -5237,7 +5371,7 @@ var Methods = {
5237
5371
  * @param {Row} row 行对象
5238
5372
  */
5239
5373
  reloadTreeExpand: function reloadTreeExpand(row) {
5240
- var _this41 = this;
5374
+ var _this42 = this;
5241
5375
 
5242
5376
  var treeOpts = this.treeOpts,
5243
5377
  treeLazyLoadeds = this.treeLazyLoadeds;
@@ -5247,13 +5381,13 @@ var Methods = {
5247
5381
 
5248
5382
  if (lazy && row[hasChild] && treeLazyLoadeds.indexOf(row) === -1) {
5249
5383
  this.clearTreeExpandLoaded(row).then(function () {
5250
- return _this41.handleAsyncTreeExpandChilds(row);
5384
+ return _this42.handleAsyncTreeExpandChilds(row);
5251
5385
  }).then(function () {
5252
5386
  if (transform) {
5253
- return _this41.updateVirtualTreeData();
5387
+ return _this42.handleTableData();
5254
5388
  }
5255
5389
  }).then(function () {
5256
- return _this41.recalculate();
5390
+ return _this42.recalculate();
5257
5391
  });
5258
5392
  }
5259
5393
 
@@ -5331,20 +5465,21 @@ var Methods = {
5331
5465
  }
5332
5466
  },
5333
5467
  handleAsyncTreeExpandChilds: function handleAsyncTreeExpandChilds(row) {
5334
- var _this42 = this;
5468
+ var _this43 = this;
5335
5469
 
5336
5470
  var fullAllDataRowMap = this.fullAllDataRowMap,
5337
5471
  treeExpandeds = this.treeExpandeds,
5338
5472
  treeOpts = this.treeOpts,
5339
5473
  treeLazyLoadeds = this.treeLazyLoadeds,
5340
5474
  checkboxOpts = this.checkboxOpts;
5341
- var loadMethod = treeOpts.loadMethod;
5475
+ var transform = treeOpts.transform,
5476
+ loadMethod = treeOpts.loadMethod;
5342
5477
  var checkStrictly = checkboxOpts.checkStrictly;
5343
5478
  var rest = fullAllDataRowMap.get(row);
5344
5479
  return new Promise(function (resolve) {
5345
5480
  treeLazyLoadeds.push(row);
5346
5481
  loadMethod({
5347
- $table: _this42,
5482
+ $table: _this43,
5348
5483
  row: row
5349
5484
  }).catch(function () {
5350
5485
  return [];
@@ -5360,19 +5495,33 @@ var Methods = {
5360
5495
  }
5361
5496
 
5362
5497
  if (childRecords) {
5363
- _this42.loadTreeChildren(row, childRecords).then(function (childRows) {
5498
+ _this43.loadTreeChildren(row, childRecords).then(function (childRows) {
5364
5499
  if (childRows.length && treeExpandeds.indexOf(row) === -1) {
5365
5500
  treeExpandeds.push(row);
5366
5501
  } // 如果当前节点已选中,则展开后子节点也被选中
5367
5502
 
5368
5503
 
5369
- if (!checkStrictly && _this42.isCheckedByCheckboxRow(row)) {
5370
- _this42.setCheckboxRow(childRows, true);
5504
+ if (!checkStrictly && _this43.isCheckedByCheckboxRow(row)) {
5505
+ _this43.setCheckboxRow(childRows, true);
5371
5506
  }
5507
+
5508
+ _this43.$nextTick().then(function () {
5509
+ if (transform) {
5510
+ return _this43.handleTableData();
5511
+ }
5512
+ }).then(function () {
5513
+ return _this43.recalculate();
5514
+ }).then(function () {
5515
+ return resolve();
5516
+ });
5517
+ });
5518
+ } else {
5519
+ _this43.$nextTick().then(function () {
5520
+ return _this43.recalculate();
5521
+ }).then(function () {
5522
+ return resolve();
5372
5523
  });
5373
5524
  }
5374
-
5375
- resolve(_this42.$nextTick().then(_this42.recalculate));
5376
5525
  });
5377
5526
  });
5378
5527
  },
@@ -5406,7 +5555,7 @@ var Methods = {
5406
5555
  * @returns
5407
5556
  */
5408
5557
  handleBaseTreeExpand: function handleBaseTreeExpand(rows, expanded) {
5409
- var _this43 = this;
5558
+ var _this44 = this;
5410
5559
 
5411
5560
  var fullAllDataRowMap = this.fullAllDataRowMap,
5412
5561
  tableFullData = this.tableFullData,
@@ -5454,7 +5603,7 @@ var Methods = {
5454
5603
  var isLoad = lazy && row[hasChild] && !rest.treeLoaded && treeLazyLoadeds.indexOf(row) === -1; // 是否使用懒加载
5455
5604
 
5456
5605
  if (isLoad) {
5457
- result.push(_this43.handleAsyncTreeExpandChilds(row));
5606
+ result.push(_this44.handleAsyncTreeExpandChilds(row));
5458
5607
  } else {
5459
5608
  if (row[children] && row[children].length) {
5460
5609
  treeExpandeds.push(row);
@@ -5470,40 +5619,12 @@ var Methods = {
5470
5619
 
5471
5620
  if (reserve) {
5472
5621
  validRows.forEach(function (row) {
5473
- return _this43.handleTreeExpandReserve(row, expanded);
5622
+ return _this44.handleTreeExpandReserve(row, expanded);
5474
5623
  });
5475
5624
  }
5476
5625
 
5477
5626
  return Promise.all(result).then(this.recalculate);
5478
5627
  },
5479
- updateVirtualTreeData: function updateVirtualTreeData() {
5480
- var _this44 = this;
5481
-
5482
- var oldScrollYLoad = this.scrollYLoad,
5483
- treeExpandeds = this.treeExpandeds,
5484
- treeOpts = this.treeOpts,
5485
- treeFullData = this.treeFullData;
5486
- var fullData = [];
5487
- var expandMaps = new Map();
5488
-
5489
- _xeUtils.default.eachTree(treeFullData, function (row, index, items, path, parent) {
5490
- if (!parent || expandMaps.has(parent) && treeExpandeds.indexOf(parent) > -1) {
5491
- expandMaps.set(row, 1);
5492
- fullData.push(row);
5493
- }
5494
- }, treeOpts);
5495
-
5496
- var scrollYLoad = this.updateScrollYStatus(fullData);
5497
- this.tableFullData = scrollYLoad ? fullData : treeFullData;
5498
-
5499
- if (scrollYLoad || oldScrollYLoad !== scrollYLoad) {
5500
- return this.handleTableData(true).then(function () {
5501
- return _this44.recalculate();
5502
- });
5503
- }
5504
-
5505
- return this.$nextTick();
5506
- },
5507
5628
 
5508
5629
  /**
5509
5630
  * 虚拟树的展开与收起
@@ -5515,7 +5636,9 @@ var Methods = {
5515
5636
  var _this45 = this;
5516
5637
 
5517
5638
  return this.handleBaseTreeExpand(rows, expanded).then(function () {
5518
- return _this45.updateVirtualTreeData();
5639
+ _this45.handleVirtualTreeToList();
5640
+
5641
+ return _this45.handleTableData();
5519
5642
  }).then(function () {
5520
5643
  return _this45.recalculate();
5521
5644
  });
@@ -5567,7 +5690,8 @@ var Methods = {
5567
5690
  var treeOpts = this.treeOpts,
5568
5691
  treeExpandeds = this.treeExpandeds,
5569
5692
  tableFullData = this.tableFullData;
5570
- var reserve = treeOpts.reserve;
5693
+ var transform = treeOpts.transform,
5694
+ reserve = treeOpts.reserve;
5571
5695
  var isExists = treeExpandeds.length;
5572
5696
  this.treeExpandeds = [];
5573
5697
 
@@ -5577,7 +5701,11 @@ var Methods = {
5577
5701
  }, treeOpts);
5578
5702
  }
5579
5703
 
5580
- return this.updateVirtualTreeData().then(function () {
5704
+ return this.handleTableData().then(function () {
5705
+ if (transform) {
5706
+ _this46.handleVirtualTreeToList();
5707
+ }
5708
+
5581
5709
  if (isExists) {
5582
5710
  _this46.recalculate();
5583
5711
  }
@@ -6049,8 +6177,8 @@ var Methods = {
6049
6177
  }
6050
6178
 
6051
6179
  _this50.clearValidate();
6052
- }).catch(function (_ref7) {
6053
- var rule = _ref7.rule;
6180
+ }).catch(function (_ref8) {
6181
+ var rule = _ref8.rule;
6054
6182
 
6055
6183
  if (customVal) {
6056
6184
  setCellValue(row, column, cellValue);