vxe-table 4.10.6-beta.4 → 4.10.6-beta.5

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.
@@ -1634,6 +1634,41 @@ var _default = exports.default = (0, _vue.defineComponent)({
1634
1634
  return cellValue;
1635
1635
  };
1636
1636
  };
1637
+ const updateAfterListIndex = () => {
1638
+ const {
1639
+ afterFullData,
1640
+ fullDataRowIdData,
1641
+ fullAllDataRowIdData
1642
+ } = internalData;
1643
+ const fullMaps = {};
1644
+ afterFullData.forEach((row, index) => {
1645
+ const rowid = (0, _util.getRowid)($xeTable, row);
1646
+ const rowRest = fullAllDataRowIdData[rowid];
1647
+ const seq = index + 1;
1648
+ if (rowRest) {
1649
+ rowRest.seq = seq;
1650
+ rowRest._index = index;
1651
+ } else {
1652
+ const rest = {
1653
+ row,
1654
+ rowid,
1655
+ seq,
1656
+ index: -1,
1657
+ $index: -1,
1658
+ _index: index,
1659
+ items: [],
1660
+ parent: null,
1661
+ level: 0,
1662
+ height: 0,
1663
+ oTop: 0
1664
+ };
1665
+ fullAllDataRowIdData[rowid] = rest;
1666
+ fullDataRowIdData[rowid] = rest;
1667
+ }
1668
+ fullMaps[rowid] = row;
1669
+ });
1670
+ internalData.afterFullRowMaps = fullMaps;
1671
+ };
1637
1672
  /**
1638
1673
  * 预编译
1639
1674
  * 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
@@ -1643,72 +1678,55 @@ var _default = exports.default = (0, _vue.defineComponent)({
1643
1678
  treeConfig
1644
1679
  } = props;
1645
1680
  const {
1646
- afterFullData,
1647
1681
  fullDataRowIdData,
1648
1682
  fullAllDataRowIdData,
1649
1683
  afterTreeFullData
1650
1684
  } = internalData;
1651
1685
  const treeOpts = computeTreeOpts.value;
1686
+ const {
1687
+ transform
1688
+ } = treeOpts;
1652
1689
  const childrenField = treeOpts.children || treeOpts.childrenField;
1653
1690
  const fullMaps = {};
1654
1691
  if (treeConfig) {
1655
- _xeUtils.default.eachTree(afterTreeFullData, (row, index, items, path) => {
1656
- const rowid = (0, _util.getRowid)($xeTable, row);
1657
- const rowRest = fullAllDataRowIdData[rowid];
1658
- const seq = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
1659
- if (rowRest) {
1660
- rowRest.seq = seq;
1661
- rowRest._index = index;
1662
- } else {
1663
- const rest = {
1664
- row,
1665
- rowid,
1666
- seq,
1667
- index: -1,
1668
- $index: -1,
1669
- _index: -1,
1670
- items: [],
1671
- parent: null,
1672
- level: 0,
1673
- height: 0,
1674
- oTop: 0
1675
- };
1676
- fullAllDataRowIdData[rowid] = rest;
1677
- fullDataRowIdData[rowid] = rest;
1678
- }
1679
- fullMaps[rowid] = row;
1680
- }, {
1681
- children: treeOpts.transform ? treeOpts.mapChildrenField : childrenField
1682
- });
1692
+ if (transform) {
1693
+ updateAfterListIndex();
1694
+ } else {
1695
+ _xeUtils.default.eachTree(afterTreeFullData, (row, index, items, path) => {
1696
+ const rowid = (0, _util.getRowid)($xeTable, row);
1697
+ const rowRest = fullAllDataRowIdData[rowid];
1698
+ const seq = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
1699
+ if (rowRest) {
1700
+ rowRest.seq = seq;
1701
+ if (!transform) {
1702
+ rowRest._index = index;
1703
+ }
1704
+ } else {
1705
+ const rest = {
1706
+ row,
1707
+ rowid,
1708
+ seq,
1709
+ index: -1,
1710
+ $index: -1,
1711
+ _index: -1,
1712
+ items: [],
1713
+ parent: null,
1714
+ level: 0,
1715
+ height: 0,
1716
+ oTop: 0
1717
+ };
1718
+ fullAllDataRowIdData[rowid] = rest;
1719
+ fullDataRowIdData[rowid] = rest;
1720
+ }
1721
+ fullMaps[rowid] = row;
1722
+ }, {
1723
+ children: transform ? treeOpts.mapChildrenField : childrenField
1724
+ });
1725
+ internalData.afterFullRowMaps = fullMaps;
1726
+ }
1683
1727
  } else {
1684
- afterFullData.forEach((row, index) => {
1685
- const rowid = (0, _util.getRowid)($xeTable, row);
1686
- const rowRest = fullAllDataRowIdData[rowid];
1687
- const seq = index + 1;
1688
- if (rowRest) {
1689
- rowRest.seq = seq;
1690
- rowRest._index = index;
1691
- } else {
1692
- const rest = {
1693
- row,
1694
- rowid,
1695
- seq,
1696
- index: -1,
1697
- $index: -1,
1698
- _index: index,
1699
- items: [],
1700
- parent: null,
1701
- level: 0,
1702
- height: 0,
1703
- oTop: 0
1704
- };
1705
- fullAllDataRowIdData[rowid] = rest;
1706
- fullDataRowIdData[rowid] = rest;
1707
- }
1708
- fullMaps[rowid] = row;
1709
- });
1728
+ updateAfterListIndex();
1710
1729
  }
1711
- internalData.afterFullRowMaps = fullMaps;
1712
1730
  };
1713
1731
  /**
1714
1732
  * 如果为虚拟树,将树结构拍平