vxe-table 3.7.0-beta.16 → 3.7.0-beta.17

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 (45) hide show
  1. package/lib/edit/src/mixin.js +6 -4
  2. package/lib/edit/src/mixin.min.js +1 -1
  3. package/lib/icon/style/style.css +1 -1
  4. package/lib/icon/style/style.min.css +1 -1
  5. package/lib/index.css +1 -1
  6. package/lib/index.umd.js +571 -404
  7. package/lib/index.umd.min.js +1 -1
  8. package/lib/input/src/input.js +24 -1
  9. package/lib/input/src/input.min.js +1 -1
  10. package/lib/input/style/style.css +21 -0
  11. package/lib/input/style/style.min.css +1 -1
  12. package/lib/style.css +1 -1
  13. package/lib/style.min.css +1 -1
  14. package/lib/table/src/body.js +6 -6
  15. package/lib/table/src/body.min.js +1 -1
  16. package/lib/table/src/cell.js +20 -16
  17. package/lib/table/src/cell.min.js +1 -1
  18. package/lib/table/src/methods.js +498 -360
  19. package/lib/table/src/methods.min.js +1 -1
  20. package/lib/table/src/table.js +15 -13
  21. package/lib/table/src/table.min.js +1 -1
  22. package/lib/table/style/style.css +2 -2
  23. package/lib/table/style/style.min.css +1 -1
  24. package/lib/tools/log.js +1 -1
  25. package/lib/tools/log.min.js +1 -1
  26. package/lib/v-x-e-table/index.js +1 -1
  27. package/lib/v-x-e-table/index.min.js +1 -1
  28. package/package.json +3 -8
  29. package/packages/edit/src/mixin.js +7 -5
  30. package/packages/input/src/input.js +24 -1
  31. package/packages/table/src/body.js +6 -6
  32. package/packages/table/src/cell.js +18 -14
  33. package/packages/table/src/methods.js +375 -181
  34. package/packages/table/src/table.js +15 -13
  35. package/styles/css-variable.scss +3 -3
  36. package/styles/input.scss +25 -0
  37. package/styles/table.scss +6 -2
  38. package/styles/textarea.scss +3 -3
  39. package/styles/variable.scss +3 -3
  40. /package/lib/icon/style/{iconfont.1693009490086.ttf → iconfont.1693628087676.ttf} +0 -0
  41. /package/lib/icon/style/{iconfont.1693009490086.woff → iconfont.1693628087676.woff} +0 -0
  42. /package/lib/icon/style/{iconfont.1693009490086.woff2 → iconfont.1693628087676.woff2} +0 -0
  43. /package/lib/{iconfont.1693009490086.ttf → iconfont.1693628087676.ttf} +0 -0
  44. /package/lib/{iconfont.1693009490086.woff → iconfont.1693628087676.woff} +0 -0
  45. /package/lib/{iconfont.1693009490086.woff2 → iconfont.1693628087676.woff2} +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 = [];
@@ -777,7 +781,8 @@ var Methods = {
777
781
  fullDataRowIdData = this.fullDataRowIdData,
778
782
  fullDataRowMap = this.fullDataRowMap,
779
783
  fullAllDataRowMap = this.fullAllDataRowMap,
780
- fullAllDataRowIdData = this.fullAllDataRowIdData;
784
+ fullAllDataRowIdData = this.fullAllDataRowIdData,
785
+ sourceDataRowIdData = this.sourceDataRowIdData;
781
786
  var transform = treeOpts.transform,
782
787
  mapChildrenField = treeOpts.mapChildrenField;
783
788
  var childrenField = treeOpts.children || treeOpts.childrenField;
@@ -794,6 +799,10 @@ var Methods = {
794
799
  if (matchObj) {
795
800
  matchObj.item[childrenField] = _xeUtils["default"].clone(rows, true);
796
801
  }
802
+ rows.forEach(function (childRow) {
803
+ var rowid = (0, _util.getRowid)(_this12, childRow);
804
+ sourceDataRowIdData[rowid] = _xeUtils["default"].clone(childRow, true);
805
+ });
797
806
  }
798
807
  _xeUtils["default"].eachTree(rows, function (childRow, index, items, path, parent, nodes) {
799
808
  var rowid = (0, _util.getRowid)(_this12, childRow);
@@ -1343,14 +1352,14 @@ var Methods = {
1343
1352
  * 用于多选行,获取已选中的数据
1344
1353
  */
1345
1354
  getCheckboxRecords: function getCheckboxRecords(isFull) {
1346
- var _this17 = this;
1347
1355
  var tableFullData = this.tableFullData,
1348
1356
  afterFullData = this.afterFullData,
1349
1357
  treeConfig = this.treeConfig,
1350
1358
  treeOpts = this.treeOpts,
1351
1359
  checkboxOpts = this.checkboxOpts,
1352
1360
  tableFullTreeData = this.tableFullTreeData,
1353
- afterTreeFullData = this.afterTreeFullData;
1361
+ afterTreeFullData = this.afterTreeFullData,
1362
+ afterFullRowMaps = this.afterFullRowMaps;
1354
1363
  var transform = treeOpts.transform,
1355
1364
  mapChildrenField = treeOpts.mapChildrenField;
1356
1365
  var checkField = checkboxOpts.checkField;
@@ -1370,18 +1379,13 @@ var Methods = {
1370
1379
  });
1371
1380
  }
1372
1381
  } else {
1373
- var selectCheckboxRows = this.selectCheckboxRows;
1374
- if (treeConfig) {
1375
- rowList = _xeUtils["default"].filterTree(currTableData, function (row) {
1376
- return _this17.findRowIndexOf(selectCheckboxRows, row) > -1;
1377
- }, {
1378
- children: transform ? mapChildrenField : childrenField
1379
- });
1380
- } else {
1381
- rowList = currTableData.filter(function (row) {
1382
- return _this17.findRowIndexOf(selectCheckboxRows, row) > -1;
1383
- });
1384
- }
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
+ });
1385
1389
  }
1386
1390
  return rowList;
1387
1391
  },
