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.
@@ -500,6 +500,32 @@ function handleRowGroupVirtualExpand($xeTable, rows, expanded) {
500
500
  }, 30);
501
501
  });
502
502
  }
503
+ /**
504
+ * 处理默认展开分组行
505
+ */
506
+ function handleDefaultRowGroupExpand($xeTable) {
507
+ const reactData = $xeTable;
508
+ const internalData = $xeTable;
509
+ const { isRowGroupStatus } = reactData;
510
+ if (isRowGroupStatus) {
511
+ const { fullDataRowIdData } = internalData;
512
+ const aggregateOpts = $xeTable.computeAggregateOpts;
513
+ const { expandAll, expandRowKeys } = aggregateOpts;
514
+ if (expandAll) {
515
+ $xeTable.setAllRowGroupExpand(true);
516
+ }
517
+ else if (expandRowKeys) {
518
+ const defExpandeds = [];
519
+ expandRowKeys.forEach((rowid) => {
520
+ const rowRest = fullDataRowIdData[rowid];
521
+ if (rowRest) {
522
+ defExpandeds.push(rowRest.row);
523
+ }
524
+ });
525
+ $xeTable.setRowGroupExpand(defExpandeds, true);
526
+ }
527
+ }
528
+ }
503
529
  function updateAfterListIndex($xeTable) {
504
530
  const props = $xeTable;
505
531
  const internalData = $xeTable;
@@ -2952,6 +2978,13 @@ function loadTableData($xeTable, datas, isReset) {
2952
2978
  }
2953
2979
  reactData.isRowLoading = false;
2954
2980
  handleRecalculateStyle($xeTable, false, false, false);
2981
+ // 如果是自动行高,特殊情况需调用 recalculate 手动刷新
2982
+ if (!props.showOverflow) {
2983
+ setTimeout(() => {
2984
+ handleLazyRecalculate($xeTable, false, true, true);
2985
+ setTimeout(() => handleLazyRecalculate($xeTable, false, true, true), 3000);
2986
+ }, 2000);
2987
+ }
2955
2988
  // 是否变更虚拟滚动
2956
2989
  if (oldScrollYLoad === sYLoad) {
2957
2990
  restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
@@ -2984,6 +3017,7 @@ function handleLoadDefaults($xeTable) {
2984
3017
  handleDefaultRadioChecked($xeTable);
2985
3018
  handleDefaultRowExpand($xeTable);
2986
3019
  handleDefaultTreeExpand($xeTable);
3020
+ handleDefaultRowGroupExpand($xeTable);
2987
3021
  handleDefaultMergeCells($xeTable);
2988
3022
  handleDefaultMergeFooterItems($xeTable);
2989
3023
  $xeTable.$nextTick(() => setTimeout(() => $xeTable.recalculate()));
@@ -5217,7 +5251,7 @@ const Methods = {
5217
5251
  evnt.preventDefault();
5218
5252
  const { column } = params;
5219
5253
  const { columnStore, overflowX, scrollbarHeight } = reactData;
5220
- const { elemStore, visibleColumn } = internalData;
5254
+ const { visibleColumn } = internalData;
5221
5255
  const { leftList, rightList } = columnStore;
5222
5256
  const resizableOpts = $xeTable.computeResizableOpts;
5223
5257
  const osbHeight = overflowX ? scrollbarHeight : 0;
@@ -5235,24 +5269,29 @@ const Methods = {
5235
5269
  const { clientX: dragClientX } = evnt;
5236
5270
  const dragBtnElem = evnt.target;
5237
5271
  let resizeColumn = column;
5238
- if (column.children && column.children.length) {
5272
+ const isDragGroupCol = column.children && column.children.length;
5273
+ if (isDragGroupCol) {
5239
5274
  XEUtils.eachTree(column.children, childColumn => {
5240
5275
  resizeColumn = childColumn;
5241
5276
  });
5242
5277
  }
5243
- const cell = dragBtnElem.parentNode;
5244
- const cellParams = Object.assign(params, { cell });
5245
- let dragLeft = 0;
5246
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
5247
- if (!bodyScrollElem) {
5278
+ let cell = dragBtnElem.parentElement;
5279
+ if (isDragGroupCol) {
5280
+ const trEl = cell ? cell.parentElement : null;
5281
+ const theadEl = trEl ? trEl.parentElement : null;
5282
+ cell = theadEl ? theadEl.querySelector(`.vxe-header--column[colid="${resizeColumn.id}"]`) : null;
5283
+ }
5284
+ if (!cell) {
5248
5285
  return;
5249
5286
  }
5287
+ const cellParams = XEUtils.assign(params, { cell });
5288
+ let dragLeft = 0;
5250
5289
  const tableRect = tableEl.getBoundingClientRect();
5251
5290
  const rightContainerRect = rightContainerElem ? rightContainerElem.getBoundingClientRect() : null;
5252
5291
  const cellRect = cell.getBoundingClientRect();
5253
5292
  const dragBtnRect = dragBtnElem.getBoundingClientRect();
5254
5293
  const dragBtnWidth = dragBtnElem.clientWidth;
5255
- const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2);
5294
+ const dragBtnOffsetWidth = XEUtils.floor(dragBtnWidth / 2);
5256
5295
  const dragPosLeft = dragBtnRect.x - tableRect.x + dragBtnOffsetWidth;
5257
5296
  const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
5258
5297
  const dragMinLeft = isRightFixed ? 0 : (cellRect.x - tableRect.x + dragBtnWidth + minInterval);
@@ -8670,8 +8709,7 @@ const Methods = {
8670
8709
  },
8671
8710
  setSort(sortConfs, isUpdate) {
8672
8711
  const $xeTable = this;
8673
- // 已废弃,即将去掉事件触发 new Event('click') -> null
8674
- return handleSortEvent($xeTable, new Event('click'), sortConfs, isUpdate);
8712
+ return handleSortEvent($xeTable, null, sortConfs, isUpdate);
8675
8713
  },
8676
8714
  setSortByEvent(evnt, sortConfs, isUpdate) {
8677
8715
  const $xeTable = this;
@@ -10201,8 +10239,6 @@ const Methods = {
10201
10239
  },
10202
10240
  /**
10203
10241
  * 如果有滚动条,则滚动到对应的位置
10204
- * @param {Number} scrollLeft 左距离
10205
- * @param {Number} scrollTop 上距离
10206
10242
  */
10207
10243
  scrollTo(scrollLeft, scrollTop) {
10208
10244
  const $xeTable = this;
@@ -10217,6 +10253,12 @@ const Methods = {
10217
10253
  const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
10218
10254
  const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
10219
10255
  internalData.intoRunScroll = true;
10256
+ if (scrollLeft) {
10257
+ if (!XEUtils.isNumber(scrollLeft)) {
10258
+ scrollTop = scrollLeft.top;
10259
+ scrollLeft = scrollLeft.left;
10260
+ }
10261
+ }
10220
10262
  if (XEUtils.isNumber(scrollLeft)) {
10221
10263
  setScrollLeft(xHandleEl, scrollLeft);
10222
10264
  setScrollLeft(bodyScrollElem, scrollLeft);
package/es/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  import { getFuncText } from './src/utils';
3
- export const version = "3.17.0-beta.1";
3
+ export const version = "3.17.0-beta.2";
4
4
  VxeUI.version = version;
5
5
  VxeUI.tableVersion = version;
6
6
  VxeUI.setConfig({
package/es/ui/src/log.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { log } = VxeUI;
3
- const version = `table v${"3.17.0-beta.1"}`;
3
+ const version = `table v${"3.17.0-beta.2"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);
package/lib/index.umd.js CHANGED
@@ -2002,7 +2002,7 @@ function getClass(property, params) {
2002
2002
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
2003
2003
 
2004
2004
 
2005
- const version = "3.17.0-beta.1";
2005
+ const version = "3.17.0-beta.2";
2006
2006
  core_.VxeUI.version = version;
2007
2007
  core_.VxeUI.tableVersion = version;
2008
2008
  core_.VxeUI.setConfig({
@@ -2667,7 +2667,7 @@ function isNodeElement(elem) {
2667
2667
  const {
2668
2668
  log: log_log
2669
2669
  } = core_.VxeUI;
2670
- const log_version = `table v${"3.17.0-beta.1"}`;
2670
+ const log_version = `table v${"3.17.0-beta.2"}`;
2671
2671
  const warnLog = log_log.create('warn', log_version);
2672
2672
  const errLog = log_log.create('error', log_version);
2673
2673
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -5832,6 +5832,38 @@ function handleRowGroupVirtualExpand($xeTable, rows, expanded) {
5832
5832
  }, 30);
5833
5833
  });
5834
5834
  }
5835
+ /**
5836
+ * 处理默认展开分组行
5837
+ */
5838
+ function handleDefaultRowGroupExpand($xeTable) {
5839
+ const reactData = $xeTable;
5840
+ const internalData = $xeTable;
5841
+ const {
5842
+ isRowGroupStatus
5843
+ } = reactData;
5844
+ if (isRowGroupStatus) {
5845
+ const {
5846
+ fullDataRowIdData
5847
+ } = internalData;
5848
+ const aggregateOpts = $xeTable.computeAggregateOpts;
5849
+ const {
5850
+ expandAll,
5851
+ expandRowKeys
5852
+ } = aggregateOpts;
5853
+ if (expandAll) {
5854
+ $xeTable.setAllRowGroupExpand(true);
5855
+ } else if (expandRowKeys) {
5856
+ const defExpandeds = [];
5857
+ expandRowKeys.forEach(rowid => {
5858
+ const rowRest = fullDataRowIdData[rowid];
5859
+ if (rowRest) {
5860
+ defExpandeds.push(rowRest.row);
5861
+ }
5862
+ });
5863
+ $xeTable.setRowGroupExpand(defExpandeds, true);
5864
+ }
5865
+ }
5866
+ }
5835
5867
  function updateAfterListIndex($xeTable) {
5836
5868
  const props = $xeTable;
5837
5869
  const internalData = $xeTable;
@@ -8739,6 +8771,13 @@ function loadTableData($xeTable, datas, isReset) {
8739
8771
  }
8740
8772
  reactData.isRowLoading = false;
8741
8773
  handleRecalculateStyle($xeTable, false, false, false);
8774
+ // 如果是自动行高,特殊情况需调用 recalculate 手动刷新
8775
+ if (!props.showOverflow) {
8776
+ setTimeout(() => {
8777
+ handleLazyRecalculate($xeTable, false, true, true);
8778
+ setTimeout(() => handleLazyRecalculate($xeTable, false, true, true), 3000);
8779
+ }, 2000);
8780
+ }
8742
8781
  // 是否变更虚拟滚动
8743
8782
  if (oldScrollYLoad === sYLoad) {
8744
8783
  restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop).then(() => {
@@ -8768,6 +8807,7 @@ function handleLoadDefaults($xeTable) {
8768
8807
  handleDefaultRadioChecked($xeTable);
8769
8808
  handleDefaultRowExpand($xeTable);
8770
8809
  handleDefaultTreeExpand($xeTable);
8810
+ handleDefaultRowGroupExpand($xeTable);
8771
8811
  handleDefaultMergeCells($xeTable);
8772
8812
  handleDefaultMergeFooterItems($xeTable);
8773
8813
  $xeTable.$nextTick(() => setTimeout(() => $xeTable.recalculate()));
@@ -11343,7 +11383,6 @@ const Methods = {
11343
11383
  scrollbarHeight
11344
11384
  } = reactData;
11345
11385
  const {
11346
- elemStore,
11347
11386
  visibleColumn
11348
11387
  } = internalData;
11349
11388
  const {
@@ -11368,26 +11407,31 @@ const Methods = {
11368
11407
  } = evnt;
11369
11408
  const dragBtnElem = evnt.target;
11370
11409
  let resizeColumn = column;
11371
- if (column.children && column.children.length) {
11410
+ const isDragGroupCol = column.children && column.children.length;
11411
+ if (isDragGroupCol) {
11372
11412
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(column.children, childColumn => {
11373
11413
  resizeColumn = childColumn;
11374
11414
  });
11375
11415
  }
11376
- const cell = dragBtnElem.parentNode;
11377
- const cellParams = Object.assign(params, {
11416
+ let cell = dragBtnElem.parentElement;
11417
+ if (isDragGroupCol) {
11418
+ const trEl = cell ? cell.parentElement : null;
11419
+ const theadEl = trEl ? trEl.parentElement : null;
11420
+ cell = theadEl ? theadEl.querySelector(`.vxe-header--column[colid="${resizeColumn.id}"]`) : null;
11421
+ }
11422
+ if (!cell) {
11423
+ return;
11424
+ }
11425
+ const cellParams = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(params, {
11378
11426
  cell
11379
11427
  });
11380
11428
  let dragLeft = 0;
11381
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
11382
- if (!bodyScrollElem) {
11383
- return;
11384
- }
11385
11429
  const tableRect = tableEl.getBoundingClientRect();
11386
11430
  const rightContainerRect = rightContainerElem ? rightContainerElem.getBoundingClientRect() : null;
11387
11431
  const cellRect = cell.getBoundingClientRect();
11388
11432
  const dragBtnRect = dragBtnElem.getBoundingClientRect();
11389
11433
  const dragBtnWidth = dragBtnElem.clientWidth;
11390
- const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2);
11434
+ const dragBtnOffsetWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(dragBtnWidth / 2);
11391
11435
  const dragPosLeft = dragBtnRect.x - tableRect.x + dragBtnOffsetWidth;
11392
11436
  const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
11393
11437
  const dragMinLeft = isRightFixed ? 0 : cellRect.x - tableRect.x + dragBtnWidth + minInterval;
@@ -15349,8 +15393,7 @@ const Methods = {
15349
15393
  },
15350
15394
  setSort(sortConfs, isUpdate) {
15351
15395
  const $xeTable = this;
15352
- // 已废弃,即将去掉事件触发 new Event('click') -> null
15353
- return handleSortEvent($xeTable, new Event('click'), sortConfs, isUpdate);
15396
+ return handleSortEvent($xeTable, null, sortConfs, isUpdate);
15354
15397
  },
15355
15398
  setSortByEvent(evnt, sortConfs, isUpdate) {
15356
15399
  const $xeTable = this;
@@ -17144,8 +17187,6 @@ const Methods = {
17144
17187
  },
17145
17188
  /**
17146
17189
  * 如果有滚动条,则滚动到对应的位置
17147
- * @param {Number} scrollLeft 左距离
17148
- * @param {Number} scrollTop 上距离
17149
17190
  */
17150
17191
  scrollTo(scrollLeft, scrollTop) {
17151
17192
  const $xeTable = this;
@@ -17162,6 +17203,12 @@ const Methods = {
17162
17203
  const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
17163
17204
  const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
17164
17205
  internalData.intoRunScroll = true;
17206
+ if (scrollLeft) {
17207
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(scrollLeft)) {
17208
+ scrollTop = scrollLeft.top;
17209
+ scrollLeft = scrollLeft.left;
17210
+ }
17211
+ }
17165
17212
  if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(scrollLeft)) {
17166
17213
  setScrollLeft(xHandleEl, scrollLeft);
17167
17214
  setScrollLeft(bodyScrollElem, scrollLeft);