vxe-table 3.17.0-beta.2 → 3.17.0-beta.3

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.
@@ -612,30 +612,19 @@ function handleRowGroupVirtualExpand($xeTable, rows, expanded) {
612
612
  */
613
613
  function handleDefaultRowGroupExpand($xeTable) {
614
614
  const reactData = $xeTable;
615
- const internalData = $xeTable;
616
615
  const {
617
616
  isRowGroupStatus
618
617
  } = reactData;
619
618
  if (isRowGroupStatus) {
620
- const {
621
- fullDataRowIdData
622
- } = internalData;
623
619
  const aggregateOpts = $xeTable.computeAggregateOpts;
624
620
  const {
625
621
  expandAll,
626
- expandRowKeys
622
+ expandGroupFields
627
623
  } = aggregateOpts;
628
624
  if (expandAll) {
629
625
  $xeTable.setAllRowGroupExpand(true);
630
- } else if (expandRowKeys) {
631
- const defExpandeds = [];
632
- expandRowKeys.forEach(rowid => {
633
- const rowRest = fullDataRowIdData[rowid];
634
- if (rowRest) {
635
- defExpandeds.push(rowRest.row);
636
- }
637
- });
638
- $xeTable.setRowGroupExpand(defExpandeds, true);
626
+ } else if (expandGroupFields && expandGroupFields.length) {
627
+ $xeTable.setRowGroupExpandByField(expandGroupFields, true);
639
628
  }
640
629
  }
641
630
  }
@@ -10776,6 +10765,41 @@ const Methods = {
10776
10765
  }
10777
10766
  return $xeTable.$nextTick();
10778
10767
  },
10768
+ setRowGroupExpandByField(groupFields, expanded) {
10769
+ const $xeTable = this;
10770
+ const reactData = $xeTable;
10771
+ const internalData = $xeTable;
10772
+ const {
10773
+ isRowGroupStatus
10774
+ } = reactData;
10775
+ const aggregateOpts = $xeTable.computeAggregateOpts;
10776
+ const {
10777
+ childrenField
10778
+ } = aggregateOpts;
10779
+ if (groupFields) {
10780
+ if (!_xeUtils.default.isArray(groupFields)) {
10781
+ groupFields = [groupFields];
10782
+ }
10783
+ if (isRowGroupStatus) {
10784
+ const rows = [];
10785
+ const gfKeys = {};
10786
+ groupFields.forEach(groupField => {
10787
+ gfKeys[groupField] = true;
10788
+ });
10789
+ _xeUtils.default.eachTree(internalData.afterGroupFullData, row => {
10790
+ if (row.isAggregate && gfKeys[row.groupField]) {
10791
+ rows.push(row);
10792
+ }
10793
+ }, {
10794
+ children: childrenField
10795
+ });
10796
+ if (rows.length) {
10797
+ return handleRowGroupVirtualExpand($xeTable, rows, expanded);
10798
+ }
10799
+ }
10800
+ }
10801
+ return $xeTable.$nextTick();
10802
+ },
10779
10803
  setAllRowGroupExpand(expanded) {
10780
10804
  const $xeTable = this;
10781
10805
  const reactData = $xeTable;