vxe-table 3.7.0-beta.9 → 3.7.1

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 (103) hide show
  1. package/README.md +4 -4
  2. package/helper/vetur/attributes.json +26 -2
  3. package/helper/vetur/tags.json +6 -0
  4. package/lib/button/style/style.css +2 -3
  5. package/lib/button/style/style.min.css +1 -1
  6. package/lib/edit/src/mixin.js +265 -214
  7. package/lib/edit/src/mixin.min.js +1 -1
  8. package/lib/export/src/mixin.js +11 -7
  9. package/lib/export/src/mixin.min.js +1 -1
  10. package/lib/form/src/form-config-item.js +5 -1
  11. package/lib/form/src/form-config-item.min.js +1 -1
  12. package/lib/form/src/form-item.js +9 -1
  13. package/lib/form/src/form-item.min.js +1 -1
  14. package/lib/form/src/form.js +4 -0
  15. package/lib/form/src/form.min.js +1 -1
  16. package/lib/form/style/style.css +12 -0
  17. package/lib/form/style/style.min.css +1 -1
  18. package/lib/icon/style/style.css +1 -1
  19. package/lib/icon/style/style.min.css +1 -1
  20. package/lib/index.css +1 -1
  21. package/lib/index.umd.js +1154 -717
  22. package/lib/index.umd.min.js +1 -1
  23. package/lib/input/src/input.js +24 -1
  24. package/lib/input/src/input.min.js +1 -1
  25. package/lib/input/style/style.css +21 -0
  26. package/lib/input/style/style.min.css +1 -1
  27. package/lib/keyboard/src/mixin.js +4 -1
  28. package/lib/keyboard/src/mixin.min.js +1 -1
  29. package/lib/style.css +1 -1
  30. package/lib/style.min.css +1 -1
  31. package/lib/table/src/body.js +17 -14
  32. package/lib/table/src/body.min.js +1 -1
  33. package/lib/table/src/cell.js +38 -34
  34. package/lib/table/src/cell.min.js +1 -1
  35. package/lib/table/src/methods.js +641 -421
  36. package/lib/table/src/methods.min.js +1 -1
  37. package/lib/table/src/table.js +27 -19
  38. package/lib/table/src/table.min.js +1 -1
  39. package/lib/table/src/util.js +4 -2
  40. package/lib/table/src/util.min.js +1 -1
  41. package/lib/table/style/style.css +2 -2
  42. package/lib/table/style/style.min.css +1 -1
  43. package/lib/tools/log.js +1 -1
  44. package/lib/tools/log.min.js +1 -1
  45. package/lib/tools/utils.js +3 -5
  46. package/lib/tools/utils.min.js +1 -1
  47. package/lib/v-x-e-table/index.js +18 -13
  48. package/lib/v-x-e-table/index.min.js +1 -1
  49. package/lib/v-x-e-table/src/commands.js +7 -7
  50. package/lib/v-x-e-table/src/commands.min.js +1 -1
  51. package/lib/v-x-e-table/src/conf.js +2 -2
  52. package/lib/v-x-e-table/src/conf.min.js +1 -1
  53. package/lib/v-x-e-table/src/{setup.js → config.js} +3 -3
  54. package/lib/v-x-e-table/src/config.min.js +1 -0
  55. package/lib/v-x-e-table/src/formats.js +7 -7
  56. package/lib/v-x-e-table/src/formats.min.js +1 -1
  57. package/lib/v-x-e-table/src/menus.js +7 -7
  58. package/lib/v-x-e-table/src/menus.min.js +1 -1
  59. package/lib/v-x-e-table/src/renderer.js +4 -4
  60. package/lib/v-x-e-table/src/renderer.min.js +1 -1
  61. package/lib/validator/src/mixin.js +4 -1
  62. package/lib/validator/src/mixin.min.js +1 -1
  63. package/package.json +7 -8
  64. package/packages/edit/src/mixin.js +185 -142
  65. package/packages/export/src/mixin.js +9 -7
  66. package/packages/form/src/form-config-item.js +4 -2
  67. package/packages/form/src/form-item.js +8 -2
  68. package/packages/form/src/form.js +4 -0
  69. package/packages/input/src/input.js +24 -1
  70. package/packages/keyboard/src/mixin.js +2 -1
  71. package/packages/table/src/body.js +17 -14
  72. package/packages/table/src/cell.js +32 -23
  73. package/packages/table/src/methods.js +476 -230
  74. package/packages/table/src/table.js +25 -17
  75. package/packages/table/src/util.js +4 -2
  76. package/packages/tools/utils.js +3 -6
  77. package/packages/v-x-e-table/index.js +11 -5
  78. package/packages/v-x-e-table/src/commands.js +6 -6
  79. package/packages/v-x-e-table/src/conf.js +2 -2
  80. package/packages/v-x-e-table/src/{setup.js → config.js} +2 -2
  81. package/packages/v-x-e-table/src/formats.js +6 -6
  82. package/packages/v-x-e-table/src/menus.js +6 -6
  83. package/packages/v-x-e-table/src/renderer.js +4 -4
  84. package/packages/validator/src/mixin.js +2 -1
  85. package/styles/button.scss +5 -3
  86. package/styles/css-variable.scss +3 -3
  87. package/styles/form.scss +14 -0
  88. package/styles/input.scss +25 -0
  89. package/styles/table.scss +6 -2
  90. package/styles/textarea.scss +3 -3
  91. package/styles/variable.scss +3 -3
  92. package/types/form-item.d.ts +1 -0
  93. package/types/form.d.ts +1 -0
  94. package/types/table.d.ts +16 -1
  95. package/types/v-x-e-table/index.d.ts +22 -10
  96. package/lib/v-x-e-table/src/setup.min.js +0 -1
  97. /package/lib/icon/style/{iconfont.1690761747506.ttf → iconfont.1694852365070.ttf} +0 -0
  98. /package/lib/icon/style/{iconfont.1690761747506.woff → iconfont.1694852365070.woff} +0 -0
  99. /package/lib/icon/style/{iconfont.1690761747506.woff2 → iconfont.1694852365070.woff2} +0 -0
  100. /package/lib/{iconfont.1690761747506.ttf → iconfont.1694852365070.ttf} +0 -0
  101. /package/lib/{iconfont.1690761747506.woff → iconfont.1694852365070.woff} +0 -0
  102. /package/lib/{iconfont.1690761747506.woff2 → iconfont.1694852365070.woff2} +0 -0
  103. /package/types/v-x-e-table/{setup.d.ts → config.d.ts} +0 -0
@@ -77,12 +77,16 @@ function getCustomStorageMap(key) {
77
77
  _v: version
78
78
  };
79
79
  }
