vxe-table 3.4.6 → 3.4.7

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.
Files changed (43) hide show
  1. package/lib/button/src/button.js +15 -14
  2. package/lib/button/src/button.min.js +1 -1
  3. package/lib/edit/src/mixin.js +19 -25
  4. package/lib/edit/src/mixin.min.js +1 -1
  5. package/lib/export/src/mixin.js +4 -10
  6. package/lib/export/src/mixin.min.js +1 -1
  7. package/lib/filter/src/mixin.js +25 -1
  8. package/lib/filter/src/mixin.min.js +1 -1
  9. package/lib/index.umd.js +734 -445
  10. package/lib/index.umd.min.js +1 -1
  11. package/lib/select/src/select.js +1 -1
  12. package/lib/select/src/select.min.js +1 -1
  13. package/lib/table/src/body.js +9 -17
  14. package/lib/table/src/body.min.js +1 -1
  15. package/lib/table/src/cell.js +16 -17
  16. package/lib/table/src/cell.min.js +1 -1
  17. package/lib/table/src/methods.js +567 -346
  18. package/lib/table/src/methods.min.js +1 -1
  19. package/lib/table/src/util.js +7 -0
  20. package/lib/table/src/util.min.js +1 -1
  21. package/lib/tools/src/dom.js +2 -9
  22. package/lib/tools/src/dom.min.js +1 -1
  23. package/lib/tools/src/utils.js +1 -1
  24. package/lib/tools/src/utils.min.js +1 -1
  25. package/lib/v-x-e-table/src/conf.js +2 -1
  26. package/lib/v-x-e-table/src/conf.min.js +1 -1
  27. package/lib/validator/src/mixin.js +1 -1
  28. package/lib/validator/src/mixin.min.js +1 -1
  29. package/package.json +3 -4
  30. package/packages/button/src/button.js +14 -14
  31. package/packages/edit/src/mixin.js +18 -21
  32. package/packages/export/src/mixin.js +4 -7
  33. package/packages/filter/src/mixin.js +20 -1
  34. package/packages/select/src/select.js +1 -1
  35. package/packages/table/src/body.js +12 -16
  36. package/packages/table/src/cell.js +15 -15
  37. package/packages/table/src/methods.js +173 -51
  38. package/packages/table/src/util.js +4 -0
  39. package/packages/tools/src/dom.js +2 -7
  40. package/packages/tools/src/utils.js +1 -1
  41. package/packages/v-x-e-table/src/conf.js +2 -1
  42. package/packages/validator/src/mixin.js +1 -1
  43. package/types/table.d.ts +1 -0
@@ -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,46 @@ var Methods = {
439
439
  return this.handleTableData(true).then(this.updateFooter).then(this.recalculate);
440
440
  },
441
441
  handleTableData: function handleTableData(force) {
442
- 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);
442
+ var _this2 = this;
443
+
444
+ var treeConfig = this.treeConfig,
445
+ scrollYLoad = this.scrollYLoad,
446
+ scrollYStore = this.scrollYStore,
447
+ fullDataRowIdData = this.fullDataRowIdData,
448
+ treeExpandeds = this.treeExpandeds,
449
+ treeOpts = this.treeOpts;
450
+ var fullList = []; // 是否进行数据处理
451
+
452
+ if (force) {
453
+ this.updateAfterFullData();
454
+ } // 如果为虚拟树,将树结构拍平
455
+
456
+
457
+ if (treeConfig && treeOpts.transform) {
458
+ var expandMaps = new Map();
459
+
460
+ _xeUtils.default.eachTree(this.afterTreeFullData, function (row, index, items, path, parent) {
461
+ if (!parent || expandMaps.has(parent) && treeExpandeds.indexOf(parent) > -1) {
462
+ expandMaps.set(row, 1);
463
+ fullList.push(row);
464
+ }
465
+ }, {
466
+ children: treeOpts.mapChildren
467
+ });
468
+ } else {
469
+ fullList = this.afterFullData;
470
+ }
471
+
472
+ var tableData = scrollYLoad ? fullList.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullList.slice(0);
473
+ tableData.forEach(function (row, $index) {
474
+ var rowid = getRowid(_this2, row);
475
+ var rest = fullDataRowIdData[rowid];
476
+
477
+ if (rest) {
478
+ rest.$index = $index;
479
+ }
480
+ });
481
+ this.tableData = tableData;
446
482
  return this.$nextTick();
447
483
  },