@@ -1390,17 +1394,20 @@ var Methods = {
1390
1394
  * @returns
1391
1395
  */
1392
1396
  handleVirtualTreeToList: function handleVirtualTreeToList() {
1397
+ var _this17 = this;
1393
1398
  var treeOpts = this.treeOpts,
1394
1399
  treeConfig = this.treeConfig,
1395
- treeExpandeds = this.treeExpandeds,
1400
+ treeExpandedMaps = this.treeExpandedMaps,
1396
1401
  afterTreeFullData = this.afterTreeFullData,
1397
1402
  afterFullData = this.afterFullData;
1398
1403
  if (treeConfig && treeOpts.transform) {
1399
1404
  var fullData = [];
1400
- var expandMaps = new Map();
1405
+ var expandMaps = {};
1401
1406
  _xeUtils["default"].eachTree(afterTreeFullData, function (row, index, items, path, parent) {
1402
- if (!parent || expandMaps.has(parent) && treeExpandeds.indexOf(parent) > -1) {
1403
- 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;
1404
1411
  fullData.push(row);
1405
1412
  }
1406
1413
  }, {
@@ -1630,6 +1637,7 @@ var Methods = {
1630
1637
  afterTreeFullData = this.afterTreeFullData,
1631
1638
  treeOpts = this.treeOpts;
1632
1639
  var childrenField = treeOpts.children || treeOpts.childrenField;
1640
+ var fullMaps = {};
1633
1641
  if (treeConfig) {
1634
1642
  _xeUtils["default"].eachTree(afterTreeFullData, function (row, index, items, path) {
1635
1643
  var rowid = (0, _util.getRowid)(_this19, row);
@@ -1655,6 +1663,7 @@ var Methods = {
1655
1663
  fullAllDataRowIdData[rowid] = rest;
1656
1664
  fullDataRowIdData[rowid] = rest;
1657
1665
  }
1666
+ fullMaps[rowid] = row;
1658
1667
  }, {
1659
1668
  children: treeOpts.transform ? treeOpts.mapChildrenField : childrenField
1660
1669
  });
@@ -1681,8 +1690,10 @@ var Methods = {
1681
1690
  fullAllDataRowIdData[rowid] = rest;
1682
1691
  fullDataRowIdData[rowid] = rest;
1683
1692
  }
1693
+ fullMaps[rowid] = row;
1684
1694
  });
1685
1695
  }
1696
+ this.afterFullRowMaps = fullMaps;
1686
1697
  },
1687
1698
  /**
1688
1699
  * 只对 tree-config 有效,获取行的父级
@@ -3437,15 +3448,24 @@ var Methods = {
3437
3448
  * 获取复选框半选状态的行数据
3438
3449
  */
3439
3450
  getCheckboxIndeterminateRecords: function getCheckboxIndeterminateRecords(isFull) {
3440
- var _this31 = this;
3441
3451
  var treeConfig = this.treeConfig,
3442
- treeIndeterminates = this.treeIndeterminates,
3452
+ treeIndeterminateMaps = this.treeIndeterminateMaps,
3443
3453
  fullDataRowIdData = this.fullDataRowIdData;
3444
3454
  if (treeConfig) {
3445
- return isFull ? treeIndeterminates.slice(0) : treeIndeterminates.filter(function (row) {
3446
- var rowid = (0, _util.getRowid)(_this31, row);
3447
- 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
+ }
3448
3464
  });
3465
+ if (isFull) {
3466
+ return fullRest;
3467
+ }
3468
+ return defRest;
3449
3469
  }
3450
3470
  return [];
3451
3471
  },
@@ -3470,12 +3490,12 @@ var Methods = {
3470
3490
  }
3471
3491
  },
3472
3492
  handleCheckedCheckboxRow: function handleCheckedCheckboxRow(rows, value, isForce) {
3473
- var _this32 = this;
3493
+ var _this31 = this;
3474
3494
  if (rows && !_xeUtils["default"].isArray(rows)) {
3475
3495
  rows = [rows];
3476
3496
  }
3477
3497
  rows.forEach(function (row) {
3478
- return _this32.handleSelectRow({
3498
+ return _this31.handleSelectRow({
3479
3499
  row: row
3480
3500
  }, !!value, isForce);
3481
3501
  });
@@ -3490,52 +3510,59 @@ var Methods = {
3490
3510
  return this.handleCheckedCheckboxRow(rows, value, true);
3491
3511
  },
3492
3512
  isCheckedByCheckboxRow: function isCheckedByCheckboxRow(row) {
3493
- var selectCheckboxRows = this.selectCheckboxRows;
3513
+ var selectCheckboxMaps = this.selectCheckboxMaps;
3494
3514
  var checkField = this.checkboxOpts.checkField;
3495
3515
  if (checkField) {
3496
3516
  return _xeUtils["default"].get(row, checkField);
3497
3517
  }
3498
- return this.findRowIndexOf(selectCheckboxRows, row) > -1;
3518
+ return !!selectCheckboxMaps[(0, _util.getRowid)(this, row)];
3499
3519
  },
3500
3520
  isIndeterminateByCheckboxRow: function isIndeterminateByCheckboxRow(row) {
3501
- var treeIndeterminates = this.treeIndeterminates;
3502
- 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);
3503
3523
  },
3504
3524
  /**
3505
3525
  * 多选,行选中事件
3506
3526
  * value 选中true 不选false 半选-1
3507
3527
  */
3508
3528
  handleSelectRow: function handleSelectRow(_ref6, value, isForce) {
3509
- var _this33 = this;
3529
+ var _this32 = this;
3510
3530
  var row = _ref6.row;
3511
- var selectCheckboxRows = this.selectCheckboxRows,
3531
+ var selectCheckboxMaps = this.selectCheckboxMaps,
3512
3532
  afterFullData = this.afterFullData,
3513
3533
  treeConfig = this.treeConfig,
3514
3534
  treeOpts = this.treeOpts,
3515
- treeIndeterminates = this.treeIndeterminates,
3535
+ treeIndeterminateMaps = this.treeIndeterminateMaps,
3516
3536
  checkboxOpts = this.checkboxOpts;
3517
3537
  var checkField = checkboxOpts.checkField,
3518
3538
  checkStrictly = checkboxOpts.checkStrictly,
3519
3539
  checkMethod = checkboxOpts.checkMethod;
3540
+ var selectRowMaps = _objectSpread({}, selectCheckboxMaps);
3520
3541
  var childrenField = treeOpts.children || treeOpts.childrenField;
3542
+ var indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
3543
+ var rowid = (0, _util.getRowid)(this, row);
3521
3544
  if (checkField) {
3522
3545
  if (treeConfig && !checkStrictly) {
3523
3546
  if (value === -1) {
3524
- if (this.findRowIndexOf(treeIndeterminates, row) === -1) {
3525
- treeIndeterminates.push(row);
3547
+ if (!treeIndeterminateMaps[rowid]) {
3548
+ if (indeterminateField) {
3549
+ _xeUtils["default"].set(row, indeterminateField, true);
3550
+ }
3551
+ treeIndeterminateMaps[rowid] = row;
3526
3552
  }
3527
3553
  _xeUtils["default"].set(row, checkField, false);
3528
3554
  } else {
3529
3555
  // 更新子节点状态
3530
3556
  _xeUtils["default"].eachTree([row], function (item) {
3531
- if (_this33.eqRow(item, row) || isForce || !checkMethod || checkMethod({
3557
+ if (_this32.eqRow(item, row) || isForce || !checkMethod || checkMethod({
3532
3558
  row: item
3533
3559
  })) {
3534
3560
  _xeUtils["default"].set(item, checkField, value);
3535
- _xeUtils["default"].remove(treeIndeterminates, function (half) {
3536
- return _this33.eqRow(half, item);
3537
- });
3538
- _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);
3539
3566
  }
3540
3567
  }, {
3541
3568
  children: childrenField
@@ -3543,30 +3570,48 @@ var Methods = {
3543
3570
  }
3544
3571
  // 如果存在父节点,更新父节点状态
3545
3572
  var matchObj = _xeUtils["default"].findTree(afterFullData, function (item) {
3546
- return _this33.eqRow(item, row);
3573
+ return _this32.eqRow(item, row);
3547
3574
  }, {
3548
3575
  children: childrenField
3549
3576
  });
3550
3577
  if (matchObj && matchObj.parent) {
3551
3578
  var parentStatus;
3552
- var vItems = !isForce && checkMethod ? matchObj.items.filter(function (item) {
3553
- return checkMethod({
3554
- 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
+ }
3590
+ });
3591
+ } else {
3592
+ matchObj.items.forEach(function (item) {
3593
+ var itemRid = (0, _util.getRowid)(_this32, item);
3594
+ vItemMaps[itemRid] = item;
3595
+ vItems.push(item);
3555
3596
  });
3556
- }) : matchObj.items;
3597
+ }
3557
3598
  var indeterminatesItem = _xeUtils["default"].find(matchObj.items, function (item) {
3558
- return _this33.findRowIndexOf(treeIndeterminates, item) > -1;
3599
+ return !!treeIndeterminateMaps[(0, _util.getRowid)(_this32, item)];
3559
3600
  });
3560
3601
  if (indeterminatesItem) {
3561
3602
  parentStatus = -1;
3562
3603
  } else {
3563
- var selectItems = matchObj.items.filter(function (item) {
3564
- 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
+ }
3565
3609
  });
3566
3610
  parentStatus = selectItems.filter(function (item) {
3567
- return _this33.findRowIndexOf(vItems, item) > -1;
3611
+ return vItemMaps[(0, _util.getRowid)(_this32, item)];
3568
3612
  }).length === vItems.length ? true : selectItems.length || value === -1 ? -1 : false;
3569
3613
  }
3614
+ this.selectCheckboxMaps = selectRowMaps;
3570
3615
  return this.handleSelectRow({
3571
3616
  row: matchObj.parent
3572
3617
  }, parentStatus, isForce);
@@ -3582,29 +3627,34 @@ var Methods = {
3582
3627
  } else {
3583
3628
  if (treeConfig && !checkStrictly) {
3584
3629
  if (value === -1) {
3585
- if (this.findRowIndexOf(treeIndeterminates, row) === -1) {
3586
- 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];
3587
3638
  }
3588
- _xeUtils["default"].remove(selectCheckboxRows, function (item) {
3589
- return _this33.eqRow(item, row);
3590
- });
3591
3639
  } else {
3592
3640
  // 更新子节点状态
3593
3641
  _xeUtils["default"].eachTree([row], function (item) {
3594
- 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({
3595
3644
  row: item
3596
3645
  })) {
3597
3646
  if (value) {
3598
- selectCheckboxRows.push(item);
3647
+ selectRowMaps[itemRid] = item;
3599
3648
  } else {
3600
- _xeUtils["default"].remove(selectCheckboxRows, function (select) {
3601
- return _this33.eqRow(select, item);
3602
- });
3649
+ if (selectRowMaps[itemRid]) {
3650
+ delete selectRowMaps[itemRid];
3651
+ }
3603
3652
  }
3604
- _xeUtils["default"].remove(treeIndeterminates, function (half) {
3605
- return _this33.eqRow(half, item);
3606
- });
3607
- _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);
3608
3658
  }
3609
3659
  }, {
3610
3660
  children: childrenField
@@ -3612,30 +3662,49 @@ var Methods = {
3612
3662
  }
3613
3663
  // 如果存在父节点,更新父节点状态
3614
3664
  var _matchObj = _xeUtils["default"].findTree(afterFullData, function (item) {
3615
- return _this33.eqRow(item, row);
3665
+ return _this32.eqRow(item, row);
3616
3666
  }, {
3617
3667
  children: childrenField
3618
3668
  });
3619
3669
  if (_matchObj && _matchObj.parent) {
3620
3670
  var _parentStatus;
3621
- var _vItems = !isForce && checkMethod ? _matchObj.items.filter(function (item) {
3622
- return checkMethod({
3623
- 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
+ }
3624
3682
  });
3625
- }) : _matchObj.items;
3683
+ } else {
3684
+ _matchObj.items.forEach(function (item) {
3685
+ var itemRid = (0, _util.getRowid)(_this32, item);
3686
+ _vItemMaps[itemRid] = item;
3687
+ _vItems.push(item);
3688
+ });
3689
+ }
3626
3690
  var _indeterminatesItem = _xeUtils["default"].find(_matchObj.items, function (item) {
3627
- return _this33.findRowIndexOf(treeIndeterminates, item) > -1;
3691
+ return !!treeIndeterminateMaps[(0, _util.getRowid)(_this32, item)];
3628
3692
  });
3629
3693
  if (_indeterminatesItem) {
3630
3694
  _parentStatus = -1;
3631
3695
  } else {
3632
- var _selectItems = _matchObj.items.filter(function (item) {
3633
- 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
+ }
3634
3702
  });
3635
3703
  _parentStatus = _selectItems.filter(function (item) {
3636
- return _this33.findRowIndexOf(_vItems, item) > -1;
3704
+ return _vItemMaps[(0, _util.getRowid)(_this32, item)];
3637
3705
  }).length === _vItems.length ? true : _selectItems.length || value === -1 ? -1 : false;
3638
3706
  }
3707
+ this.selectCheckboxMaps = selectRowMaps;
3639
3708
  return this.handleSelectRow({
3640
3709
  row: _matchObj.parent
3641
3710
  }, _parentStatus, isForce);
@@ -3645,26 +3714,32 @@ var Methods = {
3645
3714
  row: row
3646
3715
  })) {
3647
3716
  if (value) {
3648
- if (this.findRowIndexOf(selectCheckboxRows, row) === -1) {
3649
- selectCheckboxRows.push(row);
3717
+ if (!selectRowMaps[rowid]) {
3718
+ selectRowMaps[rowid] = row;
3650
3719
  }
3651
3720
  } else {
3652
- _xeUtils["default"].remove(selectCheckboxRows, function (item) {
3653
- return _this33.eqRow(item, row);
3654
- });
3721
+ if (selectRowMaps[rowid]) {
3722
+ delete selectRowMaps[rowid];
3723
+ }
3655
3724
  }
3656
3725
  this.handleCheckboxReserveRow(row, value);
3657
3726
  }
3658
3727
  }
3659
3728
  }
3729
+ this.selectCheckboxMaps = selectRowMaps;
3660
3730
  this.checkSelectionStatus();
3661
3731
  },
3662
3732
  handleToggleCheckRowEvent: function handleToggleCheckRowEvent(evnt, params) {
3663
- var selectCheckboxRows = this.selectCheckboxRows,
3733
+ var selectCheckboxMaps = this.selectCheckboxMaps,
3664
3734
  checkboxOpts = this.checkboxOpts;
3665
3735
  var checkField = checkboxOpts.checkField;
3666
3736
  var row = params.row;
3667
- 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
+ }
3668
3743
  if (evnt) {
3669
3744
  this.triggerCheckRowEvent(evnt, params, value);
3670
3745
  } else {
@@ -3709,33 +3784,42 @@ var Methods = {
3709
3784
  * 多选,切换某一行的选中状态
3710
3785
  */
3711
3786
  toggleCheckboxRow: function toggleCheckboxRow(row) {
3712
- var selectCheckboxRows = this.selectCheckboxRows,
3787
+ var selectCheckboxMaps = this.selectCheckboxMaps,
3713
3788
  checkboxOpts = this.checkboxOpts;
3714
3789
  var checkField = checkboxOpts.checkField;
3715
- 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)];
3716
3791
  this.handleSelectRow({
3717
3792
  row: row
3718
3793
  }, value, true);
3719
3794
  return this.$nextTick();
3720
3795
  },
3721
3796
  handleCheckedAllCheckboxRow: function handleCheckedAllCheckboxRow(value, isForce) {
3722
- var _this34 = this;
3797
+ var _this33 = this;
3723
3798
  var afterFullData = this.afterFullData,
3724
3799
  treeConfig = this.treeConfig,
3725
3800
  treeOpts = this.treeOpts,
3726
- selectCheckboxRows = this.selectCheckboxRows,
3801
+ selectCheckboxMaps = this.selectCheckboxMaps,
3727
3802
  checkboxReserveRowMap = this.checkboxReserveRowMap,
3728
- checkboxOpts = this.checkboxOpts;
3803
+ checkboxOpts = this.checkboxOpts,
3804
+ afterFullRowMaps = this.afterFullRowMaps;
3729
3805
  var checkField = checkboxOpts.checkField,
3730
3806
  reserve = checkboxOpts.reserve,
3731
3807
  checkStrictly = checkboxOpts.checkStrictly,
3732
3808
  checkMethod = checkboxOpts.checkMethod;
3733
3809
  var indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
3734
3810
  var childrenField = treeOpts.children || treeOpts.childrenField;
3735
- var selectRows = [];
3736
- var beforeSelection = treeConfig ? [] : selectCheckboxRows.filter(function (row) {
3737
- return _this34.findRowIndexOf(afterFullData, row) === -1;
3738
- });
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
+
3739
3823
  if (checkStrictly) {
3740
3824
  this.isAllSelected = value;
3741
3825
  } else {
@@ -3749,7 +3833,7 @@ var Methods = {
3749
3833
  row: row
3750
3834
  })) {
3751
3835
  if (value) {
3752
- selectRows.push(row);
3836
+ selectRowMaps[(0, _util.getRowid)(_this33, row)] = row;
3753
3837
  }
3754
3838
  _xeUtils["default"].set(row, checkField, value);
3755
3839
  }
@@ -3781,7 +3865,7 @@ var Methods = {
3781
3865
  if (isForce || !checkMethod || checkMethod({
3782
3866
  row: row
3783
3867
  })) {
3784
- selectRows.push(row);
3868
+ selectRowMaps[(0, _util.getRowid)(_this33, row)] = row;
3785
3869
  }
3786
3870
  }, {
3787
3871
  children: childrenField
@@ -3793,10 +3877,11 @@ var Methods = {
3793
3877
  */
3794
3878
  if (!isForce && checkMethod) {
3795
3879
  _xeUtils["default"].eachTree(afterFullData, function (row) {
3880
+ var rowid = (0, _util.getRowid)(_this33, row);
3796
3881
  if (checkMethod({
3797
3882
  row: row
3798
- }) ? 0 : _this34.findRowIndexOf(selectCheckboxRows, row) > -1) {
3799
- selectRows.push(row);
3883
+ }) ? 0 : selectCheckboxMaps[rowid]) {
3884
+ selectRowMaps[rowid] = row;
3800
3885
  }
3801
3886
  }, {
3802
3887
  children: childrenField
@@ -3811,13 +3896,18 @@ var Methods = {
3811
3896
  * 如果不存在选中方法,则添加所有数据到临时集合中
3812
3897
  */
3813
3898
  if (!isForce && checkMethod) {
3814
- selectRows = afterFullData.filter(function (row) {
3815
- 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({
3816
3902
  row: row
3817
- });
3903
+ })) {
3904
+ selectRowMaps[rowid] = row;
3905
+ }
3818
3906
  });
3819
3907
  } else {
3820
- selectRows = afterFullData.slice(0);
3908
+ afterFullData.forEach(function (row) {
3909
+ selectRowMaps[(0, _util.getRowid)(_this33, row)] = row;
3910
+ });
3821
3911
  }
3822
3912
  } else {
3823
3913
  /**
@@ -3826,10 +3916,13 @@ var Methods = {
3826
3916
  * 如果不存在选中方法,无需处理,临时集合默认为空
3827
3917
  */
3828
3918
  if (!isForce && checkMethod) {
3829
- selectRows = afterFullData.filter(function (row) {
3830
- return checkMethod({
3919
+ afterFullData.forEach(function (row) {
3920
+ var rowid = (0, _util.getRowid)(_this33, row);
3921
+ if (checkMethod({
3831
3922
  row: row
3832
- }) ? 0 : _this34.findRowIndexOf(selectCheckboxRows, row) > -1;
3923
+ }) ? 0 : selectCheckboxMaps[rowid]) {
3924
+ selectRowMaps[rowid] = row;
3925
+ }
3833
3926
  });
3834
3927
  }
3835
3928
  }
@@ -3837,18 +3930,19 @@ var Methods = {
3837
3930
  }
3838
3931
  if (reserve) {
3839
3932
  if (value) {
3840
- selectRows.forEach(function (row) {
3841
- checkboxReserveRowMap[(0, _util.getRowid)(_this34, row)] = row;
3933
+ _xeUtils["default"].each(selectRowMaps, function (row, rowid) {
3934
+ checkboxReserveRowMap[rowid] = row;
3842
3935
  });
3843
3936
  } else {
3844
3937
  afterFullData.forEach(function (row) {
3845
- return _this34.handleCheckboxReserveRow(row, false);
3938
+ return _this33.handleCheckboxReserveRow(row, false);
3846
3939
  });
3847
3940
  }
3848
3941
  }
3849
- this.selectCheckboxRows = checkField ? [] : beforeSelection.concat(selectRows);
3942
+ this.selectCheckboxMaps = checkField ? {} : selectRowMaps;
3850
3943
  }
3851
- this.treeIndeterminates = [];
3944
+ this.treeIndeterminateMaps = {};
3945
+ this.treeIndeterminateRowMaps = {};
3852
3946
  this.checkSelectionStatus();
3853
3947
  return this.$nextTick();
3854
3948
  },
@@ -3860,10 +3954,10 @@ var Methods = {
3860
3954
  return this.handleCheckedAllCheckboxRow(value, true);
3861
3955
  },
3862
3956
  checkSelectionStatus: function checkSelectionStatus() {
3863
- var _this35 = this;
3957
+ var _this34 = this;
3864
3958
  var afterFullData = this.afterFullData,
3865
- selectCheckboxRows = this.selectCheckboxRows,
3866
- treeIndeterminates = this.treeIndeterminates,
3959
+ selectCheckboxMaps = this.selectCheckboxMaps,
3960
+ treeIndeterminateMaps = this.treeIndeterminateMaps,
3867
3961
  checkboxOpts = this.checkboxOpts,
3868
3962
  treeConfig = this.treeConfig;
3869
3963
  var checkField = checkboxOpts.checkField,
@@ -3896,11 +3990,11 @@ var Methods = {
3896
3990
  if (treeConfig) {
3897
3991
  if (indeterminateField) {
3898
3992
  isIndeterminate = !isAllSelected && afterFullData.some(function (row) {
3899
- return _xeUtils["default"].get(row, checkField) || _xeUtils["default"].get(row, indeterminateField) || _this35.findRowIndexOf(treeIndeterminates, row) > -1;
3993
+ return _xeUtils["default"].get(row, checkField) || _xeUtils["default"].get(row, indeterminateField) || !!treeIndeterminateMaps[(0, _util.getRowid)(_this34, row)];
3900
3994
  });
3901
3995
  } else {
3902
3996
  isIndeterminate = !isAllSelected && afterFullData.some(function (row) {
3903
- return _xeUtils["default"].get(row, checkField) || _this35.findRowIndexOf(treeIndeterminates, row) > -1;
3997
+ return _xeUtils["default"].get(row, checkField) || !!treeIndeterminateMaps[(0, _util.getRowid)(_this34, row)];
3904
3998
  });
3905
3999
  }
3906
4000
  } else {
@@ -3922,22 +4016,23 @@ var Methods = {
3922
4016
  disableRows.push(row);
3923
4017
  return true;
3924
4018
  }
3925
- if (_this35.findRowIndexOf(selectCheckboxRows, row) > -1) {
4019
+ if (selectCheckboxMaps[(0, _util.getRowid)(_this34, row)]) {
3926
4020
  checkRows.push(row);
3927
4021
  return true;
3928
4022
  }
3929
4023
  return false;
3930
4024
  } : function (row) {
3931
- return _this35.findRowIndexOf(selectCheckboxRows, row) > -1;
4025
+ return selectCheckboxMaps[(0, _util.getRowid)(_this34, row)];
3932
4026
  });
3933
4027
  isAllSelected = isAllResolve && afterFullData.length !== disableRows.length;
3934
4028
  if (treeConfig) {
3935
4029
  isIndeterminate = !isAllSelected && afterFullData.some(function (row) {
3936
- 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];
3937
4032
  });
3938
4033
  } else {
3939
4034
  isIndeterminate = !isAllSelected && afterFullData.some(function (row) {
3940
- return _this35.findRowIndexOf(selectCheckboxRows, row) > -1;
4035
+ return selectCheckboxMaps[(0, _util.getRowid)(_this34, row)];
3941
4036
  });
3942
4037
  }
3943
4038
  }
@@ -3953,17 +4048,17 @@ var Methods = {
3953
4048
  fullDataRowIdData = this.fullDataRowIdData,
3954
4049
  fullAllDataRowMap = this.fullAllDataRowMap,
3955
4050
  currentRow = this.currentRow,
3956
- selectRow = this.selectRow,
4051
+ selectRadioRow = this.selectRadioRow,
3957
4052
  radioReserveRow = this.radioReserveRow,
3958
4053
  radioOpts = this.radioOpts,
3959
4054
  checkboxOpts = this.checkboxOpts,
3960
- selectCheckboxRows = this.selectCheckboxRows,
3961
- rowExpandeds = this.rowExpandeds,
3962
- treeExpandeds = this.treeExpandeds,
4055
+ selectCheckboxMaps = this.selectCheckboxMaps,
4056
+ rowExpandedMaps = this.rowExpandedMaps,
4057
+ treeExpandedMaps = this.treeExpandedMaps,
3963
4058
  expandOpts = this.expandOpts;
3964
4059
  // 单选框
3965
- if (selectRow && !fullAllDataRowMap.has(selectRow)) {
3966
- this.selectRow = null; // 刷新单选行状态
4060
+ if (selectRadioRow && !fullAllDataRowMap.has(selectRadioRow)) {
4061
+ this.selectRadioRow = null; // 刷新单选行状态
3967
4062
  }
3968
4063
  // 还原保留选中状态
3969
4064
  if (radioOpts.reserve && radioReserveRow) {
@@ -3973,7 +4068,7 @@ var Methods = {
3973
4068
  }
3974
4069
  }
3975
4070
  // 复选框
3976
- this.selectCheckboxRows = getRecoverRow(this, selectCheckboxRows); // 刷新多选行状态
4071
+ this.selectCheckboxMaps = getRecoverRowMaps(this, selectCheckboxMaps); // 刷新多选行状态
3977
4072
  // 还原保留选中状态
3978
4073
  if (checkboxOpts.reserve) {
3979
4074
  this.handleCheckedCheckboxRow(handleReserveRow(this, this.checkboxReserveRowMap), true, true);
@@ -3982,13 +4077,13 @@ var Methods = {
3982
4077
  this.currentRow = null; // 刷新当前行状态
3983
4078
  }
3984
4079
  // 行展开
3985
- this.rowExpandeds = expandColumn ? getRecoverRow(this, rowExpandeds) : []; // 刷新行展开状态
4080
+ this.rowExpandedMaps = expandColumn ? getRecoverRowMaps(this, rowExpandedMaps) : []; // 刷新行展开状态
3986
4081
  // 还原保留状态
3987
4082
  if (expandColumn && expandOpts.reserve) {
3988
4083
  this.setRowExpand(handleReserveRow(this, this.rowExpandedReserveRowMap), true);
3989
4084
  }
3990
4085
  // 树展开
3991
- this.treeExpandeds = treeConfig ? getRecoverRow(this, treeExpandeds) : []; // 刷新树展开状态
4086
+ this.treeExpandedMaps = treeConfig ? getRecoverRowMaps(this, treeExpandedMaps) : []; // 刷新树展开状态
3992
4087
  if (treeConfig && treeOpts.reserve) {
3993
4088
  this.setTreeExpand(handleReserveRow(this, this.treeExpandedReserveRowMap), true);
3994
4089
  }
@@ -4046,7 +4141,7 @@ var Methods = {
4046
4141
  * 获取复选框保留选中的行
4047
4142
  */
4048
4143
  getCheckboxReserveRecords: function getCheckboxReserveRecords(isFull) {
4049
- var _this36 = this;
4144
+ var _this35 = this;
4050
4145
  var fullDataRowIdData = this.fullDataRowIdData,
4051
4146
  afterFullData = this.afterFullData,
4052
4147
  checkboxReserveRowMap = this.checkboxReserveRowMap,
@@ -4059,13 +4154,13 @@ var Methods = {
4059
4154
  var afterFullIdMaps = {};
4060
4155
  if (treeConfig) {
4061
4156
  _xeUtils["default"].eachTree(afterFullData, function (row) {
4062
- afterFullIdMaps[(0, _util.getRowid)(_this36, row)] = 1;
4157
+ afterFullIdMaps[(0, _util.getRowid)(_this35, row)] = 1;
4063
4158
  }, {
4064
4159
  children: childrenField
4065
4160
  });
4066
4161
  } else {
4067
4162
  afterFullData.forEach(function (row) {
4068
- afterFullIdMaps[(0, _util.getRowid)(_this36, row)] = 1;
4163
+ afterFullIdMaps[(0, _util.getRowid)(_this35, row)] = 1;
4069
4164
  });
4070
4165
  }
4071
4166
  _xeUtils["default"].each(checkboxReserveRowMap, function (oldRow, oldRowid) {
@@ -4124,7 +4219,7 @@ var Methods = {
4124
4219
  * 清空行为不管是否被禁用还是保留记录,都将彻底清空选中状态
4125
4220
  */
4126
4221
  clearCheckboxRow: function clearCheckboxRow() {
4127
- var _this37 = this;
4222
+ var _this36 = this;
4128
4223
  var tableFullData = this.tableFullData,
4129
4224
  treeConfig = this.treeConfig,
4130
4225
  treeOpts = this.treeOpts,
@@ -4150,13 +4245,13 @@ var Methods = {
4150
4245
  }
4151
4246
  if (reserve) {
4152
4247
  tableFullData.forEach(function (row) {
4153
- return _this37.handleCheckboxReserveRow(row, false);
4248
+ return _this36.handleCheckboxReserveRow(row, false);
4154
4249
  });
4155
4250
  }
4156
4251
  this.isAllSelected = false;
4157
4252
  this.isIndeterminate = false;
4158
- this.selectCheckboxRows = [];
4159
- this.treeIndeterminates = [];
4253
+ this.selectCheckboxMaps = {};
4254
+ this.treeIndeterminateMaps = {};
4160
4255
  return this.$nextTick();
4161
4256
  },
4162
4257
  /**
@@ -4181,7 +4276,7 @@ var Methods = {
4181
4276
  * 单选,行选中事件
4182
4277
  */
4183
4278
  triggerRadioRowEvent: function triggerRadioRowEvent(evnt, params) {
4184
- var oldValue = this.selectRow,
4279
+ var oldValue = this.selectRadioRow,
4185
4280
  radioOpts = this.radioOpts;
4186
4281
  var row = params.row;
4187
4282
  var newValue = row;
@@ -4234,7 +4329,7 @@ var Methods = {
4234
4329
  return this.$nextTick();
4235
4330
  },
4236
4331
  isCheckedByRadioRow: function isCheckedByRadioRow(row) {
4237
- return this.selectRow === row;
4332
+ return this.selectRadioRow === row;
4238
4333
  },
4239
4334
  handleCheckedRadioRow: function handleCheckedRadioRow(row, isForce) {
4240
4335
  var radioOpts = this.radioOpts;
@@ -4242,7 +4337,7 @@ var Methods = {
4242
4337
  if (row && (isForce || !checkMethod || checkMethod({
4243
4338
  row: row
4244
4339
  }))) {
4245
- this.selectRow = row;
4340
+ this.selectRadioRow = row;
4246
4341
  this.handleRadioReserveRow(row);
4247
4342
  }
4248
4343
  return this.$nextTick();
@@ -4272,7 +4367,7 @@ var Methods = {
4272
4367
  * 用于单选行,手动清空用户的选择
4273
4368
  */
4274
4369
  clearRadioRow: function clearRadioRow() {
4275
- this.selectRow = null;
4370
+ this.selectRadioRow = null;
4276
4371
  return this.$nextTick();
4277
4372
  },
4278
4373
  /**
@@ -4285,33 +4380,18 @@ var Methods = {
4285
4380
  * 用于单选行,获取当已选中的数据
4286
4381
  */
4287
4382
  getRadioRecord: function getRadioRecord(isFull) {
4288
- var treeConfig = this.treeConfig,
4289
- treeOpts = this.treeOpts,
4290
- selectRow = this.selectRow,
4383
+ var selectRadioRow = this.selectRadioRow,
4291
4384
  fullDataRowIdData = this.fullDataRowIdData,
4292
- afterFullData = this.afterFullData;
4293
- var childrenField = treeOpts.children || treeOpts.childrenField;
4294
- if (selectRow) {
4295
- var rowid = (0, _util.getRowid)(this, selectRow);
4385
+ afterFullRowMaps = this.afterFullRowMaps;
4386
+ if (selectRadioRow) {
4387
+ var rowid = (0, _util.getRowid)(this, selectRadioRow);
4296
4388
  if (isFull) {
4297
4389
  if (!fullDataRowIdData[rowid]) {
4298
- return selectRow;
4390
+ return selectRadioRow;
4299
4391
  }
4300
4392
  } else {
4301
- if (treeConfig) {
4302
- var rowkey = (0, _util.getRowkey)(this);
4303
- var matchObj = _xeUtils["default"].findTree(afterFullData, function (row) {
4304
- return rowid === _xeUtils["default"].get(row, rowkey);
4305
- }, {
4306
- children: childrenField
4307
- });
4308
- if (matchObj) {
4309
- return selectRow;
4310
- }
4311
- } else {
4312
- if (afterFullData.indexOf(selectRow) > -1) {
4313
- return selectRow;
4314
- }
4393
+ if (afterFullRowMaps[rowid]) {
4394
+ return selectRadioRow;
4315
4395
  }
4316
4396
  }
4317
4397
  }
@@ -4405,12 +4485,12 @@ var Methods = {
4405
4485
  * 如果存在规则,则校验
4406
4486
  */
4407
4487
  handleChangeCell: function handleChangeCell(evnt, params) {
4408
- var _this38 = this;
4488
+ var _this37 = this;
4409
4489
  this.checkValidate('blur')["catch"](function (e) {
4410
4490
  return e;
4411
4491
  }).then(function () {
4412
- _this38.handleActived(params, evnt).then(function () {
4413
- return _this38.checkValidate('change');
4492
+ _this37.handleActived(params, evnt).then(function () {
4493
+ return _this37.checkValidate('change');
4414
4494
  })["catch"](function (e) {
4415
4495
  return e;
4416
4496
  });
@@ -4504,7 +4584,7 @@ var Methods = {
4504
4584
  * 如果是双击模式,则激活为编辑状态
4505
4585
  */
4506
4586
  triggerCellDblclickEvent: function triggerCellDblclickEvent(evnt, params) {
4507
- var _this39 = this;
4587
+ var _this38 = this;
4508
4588
  var editStore = this.editStore,
4509
4589
  editConfig = this.editConfig,
4510
4590
  editOpts = this.editOpts;
@@ -4517,15 +4597,15 @@ var Methods = {
4517
4597
  this.checkValidate('blur')["catch"](function (e) {
4518
4598
  return e;
4519
4599
  }).then(function () {
4520
- _this39.handleActived(params, evnt).then(function () {
4521
- return _this39.checkValidate('change');
4600
+ _this38.handleActived(params, evnt).then(function () {
4601
+ return _this38.checkValidate('change');
4522
4602
  })["catch"](function (e) {
4523
4603
  return e;
4524
4604
  });
4525
4605
  });
4526
4606
  } else if (editOpts.mode === 'cell') {
4527
4607
  this.handleActived(params, evnt).then(function () {
4528
- return _this39.checkValidate('change');
4608
+ return _this38.checkValidate('change');
4529
4609
  })["catch"](function (e) {
4530
4610
  return e;
4531
4611
  });
@@ -4535,7 +4615,7 @@ var Methods = {
4535
4615
  this.emitEvent('cell-dblclick', params, evnt);
4536
4616
  },
4537
4617
  handleDefaultSort: function handleDefaultSort() {
4538
- var _this40 = this;
4618
+ var _this39 = this;
4539
4619
  var sortConfig = this.sortConfig,
4540
4620
  sortOpts = this.sortOpts;
4541
4621
  var defaultSort = sortOpts.defaultSort;
@@ -4548,7 +4628,7 @@ var Methods = {
4548
4628
  var field = item.field,
4549
4629
  order = item.order;
4550
4630
  if (field && order) {
4551
- var column = _this40.getColumnByField(field);
4631
+ var column = _this39.getColumnByField(field);
4552
4632
  if (column && column.sortable) {
4553
4633
  column.order = order;
4554
4634
  column.sortTime = Date.now() + index;
@@ -4595,7 +4675,7 @@ var Methods = {
4595
4675
  }
4596
4676
  },
4597
4677
  sort: function sort(sortConfs, sortOrder) {
4598
- var _this41 = this;
4678
+ var _this40 = this;
4599
4679
  var sortOpts = this.sortOpts;
4600
4680
  var multiple = sortOpts.multiple,
4601
4681
  remote = sortOpts.remote,
@@ -4621,14 +4701,14 @@ var Methods = {
4621
4701
  order = confs.order;
4622
4702
  var column = field;
4623
4703
  if (_xeUtils["default"].isString(field)) {
4624
- column = _this41.getColumnByField(field);
4704
+ column = _this40.getColumnByField(field);
4625
4705
  }
4626
4706
  if (column && (column.sortable || column.remoteSort)) {
4627
4707
  if (!firstSortColumn) {
4628
4708
  firstSortColumn = column;
4629
4709
  }
4630
4710
  if (orders.indexOf(order) === -1) {
4631
- order = getNextSortOrder(_this41, column);
4711
+ order = getNextSortOrder(_this40, column);
4632
4712
  }
4633
4713
  if (column.order !== order) {
4634
4714
  column.order = order;
@@ -4641,8 +4721,8 @@ var Methods = {
4641
4721
  this.handleTableData(true);
4642
4722
  }
4643
4723
  return this.$nextTick().then(function () {
4644
- _this41.updateCellAreas();
4645
- return _this41.updateStyle();
4724
+ _this40.updateCellAreas();
4725
+ return _this40.updateStyle();
4646
4726
  });
4647
4727
  }
4648
4728
  return this.$nextTick();
@@ -4757,17 +4837,19 @@ var Methods = {
4757
4837
  return rest && rest.expandLoaded;
4758
4838
  },
4759
4839
  clearRowExpandLoaded: function clearRowExpandLoaded(row) {
4760
- var _this42 = this;
4761
4840
  var expandOpts = this.expandOpts,
4762
- expandLazyLoadeds = this.expandLazyLoadeds,
4841
+ rowExpandLazyLoadedMaps = this.rowExpandLazyLoadedMaps,
4763
4842
  fullAllDataRowMap = this.fullAllDataRowMap;
4764
4843
  var lazy = expandOpts.lazy;
4844
+ var rowid = (0, _util.getRowid)(this, row);
4765
4845
  var rest = fullAllDataRowMap.get(row);
4766
4846
  if (lazy && rest) {
4767
4847
  rest.expandLoaded = false;
4768
- _xeUtils["default"].remove(expandLazyLoadeds, function (item) {
4769
- return _this42.eqRow(item, row);
4770
- });
4848
+ var rowTempExpandLazyLoadedMaps = _objectSpread({}, rowExpandLazyLoadedMaps);
4849
+ if (rowTempExpandLazyLoadedMaps[rowid]) {
4850
+ delete rowTempExpandLazyLoadedMaps[rowid];
4851
+ }
4852
+ this.rowExpandLazyLoadedMaps = rowTempExpandLazyLoadedMaps;
4771
4853
  }
4772
4854
  return this.$nextTick();
4773
4855
  },
@@ -4776,13 +4858,14 @@ var Methods = {
4776
4858
  * @param {Row} row 行对象
4777
4859
  */
4778
4860
  reloadRowExpand: function reloadRowExpand(row) {
4779
- var _this43 = this;
4861
+ var _this41 = this;
4780
4862
  var expandOpts = this.expandOpts,
4781
- expandLazyLoadeds = this.expandLazyLoadeds;
4863
+ rowExpandLazyLoadedMaps = this.rowExpandLazyLoadedMaps;
4782
4864
  var lazy = expandOpts.lazy;
4783
- if (lazy && this.findRowIndexOf(expandLazyLoadeds, row) === -1) {
4865
+ var rowid = (0, _util.getRowid)(this, row);
4866
+ if (lazy && !rowExpandLazyLoadedMaps[rowid]) {
4784
4867
  this.clearRowExpandLoaded(row).then(function () {
4785
- return _this43.handleAsyncRowExpand(row);
4868
+ return _this41.handleAsyncRowExpand(row);
4786
4869
  });
4787
4870
  }
4788
4871
  return this.$nextTick();
@@ -4799,11 +4882,12 @@ var Methods = {
4799
4882
  */
4800
4883
  triggerRowExpandEvent: function triggerRowExpandEvent(evnt, params) {
4801
4884
  var expandOpts = this.expandOpts,
4802
- expandLazyLoadeds = this.expandLazyLoadeds,
4885
+ rowExpandLazyLoadedMaps = this.rowExpandLazyLoadedMaps,
4803
4886
  column = this.expandColumn;
4804
4887
  var row = params.row;
4805
4888
  var lazy = expandOpts.lazy;
4806
- if (!lazy || this.findRowIndexOf(expandLazyLoadeds, row) === -1) {
4889
+ var rowid = (0, _util.getRowid)(this, row);
4890
+ if (!lazy || !rowExpandLazyLoadedMaps[rowid]) {
4807
4891
  var expanded = !this.isExpandByRow(row);
4808
4892
  var columnIndex = this.getColumnIndex(column);
4809
4893
  var $columnIndex = this.getVMColumnIndex(column);
@@ -4868,26 +4952,43 @@ var Methods = {
4868
4952
  return this.setRowExpand(expandedRows, expanded);
4869
4953
  },
4870
4954
  handleAsyncRowExpand: function handleAsyncRowExpand(row) {
4871
- var _this44 = this;
4872
- 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);
4873
4959
  return new Promise(function (resolve) {
4874
- _this44.expandLazyLoadeds.push(row);
4875
- _this44.expandOpts.loadMethod({
4876
- $table: _this44,
4877
- row: row,
4878
- rowIndex: _this44.getRowIndex(row),
4879
- $rowIndex: _this44.getVMRowIndex(row)
4880
- }).then(function () {
4881
- rest.expandLoaded = true;
4882
- _this44.rowExpandeds.push(row);
4883
- })["catch"](function () {
4884
- rest.expandLoaded = false;
4885
- })["finally"](function () {
4886
- _xeUtils["default"].remove(_this44.expandLazyLoadeds, function (item) {
4887
- 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));
4888
4988
  });
4889
- resolve(_this44.$nextTick().then(_this44.recalculate));
4890
- });
4989
+ } else {
4990
+ resolve();
4991
+ }
4891
4992
  });
4892
4993
  },
4893
4994
  /**
@@ -4898,12 +4999,13 @@ var Methods = {
4898
4999
  * @param {Boolean} expanded 是否展开
4899
5000
  */
4900
5001
  setRowExpand: function setRowExpand(rows, expanded) {
4901
- var _this45 = this;
4902
- var fullAllDataRowMap = this.fullAllDataRowMap,
4903
- expandLazyLoadeds = this.expandLazyLoadeds,
5002
+ var _this43 = this;
5003
+ var rowExpandedMaps = this.rowExpandedMaps,
5004
+ fullAllDataRowIdData = this.fullAllDataRowIdData,
5005
+ rowExpandLazyLoadedMaps = this.rowExpandLazyLoadedMaps,
4904
5006
  expandOpts = this.expandOpts,
4905
5007
  column = this.expandColumn;
4906
- var rowExpandeds = this.rowExpandeds;
5008
+ var rExpandedMaps = _objectSpread({}, rowExpandedMaps);
4907
5009
  var reserve = expandOpts.reserve,
4908
5010
  lazy = expandOpts.lazy,
4909
5011
  accordion = expandOpts.accordion,
@@ -4917,7 +5019,7 @@ var Methods = {
4917
5019
  }
4918
5020
  if (accordion) {
4919
5021
  // 只能同时展开一个
4920
- rowExpandeds = [];
5022
+ rExpandedMaps = {};
4921
5023
  rows = rows.slice(rows.length - 1, rows.length);
4922
5024
  }
4923
5025
  var validRows = toggleMethod ? rows.filter(function (row) {
@@ -4927,34 +5029,38 @@ var Methods = {
4927
5029
  columnIndex: columnIndex,
4928
5030
  $columnIndex: $columnIndex,
4929
5031
  row: row,
4930
- rowIndex: _this45.getRowIndex(row),
4931
- $rowIndex: _this45.getVMRowIndex(row)
5032
+ rowIndex: _this43.getRowIndex(row),
5033
+ $rowIndex: _this43.getVMRowIndex(row)
4932
5034
  });
4933
5035
  }) : rows;
4934
5036
  if (expanded) {
4935
5037
  validRows.forEach(function (row) {
4936
- if (_this45.findRowIndexOf(rowExpandeds, row) === -1) {
4937
- var rest = fullAllDataRowMap.get(row);
4938
- 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];
4939
5042
  if (isLoad) {
4940
- lazyRests.push(_this45.handleAsyncRowExpand(row));
5043
+ lazyRests.push(_this43.handleAsyncRowExpand(row));
4941
5044
  } else {
4942
- rowExpandeds.push(row);
5045
+ rExpandedMaps[rowid] = row;
4943
5046
  }
4944
5047
  }
4945
5048
  });
4946
5049
  } else {
4947
- _xeUtils["default"].remove(rowExpandeds, function (row) {
4948
- 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
+ }
4949
5055
  });
4950
5056
  }
4951
5057
  if (reserve) {
4952
5058
  validRows.forEach(function (row) {
4953
- return _this45.handleRowExpandReserve(row, expanded);
5059
+ return _this43.handleRowExpandReserve(row, expanded);
4954
5060
  });
4955
5061
  }
4956
5062
  }
4957
- this.rowExpandeds = rowExpandeds;
5063
+ this.rowExpandedMaps = rExpandedMaps;
4958
5064
  return Promise.all(lazyRests).then(this.recalculate);
4959
5065
  },
4960
5066
  /**
@@ -4962,28 +5068,28 @@ var Methods = {
4962
5068
  * @param {Row} row 行对象
4963
5069
  */
4964
5070
  isExpandByRow: function isExpandByRow(row) {
4965
- var rowExpandeds = this.rowExpandeds;
4966
- return this.findRowIndexOf(rowExpandeds, row) > -1;
5071
+ var rowExpandedMaps = this.rowExpandedMaps;
5072
+ var rowid = (0, _util.getRowid)(this, row);
5073
+ return !!rowExpandedMaps[rowid];
4967
5074
  },
4968
5075
  /**
4969
5076
  * 手动清空展开行状态,数据会恢复成未展开的状态
4970
5077
  */
4971
5078
  clearRowExpand: function clearRowExpand() {
4972
- var _this46 = this;
5079
+ var _this44 = this;
4973
5080
  var expandOpts = this.expandOpts,
4974
- rowExpandeds = this.rowExpandeds,
4975
5081
  tableFullData = this.tableFullData;
4976
5082
  var reserve = expandOpts.reserve;
4977
- var isExists = rowExpandeds.length;
4978
- this.rowExpandeds = [];
5083
+ var expList = this.getRowExpandRecords();
5084
+ this.rowExpandedMaps = {};
4979
5085
  if (reserve) {
4980
5086
  tableFullData.forEach(function (row) {
4981
- return _this46.handleRowExpandReserve(row, false);
5087
+ return _this44.handleRowExpandReserve(row, false);
4982
5088
  });
4983
5089
  }
4984
5090
  return this.$nextTick().then(function () {
4985
- if (isExists) {
4986
- _this46.recalculate();
5091
+ if (expList.length) {
5092
+ _this44.recalculate();
4987
5093
  }
4988
5094
  });
4989
5095
  },
@@ -5004,13 +5110,25 @@ var Methods = {
5004
5110
  }
5005
5111
  },
5006
5112
  getRowExpandRecords: function getRowExpandRecords() {
5007
- 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;
5008
5120
  },
5009
5121
  getTreeExpandRecords: function getTreeExpandRecords() {
5010
- 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;
5011
5129
  },
5012
5130
  /**
5013
- * 获取数表格状态
5131
+ * 获取树表格状态
5014
5132
  */
5015
5133
  getTreeStatus: function getTreeStatus() {
5016
5134
  if (this.treeConfig) {
@@ -5031,16 +5149,17 @@ var Methods = {
5031
5149
  },
5032
5150
  clearTreeExpandLoaded: function clearTreeExpandLoaded(row) {
5033
5151
  var treeOpts = this.treeOpts,
5034
- treeExpandeds = this.treeExpandeds,
5152
+ treeExpandedMaps = this.treeExpandedMaps,
5035
5153
  fullAllDataRowMap = this.fullAllDataRowMap;
5036
5154
  var transform = treeOpts.transform,
5037
5155
  lazy = treeOpts.lazy;
5156
+ var rowid = (0, _util.getRowid)(this, row);
5038
5157
  var rest = fullAllDataRowMap.get(row);
5039
5158
  if (lazy && rest) {
5040
5159
  rest.treeLoaded = false;
5041
- _xeUtils["default"].remove(treeExpandeds, function (item) {
5042
- return row === item;
5043
- });
5160
+ if (treeExpandedMaps[rowid]) {
5161
+ delete treeExpandedMaps[rowid];
5162
+ }
5044
5163
  }
5045
5164
  if (transform) {
5046
5165
  this.handleVirtualTreeToList();
@@ -5053,22 +5172,23 @@ var Methods = {
5053
5172
  * @param {Row} row 行对象
5054
5173
  */
5055
5174
  reloadTreeExpand: function reloadTreeExpand(row) {
5056
- var _this47 = this;
5175
+ var _this45 = this;
5057
5176
  var treeOpts = this.treeOpts,
5058
- treeLazyLoadeds = this.treeLazyLoadeds;
5177
+ treeExpandLazyLoadedMaps = this.treeExpandLazyLoadedMaps;
5059
5178
  var transform = treeOpts.transform,
5060
5179
  lazy = treeOpts.lazy;
5061
5180
  var hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
5062
- if (lazy && row[hasChildField] && treeLazyLoadeds.indexOf(row) === -1) {
5181
+ var rowid = (0, _util.getRowid)(this, row);
5182
+ if (lazy && row[hasChildField] && !treeExpandLazyLoadedMaps[rowid]) {
5063
5183
  this.clearTreeExpandLoaded(row).then(function () {
5064
- return _this47.handleAsyncTreeExpandChilds(row);
5184
+ return _this45.handleAsyncTreeExpandChilds(row);
5065
5185
  }).then(function () {
5066
5186
  if (transform) {
5067
- _this47.handleVirtualTreeToList();
5068
- return _this47.handleTableData();
5187
+ _this45.handleVirtualTreeToList();
5188
+ return _this45.handleTableData();
5069
5189
  }
5070
5190
  }).then(function () {
5071
- return _this47.recalculate();
5191
+ return _this45.recalculate();
5072
5192
  });
5073
5193
  }
5074
5194
  return this.$nextTick();
@@ -5085,11 +5205,12 @@ var Methods = {
5085
5205
  */
5086
5206
  triggerTreeExpandEvent: function triggerTreeExpandEvent(evnt, params) {
5087
5207
  var treeOpts = this.treeOpts,
5088
- treeLazyLoadeds = this.treeLazyLoadeds;
5208
+ treeExpandLazyLoadedMaps = this.treeExpandLazyLoadedMaps;
5089
5209
  var row = params.row,
5090
5210
  column = params.column;
5091
5211
  var lazy = treeOpts.lazy;
5092
- if (!lazy || treeLazyLoadeds.indexOf(row) === -1) {
5212
+ var rowid = (0, _util.getRowid)(this, row);
5213
+ if (!lazy || !treeExpandLazyLoadedMaps[rowid]) {
5093
5214
  var expanded = !this.isTreeExpandByRow(row);
5094
5215
  var columnIndex = this.getColumnIndex(column);
5095
5216
  var $columnIndex = this.getVMColumnIndex(column);
@@ -5140,59 +5261,67 @@ var Methods = {
5140
5261
  }
5141
5262
  },
5142
5263
  handleAsyncTreeExpandChilds: function handleAsyncTreeExpandChilds(row) {
5143
- var _this48 = this;
5144
- var fullAllDataRowMap = this.fullAllDataRowMap,
5145
- treeExpandeds = this.treeExpandeds,
5146
- treeOpts = this.treeOpts,
5147
- treeLazyLoadeds = this.treeLazyLoadeds,
5264
+ var _this46 = this;
5265
+ var treeOpts = this.treeOpts,
5148
5266
  checkboxOpts = this.checkboxOpts;
5149
5267
  var transform = treeOpts.transform,
5150
5268
  loadMethod = treeOpts.loadMethod;
5151
5269
  var checkStrictly = checkboxOpts.checkStrictly;
5152
- var rest = fullAllDataRowMap.get(row);
5153
5270
  return new Promise(function (resolve) {
5154
- treeLazyLoadeds.push(row);
5155
- loadMethod({
5156
- $table: _this48,
5157
- row: row
5158
- }).then(function (childRecords) {
5159
- // 响应成功后则展开行,并将子节点挂载到该节点下
5160
- rest.treeLoaded = true;
5161
- _xeUtils["default"].remove(treeLazyLoadeds, function (item) {
5162
- return item === row;
5163
- });
5164
- if (!_xeUtils["default"].isArray(childRecords)) {
5165
- childRecords = [];
5166
- }
5167
- if (childRecords) {
5168
- return _this48.loadTreeChildren(row, childRecords).then(function (childRows) {
5169
- if (childRows.length && treeExpandeds.indexOf(row) === -1) {
5170
- treeExpandeds.push(row);
5171
- }
5172
- // 如果当前节点已选中,则展开后子节点也被选中
5173
- if (!checkStrictly && _this48.isCheckedByCheckboxRow(row)) {
5174
- _this48.handleCheckedCheckboxRow(childRows, true, true);
5175
- }
5176
- return _this48.$nextTick().then(function () {
5177
- if (transform) {
5178
- 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;
5179
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
+ });
5180
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();
5181
5320
  });
5182
- }
5183
- })["catch"](function () {
5184
- // 如果响应异常,则不展开,再次点击后将重新触发懒加载
5185
- rest.treeLoaded = false;
5186
- _xeUtils["default"].remove(treeLazyLoadeds, function (item) {
5187
- return item === row;
5188
- });
5189
- })["finally"](function () {
5190
- _this48.$nextTick().then(function () {
5191
- return _this48.recalculate();
5192
- }).then(function () {
5193
- return resolve();
5194
5321
  });
5195
- });
5322
+ } else {
5323
+ resolve();
5324
+ }
5196
5325
  });
5197
5326
  },
5198
5327
  /**
@@ -5222,17 +5351,18 @@ var Methods = {
5222
5351
  * @returns
5223
5352
  */
5224
5353
  handleBaseTreeExpand: function handleBaseTreeExpand(rows, expanded) {
5225
- var _this49 = this;
5354
+ var _this47 = this;
5226
5355
  var fullAllDataRowMap = this.fullAllDataRowMap,
5227
5356
  tableFullData = this.tableFullData,
5228
- treeExpandeds = this.treeExpandeds,
5357
+ treeExpandedMaps = this.treeExpandedMaps,
5229
5358
  treeOpts = this.treeOpts,
5230
- treeLazyLoadeds = this.treeLazyLoadeds,
5359
+ treeExpandLazyLoadedMaps = this.treeExpandLazyLoadedMaps,
5231
5360
  treeNodeColumn = this.treeNodeColumn;
5232
5361
  var reserve = treeOpts.reserve,
5233
5362
  lazy = treeOpts.lazy,
5234
5363
  accordion = treeOpts.accordion,
5235
5364
  toggleMethod = treeOpts.toggleMethod;
5365
+ var treeTempExpandedMaps = _objectSpread({}, treeExpandedMaps);
5236
5366
  var childrenField = treeOpts.children || treeOpts.childrenField;
5237
5367
  var hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
5238
5368
  var result = [];
@@ -5256,36 +5386,44 @@ var Methods = {
5256
5386
  children: childrenField
5257
5387
  });
5258
5388
  if (matchObj) {
5259
- _xeUtils["default"].remove(treeExpandeds, function (item) {
5260
- 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
+ }
5261
5394
  });
5262
5395
  }
5263
5396
  }
5264
5397
  if (expanded) {
5265
5398
  validRows.forEach(function (row) {
5266
- if (treeExpandeds.indexOf(row) === -1) {
5399
+ var rowid = (0, _util.getRowid)(_this47, row);
5400
+ if (!treeTempExpandedMaps[rowid]) {
5267
5401
  var rest = fullAllDataRowMap.get(row);
5268
- var isLoad = lazy && row[hasChildField] && !rest.treeLoaded && treeLazyLoadeds.indexOf(row) === -1;
5402
+ var isLoad = lazy && row[hasChildField] && !rest.treeLoaded && !treeExpandLazyLoadedMaps[rowid];
5269
5403
  // 是否使用懒加载
5270
5404
  if (isLoad) {
5271
- result.push(_this49.handleAsyncTreeExpandChilds(row));
5405
+ result.push(_this47.handleAsyncTreeExpandChilds(row));
5272
5406
  } else {
5273
5407
  if (row[childrenField] && row[childrenField].length) {
5274
- treeExpandeds.push(row);
5408
+ treeTempExpandedMaps[rowid] = row;
5275
5409
  }
5276
5410
  }
5277
5411
  }
5278
5412
  });
5279
5413
  } else {
5280
- _xeUtils["default"].remove(treeExpandeds, function (row) {
5281
- 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
+ }
5282
5419
  });
5283
5420
  }
5284
5421
  if (reserve) {
5285
5422
  validRows.forEach(function (row) {
5286
- return _this49.handleTreeExpandReserve(row, expanded);
5423
+ return _this47.handleTreeExpandReserve(row, expanded);
5287
5424
  });
5288
5425
  }
5426
+ this.treeExpandedMaps = treeTempExpandedMaps;
5289
5427
  return Promise.all(result).then(this.recalculate);
5290
5428
  },
5291
5429
  /**
@@ -5295,12 +5433,12 @@ var Methods = {
5295
5433
  * @returns
5296
5434
  */
5297
5435
  handleVirtualTreeExpand: function handleVirtualTreeExpand(rows, expanded) {
5298
- var _this50 = this;
5436
+ var _this48 = this;
5299
5437
  return this.handleBaseTreeExpand(rows, expanded).then(function () {
5300
- _this50.handleVirtualTreeToList();
5301
- return _this50.handleTableData();
5438
+ _this48.handleVirtualTreeToList();
5439
+ return _this48.handleTableData();
5302
5440
  }).then(function () {
5303
- return _this50.recalculate();
5441
+ return _this48.recalculate();
5304
5442
  });
5305
5443
  },
5306
5444
  /**
@@ -5333,36 +5471,36 @@ var Methods = {
5333
5471
  * @param {Row} row 行对象
5334
5472
  */
5335
5473
  isTreeExpandByRow: function isTreeExpandByRow(row) {
5336
- return this.treeExpandeds.indexOf(row) > -1;
5474
+ var treeExpandedMaps = this.treeExpandedMaps;
5475
+ return !!treeExpandedMaps[(0, _util.getRowid)(this, row)];
5337
5476
  },
5338
5477
  /**
5339
5478
  * 手动清空树形节点的展开状态,数据会恢复成未展开的状态
5340
5479
  */
5341
5480
  clearTreeExpand: function clearTreeExpand() {
5342
- var _this51 = this;
5481
+ var _this49 = this;
5343
5482
  var treeOpts = this.treeOpts,
5344
- treeExpandeds = this.treeExpandeds,
5345
5483
  tableFullData = this.tableFullData;
5346
5484
  var transform = treeOpts.transform,
5347
5485
  reserve = treeOpts.reserve;
5348
5486
  var childrenField = treeOpts.children || treeOpts.childrenField;
5349
- var isExists = treeExpandeds.length;
5350
- this.treeExpandeds = [];
5487
+ var expList = this.getTreeExpandRecords();
5488
+ this.treeExpandedMaps = {};
5351
5489
  if (reserve) {
5352
5490
  _xeUtils["default"].eachTree(tableFullData, function (row) {
5353
- return _this51.handleTreeExpandReserve(row, false);
5491
+ return _this49.handleTreeExpandReserve(row, false);
5354
5492
  }, {
5355
5493
  children: childrenField
5356
5494
  });
5357
5495
  }
5358
5496
  return this.handleTableData().then(function () {
5359
5497
  if (transform) {
5360
- _this51.handleVirtualTreeToList();
5361
- return _this51.handleTableData();
5498
+ _this49.handleVirtualTreeToList();
5499
+ return _this49.handleTableData();
5362
5500
  }
5363
5501
  }).then(function () {
5364
- if (isExists) {
5365
- _this51.recalculate();
5502
+ if (expList.length) {
5503
+ _this49.recalculate();
5366
5504
  }
5367
5505
  });
5368
5506
  },
@@ -5481,28 +5619,28 @@ var Methods = {
5481
5619
  },
5482
5620
  // 计算可视渲染相关数据
5483
5621
  computeScrollLoad: function computeScrollLoad() {
5484
- var _this52 = this;
5622
+ var _this50 = this;
5485
5623
  return this.$nextTick().then(function () {
5486
- var sYOpts = _this52.sYOpts,
5487
- sXOpts = _this52.sXOpts,
5488
- scrollXLoad = _this52.scrollXLoad,
5489
- scrollYLoad = _this52.scrollYLoad,
5490
- scrollXStore = _this52.scrollXStore,
5491
- 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;
5492
5630
  // 计算 X 逻辑
5493
5631
  if (scrollXLoad) {
5494
- var _computeVirtualX3 = computeVirtualX(_this52),
5632
+ var _computeVirtualX3 = computeVirtualX(_this50),
5495
5633
  visibleXSize = _computeVirtualX3.visibleSize;
5496
5634
  var offsetXSize = sXOpts.oSize ? _xeUtils["default"].toNumber(sXOpts.oSize) : _dom.browse.msie ? 10 : _dom.browse.edge ? 5 : 0;
5497
5635
  scrollXStore.offsetSize = offsetXSize;
5498
5636
  scrollXStore.visibleSize = visibleXSize;
5499
5637
  scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
5500
- _this52.updateScrollXData();
5638
+ _this50.updateScrollXData();
5501
5639
  } else {
5502
- _this52.updateScrollXSpace();
5640
+ _this50.updateScrollXSpace();
5503
5641
  }
5504
5642
  // 计算 Y 逻辑
5505
- var _computeVirtualY = computeVirtualY(_this52),
5643
+ var _computeVirtualY = computeVirtualY(_this50),
5506
5644
  rowHeight = _computeVirtualY.rowHeight,
5507
5645
  visibleYSize = _computeVirtualY.visibleSize;
5508
5646
  scrollYStore.rowHeight = rowHeight;
@@ -5511,12 +5649,12 @@ var Methods = {
5511
5649
  scrollYStore.offsetSize = offsetYSize;
5512
5650
  scrollYStore.visibleSize = visibleYSize;
5513
5651
  scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
5514
- _this52.updateScrollYData();
5652
+ _this50.updateScrollYData();
5515
5653
  } else {
5516
- _this52.updateScrollYSpace();
5654
+ _this50.updateScrollYSpace();
5517
5655
  }
5518
- _this52.rowHeight = rowHeight;
5519
- _this52.$nextTick(_this52.updateStyle);
5656
+ _this50.rowHeight = rowHeight;
5657
+ _this50.$nextTick(_this50.updateStyle);
5520
5658
  });
5521
5659
  },
5522
5660
  handleTableColumn: function handleTableColumn() {
@@ -5526,11 +5664,11 @@ var Methods = {
5526
5664
  this.tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0);
5527
5665
  },
5528
5666
  updateScrollXData: function updateScrollXData() {
5529
- var _this53 = this;
5667
+ var _this51 = this;
5530
5668
  // this.tableColumn = []
5531
5669
  this.$nextTick(function () {
5532
- _this53.handleTableColumn();
5533
- _this53.updateScrollXSpace();
5670
+ _this51.handleTableColumn();
5671
+ _this51.updateScrollXSpace();
5534
5672
  });
5535
5673
  },
5536
5674
  // 更新横向 X 可视渲染上下剩余空间大小
@@ -5581,11 +5719,11 @@ var Methods = {
5581
5719
  }
5582
5720
  },
5583
5721
  updateScrollYData: function updateScrollYData() {
5584
- var _this54 = this;
5722
+ var _this52 = this;
5585
5723
  // this.tableData = []
5586
5724
  this.$nextTick(function () {
5587
- _this54.handleTableData();
5588
- _this54.updateScrollYSpace();
5725
+ _this52.handleTableData();
5726
+ _this52.updateScrollYSpace();
5589
5727
  });
5590
5728
  },
5591
5729
  // 更新纵向 Y 可视渲染上下剩余空间大小
@@ -5626,7 +5764,7 @@ var Methods = {
5626
5764
  * @param {Number} scrollTop 上距离
5627
5765
  */
5628
5766
  scrollTo: function scrollTo(scrollLeft, scrollTop) {
5629
- var _this55 = this;
5767
+ var _this53 = this;
5630
5768
  var $refs = this.$refs;
5631
5769
  var tableBody = $refs.tableBody,
5632
5770
  rightBody = $refs.rightBody,
@@ -5643,7 +5781,7 @@ var Methods = {
5643
5781
  if (this.scrollXLoad || this.scrollYLoad) {
5644
5782
  return new Promise(function (resolve) {
5645
5783
  return setTimeout(function () {
5646
- return resolve(_this55.$nextTick());
5784
+ return resolve(_this53.$nextTick());
5647
5785
  }, 50);
5648
5786
  });
5649
5787
  }
@@ -5685,7 +5823,7 @@ var Methods = {
5685
5823
  * @param {Row} row 行对象
5686
5824
  */
5687
5825
  scrollToTreeRow: function scrollToTreeRow(row) {
5688
- var _this56 = this;
5826
+ var _this54 = this;
5689
5827
  var tableFullData = this.tableFullData,
5690
5828
  treeConfig = this.treeConfig,
5691
5829
  treeOpts = this.treeOpts;
@@ -5700,14 +5838,14 @@ var Methods = {
5700
5838
  if (matchObj) {
5701
5839
  var nodes = matchObj.nodes;
5702
5840
  nodes.forEach(function (row, index) {
5703
- if (index < nodes.length - 1 && !_this56.isTreeExpandByRow(row)) {
5704
- rests.push(_this56.setTreeExpand(row, true));
5841
+ if (index < nodes.length - 1 && !_this54.isTreeExpandByRow(row)) {
5842
+ rests.push(_this54.setTreeExpand(row, true));
5705
5843
  }
5706
5844
  });
5707
5845
  }
5708
5846
  }
5709
5847
  return Promise.all(rests).then(function () {
5710
- return (0, _util.rowToVisible)(_this56, row);
5848
+ return (0, _util.rowToVisible)(_this54, row);
5711
5849
  });
5712
5850
  },
5713
5851
  /**
@@ -5762,30 +5900,30 @@ var Methods = {
5762
5900
  * 如果单元格配置了校验规则,则会进行校验
5763
5901
  */
5764
5902
  updateStatus: function updateStatus(slotParams, cellValue) {
5765
- var _this57 = this;
5903
+ var _this55 = this;
5766
5904
  var customVal = !_xeUtils["default"].isUndefined(cellValue);
5767
5905
  return this.$nextTick().then(function () {
5768
- var $refs = _this57.$refs,
5769
- editRules = _this57.editRules,
5770
- validStore = _this57.validStore;
5906
+ var $refs = _this55.$refs,
5907
+ editRules = _this55.editRules,
5908
+ validStore = _this55.validStore;
5771
5909
  if (slotParams && $refs.tableBody && editRules) {
5772
5910
  var row = slotParams.row,
5773
5911
  column = slotParams.column;
5774
5912
  var type = 'change';
5775
- if (_this57.hasCellRules(type, row, column)) {
5776
- var cell = _this57.getCell(row, column);
5913
+ if (_this55.hasCellRules(type, row, column)) {
5914
+ var cell = _this55.getCell(row, column);
5777
5915
  if (cell) {
5778
- return _this57.validCellRules(type, row, column, cellValue).then(function () {
5916
+ return _this55.validCellRules(type, row, column, cellValue).then(function () {
5779
5917
  if (customVal && validStore.visible) {
5780
5918
  setCellValue(row, column, cellValue);
5781
5919
  }
5782
- _this57.clearValidate();
5920
+ _this55.clearValidate();
5783
5921
  })["catch"](function (_ref8) {
5784
5922
  var rule = _ref8.rule;
5785
5923
  if (customVal) {
5786
5924
  setCellValue(row, column, cellValue);
5787
5925
  }
5788
- _this57.showValidTooltip({
5926
+ _this55.showValidTooltip({
5789
5927
  rule: rule,
5790
5928
  row: row,
5791
5929
  column: column,
@@ -5805,13 +5943,13 @@ var Methods = {
5805
5943
  * @param {TableMergeConfig[]} merges { row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }
5806
5944
  */
5807
5945
  setMergeCells: function setMergeCells(merges) {
5808
- var _this58 = this;
5946
+ var _this56 = this;
5809
5947
  if (this.spanMethod) {
5810
5948
  (0, _log.errLog)('vxe.error.errConflicts', ['merge-cells', 'span-method']);
5811
5949
  }
5812
5950
  setMerges(this, merges, this.mergeList, this.afterFullData);
5813
5951
  return this.$nextTick().then(function () {
5814
- return _this58.updateCellAreas();
5952
+ return _this56.updateCellAreas();
5815
5953
  });
5816
5954
  },
5817
5955
  /**
@@ -5819,13 +5957,13 @@ var Methods = {
5819
5957
  * @param {TableMergeConfig[]} merges 多个或数组 [{row:Row|number, col:ColumnInfo|number}]
5820
5958
  */
5821
5959
  removeMergeCells: function removeMergeCells(merges) {
5822
- var _this59 = this;
5960
+ var _this57 = this;
5823
5961
  if (this.spanMethod) {
5824
5962
  (0, _log.errLog)('vxe.error.errConflicts', ['merge-cells', 'span-method']);
5825
5963
  }
5826
5964
  var rest = removeMerges(this, merges, this.mergeList, this.afterFullData);
5827
5965
  return this.$nextTick().then(function () {
5828
- _this59.updateCellAreas();
5966
+ _this57.updateCellAreas();
5829
5967
  return rest;
5830
5968
  });
5831
5969
  },
@@ -5846,23 +5984,23 @@ var Methods = {
5846
5984
  this.setMergeFooterItems(this.mergeFooterItems);
5847
5985
  },
5848
5986
  setMergeFooterItems: function setMergeFooterItems(merges) {
5849
- var _this60 = this;
5987
+ var _this58 = this;
5850
5988
  if (this.footerSpanMethod) {
5851
5989
  (0, _log.errLog)('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method']);
5852
5990
  }
5853
5991
  setMerges(this, merges, this.mergeFooterList, null);
5854
5992
  return this.$nextTick().then(function () {
5855
- return _this60.updateCellAreas();
5993
+ return _this58.updateCellAreas();
5856
5994
  });
5857
5995
  },
5858
5996
  removeMergeFooterItems: function removeMergeFooterItems(merges) {
5859
- var _this61 = this;
5997
+ var _this59 = this;
5860
5998
  if (this.footerSpanMethod) {
5861
5999
  (0, _log.errLog)('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method']);
5862
6000
  }
5863
6001
  var rest = removeMerges(this, merges, this.mergeFooterList, null);
5864
6002
  return this.$nextTick().then(function () {
5865
- _this61.updateCellAreas();
6003
+ _this59.updateCellAreas();
5866
6004
  return rest;
5867
6005
  });
5868
6006
  },
@@ -5979,9 +6117,9 @@ var Methods = {
5979
6117
  return cellLabel;
5980
6118
  },
5981
6119
  findRowIndexOf: function findRowIndexOf(list, row) {
5982
- var _this62 = this;
6120
+ var _this60 = this;
5983
6121
  return row ? _xeUtils["default"].findIndexOf(list, function (item) {
5984
- return _this62.eqRow(item, row);
6122
+ return _this60.eqRow(item, row);
5985
6123
  }) : -1;
5986
6124
  },
5987
6125
  eqRow: function eqRow(row1, row2) {