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

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.
@@ -607,6 +607,38 @@ function handleRowGroupVirtualExpand($xeTable, rows, expanded) {
607
607
  }, 30);
608
608
  });
609
609
  }
610
+ /**
611
+ * 处理默认展开分组行
612
+ */
613
+ function handleDefaultRowGroupExpand($xeTable) {
614
+ const reactData = $xeTable;
615
+ const internalData = $xeTable;
616
+ const {
617
+ isRowGroupStatus
618
+ } = reactData;
619
+ if (isRowGroupStatus) {
620
+ const {
621
+ fullDataRowIdData
622
+ } = internalData;
623
+ const aggregateOpts = $xeTable.computeAggregateOpts;
624
+ const {
625
+ expandAll,
626
+ expandRowKeys
627
+ } = aggregateOpts;
628
+ if (expandAll) {
629
+ $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);
639
+ }
640
+ }
641
+ }
610
642
  function updateAfterListIndex($xeTable) {
611
643
  const props = $xeTable;
612
644
  const internalData = $xeTable;
@@ -3514,6 +3546,13 @@ function loadTableData($xeTable, datas, isReset) {
3514
3546
  }
3515
3547
  reactData.isRowLoading = false;
3516
3548
  handleRecalculateStyle($xeTable, false, false, false);
3549
+ // 如果是自动行高,特殊情况需调用 recalculate 手动刷新
3550
+ if (!props.showOverflow) {
3551
+ setTimeout(() => {
3552
+ handleLazyRecalculate($xeTable, false, true, true);
3553
+ setTimeout(() => handleLazyRecalculate($xeTable, false, true, true), 3000);
3554
+ }, 2000);
3555
+ }
3517
3556
  // 是否变更虚拟滚动
3518
3557
  if (oldScrollYLoad === sYLoad) {
3519
3558
  (0, _util.restoreScrollLocation)($xeTable, targetScrollLeft, targetScrollTop).then(() => {
@@ -3543,6 +3582,7 @@ function handleLoadDefaults($xeTable) {
3543
3582
  handleDefaultRadioChecked($xeTable);
3544
3583
  handleDefaultRowExpand($xeTable);
3545
3584
  handleDefaultTreeExpand($xeTable);
3585
+ handleDefaultRowGroupExpand($xeTable);
3546
3586
  handleDefaultMergeCells($xeTable);
3547
3587
  handleDefaultMergeFooterItems($xeTable);
3548
3588
  $xeTable.$nextTick(() => setTimeout(() => $xeTable.recalculate()));
@@ -6116,7 +6156,6 @@ const Methods = {
6116
6156
  scrollbarHeight
6117
6157
  } = reactData;
6118
6158
  const {
6119
- elemStore,
6120
6159
  visibleColumn
6121
6160
  } = internalData;
6122
6161
  const {
@@ -6141,26 +6180,31 @@ const Methods = {
6141
6180
  } = evnt;
6142
6181
  const dragBtnElem = evnt.target;
6143
6182
  let resizeColumn = column;
6144
- if (column.children && column.children.length) {
6183
+ const isDragGroupCol = column.children && column.children.length;
6184
+ if (isDragGroupCol) {
6145
6185
  _xeUtils.default.eachTree(column.children, childColumn => {
6146
6186
  resizeColumn = childColumn;
6147
6187
  });
6148
6188
  }
6149
- const cell = dragBtnElem.parentNode;
6150
- const cellParams = Object.assign(params, {
6189
+ let cell = dragBtnElem.parentElement;
6190
+ if (isDragGroupCol) {
6191
+ const trEl = cell ? cell.parentElement : null;
6192
+ const theadEl = trEl ? trEl.parentElement : null;
6193
+ cell = theadEl ? theadEl.querySelector(`.vxe-header--column[colid="${resizeColumn.id}"]`) : null;
6194
+ }
6195
+ if (!cell) {
6196
+ return;
6197
+ }
6198
+ const cellParams = _xeUtils.default.assign(params, {
6151
6199
  cell
6152
6200
  });
6153
6201
  let dragLeft = 0;
6154
- const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
6155
- if (!bodyScrollElem) {
6156
- return;
6157
- }
6158
6202
  const tableRect = tableEl.getBoundingClientRect();
6159
6203
  const rightContainerRect = rightContainerElem ? rightContainerElem.getBoundingClientRect() : null;
6160
6204
  const cellRect = cell.getBoundingClientRect();
6161
6205
  const dragBtnRect = dragBtnElem.getBoundingClientRect();
6162
6206
  const dragBtnWidth = dragBtnElem.clientWidth;
6163
- const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2);
6207
+ const dragBtnOffsetWidth = _xeUtils.default.floor(dragBtnWidth / 2);
6164
6208
  const dragPosLeft = dragBtnRect.x - tableRect.x + dragBtnOffsetWidth;
6165
6209
  const minInterval = (0, _util.getColReMinWidth)(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
6166
6210
  const dragMinLeft = isRightFixed ? 0 : cellRect.x - tableRect.x + dragBtnWidth + minInterval;
@@ -10115,8 +10159,7 @@ const Methods = {
10115
10159
  },
10116
10160
  setSort(sortConfs, isUpdate) {
10117
10161
  const $xeTable = this;
10118
- // 已废弃,即将去掉事件触发 new Event('click') -> null
10119
- return handleSortEvent($xeTable, new Event('click'), sortConfs, isUpdate);
10162
+ return handleSortEvent($xeTable, null, sortConfs, isUpdate);
10120
10163
  },
10121
10164
  setSortByEvent(evnt, sortConfs, isUpdate) {
10122
10165
  const $xeTable = this;
@@ -11909,8 +11952,6 @@ const Methods = {
11909
11952
  },
11910
11953
  /**
11911
11954
  * 如果有滚动条,则滚动到对应的位置
11912
- * @param {Number} scrollLeft 左距离
11913
- * @param {Number} scrollTop 上距离
11914
11955
  */
11915
11956
  scrollTo(scrollLeft, scrollTop) {
11916
11957
  const $xeTable = this;
@@ -11927,6 +11968,12 @@ const Methods = {
11927
11968
  const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
11928
11969
  const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
11929
11970
  internalData.intoRunScroll = true;
11971
+ if (scrollLeft) {
11972
+ if (!_xeUtils.default.isNumber(scrollLeft)) {
11973
+ scrollTop = scrollLeft.top;
11974
+ scrollLeft = scrollLeft.left;
11975
+ }
11976
+ }
11930
11977
  if (_xeUtils.default.isNumber(scrollLeft)) {
11931
11978
  (0, _dom.setScrollLeft)(xHandleEl, scrollLeft);
11932
11979
  (0, _dom.setScrollLeft)(bodyScrollElem, scrollLeft);