80
- function getRecoverRow(_vm, list) {
81
- var fullAllDataRowMap = _vm.fullAllDataRowMap;
82
- return list.filter(function (row) {
83
- return fullAllDataRowMap.has(row);
80
+ var getRecoverRowMaps = function getRecoverRowMaps(_vm, keyMaps) {
81
+ var fullAllDataRowIdData = _vm.fullAllDataRowIdData;
82
+ var restKeys = {};
83
+ _xeUtils["default"].each(keyMaps, function (row, rowid) {
84
+ if (fullAllDataRowIdData[rowid]) {
85
+ restKeys[rowid] = row;
86
+ }
84
87
  });
85
- }
88
+ return restKeys;
89
+ };
86
90
  function handleReserveRow(_vm, reserveRowMap) {
87
91
  var fullDataRowIdData = _vm.fullDataRowIdData;
88
92
  var reserveList = [];
@@ -434,6 +438,7 @@ var Methods = {
434
438
  oldScrollYLoad = this.scrollYLoad,
435
439
  sXOpts = this.sXOpts,
436
440
  sYOpts = this.sYOpts;
441
+ var childrenField = treeOpts.children || treeOpts.childrenField;
437
442
  var treeData = [];
438
443
  var fullData = datas ? datas.slice(0) : [];
439
444
  if (treeConfig) {
@@ -446,25 +451,25 @@ var Methods = {
446
451
  if (!treeOpts.parentField) {
447
452
  (0, _log.errLog)('vxe.error.reqProp', ['table.tree-config.parentField']);
448
453
  }
449
- if (!(treeOpts.childrenField || treeOpts.children)) {
454
+ if (!childrenField) {
450
455
  (0, _log.errLog)('vxe.error.reqProp', ['tree-config.childrenField']);
451
456
  }
452
457
  if (!treeOpts.mapChildrenField) {
453
458
  (0, _log.errLog)('vxe.error.reqProp', ['tree-config.mapChildrenField']);
454
459
  }
455
- if ((treeOpts.treeOpts || treeOpts.children) === treeOpts.mapChildrenField) {
460
+ if (childrenField === treeOpts.mapChildrenField) {
456
461
  (0, _log.errLog)('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField']);
457
462
  }
458
463
  fullData.forEach(function (row) {
459
- if (row[treeOpts.childrenField || treeOpts.children] && row[treeOpts.childrenField || treeOpts.children].length) {
460
- (0, _log.warnLog)('vxe.error.errConflicts', ['tree-config.transform', "row.".concat(treeOpts.childrenField || treeOpts.children)]);
464
+ if (row[childrenField] && row[childrenField].length) {
465
+ (0, _log.warnLog)('vxe.error.errConflicts', ['tree-config.transform', "row.".concat(childrenField)]);
461
466
  }
462
467
  });
463
468
  }
464
469
  treeData = _xeUtils["default"].toArrayTree(fullData, {
465
470
  key: treeOpts.rowField,
466
471
  parentKey: treeOpts.parentField,
467
- children: treeOpts.childrenField || treeOpts.children,
472
+ children: childrenField,
468
473
  mapChildren: treeOpts.mapChildrenField
469
474
  });
470
475
  fullData = treeData.slice(0);
@@ -691,6 +696,8 @@ var Methods = {
691
696
  tableFullTreeData = this.tableFullTreeData;
692
697
  var fullDataRowIdData = this.fullDataRowIdData,
693
698
  fullAllDataRowIdData = this.fullAllDataRowIdData;
699
+ var childrenField = treeOpts.children || treeOpts.childrenField;
700
+ var hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
694
701
  var rowkey = (0, _util.getRowkey)(this);
695
702
  var isLazy = treeConfig && treeOpts.lazy;
696
703
  var handleCache = function handleCache(row, index, items, path, parent, nodes) {
@@ -701,8 +708,8 @@ var Methods = {
701
708
  rowid = getRowUniqueId();
702
709
  _xeUtils["default"].set(row, rowkey, rowid);
703
710
  }
704
- if (isLazy && row[treeOpts.hasChildField || treeOpts.hasChild] && _xeUtils["default"].isUndefined(row[treeOpts.childrenField || treeOpts.children])) {
705
- row[treeOpts.childrenField || treeOpts.children] = null;
711
+ if (isLazy && row[hasChildField] && _xeUtils["default"].isUndefined(row[childrenField])) {
712
+ row[childrenField] = null;
706
713
  }
707
714
  var rest = {
708
715
  row: row,
@@ -729,7 +736,9 @@ var Methods = {
729
736
  fullAllDataRowIdData = this.fullAllDataRowIdData = {};
730
737
  fullAllDataRowMap.clear();
731
738
  if (treeConfig) {
732
- _xeUtils["default"].eachTree(tableFullTreeData, handleCache, treeOpts);
739
+ _xeUtils["default"].eachTree(tableFullTreeData, handleCache, {
740
+ children: childrenField
741
+ });
733
742
  } else {
734
743
  tableFullData.forEach(handleCache);
735
744
  }
@@ -755,7 +764,10 @@ var Methods = {
755
764
  };
756
765
  // 源数据缓存
757
766
  if (treeConfig && !treeOpts.transform) {
758
- _xeUtils["default"].eachTree(sourceData, handleSourceRow, treeOpts);
767
+ var childrenField = treeOpts.children || treeOpts.childrenField;
768
+ _xeUtils["default"].eachTree(sourceData, handleSourceRow, {
769
+ children: treeOpts.transform ? treeOpts.mapChildrenField : childrenField
770
+ });
759
771
  } else {
760
772
  sourceData.forEach(handleSourceRow);
761
773
  }
@@ -769,11 +781,11 @@ var Methods = {
769
781
  fullDataRowIdData = this.fullDataRowIdData,
770
782
  fullDataRowMap = this.fullDataRowMap,
771
783
  fullAllDataRowMap = this.fullAllDataRowMap,
772
- fullAllDataRowIdData = this.fullAllDataRowIdData;
784
+ fullAllDataRowIdData = this.fullAllDataRowIdData,
785
+ sourceDataRowIdData = this.sourceDataRowIdData;
773
786
  var transform = treeOpts.transform,
774
- childrenField = treeOpts.childrenField,
775
- children = treeOpts.children,
776
787
  mapChildrenField = treeOpts.mapChildrenField;
788
+ var childrenField = treeOpts.children || treeOpts.childrenField;
777
789
  var rest = fullAllDataRowIdData[(0, _util.getRowid)(this, row)];
778
790
  var parentLevel = rest ? rest.level : 0;
779
791
  return this.createData(childRecords).then(function (rows) {
@@ -781,10 +793,16 @@ var Methods = {
781
793
  var rowid = (0, _util.getRowid)(_this12, row);
782
794
  var matchObj = _xeUtils["default"].findTree(tableSourceData, function (item) {
783
795
  return rowid === (0, _util.getRowid)(_this12, item);
784
- }, treeOpts);
796
+ }, {
797
+ children: childrenField
798
+ });
785
799
  if (matchObj) {
786
- matchObj.item[childrenField || children] = _xeUtils["default"].clone(rows, true);
800
+ matchObj.item[childrenField] = _xeUtils["default"].clone(rows, true);
787
801
  }
802
+ rows.forEach(function (childRow) {
803
+ var rowid = (0, _util.getRowid)(_this12, childRow);
804
+ sourceDataRowIdData[rowid] = _xeUtils["default"].clone(childRow, true);
805
+ });
788
806
  }
789
807
  _xeUtils["default"].eachTree(rows, function (childRow, index, items, path, parent, nodes) {
790
808
  var rowid = (0, _util.getRowid)(_this12, childRow);
@@ -803,8 +821,10 @@ var Methods = {
803
821
  fullDataRowMap.set(childRow, rest);
804
822
  fullAllDataRowIdData[rowid] = rest;
805
823
  fullAllDataRowMap.set(childRow, rest);
806
- }, treeOpts);
807
- row[childrenField || children] = rows;
824
+ }, {
825
+ children: childrenField
826
+ });
827
+ row[childrenField] = rows;
808
828
  if (transform) {
809
829
  row[mapChildrenField] = rows;
810
830
  }
@@ -1091,6 +1111,7 @@ var Methods = {
1091
1111
  treeConfig = this.treeConfig,
1092
1112
  treeOpts = this.treeOpts,
1093
1113
  expandOpts = this.expandOpts;
1114
+ var childrenField = treeOpts.children || treeOpts.childrenField;
1094
1115
  var rowkey = (0, _util.getRowkey)(this);
1095
1116
  if (!_xeUtils["default"].isArray(records)) {
1096
1117
  records = [records || {}];
@@ -1120,8 +1141,8 @@ var Methods = {
1120
1141
  _xeUtils["default"].set(record, key, null);
1121
1142
  }
1122
1143
  });
1123
- if (treeConfig && treeOpts.lazy && _xeUtils["default"].isUndefined(record[treeOpts.childrenField || treeOpts.children])) {
1124
- record[treeOpts.childrenField || treeOpts.children] = null;
1144
+ if (treeConfig && treeOpts.lazy && _xeUtils["default"].isUndefined(record[childrenField])) {
1145
+ record[childrenField] = null;
1125
1146
  }
1126
1147
  // 必须有行数据的唯一主键,可以自行设置;也可以默认生成一个随机数
1127
1148
  if ((0, _utils.eqEmptyValue)(_xeUtils["default"].get(record, rowkey))) {
@@ -1331,19 +1352,18 @@ var Methods = {
1331
1352
  * 用于多选行,获取已选中的数据
1332
1353
  */
1333
1354
  getCheckboxRecords: function getCheckboxRecords(isFull) {
1334
- var _this17 = this;
1335
1355
  var tableFullData = this.tableFullData,
1336
1356
  afterFullData = this.afterFullData,
1337
1357
  treeConfig = this.treeConfig,
1338
1358
  treeOpts = this.treeOpts,
1339
1359
  checkboxOpts = this.checkboxOpts,
1340
1360
  tableFullTreeData = this.tableFullTreeData,
1341
- afterTreeFullData = this.afterTreeFullData;
1361
+ afterTreeFullData = this.afterTreeFullData,
1362
+ afterFullRowMaps = this.afterFullRowMaps;
1342
1363
  var transform = treeOpts.transform,
1343
- childrenField = treeOpts.childrenField,
1344
- children = treeOpts.children,
1345
1364
  mapChildrenField = treeOpts.mapChildrenField;
1346
1365
  var checkField = checkboxOpts.checkField;
1366
+ var childrenField = treeOpts.children || treeOpts.childrenField;
1347
1367
  var currTableData = isFull ? transform ? tableFullTreeData : tableFullData : transform ? afterTreeFullData : afterFullData;
1348
1368
  var rowList = [];
1349
1369
  if (checkField) {
@@ -1351,7 +1371,7 @@ var Methods = {
1351
1371
  rowList = _xeUtils["default"].filterTree(currTableData, function (row) {
1352
1372
  return _xeUtils["default"].get(row, checkField);
1353
1373
  }, {
1354
- children: transform ? mapChildrenField : childrenField || children
1374
+ children: transform ? mapChildrenField : childrenField
1355
1375
  });
1356
1376
  } else {
1357
1377
  rowList = currTableData.filter(function (row) {
@@ -1359,18 +1379,13 @@ var Methods = {
1359
1379
  });
1360
1380
  }
1361
1381
  } else {
1362
- var selectCheckboxRows = this.selectCheckboxRows;
1363
- if (treeConfig) {
1364
- rowList = _xeUtils["default"].filterTree(currTableData, function (row) {
1365
- return _this17.findRowIndexOf(selectCheckboxRows, row) > -1;
1366
- }, {
1367
- children: transform ? mapChildrenField : childrenField || children
1368
- });
1369
- } else {
1370
- rowList = currTableData.filter(function (row) {
1371
- return _this17.findRowIndexOf(selectCheckboxRows, row) > -1;
1372
- });
1373
- }
1382
+ var selectCheckboxMaps = this.selectCheckboxMaps,
1383
+ fullDataRowIdData = this.fullDataRowIdData;
1384
+ _xeUtils["default"].each(selectCheckboxMaps, function (row, rowid) {
1385
+ if (isFull ? fullDataRowIdData[rowid] : afterFullRowMaps[rowid]) {
1386
+ rowList.push(row);
1387
+ }
1388
+ });
1374
1389
  }
1375
1390
  return rowList;
1376
1391
  },
@@ -1379,17 +1394,20 @@ var Methods = {
1379
1394
  * @returns
1380
1395
  */
1381
1396
  handleVirtualTreeToList: function handleVirtualTreeToList() {
1397
+ var _this17 = this;
1382
1398
  var treeOpts = this.treeOpts,
1383
1399
  treeConfig = this.treeConfig,
1384
- treeExpandeds = this.treeExpandeds,
1400
+ treeExpandedMaps = this.treeExpandedMaps,
1385
1401
  afterTreeFullData = this.afterTreeFullData,
1386
1402
  afterFullData = this.afterFullData;
1387
1403
  if (treeConfig && treeOpts.transform) {
1388
1404
  var fullData = [];
1389
- var expandMaps = new Map();
1405
+ var expandMaps = {};
1390
1406
  _xeUtils["default"].eachTree(afterTreeFullData, function (row, index, items, path, parent) {
1391
- if (!parent || expandMaps.has(parent) && treeExpandeds.indexOf(parent) > -1) {
1392
- expandMaps.set(row, 1);
1407
+ var rowid = (0, _util.getRowid)(_this17, row);
1408
+ var parentRowid = (0, _util.getRowid)(_this17, parent);
1409
+ if (!parent || expandMaps[parentRowid] && treeExpandedMaps[parentRowid]) {
1410
+ expandMaps[rowid] = 1;
1393
1411
  fullData.push(row);
1394
1412
  }
1395
1413
  }, {
@@ -1618,6 +1636,8 @@ var Methods = {
1618
1636
  fullAllDataRowIdData = this.fullAllDataRowIdData,
1619
1637
  afterTreeFullData = this.afterTreeFullData,
1620
1638
  treeOpts = this.treeOpts;
1639
+ var childrenField = treeOpts.children || treeOpts.childrenField;
1640
+ var fullMaps = {};
1621
1641
  if (treeConfig) {
1622
1642
  _xeUtils["default"].eachTree(afterTreeFullData, function (row, index, items, path) {
1623
1643
  var rowid = (0, _util.getRowid)(_this19, row);
@@ -1643,8 +1663,9 @@ var Methods = {
1643
1663
  fullAllDataRowIdData[rowid] = rest;
1644
1664
  fullDataRowIdData[rowid] = rest;
1645
1665
  }
1666
+ fullMaps[rowid] = row;
1646
1667
  }, {
1647
- children: treeOpts.transform ? treeOpts.mapChildrenField : treeOpts.childrenField || treeOpts.children
1668
+ children: treeOpts.transform ? treeOpts.mapChildrenField : childrenField
1648
1669
  });
1649
1670
  } else {
1650
1671
  afterFullData.forEach(function (row, index) {
@@ -1669,8 +1690,10 @@ var Methods = {
1669
1690
  fullAllDataRowIdData[rowid] = rest;
1670
1691
  fullDataRowIdData[rowid] = rest;
1671
1692
  }
1693
+ fullMaps[rowid] = row;
1672
1694
  });
1673
1695
  }
1696
+ this.afterFullRowMaps = fullMaps;
1674
1697
  },
1675
1698
  /**
1676
1699
  * 只对 tree-config 有效,获取行的父级
@@ -1809,7 +1832,7 @@ var Methods = {
1809
1832
  */
1810
1833
  showColumn: function showColumn(fieldOrColumn) {
1811
1834
  var column = (0, _util.handleFieldOrColumn)(this, fieldOrColumn);
1812
- if (column && column.visible) {
1835
+ if (column && !column.visible) {
1813
1836
  column.visible = true;
1814
1837
  return this.handleCustom();
1815
1838
  }
@@ -2972,6 +2995,7 @@ var Methods = {
2972
2995
  var operArrow = isLeftArrow || isUpArrow || isRightArrow || isDwArrow;
2973
2996
  var operCtxMenu = isCtxMenu && ctxMenuStore.visible && (isEnter || isSpacebar || operArrow);
2974
2997
  var isEditStatus = (0, _utils.isEnableConf)(editConfig) && actived.column && actived.row;
2998
+ var childrenField = treeOpts.children || treeOpts.childrenField;
2975
2999
  var params;
2976
3000
  if (filterStore.visible) {
2977
3001
  if (isEsc) {
@@ -3046,7 +3070,7 @@ var Methods = {
3046
3070
  }
3047
3071
  } else if (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
3048
3072
  // 如果是树形表格当前行回车移动到子节点
3049
- var childrens = currentRow[treeOpts.children];
3073
+ var childrens = currentRow[childrenField];
3050
3074
  if (childrens && childrens.length) {
3051
3075
  evnt.preventDefault();
3052
3076
  var targetRow = childrens[0];
@@ -3116,7 +3140,9 @@ var Methods = {
3116
3140
  // 如果树形表格回退键关闭当前行返回父节点
3117
3141
  var _XEUtils$findTree = _xeUtils["default"].findTree(_this29.afterFullData, function (item) {
3118
3142
  return item === currentRow;
3119
- }, treeOpts),
3143
+ }, {
3144
+ children: childrenField
3145
+ }),
3120
3146
  parentRow = _XEUtils$findTree.parent;
3121
3147
  if (parentRow) {
3122
3148
  evnt.preventDefault();
@@ -3422,15 +3448,24 @@ var Methods = {
3422
3448
  * 获取复选框半选状态的行数据
3423
3449
  */
3424
3450
  getCheckboxIndeterminateRecords: function getCheckboxIndeterminateRecords(isFull) {
3425
- var _this31 = this;
3426
3451
  var treeConfig = this.treeConfig,
3427
- treeIndeterminates = this.treeIndeterminates,
3452
+ treeIndeterminateMaps = this.treeIndeterminateMaps,
3428
3453
  fullDataRowIdData = this.fullDataRowIdData;
3429
3454
  if (treeConfig) {
3430
- return isFull ? treeIndeterminates.slice(0) : treeIndeterminates.filter(function (row) {
3431
- var rowid = (0, _util.getRowid)(_this31, row);
3432
- return fullDataRowIdData[rowid];
3455
+ var fullRest = [];
3456
+ var defRest = [];
3457
+ _xeUtils["default"].each(treeIndeterminateMaps, function (item, rowid) {
3458
+ if (item) {
3459
+ fullRest.push(item);
3460
+ if (fullDataRowIdData[rowid]) {
3461
+ defRest.push(item);
3462
+ }
3463
+ }
3433
3464
  });
3465
+ if (isFull) {
3466
+ return fullRest;
3467
+ }
3468
+ return defRest;
3434
3469
  }
3435
3470
  return [];
3436
3471
  },
@@ -3455,12 +3490,12 @@ var Methods = {
3455
3490
  }
3456
3491
  },
3457
3492
  handleCheckedCheckboxRow: function handleCheckedCheckboxRow(rows, value, isForce) {
3458
- var _this32 = this;
3493
+ var _this31 = this;
3459
3494
  if (rows && !_xeUtils["default"].isArray(rows)) {
3460
3495
  rows = [rows];
3461
3496
  }
3462
3497
  rows.forEach(function (row) {
3463
- return _this32.handleSelectRow({
3498
+ return _this31.handleSelectRow({
3464
3499
  row: row
3465
3500
  }, !!value, isForce);
3466
3501
  });
@@ -3475,78 +3510,108 @@ var Methods = {
3475
3510
  return this.handleCheckedCheckboxRow(rows, value, true);
3476
3511
  },
3477
3512
  isCheckedByCheckboxRow: function isCheckedByCheckboxRow(row) {
3478
- var selectCheckboxRows = this.selectCheckboxRows;
3513
+ var selectCheckboxMaps = this.selectCheckboxMaps;
3479
3514
  var checkField = this.checkboxOpts.checkField;
3480
3515
  if (checkField) {
3481
3516
  return _xeUtils["default"].get(row, checkField);
3482
3517
  }
3483
- return this.findRowIndexOf(selectCheckboxRows, row) > -1;
3518
+ return !!selectCheckboxMaps[(0, _util.getRowid)(this, row)];
3484
3519
  },
3485
3520
  isIndeterminateByCheckboxRow: function isIndeterminateByCheckboxRow(row) {
3486
- var treeIndeterminates = this.treeIndeterminates;
3487
- return this.findRowIndexOf(treeIndeterminates, row) > -1 && !this.isCheckedByCheckboxRow(row);
3521
+ var treeIndeterminateMaps = this.treeIndeterminateMaps;
3522
+ return !!treeIndeterminateMaps[(0, _util.getRowid)(this, row)] && !this.isCheckedByCheckboxRow(row);
3488
3523
  },
3489
3524
  /**
3490
3525
  * 多选,行选中事件
3491
3526
  * value 选中true 不选false 半选-1
3492
3527
  */
3493
3528
  handleSelectRow: function handleSelectRow(_ref6, value, isForce) {
3494
- var _this33 = this;
3529
+ var _this32 = this;
3495
3530
  var row = _ref6.row;
3496
- var selectCheckboxRows = this.selectCheckboxRows,
3531
+ var selectCheckboxMaps = this.selectCheckboxMaps,
3497
3532
  afterFullData = this.afterFullData,
3498
3533
  treeConfig = this.treeConfig,
3499
3534
  treeOpts = this.treeOpts,
3500
- treeIndeterminates = this.treeIndeterminates,
3535
+ treeIndeterminateMaps = this.treeIndeterminateMaps,
3501
3536
  checkboxOpts = this.checkboxOpts;
3502
3537
  var checkField = checkboxOpts.checkField,
3503
3538
  checkStrictly = checkboxOpts.checkStrictly,
3504
3539
  checkMethod = checkboxOpts.checkMethod;
3540
+ var selectRowMaps = _objectSpread({}, selectCheckboxMaps);
3541
+ var childrenField = treeOpts.children || treeOpts.childrenField;
3542
+ var indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
3543
+ var rowid = (0, _util.getRowid)(this, row);
3505
3544
  if (checkField) {
3506
3545
  if (treeConfig && !checkStrictly) {
3507
3546
  if (value === -1) {
3508
- if (this.findRowIndexOf(treeIndeterminates, row) === -1) {
3509
- treeIndeterminates.push(row);
3547
+ if (!treeIndeterminateMaps[rowid]) {
3548
+ if (indeterminateField) {
3549
+ _xeUtils["default"].set(row, indeterminateField, true);
3550
+ }
3551
+ treeIndeterminateMaps[rowid] = row;
3510
3552
  }
3511
3553
  _xeUtils["default"].set(row, checkField, false);
3512
3554
  } else {
3513
3555
  // 更新子节点状态
3514
3556
  _xeUtils["default"].eachTree([row], function (item) {
3515
- if (_this33.eqRow(item, row) || isForce || !checkMethod || checkMethod({
3557
+ if (_this32.eqRow(item, row) || isForce || !checkMethod || checkMethod({
3516
3558
  row: item
3517
3559
  })) {
3518
3560
  _xeUtils["default"].set(item, checkField, value);
3519
- _xeUtils["default"].remove(treeIndeterminates, function (half) {
3520
- return _this33.eqRow(half, item);
3521
- });
3522
- _this33.handleCheckboxReserveRow(row, value);
3561
+ if (indeterminateField) {
3562
+ _xeUtils["default"].set(row, indeterminateField, false);
3563
+ }
3564
+ delete treeIndeterminateMaps[(0, _util.getRowid)(_this32, item)];
3565
+ _this32.handleCheckboxReserveRow(row, value);
3523
3566
  }
3524
- }, treeOpts);
3567
+ }, {
3568
+ children: childrenField
3569
+ });
3525
3570
  }
3526
3571
  // 如果存在父节点,更新父节点状态
3527
3572
  var matchObj = _xeUtils["default"].findTree(afterFullData, function (item) {
3528
- return _this33.eqRow(item, row);
3529
- }, treeOpts);
3573
+ return _this32.eqRow(item, row);
3574
+ }, {
3575
+ children: childrenField
3576
+ });
3530
3577
  if (matchObj && matchObj.parent) {
3531
3578
  var parentStatus;
3532
- var vItems = !isForce && checkMethod ? matchObj.items.filter(function (item) {
3533
- return checkMethod({
3534
- row: item
3579
+ var vItems = [];
3580
+ var vItemMaps = {};
3581
+ if (!isForce && checkMethod) {
3582
+ matchObj.items.forEach(function (item) {
3583
+ if (checkMethod({
3584
+ row: item
3585
+ })) {
3586
+ var itemRid = (0, _util.getRowid)(_this32, item);
3587
+ vItemMaps[itemRid] = item;
3588
+ vItems.push(item);
3589
+ }
3535
3590
  });
3536
- }) : matchObj.items;
3591
+ } else {
3592
+ matchObj.items.forEach(function (item) {
3593
+ var itemRid = (0, _util.getRowid)(_this32, item);
3594
+ vItemMaps[itemRid] = item;
3595
+ vItems.push(item);
3596
+ });
3597
+ }
3537
3598
  var indeterminatesItem = _xeUtils["default"].find(matchObj.items, function (item) {
3538
- return _this33.findRowIndexOf(treeIndeterminates, item) > -1;
3599
+ return !!treeIndeterminateMaps[(0, _util.getRowid)(_this32, item)];
3539
3600
  });
3540
3601
  if (indeterminatesItem) {
3541
3602
  parentStatus = -1;
3542
3603
  } else {
3543
- var selectItems = matchObj.items.filter(function (item) {
3544
- return _xeUtils["default"].get(item, checkField);
3604
+ var selectItems = [];
3605
+ matchObj.items.forEach(function (item) {
3606
+ if (_xeUtils["default"].get(item, checkField)) {
3607
+ selectItems.push(item);
3608
+ }
3545
3609
  });
3546
3610
  parentStatus = selectItems.filter(function (item) {
3547
- return _this33.findRowIndexOf(vItems, item) > -1;
3611
+ return vItemMaps[(0, _util.getRowid)(_this32, item)];
3548
3612
  }).length === vItems.length ? true : selectItems.length || value === -1 ? -1 : false;
3549
3613
  }
3614
+ this.selectCheckboxMaps = selectRowMaps;
3550
3615
  return this.handleSelectRow({
3551
3616
  row: matchObj.parent
3552
3617
  }, parentStatus, isForce);
@@ -3562,56 +3627,84 @@ var Methods = {
3562
3627
  } else {
3563
3628
  if (treeConfig && !checkStrictly) {
3564
3629
  if (value === -1) {
3565
- if (this.findRowIndexOf(treeIndeterminates, row) === -1) {
3566
- treeIndeterminates.push(row);
3630
+ if (!treeIndeterminateMaps[rowid]) {
3631
+ if (indeterminateField) {
3632
+ _xeUtils["default"].set(row, indeterminateField, true);
3633
+ }
3634
+ treeIndeterminateMaps[rowid] = row;
3635
+ }
3636
+ if (selectRowMaps[rowid]) {
3637
+ delete selectRowMaps[rowid];
3567
3638
  }
3568
- _xeUtils["default"].remove(selectCheckboxRows, function (item) {
3569
- return _this33.eqRow(item, row);
3570
- });
3571
3639
  } else {
3572
3640
  // 更新子节点状态
3573
3641
  _xeUtils["default"].eachTree([row], function (item) {
3574
- if (_this33.eqRow(item, row) || isForce || !checkMethod || checkMethod({
3642
+ var itemRid = (0, _util.getRowid)(_this32, item);
3643
+ if (_this32.eqRow(item, row) || isForce || !checkMethod || checkMethod({
3575
3644
  row: item
3576
3645
  })) {
3577
3646
  if (value) {
3578
- selectCheckboxRows.push(item);
3647
+ selectRowMaps[itemRid] = item;
3579
3648
  } else {
3580
- _xeUtils["default"].remove(selectCheckboxRows, function (select) {
3581
- return _this33.eqRow(select, item);
3582
- });
3649
+ if (selectRowMaps[itemRid]) {
3650
+ delete selectRowMaps[itemRid];
3651
+ }
3583
3652
  }
3584
- _xeUtils["default"].remove(treeIndeterminates, function (half) {
3585
- return _this33.eqRow(half, item);
3586
- });
3587
- _this33.handleCheckboxReserveRow(row, value);
3653
+ if (indeterminateField) {
3654
+ _xeUtils["default"].set(row, indeterminateField, false);
3655
+ }
3656
+ delete treeIndeterminateMaps[(0, _util.getRowid)(_this32, item)];
3657
+ _this32.handleCheckboxReserveRow(row, value);
3588
3658
  }
3589
- }, treeOpts);
3659
+ }, {
3660
+ children: childrenField
3661
+ });
3590
3662
  }
3591
3663
  // 如果存在父节点,更新父节点状态
3592
3664
  var _matchObj = _xeUtils["default"].findTree(afterFullData, function (item) {
3593
- return _this33.eqRow(item, row);
3594
- }, treeOpts);
3665
+ return _this32.eqRow(item, row);
3666
+ }, {
3667
+ children: childrenField
3668
+ });
3595
3669
  if (_matchObj && _matchObj.parent) {
3596
3670
  var _parentStatus;
3597
- var _vItems = !isForce && checkMethod ? _matchObj.items.filter(function (item) {
3598
- return checkMethod({
3599
- row: item
3671
+ var _vItems = [];
3672
+ var _vItemMaps = {};
3673
+ if (!isForce && checkMethod) {
3674
+ _matchObj.items.forEach(function (item) {
3675
+ if (checkMethod({
3676
+ row: item
3677
+ })) {
3678
+ var itemRid = (0, _util.getRowid)(_this32, item);
3679
+ _vItemMaps[itemRid] = item;
3680
+ _vItems.push(item);
3681
+ }
3682
+ });
3683
+ } else {
3684
+ _matchObj.items.forEach(function (item) {
3685
+ var itemRid = (0, _util.getRowid)(_this32, item);
3686
+ _vItemMaps[itemRid] = item;
3687
+ _vItems.push(item);
3600
3688
  });
3601
- }) : _matchObj.items;
3689
+ }
3602
3690
  var _indeterminatesItem = _xeUtils["default"].find(_matchObj.items, function (item) {
3603
- return _this33.findRowIndexOf(treeIndeterminates, item) > -1;
3691
+ return !!treeIndeterminateMaps[(0, _util.getRowid)(_this32, item)];
3604
3692
  });
3605
3693
  if (_indeterminatesItem) {
3606
3694
  _parentStatus = -1;
3607
3695
  } else {
3608
- var _selectItems = _matchObj.items.filter(function (item) {
3609
- return _this33.findRowIndexOf(selectCheckboxRows, item) > -1;
3696
+ var _selectItems = [];
3697
+ _matchObj.items.forEach(function (item) {
3698
+ var itemRid = (0, _util.getRowid)(_this32, item);
3699
+ if (selectRowMaps[itemRid]) {
3700
+ _selectItems.push(item);
3701
+ }
3610
3702
  });
3611
3703
  _parentStatus = _selectItems.filter(function (item) {
3612
- return _this33.findRowIndexOf(_vItems, item) > -1;
3704
+ return _vItemMaps[(0, _util.getRowid)(_this32, item)];
3613
3705
  }).length === _vItems.length ? true : _selectItems.length || value === -1 ? -1 : false;
3614
3706
  }
3707
+ this.selectCheckboxMaps = selectRowMaps;
3615
3708
  return this.handleSelectRow({
3616
3709
  row: _matchObj.parent
3617
3710
  }, _parentStatus, isForce);
@@ -3621,26 +3714,32 @@ var Methods = {
3621
3714
  row: row
3622
3715
  })) {
3623
3716
  if (value) {
3624
- if (this.findRowIndexOf(selectCheckboxRows, row) === -1) {
3625
- selectCheckboxRows.push(row);
3717
+ if (!selectRowMaps[rowid]) {
3718
+ selectRowMaps[rowid] = row;
3626
3719
  }
3627
3720
  } else {
3628
- _xeUtils["default"].remove(selectCheckboxRows, function (item) {
3629
- return _this33.eqRow(item, row);
3630
- });
3721
+ if (selectRowMaps[rowid]) {
3722
+ delete selectRowMaps[rowid];
3723
+ }
3631
3724
  }
3632
3725
  this.handleCheckboxReserveRow(row, value);
3633
3726
  }
3634
3727
  }
3635
3728
  }
3729
+ this.selectCheckboxMaps = selectRowMaps;
3636
3730
  this.checkSelectionStatus();
3637
3731
  },
3638
3732
  handleToggleCheckRowEvent: function handleToggleCheckRowEvent(evnt, params) {
3639
- var selectCheckboxRows = this.selectCheckboxRows,
3733
+ var selectCheckboxMaps = this.selectCheckboxMaps,
3640
3734
  checkboxOpts = this.checkboxOpts;
3641
3735
  var checkField = checkboxOpts.checkField;
3642
3736
  var row = params.row;
3643
- var value = checkField ? !_xeUtils["default"].get(row, checkField) : this.findRowIndexOf(selectCheckboxRows, row) === -1;
3737
+ var value = false;
3738
+ if (checkField) {
3739
+ value = !_xeUtils["default"].get(row, checkField);
3740
+ } else {
3741
+ value = !selectCheckboxMaps[(0, _util.getRowid)(this, row)];
3742
+ }
3644
3743
  if (evnt) {
3645
3744
  this.triggerCheckRowEvent(evnt, params, value);
3646
3745
  } else {
@@ -3648,9 +3747,29 @@ var Methods = {
3648
3747
  }
3649
3748
  },
3650
3749
  triggerCheckRowEvent: function triggerCheckRowEvent(evnt, params, value) {
3651
- var checkMethod = this.checkboxOpts.checkMethod;
3750
+ var checkboxOpts = this.checkboxOpts,
3751
+ afterFullData = this.afterFullData;
3752
+ var checkMethod = checkboxOpts.checkMethod;
3753
+ var row = params.row;
3754
+ if (checkboxOpts.isShiftKey && evnt.shiftKey && !this.treeConfig) {
3755
+ var checkboxRecords = this.getCheckboxRecords();
3756
+ if (checkboxRecords.length) {
3757
+ var firstRow = checkboxRecords[0];
3758
+ var _rowIndex = this.getVTRowIndex(row);
3759
+ var _firstRowIndex = this.getVTRowIndex(firstRow);
3760
+ if (_rowIndex !== _firstRowIndex) {
3761
+ this.setAllCheckboxRow(false);
3762
+ var rangeRows = _rowIndex < _firstRowIndex ? afterFullData.slice(_rowIndex, _firstRowIndex + 1) : afterFullData.slice(_firstRowIndex, _rowIndex + 1);
3763
+ this.handleCheckedCheckboxRow(rangeRows, true, false);
3764
+ this.emitEvent('checkbox-range-select', Object.assign({
3765
+ rangeRecords: rangeRows
3766
+ }, params), evnt);
3767
+ return;
3768
+ }
3769
+ }
3770
+ }
3652
3771
  if (!checkMethod || checkMethod({
3653
- row: params.row
3772
+ row: row
3654
3773
  })) {
3655
3774
  this.handleSelectRow(params, value);
3656
3775
  this.emitEvent('checkbox-change', Object.assign({
@@ -3665,31 +3784,42 @@ var Methods = {
3665
3784
  * 多选,切换某一行的选中状态
3666
3785
  */
3667
3786
  toggleCheckboxRow: function toggleCheckboxRow(row) {
3668
- var selectCheckboxRows = this.selectCheckboxRows,
3787
+ var selectCheckboxMaps = this.selectCheckboxMaps,
3669
3788
  checkboxOpts = this.checkboxOpts;
3670
3789
  var checkField = checkboxOpts.checkField;
3671
- var value = checkField ? !_xeUtils["default"].get(row, checkField) : this.findRowIndexOf(selectCheckboxRows, row) === -1;
3790
+ var value = checkField ? !_xeUtils["default"].get(row, checkField) : !selectCheckboxMaps[(0, _util.getRowid)(this, row)];
3672
3791
  this.handleSelectRow({
3673
3792
  row: row
3674
3793
  }, value, true);
3675
3794
  return this.$nextTick();
3676
3795
  },
3677
3796
  handleCheckedAllCheckboxRow: function handleCheckedAllCheckboxRow(value, isForce) {
3678
- var _this34 = this;
3797
+ var _this33 = this;
3679
3798
  var afterFullData = this.afterFullData,
3680
3799
  treeConfig = this.treeConfig,
3681
3800
  treeOpts = this.treeOpts,
3682
- selectCheckboxRows = this.selectCheckboxRows,
3801
+ selectCheckboxMaps = this.selectCheckboxMaps,
3683
3802
  checkboxReserveRowMap = this.checkboxReserveRowMap,
3684
- checkboxOpts = this.checkboxOpts;
3803
+ checkboxOpts = this.checkboxOpts,
3804
+ afterFullRowMaps = this.afterFullRowMaps;
3685
3805
  var checkField = checkboxOpts.checkField,
3686
3806
  reserve = checkboxOpts.reserve,
3687
3807
  checkStrictly = checkboxOpts.checkStrictly,
3688
3808
  checkMethod = checkboxOpts.checkMethod;
3689
- var selectRows = [];
3690
- var beforeSelection = treeConfig ? [] : selectCheckboxRows.filter(function (row) {
3691
- return _this34.findRowIndexOf(afterFullData, row) === -1;
3692
- });
3809
+ var indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
3810
+ var childrenField = treeOpts.children || treeOpts.childrenField;
3811
+ var selectRowMaps = {};
3812
+
3813
+ // 疑惑!
3814
+ if (!treeConfig) {
3815
+ _xeUtils["default"].each(selectCheckboxMaps, function (row, rowid) {
3816
+ if (!afterFullRowMaps[rowid]) {
3817
+ selectRowMaps[rowid] = row;
3818
+ }
3819
+ });
3820
+ }
3821
+ // 疑惑!
3822
+
3693
3823
  if (checkStrictly) {
3694
3824
  this.isAllSelected = value;
3695
3825
  } else {
@@ -3703,15 +3833,20 @@ var Methods = {
3703
3833
  row: row
3704
3834
  })) {
3705
3835
  if (value) {
3706
- selectRows.push(row);
3836
+ selectRowMaps[(0, _util.getRowid)(_this33, row)] = row;
3707
3837
  }
3708
3838
  _xeUtils["default"].set(row, checkField, value);
3709
3839
  }
3840
+ if (treeConfig && indeterminateField) {
3841
+ _xeUtils["default"].set(row, indeterminateField, false);
3842
+ }
3710
3843
  };
3711
3844
  // 如果存在选中方法
3712
3845
  // 如果方法成立,则更新值,否则忽略该数据
3713
3846
  if (treeConfig) {
3714
- _xeUtils["default"].eachTree(afterFullData, checkValFn, treeOpts);
3847
+ _xeUtils["default"].eachTree(afterFullData, checkValFn, {
3848
+ children: childrenField
3849
+ });
3715
3850
  } else {
3716
3851
  afterFullData.forEach(checkValFn);
3717
3852
  }
@@ -3730,9 +3865,11 @@ var Methods = {
3730
3865
  if (isForce || !checkMethod || checkMethod({
3731
3866
  row: row
3732
3867
  })) {
3733
- selectRows.push(row);
3868
+ selectRowMaps[(0, _util.getRowid)(_this33, row)] = row;
3734
3869
  }
3735
- }, treeOpts);
3870
+ }, {
3871
+ children: childrenField
3872
+ });
3736
3873
  } else {
3737
3874
  /**
3738
3875
  * 如果是树取消
@@ -3740,12 +3877,15 @@ var Methods = {
3740
3877
  */
3741
3878
  if (!isForce && checkMethod) {
3742
3879
  _xeUtils["default"].eachTree(afterFullData, function (row) {
3880
+ var rowid = (0, _util.getRowid)(_this33, row);
3743
3881
  if (checkMethod({
3744
3882
  row: row
3745
- }) ? 0 : _this34.findRowIndexOf(selectCheckboxRows, row) > -1) {
3746
- selectRows.push(row);
3883
+ }) ? 0 : selectCheckboxMaps[rowid]) {
3884
+ selectRowMaps[rowid] = row;
3747
3885
  }
3748
- }, treeOpts);
3886
+ }, {
3887
+ children: childrenField
3888
+ });
3749
3889
  }
3750
3890
  }
3751
3891
  } else {
@@ -3756,13 +3896,18 @@ var Methods = {
3756
3896
  * 如果不存在选中方法,则添加所有数据到临时集合中
3757
3897
  */
3758
3898
  if (!isForce && checkMethod) {
3759
- selectRows = afterFullData.filter(function (row) {
3760
- return _this34.findRowIndexOf(selectCheckboxRows, row) > -1 || checkMethod({
3899
+ afterFullData.forEach(function (row) {
3900
+ var rowid = (0, _util.getRowid)(_this33, row);
3901
+ if (selectCheckboxMaps[rowid] || checkMethod({
3761
3902
  row: row
3762
- });
3903
+ })) {
3904
+ selectRowMaps[rowid] = row;
3905
+ }
3763
3906
  });
3764
3907
  } else {
3765
- selectRows = afterFullData.slice(0);
3908
+ afterFullData.forEach(function (row) {
3909
+ selectRowMaps[(0, _util.getRowid)(_this33, row)] = row;
3910
+ });
3766
3911
  }
3767
3912
  } else {
3768
3913
  /**
@@ -3771,10 +3916,13 @@ var Methods = {
3771
3916
  * 如果不存在选中方法,无需处理,临时集合默认为空
3772
3917
  */
3773
3918
  if (!isForce && checkMethod) {
3774
- selectRows = afterFullData.filter(function (row) {
3775
- return checkMethod({
3919
+ afterFullData.forEach(function (row) {
3920
+ var rowid = (0, _util.getRowid)(_this33, row);
3921
+ if (checkMethod({
3776
3922
  row: row
3777
- }) ? 0 : _this34.findRowIndexOf(selectCheckboxRows, row) > -1;
3923
+ }) ? 0 : selectCheckboxMaps[rowid]) {
3924
+ selectRowMaps[rowid] = row;
3925
+ }
3778
3926
  });
3779
3927
  }
3780
3928
  }
@@ -3782,18 +3930,19 @@ var Methods = {
3782
3930
  }
3783
3931
  if (reserve) {
3784
3932
  if (value) {
3785
- selectRows.forEach(function (row) {
3786
- checkboxReserveRowMap[(0, _util.getRowid)(_this34, row)] = row;
3933
+ _xeUtils["default"].each(selectRowMaps, function (row, rowid) {
3934
+ checkboxReserveRowMap[rowid] = row;
3787
3935
  });
3788
3936
  } else {
3789
3937
  afterFullData.forEach(function (row) {
3790
- return _this34.handleCheckboxReserveRow(row, false);
3938
+ return _this33.handleCheckboxReserveRow(row, false);
3791
3939
  });
3792
3940
  }
3793
3941
  }
3794
- this.selectCheckboxRows = checkField ? [] : beforeSelection.concat(selectRows);
3942
+ this.selectCheckboxMaps = checkField ? {} : selectRowMaps;
3795
3943
  }
3796
- this.treeIndeterminates = [];
3944
+ this.treeIndeterminateMaps = {};
3945
+ this.treeIndeterminateRowMaps = {};
3797
3946
  this.checkSelectionStatus();
3798
3947
  return this.$nextTick();
3799
3948
  },
@@ -3805,16 +3954,16 @@ var Methods = {
3805
3954
  return this.handleCheckedAllCheckboxRow(value, true);
3806
3955
  },
3807
3956
  checkSelectionStatus: function checkSelectionStatus() {
3808
- var _this35 = this;
3957
+ var _this34 = this;
3809
3958
  var afterFullData = this.afterFullData,
3810
- selectCheckboxRows = this.selectCheckboxRows,
3811
- treeIndeterminates = this.treeIndeterminates,
3959
+ selectCheckboxMaps = this.selectCheckboxMaps,
3960
+ treeIndeterminateMaps = this.treeIndeterminateMaps,
3812
3961
  checkboxOpts = this.checkboxOpts,
3813
3962
  treeConfig = this.treeConfig;
3814
3963
  var checkField = checkboxOpts.checkField,
3815
- halfField = checkboxOpts.halfField,
3816
3964
  checkStrictly = checkboxOpts.checkStrictly,
3817
3965
  checkMethod = checkboxOpts.checkMethod;
3966
+ var indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
3818
3967
  if (!checkStrictly) {
3819
3968
  var disableRows = [];
3820
3969
  var checkRows = [];
@@ -3839,19 +3988,19 @@ var Methods = {
3839
3988
  });
3840
3989
  isAllSelected = isAllResolve && afterFullData.length !== disableRows.length;
3841
3990
  if (treeConfig) {
3842
- if (halfField) {
3991
+ if (indeterminateField) {
3843
3992
  isIndeterminate = !isAllSelected && afterFullData.some(function (row) {
3844
- return _xeUtils["default"].get(row, checkField) || _xeUtils["default"].get(row, halfField) || _this35.findRowIndexOf(treeIndeterminates, row) > -1;
3993
+ return _xeUtils["default"].get(row, checkField) || _xeUtils["default"].get(row, indeterminateField) || !!treeIndeterminateMaps[(0, _util.getRowid)(_this34, row)];
3845
3994
  });
3846
3995
  } else {
3847
3996
  isIndeterminate = !isAllSelected && afterFullData.some(function (row) {
3848
- return _xeUtils["default"].get(row, checkField) || _this35.findRowIndexOf(treeIndeterminates, row) > -1;
3997
+ return _xeUtils["default"].get(row, checkField) || !!treeIndeterminateMaps[(0, _util.getRowid)(_this34, row)];
3849
3998
  });
3850
3999
  }
3851
4000
  } else {
3852
- if (halfField) {
4001
+ if (indeterminateField) {
3853
4002
  isIndeterminate = !isAllSelected && afterFullData.some(function (row) {
3854
- return _xeUtils["default"].get(row, checkField) || _xeUtils["default"].get(row, halfField);
4003
+ return _xeUtils["default"].get(row, checkField) || _xeUtils["default"].get(row, indeterminateField);
3855
4004
  });
3856
4005
  } else {
3857
4006
  isIndeterminate = !isAllSelected && afterFullData.some(function (row) {
@@ -3867,22 +4016,23 @@ var Methods = {
3867
4016
  disableRows.push(row);
3868
4017
  return true;
3869
4018
  }
3870
- if (_this35.findRowIndexOf(selectCheckboxRows, row) > -1) {
4019
+ if (selectCheckboxMaps[(0, _util.getRowid)(_this34, row)]) {
3871
4020
  checkRows.push(row);
3872
4021
  return true;
3873
4022
  }
3874
4023
  return false;
3875
4024
  } : function (row) {
3876
- return _this35.findRowIndexOf(selectCheckboxRows, row) > -1;
4025
+ return selectCheckboxMaps[(0, _util.getRowid)(_this34, row)];
3877
4026
  });
3878
4027
  isAllSelected = isAllResolve && afterFullData.length !== disableRows.length;
3879
4028
  if (treeConfig) {
3880
4029
  isIndeterminate = !isAllSelected && afterFullData.some(function (row) {
3881
- return _this35.findRowIndexOf(treeIndeterminates, row) > -1 || _this35.findRowIndexOf(selectCheckboxRows, row) > -1;
4030
+ var itemRid = (0, _util.getRowid)(_this34, row);
4031
+ return treeIndeterminateMaps[itemRid] || selectCheckboxMaps[itemRid];
3882
4032
  });
3883
4033
  } else {
3884
4034
  isIndeterminate = !isAllSelected && afterFullData.some(function (row) {
3885
- return _this35.findRowIndexOf(selectCheckboxRows, row) > -1;
4035
+ return selectCheckboxMaps[(0, _util.getRowid)(_this34, row)];
3886
4036
  });
3887
4037
  }
3888
4038
  }
@@ -3898,17 +4048,17 @@ var Methods = {
3898
4048
  fullDataRowIdData = this.fullDataRowIdData,
3899
4049
  fullAllDataRowMap = this.fullAllDataRowMap,
3900
4050
  currentRow = this.currentRow,
3901
- selectRow = this.selectRow,
4051
+ selectRadioRow = this.selectRadioRow,
3902
4052
  radioReserveRow = this.radioReserveRow,
3903
4053
  radioOpts = this.radioOpts,
3904
4054
  checkboxOpts = this.checkboxOpts,
3905
- selectCheckboxRows = this.selectCheckboxRows,
3906
- rowExpandeds = this.rowExpandeds,
3907
- treeExpandeds = this.treeExpandeds,
4055
+ selectCheckboxMaps = this.selectCheckboxMaps,
4056
+ rowExpandedMaps = this.rowExpandedMaps,
4057
+ treeExpandedMaps = this.treeExpandedMaps,
3908
4058
  expandOpts = this.expandOpts;
3909
4059
  // 单选框
3910
- if (selectRow && !fullAllDataRowMap.has(selectRow)) {
3911
- this.selectRow = null; // 刷新单选行状态
4060
+ if (selectRadioRow && !fullAllDataRowMap.has(selectRadioRow)) {
4061
+ this.selectRadioRow = null; // 刷新单选行状态
3912
4062
  }
3913
4063
  // 还原保留选中状态
3914
4064
  if (radioOpts.reserve && radioReserveRow) {
@@ -3918,7 +4068,7 @@ var Methods = {
3918
4068
  }
3919
4069
  }
3920
4070
  // 复选框
3921
- this.selectCheckboxRows = getRecoverRow(this, selectCheckboxRows); // 刷新多选行状态
4071
+ this.selectCheckboxMaps = getRecoverRowMaps(this, selectCheckboxMaps); // 刷新多选行状态
3922
4072
  // 还原保留选中状态
3923
4073
  if (checkboxOpts.reserve) {
3924
4074
  this.handleCheckedCheckboxRow(handleReserveRow(this, this.checkboxReserveRowMap), true, true);
@@ -3927,13 +4077,13 @@ var Methods = {
3927
4077
  this.currentRow = null; // 刷新当前行状态
3928
4078
  }
3929
4079
  // 行展开
3930
- this.rowExpandeds = expandColumn ? getRecoverRow(this, rowExpandeds) : []; // 刷新行展开状态
4080
+ this.rowExpandedMaps = expandColumn ? getRecoverRowMaps(this, rowExpandedMaps) : []; // 刷新行展开状态
3931
4081
  // 还原保留状态
3932
4082
  if (expandColumn && expandOpts.reserve) {
3933
4083
  this.setRowExpand(handleReserveRow(this, this.rowExpandedReserveRowMap), true);
3934
4084
  }
3935
4085
  // 树展开
3936
- this.treeExpandeds = treeConfig ? getRecoverRow(this, treeExpandeds) : []; // 刷新树展开状态
4086
+ this.treeExpandedMaps = treeConfig ? getRecoverRowMaps(this, treeExpandedMaps) : []; // 刷新树展开状态
3937
4087
  if (treeConfig && treeOpts.reserve) {
3938
4088
  this.setTreeExpand(handleReserveRow(this, this.treeExpandedReserveRowMap), true);
3939
4089
  }
@@ -3948,6 +4098,7 @@ var Methods = {
3948
4098
  afterFullData = this.afterFullData,
3949
4099
  treeConfig = this.treeConfig,
3950
4100
  treeOpts = this.treeOpts;
4101
+ var childrenField = treeOpts.children || treeOpts.childrenField;
3951
4102
  if (radioOpts.reserve && radioReserveRow) {
3952
4103
  var rowid = (0, _util.getRowid)(this, radioReserveRow);
3953
4104
  if (isFull) {
@@ -3959,7 +4110,9 @@ var Methods = {
3959
4110
  if (treeConfig) {
3960
4111
  var matchObj = _xeUtils["default"].findTree(afterFullData, function (row) {
3961
4112
  return rowid === _xeUtils["default"].get(row, rowkey);
3962
- }, treeOpts);
4113
+ }, {
4114
+ children: childrenField
4115
+ });
3963
4116
  if (matchObj) {
3964
4117
  return radioReserveRow;
3965
4118
  }
@@ -3988,23 +4141,26 @@ var Methods = {
3988
4141
  * 获取复选框保留选中的行
3989
4142
  */
3990
4143
  getCheckboxReserveRecords: function getCheckboxReserveRecords(isFull) {
3991
- var _this36 = this;
4144
+ var _this35 = this;
3992
4145
  var fullDataRowIdData = this.fullDataRowIdData,
3993
4146
  afterFullData = this.afterFullData,
3994
4147
  checkboxReserveRowMap = this.checkboxReserveRowMap,
3995
4148
  checkboxOpts = this.checkboxOpts,
3996
4149
  treeConfig = this.treeConfig,
3997
4150
  treeOpts = this.treeOpts;
4151
+ var childrenField = treeOpts.children || treeOpts.childrenField;
3998
4152
  var reserveSelection = [];
3999
4153
  if (checkboxOpts.reserve) {
4000
4154
  var afterFullIdMaps = {};
4001
4155
  if (treeConfig) {
4002
4156
  _xeUtils["default"].eachTree(afterFullData, function (row) {
4003
- afterFullIdMaps[(0, _util.getRowid)(_this36, row)] = 1;
4004
- }, treeOpts);
4157
+ afterFullIdMaps[(0, _util.getRowid)(_this35, row)] = 1;
4158
+ }, {
4159
+ children: childrenField
4160
+ });
4005
4161
  } else {
4006
4162
  afterFullData.forEach(function (row) {
4007
- afterFullIdMaps[(0, _util.getRowid)(_this36, row)] = 1;
4163
+ afterFullIdMaps[(0, _util.getRowid)(_this35, row)] = 1;
4008
4164
  });
4009
4165
  }
4010
4166
  _xeUtils["default"].each(checkboxReserveRowMap, function (oldRow, oldRowid) {
@@ -4063,33 +4219,39 @@ var Methods = {
4063
4219
  * 清空行为不管是否被禁用还是保留记录,都将彻底清空选中状态
4064
4220
  */
4065
4221
  clearCheckboxRow: function clearCheckboxRow() {
4066
- var _this37 = this;
4222
+ var _this36 = this;
4067
4223
  var tableFullData = this.tableFullData,
4068
4224
  treeConfig = this.treeConfig,
4069
4225
  treeOpts = this.treeOpts,
4070
4226
  checkboxOpts = this.checkboxOpts;
4071
4227
  var checkField = checkboxOpts.checkField,
4072
4228
  reserve = checkboxOpts.reserve;
4229
+ var childrenField = treeOpts.children || treeOpts.childrenField;
4230
+ var indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
4073
4231
  if (checkField) {
4232
+ var handleClearChecked = function handleClearChecked(item) {
4233
+ if (treeConfig && indeterminateField) {
4234
+ _xeUtils["default"].set(item, indeterminateField, false);
4235
+ }
4236
+ _xeUtils["default"].set(item, checkField, false);
4237
+ };
4074
4238
  if (treeConfig) {
4075
- _xeUtils["default"].eachTree(tableFullData, function (item) {
4076
- return _xeUtils["default"].set(item, checkField, false);
4077
- }, treeOpts);
4078
- } else {
4079
- tableFullData.forEach(function (item) {
4080
- return _xeUtils["default"].set(item, checkField, false);
4239
+ _xeUtils["default"].eachTree(tableFullData, handleClearChecked, {
4240
+ children: childrenField
4081
4241
  });
4242
+ } else {
4243
+ tableFullData.forEach(handleClearChecked);
4082
4244
  }
4083
4245
  }
4084
4246
  if (reserve) {
4085
4247
  tableFullData.forEach(function (row) {
4086
- return _this37.handleCheckboxReserveRow(row, false);
4248
+ return _this36.handleCheckboxReserveRow(row, false);
4087
4249
  });
4088
4250
  }
4089
4251
  this.isAllSelected = false;
4090
4252
  this.isIndeterminate = false;
4091
- this.selectCheckboxRows = [];
4092
- this.treeIndeterminates = [];
4253
+ this.selectCheckboxMaps = {};
4254
+ this.treeIndeterminateMaps = {};
4093
4255
  return this.$nextTick();
4094
4256
  },
4095
4257
  /**
@@ -4114,7 +4276,7 @@ var Methods = {
4114
4276
  * 单选,行选中事件
4115
4277
  */
4116
4278
  triggerRadioRowEvent: function triggerRadioRowEvent(evnt, params) {
4117
- var oldValue = this.selectRow,
4279
+ var oldValue = this.selectRadioRow,
4118
4280
  radioOpts = this.radioOpts;
4119
4281
  var row = params.row;
4120
4282
  var newValue = row;
@@ -4167,7 +4329,7 @@ var Methods = {
4167
4329
  return this.$nextTick();
4168
4330
  },
4169
4331
  isCheckedByRadioRow: function isCheckedByRadioRow(row) {
4170
- return this.selectRow === row;
4332
+ return this.selectRadioRow === row;
4171
4333
  },
4172
4334
  handleCheckedRadioRow: function handleCheckedRadioRow(row, isForce) {
4173
4335
  var radioOpts = this.radioOpts;
@@ -4175,7 +4337,7 @@ var Methods = {
4175
4337
  if (row && (isForce || !checkMethod || checkMethod({
4176
4338
  row: row
4177
4339
  }))) {
4178
- this.selectRow = row;
4340
+ this.selectRadioRow = row;
4179
4341
  this.handleRadioReserveRow(row);
4180
4342
  }
4181
4343
  return this.$nextTick();
@@ -4205,7 +4367,7 @@ var Methods = {
4205
4367
  * 用于单选行,手动清空用户的选择
4206
4368
  */
4207
4369
  clearRadioRow: function clearRadioRow() {
4208
- this.selectRow = null;
4370
+ this.selectRadioRow = null;
4209
4371
  return this.$nextTick();
4210
4372
  },
4211
4373
  /**
@@ -4218,30 +4380,18 @@ var Methods = {
4218
4380
  * 用于单选行,获取当已选中的数据
4219
4381
  */
4220
4382
  getRadioRecord: function getRadioRecord(isFull) {
4221
- var treeConfig = this.treeConfig,
4222
- treeOpts = this.treeOpts,
4223
- selectRow = this.selectRow,
4383
+ var selectRadioRow = this.selectRadioRow,
4224
4384
  fullDataRowIdData = this.fullDataRowIdData,
4225
- afterFullData = this.afterFullData;
4226
- if (selectRow) {
4227
- var rowid = (0, _util.getRowid)(this, selectRow);
4385
+ afterFullRowMaps = this.afterFullRowMaps;
4386
+ if (selectRadioRow) {
4387
+ var rowid = (0, _util.getRowid)(this, selectRadioRow);
4228
4388
  if (isFull) {
4229
4389
  if (!fullDataRowIdData[rowid]) {
4230
- return selectRow;
4390
+ return selectRadioRow;
4231
4391
  }
4232
4392
  } else {
4233
- if (treeConfig) {
4234
- var rowkey = (0, _util.getRowkey)(this);
4235
- var matchObj = _xeUtils["default"].findTree(afterFullData, function (row) {
4236
- return rowid === _xeUtils["default"].get(row, rowkey);
4237
- }, treeOpts);
4238
- if (matchObj) {
4239
- return selectRow;
4240
- }
4241
- } else {
4242
- if (afterFullData.indexOf(selectRow) > -1) {
4243
- return selectRow;
4244
- }
4393
+ if (afterFullRowMaps[rowid]) {
4394
+ return selectRadioRow;
4245
4395
  }
4246
4396
  }
4247
4397
  }
@@ -4335,12 +4485,12 @@ var Methods = {
4335
4485
  * 如果存在规则,则校验
4336
4486
  */
4337
4487
  handleChangeCell: function handleChangeCell(evnt, params) {
4338
- var _this38 = this;
4488
+ var _this37 = this;
4339
4489
  this.checkValidate('blur')["catch"](function (e) {
4340
4490
  return e;
4341
4491
  }).then(function () {
4342
- _this38.handleActived(params, evnt).then(function () {
4343
- return _this38.checkValidate('change');
4492
+ _this37.handleActived(params, evnt).then(function () {
4493
+ return _this37.checkValidate('change');
4344
4494
  })["catch"](function (e) {
4345
4495
  return e;
4346
4496
  });
@@ -4434,7 +4584,7 @@ var Methods = {
4434
4584
  * 如果是双击模式,则激活为编辑状态
4435
4585
  */
4436
4586
  triggerCellDblclickEvent: function triggerCellDblclickEvent(evnt, params) {
4437
- var _this39 = this;
4587
+ var _this38 = this;
4438
4588
  var editStore = this.editStore,
4439
4589
  editConfig = this.editConfig,
4440
4590
  editOpts = this.editOpts;
@@ -4447,15 +4597,15 @@ var Methods = {
4447
4597
  this.checkValidate('blur')["catch"](function (e) {
4448
4598
  return e;
4449
4599
  }).then(function () {
4450
- _this39.handleActived(params, evnt).then(function () {
4451
- return _this39.checkValidate('change');
4600
+ _this38.handleActived(params, evnt).then(function () {
4601
+ return _this38.checkValidate('change');
4452
4602
  })["catch"](function (e) {
4453
4603
  return e;
4454
4604
  });
4455
4605
  });
4456
4606
  } else if (editOpts.mode === 'cell') {
4457
4607
  this.handleActived(params, evnt).then(function () {
4458
- return _this39.checkValidate('change');
4608
+ return _this38.checkValidate('change');
4459
4609
  })["catch"](function (e) {
4460
4610
  return e;
4461
4611
  });
@@ -4465,7 +4615,7 @@ var Methods = {
4465
4615
  this.emitEvent('cell-dblclick', params, evnt);
4466
4616
  },
4467
4617
  handleDefaultSort: function handleDefaultSort() {
4468
- var _this40 = this;
4618
+ var _this39 = this;
4469
4619
  var sortConfig = this.sortConfig,
4470
4620
  sortOpts = this.sortOpts;
4471
4621
  var defaultSort = sortOpts.defaultSort;
@@ -4478,7 +4628,7 @@ var Methods = {
4478
4628
  var field = item.field,
4479
4629
  order = item.order;
4480
4630
  if (field && order) {
4481
- var column = _this40.getColumnByField(field);
4631
+ var column = _this39.getColumnByField(field);
4482
4632
  if (column && column.sortable) {
4483
4633
  column.order = order;
4484
4634
  column.sortTime = Date.now() + index;
@@ -4525,7 +4675,7 @@ var Methods = {
4525
4675
  }
4526
4676
  },
4527
4677
  sort: function sort(sortConfs, sortOrder) {
4528
- var _this41 = this;
4678
+ var _this40 = this;
4529
4679
  var sortOpts = this.sortOpts;
4530
4680
  var multiple = sortOpts.multiple,
4531
4681
  remote = sortOpts.remote,
@@ -4551,14 +4701,14 @@ var Methods = {
4551
4701
  order = confs.order;
4552
4702
  var column = field;
4553
4703
  if (_xeUtils["default"].isString(field)) {
4554
- column = _this41.getColumnByField(field);
4704
+ column = _this40.getColumnByField(field);
4555
4705
  }
4556
4706
  if (column && (column.sortable || column.remoteSort)) {
4557
4707
  if (!firstSortColumn) {
4558
4708
  firstSortColumn = column;
4559
4709
  }
4560
4710
  if (orders.indexOf(order) === -1) {
4561
- order = getNextSortOrder(_this41, column);
4711
+ order = getNextSortOrder(_this40, column);
4562
4712
  }
4563
4713
  if (column.order !== order) {
4564
4714
  column.order = order;
@@ -4571,8 +4721,8 @@ var Methods = {
4571
4721
  this.handleTableData(true);
4572
4722
  }
4573
4723
  return this.$nextTick().then(function () {
4574
- _this41.updateCellAreas();
4575
- return _this41.updateStyle();
4724
+ _this40.updateCellAreas();
4725
+ return _this40.updateStyle();
4576
4726
  });
4577
4727
  }
4578
4728
  return this.$nextTick();
@@ -4687,17 +4837,19 @@ var Methods = {
4687
4837
  return rest && rest.expandLoaded;
4688
4838
  },
4689
4839
  clearRowExpandLoaded: function clearRowExpandLoaded(row) {
4690
- var _this42 = this;
4691
4840
  var expandOpts = this.expandOpts,
4692
- expandLazyLoadeds = this.expandLazyLoadeds,
4841
+ rowExpandLazyLoadedMaps = this.rowExpandLazyLoadedMaps,
4693
4842
  fullAllDataRowMap = this.fullAllDataRowMap;
4694
4843
  var lazy = expandOpts.lazy;
4844
+ var rowid = (0, _util.getRowid)(this, row);
4695
4845
  var rest = fullAllDataRowMap.get(row);
4696
4846
  if (lazy && rest) {
4697
4847
  rest.expandLoaded = false;
4698
- _xeUtils["default"].remove(expandLazyLoadeds, function (item) {
4699
- return _this42.eqRow(item, row);
4700
- });
4848
+ var rowTempExpandLazyLoadedMaps = _objectSpread({}, rowExpandLazyLoadedMaps);
4849
+ if (rowTempExpandLazyLoadedMaps[rowid]) {
4850
+ delete rowTempExpandLazyLoadedMaps[rowid];
4851
+ }
4852
+ this.rowExpandLazyLoadedMaps = rowTempExpandLazyLoadedMaps;
4701
4853
  }
4702
4854
  return this.$nextTick();
4703
4855
  },
@@ -4706,13 +4858,14 @@ var Methods = {
4706
4858
  * @param {Row} row 行对象
4707
4859
  */
4708
4860
  reloadRowExpand: function reloadRowExpand(row) {
4709
- var _this43 = this;
4861
+ var _this41 = this;
4710
4862
  var expandOpts = this.expandOpts,
4711
- expandLazyLoadeds = this.expandLazyLoadeds;
4863
+ rowExpandLazyLoadedMaps = this.rowExpandLazyLoadedMaps;
4712
4864
  var lazy = expandOpts.lazy;
4713
- if (lazy && this.findRowIndexOf(expandLazyLoadeds, row) === -1) {
4865
+ var rowid = (0, _util.getRowid)(this, row);
4866
+ if (lazy && !rowExpandLazyLoadedMaps[rowid]) {
4714
4867
  this.clearRowExpandLoaded(row).then(function () {
4715
- return _this43.handleAsyncRowExpand(row);
4868
+ return _this41.handleAsyncRowExpand(row);
4716
4869
  });
4717
4870
  }
4718
4871
  return this.$nextTick();
@@ -4729,11 +4882,12 @@ var Methods = {
4729
4882
  */
4730
4883
  triggerRowExpandEvent: function triggerRowExpandEvent(evnt, params) {
4731
4884
  var expandOpts = this.expandOpts,
4732
- expandLazyLoadeds = this.expandLazyLoadeds,
4885
+ rowExpandLazyLoadedMaps = this.rowExpandLazyLoadedMaps,
4733
4886
  column = this.expandColumn;
4734
4887
  var row = params.row;
4735
4888
  var lazy = expandOpts.lazy;
4736
- if (!lazy || this.findRowIndexOf(expandLazyLoadeds, row) === -1) {
4889
+ var rowid = (0, _util.getRowid)(this, row);
4890
+ if (!lazy || !rowExpandLazyLoadedMaps[rowid]) {
4737
4891
  var expanded = !this.isExpandByRow(row);
4738
4892
  var columnIndex = this.getColumnIndex(column);
4739
4893
  var $columnIndex = this.getVMColumnIndex(column);
@@ -4784,37 +4938,57 @@ var Methods = {
4784
4938
  treeOpts = this.treeOpts,
4785
4939
  tableFullData = this.tableFullData,
4786
4940
  tableFullTreeData = this.tableFullTreeData;
4941
+ var childrenField = treeOpts.children || treeOpts.childrenField;
4787
4942
  var expandedRows = [];
4788
4943
  if (treeConfig) {
4789
4944
  _xeUtils["default"].eachTree(tableFullTreeData, function (row) {
4790
4945
  expandedRows.push(row);
4791
- }, treeOpts);
4946
+ }, {
4947
+ children: childrenField
4948
+ });
4792
4949
  } else {
4793
4950
  expandedRows = tableFullData;
4794
4951
  }
4795
4952
  return this.setRowExpand(expandedRows, expanded);
4796
4953
  },
4797
4954
  handleAsyncRowExpand: function handleAsyncRowExpand(row) {
4798
- var _this44 = this;
4799
- var rest = this.fullAllDataRowMap.get(row);
4955
+ var _this42 = this;
4956
+ var fullAllDataRowMap = this.fullAllDataRowMap,
4957
+ expandOpts = this.expandOpts;
4958
+ var rest = fullAllDataRowMap.get(row);
4800
4959
  return new Promise(function (resolve) {
4801
- _this44.expandLazyLoadeds.push(row);
4802
- _this44.expandOpts.loadMethod({
4803
- $table: _this44,
4804
- row: row,
4805
- rowIndex: _this44.getRowIndex(row),
4806
- $rowIndex: _this44.getVMRowIndex(row)
4807
- }).then(function () {
4808
- rest.expandLoaded = true;
4809
- _this44.rowExpandeds.push(row);
4810
- })["catch"](function () {
4811
- rest.expandLoaded = false;
4812
- })["finally"](function () {
4813
- _xeUtils["default"].remove(_this44.expandLazyLoadeds, function (item) {
4814
- return _this44.eqRow(item, row);
4960
+ var loadMethod = expandOpts.loadMethod;
4961
+ if (loadMethod) {
4962
+ var rowExpandLazyLoadedMaps = _this42.rowExpandLazyLoadedMaps;
4963
+ var rowTempExpandLazyLoadedMaps = _objectSpread({}, rowExpandLazyLoadedMaps);
4964
+ var rowid = (0, _util.getRowid)(_this42, row);
4965
+ rowTempExpandLazyLoadedMaps[rowid] = row;
4966
+ _this42.rowExpandLazyLoadedMaps = rowTempExpandLazyLoadedMaps;
4967
+ loadMethod({
4968
+ $table: _this42,
4969
+ row: row,
4970
+ rowIndex: _this42.getRowIndex(row),
4971
+ $rowIndex: _this42.getVMRowIndex(row)
4972
+ }).then(function () {
4973
+ rest.expandLoaded = true;
4974
+ var rowExpandedMaps = _this42.rowExpandedMaps;
4975
+ var rowTempExpandedMaps = _objectSpread({}, rowExpandedMaps);
4976
+ rowTempExpandedMaps[rowid] = row;
4977
+ _this42.rowExpandedMaps = rowTempExpandedMaps;
4978
+ })["catch"](function () {
4979
+ rest.expandLoaded = false;
4980
+ })["finally"](function () {
4981
+ var rowExpandLazyLoadedMaps = _this42.rowExpandLazyLoadedMaps;
4982
+ var rowTempExpandLazyLoadedMaps = _objectSpread({}, rowExpandLazyLoadedMaps);
4983
+ if (rowTempExpandLazyLoadedMaps[rowid]) {
4984
+ delete rowTempExpandLazyLoadedMaps[rowid];
4985
+ }
4986
+ _this42.rowExpandLazyLoadedMaps = rowTempExpandLazyLoadedMaps;
4987
+ resolve(_this42.$nextTick().then(_this42.recalculate));
4815
4988
  });
4816
- resolve(_this44.$nextTick().then(_this44.recalculate));
4817
- });
4989
+ } else {
4990
+ resolve();
4991
+ }
4818
4992
  });
4819
4993
  },
4820
4994
  /**
@@ -4825,12 +4999,13 @@ var Methods = {
4825
4999
  * @param {Boolean} expanded 是否展开
4826
5000
  */
4827
5001
  setRowExpand: function setRowExpand(rows, expanded) {
4828
- var _this45 = this;
4829
- var fullAllDataRowMap = this.fullAllDataRowMap,
4830
- expandLazyLoadeds = this.expandLazyLoadeds,
5002
+ var _this43 = this;
5003
+ var rowExpandedMaps = this.rowExpandedMaps,
5004
+ fullAllDataRowIdData = this.fullAllDataRowIdData,
5005
+ rowExpandLazyLoadedMaps = this.rowExpandLazyLoadedMaps,
4831
5006
  expandOpts = this.expandOpts,
4832
5007
  column = this.expandColumn;
4833
- var rowExpandeds = this.rowExpandeds;
5008
+ var rExpandedMaps = _objectSpread({}, rowExpandedMaps);
4834
5009
  var reserve = expandOpts.reserve,
4835
5010
  lazy = expandOpts.lazy,
4836
5011
  accordion = expandOpts.accordion,
@@ -4844,7 +5019,7 @@ var Methods = {
4844
5019
  }
4845
5020
  if (accordion) {
4846
5021
  // 只能同时展开一个
4847
- rowExpandeds = [];
5022
+ rExpandedMaps = {};
4848
5023
  rows = rows.slice(rows.length - 1, rows.length);
4849
5024
  }
4850
5025
  var validRows = toggleMethod ? rows.filter(function (row) {
@@ -4854,34 +5029,38 @@ var Methods = {
4854
5029
  columnIndex: columnIndex,
4855
5030
  $columnIndex: $columnIndex,
4856
5031
  row: row,
4857
- rowIndex: _this45.getRowIndex(row),
4858
- $rowIndex: _this45.getVMRowIndex(row)
5032
+ rowIndex: _this43.getRowIndex(row),
5033
+ $rowIndex: _this43.getVMRowIndex(row)
4859
5034
  });
4860
5035
  }) : rows;
4861
5036
  if (expanded) {
4862
5037
  validRows.forEach(function (row) {
4863
- if (_this45.findRowIndexOf(rowExpandeds, row) === -1) {
4864
- var rest = fullAllDataRowMap.get(row);
4865
- var isLoad = lazy && !rest.expandLoaded && _this45.findRowIndexOf(expandLazyLoadeds, row) === -1;
5038
+ var rowid = (0, _util.getRowid)(_this43, row);
5039
+ if (!rExpandedMaps[rowid]) {
5040
+ var rest = fullAllDataRowIdData[rowid];
5041
+ var isLoad = lazy && !rest.expandLoaded && !rowExpandLazyLoadedMaps[rowid];
4866
5042
  if (isLoad) {
4867
- lazyRests.push(_this45.handleAsyncRowExpand(row));
5043
+ lazyRests.push(_this43.handleAsyncRowExpand(row));
4868
5044
  } else {
4869
- rowExpandeds.push(row);
5045
+ rExpandedMaps[rowid] = row;
4870
5046
  }
4871
5047
  }
4872
5048
  });
4873
5049
  } else {
4874
- _xeUtils["default"].remove(rowExpandeds, function (row) {
4875
- return _this45.findRowIndexOf(validRows, row) > -1;
5050
+ validRows.forEach(function (item) {
5051
+ var rowid = (0, _util.getRowid)(_this43, item);
5052
+ if (rExpandedMaps[rowid]) {
5053
+ delete rExpandedMaps[rowid];
5054
+ }
4876
5055
  });
4877
5056
  }
4878
5057
  if (reserve) {
4879
5058
  validRows.forEach(function (row) {
4880
- return _this45.handleRowExpandReserve(row, expanded);
5059
+ return _this43.handleRowExpandReserve(row, expanded);
4881
5060
  });
4882
5061
  }
4883
5062
  }
4884
- this.rowExpandeds = rowExpandeds;
5063
+ this.rowExpandedMaps = rExpandedMaps;
4885
5064
  return Promise.all(lazyRests).then(this.recalculate);
4886
5065
  },
4887
5066
  /**
@@ -4889,28 +5068,28 @@ var Methods = {
4889
5068
  * @param {Row} row 行对象
4890
5069
  */
4891
5070
  isExpandByRow: function isExpandByRow(row) {
4892
- var rowExpandeds = this.rowExpandeds;
4893
- return this.findRowIndexOf(rowExpandeds, row) > -1;
5071
+ var rowExpandedMaps = this.rowExpandedMaps;
5072
+ var rowid = (0, _util.getRowid)(this, row);
5073
+ return !!rowExpandedMaps[rowid];
4894
5074
  },
4895
5075
  /**
4896
5076
  * 手动清空展开行状态,数据会恢复成未展开的状态
4897
5077
  */
4898
5078
  clearRowExpand: function clearRowExpand() {
4899
- var _this46 = this;
5079
+ var _this44 = this;
4900
5080
  var expandOpts = this.expandOpts,
4901
- rowExpandeds = this.rowExpandeds,
4902
5081
  tableFullData = this.tableFullData;
4903
5082
  var reserve = expandOpts.reserve;
4904
- var isExists = rowExpandeds.length;
4905
- this.rowExpandeds = [];
5083
+ var expList = this.getRowExpandRecords();
5084
+ this.rowExpandedMaps = {};
4906
5085
  if (reserve) {
4907
5086
  tableFullData.forEach(function (row) {
4908
- return _this46.handleRowExpandReserve(row, false);
5087
+ return _this44.handleRowExpandReserve(row, false);
4909
5088
  });
4910
5089
  }
4911
5090
  return this.$nextTick().then(function () {
4912
- if (isExists) {
4913
- _this46.recalculate();
5091
+ if (expList.length) {
5092
+ _this44.recalculate();
4914
5093
  }
4915
5094
  });
4916
5095
  },
@@ -4931,13 +5110,25 @@ var Methods = {
4931
5110
  }
4932
5111
  },
4933
5112
  getRowExpandRecords: function getRowExpandRecords() {
4934
- return this.rowExpandeds.slice(0);
5113
+ var rest = [];
5114
+ _xeUtils["default"].each(this.rowExpandedMaps, function (item) {
5115
+ if (item) {
5116
+ rest.push(item);
5117
+ }
5118
+ });
5119
+ return rest;
4935
5120
  },
4936
5121
  getTreeExpandRecords: function getTreeExpandRecords() {
4937
- return this.treeExpandeds.slice(0);
5122
+ var rest = [];
5123
+ _xeUtils["default"].each(this.treeExpandedMaps, function (item) {
5124
+ if (item) {
5125
+ rest.push(item);
5126
+ }
5127
+ });
5128
+ return rest;
4938
5129
  },
4939
5130
  /**
4940
- * 获取数表格状态
5131
+ * 获取树表格状态
4941
5132
  */
4942
5133
  getTreeStatus: function getTreeStatus() {
4943
5134
  if (this.treeConfig) {
@@ -4958,16 +5149,17 @@ var Methods = {
4958
5149
  },
4959
5150
  clearTreeExpandLoaded: function clearTreeExpandLoaded(row) {
4960
5151
  var treeOpts = this.treeOpts,
4961
- treeExpandeds = this.treeExpandeds,
5152
+ treeExpandedMaps = this.treeExpandedMaps,
4962
5153
  fullAllDataRowMap = this.fullAllDataRowMap;
4963
5154
  var transform = treeOpts.transform,
4964
5155
  lazy = treeOpts.lazy;
5156
+ var rowid = (0, _util.getRowid)(this, row);
4965
5157
  var rest = fullAllDataRowMap.get(row);
4966
5158
  if (lazy && rest) {
4967
5159
  rest.treeLoaded = false;
4968
- _xeUtils["default"].remove(treeExpandeds, function (item) {
4969
- return row === item;
4970
- });
5160
+ if (treeExpandedMaps[rowid]) {
5161
+ delete treeExpandedMaps[rowid];
5162
+ }
4971
5163
  }
4972
5164
  if (transform) {
4973
5165
  this.handleVirtualTreeToList();
@@ -4980,23 +5172,23 @@ var Methods = {
4980
5172
  * @param {Row} row 行对象
4981
5173
  */
4982
5174
  reloadTreeExpand: function reloadTreeExpand(row) {
4983
- var _this47 = this;
5175
+ var _this45 = this;
4984
5176
  var treeOpts = this.treeOpts,
4985
- treeLazyLoadeds = this.treeLazyLoadeds;
5177
+ treeExpandLazyLoadedMaps = this.treeExpandLazyLoadedMaps;
4986
5178
  var transform = treeOpts.transform,
4987
- lazy = treeOpts.lazy,
4988
- hasChildField = treeOpts.hasChildField,
4989
- hasChild = treeOpts.hasChild;
4990
- if (lazy && row[hasChildField || hasChild] && treeLazyLoadeds.indexOf(row) === -1) {
5179
+ lazy = treeOpts.lazy;
5180
+ var hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
5181
+ var rowid = (0, _util.getRowid)(this, row);
5182
+ if (lazy && row[hasChildField] && !treeExpandLazyLoadedMaps[rowid]) {
4991
5183
  this.clearTreeExpandLoaded(row).then(function () {
4992
- return _this47.handleAsyncTreeExpandChilds(row);
5184
+ return _this45.handleAsyncTreeExpandChilds(row);
4993
5185
  }).then(function () {
4994
5186
  if (transform) {
4995
- _this47.handleVirtualTreeToList();
4996
- return _this47.handleTableData();
5187
+ _this45.handleVirtualTreeToList();
5188
+ return _this45.handleTableData();
4997
5189
  }
4998
5190
  }).then(function () {
4999
- return _this47.recalculate();
5191
+ return _this45.recalculate();
5000
5192
  });
5001
5193
  }
5002
5194
  return this.$nextTick();
@@ -5013,11 +5205,12 @@ var Methods = {
5013
5205
  */
5014
5206
  triggerTreeExpandEvent: function triggerTreeExpandEvent(evnt, params) {
5015
5207
  var treeOpts = this.treeOpts,
5016
- treeLazyLoadeds = this.treeLazyLoadeds;
5208
+ treeExpandLazyLoadedMaps = this.treeExpandLazyLoadedMaps;
5017
5209
  var row = params.row,
5018
5210
  column = params.column;
5019
5211
  var lazy = treeOpts.lazy;
5020
- if (!lazy || treeLazyLoadeds.indexOf(row) === -1) {
5212
+ var rowid = (0, _util.getRowid)(this, row);
5213
+ if (!lazy || !treeExpandLazyLoadedMaps[rowid]) {
5021
5214
  var expanded = !this.isTreeExpandByRow(row);
5022
5215
  var columnIndex = this.getColumnIndex(column);
5023
5216
  var $columnIndex = this.getVMColumnIndex(column);
@@ -5047,6 +5240,7 @@ var Methods = {
5047
5240
  if (treeConfig) {
5048
5241
  var expandAll = treeOpts.expandAll,
5049
5242
  expandRowKeys = treeOpts.expandRowKeys;
5243
+ var childrenField = treeOpts.children || treeOpts.childrenField;
5050
5244
  if (expandAll) {
5051
5245
  this.setAllTreeExpand(true);
5052
5246
  } else if (expandRowKeys) {
@@ -5055,7 +5249,9 @@ var Methods = {
5055
5249
  expandRowKeys.forEach(function (rowid) {
5056
5250
  var matchObj = _xeUtils["default"].findTree(tableFullData, function (item) {
5057
5251
  return rowid === _xeUtils["default"].get(item, rowkey);
5058
- }, treeOpts);
5252
+ }, {
5253
+ children: childrenField
5254
+ });
5059
5255
  if (matchObj) {
5060
5256
  defExpandeds.push(matchObj.item);
5061
5257
  }
@@ -5065,59 +5261,67 @@ var Methods = {
5065
5261
  }
5066
5262
  },
5067
5263
  handleAsyncTreeExpandChilds: function handleAsyncTreeExpandChilds(row) {
5068
- var _this48 = this;
5069
- var fullAllDataRowMap = this.fullAllDataRowMap,
5070
- treeExpandeds = this.treeExpandeds,
5071
- treeOpts = this.treeOpts,
5072
- treeLazyLoadeds = this.treeLazyLoadeds,
5264
+ var _this46 = this;
5265
+ var treeOpts = this.treeOpts,
5073
5266
  checkboxOpts = this.checkboxOpts;
5074
5267
  var transform = treeOpts.transform,
5075
5268
  loadMethod = treeOpts.loadMethod;
5076
5269
  var checkStrictly = checkboxOpts.checkStrictly;
5077
- var rest = fullAllDataRowMap.get(row);
5078
5270
  return new Promise(function (resolve) {
5079
- treeLazyLoadeds.push(row);
5080
- loadMethod({
5081
- $table: _this48,
5082
- row: row
5083
- }).then(function (childRecords) {
5084
- // 响应成功后则展开行,并将子节点挂载到该节点下
5085
- rest.treeLoaded = true;
5086
- _xeUtils["default"].remove(treeLazyLoadeds, function (item) {
5087
- return item === row;
5088
- });
5089
- if (!_xeUtils["default"].isArray(childRecords)) {
5090
- childRecords = [];
5091
- }
5092
- if (childRecords) {
5093
- return _this48.loadTreeChildren(row, childRecords).then(function (childRows) {
5094
- if (childRows.length && treeExpandeds.indexOf(row) === -1) {
5095
- treeExpandeds.push(row);
5096
- }
5097
- // 如果当前节点已选中,则展开后子节点也被选中
5098
- if (!checkStrictly && _this48.isCheckedByCheckboxRow(row)) {
5099
- _this48.handleCheckedCheckboxRow(childRows, true, true);
5100
- }
5101
- return _this48.$nextTick().then(function () {
5102
- if (transform) {
5103
- return _this48.handleTableData();
5271
+ if (loadMethod) {
5272
+ var fullAllDataRowMap = _this46.fullAllDataRowMap,
5273
+ treeExpandLazyLoadedMaps = _this46.treeExpandLazyLoadedMaps;
5274
+ var rowid = (0, _util.getRowid)(_this46, row);
5275
+ var rest = fullAllDataRowMap.get(row);
5276
+ treeExpandLazyLoadedMaps[rowid] = row;
5277
+ loadMethod({
5278
+ $table: _this46,
5279
+ row: row
5280
+ }).then(function (childRecords) {
5281
+ // 响应成功后则展开行,并将子节点挂载到该节点下
5282
+ rest.treeLoaded = true;
5283
+ if (treeExpandLazyLoadedMaps[rowid]) {
5284
+ treeExpandLazyLoadedMaps[rowid] = null;
5285
+ }
5286
+ if (!_xeUtils["default"].isArray(childRecords)) {
5287
+ childRecords = [];
5288
+ }
5289
+ if (childRecords) {
5290
+ return _this46.loadTreeChildren(row, childRecords).then(function (childRows) {
5291
+ var treeExpandedMaps = _this46.treeExpandedMaps;
5292
+ var treeTempExpandedMaps = _objectSpread({}, treeExpandedMaps);
5293
+ if (childRows.length && !treeTempExpandedMaps[rowid]) {
5294
+ treeTempExpandedMaps[rowid] = row;
5295
+ _this46.treeExpandedMaps = treeTempExpandedMaps;
5104
5296
  }
5297
+ // 如果当前节点已选中,则展开后子节点也被选中
5298
+ if (!checkStrictly && _this46.isCheckedByCheckboxRow(row)) {
5299
+ _this46.handleCheckedCheckboxRow(childRows, true, true);
5300
+ }
5301
+ return _this46.$nextTick().then(function () {
5302
+ if (transform) {
5303
+ return _this46.handleTableData();
5304
+ }
5305
+ });
5105
5306
  });
5307
+ }
5308
+ })["catch"](function () {
5309
+ // 如果响应异常,则不展开,再次点击后将重新触发懒加载
5310
+ rest.treeLoaded = false;
5311
+ var treeExpandLazyLoadedMaps = _this46.treeExpandLazyLoadedMaps;
5312
+ if (treeExpandLazyLoadedMaps[rowid]) {
5313
+ treeExpandLazyLoadedMaps[rowid] = null;
5314
+ }
5315
+ })["finally"](function () {
5316
+ _this46.$nextTick().then(function () {
5317
+ return _this46.recalculate();
5318
+ }).then(function () {
5319
+ return resolve();
5106
5320
  });
5107
- }
5108
- })["catch"](function () {
5109
- // 如果响应异常,则不展开,再次点击后将重新触发懒加载
5110
- rest.treeLoaded = false;
5111
- _xeUtils["default"].remove(treeLazyLoadeds, function (item) {
5112
- return item === row;
5113
5321
  });
5114
- })["finally"](function () {
5115
- _this48.$nextTick().then(function () {
5116
- return _this48.recalculate();
5117
- }).then(function () {
5118
- return resolve();
5119
- });
5120
- });
5322
+ } else {
5323
+ resolve();
5324
+ }
5121
5325
  });
5122
5326
  },
5123
5327
  /**
@@ -5127,16 +5331,17 @@ var Methods = {
5127
5331
  setAllTreeExpand: function setAllTreeExpand(expanded) {
5128
5332
  var tableFullData = this.tableFullData,
5129
5333
  treeOpts = this.treeOpts;
5130
- var lazy = treeOpts.lazy,
5131
- childrenField = treeOpts.childrenField,
5132
- children = treeOpts.children;
5334
+ var lazy = treeOpts.lazy;
5335
+ var childrenField = treeOpts.children || treeOpts.childrenField;
5133
5336
  var expandeds = [];
5134
5337
  _xeUtils["default"].eachTree(tableFullData, function (row) {
5135
- var rowChildren = row[childrenField || children];
5338
+ var rowChildren = row[childrenField];
5136
5339
  if (lazy || rowChildren && rowChildren.length) {
5137
5340
  expandeds.push(row);
5138
5341
  }
5139
- }, treeOpts);
5342
+ }, {
5343
+ children: childrenField
5344
+ });
5140
5345
  return this.setTreeExpand(expandeds, expanded);
5141
5346
  },
5142
5347
  /**
@@ -5146,21 +5351,20 @@ var Methods = {
5146
5351
  * @returns
5147
5352
  */
5148
5353
  handleBaseTreeExpand: function handleBaseTreeExpand(rows, expanded) {
5149
- var _this49 = this;
5354
+ var _this47 = this;
5150
5355
  var fullAllDataRowMap = this.fullAllDataRowMap,
5151
5356
  tableFullData = this.tableFullData,
5152
- treeExpandeds = this.treeExpandeds,
5357
+ treeExpandedMaps = this.treeExpandedMaps,
5153
5358
  treeOpts = this.treeOpts,
5154
- treeLazyLoadeds = this.treeLazyLoadeds,
5359
+ treeExpandLazyLoadedMaps = this.treeExpandLazyLoadedMaps,
5155
5360
  treeNodeColumn = this.treeNodeColumn;
5156
5361
  var reserve = treeOpts.reserve,
5157
5362
  lazy = treeOpts.lazy,
5158
- hasChildField = treeOpts.hasChildField,
5159
- hasChild = treeOpts.hasChild,
5160
- childrenField = treeOpts.childrenField,
5161
- children = treeOpts.children,
5162
5363
  accordion = treeOpts.accordion,
5163
5364
  toggleMethod = treeOpts.toggleMethod;
5365
+ var treeTempExpandedMaps = _objectSpread({}, treeExpandedMaps);
5366
+ var childrenField = treeOpts.children || treeOpts.childrenField;
5367
+ var hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
5164
5368
  var result = [];
5165
5369
  var columnIndex = this.getColumnIndex(treeNodeColumn);
5166
5370
  var $columnIndex = this.getVMColumnIndex(treeNodeColumn);
@@ -5178,38 +5382,48 @@ var Methods = {
5178
5382
  // 同一级只能展开一个
5179
5383
  var matchObj = _xeUtils["default"].findTree(tableFullData, function (item) {
5180
5384
  return item === validRows[0];
5181
- }, treeOpts);
5385
+ }, {
5386
+ children: childrenField
5387
+ });
5182
5388
  if (matchObj) {
5183
- _xeUtils["default"].remove(treeExpandeds, function (item) {
5184
- return matchObj.items.indexOf(item) > -1;
5389
+ matchObj.items.forEach(function (item) {
5390
+ var rowid = (0, _util.getRowid)(_this47, item);
5391
+ if (treeTempExpandedMaps[rowid]) {
5392
+ delete treeTempExpandedMaps[rowid];
5393
+ }
5185
5394
  });
5186
5395
  }
5187
5396
  }
5188
5397
  if (expanded) {
5189
5398
  validRows.forEach(function (row) {
5190
- if (treeExpandeds.indexOf(row) === -1) {
5399
+ var rowid = (0, _util.getRowid)(_this47, row);
5400
+ if (!treeTempExpandedMaps[rowid]) {
5191
5401
  var rest = fullAllDataRowMap.get(row);
5192
- var isLoad = lazy && row[hasChildField || hasChild] && !rest.treeLoaded && treeLazyLoadeds.indexOf(row) === -1;
5402
+ var isLoad = lazy && row[hasChildField] && !rest.treeLoaded && !treeExpandLazyLoadedMaps[rowid];
5193
5403
  // 是否使用懒加载
5194
5404
  if (isLoad) {
5195
- result.push(_this49.handleAsyncTreeExpandChilds(row));
5405
+ result.push(_this47.handleAsyncTreeExpandChilds(row));
5196
5406
  } else {
5197
- if (row[childrenField || children] && row[childrenField || children].length) {
5198
- treeExpandeds.push(row);
5407
+ if (row[childrenField] && row[childrenField].length) {
5408
+ treeTempExpandedMaps[rowid] = row;
5199
5409
  }
5200
5410
  }
5201
5411
  }
5202
5412
  });
5203
5413
  } else {
5204
- _xeUtils["default"].remove(treeExpandeds, function (row) {
5205
- return validRows.indexOf(row) > -1;
5414
+ validRows.forEach(function (item) {
5415
+ var rowid = (0, _util.getRowid)(_this47, item);
5416
+ if (treeTempExpandedMaps[rowid]) {
5417
+ delete treeTempExpandedMaps[rowid];
5418
+ }
5206
5419
  });
5207
5420
  }
5208
5421
  if (reserve) {
5209
5422
  validRows.forEach(function (row) {
5210
- return _this49.handleTreeExpandReserve(row, expanded);
5423
+ return _this47.handleTreeExpandReserve(row, expanded);
5211
5424
  });
5212
5425
  }
5426
+ this.treeExpandedMaps = treeTempExpandedMaps;
5213
5427
  return Promise.all(result).then(this.recalculate);
5214
5428
  },
5215
5429
  /**
@@ -5219,12 +5433,12 @@ var Methods = {
5219
5433
  * @returns
5220
5434
  */
5221
5435
  handleVirtualTreeExpand: function handleVirtualTreeExpand(rows, expanded) {
5222
- var _this50 = this;
5436
+ var _this48 = this;
5223
5437
  return this.handleBaseTreeExpand(rows, expanded).then(function () {
5224
- _this50.handleVirtualTreeToList();
5225
- return _this50.handleTableData();
5438
+ _this48.handleVirtualTreeToList();
5439
+ return _this48.handleTableData();
5226
5440
  }).then(function () {
5227
- return _this50.recalculate();
5441
+ return _this48.recalculate();
5228
5442
  });
5229
5443
  },
5230
5444
  /**
@@ -5257,33 +5471,36 @@ var Methods = {
5257
5471
  * @param {Row} row 行对象
5258
5472
  */
5259
5473
  isTreeExpandByRow: function isTreeExpandByRow(row) {
5260
- return this.treeExpandeds.indexOf(row) > -1;
5474
+ var treeExpandedMaps = this.treeExpandedMaps;
5475
+ return !!treeExpandedMaps[(0, _util.getRowid)(this, row)];
5261
5476
  },
5262
5477
  /**
5263
5478
  * 手动清空树形节点的展开状态,数据会恢复成未展开的状态
5264
5479
  */
5265
5480
  clearTreeExpand: function clearTreeExpand() {
5266
- var _this51 = this;
5481
+ var _this49 = this;
5267
5482
  var treeOpts = this.treeOpts,
5268
- treeExpandeds = this.treeExpandeds,
5269
5483
  tableFullData = this.tableFullData;
5270
5484
  var transform = treeOpts.transform,
5271
5485
  reserve = treeOpts.reserve;
5272
- var isExists = treeExpandeds.length;
5273
- this.treeExpandeds = [];
5486
+ var childrenField = treeOpts.children || treeOpts.childrenField;
5487
+ var expList = this.getTreeExpandRecords();
5488
+ this.treeExpandedMaps = {};
5274
5489
  if (reserve) {
5275
5490
  _xeUtils["default"].eachTree(tableFullData, function (row) {
5276
- return _this51.handleTreeExpandReserve(row, false);
5277
- }, treeOpts);
5491
+ return _this49.handleTreeExpandReserve(row, false);
5492
+ }, {
5493
+ children: childrenField
5494
+ });
5278
5495
  }
5279
5496
  return this.handleTableData().then(function () {
5280
5497
  if (transform) {
5281
- _this51.handleVirtualTreeToList();
5282
- return _this51.handleTableData();
5498
+ _this49.handleVirtualTreeToList();
5499
+ return _this49.handleTableData();
5283
5500
  }
5284
5501
  }).then(function () {
5285
- if (isExists) {
5286
- _this51.recalculate();
5502
+ if (expList.length) {
5503
+ _this49.recalculate();
5287
5504
  }
5288
5505
  });
5289
5506
  },
@@ -5402,28 +5619,28 @@ var Methods = {
5402
5619
  },
5403
5620
  // 计算可视渲染相关数据
5404
5621
  computeScrollLoad: function computeScrollLoad() {
5405
- var _this52 = this;
5622
+ var _this50 = this;
5406
5623
  return this.$nextTick().then(function () {
5407
- var sYOpts = _this52.sYOpts,
5408
- sXOpts = _this52.sXOpts,
5409
- scrollXLoad = _this52.scrollXLoad,
5410
- scrollYLoad = _this52.scrollYLoad,
5411
- scrollXStore = _this52.scrollXStore,
5412
- scrollYStore = _this52.scrollYStore;
5624
+ var sYOpts = _this50.sYOpts,
5625
+ sXOpts = _this50.sXOpts,
5626
+ scrollXLoad = _this50.scrollXLoad,
5627
+ scrollYLoad = _this50.scrollYLoad,
5628
+ scrollXStore = _this50.scrollXStore,
5629
+ scrollYStore = _this50.scrollYStore;
5413
5630
  // 计算 X 逻辑
5414
5631
  if (scrollXLoad) {
5415
- var _computeVirtualX3 = computeVirtualX(_this52),
5632
+ var _computeVirtualX3 = computeVirtualX(_this50),
5416
5633
  visibleXSize = _computeVirtualX3.visibleSize;
5417
5634
  var offsetXSize = sXOpts.oSize ? _xeUtils["default"].toNumber(sXOpts.oSize) : _dom.browse.msie ? 10 : _dom.browse.edge ? 5 : 0;
5418
5635
  scrollXStore.offsetSize = offsetXSize;
5419
5636
  scrollXStore.visibleSize = visibleXSize;
5420
5637
  scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
5421
- _this52.updateScrollXData();
5638
+ _this50.updateScrollXData();
5422
5639
  } else {
5423
- _this52.updateScrollXSpace();
5640
+ _this50.updateScrollXSpace();
5424
5641
  }
5425
5642
  // 计算 Y 逻辑
5426
- var _computeVirtualY = computeVirtualY(_this52),
5643
+ var _computeVirtualY = computeVirtualY(_this50),
5427
5644
  rowHeight = _computeVirtualY.rowHeight,
5428
5645
  visibleYSize = _computeVirtualY.visibleSize;
5429
5646
  scrollYStore.rowHeight = rowHeight;
@@ -5432,12 +5649,12 @@ var Methods = {
5432
5649
  scrollYStore.offsetSize = offsetYSize;
5433
5650
  scrollYStore.visibleSize = visibleYSize;
5434
5651
  scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
5435
- _this52.updateScrollYData();
5652
+ _this50.updateScrollYData();
5436
5653
  } else {
5437
- _this52.updateScrollYSpace();
5654
+ _this50.updateScrollYSpace();
5438
5655
  }
5439
- _this52.rowHeight = rowHeight;
5440
- _this52.$nextTick(_this52.updateStyle);
5656
+ _this50.rowHeight = rowHeight;
5657
+ _this50.$nextTick(_this50.updateStyle);
5441
5658
  });
5442
5659
  },
5443
5660
  handleTableColumn: function handleTableColumn() {
@@ -5447,11 +5664,11 @@ var Methods = {
5447
5664
  this.tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0);
5448
5665
  },
5449
5666
  updateScrollXData: function updateScrollXData() {
5450
- var _this53 = this;
5667
+ var _this51 = this;
5451
5668
  // this.tableColumn = []
5452
5669
  this.$nextTick(function () {
5453
- _this53.handleTableColumn();
5454
- _this53.updateScrollXSpace();
5670
+ _this51.handleTableColumn();
5671
+ _this51.updateScrollXSpace();
5455
5672
  });
5456
5673
  },
5457
5674
  // 更新横向 X 可视渲染上下剩余空间大小
@@ -5502,11 +5719,11 @@ var Methods = {
5502
5719
  }
5503
5720
  },
5504
5721
  updateScrollYData: function updateScrollYData() {
5505
- var _this54 = this;
5722
+ var _this52 = this;
5506
5723
  // this.tableData = []
5507
5724
  this.$nextTick(function () {
5508
- _this54.handleTableData();
5509
- _this54.updateScrollYSpace();
5725
+ _this52.handleTableData();
5726
+ _this52.updateScrollYSpace();
5510
5727
  });
5511
5728
  },
5512
5729
  // 更新纵向 Y 可视渲染上下剩余空间大小
@@ -5547,7 +5764,7 @@ var Methods = {
5547
5764
  * @param {Number} scrollTop 上距离
5548
5765
  */
5549
5766
  scrollTo: function scrollTo(scrollLeft, scrollTop) {
5550
- var _this55 = this;
5767
+ var _this53 = this;
5551
5768
  var $refs = this.$refs;
5552
5769
  var tableBody = $refs.tableBody,
5553
5770
  rightBody = $refs.rightBody,
@@ -5564,7 +5781,7 @@ var Methods = {
5564
5781
  if (this.scrollXLoad || this.scrollYLoad) {
5565
5782
  return new Promise(function (resolve) {
5566
5783
  return setTimeout(function () {
5567
- return resolve(_this55.$nextTick());
5784
+ return resolve(_this53.$nextTick());
5568
5785
  }, 50);
5569
5786
  });
5570
5787
  }
@@ -5606,26 +5823,29 @@ var Methods = {
5606
5823
  * @param {Row} row 行对象
5607
5824
  */
5608
5825
  scrollToTreeRow: function scrollToTreeRow(row) {
5609
- var _this56 = this;
5826
+ var _this54 = this;
5610
5827
  var tableFullData = this.tableFullData,
5611
5828
  treeConfig = this.treeConfig,
5612
5829
  treeOpts = this.treeOpts;
5830
+ var childrenField = treeOpts.children || treeOpts.childrenField;
5613
5831
  var rests = [];
5614
5832
  if (treeConfig) {
5615
5833
  var matchObj = _xeUtils["default"].findTree(tableFullData, function (item) {
5616
5834
  return item === row;
5617
- }, treeOpts);
5835
+ }, {
5836
+ children: childrenField
5837
+ });
5618
5838
  if (matchObj) {
5619
5839
  var nodes = matchObj.nodes;
5620
5840
  nodes.forEach(function (row, index) {
5621
- if (index < nodes.length - 1 && !_this56.isTreeExpandByRow(row)) {
5622
- rests.push(_this56.setTreeExpand(row, true));
5841
+ if (index < nodes.length - 1 && !_this54.isTreeExpandByRow(row)) {
5842
+ rests.push(_this54.setTreeExpand(row, true));
5623
5843
  }
5624
5844
  });
5625
5845
  }
5626
5846
  }
5627
5847
  return Promise.all(rests).then(function () {
5628
- return (0, _util.rowToVisible)(_this56, row);
5848
+ return (0, _util.rowToVisible)(_this54, row);
5629
5849
  });
5630
5850
  },
5631
5851
  /**
@@ -5680,30 +5900,30 @@ var Methods = {
5680
5900
  * 如果单元格配置了校验规则,则会进行校验
5681
5901
  */
5682
5902
  updateStatus: function updateStatus(slotParams, cellValue) {
5683
- var _this57 = this;
5903
+ var _this55 = this;
5684
5904
  var customVal = !_xeUtils["default"].isUndefined(cellValue);
5685
5905
  return this.$nextTick().then(function () {
5686
- var $refs = _this57.$refs,
5687
- editRules = _this57.editRules,
5688
- validStore = _this57.validStore;
5906
+ var $refs = _this55.$refs,
5907
+ editRules = _this55.editRules,
5908
+ validStore = _this55.validStore;
5689
5909
  if (slotParams && $refs.tableBody && editRules) {
5690
5910
  var row = slotParams.row,
5691
5911
  column = slotParams.column;
5692
5912
  var type = 'change';
5693
- if (_this57.hasCellRules(type, row, column)) {
5694
- var cell = _this57.getCell(row, column);
5913
+ if (_this55.hasCellRules(type, row, column)) {
5914
+ var cell = _this55.getCell(row, column);
5695
5915
  if (cell) {
5696
- return _this57.validCellRules(type, row, column, cellValue).then(function () {
5916
+ return _this55.validCellRules(type, row, column, cellValue).then(function () {
5697
5917
  if (customVal && validStore.visible) {
5698
5918
  setCellValue(row, column, cellValue);
5699
5919
  }
5700
- _this57.clearValidate();
5920
+ _this55.clearValidate();
5701
5921
  })["catch"](function (_ref8) {
5702
5922
  var rule = _ref8.rule;
5703
5923
  if (customVal) {
5704
5924
  setCellValue(row, column, cellValue);
5705
5925
  }
5706
- _this57.showValidTooltip({
5926
+ _this55.showValidTooltip({
5707
5927
  rule: rule,
5708
5928
  row: row,
5709
5929
  column: column,
@@ -5723,13 +5943,13 @@ var Methods = {
5723
5943
  * @param {TableMergeConfig[]} merges { row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }
5724
5944
  */
5725
5945
  setMergeCells: function setMergeCells(merges) {
5726
- var _this58 = this;
5946
+ var _this56 = this;
5727
5947
  if (this.spanMethod) {
5728
5948
  (0, _log.errLog)('vxe.error.errConflicts', ['merge-cells', 'span-method']);
5729
5949
  }
5730
5950
  setMerges(this, merges, this.mergeList, this.afterFullData);
5731
5951
  return this.$nextTick().then(function () {
5732
- return _this58.updateCellAreas();
5952
+ return _this56.updateCellAreas();
5733
5953
  });
5734
5954
  },
5735
5955
  /**
@@ -5737,13 +5957,13 @@ var Methods = {
5737
5957
  * @param {TableMergeConfig[]} merges 多个或数组 [{row:Row|number, col:ColumnInfo|number}]
5738
5958
  */
5739
5959
  removeMergeCells: function removeMergeCells(merges) {
5740
- var _this59 = this;
5960
+ var _this57 = this;
5741
5961
  if (this.spanMethod) {
5742
5962
  (0, _log.errLog)('vxe.error.errConflicts', ['merge-cells', 'span-method']);
5743
5963
  }
5744
5964
  var rest = removeMerges(this, merges, this.mergeList, this.afterFullData);
5745
5965
  return this.$nextTick().then(function () {
5746
- _this59.updateCellAreas();
5966
+ _this57.updateCellAreas();
5747
5967
  return rest;
5748
5968
  });
5749
5969
  },
@@ -5764,23 +5984,23 @@ var Methods = {
5764
5984
  this.setMergeFooterItems(this.mergeFooterItems);
5765
5985
  },
5766
5986
  setMergeFooterItems: function setMergeFooterItems(merges) {
5767
- var _this60 = this;
5987
+ var _this58 = this;
5768
5988
  if (this.footerSpanMethod) {
5769
5989
  (0, _log.errLog)('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method']);
5770
5990
  }
5771
5991
  setMerges(this, merges, this.mergeFooterList, null);
5772
5992
  return this.$nextTick().then(function () {
5773
- return _this60.updateCellAreas();
5993
+ return _this58.updateCellAreas();
5774
5994
  });
5775
5995
  },
5776
5996
  removeMergeFooterItems: function removeMergeFooterItems(merges) {
5777
- var _this61 = this;
5997
+ var _this59 = this;
5778
5998
  if (this.footerSpanMethod) {
5779
5999
  (0, _log.errLog)('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method']);
5780
6000
  }
5781
6001
  var rest = removeMerges(this, merges, this.mergeFooterList, null);
5782
6002
  return this.$nextTick().then(function () {
5783
- _this61.updateCellAreas();
6003
+ _this59.updateCellAreas();
5784
6004
  return rest;
5785
6005
  });
5786
6006
  },
@@ -5897,9 +6117,9 @@ var Methods = {
5897
6117
  return cellLabel;
5898
6118
  },
5899
6119
  findRowIndexOf: function findRowIndexOf(list, row) {
5900
- var _this62 = this;
6120
+ var _this60 = this;
5901
6121
  return row ? _xeUtils["default"].findIndexOf(list, function (item) {
5902
- return _this62.eqRow(item, row);
6122
+ return _this60.eqRow(item, row);
5903
6123
  }) : -1;
5904
6124
  },
5905
6125
  eqRow: function eqRow(row1, row2) {
@@ -5920,7 +6140,7 @@ var Methods = {
5920
6140
  };
5921
6141
 
5922
6142
  // Module methods
5923
- var funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',');
6143
+ var funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',');
5924
6144
  funcs.forEach(function (name) {
5925
6145
  Methods[name] = function () {
5926
6146
  if (process.env.NODE_ENV === 'development') {