vxe-table 3.9.7 → 3.9.8

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.8";
2224
2224
  core_.VxeUI.version = version;
2225
- core_.VxeUI.tableVersion = "3.9.7";
2225
+ core_.VxeUI.tableVersion = "3.9.8";
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.8"}`;
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,30 +3334,44 @@ 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
3365
  const tdWidth = tdElem.clientWidth;
3349
3366
  // 检测行是否在可视区中
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);
3367
+ if (tdOffsetLeft < bodySrcollLeft + offsetFixedLeft) {
3368
+ return $xeTable.scrollTo(tdOffsetLeft - offsetFixedLeft - 1);
3369
+ } else if (tdOffsetLeft + tdWidth >= bodyWidth + bodySrcollLeft - offsetFixedRight) {
3370
+ return $xeTable.scrollTo(tdOffsetLeft - offsetFixedLeft - 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;
3362
3376
  for (let index = 0; index < visibleColumn.length; index++) {
3363
3377
  if (visibleColumn[index] === column) {
@@ -3365,7 +3379,10 @@ function colToVisible($xetable, column) {
3365
3379
  }
3366
3380
  scrollLeft += visibleColumn[index].renderWidth;
3367
3381
  }
3368
- return $xetable.scrollTo(scrollLeft);
3382
+ if (scrollLeft < bodySrcollLeft) {
3383
+ return $xeTable.scrollTo(scrollLeft - offsetFixedLeft - 1);
3384
+ }
3385
+ return $xeTable.scrollTo(scrollLeft - offsetFixedLeft - offsetFixedRight + 1);
3369
3386
  }
3370
3387
  }
3371
3388
  }
@@ -4802,7 +4819,7 @@ function computeVirtualY(_vm) {
4802
4819
  visibleSize: 8
4803
4820
  };
4804
4821
  }
4805
- function calculateMergerOffserIndex(list, offsetItem, type) {
4822
+ function calculateMergerOffsetIndex(list, offsetItem, type) {
4806
4823
  for (let mcIndex = 0, len = list.length; mcIndex < len; mcIndex++) {
4807
4824
  const mergeItem = list[mcIndex];
4808
4825
  const {
@@ -6279,6 +6296,7 @@ const Methods = {
6279
6296
  afterTreeFullData,
6280
6297
  afterFullData
6281
6298
  } = this;
6299
+ const childrenField = treeOpts.children || treeOpts.childrenField;
6282
6300
  if (treeConfig && treeOpts.transform) {
6283
6301
  const fullData = [];
6284
6302
  const expandMaps = {};
@@ -6290,7 +6308,7 @@ const Methods = {
6290
6308
  fullData.push(row);
6291
6309
  }
6292
6310
  }, {
6293
- children: treeOpts.mapChildrenField
6311
+ children: childrenField
6294
6312
  });
6295
6313
  this.afterFullData = fullData;
6296
6314
  this.updateScrollYStatus(fullData);
@@ -6325,6 +6343,7 @@ const Methods = {
6325
6343
  const {
6326
6344
  transform
6327
6345
  } = treeOpts;
6346
+ const childrenField = treeOpts.children || treeOpts.childrenField;
6328
6347
  let tableData = [];
6329
6348
  let tableTree = [];
6330
6349
  const filterColumns = [];
@@ -6427,8 +6446,10 @@ const Methods = {
6427
6446
  if (treeConfig && transform) {
6428
6447
  // 筛选虚拟树
6429
6448
  tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, handleFilter, {
6430
- ...treeOpts,
6431
- original: true
6449
+ original: true,
6450
+ isEvery: true,
6451
+ children: treeOpts.mapChildrenField,
6452
+ mapChildren: childrenField
6432
6453
  });
6433
6454
  tableData = tableTree;
6434
6455
  } else {
@@ -6439,8 +6460,10 @@ const Methods = {
6439
6460
  if (treeConfig && transform) {
6440
6461
  // 还原虚拟树
6441
6462
  tableTree = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(tableFullTreeData, () => true, {
6442
- ...treeOpts,
6443
- original: true
6463
+ original: true,
6464
+ isEvery: true,
6465
+ children: treeOpts.mapChildrenField,
6466
+ mapChildren: childrenField
6444
6467
  });
6445
6468
  tableData = tableTree;
6446
6469
  } else {
@@ -10940,7 +10963,7 @@ const Methods = {
10940
10963
  startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
10941
10964
  endIndex: toVisibleIndex + visibleSize + offsetSize
10942
10965
  };
10943
- calculateMergerOffserIndex(mergeList.concat(mergeFooterList), offsetItem, 'col');
10966
+ calculateMergerOffsetIndex(mergeList.concat(mergeFooterList), offsetItem, 'col');
10944
10967
  const {
10945
10968
  startIndex: offsetStartIndex,
10946
10969
  endIndex: offsetEndIndex
@@ -11001,7 +11024,7 @@ const Methods = {
11001
11024
  startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
11002
11025
  endIndex: toVisibleIndex + visibleSize + offsetSize
11003
11026
  };
11004
- calculateMergerOffserIndex(mergeList, offsetItem, 'row');
11027
+ calculateMergerOffsetIndex(mergeList, offsetItem, 'row');
11005
11028
  const {
11006
11029
  startIndex: offsetStartIndex,
11007
11030
  endIndex: offsetEndIndex