vxe-table 3.9.7 → 3.9.9

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.
package/lib/index.umd.js CHANGED
@@ -2220,9 +2220,9 @@ function getClass(property, params) {
2220
2220
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
2221
2221
 
2222
2222
 
2223
- const version = "3.9.7";
2223
+ const version = "3.9.9";
2224
2224
  core_.VxeUI.version = version;
2225
- core_.VxeUI.tableVersion = "3.9.7";
2225
+ core_.VxeUI.tableVersion = "3.9.9";
2226
2226
  core_.VxeUI.setConfig({
2227
2227
  emptyCell: ' ',
2228
2228
  table: {
@@ -2764,7 +2764,7 @@ function isNodeElement(elem) {
2764
2764
  const {
2765
2765
  log: log_log
2766
2766
  } = core_.VxeUI;
2767
- const log_version = `table v${"3.9.7"}`;
2767
+ const log_version = `table v${"3.9.9"}`;
2768
2768
  const warnLog = log_log.create('warn', log_version);
2769
2769
  const errLog = log_log.create('error', log_version);
2770
2770
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -3334,38 +3334,56 @@ function rowToVisible($xetable, row) {
3334
3334
  }
3335
3335
  return Promise.resolve();
3336
3336
  }
3337
- function colToVisible($xetable, column) {
3337
+ function colToVisible($xeTable, column) {
3338
+ const {
3339
+ columnStore,
3340
+ scrollXLoad,
3341
+ visibleColumn
3342
+ } = $xeTable;
3338
3343
  const {
3339
3344
  tableBody
3340
- } = $xetable.$refs;
3345
+ } = $xeTable.$refs;
3346
+ const {
3347
+ leftList,
3348
+ rightList
3349
+ } = columnStore;
3341
3350
  const bodyElem = tableBody ? tableBody.$el : null;
3351
+ let offsetFixedLeft = 0;
3352
+ leftList.forEach(item => {
3353
+ offsetFixedLeft += item.renderWidth;
3354
+ });
3355
+ let offsetFixedRight = 0;
3356
+ rightList.forEach(item => {
3357
+ offsetFixedRight += item.renderWidth;
3358
+ });
3342
3359
  if (bodyElem) {
3360
+ const bodyWidth = bodyElem.clientWidth;
3361
+ const bodySrcollLeft = bodyElem.scrollLeft;
3343
3362
  const tdElem = bodyElem.querySelector(`.${column.id}`);
3344
3363
  if (tdElem) {
3345
- const bodyWidth = bodyElem.clientWidth;
3346
- const bodySrcollLeft = bodyElem.scrollLeft;
3347
3364
  const tdOffsetLeft = tdElem.offsetLeft + (tdElem.offsetParent ? tdElem.offsetParent.offsetLeft : 0);
3348
- const tdWidth = tdElem.clientWidth;
3349
- // 检测行是否在可视区中
3350
- if (tdOffsetLeft < bodySrcollLeft || tdOffsetLeft > bodySrcollLeft + bodyWidth) {
3351
- // 向左定位
3352
- return $xetable.scrollTo(tdOffsetLeft);
3353
- } else if (tdOffsetLeft + tdWidth >= bodyWidth + bodySrcollLeft) {
3354
- // 向右定位
3355
- return $xetable.scrollTo(bodySrcollLeft + tdWidth);
3365
+ const cellWidth = tdElem.clientWidth;
3366
+ // 检测是否在可视区中
3367
+ if (tdOffsetLeft < bodySrcollLeft + offsetFixedLeft) {
3368
+ return $xeTable.scrollTo(tdOffsetLeft - offsetFixedLeft - 1);
3369
+ } else if (tdOffsetLeft + cellWidth - bodySrcollLeft > bodyWidth - offsetFixedRight) {
3370
+ return $xeTable.scrollTo(tdOffsetLeft + cellWidth - (bodyWidth - offsetFixedRight - 1));
3356
3371
  }
3357
3372
  } else {
3358
- // 如果是虚拟渲染跨行滚动
3359
- if ($xetable.scrollXLoad) {
3360
- const visibleColumn = $xetable.visibleColumn;
3373
+ // 检测是否在虚拟渲染可视区中
3374
+ if (scrollXLoad) {
3361
3375
  let scrollLeft = 0;
3376
+ const cellWidth = column.renderWidth;
3362
3377
  for (let index = 0; index < visibleColumn.length; index++) {
3363
3378
  if (visibleColumn[index] === column) {
3364
3379
  break;
3365
3380
  }
3366
3381
  scrollLeft += visibleColumn[index].renderWidth;
3367
3382
  }
3368
- return $xetable.scrollTo(scrollLeft);
3383
+ if (scrollLeft < bodySrcollLeft) {
3384
+ return $xeTable.scrollTo(scrollLeft - offsetFixedLeft - 1);
3385
+ }
3386
+ return $xeTable.scrollTo(scrollLeft + cellWidth - (bodyWidth - offsetFixedRight - 1));
3369
3387
  }
3370
3388
  }
3371
3389
  }
@@ -4802,7 +4820,7 @@ function computeVirtualY(_vm) {
4802
4820
  visibleSize: 8
4803
4821
  };
4804
4822
  }
4805
- function calculateMergerOffserIndex(list, offsetItem, type) {
4823
+ function calculateMergerOffsetIndex(list, offsetItem, type) {
4806
4824
  for (let mcIndex = 0, len = list.length; mcIndex < len; mcIndex++) {
4807
4825
  const mergeItem = list[mcIndex];
4808
4826
  const {
@@ -6279,6 +6297,7 @@ const Methods = {
6279
6297
  afterTreeFullData,
6280
6298
  afterFullData
6281
6299
  } = this;
6300
+ const childrenField = treeOpts.children || treeOpts.childrenField;
6282
6301
  if (treeConfig && treeOpts.transform) {
6283
6302
  const fullData = [];
6284
6303
  const expandMaps = {};
@@ -6290,7 +6309,7 @@ const Methods = {
6290
6309
  fullData.push(row);
6291
6310
  }
6292
6311
  }, {
6293
- children: treeOpts.mapChildrenField
6312
+ children: childrenField
6294
6313
  });
6295
6314
  this.afterFullData = fullData;
6296
6315
  this.updateScrollYStatus(fullData);
@@ -6325,6 +6344,7 @@ const Methods = {
6325
6344
  const {
6326
6345
  transform
6327
6346
  } = treeOpts;
6347
+ const childrenField = treeOpts.children || treeOpts.childrenField;
6328
6348
  let tableData = [];
6329
6349
  let tableTree = [];
6330
6350
  const filterColumns = [];
@@ -6427,8 +6447,10 @@ const Methods = {
6427
6447
  if (treeConfig && transform) {
6428
6448
  // 筛选虚拟树
6429
6449
  tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, handleFilter, {
6430
- ...treeOpts,
6431
- original: true
6450
+ original: true,
6451
+ isEvery: true,
6452
+ children: treeOpts.mapChildrenField,
6453
+ mapChildren: childrenField
6432
6454
  });
6433
6455
  tableData = tableTree;
6434
6456
  } else {
@@ -6439,8 +6461,10 @@ const Methods = {
6439
6461
  if (treeConfig && transform) {
6440
6462
  // 还原虚拟树
6441
6463
  tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, () => true, {
6442
- ...treeOpts,
6443
- original: true
6464
+ original: true,
6465
+ isEvery: true,
6466
+ children: treeOpts.mapChildrenField,
6467
+ mapChildren: childrenField
6444
6468
  });
6445
6469
  tableData = tableTree;
6446
6470
  } else {
@@ -10940,7 +10964,7 @@ const Methods = {
10940
10964
  startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
10941
10965
  endIndex: toVisibleIndex + visibleSize + offsetSize
10942
10966
  };
10943
- calculateMergerOffserIndex(mergeList.concat(mergeFooterList), offsetItem, 'col');
10967
+ calculateMergerOffsetIndex(mergeList.concat(mergeFooterList), offsetItem, 'col');
10944
10968
  const {
10945
10969
  startIndex: offsetStartIndex,
10946
10970
  endIndex: offsetEndIndex
@@ -11001,7 +11025,7 @@ const Methods = {
11001
11025
  startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
11002
11026
  endIndex: toVisibleIndex + visibleSize + offsetSize
11003
11027
  };
11004
- calculateMergerOffserIndex(mergeList, offsetItem, 'row');
11028
+ calculateMergerOffsetIndex(mergeList, offsetItem, 'row');
11005
11029
  const {
11006
11030
  startIndex: offsetStartIndex,
11007
11031
  endIndex: offsetEndIndex