448
484
  updateScrollYStatus: function updateScrollYStatus(fullData) {
@@ -460,7 +496,7 @@ var Methods = {
460
496
  * @param {Array} datas 数据
461
497
  */
462
498
  loadTableData: function loadTableData(datas) {
463
- var _this2 = this;
499
+ var _this3 = this;
464
500
 
465
501
  var keepSource = this.keepSource,
466
502
  treeConfig = this.treeConfig,
@@ -490,6 +526,14 @@ var Methods = {
490
526
  _tools.UtilTools.error('vxe.error.reqProp', ['tree-config.children']);
491
527
  }
492
528
 
529
+ if (!treeOpts.mapChildren) {
530
+ _tools.UtilTools.error('vxe.error.reqProp', ['tree-config.mapChildren']);
531
+ }
532
+
533
+ if (treeOpts.children === treeOpts.mapChildren) {
534
+ _tools.UtilTools.error('vxe.error.errConflicts', ['tree-config.children', 'tree-config.mapChildren']);
535
+ }
536
+
493
537
  fullData.forEach(function (row) {
494
538
  if (row[treeOpts.children] && row[treeOpts.children].length) {
495
539
  _tools.UtilTools.warn('vxe.error.errConflicts', ['tree-config.transform', "row.".concat(treeOpts.children)]);
@@ -500,7 +544,8 @@ var Methods = {
500
544
  treeData = _xeUtils.default.toArrayTree(fullData, {
501
545
  key: treeOpts.rowField,
502
546
  parentKey: treeOpts.parentField,
503
- children: treeOpts.children
547
+ children: treeOpts.children,
548
+ mapChildren: treeOpts.mapChildren
504
549
  });
505
550
  fullData = treeData.slice(0);
506
551
  } else {
@@ -518,7 +563,7 @@ var Methods = {
518
563
  this.scrollYLoad = sYLoad; // 全量数据
519
564
 
520
565
  this.tableFullData = fullData;
521
- this.treeFullData = treeData; // 缓存数据
566
+ this.tableFullTreeData = treeData; // 缓存数据
522
567
 
523
568
  this.cacheRowMap(true); // 原始数据
524
569
 
@@ -554,31 +599,31 @@ var Methods = {
554
599
  this.handleTableData(true);
555
600
  this.updateFooter();
556
601
  return this.$nextTick().then(function () {
557
- _this2.updateHeight();
602
+ _this3.updateHeight();
558
603
 
559
- _this2.updateStyle();
604
+ _this3.updateStyle();
560
605
  }).then(function () {
561
- _this2.computeScrollLoad();
606
+ _this3.computeScrollLoad();
562
607
  }).then(function () {
563
608
  // 是否启用了虚拟滚动
564
609
  if (sYLoad) {
565
610
  scrollYStore.endIndex = scrollYStore.visibleSize;
566
611
  }
567
612
 
568
- _this2.handleReserveStatus();
613
+ _this3.handleReserveStatus();
569
614
 
570
- _this2.checkSelectionStatus();
615
+ _this3.checkSelectionStatus();
571
616
 
572
617
  return new Promise(function (resolve) {
573
- _this2.$nextTick().then(function () {
574
- return _this2.recalculate();
618
+ _this3.$nextTick().then(function () {
619
+ return _this3.recalculate();
575
620
  }).then(function () {
576
621
  // 是否变更虚拟滚动
577
622
  if (oldScrollYLoad === sYLoad) {
578
- (0, _util.restoreScrollLocation)(_this2, lastScrollLeft, lastScrollTop).then(resolve);
623
+ (0, _util.restoreScrollLocation)(_this3, lastScrollLeft, lastScrollTop).then(resolve);
579
624
  } else {
580
625
  setTimeout(function () {
581
- return (0, _util.restoreScrollLocation)(_this2, lastScrollLeft, lastScrollTop).then(resolve);
626
+ return (0, _util.restoreScrollLocation)(_this3, lastScrollLeft, lastScrollTop).then(resolve);
582
627
  });
583
628
  }
584
629
  });
@@ -591,23 +636,23 @@ var Methods = {
591
636
  * @param {Array} datas 数据
592
637
  */
593
638
  loadData: function loadData(datas) {
594
- var _this3 = this;
639
+ var _this4 = this;
595
640
 
596
641
  var inited = this.inited,
597
642
  initStatus = this.initStatus;
598
643
  return this.loadTableData(datas).then(function () {
599
- _this3.inited = true;
600
- _this3.initStatus = true;
644
+ _this4.inited = true;
645
+ _this4.initStatus = true;
601
646
 
602
647
  if (!initStatus) {
603
- _this3.handleLoadDefaults();
648
+ _this4.handleLoadDefaults();
604
649
  }
605
650
 
606
651
  if (!inited) {
607
- _this3.handleInitDefaults();
652
+ _this4.handleInitDefaults();
608
653
  }
609
654
 
610
- return _this3.recalculate();
655
+ return _this4.recalculate();
611
656
  });
612
657
  },
613
658
 
@@ -616,21 +661,21 @@ var Methods = {
616
661
  * @param {Array} datas 数据
617
662
  */
618
663
  reloadData: function reloadData(datas) {
619
- var _this4 = this;
664
+ var _this5 = this;
620
665
 
621
666
  var inited = this.inited;
622
667
  return this.clearAll().then(function () {
623
- _this4.inited = true;
624
- _this4.initStatus = true;
625
- return _this4.loadTableData(datas);
668
+ _this5.inited = true;
669
+ _this5.initStatus = true;
670
+ return _this5.loadTableData(datas);
626
671
  }).then(function () {
627
- _this4.handleLoadDefaults();
672
+ _this5.handleLoadDefaults();
628
673
 
629
674
  if (!inited) {
630
- _this4.handleInitDefaults();
675
+ _this5.handleInitDefaults();
631
676
  }
632
677
 
633
- return _this4.recalculate();
678
+ return _this5.recalculate();
634
679
  });
635
680
  },
636
681
 
@@ -680,10 +725,10 @@ var Methods = {
680
725
  * @param {ColumnInfo} columns 列配置
681
726
  */
682
727
  loadColumn: function loadColumn(columns) {
683
- var _this5 = this;
728
+ var _this6 = this;
684
729
 
685
730
  var collectColumn = _xeUtils.default.mapTree(columns, function (column) {
686
- return _cell.default.createColumn(_this5, column);
731
+ return _cell.default.createColumn(_this6, column);
687
732
  }, {
688
733
  children: 'children'
689
734
  });
@@ -697,14 +742,14 @@ var Methods = {
697
742
  * @param {ColumnInfo} columns 列配置
698
743
  */
699
744
  reloadColumn: function reloadColumn(columns) {
700
- var _this6 = this;
745
+ var _this7 = this;
701
746
 
702
747
  return this.clearAll().then(function () {
703
- return _this6.loadColumn(columns);
748
+ return _this7.loadColumn(columns);
704
749
  });
705
750
  },
706
751
  handleColumn: function handleColumn(collectColumn) {
707
- var _this7 = this;
752
+ var _this8 = this;
708
753
 
709
754
  this.collectColumn = collectColumn;
710
755
  var tableFullColumn = getColumnList(collectColumn);
@@ -712,8 +757,8 @@ var Methods = {
712
757
  this.cacheColumnMap();
713
758
  this.restoreCustomStorage();
714
759
  this.parseColumns().then(function () {
715
- if (_this7.scrollXLoad) {
716
- _this7.loadScrollXData(true);
760
+ if (_this8.scrollXLoad) {
761
+ _this8.loadScrollXData(true);
717
762
  }
718
763
  });
719
764
  this.clearMergeCells();
@@ -727,14 +772,14 @@ var Methods = {
727
772
  }
728
773
 
729
774
  return this.$nextTick().then(function () {
730
- if (_this7.$toolbar) {
731
- _this7.$toolbar.syncUpdate({
775
+ if (_this8.$toolbar) {
776
+ _this8.$toolbar.syncUpdate({
732
777
  collectColumn: collectColumn,
733
- $table: _this7
778
+ $table: _this8
734
779
  });
735
780
  }
736
781
 
737
- return _this7.recalculate();
782
+ return _this8.recalculate();
738
783
  });
739
784
  },
740
785
 
@@ -743,20 +788,23 @@ var Methods = {
743
788
  * 牺牲数据组装的耗时,用来换取使用过程中的流畅
744
789
  */
745
790
  cacheRowMap: function cacheRowMap(source) {
746
- var _this8 = this;
791
+ var _this9 = this;
747
792
 
748
793
  var treeConfig = this.treeConfig,
749
794
  treeOpts = this.treeOpts,
750
795
  tableFullData = this.tableFullData,
751
796
  fullDataRowMap = this.fullDataRowMap,
752
- fullAllDataRowMap = this.fullAllDataRowMap;
797
+ fullAllDataRowMap = this.fullAllDataRowMap,
798
+ tableFullTreeData = this.tableFullTreeData;
753
799
  var fullDataRowIdData = this.fullDataRowIdData,
754
800
  fullAllDataRowIdData = this.fullAllDataRowIdData;
755
801
  var rowkey = getRowkey(this);
756
802
  var isLazy = treeConfig && treeOpts.lazy;
757
803
 
758
804
  var handleCache = function handleCache(row, index, items, path, parent, nodes) {
759
- var rowid = getRowid(_this8, row);
805
+ var rowid = getRowid(_this9, row);
806
+ var seq = treeConfig && path ? (0, _util.toTreePathSeq)(path) : index + 1;
807
+ var level = nodes ? nodes.length - 1 : 0;
760
808
 
761
809
  if ((0, _utils.eqEmptyValue)(rowid)) {
762
810
  rowid = getRowUniqueId();
@@ -771,10 +819,13 @@ var Methods = {
771
819
  var rest = {
772
820
  row: row,
773
821
  rowid: rowid,
822
+ seq: seq,
774
823
  index: treeConfig && parent ? -1 : index,
824
+ _index: -1,
825
+ $index: -1,
775
826
  items: items,
776
827
  parent: parent,
777
- level: nodes ? nodes.length - 1 : 0
828
+ level: level
778
829
  };
779
830
 
780
831
  if (source) {
@@ -795,13 +846,13 @@ var Methods = {
795
846
  fullAllDataRowMap.clear();
796
847
 
797
848
  if (treeConfig) {
798
- _xeUtils.default.eachTree(tableFullData, handleCache, treeOpts);
849
+ _xeUtils.default.eachTree(tableFullTreeData, handleCache, treeOpts);
799
850
  } else {
800
851
  tableFullData.forEach(handleCache);
801
852
  }
802
853
  },
803
854
  loadTreeChildren: function loadTreeChildren(row, childRecords) {
804
- var _this9 = this;
855
+ var _this10 = this;
805
856
 
806
857
  var keepSource = this.keepSource,
807
858
  tableSourceData = this.tableSourceData,
@@ -810,15 +861,17 @@ var Methods = {
810
861
  fullDataRowMap = this.fullDataRowMap,
811
862
  fullAllDataRowMap = this.fullAllDataRowMap,
812
863
  fullAllDataRowIdData = this.fullAllDataRowIdData;
813
- var children = treeOpts.children;
864
+ var transform = treeOpts.transform,
865
+ children = treeOpts.children,
866
+ mapChildren = treeOpts.mapChildren;
814
867
  var rest = fullAllDataRowIdData[getRowid(this, row)];
815
868
  var parentLevel = rest ? rest.level : 0;
816
869
  return this.createData(childRecords).then(function (rows) {
817
870
  if (keepSource) {
818
- var rowid = getRowid(_this9, row);
871
+ var rowid = getRowid(_this10, row);
819
872
 
820
873
  var matchObj = _xeUtils.default.findTree(tableSourceData, function (item) {
821
- return rowid === getRowid(_this9, item);
874
+ return rowid === getRowid(_this10, item);
822
875
  }, treeOpts);
823
876
 
824
877
  if (matchObj) {
@@ -827,11 +880,14 @@ var Methods = {
827
880
  }
828
881
 
829
882
  _xeUtils.default.eachTree(rows, function (childRow, index, items, path, parent, nodes) {
830
- var rowid = getRowid(_this9, childRow);
883
+ var rowid = getRowid(_this10, childRow);
831
884
  var rest = {
832
885
  row: childRow,
833
886
  rowid: rowid,
887
+ seq: -1,
834
888
  index: -1,
889
+ _index: -1,
890
+ $index: -1,
835
891
  items: items,
836
892
  parent: parent,
837
893
  level: parentLevel + nodes.length
@@ -843,6 +899,11 @@ var Methods = {
843
899
  }, treeOpts);
844
900
 
845
901
  row[children] = rows;
902
+
903
+ if (transform) {
904
+ row[mapChildren] = rows;
905
+ }
906
+
846
907
  return rows;
847
908
  });
848
909
  },
@@ -852,7 +913,7 @@ var Methods = {
852
913
  * 牺牲数据组装的耗时,用来换取使用过程中的流畅
853
914
  */
854
915
  cacheColumnMap: function cacheColumnMap() {
855
- var _this10 = this;
916
+ var _this11 = this;
856
917
 
857
918
  var tableFullColumn = this.tableFullColumn,
858
919
  collectColumn = this.collectColumn,
@@ -939,16 +1000,16 @@ var Methods = {
939
1000
  }
940
1001
 
941
1002
  if (process.env.NODE_ENV === 'development') {
942
- if (_this10.showOverflow && column.showOverflow === false) {
943
- _tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-overflow=".concat(_this10.showOverflow), "column.show-overflow=".concat(column.showOverflow)]);
1003
+ if (_this11.showOverflow && column.showOverflow === false) {
1004
+ _tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-overflow=".concat(_this11.showOverflow), "column.show-overflow=".concat(column.showOverflow)]);
944
1005
  }
945
1006
 
946
- if (_this10.showHeaderOverflow && column.showHeaderOverflow === false) {
947
- _tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-header-overflow=".concat(_this10.showHeaderOverflow), "column.show-header-overflow=".concat(column.showHeaderOverflow)]);
1007
+ if (_this11.showHeaderOverflow && column.showHeaderOverflow === false) {
1008
+ _tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-header-overflow=".concat(_this11.showHeaderOverflow), "column.show-header-overflow=".concat(column.showHeaderOverflow)]);
948
1009
  }
949
1010
 
950
- if (_this10.showFooterOverflow && column.showFooterOverflow === false) {
951
- _tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-footer-overflow=".concat(_this10.showFooterOverflow), "column.show-footer-overflow=".concat(column.showFooterOverflow)]);
1011
+ if (_this11.showFooterOverflow && column.showFooterOverflow === false) {
1012
+ _tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-footer-overflow=".concat(_this11.showFooterOverflow), "column.show-footer-overflow=".concat(column.showFooterOverflow)]);
952
1013
  }
953
1014
  }
954
1015
 
@@ -1035,6 +1096,25 @@ var Methods = {
1035
1096
  return null;
1036
1097
  },
1037
1098
 
1099
+ /**
1100
+ * 根据 row 获取序号
1101
+ * @param {Row} row 行对象
1102
+ */
1103
+ getRowSeq: function getRowSeq(row) {
1104
+ var fullDataRowIdData = this.fullDataRowIdData;
1105
+
1106
+ if (row) {
1107
+ var rowid = getRowid(this, row);
1108
+ var rest = fullDataRowIdData[rowid];
1109
+
1110
+ if (rest) {
1111
+ return rest.seq;
1112
+ }
1113
+ }
1114
+
1115
+ return -1;
1116
+ },
1117
+
1038
1118
  /**
1039
1119
  * 根据 row 获取相对于 data 中的索引
1040
1120
  * @param {Row} row 行对象
@@ -1181,13 +1261,13 @@ var Methods = {
1181
1261
  * @param {Array} records 新数据
1182
1262
  */
1183
1263
  createData: function createData(records) {
1184
- var _this11 = this;
1264
+ var _this12 = this;
1185
1265
 
1186
1266
  var treeConfig = this.treeConfig,
1187
1267
  treeOpts = this.treeOpts;
1188
1268
 
1189
1269
  var handleRrecord = function handleRrecord(record) {
1190
- return _this11.defineField(Object.assign({}, record));
1270
+ return _this12.defineField(Object.assign({}, record));
1191
1271
  };
1192
1272
 
1193
1273
  var rows = treeConfig ? _xeUtils.default.mapTree(records, handleRrecord, treeOpts) : records.map(handleRrecord);
@@ -1202,7 +1282,7 @@ var Methods = {
1202
1282
  * @param {Array/Object} records 新数据
1203
1283
  */
1204
1284
  createRow: function createRow(records) {
1205
- var _this12 = this;
1285
+ var _this13 = this;
1206
1286
 
1207
1287
  var isArr = _xeUtils.default.isArray(records);
1208
1288
 
@@ -1211,7 +1291,7 @@ var Methods = {
1211
1291
  }
1212
1292
 
1213
1293
  return this.$nextTick().then(function () {
1214
- return _this12.createData(records).then(function (rows) {
1294
+ return _this13.createData(records).then(function (rows) {
1215
1295
  return isArr ? rows : rows[0];
1216
1296
  });
1217
1297
  });
@@ -1225,7 +1305,7 @@ var Methods = {
1225
1305
  * 如果还额外传了 field 则还原指定的单元格数据
1226
1306
  */
1227
1307
  revertData: function revertData(rows, field) {
1228
- var _this13 = this;
1308
+ var _this14 = this;
1229
1309
 
1230
1310
  var keepSource = this.keepSource,
1231
1311
  tableSourceData = this.tableSourceData,
@@ -1251,8 +1331,8 @@ var Methods = {
1251
1331
 
1252
1332
  if (targetRows.length) {
1253
1333
  targetRows.forEach(function (row) {
1254
- if (!_this13.isInsertByRow(row)) {
1255
- var rowIndex = _this13.getRowIndex(row);
1334
+ if (!_this14.isInsertByRow(row)) {
1335
+ var rowIndex = _this14.getRowIndex(row);
1256
1336
 
1257
1337
  if (treeConfig && rowIndex === -1) {
1258
1338
  throw new Error(_tools.UtilTools.getLog('vxe.error.noTree', ['revertData']));
@@ -1336,7 +1416,7 @@ var Methods = {
1336
1416
  * @param {String} field 字段名
1337
1417
  */
1338
1418
  isUpdateByRow: function isUpdateByRow(row, field) {
1339
- var _this14 = this;
1419
+ var _this15 = this;
1340
1420
 
1341
1421
  var visibleColumn = this.visibleColumn,
1342
1422
  keepSource = this.keepSource,
@@ -1357,7 +1437,7 @@ var Methods = {
1357
1437
  var children = treeOpts.children;
1358
1438
 
1359
1439
  var matchObj = _xeUtils.default.findTree(tableSourceData, function (item) {
1360
- return rowid === getRowid(_this14, item);
1440
+ return rowid === getRowid(_this15, item);
1361
1441
  }, treeOpts);
1362
1442
 
1363
1443
  row = Object.assign({}, row, _defineProperty({}, children, null));
@@ -1481,18 +1561,23 @@ var Methods = {
1481
1561
  * 如果存在筛选条件,继续处理
1482
1562
  */
1483
1563
  updateAfterFullData: function updateAfterFullData() {
1484
- var _this15 = this;
1564
+ var _this16 = this;
1485
1565
 
1486
1566
  var tableFullColumn = this.tableFullColumn,
1487
1567
  tableFullData = this.tableFullData,
1488
1568
  filterOpts = this.filterOpts,
1489
- sortOpts = this.sortOpts;
1569
+ sortOpts = this.sortOpts,
1570
+ treeConfig = this.treeConfig,
1571
+ treeOpts = this.treeOpts,
1572
+ tableFullTreeData = this.tableFullTreeData;
1490
1573
  var allRemoteFilter = filterOpts.remote,
1491
1574
  allFilterMethod = filterOpts.filterMethod;
1492
1575
  var allRemoteSort = sortOpts.remote,
1493
1576
  allSortMethod = sortOpts.sortMethod,
1494
1577
  sortMultiple = sortOpts.multiple;
1495
- var tableData = tableFullData.slice(0);
1578
+ var transform = treeOpts.transform;
1579
+ var tableData = [];
1580
+ var tableTree = [];
1496
1581
  var filterColumns = [];
1497
1582
  var orderColumns = [];
1498
1583
  tableFullColumn.forEach(function (column) {
@@ -1529,7 +1614,7 @@ var Methods = {
1529
1614
  });
1530
1615
 
1531
1616
  if (filterColumns.length) {
1532
- tableData = tableData.filter(function (row) {
1617
+ var handleFilter = function handleFilter(row) {
1533
1618
  return filterColumns.every(function (_ref) {
1534
1619
  var column = _ref.column,
1535
1620
  valueList = _ref.valueList,
@@ -1552,7 +1637,7 @@ var Methods = {
1552
1637
  cellValue: cellValue,
1553
1638
  row: row,
1554
1639
  column: column,
1555
- $table: _this15
1640
+ $table: _this16
1556
1641
  });
1557
1642
  });
1558
1643
  } else if (compFilterMethod) {
@@ -1563,7 +1648,7 @@ var Methods = {
1563
1648
  cellValue: cellValue,
1564
1649
  row: row,
1565
1650
  column: column,
1566
- $table: _this15
1651
+ $table: _this16
1567
1652
  });
1568
1653
  });
1569
1654
  } else if (allFilterMethod) {
@@ -1582,7 +1667,7 @@ var Methods = {
1582
1667
  cellValue: cellValue,
1583
1668
  row: row,
1584
1669
  column: column,
1585
- $table: _this15
1670
+ $table: _this16
1586
1671
  });
1587
1672
  });
1588
1673
  }
@@ -1592,51 +1677,200 @@ var Methods = {
1592
1677
 
1593
1678
  return true;
1594
1679
  });
1595
- });
1680
+ };
1681
+
1682
+ if (treeConfig && transform) {
1683
+ // 筛选虚拟树
1684
+ tableTree = _xeUtils.default.searchTree(tableFullTreeData, handleFilter, _objectSpread(_objectSpread({}, treeOpts), {}, {
1685
+ original: true
1686
+ }));
1687
+ tableData = tableTree;
1688
+ } else {
1689
+ tableData = treeConfig ? tableFullTreeData.filter(handleFilter) : tableFullData.filter(handleFilter);
1690
+ tableTree = tableData;
1691
+ }
1692
+ } else {
1693
+ if (treeConfig && transform) {
1694
+ // 还原虚拟树
1695
+ tableTree = _xeUtils.default.searchTree(tableFullTreeData, function () {
1696
+ return true;
1697
+ }, _objectSpread(_objectSpread({}, treeOpts), {}, {
1698
+ original: true
1699
+ }));
1700
+ tableData = tableTree;
1701
+ } else {
1702
+ tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0);
1703
+ tableTree = tableData;
1704
+ }
1596
1705
  }
1597
1706
 
1598
1707
  var firstOrderColumn = orderColumns[0];
1599
1708
 
1600
1709
  if (!allRemoteSort && firstOrderColumn) {
1601
- if (allSortMethod) {
1602
- var sortRests = allSortMethod({
1603
- data: tableData,
1604
- column: firstOrderColumn.column,
1605
- property: firstOrderColumn.property,
1606
- order: firstOrderColumn.order,
1607
- sortList: orderColumns,
1608
- $table: this
1609
- });
1610
- tableData = _xeUtils.default.isArray(sortRests) ? sortRests : tableData;
1611
- } else {
1612
- // 兼容 v4
1613
- if (sortMultiple) {
1614
- tableData = _xeUtils.default.orderBy(tableData, orderColumns.map(function (_ref2) {
1710
+ if (treeConfig && transform) {
1711
+ // 虚拟树和列表一样,只能排序根级节点
1712
+ if (allSortMethod) {
1713
+ var sortRests = allSortMethod({
1714
+ data: tableTree,
1715
+ sortList: orderColumns,
1716
+ $table: this
1717
+ });
1718
+ tableTree = _xeUtils.default.isArray(sortRests) ? sortRests : tableTree;
1719
+ } else {
1720
+ tableTree = _xeUtils.default.orderBy(tableTree, orderColumns.map(function (_ref2) {
1615
1721
  var column = _ref2.column,
1616
1722
  order = _ref2.order;
1617
- return [getOrderField(_this15, column), order];
1723
+ return [getOrderField(_this16, column), order];
1618
1724
  }));
1725
+ }
1726
+
1727
+ tableData = tableTree;
1728
+ } else {
1729
+ if (allSortMethod) {
1730
+ var _sortRests = allSortMethod({
1731
+ data: tableData,
1732
+ column: firstOrderColumn.column,
1733
+ property: firstOrderColumn.property,
1734
+ order: firstOrderColumn.order,
1735
+ sortList: orderColumns,
1736
+ $table: this
1737
+ });
1738
+
1739
+ tableData = _xeUtils.default.isArray(_sortRests) ? _sortRests : tableData;
1619
1740
  } else {
1620
- // 兼容 v2,在 v4 中废弃, sortBy 不能为数组
1621
- var sortByConfs;
1741
+ // 兼容 v4
1742
+ if (sortMultiple) {
1743
+ tableData = _xeUtils.default.orderBy(tableData, orderColumns.map(function (_ref3) {
1744
+ var column = _ref3.column,
1745
+ order = _ref3.order;
1746
+ return [getOrderField(_this16, column), order];
1747
+ }));
1748
+ } else {
1749
+ // 兼容 v2,在 v4 中废弃, sortBy 不能为数组
1750
+ var sortByConfs;
1622
1751
 
1623
- if (_xeUtils.default.isArray(firstOrderColumn.sortBy)) {
1624
- sortByConfs = firstOrderColumn.sortBy.map(function (item) {
1625
- return [item, firstOrderColumn.order];
1626
- });
1627
- }
1752
+ if (_xeUtils.default.isArray(firstOrderColumn.sortBy)) {
1753
+ sortByConfs = firstOrderColumn.sortBy.map(function (item) {
1754
+ return [item, firstOrderColumn.order];
1755
+ });
1756
+ }
1628
1757
 
1629
- tableData = _xeUtils.default.orderBy(tableData, sortByConfs || [firstOrderColumn].map(function (_ref3) {
1630
- var column = _ref3.column,
1631
- order = _ref3.order;
1632
- return [getOrderField(_this15, column), order];
1633
- }));
1758
+ tableData = _xeUtils.default.orderBy(tableData, sortByConfs || [firstOrderColumn].map(function (_ref4) {
1759
+ var column = _ref4.column,
1760
+ order = _ref4.order;
1761
+ return [getOrderField(_this16, column), order];
1762
+ }));
1763
+ }
1634
1764
  }
1765
+
1766
+ tableTree = tableData;
1635
1767
  }
1636
1768
  }
1637
1769
 
1638
1770
  this.afterFullData = tableData;
1639
- return tableData;
1771
+ this.afterTreeFullData = tableTree;
1772
+ this.updateAfterDataIndex();
1773
+ },
1774
+
1775
+ /**
1776
+ * 预编译
1777
+ * 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
1778
+ */
1779
+ updateAfterDataIndex: function updateAfterDataIndex() {
1780
+ var _this17 = this;
1781
+
1782
+ var treeConfig = this.treeConfig,
1783
+ afterFullData = this.afterFullData,
1784
+ fullDataRowIdData = this.fullDataRowIdData,
1785
+ fullAllDataRowIdData = this.fullAllDataRowIdData,
1786
+ afterTreeFullData = this.afterTreeFullData,
1787
+ treeOpts = this.treeOpts;
1788
+
1789
+ if (treeConfig) {
1790
+ _xeUtils.default.eachTree(afterTreeFullData, function (row, index, items, path) {
1791
+ var rowid = getRowid(_this17, row);
1792
+ var allrest = fullAllDataRowIdData[rowid];
1793
+ var fullrest = fullDataRowIdData[rowid];
1794
+ var seq = path.map(function (num, i) {
1795
+ return i % 2 === 0 ? Number(num) + 1 : '.';
1796
+ }).join('');
1797
+
1798
+ if (allrest) {
1799
+ allrest.seq = seq;
1800
+ allrest._index = index;
1801
+ }
1802
+
1803
+ if (fullrest) {
1804
+ fullrest.seq = seq;
1805
+ fullrest._index = index;
1806
+ } else {
1807
+ fullAllDataRowIdData[rowid] = {
1808
+ row: row,
1809
+ rowid: rowid,
1810
+ seq: seq,
1811
+ index: -1,
1812
+ $index: -1,
1813
+ _index: index,
1814
+ items: [],
1815
+ parent: null,
1816
+ level: 0
1817
+ };
1818
+ fullDataRowIdData[rowid] = {
1819
+ row: row,
1820
+ rowid: rowid,
1821
+ seq: seq,
1822
+ index: -1,
1823
+ $index: -1,
1824
+ _index: index,
1825
+ items: [],
1826
+ parent: null,
1827
+ level: 0
1828
+ };
1829
+ }
1830
+ }, {
1831
+ children: treeOpts.mapChildren
1832
+ });
1833
+ } else {
1834
+ afterFullData.forEach(function (row, index) {
1835
+ var rowid = getRowid(_this17, row);
1836
+ var allrest = fullAllDataRowIdData[rowid];
1837
+ var fullrest = fullDataRowIdData[rowid];
1838
+ var seq = index + 1;
1839
+
1840
+ if (allrest) {
1841
+ allrest.seq = seq;
1842
+ allrest._index = index;
1843
+ }
1844
+
1845
+ if (fullrest) {
1846
+ fullrest.seq = seq;
1847
+ fullrest._index = index;
1848
+ } else {
1849
+ fullAllDataRowIdData[rowid] = {
1850
+ row: row,
1851
+ rowid: rowid,
1852
+ seq: seq,
1853
+ index: -1,
1854
+ $index: -1,
1855
+ _index: index,
1856
+ items: [],
1857
+ parent: null,
1858
+ level: 0
1859
+ };
1860
+ fullDataRowIdData[rowid] = {
1861
+ row: row,
1862
+ rowid: rowid,
1863
+ seq: seq,
1864
+ index: -1,
1865
+ $index: -1,
1866
+ _index: index,
1867
+ items: [],
1868
+ parent: null,
1869
+ level: 0
1870
+ };
1871
+ }
1872
+ });
1873
+ }
1640
1874
  },
1641
1875
 
1642
1876
  /**
@@ -1680,7 +1914,7 @@ var Methods = {
1680
1914
  * 默认执行一次,除非被重置
1681
1915
  */
1682
1916
  handleLoadDefaults: function handleLoadDefaults() {
1683
- var _this16 = this;
1917
+ var _this18 = this;
1684
1918
 
1685
1919
  if (this.checkboxConfig) {
1686
1920
  this.handleDefaultSelectionChecked();
@@ -1707,7 +1941,7 @@ var Methods = {
1707
1941
  }
1708
1942
 
1709
1943
  this.$nextTick(function () {
1710
- return setTimeout(_this16.recalculate);
1944
+ return setTimeout(_this18.recalculate);
1711
1945
  });
1712
1946
  },
1713
1947
 
@@ -1860,9 +2094,9 @@ var Methods = {
1860
2094
  }
1861
2095
  });
1862
2096
 
1863
- _xeUtils.default.each(customMap, function (_ref4, field) {
1864
- var visible = _ref4.visible,
1865
- resizeWidth = _ref4.resizeWidth;
2097
+ _xeUtils.default.each(customMap, function (_ref5, field) {
2098
+ var visible = _ref5.visible,
2099
+ resizeWidth = _ref5.resizeWidth;
1866
2100
  var column = keyMap[field];
1867
2101
 
1868
2102
  if (column) {
@@ -1964,12 +2198,12 @@ var Methods = {
1964
2198
  * 刷新列配置
1965
2199
  */
1966
2200
  refreshColumn: function refreshColumn() {
1967
- var _this17 = this;
2201
+ var _this19 = this;
1968
2202
 
1969
2203
  return this.parseColumns().then(function () {
1970
- return _this17.refreshScroll();
2204
+ return _this19.refreshScroll();
1971
2205
  }).then(function () {
1972
- return _this17.recalculate();
2206
+ return _this19.recalculate();
1973
2207
  });
1974
2208
  },
1975
2209
 
@@ -1978,7 +2212,7 @@ var Methods = {
1978
2212
  * 将固定的列左边、右边分别靠边
1979
2213
  */
1980
2214
  parseColumns: function parseColumns() {
1981
- var _this18 = this;
2215
+ var _this20 = this;
1982
2216
 
1983
2217
  var leftList = [];
1984
2218
  var centerList = [];
@@ -2105,11 +2339,11 @@ var Methods = {
2105
2339
  this.visibleColumn = visibleColumn;
2106
2340
  this.handleTableColumn();
2107
2341
  return this.updateFooter().then(function () {
2108
- return _this18.recalculate();
2342
+ return _this20.recalculate();
2109
2343
  }).then(function () {
2110
- _this18.updateCellAreas();
2344
+ _this20.updateCellAreas();
2111
2345
 
2112
- return _this18.recalculate();
2346
+ return _this20.recalculate();
2113
2347
  });
2114
2348
  },
2115
2349
 
@@ -2193,7 +2427,7 @@ var Methods = {
2193
2427
  * 支持 width=? width=?px width=?% min-width=? min-width=?px min-width=?%
2194
2428
  */
2195
2429
  recalculate: function recalculate(refull) {
2196
- var _this19 = this;
2430
+ var _this21 = this;
2197
2431
 
2198
2432
  var $refs = this.$refs;
2199
2433
  var tableBody = $refs.tableBody,
@@ -2209,9 +2443,9 @@ var Methods = {
2209
2443
  if (refull === true) {
2210
2444
  // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
2211
2445
  return this.computeScrollLoad().then(function () {
2212
- _this19.autoCellWidth(headerElem, bodyElem, footerElem);
2446
+ _this21.autoCellWidth(headerElem, bodyElem, footerElem);
2213
2447
 
2214
- return _this19.computeScrollLoad();
2448
+ return _this21.computeScrollLoad();
2215
2449
  });
2216
2450
  }
2217
2451
  }
@@ -2359,7 +2593,7 @@ var Methods = {
2359
2593
  this.customMaxHeight = calcHeight(this, 'maxHeight');
2360
2594
  },
2361
2595
  updateStyle: function updateStyle() {
2362
- var _this20 = this;
2596
+ var _this22 = this;
2363
2597
 
2364
2598
  var $refs = this.$refs,
2365
2599
  isGroup = this.isGroup,
@@ -2463,7 +2697,7 @@ var Methods = {
2463
2697
 
2464
2698
  if (isGroup && listElem) {
2465
2699
  _xeUtils.default.arrayEach(listElem.querySelectorAll('.col--group'), function (thElem) {
2466
- var colNode = _this20.getColumnNode(thElem);
2700
+ var colNode = _this22.getColumnNode(thElem);
2467
2701
 
2468
2702
  if (colNode) {
2469
2703
  var column = colNode.item;
@@ -2644,10 +2878,10 @@ var Methods = {
2644
2878
 
2645
2879
  if (cellElem) {
2646
2880
  if (colspan > 1) {
2647
- var columnIndex = _this20.getColumnIndex(column);
2881
+ var columnIndex = _this22.getColumnIndex(column);
2648
2882
 
2649
2883
  for (var _index = 1; _index < colspan; _index++) {
2650
- var nextColumn = _this20.getColumns(columnIndex + _index);
2884
+ var nextColumn = _this22.getColumns(columnIndex + _index);
2651
2885
 
2652
2886
  if (nextColumn) {
2653
2887
  colWidth += nextColumn.renderWidth;
@@ -2697,7 +2931,7 @@ var Methods = {
2697
2931
  }
2698
2932
  },
2699
2933
  preventEvent: function preventEvent(evnt, type, args, next, end) {
2700
- var _this21 = this;
2934
+ var _this23 = this;
2701
2935
 
2702
2936
  var evntList = _vXETable.default.interceptor.get(type);
2703
2937
 
@@ -2705,8 +2939,8 @@ var Methods = {
2705
2939
 
2706
2940
  if (!evntList.some(function (func) {
2707
2941
  return func(Object.assign({
2708
- $grid: _this21.$xegrid,
2709
- $table: _this21,
2942
+ $grid: _this23.$xegrid,
2943
+ $table: _this23,
2710
2944
  $event: evnt
2711
2945
  }, args)) === false;
2712
2946
  })) {
@@ -2726,7 +2960,7 @@ var Methods = {
2726
2960
  * 全局按下事件处理
2727
2961
  */
2728
2962
  handleGlobalMousedownEvent: function handleGlobalMousedownEvent(evnt) {
2729
- var _this22 = this;
2963
+ var _this24 = this;
2730
2964
 
2731
2965
  var $el = this.$el,
2732
2966
  $refs = this.$refs,
@@ -2787,7 +3021,7 @@ var Methods = {
2787
3021
  } // 如果固定了高度且点击了行之外的空白处,则清除激活状态
2788
3022
 
2789
3023
 
2790
- if (!isClearActived && _this22.height && !_this22.overflowY) {
3024
+ if (!isClearActived && _this24.height && !_this24.overflowY) {
2791
3025
  var bodyWrapperElem = evnt.target;
2792
3026
 
2793
3027
  if (hasClass(bodyWrapperElem, 'vxe-table--body-wrapper')) {
@@ -2798,7 +3032,7 @@ var Methods = {
2798
3032
  if (isClearActived || // 如果点击了当前表格之外
2799
3033
  !getEventTargetNode(evnt, $el).flag) {
2800
3034
  setTimeout(function () {
2801
- return _this22.clearActived(evnt);
3035
+ return _this24.clearActived(evnt);
2802
3036
  });
2803
3037
  }
2804
3038
  });
@@ -2812,9 +3046,9 @@ var Methods = {
2812
3046
 
2813
3047
  if (!getEventTargetNode(evnt, document.body, 'vxe-table--ignore-areas-clear').flag) {
2814
3048
  this.preventEvent(evnt, 'event.clearAreas', {}, function () {
2815
- _this22.clearCellAreas();
3049
+ _this24.clearCellAreas();
2816
3050
 
2817
- _this22.clearCopyCellArea();
3051
+ _this24.clearCopyCellArea();
2818
3052
  });
2819
3053
  }
2820
3054
  }
@@ -2849,7 +3083,7 @@ var Methods = {
2849
3083
  * 表格键盘事件
2850
3084
  */
2851
3085
  keydownEvent: function keydownEvent(evnt) {
2852
- var _this23 = this;
3086
+ var _this25 = this;
2853
3087
 
2854
3088
  var filterStore = this.filterStore,
2855
3089
  ctxMenuStore = this.ctxMenuStore,
@@ -2864,33 +3098,33 @@ var Methods = {
2864
3098
 
2865
3099
  if (isEsc) {
2866
3100
  this.preventEvent(evnt, 'event.keydown', null, function () {
2867
- if (keyboardConfig && mouseConfig && mouseOpts.area && _this23.handleKeyboardEvent) {
2868
- _this23.handleKeyboardEvent(evnt);
3101
+ if (keyboardConfig && mouseConfig && mouseOpts.area && _this25.handleKeyboardEvent) {
3102
+ _this25.handleKeyboardEvent(evnt);
2869
3103
  } else if (actived.row || filterStore.visible || ctxMenuStore.visible) {
2870
3104
  evnt.stopPropagation(); // 如果按下了 Esc 键,关闭快捷菜单、筛选
2871
3105
 
2872
- _this23.closeFilter();
3106
+ _this25.closeFilter();
2873
3107
 
2874
- _this23.closeMenu();
3108
+ _this25.closeMenu();
2875
3109
 
2876
3110
  if (keyboardConfig && keyboardOpts.isEsc) {
2877
3111
  // 如果是激活编辑状态,则取消编辑
2878
3112
  if (actived.row) {
2879
3113
  var params = actived.args;
2880
3114
 
2881
- _this23.clearActived(evnt); // 如果配置了选中功能,则为选中状态
3115
+ _this25.clearActived(evnt); // 如果配置了选中功能,则为选中状态
2882
3116
 
2883
3117
 
2884
3118
  if (mouseConfig && mouseOpts.selected) {
2885
- _this23.$nextTick(function () {
2886
- return _this23.handleSelected(params, evnt);
3119
+ _this25.$nextTick(function () {
3120
+ return _this25.handleSelected(params, evnt);
2887
3121
  });
2888
3122
  }
2889
3123
  }
2890
3124
  }
2891
3125
  }
2892
3126
 
2893
- _this23.emitEvent('keydown', {}, evnt);
3127
+ _this25.emitEvent('keydown', {}, evnt);
2894
3128
  });
2895
3129
  }
2896
3130
  },
@@ -2899,27 +3133,27 @@ var Methods = {
2899
3133
  * 全局键盘事件
2900
3134
  */
2901
3135
  handleGlobalKeydownEvent: function handleGlobalKeydownEvent(evnt) {
2902
- var _this24 = this;
3136
+ var _this26 = this;
2903
3137
 
2904
3138
  // 该行为只对当前激活的表格有效
2905
3139
  if (this.isActivated) {
2906
3140
  this.preventEvent(evnt, 'event.keydown', null, function () {
2907
- var filterStore = _this24.filterStore,
2908
- isCtxMenu = _this24.isCtxMenu,
2909
- ctxMenuStore = _this24.ctxMenuStore,
2910
- editStore = _this24.editStore,
2911
- editOpts = _this24.editOpts,
2912
- editConfig = _this24.editConfig,
2913
- mouseConfig = _this24.mouseConfig,
2914
- mouseOpts = _this24.mouseOpts,
2915
- keyboardConfig = _this24.keyboardConfig,
2916
- keyboardOpts = _this24.keyboardOpts,
2917
- treeConfig = _this24.treeConfig,
2918
- treeOpts = _this24.treeOpts,
2919
- highlightCurrentRow = _this24.highlightCurrentRow,
2920
- currentRow = _this24.currentRow,
2921
- bodyCtxMenu = _this24.bodyCtxMenu,
2922
- rowOpts = _this24.rowOpts;
3141
+ var filterStore = _this26.filterStore,
3142
+ isCtxMenu = _this26.isCtxMenu,
3143
+ ctxMenuStore = _this26.ctxMenuStore,
3144
+ editStore = _this26.editStore,
3145
+ editOpts = _this26.editOpts,
3146
+ editConfig = _this26.editConfig,
3147
+ mouseConfig = _this26.mouseConfig,
3148
+ mouseOpts = _this26.mouseOpts,
3149
+ keyboardConfig = _this26.keyboardConfig,
3150
+ keyboardOpts = _this26.keyboardOpts,
3151
+ treeConfig = _this26.treeConfig,
3152
+ treeOpts = _this26.treeOpts,
3153
+ highlightCurrentRow = _this26.highlightCurrentRow,
3154
+ currentRow = _this26.currentRow,
3155
+ bodyCtxMenu = _this26.bodyCtxMenu,
3156
+ rowOpts = _this26.rowOpts;
2923
3157
  var selected = editStore.selected,
2924
3158
  actived = editStore.actived;
2925
3159
  var keyCode = evnt.keyCode;
@@ -2946,7 +3180,7 @@ var Methods = {
2946
3180
 
2947
3181
  if (filterStore.visible) {
2948
3182
  if (isEsc) {
2949
- _this24.closeFilter();
3183
+ _this26.closeFilter();
2950
3184
  }
2951
3185
 
2952
3186
  return;
@@ -2957,20 +3191,20 @@ var Methods = {
2957
3191
  evnt.preventDefault();
2958
3192
 
2959
3193
  if (ctxMenuStore.showChild && hasChildrenList(ctxMenuStore.selected)) {
2960
- _this24.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selectChild', 37, false, ctxMenuStore.selected.children);
3194
+ _this26.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selectChild', 37, false, ctxMenuStore.selected.children);
2961
3195
  } else {
2962
- _this24.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selected', 39, true, _this24.ctxMenuList);
3196
+ _this26.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selected', 39, true, _this26.ctxMenuList);
2963
3197
  }
2964
- } else if (keyboardConfig && mouseConfig && mouseOpts.area && _this24.handleKeyboardEvent) {
2965
- _this24.handleKeyboardEvent(evnt);
3198
+ } else if (keyboardConfig && mouseConfig && mouseOpts.area && _this26.handleKeyboardEvent) {
3199
+ _this26.handleKeyboardEvent(evnt);
2966
3200
  } else if (keyboardConfig && isSpacebar && keyboardOpts.isChecked && selected.row && selected.column && (selected.column.type === 'checkbox' || selected.column.type === 'radio')) {
2967
3201
  // 空格键支持选中复选框
2968
3202
  evnt.preventDefault();
2969
3203
 
2970
3204
  if (selected.column.type === 'checkbox') {
2971
- _this24.handleToggleCheckRowEvent(evnt, selected.args);
3205
+ _this26.handleToggleCheckRowEvent(evnt, selected.args);
2972
3206
  } else {
2973
- _this24.triggerRadioRowEvent(evnt, selected.args);
3207
+ _this26.triggerRadioRowEvent(evnt, selected.args);
2974
3208
  }
2975
3209
  } else if (isF2 && (0, _utils.isEnableConf)(editConfig)) {
2976
3210
  if (!isEditStatus) {
@@ -2979,15 +3213,15 @@ var Methods = {
2979
3213
  evnt.stopPropagation();
2980
3214
  evnt.preventDefault();
2981
3215
 
2982
- _this24.handleActived(selected.args, evnt);
3216
+ _this26.handleActived(selected.args, evnt);
2983
3217
  }
2984
3218
  }
2985
3219
  } else if (isContextMenu) {
2986
3220
  // 如果按下上下文键
2987
- _this24._keyCtx = selected.row && selected.column && bodyCtxMenu.length;
2988
- clearTimeout(_this24.keyCtxTimeout);
2989
- _this24.keyCtxTimeout = setTimeout(function () {
2990
- _this24._keyCtx = false;
3221
+ _this26._keyCtx = selected.row && selected.column && bodyCtxMenu.length;
3222
+ clearTimeout(_this26.keyCtxTimeout);
3223
+ _this26.keyCtxTimeout = setTimeout(function () {
3224
+ _this26._keyCtx = false;
2991
3225
  }, 1000);
2992
3226
  } else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow)) {
2993
3227
  // 退出选中
@@ -2996,12 +3230,12 @@ var Methods = {
2996
3230
  if (actived.row) {
2997
3231
  params = actived.args;
2998
3232
 
2999
- _this24.clearActived(evnt); // 如果配置了选中功能,则为选中状态
3233
+ _this26.clearActived(evnt); // 如果配置了选中功能,则为选中状态
3000
3234
 
3001
3235
 
3002
3236
  if (mouseConfig && mouseOpts.selected) {
3003
- _this24.$nextTick(function () {
3004
- return _this24.handleSelected(params, evnt);
3237
+ _this26.$nextTick(function () {
3238
+ return _this26.handleSelected(params, evnt);
3005
3239
  });
3006
3240
  }
3007
3241
  }
@@ -3012,15 +3246,15 @@ var Methods = {
3012
3246
 
3013
3247
  if (hasShiftKey) {
3014
3248
  if (keyboardOpts.enterToTab) {
3015
- _this24.moveTabSelected(targetArgs, hasShiftKey, evnt);
3249
+ _this26.moveTabSelected(targetArgs, hasShiftKey, evnt);
3016
3250
  } else {
3017
- _this24.moveSelected(targetArgs, isLeftArrow, true, isRightArrow, false, evnt);
3251
+ _this26.moveSelected(targetArgs, isLeftArrow, true, isRightArrow, false, evnt);
3018
3252
  }
3019
3253
  } else {
3020
3254
  if (keyboardOpts.enterToTab) {
3021
- _this24.moveTabSelected(targetArgs, hasShiftKey, evnt);
3255
+ _this26.moveTabSelected(targetArgs, hasShiftKey, evnt);
3022
3256
  } else {
3023
- _this24.moveSelected(targetArgs, isLeftArrow, false, isRightArrow, true, evnt);
3257
+ _this26.moveSelected(targetArgs, isLeftArrow, false, isRightArrow, true, evnt);
3024
3258
  }
3025
3259
  }
3026
3260
  } else if (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
@@ -3031,14 +3265,14 @@ var Methods = {
3031
3265
  evnt.preventDefault();
3032
3266
  var targetRow = childrens[0];
3033
3267
  params = {
3034
- $table: _this24,
3268
+ $table: _this26,
3035
3269
  row: targetRow
3036
3270
  };
3037
3271
 
3038
- _this24.setTreeExpand(currentRow, true).then(function () {
3039
- return _this24.scrollToRow(targetRow);
3272
+ _this26.setTreeExpand(currentRow, true).then(function () {
3273
+ return _this26.scrollToRow(targetRow);
3040
3274
  }).then(function () {
3041
- return _this24.triggerCurrentRowEvent(evnt, params);
3275
+ return _this26.triggerCurrentRowEvent(evnt, params);
3042
3276
  });
3043
3277
  }
3044
3278
  }
@@ -3047,18 +3281,18 @@ var Methods = {
3047
3281
  if (!isEditStatus) {
3048
3282
  // 如果按下了方向键
3049
3283
  if (selected.row && selected.column) {
3050
- _this24.moveSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
3284
+ _this26.moveSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
3051
3285
  } else if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
3052
3286
  // 当前行按键上下移动
3053
- _this24.moveCurrentRow(isUpArrow, isDwArrow, evnt);
3287
+ _this26.moveCurrentRow(isUpArrow, isDwArrow, evnt);
3054
3288
  }
3055
3289
  }
3056
3290
  } else if (isTab && keyboardConfig && keyboardOpts.isTab) {
3057
3291
  // 如果按下了 Tab 键切换
3058
3292
  if (selected.row || selected.column) {
3059
- _this24.moveTabSelected(selected.args, hasShiftKey, evnt);
3293
+ _this26.moveTabSelected(selected.args, hasShiftKey, evnt);
3060
3294
  } else if (actived.row || actived.column) {
3061
- _this24.moveTabSelected(actived.args, hasShiftKey, evnt);
3295
+ _this26.moveTabSelected(actived.args, hasShiftKey, evnt);
3062
3296
  }
3063
3297
  } else if (keyboardConfig && (isDel || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow ? isBack && keyboardOpts.isArrow : isBack))) {
3064
3298
  if (!isEditStatus) {
@@ -3069,10 +3303,10 @@ var Methods = {
3069
3303
  if (delMethod) {
3070
3304
  delMethod({
3071
3305
  row: selected.row,
3072
- rowIndex: _this24.getRowIndex(selected.row),
3306
+ rowIndex: _this26.getRowIndex(selected.row),
3073
3307
  column: selected.column,
3074
- columnIndex: _this24.getColumnIndex(selected.column),
3075
- $table: _this24
3308
+ columnIndex: _this26.getColumnIndex(selected.column),
3309
+ $table: _this26
3076
3310
  });
3077
3311
  } else {
3078
3312
  setCellValue(selected.row, selected.column, null);
@@ -3082,21 +3316,21 @@ var Methods = {
3082
3316
  if (backMethod) {
3083
3317
  backMethod({
3084
3318
  row: selected.row,
3085
- rowIndex: _this24.getRowIndex(selected.row),
3319
+ rowIndex: _this26.getRowIndex(selected.row),
3086
3320
  column: selected.column,
3087
- columnIndex: _this24.getColumnIndex(selected.column),
3088
- $table: _this24
3321
+ columnIndex: _this26.getColumnIndex(selected.column),
3322
+ $table: _this26
3089
3323
  });
3090
3324
  } else {
3091
- _this24.handleActived(selected.args, evnt);
3325
+ _this26.handleActived(selected.args, evnt);
3092
3326
  }
3093
3327
  } else if (isDel) {
3094
3328
  // 如果按下 del 键,更新表尾数据
3095
- _this24.updateFooter();
3329
+ _this26.updateFooter();
3096
3330
  }
3097
3331
  } else if (isBack && keyboardOpts.isArrow && treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
3098
3332
  // 如果树形表格回退键关闭当前行返回父节点
3099
- var _XEUtils$findTree = _xeUtils.default.findTree(_this24.afterFullData, function (item) {
3333
+ var _XEUtils$findTree = _xeUtils.default.findTree(_this26.afterFullData, function (item) {
3100
3334
  return item === currentRow;
3101
3335
  }, treeOpts),
3102
3336
  parentRow = _XEUtils$findTree.parent;
@@ -3104,14 +3338,14 @@ var Methods = {
3104
3338
  if (parentRow) {
3105
3339
  evnt.preventDefault();
3106
3340
  params = {
3107
- $table: _this24,
3341
+ $table: _this26,
3108
3342
  row: parentRow
3109
3343
  };
3110
3344
 
3111
- _this24.setTreeExpand(parentRow, false).then(function () {
3112
- return _this24.scrollToRow(parentRow);
3345
+ _this26.setTreeExpand(parentRow, false).then(function () {
3346
+ return _this26.scrollToRow(parentRow);
3113
3347
  }).then(function () {
3114
- return _this24.triggerCurrentRowEvent(evnt, params);
3348
+ return _this26.triggerCurrentRowEvent(evnt, params);
3115
3349
  });
3116
3350
  }
3117
3351
  }
@@ -3128,21 +3362,21 @@ var Methods = {
3128
3362
  if (editMethod) {
3129
3363
  editMethod({
3130
3364
  row: selected.row,
3131
- rowIndex: _this24.getRowIndex(selected.row),
3365
+ rowIndex: _this26.getRowIndex(selected.row),
3132
3366
  column: selected.column,
3133
- columnIndex: _this24.getColumnIndex(selected.column),
3134
- $table: _this24
3367
+ columnIndex: _this26.getColumnIndex(selected.column),
3368
+ $table: _this26
3135
3369
  });
3136
3370
  } else {
3137
3371
  setCellValue(selected.row, selected.column, null);
3138
3372
 
3139
- _this24.handleActived(selected.args, evnt);
3373
+ _this26.handleActived(selected.args, evnt);
3140
3374
  }
3141
3375
  }
3142
3376
  }
3143
3377
  }
3144
3378
 
3145
- _this24.emitEvent('keydown', {}, evnt);
3379
+ _this26.emitEvent('keydown', {}, evnt);
3146
3380
  });
3147
3381
  }
3148
3382
  },
@@ -3212,12 +3446,12 @@ var Methods = {
3212
3446
  this.recalculate(true);
3213
3447
  },
3214
3448
  handleTooltipLeaveMethod: function handleTooltipLeaveMethod() {
3215
- var _this25 = this;
3449
+ var _this27 = this;
3216
3450
 
3217
3451
  var tooltipOpts = this.tooltipOpts;
3218
3452
  setTimeout(function () {
3219
- if (!_this25.tooltipActive) {
3220
- _this25.closeTooltip();
3453
+ if (!_this27.tooltipActive) {
3454
+ _this27.closeTooltip();
3221
3455
  }
3222
3456
  }, tooltipOpts.leaveDelay);
3223
3457
  return false;
@@ -3228,17 +3462,17 @@ var Methods = {
3228
3462
  this.closeTooltip();
3229
3463
  },
3230
3464
  handleTargetLeaveEvent: function handleTargetLeaveEvent() {
3231
- var _this26 = this;
3465
+ var _this28 = this;
3232
3466
 
3233
3467
  var tooltipOpts = this.tooltipOpts;
3234
3468
  this.tooltipActive = false;
3235
3469
 
3236
3470
  if (tooltipOpts.enterable) {
3237
3471
  this.tooltipTimeout = setTimeout(function () {
3238
- var tooltip = _this26.$refs.tooltip;
3472
+ var tooltip = _this28.$refs.tooltip;
3239
3473
 
3240
3474
  if (tooltip && !tooltip.isHover) {
3241
- _this26.closeTooltip();
3475
+ _this28.closeTooltip();
3242
3476
  }
3243
3477
  }, tooltipOpts.leaveDelay);
3244
3478
  } else {
@@ -3471,14 +3705,14 @@ var Methods = {
3471
3705
  * @param {Boolean} value 是否选中
3472
3706
  */
3473
3707
  setCheckboxRow: function setCheckboxRow(rows, value) {
3474
- var _this27 = this;
3708
+ var _this29 = this;
3475
3709
 
3476
3710
  if (rows && !_xeUtils.default.isArray(rows)) {
3477
3711
  rows = [rows];
3478
3712
  }
3479
3713
 
3480
3714
  rows.forEach(function (row) {
3481
- return _this27.handleSelectRow({
3715
+ return _this29.handleSelectRow({
3482
3716
  row: row
3483
3717
  }, !!value);
3484
3718
  });
@@ -3501,10 +3735,10 @@ var Methods = {
3501
3735
  * 多选,行选中事件
3502
3736
  * value 选中true 不选false 半选-1
3503
3737
  */
3504
- handleSelectRow: function handleSelectRow(_ref5, value) {
3505
- var _this28 = this;
3738
+ handleSelectRow: function handleSelectRow(_ref6, value) {
3739
+ var _this30 = this;
3506
3740
 
3507
- var row = _ref5.row;
3741
+ var row = _ref6.row;
3508
3742
  var selection = this.selection,
3509
3743
  afterFullData = this.afterFullData,
3510
3744
  treeConfig = this.treeConfig,
@@ -3535,7 +3769,7 @@ var Methods = {
3535
3769
  return half === item;
3536
3770
  });
3537
3771
 
3538
- _this28.handleCheckboxReserveRow(row, value);
3772
+ _this30.handleCheckboxReserveRow(row, value);
3539
3773
  }
3540
3774
  }, treeOpts);
3541
3775
  } // 如果存在父节点,更新父节点状态
@@ -3609,7 +3843,7 @@ var Methods = {
3609
3843
  return half === item;
3610
3844
  });
3611
3845
 
3612
- _this28.handleCheckboxReserveRow(row, value);
3846
+ _this30.handleCheckboxReserveRow(row, value);
3613
3847
  }
3614
3848
  }, treeOpts);
3615
3849
  } // 如果存在父节点,更新父节点状态
@@ -3713,7 +3947,7 @@ var Methods = {
3713
3947
  * @param {Boolean} value 是否选中
3714
3948
  */
3715
3949
  setAllCheckboxRow: function setAllCheckboxRow(value) {
3716
- var _this29 = this;
3950
+ var _this31 = this;
3717
3951
 
3718
3952
  var afterFullData = this.afterFullData,
3719
3953
  treeConfig = this.treeConfig,
@@ -3826,11 +4060,11 @@ var Methods = {
3826
4060
  if (reserve) {
3827
4061
  if (value) {
3828
4062
  selectRows.forEach(function (row) {
3829
- checkboxReserveRowMap[getRowid(_this29, row)] = row;
4063
+ checkboxReserveRowMap[getRowid(_this31, row)] = row;
3830
4064
  });
3831
4065
  } else {
3832
4066
  afterFullData.forEach(function (row) {
3833
- return _this29.handleCheckboxReserveRow(row, false);
4067
+ return _this31.handleCheckboxReserveRow(row, false);
3834
4068
  });
3835
4069
  }
3836
4070
  }
@@ -4025,7 +4259,7 @@ var Methods = {
4025
4259
  * 获取复选框保留选中的行
4026
4260
  */
4027
4261
  getCheckboxReserveRecords: function getCheckboxReserveRecords(isFull) {
4028
- var _this30 = this;
4262
+ var _this32 = this;
4029
4263
 
4030
4264
  var fullDataRowIdData = this.fullDataRowIdData,
4031
4265
  afterFullData = this.afterFullData,
@@ -4040,11 +4274,11 @@ var Methods = {
4040
4274
 
4041
4275
  if (treeConfig) {
4042
4276
  _xeUtils.default.eachTree(afterFullData, function (row) {
4043
- afterFullIdMaps[getRowid(_this30, row)] = 1;
4277
+ afterFullIdMaps[getRowid(_this32, row)] = 1;
4044
4278
  }, treeOpts);
4045
4279
  } else {
4046
4280
  afterFullData.forEach(function (row) {
4047
- afterFullIdMaps[getRowid(_this30, row)] = 1;
4281
+ afterFullIdMaps[getRowid(_this32, row)] = 1;
4048
4282
  });
4049
4283
  }
4050
4284
 
@@ -4110,7 +4344,7 @@ var Methods = {
4110
4344
  * 清空行为不管是否被禁用还是保留记录,都将彻底清空选中状态
4111
4345
  */
4112
4346
  clearCheckboxRow: function clearCheckboxRow() {
4113
- var _this31 = this;
4347
+ var _this33 = this;
4114
4348
 
4115
4349
  var tableFullData = this.tableFullData,
4116
4350
  treeConfig = this.treeConfig,
@@ -4133,7 +4367,7 @@ var Methods = {
4133
4367
 
4134
4368
  if (reserve) {
4135
4369
  tableFullData.forEach(function (row) {
4136
- return _this31.handleCheckboxReserveRow(row, false);
4370
+ return _this33.handleCheckboxReserveRow(row, false);
4137
4371
  });
4138
4372
  }
4139
4373
 
@@ -4324,8 +4558,8 @@ var Methods = {
4324
4558
  /**
4325
4559
  * 行 hover 事件
4326
4560
  */
4327
- triggerHoverEvent: function triggerHoverEvent(evnt, _ref6) {
4328
- var row = _ref6.row;
4561
+ triggerHoverEvent: function triggerHoverEvent(evnt, _ref7) {
4562
+ var row = _ref7.row;
4329
4563
  this.setHoverRow(row);
4330
4564
  },
4331
4565
  setHoverRow: function setHoverRow(row) {
@@ -4425,13 +4659,13 @@ var Methods = {
4425
4659
  * 如果存在规则,则校验
4426
4660
  */
4427
4661
  handleChangeCell: function handleChangeCell(evnt, params) {
4428
- var _this32 = this;
4662
+ var _this34 = this;
4429
4663
 
4430
4664
  this.checkValidate('blur').catch(function (e) {
4431
4665
  return e;
4432
4666
  }).then(function () {
4433
- _this32.handleActived(params, evnt).then(function () {
4434
- return _this32.checkValidate('change');
4667
+ _this34.handleActived(params, evnt).then(function () {
4668
+ return _this34.checkValidate('change');
4435
4669
  }).catch(function (e) {
4436
4670
  return e;
4437
4671
  });
@@ -4534,7 +4768,7 @@ var Methods = {
4534
4768
  * 如果是双击模式,则激活为编辑状态
4535
4769
  */
4536
4770
  triggerCellDblclickEvent: function triggerCellDblclickEvent(evnt, params) {
4537
- var _this33 = this;
4771
+ var _this35 = this;
4538
4772
 
4539
4773
  var editStore = this.editStore,
4540
4774
  editConfig = this.editConfig,
@@ -4549,15 +4783,15 @@ var Methods = {
4549
4783
  this.checkValidate('blur').catch(function (e) {
4550
4784
  return e;
4551
4785
  }).then(function () {
4552
- _this33.handleActived(params, evnt).then(function () {
4553
- return _this33.checkValidate('change');
4786
+ _this35.handleActived(params, evnt).then(function () {
4787
+ return _this35.checkValidate('change');
4554
4788
  }).catch(function (e) {
4555
4789
  return e;
4556
4790
  });
4557
4791
  });
4558
4792
  } else if (editOpts.mode === 'cell') {
4559
4793
  this.handleActived(params, evnt).then(function () {
4560
- return _this33.checkValidate('change');
4794
+ return _this35.checkValidate('change');
4561
4795
  }).catch(function (e) {
4562
4796
  return e;
4563
4797
  });
@@ -4568,7 +4802,7 @@ var Methods = {
4568
4802
  this.emitEvent('cell-dblclick', params, evnt);
4569
4803
  },
4570
4804
  handleDefaultSort: function handleDefaultSort() {
4571
- var _this34 = this;
4805
+ var _this36 = this;
4572
4806
 
4573
4807
  var sortConfig = this.sortConfig,
4574
4808
  sortOpts = this.sortOpts;
@@ -4585,7 +4819,7 @@ var Methods = {
4585
4819
  order = item.order;
4586
4820
 
4587
4821
  if (field && order) {
4588
- var column = _this34.getColumnByField(field);
4822
+ var column = _this36.getColumnByField(field);
4589
4823
 
4590
4824
  if (column && column.sortable) {
4591
4825
  column.order = order;
@@ -4628,7 +4862,7 @@ var Methods = {
4628
4862
  }
4629
4863
  },
4630
4864
  sort: function sort(sortConfs, sortOrder) {
4631
- var _this35 = this;
4865
+ var _this37 = this;
4632
4866
 
4633
4867
  var sortOpts = this.sortOpts;
4634
4868
  var multiple = sortOpts.multiple,
@@ -4661,7 +4895,7 @@ var Methods = {
4661
4895
  var column = field;
4662
4896
 
4663
4897
  if (_xeUtils.default.isString(field)) {
4664
- column = _this35.getColumnByField(field);
4898
+ column = _this37.getColumnByField(field);
4665
4899
  }
4666
4900
 
4667
4901
  if (column && (column.sortable || column.remoteSort)) {
@@ -4670,7 +4904,7 @@ var Methods = {
4670
4904
  }
4671
4905
 
4672
4906
  if (orders.indexOf(order) === -1) {
4673
- order = getNextSortOrder(_this35, column);
4907
+ order = getNextSortOrder(_this37, column);
4674
4908
  }
4675
4909
 
4676
4910
  if (column.order !== order) {
@@ -4821,7 +5055,7 @@ var Methods = {
4821
5055
  * @param {Row} row 行对象
4822
5056
  */
4823
5057
  reloadRowExpand: function reloadRowExpand(row) {
4824
- var _this36 = this;
5058
+ var _this38 = this;
4825
5059
 
4826
5060
  var expandOpts = this.expandOpts,
4827
5061
  expandLazyLoadeds = this.expandLazyLoadeds;
@@ -4829,7 +5063,7 @@ var Methods = {
4829
5063
 
4830
5064
  if (lazy && expandLazyLoadeds.indexOf(row) === -1) {
4831
5065
  this.clearRowExpandLoaded(row).then(function () {
4832
- return _this36.handleAsyncRowExpand(row);
5066
+ return _this38.handleAsyncRowExpand(row);
4833
5067
  });
4834
5068
  }
4835
5069
 
@@ -4908,29 +5142,29 @@ var Methods = {
4908
5142
  return this.setRowExpand(this.expandOpts.lazy ? this.tableData : this.tableFullData, expanded);
4909
5143
  },
4910
5144
  handleAsyncRowExpand: function handleAsyncRowExpand(row) {
4911
- var _this37 = this;
5145
+ var _this39 = this;
4912
5146
 
4913
5147
  var rest = this.fullAllDataRowMap.get(row);
4914
5148
  return new Promise(function (resolve) {
4915
- _this37.expandLazyLoadeds.push(row);
5149
+ _this39.expandLazyLoadeds.push(row);
4916
5150
 
4917
- _this37.expandOpts.loadMethod({
4918
- $table: _this37,
5151
+ _this39.expandOpts.loadMethod({
5152
+ $table: _this39,
4919
5153
  row: row,
4920
- rowIndex: _this37.getRowIndex(row),
4921
- $rowIndex: _this37.getVMRowIndex(row)
5154
+ rowIndex: _this39.getRowIndex(row),
5155
+ $rowIndex: _this39.getVMRowIndex(row)
4922
5156
  }).catch(function (e) {
4923
5157
  return e;
4924
5158
  }).then(function () {
4925
5159
  rest.expandLoaded = true;
4926
5160
 
4927
- _xeUtils.default.remove(_this37.expandLazyLoadeds, function (item) {
5161
+ _xeUtils.default.remove(_this39.expandLazyLoadeds, function (item) {
4928
5162
  return item === row;
4929
5163
  });
4930
5164
 
4931
- _this37.rowExpandeds.push(row);
5165
+ _this39.rowExpandeds.push(row);
4932
5166
 
4933
- resolve(_this37.$nextTick().then(_this37.recalculate));
5167
+ resolve(_this39.$nextTick().then(_this39.recalculate));
4934
5168
  });
4935
5169
  });
4936
5170
  },
@@ -4943,7 +5177,7 @@ var Methods = {
4943
5177
  * @param {Boolean} expanded 是否展开
4944
5178
  */
4945
5179
  setRowExpand: function setRowExpand(rows, expanded) {
4946
- var _this38 = this;
5180
+ var _this40 = this;
4947
5181
 
4948
5182
  var fullAllDataRowMap = this.fullAllDataRowMap,
4949
5183
  expandLazyLoadeds = this.expandLazyLoadeds,
@@ -4976,8 +5210,8 @@ var Methods = {
4976
5210
  columnIndex: columnIndex,
4977
5211
  $columnIndex: $columnIndex,
4978
5212
  row: row,
4979
- rowIndex: _this38.getRowIndex(row),
4980
- $rowIndex: _this38.getVMRowIndex(row)
5213
+ rowIndex: _this40.getRowIndex(row),
5214
+ $rowIndex: _this40.getVMRowIndex(row)
4981
5215
  });
4982
5216
  }) : rows;
4983
5217
 
@@ -4988,7 +5222,7 @@ var Methods = {
4988
5222
  var isLoad = lazy && !rest.expandLoaded && expandLazyLoadeds.indexOf(row) === -1;
4989
5223
 
4990
5224
  if (isLoad) {
4991
- lazyRests.push(_this38.handleAsyncRowExpand(row));
5225
+ lazyRests.push(_this40.handleAsyncRowExpand(row));
4992
5226
  } else {
4993
5227
  rowExpandeds.push(row);
4994
5228
  }
@@ -5002,7 +5236,7 @@ var Methods = {
5002
5236
 
5003
5237
  if (reserve) {
5004
5238
  validRows.forEach(function (row) {
5005
- return _this38.handleRowExpandReserve(row, expanded);
5239
+ return _this40.handleRowExpandReserve(row, expanded);
5006
5240
  });
5007
5241
  }
5008
5242
  }
@@ -5023,7 +5257,7 @@ var Methods = {
5023
5257
  * 手动清空展开行状态,数据会恢复成未展开的状态
5024
5258
  */
5025
5259
  clearRowExpand: function clearRowExpand() {
5026
- var _this39 = this;
5260
+ var _this41 = this;
5027
5261
 
5028
5262
  var expandOpts = this.expandOpts,
5029
5263
  rowExpandeds = this.rowExpandeds,
@@ -5034,13 +5268,13 @@ var Methods = {
5034
5268
 
5035
5269
  if (reserve) {
5036
5270
  tableFullData.forEach(function (row) {
5037
- return _this39.handleRowExpandReserve(row, false);
5271
+ return _this41.handleRowExpandReserve(row, false);
5038
5272
  });
5039
5273
  }
5040
5274
 
5041
5275
  return this.$nextTick().then(function () {
5042
5276
  if (isExists) {
5043
- _this39.recalculate();
5277
+ _this41.recalculate();
5044
5278
  }
5045
5279
  });
5046
5280
  },
@@ -5114,7 +5348,7 @@ var Methods = {
5114
5348
  * @param {Row} row 行对象
5115
5349
  */
5116
5350
  reloadTreeExpand: function reloadTreeExpand(row) {
5117
- var _this40 = this;
5351
+ var _this42 = this;
5118
5352
 
5119
5353
  var treeOpts = this.treeOpts,
5120
5354
  treeLazyLoadeds = this.treeLazyLoadeds;
@@ -5124,13 +5358,13 @@ var Methods = {
5124
5358
 
5125
5359
  if (lazy && row[hasChild] && treeLazyLoadeds.indexOf(row) === -1) {
5126
5360
  this.clearTreeExpandLoaded(row).then(function () {
5127
- return _this40.handleAsyncTreeExpandChilds(row);
5361
+ return _this42.handleAsyncTreeExpandChilds(row);
5128
5362
  }).then(function () {
5129
5363
  if (transform) {
5130
- return _this40.updateVirtualTreeData();
5364
+ return _this42.handleTableData();
5131
5365
  }
5132
5366
  }).then(function () {
5133
- return _this40.recalculate();
5367
+ return _this42.recalculate();
5134
5368
  });
5135
5369
  }
5136
5370
 
@@ -5208,20 +5442,21 @@ var Methods = {
5208
5442
  }
5209
5443
  },
5210
5444
  handleAsyncTreeExpandChilds: function handleAsyncTreeExpandChilds(row) {
5211
- var _this41 = this;
5445
+ var _this43 = this;
5212
5446
 
5213
5447
  var fullAllDataRowMap = this.fullAllDataRowMap,
5214
5448
  treeExpandeds = this.treeExpandeds,
5215
5449
  treeOpts = this.treeOpts,
5216
5450
  treeLazyLoadeds = this.treeLazyLoadeds,
5217
5451
  checkboxOpts = this.checkboxOpts;
5218
- var loadMethod = treeOpts.loadMethod;
5452
+ var transform = treeOpts.transform,
5453
+ loadMethod = treeOpts.loadMethod;
5219
5454
  var checkStrictly = checkboxOpts.checkStrictly;
5220
5455
  var rest = fullAllDataRowMap.get(row);
5221
5456
  return new Promise(function (resolve) {
5222
5457
  treeLazyLoadeds.push(row);
5223
5458
  loadMethod({
5224
- $table: _this41,
5459
+ $table: _this43,
5225
5460
  row: row
5226
5461
  }).catch(function () {
5227
5462
  return [];
@@ -5237,19 +5472,33 @@ var Methods = {
5237
5472
  }
5238
5473
 
5239
5474
  if (childRecords) {
5240
- _this41.loadTreeChildren(row, childRecords).then(function (childRows) {
5475
+ _this43.loadTreeChildren(row, childRecords).then(function (childRows) {
5241
5476
  if (childRows.length && treeExpandeds.indexOf(row) === -1) {
5242
5477
  treeExpandeds.push(row);
5243
5478
  } // 如果当前节点已选中,则展开后子节点也被选中
5244
5479
 
5245
5480
 
5246
- if (!checkStrictly && _this41.isCheckedByCheckboxRow(row)) {
5247
- _this41.setCheckboxRow(childRows, true);
5481
+ if (!checkStrictly && _this43.isCheckedByCheckboxRow(row)) {
5482
+ _this43.setCheckboxRow(childRows, true);
5248
5483
  }
5484
+
5485
+ _this43.$nextTick().then(function () {
5486
+ if (transform) {
5487
+ return _this43.handleTableData();
5488
+ }
5489
+ }).then(function () {
5490
+ return _this43.recalculate();
5491
+ }).then(function () {
5492
+ return resolve();
5493
+ });
5494
+ });
5495
+ } else {
5496
+ _this43.$nextTick().then(function () {
5497
+ return _this43.recalculate();
5498
+ }).then(function () {
5499
+ return resolve();
5249
5500
  });
5250
5501
  }
5251
-
5252
- resolve(_this41.$nextTick().then(_this41.recalculate));
5253
5502
  });
5254
5503
  });
5255
5504
  },
@@ -5283,7 +5532,7 @@ var Methods = {
5283
5532
  * @returns
5284
5533
  */
5285
5534
  handleBaseTreeExpand: function handleBaseTreeExpand(rows, expanded) {
5286
- var _this42 = this;
5535
+ var _this44 = this;
5287
5536
 
5288
5537
  var fullAllDataRowMap = this.fullAllDataRowMap,
5289
5538
  tableFullData = this.tableFullData,
@@ -5331,7 +5580,7 @@ var Methods = {
5331
5580
  var isLoad = lazy && row[hasChild] && !rest.treeLoaded && treeLazyLoadeds.indexOf(row) === -1; // 是否使用懒加载
5332
5581
 
5333
5582
  if (isLoad) {
5334
- result.push(_this42.handleAsyncTreeExpandChilds(row));
5583
+ result.push(_this44.handleAsyncTreeExpandChilds(row));
5335
5584
  } else {
5336
5585
  if (row[children] && row[children].length) {
5337
5586
  treeExpandeds.push(row);
@@ -5347,40 +5596,12 @@ var Methods = {
5347
5596
 
5348
5597
  if (reserve) {
5349
5598
  validRows.forEach(function (row) {
5350
- return _this42.handleTreeExpandReserve(row, expanded);
5599
+ return _this44.handleTreeExpandReserve(row, expanded);
5351
5600
  });
5352
5601
  }
5353
5602
 
5354
5603
  return Promise.all(result).then(this.recalculate);
5355
5604
  },
5356
- updateVirtualTreeData: function updateVirtualTreeData() {
5357
- var _this43 = this;
5358
-
5359
- var oldScrollYLoad = this.scrollYLoad,
5360
- treeExpandeds = this.treeExpandeds,
5361
- treeOpts = this.treeOpts,
5362
- treeFullData = this.treeFullData;
5363
- var fullData = [];
5364
- var expandMaps = new Map();
5365
-
5366
- _xeUtils.default.eachTree(treeFullData, function (row, index, items, path, parent) {
5367
- if (!parent || expandMaps.has(parent) && treeExpandeds.indexOf(parent) > -1) {
5368
- expandMaps.set(row, 1);
5369
- fullData.push(row);
5370
- }
5371
- }, treeOpts);
5372
-
5373
- var scrollYLoad = this.updateScrollYStatus(fullData);
5374
- this.tableFullData = scrollYLoad ? fullData : treeFullData;
5375
-
5376
- if (scrollYLoad || oldScrollYLoad !== scrollYLoad) {
5377
- return this.handleTableData(true).then(function () {
5378
- return _this43.recalculate();
5379
- });
5380
- }
5381
-
5382
- return this.$nextTick();
5383
- },
5384
5605
 
5385
5606
  /**
5386
5607
  * 虚拟树的展开与收起
@@ -5389,12 +5610,12 @@ var Methods = {
5389
5610
  * @returns
5390
5611
  */
5391
5612
  handleVirtualTreeExpand: function handleVirtualTreeExpand(rows, expanded) {
5392
- var _this44 = this;
5613
+ var _this45 = this;
5393
5614
 
5394
5615
  return this.handleBaseTreeExpand(rows, expanded).then(function () {
5395
- return _this44.updateVirtualTreeData();
5616
+ return _this45.handleTableData();
5396
5617
  }).then(function () {
5397
- return _this44.recalculate();
5618
+ return _this45.recalculate();
5398
5619
  });
5399
5620
  },
5400
5621
 
@@ -5439,7 +5660,7 @@ var Methods = {
5439
5660
  * 手动清空树形节点的展开状态,数据会恢复成未展开的状态
5440
5661
  */
5441
5662
  clearTreeExpand: function clearTreeExpand() {
5442
- var _this45 = this;
5663
+ var _this46 = this;
5443
5664
 
5444
5665
  var treeOpts = this.treeOpts,
5445
5666
  treeExpandeds = this.treeExpandeds,
@@ -5450,13 +5671,13 @@ var Methods = {
5450
5671
 
5451
5672
  if (reserve) {
5452
5673
  _xeUtils.default.eachTree(tableFullData, function (row) {
5453
- return _this45.handleTreeExpandReserve(row, false);
5674
+ return _this46.handleTreeExpandReserve(row, false);
5454
5675
  }, treeOpts);
5455
5676
  }
5456
5677
 
5457
- return this.updateVirtualTreeData().then(function () {
5678
+ return this.handleTableData().then(function () {
5458
5679
  if (isExists) {
5459
- _this45.recalculate();
5680
+ _this46.recalculate();
5460
5681
  }
5461
5682
  });
5462
5683
  },
@@ -5586,18 +5807,18 @@ var Methods = {
5586
5807
  },
5587
5808
  // 计算可视渲染相关数据
5588
5809
  computeScrollLoad: function computeScrollLoad() {
5589
- var _this46 = this;
5810
+ var _this47 = this;
5590
5811
 
5591
5812
  return this.$nextTick().then(function () {
5592
- var sYOpts = _this46.sYOpts,
5593
- sXOpts = _this46.sXOpts,
5594
- scrollXLoad = _this46.scrollXLoad,
5595
- scrollYLoad = _this46.scrollYLoad,
5596
- scrollXStore = _this46.scrollXStore,
5597
- scrollYStore = _this46.scrollYStore; // 计算 X 逻辑
5813
+ var sYOpts = _this47.sYOpts,
5814
+ sXOpts = _this47.sXOpts,
5815
+ scrollXLoad = _this47.scrollXLoad,
5816
+ scrollYLoad = _this47.scrollYLoad,
5817
+ scrollXStore = _this47.scrollXStore,
5818
+ scrollYStore = _this47.scrollYStore; // 计算 X 逻辑
5598
5819
 
5599
5820
  if (scrollXLoad) {
5600
- var _computeVirtualX3 = computeVirtualX(_this46),
5821
+ var _computeVirtualX3 = computeVirtualX(_this47),
5601
5822
  visibleXSize = _computeVirtualX3.visibleSize;
5602
5823
 
5603
5824
  var offsetXSize = sXOpts.oSize ? _xeUtils.default.toNumber(sXOpts.oSize) : _dom.browse.msie ? 10 : _dom.browse.edge ? 5 : 0;
@@ -5605,13 +5826,13 @@ var Methods = {
5605
5826
  scrollXStore.visibleSize = visibleXSize;
5606
5827
  scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
5607
5828
 
5608
- _this46.updateScrollXData();
5829
+ _this47.updateScrollXData();
5609
5830
  } else {
5610
- _this46.updateScrollXSpace();
5831
+ _this47.updateScrollXSpace();
5611
5832
  } // 计算 Y 逻辑
5612
5833
 
5613
5834
 
5614
- var _computeVirtualY = computeVirtualY(_this46),
5835
+ var _computeVirtualY = computeVirtualY(_this47),
5615
5836
  rowHeight = _computeVirtualY.rowHeight,
5616
5837
  visibleYSize = _computeVirtualY.visibleSize;
5617
5838
 
@@ -5623,14 +5844,14 @@ var Methods = {
5623
5844
  scrollYStore.visibleSize = visibleYSize;
5624
5845
  scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
5625
5846
 
5626
- _this46.updateScrollYData();
5847
+ _this47.updateScrollYData();
5627
5848
  } else {
5628
- _this46.updateScrollYSpace();
5849
+ _this47.updateScrollYSpace();
5629
5850
  }
5630
5851
 
5631
- _this46.rowHeight = rowHeight;
5852
+ _this47.rowHeight = rowHeight;
5632
5853
 
5633
- _this46.$nextTick(_this46.updateStyle);
5854
+ _this47.$nextTick(_this47.updateStyle);
5634
5855
  });
5635
5856
  },
5636
5857
  handleTableColumn: function handleTableColumn() {
@@ -5744,7 +5965,7 @@ var Methods = {
5744
5965
  * @param {Number} scrollTop 上距离
5745
5966
  */
5746
5967
  scrollTo: function scrollTo(scrollLeft, scrollTop) {
5747
- var _this47 = this;
5968
+ var _this48 = this;
5748
5969
 
5749
5970
  var $refs = this.$refs;
5750
5971
  var tableBody = $refs.tableBody,
@@ -5765,7 +5986,7 @@ var Methods = {
5765
5986
  if (this.scrollXLoad || this.scrollYLoad) {
5766
5987
  return new Promise(function (resolve) {
5767
5988
  return setTimeout(function () {
5768
- return resolve(_this47.$nextTick());
5989
+ return resolve(_this48.$nextTick());
5769
5990
  }, 50);
5770
5991
  });
5771
5992
  }
@@ -5816,7 +6037,7 @@ var Methods = {
5816
6037
  * @param {Row} row 行对象
5817
6038
  */
5818
6039
  scrollToTreeRow: function scrollToTreeRow(row) {
5819
- var _this48 = this;
6040
+ var _this49 = this;
5820
6041
 
5821
6042
  var tableFullData = this.tableFullData,
5822
6043
  treeConfig = this.treeConfig,
@@ -5831,15 +6052,15 @@ var Methods = {
5831
6052
  if (matchObj) {
5832
6053
  var nodes = matchObj.nodes;
5833
6054
  nodes.forEach(function (row, index) {
5834
- if (index < nodes.length - 1 && !_this48.isTreeExpandByRow(row)) {
5835
- rests.push(_this48.setTreeExpand(row, true));
6055
+ if (index < nodes.length - 1 && !_this49.isTreeExpandByRow(row)) {
6056
+ rests.push(_this49.setTreeExpand(row, true));
5836
6057
  }
5837
6058
  });
5838
6059
  }
5839
6060
  }
5840
6061
 
5841
6062
  return Promise.all(rests).then(function () {
5842
- return _tools.DomTools.rowToVisible(_this48, row);
6063
+ return _tools.DomTools.rowToVisible(_this49, row);
5843
6064
  });
5844
6065
  },
5845
6066
 
@@ -5903,37 +6124,37 @@ var Methods = {
5903
6124
  * 如果单元格配置了校验规则,则会进行校验
5904
6125
  */
5905
6126
  updateStatus: function updateStatus(scope, cellValue) {
5906
- var _this49 = this;
6127
+ var _this50 = this;
5907
6128
 
5908
6129
  var customVal = !_xeUtils.default.isUndefined(cellValue);
5909
6130
  return this.$nextTick().then(function () {
5910
- var $refs = _this49.$refs,
5911
- editRules = _this49.editRules,
5912
- validStore = _this49.validStore;
6131
+ var $refs = _this50.$refs,
6132
+ editRules = _this50.editRules,
6133
+ validStore = _this50.validStore;
5913
6134
 
5914
6135
  if (scope && $refs.tableBody && editRules) {
5915
6136
  var row = scope.row,
5916
6137
  column = scope.column;
5917
6138
  var type = 'change';
5918
6139
 
5919
- if (_this49.hasCellRules(type, row, column)) {
5920
- var cell = _this49.getCell(row, column);
6140
+ if (_this50.hasCellRules(type, row, column)) {
6141
+ var cell = _this50.getCell(row, column);
5921
6142
 
5922
6143
  if (cell) {
5923
- return _this49.validCellRules(type, row, column, cellValue).then(function () {
6144
+ return _this50.validCellRules(type, row, column, cellValue).then(function () {
5924
6145
  if (customVal && validStore.visible) {
5925
6146
  setCellValue(row, column, cellValue);
5926
6147
  }
5927
6148
 
5928
- _this49.clearValidate();
5929
- }).catch(function (_ref7) {
5930
- var rule = _ref7.rule;
6149
+ _this50.clearValidate();
6150
+ }).catch(function (_ref8) {
6151
+ var rule = _ref8.rule;
5931
6152
 
5932
6153
  if (customVal) {
5933
6154
  setCellValue(row, column, cellValue);
5934
6155
  }
5935
6156
 
5936
- _this49.showValidTooltip({
6157
+ _this50.showValidTooltip({
5937
6158
  rule: rule,
5938
6159
  row: row,
5939
6160
  column: column,
@@ -5954,7 +6175,7 @@ var Methods = {
5954
6175
  * @param {TableMergeConfig[]} merges { row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }
5955
6176
  */
5956
6177
  setMergeCells: function setMergeCells(merges) {
5957
- var _this50 = this;
6178
+ var _this51 = this;
5958
6179
 
5959
6180
  if (this.spanMethod) {
5960
6181
  _tools.UtilTools.error('vxe.error.errConflicts', ['merge-cells', 'span-method']);
@@ -5962,7 +6183,7 @@ var Methods = {
5962
6183
 
5963
6184
  setMerges(this, merges, this.mergeList, this.afterFullData);
5964
6185
  return this.$nextTick().then(function () {
5965
- return _this50.updateCellAreas();
6186
+ return _this51.updateCellAreas();
5966
6187
  });
5967
6188
  },
5968
6189
 
@@ -5971,7 +6192,7 @@ var Methods = {
5971
6192
  * @param {TableMergeConfig[]} merges 多个或数组 [{row:Row|number, col:ColumnInfo|number}]
5972
6193
  */
5973
6194
  removeMergeCells: function removeMergeCells(merges) {
5974
- var _this51 = this;
6195
+ var _this52 = this;
5975
6196
 
5976
6197
  if (this.spanMethod) {
5977
6198
  _tools.UtilTools.error('vxe.error.errConflicts', ['merge-cells', 'span-method']);
@@ -5979,7 +6200,7 @@ var Methods = {
5979
6200
 
5980
6201
  var rest = removeMerges(this, merges, this.mergeList, this.afterFullData);
5981
6202
  return this.$nextTick().then(function () {
5982
- _this51.updateCellAreas();
6203
+ _this52.updateCellAreas();
5983
6204
 
5984
6205
  return rest;
5985
6206
  });
@@ -6003,7 +6224,7 @@ var Methods = {
6003
6224
  this.setMergeFooterItems(this.mergeFooterItems);
6004
6225
  },
6005
6226
  setMergeFooterItems: function setMergeFooterItems(merges) {
6006
- var _this52 = this;
6227
+ var _this53 = this;
6007
6228
 
6008
6229
  if (this.footerSpanMethod) {
6009
6230
  _tools.UtilTools.error('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method']);
@@ -6011,11 +6232,11 @@ var Methods = {
6011
6232
 
6012
6233
  setMerges(this, merges, this.mergeFooterList, null);
6013
6234
  return this.$nextTick().then(function () {
6014
- return _this52.updateCellAreas();
6235
+ return _this53.updateCellAreas();
6015
6236
  });
6016
6237
  },
6017
6238
  removeMergeFooterItems: function removeMergeFooterItems(merges) {
6018
- var _this53 = this;
6239
+ var _this54 = this;
6019
6240
 
6020
6241
  if (this.footerSpanMethod) {
6021
6242
  _tools.UtilTools.error('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method']);
@@ -6023,7 +6244,7 @@ var Methods = {
6023
6244
 
6024
6245
  var rest = removeMerges(this, merges, this.mergeFooterList, null);
6025
6246
  return this.$nextTick().then(function () {
6026
- _this53.updateCellAreas();
6247
+ _this54.updateCellAreas();
6027
6248
 
6028
6249
  return rest;
6029
6250
  });
@@ -6163,7 +6384,7 @@ var Methods = {
6163
6384
 
6164
6385
  }; // Module methods
6165
6386
 
6166
- var funcs = 'setFilter,clearFilter,getCheckedFilters,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,clearCopyCellArea,setCellAreas,openFind,openReplace,getSelectedCell,clearSelected,insert,insertAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearActived,getActiveRecord,isActiveByRow,setActiveRow,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',');
6387
+ var funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,clearCopyCellArea,setCellAreas,openFind,openReplace,getSelectedCell,clearSelected,insert,insertAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearActived,getActiveRecord,isActiveByRow,setActiveRow,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',');
6167
6388
  funcs.forEach(function (name) {
6168
6389
  Methods[name] = function () {
6169
6390
  if (process.env.NODE_ENV === 'development') {