vxe-table 3.9.21 → 3.10.0-beta.1

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.
Files changed (91) hide show
  1. package/es/locale/lang/ja-JP.js +5 -5
  2. package/es/locale/lang/ko-KR.js +5 -5
  3. package/es/locale/lang/uk-UA.js +5 -5
  4. package/es/locale/lang/vi-VN.js +5 -5
  5. package/es/locale/lang/zh-CHT.js +5 -5
  6. package/es/locale/lang/zh-CN.js +5 -5
  7. package/es/style.css +1 -1
  8. package/es/style.min.css +1 -1
  9. package/es/table/module/edit/mixin.js +3 -3
  10. package/es/table/src/body.js +53 -115
  11. package/es/table/src/footer.js +24 -21
  12. package/es/table/src/methods.js +392 -123
  13. package/es/table/src/props.js +2 -0
  14. package/es/table/src/table.js +71 -10
  15. package/es/table/src/util.js +58 -33
  16. package/es/table/style.css +47 -7
  17. package/es/table/style.min.css +1 -1
  18. package/es/ui/index.js +2 -2
  19. package/es/ui/src/log.js +1 -1
  20. package/es/vxe-table/style.css +47 -7
  21. package/es/vxe-table/style.min.css +1 -1
  22. package/lib/index.umd.js +682 -361
  23. package/lib/index.umd.min.js +1 -1
  24. package/lib/locale/lang/ja-JP.js +5 -5
  25. package/lib/locale/lang/ja-JP.min.js +1 -1
  26. package/lib/locale/lang/ja-JP.umd.js +5 -5
  27. package/lib/locale/lang/ko-KR.js +5 -5
  28. package/lib/locale/lang/ko-KR.min.js +1 -1
  29. package/lib/locale/lang/ko-KR.umd.js +5 -5
  30. package/lib/locale/lang/uk-UA.js +5 -5
  31. package/lib/locale/lang/uk-UA.min.js +1 -1
  32. package/lib/locale/lang/uk-UA.umd.js +5 -5
  33. package/lib/locale/lang/vi-VN.js +5 -5
  34. package/lib/locale/lang/vi-VN.min.js +1 -1
  35. package/lib/locale/lang/zh-CHT.js +5 -5
  36. package/lib/locale/lang/zh-CHT.min.js +1 -1
  37. package/lib/locale/lang/zh-CHT.umd.js +5 -5
  38. package/lib/locale/lang/zh-CN.js +5 -5
  39. package/lib/locale/lang/zh-CN.min.js +1 -1
  40. package/lib/locale/lang/zh-CN.umd.js +5 -5
  41. package/lib/style.css +1 -1
  42. package/lib/style.min.css +1 -1
  43. package/lib/table/module/edit/mixin.js +6 -3
  44. package/lib/table/module/edit/mixin.min.js +1 -1
  45. package/lib/table/src/body.js +54 -118
  46. package/lib/table/src/body.min.js +1 -1
  47. package/lib/table/src/footer.js +24 -33
  48. package/lib/table/src/footer.min.js +1 -1
  49. package/lib/table/src/methods.js +449 -148
  50. package/lib/table/src/methods.min.js +1 -1
  51. package/lib/table/src/props.js +2 -0
  52. package/lib/table/src/props.min.js +1 -1
  53. package/lib/table/src/table.js +64 -13
  54. package/lib/table/src/table.min.js +1 -1
  55. package/lib/table/src/util.js +72 -38
  56. package/lib/table/src/util.min.js +1 -1
  57. package/lib/table/style/style.css +47 -7
  58. package/lib/table/style/style.min.css +1 -1
  59. package/lib/ui/index.js +2 -2
  60. package/lib/ui/index.min.js +1 -1
  61. package/lib/ui/src/log.js +1 -1
  62. package/lib/ui/src/log.min.js +1 -1
  63. package/lib/vxe-table/style/style.css +47 -7
  64. package/lib/vxe-table/style/style.min.css +1 -1
  65. package/package.json +2 -2
  66. package/packages/locale/lang/ja-JP.ts +5 -5
  67. package/packages/locale/lang/ko-KR.ts +5 -5
  68. package/packages/locale/lang/uk-UA.ts +5 -5
  69. package/packages/locale/lang/vi-VN.ts +5 -5
  70. package/packages/locale/lang/zh-CHT.ts +5 -5
  71. package/packages/locale/lang/zh-CN.ts +5 -5
  72. package/packages/table/module/edit/mixin.ts +3 -3
  73. package/packages/table/src/body.ts +53 -118
  74. package/packages/table/src/footer.ts +24 -22
  75. package/packages/table/src/methods.ts +418 -127
  76. package/packages/table/src/props.ts +10 -8
  77. package/packages/table/src/table.ts +73 -10
  78. package/packages/table/src/util.ts +61 -36
  79. package/packages/ui/index.ts +1 -1
  80. package/styles/components/table-module/filter.scss +1 -1
  81. package/styles/components/table.scss +46 -13
  82. package/styles/modules.scss +0 -2
  83. package/styles/theme/base.scss +1 -1
  84. package/styles/theme/dark.scss +7 -4
  85. package/styles/variable.scss +5 -1
  86. /package/es/{iconfont.1729992873866.ttf → iconfont.1730364042434.ttf} +0 -0
  87. /package/es/{iconfont.1729992873866.woff → iconfont.1730364042434.woff} +0 -0
  88. /package/es/{iconfont.1729992873866.woff2 → iconfont.1730364042434.woff2} +0 -0
  89. /package/lib/{iconfont.1729992873866.ttf → iconfont.1730364042434.ttf} +0 -0
  90. /package/lib/{iconfont.1729992873866.woff → iconfont.1730364042434.woff} +0 -0
  91. /package/lib/{iconfont.1729992873866.woff2 → iconfont.1730364042434.woff2} +0 -0
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.20";
2223
+ const version = "3.10.0-beta.1";
2224
2224
  core_.VxeUI.version = version;
2225
- core_.VxeUI.tableVersion = "3.9.20";
2225
+ core_.VxeUI.tableVersion = version;
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.20"}`;
2767
+ const log_version = `table v${"3.10.0-beta.1"}`;
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
@@ -3019,16 +3019,6 @@ function restoreScrollLocation(_vm, scrollLeft, scrollTop) {
3019
3019
  function toTreePathSeq(path) {
3020
3020
  return path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
3021
3021
  }
3022
- function removeScrollListener(scrollElem) {
3023
- if (scrollElem && scrollElem._onscroll) {
3024
- scrollElem.onscroll = null;
3025
- }
3026
- }
3027
- function restoreScrollListener(scrollElem) {
3028
- if (scrollElem && scrollElem._onscroll) {
3029
- scrollElem.onscroll = scrollElem._onscroll;
3030
- }
3031
- }
3032
3022
  /**
3033
3023
  * 生成行的唯一主键
3034
3024
  */
@@ -3305,30 +3295,75 @@ function isColumnInfo(column) {
3305
3295
  function createColumn($xeTable, options, renderOptions) {
3306
3296
  return isColumnInfo(options) ? options : new ColumnInfo($xeTable, options, renderOptions);
3307
3297
  }
3308
- function rowToVisible($xetable, row) {
3298
+ function rowToVisible($xeTable, row) {
3309
3299
  const {
3310
- tableBody
3311
- } = $xetable.$refs;
3300
+ reactData,
3301
+ internalData
3302
+ } = $xeTable;
3303
+ const tableProps = $xeTable;
3304
+ const {
3305
+ showOverflow
3306
+ } = tableProps;
3307
+ const tableBody = $xeTable.$refs.tableBody;
3308
+ const {
3309
+ columnStore,
3310
+ scrollYLoad
3311
+ } = reactData;
3312
+ const {
3313
+ afterFullData,
3314
+ scrollYStore,
3315
+ fullAllDataRowIdData
3316
+ } = internalData;
3317
+ const {
3318
+ leftList,
3319
+ rightList
3320
+ } = columnStore;
3312
3321
  const bodyElem = tableBody ? tableBody.$el : null;
3322
+ const rowid = getRowid($xeTable, row);
3323
+ let offsetFixedLeft = 0;
3324
+ leftList.forEach(item => {
3325
+ offsetFixedLeft += item.renderWidth;
3326
+ });
3327
+ let offsetFixedRight = 0;
3328
+ rightList.forEach(item => {
3329
+ offsetFixedRight += item.renderWidth;
3330
+ });
3313
3331
  if (bodyElem) {
3314
- const trElem = bodyElem.querySelector(`[rowid="${getRowid($xetable, row)}"]`);
3332
+ const bodyHeight = bodyElem.clientHeight;
3333
+ const bodyScrollTop = bodyElem.scrollTop;
3334
+ const trElem = bodyElem.querySelector(`[rowid="${rowid}"]`);
3315
3335
  if (trElem) {
3316
- const bodyHeight = bodyElem.clientHeight;
3317
- const bodySrcollTop = bodyElem.scrollTop;
3318
- const trOffsetTop = trElem.offsetTop + (trElem.offsetParent ? trElem.offsetParent.offsetTop : 0);
3336
+ const trOffsetParent = trElem.offsetParent;
3337
+ const trOffsetTop = trElem.offsetTop + (trOffsetParent ? trOffsetParent.offsetTop : 0);
3319
3338
  const trHeight = trElem.clientHeight;
3320
3339
  // 检测行是否在可视区中
3321
- if (trOffsetTop < bodySrcollTop || trOffsetTop > bodySrcollTop + bodyHeight) {
3322
- // 向上定位
3323
- return $xetable.scrollTo(null, trOffsetTop);
3324
- } else if (trOffsetTop + trHeight >= bodyHeight + bodySrcollTop) {
3325
- // 向下定位
3326
- return $xetable.scrollTo(null, bodySrcollTop + trHeight);
3340
+ if (trOffsetTop < bodyScrollTop || trOffsetTop > bodyScrollTop + bodyHeight) {
3341
+ return $xeTable.scrollTo(null, trOffsetTop);
3342
+ } else if (trOffsetTop + trHeight >= bodyHeight + bodyScrollTop) {
3343
+ return $xeTable.scrollTo(null, bodyScrollTop + trHeight);
3327
3344
  }
3328
3345
  } else {
3329
- // 如果是虚拟渲染跨行滚动
3330
- if ($xetable.scrollYLoad) {
3331
- return $xetable.scrollTo(null, ($xetable.afterFullData.indexOf(row) - 1) * $xetable.scrollYStore.rowHeight);
3346
+ // 如果是虚拟渲染滚动
3347
+ if (scrollYLoad) {
3348
+ if (showOverflow) {
3349
+ return $xeTable.scrollTo(null, ($xeTable.findRowIndexOf(afterFullData, row) - 1) * scrollYStore.rowHeight);
3350
+ }
3351
+ let scrollTop = 0;
3352
+ const rest = fullAllDataRowIdData[rowid];
3353
+ const rHeight = rest ? rest.height : 0;
3354
+ for (let i = 0; i < afterFullData.length; i++) {
3355
+ const currRow = afterFullData[i];
3356
+ const currRowid = getRowid($xeTable, currRow);
3357
+ if (currRow === row || currRowid === rowid) {
3358
+ break;
3359
+ }
3360
+ const rest = fullAllDataRowIdData[currRowid];
3361
+ scrollTop += rest ? rest.height : 0;
3362
+ }
3363
+ if (scrollTop < bodyScrollTop) {
3364
+ return $xeTable.scrollTo(null, scrollTop - offsetFixedLeft - 1);
3365
+ }
3366
+ return $xeTable.scrollTo(null, scrollTop + rHeight - (bodyHeight - offsetFixedRight - 1));
3332
3367
  }
3333
3368
  }
3334
3369
  }
@@ -3340,14 +3375,15 @@ function colToVisible($xeTable, column) {
3340
3375
  scrollXLoad,
3341
3376
  visibleColumn
3342
3377
  } = $xeTable;
3343
- const {
3344
- tableBody
3345
- } = $xeTable.$refs;
3378
+ const tableBody = $xeTable.$refs.tableBody;
3346
3379
  const {
3347
3380
  leftList,
3348
3381
  rightList
3349
3382
  } = columnStore;
3350
3383
  const bodyElem = tableBody ? tableBody.$el : null;
3384
+ if (column.fixed) {
3385
+ return Promise.resolve();
3386
+ }
3351
3387
  let offsetFixedLeft = 0;
3352
3388
  leftList.forEach(item => {
3353
3389
  offsetFixedLeft += item.renderWidth;
@@ -3358,15 +3394,15 @@ function colToVisible($xeTable, column) {
3358
3394
  });
3359
3395
  if (bodyElem) {
3360
3396
  const bodyWidth = bodyElem.clientWidth;
3361
- const bodySrcollLeft = bodyElem.scrollLeft;
3397
+ const bodyScrollLeft = bodyElem.scrollLeft;
3362
3398
  const tdElem = bodyElem.querySelector(`.${column.id}`);
3363
3399
  if (tdElem) {
3364
3400
  const tdOffsetLeft = tdElem.offsetLeft + (tdElem.offsetParent ? tdElem.offsetParent.offsetLeft : 0);
3365
3401
  const cellWidth = tdElem.clientWidth;
3366
3402
  // 检测是否在可视区中
3367
- if (tdOffsetLeft < bodySrcollLeft + offsetFixedLeft) {
3403
+ if (tdOffsetLeft < bodyScrollLeft + offsetFixedLeft) {
3368
3404
  return $xeTable.scrollTo(tdOffsetLeft - offsetFixedLeft - 1);
3369
- } else if (tdOffsetLeft + cellWidth - bodySrcollLeft > bodyWidth - offsetFixedRight) {
3405
+ } else if (tdOffsetLeft + cellWidth - bodyScrollLeft > bodyWidth - offsetFixedRight) {
3370
3406
  return $xeTable.scrollTo(tdOffsetLeft + cellWidth - (bodyWidth - offsetFixedRight - 1));
3371
3407
  }
3372
3408
  } else {
@@ -3374,13 +3410,13 @@ function colToVisible($xeTable, column) {
3374
3410
  if (scrollXLoad) {
3375
3411
  let scrollLeft = 0;
3376
3412
  const cellWidth = column.renderWidth;
3377
- for (let index = 0; index < visibleColumn.length; index++) {
3378
- if (visibleColumn[index] === column) {
3413
+ for (let i = 0; i < visibleColumn.length; i++) {
3414
+ if (visibleColumn[i] === column) {
3379
3415
  break;
3380
3416
  }
3381
- scrollLeft += visibleColumn[index].renderWidth;
3417
+ scrollLeft += visibleColumn[i].renderWidth;
3382
3418
  }
3383
- if (scrollLeft < bodySrcollLeft) {
3419
+ if (scrollLeft < bodyScrollLeft) {
3384
3420
  return $xeTable.scrollTo(scrollLeft - offsetFixedLeft - 1);
3385
3421
  }
3386
3422
  return $xeTable.scrollTo(scrollLeft + cellWidth - (bodyWidth - offsetFixedRight - 1));
@@ -4674,7 +4710,8 @@ const {
4674
4710
  getI18n: methods_getI18n,
4675
4711
  renderer: methods_renderer,
4676
4712
  formats: methods_formats,
4677
- interceptor: methods_interceptor
4713
+ interceptor: methods_interceptor,
4714
+ createEvent
4678
4715
  } = core_.VxeUI;
4679
4716
  const isWebkit = browse['-webkit'] && !browse.edge;
4680
4717
  const debounceScrollYDuration = browse.msie ? 80 : 20;
@@ -4743,7 +4780,7 @@ function handleReserveRow(_vm, reserveRowMap) {
4743
4780
  });
4744
4781
  return reserveList;
4745
4782
  }
4746
- function computeVirtualX(_vm) {
4783
+ function handleVirtualXVisible(_vm) {
4747
4784
  const {
4748
4785
  $refs,
4749
4786
  visibleColumn
@@ -4783,21 +4820,19 @@ function computeVirtualX(_vm) {
4783
4820
  visibleSize: 6
4784
4821
  };
4785
4822
  }
4786
- function computeVirtualY(_vm) {
4823
+ const computeRowHeight = $xeTable => {
4787
4824
  const {
4788
4825
  $refs,
4789
- computeSize,
4790
- rowHeightMaps
4791
- } = _vm;
4792
- const {
4793
- tableHeader,
4794
- tableBody
4795
- } = $refs;
4826
+ computeSize
4827
+ } = $xeTable;
4828
+ const tableHeader = $refs.tableHeader;
4829
+ const tableBody = $refs.tableBody;
4796
4830
  const tableBodyElem = tableBody ? tableBody.$el : null;
4797
4831
  const vSize = computeSize;
4832
+ const rowHeightMaps = $xeTable.rowHeightMaps;
4833
+ let rowHeight = 0;
4798
4834
  if (tableBodyElem) {
4799
4835
  const tableHeaderElem = tableHeader ? tableHeader.$el : null;
4800
- let rowHeight = 0;
4801
4836
  let firstTrElem;
4802
4837
  firstTrElem = tableBodyElem.querySelector('tr');
4803
4838
  if (!firstTrElem && tableHeaderElem) {
@@ -4809,14 +4844,55 @@ function computeVirtualY(_vm) {
4809
4844
  if (!rowHeight) {
4810
4845
  rowHeight = rowHeightMaps[vSize || 'default'];
4811
4846
  }
4812
- const visibleSize = Math.max(8, Math.ceil(tableBodyElem.clientHeight / rowHeight) + 2);
4847
+ }
4848
+ return rowHeight;
4849
+ };
4850
+ function handleVirtualYVisible($xeTable) {
4851
+ const {
4852
+ $refs,
4853
+ scrollYStore,
4854
+ afterFullData,
4855
+ fullAllDataRowIdData
4856
+ } = $xeTable;
4857
+ const tableBody = $refs.tableBody;
4858
+ const tableBodyElem = tableBody ? tableBody.$el : null;
4859
+ const {
4860
+ rowHeight
4861
+ } = scrollYStore;
4862
+ if (tableBodyElem) {
4863
+ const {
4864
+ scrollTop,
4865
+ clientHeight
4866
+ } = tableBodyElem;
4867
+ const endHeight = scrollTop + clientHeight;
4868
+ let toVisibleIndex = -1;
4869
+ let offsetTop = 0;
4870
+ let visibleSize = 0;
4871
+ for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
4872
+ const row = afterFullData[rIndex];
4873
+ const rowid = getRowid($xeTable, row);
4874
+ const rest = fullAllDataRowIdData[rowid];
4875
+ if (!rest) {
4876
+ break;
4877
+ }
4878
+ offsetTop += rest.height || rowHeight;
4879
+ if (toVisibleIndex === -1 && scrollTop < offsetTop) {
4880
+ toVisibleIndex = rIndex;
4881
+ }
4882
+ if (toVisibleIndex >= 0) {
4883
+ visibleSize++;
4884
+ if (offsetTop > endHeight) {
4885
+ break;
4886
+ }
4887
+ }
4888
+ }
4813
4889
  return {
4814
- rowHeight,
4815
- visibleSize
4890
+ toVisibleIndex: Math.max(0, toVisibleIndex),
4891
+ visibleSize: Math.max(8, visibleSize)
4816
4892
  };
4817
4893
  }
4818
4894
  return {
4819
- rowHeight: 0,
4895
+ toVisibleIndex: 0,
4820
4896
  visibleSize: 8
4821
4897
  };
4822
4898
  }
@@ -4934,7 +5010,7 @@ function clearAllSort(_vm) {
4934
5010
  column.order = null;
4935
5011
  });
4936
5012
  }
4937
- function calcHeight(_vm, key) {
5013
+ function calcTableHeight(_vm, key) {
4938
5014
  const {
4939
5015
  parentHeight
4940
5016
  } = _vm;
@@ -4955,6 +5031,29 @@ function calcHeight(_vm, key) {
4955
5031
  }
4956
5032
  return num;
4957
5033
  }
5034
+ const calcCellHeight = $xeTable => {
5035
+ const {
5036
+ tableData,
5037
+ scrollYLoad,
5038
+ fullAllDataRowIdData
5039
+ } = $xeTable;
5040
+ const el = $xeTable.$el;
5041
+ if (scrollYLoad && el) {
5042
+ tableData.forEach(row => {
5043
+ const rowid = getRowid($xeTable, row);
5044
+ const rest = fullAllDataRowIdData[rowid];
5045
+ const trList = el.querySelectorAll(`.vxe-body--row[rowid="${rowid}"]`);
5046
+ if (rest && trList.length) {
5047
+ let height = 0;
5048
+ for (let i = 0; i < trList.length; i++) {
5049
+ const trEl = trList[i];
5050
+ height = Math.max(height, trEl.offsetHeight);
5051
+ }
5052
+ rest.height = height;
5053
+ }
5054
+ });
5055
+ }
5056
+ };
4958
5057
  function getOrderField(_vm, column) {
4959
5058
  const {
4960
5059
  sortBy,
@@ -5199,9 +5298,9 @@ const Methods = {
5199
5298
  if (!(this.height || this.maxHeight)) {
5200
5299
  errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
5201
5300
  }
5202
- if (!this.showOverflow) {
5203
- warnLog('vxe.error.reqProp', ['table.show-overflow']);
5204
- }
5301
+ // if (!this.showOverflow) {
5302
+ // warnLog('vxe.error.reqProp', ['table.show-overflow'])
5303
+ // }
5205
5304
  if (this.spanMethod) {
5206
5305
  warnLog('vxe.error.scrollErrProp', ['table.span-method']);
5207
5306
  }
@@ -5442,7 +5541,8 @@ const Methods = {
5442
5541
  $index: -1,
5443
5542
  items,
5444
5543
  parent,
5445
- level
5544
+ level,
5545
+ height: 0
5446
5546
  };
5447
5547
  }
5448
5548
  if (isSource) {
@@ -5540,7 +5640,8 @@ const Methods = {
5540
5640
  $index: -1,
5541
5641
  items,
5542
5642
  parent: parentRow,
5543
- level: parentLevel + nodes.length
5643
+ level: parentLevel + nodes.length,
5644
+ height: 0
5544
5645
  };
5545
5646
  fullDataRowIdData[rowid] = rest;
5546
5647
  fullAllDataRowIdData[rowid] = rest;
@@ -5591,7 +5692,8 @@ const Methods = {
5591
5692
  colid,
5592
5693
  index,
5593
5694
  items,
5594
- parent
5695
+ parent: parent || null,
5696
+ width: 0
5595
5697
  };
5596
5698
  if (field) {
5597
5699
  if (true) {
@@ -5702,14 +5804,14 @@ const Methods = {
5702
5804
  fullAllDataRowIdData
5703
5805
  } = this;
5704
5806
  const rowid = tr.getAttribute('rowid');
5705
- const rest = fullAllDataRowIdData[rowid];
5706
- if (rest) {
5807
+ const rowRest = fullAllDataRowIdData[rowid];
5808
+ if (rowRest) {
5707
5809
  return {
5708
- rowid: rest.rowid,
5709
- item: rest.row,
5710
- index: rest.index,
5711
- items: rest.items,
5712
- parent: rest.parent
5810
+ rowid: rowRest.rowid,
5811
+ item: rowRest.row,
5812
+ index: rowRest.index,
5813
+ items: rowRest.items,
5814
+ parent: rowRest.parent
5713
5815
  };
5714
5816
  }
5715
5817
  }
@@ -5725,15 +5827,17 @@ const Methods = {
5725
5827
  fullColumnIdData
5726
5828
  } = this;
5727
5829
  const colid = cell.getAttribute('colid');
5728
- const rest = fullColumnIdData[colid];
5729
- if (rest) {
5730
- return {
5731
- colid: rest.colid,
5732
- item: rest.column,
5733
- index: rest.index,
5734
- items: rest.items,
5735
- parent: rest.parent
5736
- };
5830
+ if (colid) {
5831
+ const colRest = fullColumnIdData[colid];
5832
+ if (colRest) {
5833
+ return {
5834
+ colid: colRest.colid,
5835
+ item: colRest.column,
5836
+ index: colRest.index,
5837
+ items: colRest.items,
5838
+ parent: colRest.parent
5839
+ };
5840
+ }
5737
5841
  }
5738
5842
  }
5739
5843
  return null;
@@ -6083,13 +6187,13 @@ const Methods = {
6083
6187
  } = $xeTable;
6084
6188
  const rowid = getRowid($xeTable, row);
6085
6189
  const colid = column.id;
6086
- const rest = fullAllDataRowIdData[rowid];
6087
- if (rest) {
6088
- formatData = rest.formatData;
6190
+ const rowRest = fullAllDataRowIdData[rowid];
6191
+ if (rowRest) {
6192
+ formatData = rowRest.formatData;
6089
6193
  if (!formatData) {
6090
6194
  formatData = fullAllDataRowIdData[rowid].formatData = {};
6091
6195
  }
6092
- if (rest && formatData[colid]) {
6196
+ if (rowRest && formatData[colid]) {
6093
6197
  if (formatData[colid].value === cellValue) {
6094
6198
  return formatData[colid].label;
6095
6199
  }
@@ -6541,11 +6645,11 @@ const Methods = {
6541
6645
  if (treeConfig) {
6542
6646
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(afterTreeFullData, (row, index, items, path) => {
6543
6647
  const rowid = getRowid(this, row);
6544
- const allrest = fullAllDataRowIdData[rowid];
6648
+ const rowRest = fullAllDataRowIdData[rowid];
6545
6649
  const seq = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
6546
- if (allrest) {
6547
- allrest.seq = seq;
6548
- allrest._index = index;
6650
+ if (rowRest) {
6651
+ rowRest.seq = seq;
6652
+ rowRest._index = index;
6549
6653
  } else {
6550
6654
  const rest = {
6551
6655
  row,
@@ -6556,7 +6660,8 @@ const Methods = {
6556
6660
  _index: index,
6557
6661
  items: [],
6558
6662
  parent: null,
6559
- level: 0
6663
+ level: 0,
6664
+ height: 0
6560
6665
  };
6561
6666
  fullAllDataRowIdData[rowid] = rest;
6562
6667
  fullDataRowIdData[rowid] = rest;
@@ -6568,11 +6673,11 @@ const Methods = {
6568
6673
  } else {
6569
6674
  afterFullData.forEach((row, index) => {
6570
6675
  const rowid = getRowid(this, row);
6571
- const allrest = fullAllDataRowIdData[rowid];
6676
+ const rowRest = fullAllDataRowIdData[rowid];
6572
6677
  const seq = index + 1;
6573
- if (allrest) {
6574
- allrest.seq = seq;
6575
- allrest._index = index;
6678
+ if (rowRest) {
6679
+ rowRest.seq = seq;
6680
+ rowRest._index = index;
6576
6681
  } else {
6577
6682
  const rest = {
6578
6683
  row,
@@ -6583,7 +6688,8 @@ const Methods = {
6583
6688
  _index: index,
6584
6689
  items: [],
6585
6690
  parent: null,
6586
- level: 0
6691
+ level: 0,
6692
+ height: 0
6587
6693
  };
6588
6694
  fullAllDataRowIdData[rowid] = rest;
6589
6695
  fullDataRowIdData[rowid] = rest;
@@ -7158,7 +7264,7 @@ const Methods = {
7158
7264
  }
7159
7265
  const {
7160
7266
  visibleSize
7161
- } = computeVirtualX(this);
7267
+ } = handleVirtualXVisible(this);
7162
7268
  scrollXStore.startIndex = 0;
7163
7269
  scrollXStore.endIndex = visibleSize;
7164
7270
  scrollXStore.visibleSize = visibleSize;
@@ -7172,9 +7278,9 @@ const Methods = {
7172
7278
  this.scrollXLoad = scrollXLoad;
7173
7279
  visibleColumn.forEach((column, index) => {
7174
7280
  const colid = column.id;
7175
- const rest = fullColumnIdData[colid];
7176
- if (rest) {
7177
- rest._index = index;
7281
+ const colRest = fullColumnIdData[colid];
7282
+ if (colRest) {
7283
+ colRest._index = index;
7178
7284
  }
7179
7285
  });
7180
7286
  this.visibleColumn = visibleColumn;
@@ -7285,36 +7391,26 @@ const Methods = {
7285
7391
  * 计算单元格列宽,动态分配可用剩余空间
7286
7392
  * 支持 width=? width=?px width=?% min-width=? min-width=?px min-width=?%
7287
7393
  */
7288
- recalculate(refull) {
7289
- const {
7290
- $refs
7291
- } = this;
7292
- const {
7293
- tableBody,
7294
- tableHeader,
7295
- tableFooter
7296
- } = $refs;
7297
- const bodyElem = tableBody ? tableBody.$el : null;
7298
- const headerElem = tableHeader ? tableHeader.$el : null;
7299
- const footerElem = tableFooter ? tableFooter.$el : null;
7394
+ recalculate(reFull) {
7300
7395
  const el = this.$el;
7301
7396
  if (!el || !el.clientWidth) {
7302
7397
  return this.$nextTick();
7303
7398
  }
7304
- if (bodyElem) {
7305
- this.calcCellWidth();
7306
- this.autoCellWidth(headerElem, bodyElem, footerElem);
7307
- if (refull === true) {
7308
- // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
7309
- return this.computeScrollLoad().then(() => {
7310
- this.autoCellWidth(headerElem, bodyElem, footerElem);
7311
- return this.computeScrollLoad();
7312
- });
7313
- }
7399
+ calcCellHeight(this);
7400
+ this.calcCellWidth();
7401
+ this.autoCellWidth();
7402
+ if (reFull === true) {
7403
+ // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
7404
+ return this.computeScrollLoad().then(() => {
7405
+ calcCellHeight(this);
7406
+ this.autoCellWidth();
7407
+ return this.computeScrollLoad();
7408
+ });
7314
7409
  }
7315
7410
  return this.computeScrollLoad();
7316
7411
  },
7317
7412
  calcCellWidth() {
7413
+ const $xeTable = this;
7318
7414
  const {
7319
7415
  autoWidthColumnList,
7320
7416
  tableData
@@ -7325,9 +7421,15 @@ const Methods = {
7325
7421
  }
7326
7422
  this.isCalcColumn = true;
7327
7423
  return this.$nextTick().then(() => {
7424
+ const internalData = $xeTable;
7425
+ const {
7426
+ fullColumnIdData
7427
+ } = internalData;
7328
7428
  const el = this.$el;
7329
7429
  if (el) {
7330
7430
  autoWidthColumnList.forEach(column => {
7431
+ const colid = column.id;
7432
+ const colRest = fullColumnIdData[colid];
7331
7433
  const cellElList = el.querySelectorAll(`.vxe-header--column.${column.id}>.vxe-cell,.vxe-body--column.${column.id}>.vxe-cell,.vxe-footer--column.${column.id}>.vxe-cell`);
7332
7434
  const firstCellEl = cellElList[0];
7333
7435
  let paddingSize = 0;
@@ -7354,6 +7456,9 @@ const Methods = {
7354
7456
  colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4);
7355
7457
  }
7356
7458
  });
7459
+ if (colRest) {
7460
+ colRest.width = Math.max(colWidth, colRest.width);
7461
+ }
7357
7462
  column.renderAutoWidth = colWidth + paddingSize;
7358
7463
  });
7359
7464
  this.analyColumnWidth();
@@ -7366,12 +7471,19 @@ const Methods = {
7366
7471
  * 支持 px、%、固定 混合分配
7367
7472
  * 支持动态列表调整分配
7368
7473
  * 支持自动分配偏移量
7369
- * @param {Element} headerElem
7370
- * @param {Element} bodyElem
7371
- * @param {Element} footerElem
7372
- * @param {Number} bodyWidth
7373
7474
  */
7374
- autoCellWidth(headerElem, bodyElem, footerElem) {
7475
+ autoCellWidth() {
7476
+ const {
7477
+ $refs
7478
+ } = this;
7479
+ const {
7480
+ tableBody,
7481
+ tableHeader,
7482
+ tableFooter
7483
+ } = $refs;
7484
+ const bodyElem = tableBody ? tableBody.$el : null;
7485
+ const headerElem = tableHeader ? tableHeader.$el : null;
7486
+ const footerElem = tableFooter ? tableFooter.$el : null;
7375
7487
  let tableWidth = 0;
7376
7488
  const minCellWidth = 40; // 列宽最少限制 40px
7377
7489
  const bodyWidth = bodyElem.clientWidth - 1;
@@ -7506,12 +7618,41 @@ const Methods = {
7506
7618
  this.checkScrolling();
7507
7619
  }
7508
7620
  },
7621
+ calcCellHeight() {
7622
+ const $xeTable = this;
7623
+ const reactData = $xeTable;
7624
+ const internalData = $xeTable;
7625
+ const {
7626
+ tableData,
7627
+ scrollYLoad
7628
+ } = reactData;
7629
+ const {
7630
+ fullAllDataRowIdData
7631
+ } = internalData;
7632
+ const el = $xeTable.$el;
7633
+ if (scrollYLoad && el) {
7634
+ tableData.forEach(row => {
7635
+ const rowid = getRowid($xeTable, row);
7636
+ const rowRest = fullAllDataRowIdData[rowid];
7637
+ const trList = el.querySelectorAll(`.vxe-body--row[rowid="${rowid}"]`);
7638
+ if (rowRest && trList.length) {
7639
+ let height = 0;
7640
+ for (let i = 0; i < trList.length; i++) {
7641
+ const trEl = trList[i];
7642
+ height = Math.max(height, trEl.offsetHeight);
7643
+ }
7644
+ rowRest.height = height;
7645
+ }
7646
+ });
7647
+ }
7648
+ },
7509
7649
  updateHeight() {
7510
- this.customHeight = calcHeight(this, 'height');
7511
- this.customMinHeight = calcHeight(this, 'minHeight');
7512
- this.customMaxHeight = calcHeight(this, 'maxHeight');
7650
+ this.customHeight = calcTableHeight(this, 'height');
7651
+ this.customMinHeight = calcTableHeight(this, 'minHeight');
7652
+ this.customMaxHeight = calcTableHeight(this, 'maxHeight');
7513
7653
  },
7514
7654
  updateStyle() {
7655
+ const $xeTable = this;
7515
7656
  let {
7516
7657
  $refs,
7517
7658
  isGroup,
@@ -7533,6 +7674,7 @@ const Methods = {
7533
7674
  scrollbarWidth,
7534
7675
  scrollXLoad,
7535
7676
  scrollYLoad,
7677
+ overflowX,
7536
7678
  cellOffsetWidth,
7537
7679
  columnStore,
7538
7680
  elemStore,
@@ -7547,7 +7689,7 @@ const Methods = {
7547
7689
  footerSpanMethod,
7548
7690
  isAllOverflow,
7549
7691
  visibleColumn
7550
- } = this;
7692
+ } = $xeTable;
7551
7693
  const containerList = ['main', 'left', 'right'];
7552
7694
  const emptyPlaceholderElem = $refs.emptyPlaceholder;
7553
7695
  const bodyWrapperElem = elemStore['main-body-wrapper'];
@@ -7560,6 +7702,30 @@ const Methods = {
7560
7702
  customHeight += scrollbarHeight;
7561
7703
  }
7562
7704
  }
7705
+ const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem;
7706
+ if (scrollXVirtualEl) {
7707
+ scrollXVirtualEl.style.height = `${scrollbarHeight}px`;
7708
+ }
7709
+ const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem;
7710
+ if (scrollYVirtualEl) {
7711
+ let bodyHeight = 0;
7712
+ let bodyMaxHeight = 0;
7713
+ const bodyMinHeight = customMinHeight - headerHeight - footerHeight;
7714
+ if (customMaxHeight) {
7715
+ bodyMaxHeight = customMaxHeight - headerHeight - footerHeight;
7716
+ bodyMaxHeight = Math.max(bodyMinHeight, bodyMaxHeight);
7717
+ }
7718
+ if (customHeight) {
7719
+ bodyHeight = customHeight - headerHeight - footerHeight;
7720
+ if (bodyMaxHeight) {
7721
+ bodyHeight = Math.min(bodyMaxHeight, bodyHeight);
7722
+ }
7723
+ bodyHeight = Math.max(bodyMinHeight, bodyHeight);
7724
+ }
7725
+ scrollYVirtualEl.style.top = `${headerHeight}px`;
7726
+ scrollYVirtualEl.style.width = `${scrollbarWidth}px`;
7727
+ scrollYVirtualEl.style.height = `${bodyHeight + (overflowX ? -Math.max(1, scrollbarHeight) : 0)}px`;
7728
+ }
7563
7729
  containerList.forEach((name, index) => {
7564
7730
  const fixedType = index > 0 ? name : '';
7565
7731
  const layoutList = ['header', 'body', 'footer'];
@@ -7724,7 +7890,8 @@ const Methods = {
7724
7890
  colElem.style.width = `${scrollbarWidth}px`;
7725
7891
  }
7726
7892
  if (fullColumnIdData[colid]) {
7727
- const column = fullColumnIdData[colid].column;
7893
+ const colRest = fullColumnIdData[colid];
7894
+ const column = colRest.column;
7728
7895
  const {
7729
7896
  showHeaderOverflow,
7730
7897
  showFooterOverflow,
@@ -7790,22 +7957,25 @@ const Methods = {
7790
7957
  * 处理固定列的显示状态
7791
7958
  */
7792
7959
  checkScrolling() {
7960
+ const $xeTable = this;
7793
7961
  const {
7794
7962
  tableBody,
7795
7963
  leftContainer,
7796
7964
  rightContainer
7797
- } = this.$refs;
7965
+ } = $xeTable.$refs;
7798
7966
  const bodyElem = tableBody ? tableBody.$el : null;
7799
- if (bodyElem) {
7967
+ const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
7968
+ const bodtTargetEl = xHandleEl || bodyElem;
7969
+ if (bodtTargetEl) {
7800
7970
  if (leftContainer) {
7801
- if (bodyElem.scrollLeft > 0) {
7971
+ if (bodtTargetEl.scrollLeft > 0) {
7802
7972
  addClass(leftContainer, 'scrolling--middle');
7803
7973
  } else {
7804
7974
  removeClass(leftContainer, 'scrolling--middle');
7805
7975
  }
7806
7976
  }
7807
7977
  if (rightContainer) {
7808
- if (bodyElem.clientWidth < bodyElem.scrollWidth - Math.ceil(bodyElem.scrollLeft)) {
7978
+ if (bodtTargetEl.clientWidth < bodtTargetEl.scrollWidth - Math.ceil(bodtTargetEl.scrollLeft)) {
7809
7979
  addClass(rightContainer, 'scrolling--middle');
7810
7980
  } else {
7811
7981
  removeClass(rightContainer, 'scrolling--middle');
@@ -10214,8 +10384,8 @@ const Methods = {
10214
10384
  const {
10215
10385
  fullAllDataRowIdData
10216
10386
  } = this;
10217
- const rest = fullAllDataRowIdData[getRowid($xeTable, row)];
10218
- return rest && !!rest.expandLoaded;
10387
+ const rowRest = fullAllDataRowIdData[getRowid($xeTable, row)];
10388
+ return rowRest && !!rowRest.expandLoaded;
10219
10389
  },
10220
10390
  clearRowExpandLoaded(row) {
10221
10391
  const $xeTable = this;
@@ -10228,9 +10398,9 @@ const Methods = {
10228
10398
  lazy
10229
10399
  } = expandOpts;
10230
10400
  const rowid = getRowid($xeTable, row);
10231
- const rest = fullAllDataRowIdData[rowid];
10232
- if (lazy && rest) {
10233
- rest.expandLoaded = false;
10401
+ const rowRest = fullAllDataRowIdData[rowid];
10402
+ if (lazy && rowRest) {
10403
+ rowRest.expandLoaded = false;
10234
10404
  const rowTempExpandLazyLoadedMaps = {
10235
10405
  ...rowExpandLazyLoadedMaps
10236
10406
  };
@@ -10372,7 +10542,7 @@ const Methods = {
10372
10542
  fullAllDataRowIdData
10373
10543
  } = this;
10374
10544
  const rowid = getRowid($xeTable, row);
10375
- const rest = fullAllDataRowIdData[rowid];
10545
+ const rowRest = fullAllDataRowIdData[rowid];
10376
10546
  rowExpandLazyLoadedMaps[rowid] = row;
10377
10547
  loadMethod({
10378
10548
  $table: $xeTable,
@@ -10383,10 +10553,10 @@ const Methods = {
10383
10553
  const {
10384
10554
  rowExpandedMaps
10385
10555
  } = this;
10386
- rest.expandLoaded = true;
10556
+ rowRest.expandLoaded = true;
10387
10557
  rowExpandedMaps[rowid] = row;
10388
10558
  }).catch(() => {
10389
- rest.expandLoaded = false;
10559
+ rowRest.expandLoaded = false;
10390
10560
  }).finally(() => {
10391
10561
  const {
10392
10562
  rowExpandLazyLoadedMaps
@@ -10450,8 +10620,8 @@ const Methods = {
10450
10620
  validRows.forEach(row => {
10451
10621
  const rowid = getRowid(this, row);
10452
10622
  if (!rExpandedMaps[rowid]) {
10453
- const rest = fullAllDataRowIdData[rowid];
10454
- const isLoad = lazy && !rest.expandLoaded && !rowExpandLazyLoadedMaps[rowid];
10623
+ const rowRest = fullAllDataRowIdData[rowid];
10624
+ const isLoad = lazy && !rowRest.expandLoaded && !rowExpandLazyLoadedMaps[rowid];
10455
10625
  if (isLoad) {
10456
10626
  lazyRests.push(this.handleAsyncRowExpand(row));
10457
10627
  } else {
@@ -10571,8 +10741,8 @@ const Methods = {
10571
10741
  const {
10572
10742
  fullAllDataRowIdData
10573
10743
  } = this;
10574
- const rest = fullAllDataRowIdData[getRowid($xeTable, row)];
10575
- return rest && !!rest.treeLoaded;
10744
+ const rowRest = fullAllDataRowIdData[getRowid($xeTable, row)];
10745
+ return rowRest && !!rowRest.treeLoaded;
10576
10746
  },
10577
10747
  clearTreeExpandLoaded(row) {
10578
10748
  const $xeTable = this;
@@ -10586,9 +10756,9 @@ const Methods = {
10586
10756
  lazy
10587
10757
  } = treeOpts;
10588
10758
  const rowid = getRowid($xeTable, row);
10589
- const rest = fullAllDataRowIdData[rowid];
10590
- if (lazy && rest) {
10591
- rest.treeLoaded = false;
10759
+ const rowRest = fullAllDataRowIdData[rowid];
10760
+ if (lazy && rowRest) {
10761
+ rowRest.treeLoaded = false;
10592
10762
  if (treeExpandedMaps[rowid]) {
10593
10763
  delete treeExpandedMaps[rowid];
10594
10764
  }
@@ -10728,13 +10898,13 @@ const Methods = {
10728
10898
  fullAllDataRowIdData
10729
10899
  } = this;
10730
10900
  const rowid = getRowid($xeTable, row);
10731
- const rest = fullAllDataRowIdData[rowid];
10901
+ const rowRest = fullAllDataRowIdData[rowid];
10732
10902
  treeExpandLazyLoadedMaps[rowid] = row;
10733
10903
  Promise.resolve(loadMethod({
10734
10904
  $table: $xeTable,
10735
10905
  row
10736
10906
  })).then(childRecords => {
10737
- rest.treeLoaded = true;
10907
+ rowRest.treeLoaded = true;
10738
10908
  if (treeExpandLazyLoadedMaps[rowid]) {
10739
10909
  delete treeExpandLazyLoadedMaps[rowid];
10740
10910
  }
@@ -10764,7 +10934,7 @@ const Methods = {
10764
10934
  const {
10765
10935
  treeExpandLazyLoadedMaps
10766
10936
  } = this;
10767
- rest.treeLoaded = false;
10937
+ rowRest.treeLoaded = false;
10768
10938
  if (treeExpandLazyLoadedMaps[rowid]) {
10769
10939
  delete treeExpandLazyLoadedMaps[rowid];
10770
10940
  }
@@ -10855,8 +11025,8 @@ const Methods = {
10855
11025
  validRows.forEach(row => {
10856
11026
  const rowid = getRowid(this, row);
10857
11027
  if (!treeTempExpandedMaps[rowid]) {
10858
- const rest = fullAllDataRowIdData[rowid];
10859
- const isLoad = lazy && row[hasChildField] && !rest.treeLoaded && !treeExpandLazyLoadedMaps[rowid];
11028
+ const rowRest = fullAllDataRowIdData[rowid];
11029
+ const isLoad = lazy && row[hasChildField] && !rowRest.treeLoaded && !treeExpandLazyLoadedMaps[rowid];
10860
11030
  // 是否使用懒加载
10861
11031
  if (isLoad) {
10862
11032
  result.push(this.handleAsyncTreeExpandChilds(row));
@@ -11020,7 +11190,7 @@ const Methods = {
11020
11190
  const {
11021
11191
  toVisibleIndex,
11022
11192
  visibleSize
11023
- } = computeVirtualX(this);
11193
+ } = handleVirtualXVisible(this);
11024
11194
  const offsetItem = {
11025
11195
  startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
11026
11196
  endIndex: toVisibleIndex + visibleSize + offsetSize
@@ -11039,10 +11209,47 @@ const Methods = {
11039
11209
  }
11040
11210
  this.closeTooltip();
11041
11211
  },
11212
+ handleScrollEvent(evnt, isRollY, isRollX, params) {
11213
+ const $xeTable = this;
11214
+ const props = $xeTable;
11215
+ const {
11216
+ highlightHoverRow
11217
+ } = props;
11218
+ const tableBody = $xeTable.$refs.tableBody;
11219
+ const bodyElem = tableBody ? tableBody.$el : null;
11220
+ const rowOpts = $xeTable.computeRowOpts;
11221
+ const validTip = $xeTable.$refs.validTip;
11222
+ const tooltip = $xeTable.$refs.tooltip;
11223
+ if (rowOpts.isHover || highlightHoverRow) {
11224
+ $xeTable.clearHoverRow();
11225
+ }
11226
+ if (validTip && validTip.visible) {
11227
+ validTip.close();
11228
+ }
11229
+ if (tooltip && tooltip.visible) {
11230
+ tooltip.close();
11231
+ }
11232
+ if (isRollX) {
11233
+ $xeTable.checkScrolling();
11234
+ }
11235
+ const bodyHeight = bodyElem ? bodyElem.clientHeight : 0;
11236
+ const bodyWidth = bodyElem ? bodyElem.clientWidth : 0;
11237
+ const scrollHeight = bodyElem ? bodyElem.scrollHeight : 0;
11238
+ const scrollWidth = bodyElem ? bodyElem.scrollWidth : 0;
11239
+ $xeTable.dispatchEvent('scroll', {
11240
+ bodyHeight,
11241
+ bodyWidth,
11242
+ scrollHeight,
11243
+ scrollWidth,
11244
+ isX: isRollX,
11245
+ isY: isRollY,
11246
+ ...params
11247
+ }, evnt);
11248
+ },
11042
11249
  /**
11043
11250
  * 纵向 Y 可视渲染事件处理
11044
11251
  */
11045
- triggerScrollYEvent(evnt) {
11252
+ triggerScrollYEvent() {
11046
11253
  const {
11047
11254
  scrollYStore
11048
11255
  } = this;
@@ -11053,21 +11260,84 @@ const Methods = {
11053
11260
  } = scrollYStore;
11054
11261
  // webkit 浏览器使用最佳的渲染方式,且最高渲染量不能大于 40 条
11055
11262
  if (isWebkit && adaptive && offsetSize * 2 + visibleSize <= 40) {
11056
- this.loadScrollYData(evnt);
11263
+ this.loadScrollYData();
11057
11264
  } else {
11058
- this.debounceScrollY(evnt);
11265
+ this.debounceScrollYData();
11059
11266
  }
11267
+ this.debounceScrollYCalculate();
11060
11268
  },
11061
- debounceScrollY: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().debounce(function (evnt) {
11062
- this.loadScrollYData(evnt);
11269
+ debounceScrollYData: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().debounce(function () {
11270
+ this.loadScrollYData();
11063
11271
  }, debounceScrollYDuration, {
11064
11272
  leading: false,
11065
11273
  trailing: true
11066
11274
  }),
11275
+ scrollXEvent(evnt) {
11276
+ const $xeTable = this;
11277
+ const wrapperEl = evnt.currentTarget;
11278
+ const tableHeader = $xeTable.$refs.tableHeader;
11279
+ const tableBody = $xeTable.$refs.tableBody;
11280
+ const tableFooter = $xeTable.$refs.tableFooter;
11281
+ const bodyElem = tableBody.$el;
11282
+ const headerElem = tableHeader ? tableHeader.$el : null;
11283
+ const footerElem = tableFooter ? tableFooter.$el : null;
11284
+ const {
11285
+ scrollTop,
11286
+ scrollLeft
11287
+ } = wrapperEl;
11288
+ const isRollX = true;
11289
+ const isRollY = false;
11290
+ $xeTable.lastScrollLeft = scrollLeft;
11291
+ $xeTable.lastScrollTime = Date.now();
11292
+ setScrollLeft(bodyElem, scrollLeft);
11293
+ setScrollLeft(headerElem, scrollLeft);
11294
+ setScrollLeft(footerElem, scrollLeft);
11295
+ $xeTable.triggerScrollXEvent(evnt);
11296
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
11297
+ type: 'table',
11298
+ fixed: '',
11299
+ scrollTop,
11300
+ scrollLeft
11301
+ });
11302
+ },
11303
+ debounceScrollYCalculate: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().debounce(function () {
11304
+ this.updateScrollYSpace();
11305
+ }, 1000, {
11306
+ leading: false,
11307
+ trailing: true
11308
+ }),
11309
+ scrollYEvent(evnt) {
11310
+ const $xeTable = this;
11311
+ const wrapperEl = evnt.currentTarget;
11312
+ const tableBody = $xeTable.$refs.tableBody;
11313
+ const leftBody = $xeTable.$refs.leftBody;
11314
+ const rightBody = $xeTable.$refs.rightBody;
11315
+ const bodyElem = tableBody.$el;
11316
+ const leftElem = leftBody ? leftBody.$el : null;
11317
+ const rightElem = rightBody ? rightBody.$el : null;
11318
+ const {
11319
+ scrollTop,
11320
+ scrollLeft
11321
+ } = wrapperEl;
11322
+ const isRollX = false;
11323
+ const isRollY = true;
11324
+ $xeTable.lastScrollTop = scrollTop;
11325
+ $xeTable.lastScrollTime = Date.now();
11326
+ setScrollTop(bodyElem, scrollTop);
11327
+ setScrollTop(leftElem, scrollTop);
11328
+ setScrollTop(rightElem, scrollTop);
11329
+ $xeTable.triggerScrollYEvent(evnt);
11330
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
11331
+ type: 'table',
11332
+ fixed: '',
11333
+ scrollTop,
11334
+ scrollLeft
11335
+ });
11336
+ },
11067
11337
  /**
11068
11338
  * 纵向 Y 可视渲染处理
11069
11339
  */
11070
- loadScrollYData(evnt) {
11340
+ loadScrollYData() {
11071
11341
  const {
11072
11342
  mergeList,
11073
11343
  scrollYStore
@@ -11075,13 +11345,12 @@ const Methods = {
11075
11345
  const {
11076
11346
  startIndex,
11077
11347
  endIndex,
11078
- visibleSize,
11079
- offsetSize,
11080
- rowHeight
11348
+ offsetSize
11081
11349
  } = scrollYStore;
11082
- const scrollBodyElem = evnt.currentTarget || evnt.target;
11083
- const scrollTop = scrollBodyElem.scrollTop;
11084
- const toVisibleIndex = Math.floor(scrollTop / rowHeight);
11350
+ const {
11351
+ toVisibleIndex,
11352
+ visibleSize
11353
+ } = handleVirtualYVisible(this);
11085
11354
  const offsetItem = {
11086
11355
  startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
11087
11356
  endIndex: toVisibleIndex + visibleSize + offsetSize
@@ -11114,7 +11383,7 @@ const Methods = {
11114
11383
  if (scrollXLoad) {
11115
11384
  const {
11116
11385
  visibleSize: visibleXSize
11117
- } = computeVirtualX(this);
11386
+ } = handleVirtualXVisible(this);
11118
11387
  const offsetXSize = sXOpts.oSize ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(sXOpts.oSize) : browse.msie ? 10 : browse.edge ? 5 : 0;
11119
11388
  scrollXStore.offsetSize = offsetXSize;
11120
11389
  scrollXStore.visibleSize = visibleXSize;
@@ -11123,12 +11392,14 @@ const Methods = {
11123
11392
  } else {
11124
11393
  this.updateScrollXSpace();
11125
11394
  }
11395
+ calcCellHeight(this);
11126
11396
  // 计算 Y 逻辑
11397
+ const rowHeight = computeRowHeight(this);
11398
+ scrollYStore.rowHeight = rowHeight;
11399
+ this.rowHeight = rowHeight;
11127
11400
  const {
11128
- rowHeight,
11129
11401
  visibleSize: visibleYSize
11130
- } = computeVirtualY(this);
11131
- scrollYStore.rowHeight = rowHeight;
11402
+ } = handleVirtualYVisible(this);
11132
11403
  if (scrollYLoad) {
11133
11404
  const offsetYSize = sYOpts.oSize ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(sYOpts.oSize) : browse.msie ? 20 : browse.edge ? 10 : 0;
11134
11405
  scrollYStore.offsetSize = offsetYSize;
@@ -11138,7 +11409,6 @@ const Methods = {
11138
11409
  } else {
11139
11410
  this.updateScrollYSpace();
11140
11411
  }
11141
- this.rowHeight = rowHeight;
11142
11412
  this.$nextTick(this.updateStyle);
11143
11413
  });
11144
11414
  },
@@ -11146,9 +11416,18 @@ const Methods = {
11146
11416
  const {
11147
11417
  scrollXLoad,
11148
11418
  visibleColumn,
11149
- scrollXStore
11419
+ scrollXStore,
11420
+ fullColumnIdData
11150
11421
  } = this;
11151
- this.tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0);
11422
+ const tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0);
11423
+ tableColumn.forEach((column, $index) => {
11424
+ const colid = column.id;
11425
+ const colRest = fullColumnIdData[colid];
11426
+ if (colRest) {
11427
+ colRest.$index = $index;
11428
+ }
11429
+ });
11430
+ this.tableColumn = tableColumn;
11152
11431
  },
11153
11432
  updateScrollXData() {
11154
11433
  // this.tableColumn = []
@@ -11159,6 +11438,7 @@ const Methods = {
11159
11438
  },
11160
11439
  // 更新横向 X 可视渲染上下剩余空间大小
11161
11440
  updateScrollXSpace() {
11441
+ const $xeTable = this;
11162
11442
  const {
11163
11443
  $refs,
11164
11444
  isGroup,
@@ -11168,7 +11448,7 @@ const Methods = {
11168
11448
  scrollXLoad,
11169
11449
  tableWidth,
11170
11450
  scrollbarWidth
11171
- } = this;
11451
+ } = $xeTable;
11172
11452
  const {
11173
11453
  tableHeader,
11174
11454
  tableBody,
@@ -11203,34 +11483,64 @@ const Methods = {
11203
11483
  }
11204
11484
  });
11205
11485
  });
11486
+ const scrollXSpaceEl = $xeTable.$refs.refScrollXSpaceElem;
11487
+ if (scrollXSpaceEl) {
11488
+ scrollXSpaceEl.style.width = `${tableWidth + scrollbarWidth}px`;
11489
+ }
11206
11490
  this.$nextTick(this.updateStyle);
11207
11491
  }
11208
11492
  },
11209
11493
  updateScrollYData() {
11494
+ const $xeTable = this;
11210
11495
  // this.tableData = []
11211
11496
  this.$nextTick(() => {
11212
11497
  this.handleTableData();
11498
+ calcCellHeight($xeTable);
11213
11499
  this.updateScrollYSpace();
11214
11500
  });
11215
11501
  },
11216
11502
  // 更新纵向 Y 可视渲染上下剩余空间大小
11217
11503
  updateScrollYSpace() {
11504
+ const $xeTable = this;
11218
11505
  const {
11506
+ showOverflow,
11219
11507
  elemStore,
11220
11508
  scrollYStore,
11221
11509
  scrollYLoad,
11222
- afterFullData
11510
+ afterFullData,
11511
+ fullAllDataRowIdData
11223
11512
  } = this;
11224
11513
  const {
11225
11514
  startIndex,
11226
11515
  rowHeight
11227
11516
  } = scrollYStore;
11228
- const bodyHeight = afterFullData.length * rowHeight;
11229
- const topSpaceHeight = Math.max(0, startIndex * rowHeight);
11517
+ let bodyHeight = 0;
11518
+ let topSpaceHeight = 0;
11230
11519
  const containerList = ['main', 'left', 'right'];
11231
11520
  let marginTop = '';
11232
11521
  let ySpaceHeight = '';
11233
11522
  if (scrollYLoad) {
11523
+ if (showOverflow) {
11524
+ bodyHeight = afterFullData.length * rowHeight;
11525
+ topSpaceHeight = Math.max(0, startIndex * rowHeight);
11526
+ } else {
11527
+ for (let i = 0; i < afterFullData.length; i++) {
11528
+ const row = afterFullData[i];
11529
+ const rowid = getRowid($xeTable, row);
11530
+ const rowRest = fullAllDataRowIdData[rowid];
11531
+ if (rowRest) {
11532
+ bodyHeight += rowRest.height || rowHeight;
11533
+ }
11534
+ }
11535
+ for (let i = 0; i < startIndex; i++) {
11536
+ const row = afterFullData[i];
11537
+ const rowid = getRowid($xeTable, row);
11538
+ const rowRest = fullAllDataRowIdData[rowid];
11539
+ if (rowRest) {
11540
+ topSpaceHeight += rowRest.height || rowHeight;
11541
+ }
11542
+ }
11543
+ }
11234
11544
  marginTop = `${topSpaceHeight}px`;
11235
11545
  ySpaceHeight = `${bodyHeight}px`;
11236
11546
  }
@@ -11247,6 +11557,10 @@ const Methods = {
11247
11557
  }
11248
11558
  });
11249
11559
  });
11560
+ const scrollYSpaceEl = $xeTable.$refs.refScrollYSpaceElem;
11561
+ if (scrollYSpaceEl) {
11562
+ scrollYSpaceEl.style.height = ySpaceHeight;
11563
+ }
11250
11564
  this.$nextTick(this.updateStyle);
11251
11565
  },
11252
11566
  /**
@@ -11339,36 +11653,52 @@ const Methods = {
11339
11653
  * 手动清除滚动相关信息,还原到初始状态
11340
11654
  */
11341
11655
  clearScroll() {
11656
+ const $xeTable = this;
11342
11657
  const {
11343
11658
  $refs,
11344
11659
  scrollXStore,
11345
11660
  scrollYStore
11346
- } = this;
11661
+ } = $xeTable;
11347
11662
  const {
11348
11663
  tableBody,
11664
+ tableHeader,
11665
+ leftBody,
11349
11666
  rightBody,
11350
11667
  tableFooter
11351
11668
  } = $refs;
11352
11669
  const tableBodyElem = tableBody ? tableBody.$el : null;
11670
+ const leftBodyElem = leftBody ? leftBody.$el : null;
11353
11671
  const rightBodyElem = rightBody ? rightBody.$el : null;
11672
+ const tableHeaderElem = tableHeader ? tableHeader.$el : null;
11354
11673
  const tableFooterElem = tableFooter ? tableFooter.$el : null;
11355
- if (rightBodyElem) {
11356
- restoreScrollListener(rightBodyElem);
11357
- rightBodyElem.scrollTop = 0;
11358
- }
11359
- if (tableFooterElem) {
11360
- tableFooterElem.scrollLeft = 0;
11674
+ const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
11675
+ if (xHandleEl) {
11676
+ setScrollLeft(xHandleEl, 0);
11677
+ } else {
11678
+ setScrollLeft(tableBodyElem, 0);
11679
+ setScrollLeft(tableHeaderElem, 0);
11680
+ setScrollLeft(tableFooterElem, 0);
11361
11681
  }
11362
- if (tableBodyElem) {
11363
- restoreScrollListener(tableBodyElem);
11364
- tableBodyElem.scrollTop = 0;
11365
- tableBodyElem.scrollLeft = 0;
11682
+ const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
11683
+ if (yHandleEl) {
11684
+ setScrollTop(yHandleEl, 0);
11685
+ } else {
11686
+ setScrollTop(tableBodyElem, 0);
11687
+ setScrollTop(leftBodyElem, 0);
11688
+ setScrollTop(rightBodyElem, 0);
11366
11689
  }
11367
11690
  scrollXStore.startIndex = 0;
11368
11691
  scrollXStore.endIndex = scrollXStore.visibleSize;
11369
11692
  scrollYStore.startIndex = 0;
11370
11693
  scrollYStore.endIndex = scrollYStore.visibleSize;
11371
- return this.$nextTick();
11694
+ return $xeTable.$nextTick().then(() => {
11695
+ setScrollLeft(tableBodyElem, 0);
11696
+ setScrollLeft(tableHeaderElem, 0);
11697
+ setScrollLeft(tableFooterElem, 0);
11698
+ setScrollTop(tableBodyElem, 0);
11699
+ setScrollTop(leftBodyElem, 0);
11700
+ setScrollTop(rightBodyElem, 0);
11701
+ });
11372
11702
  },
11373
11703
  /**
11374
11704
  * 更新表尾合计
@@ -11541,6 +11871,14 @@ const Methods = {
11541
11871
  }
11542
11872
  return this.$nextTick();
11543
11873
  },
11874
+ dispatchEvent(type, params, evnt) {
11875
+ const $xeTable = this;
11876
+ $xeTable.$emit(type, createEvent(evnt, {
11877
+ $table: $xeTable,
11878
+ $grid: $xeTable.$xegrid
11879
+ }, params));
11880
+ },
11881
+ // 已废弃,使用 dispatchEvent
11544
11882
  emitEvent(type, params, evnt) {
11545
11883
  this.$emit(type, Object.assign({
11546
11884
  $table: this,
@@ -11686,13 +12024,13 @@ function renderLine(h, _vm, $xetable, params) {
11686
12024
  function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, columns, items) {
11687
12025
  const {
11688
12026
  $listeners: tableListeners,
12027
+ fullAllDataRowIdData,
11689
12028
  afterFullData,
11690
12029
  tableData,
11691
12030
  height,
11692
12031
  columnKey,
11693
12032
  overflowX,
11694
12033
  sYOpts,
11695
- scrollXLoad,
11696
12034
  scrollYLoad,
11697
12035
  highlightCurrentRow,
11698
12036
  showOverflow: allColumnOverflow,
@@ -11719,6 +12057,7 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
11719
12057
  columnOpts,
11720
12058
  validErrorMaps
11721
12059
  } = $xetable;
12060
+ const cellOpts = $xetable.computeCellOpts;
11722
12061
  const {
11723
12062
  type,
11724
12063
  cellRender,
@@ -11729,6 +12068,9 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
11729
12068
  treeNode,
11730
12069
  slots
11731
12070
  } = column;
12071
+ const {
12072
+ verticalAlign
12073
+ } = cellOpts;
11732
12074
  const {
11733
12075
  actived
11734
12076
  } = editStore;
@@ -11748,12 +12090,13 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
11748
12090
  const isEdit = isEnableConf(editRender);
11749
12091
  let fixedHiddenColumn = fixedType ? column.fixed !== fixedType : column.fixed && overflowX;
11750
12092
  const cellOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(showOverflow) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNull(showOverflow) ? allColumnOverflow : showOverflow;
11751
- let showEllipsis = cellOverflow === 'ellipsis';
12093
+ const showEllipsis = cellOverflow === 'ellipsis';
11752
12094
  const showTitle = cellOverflow === 'title';
11753
12095
  const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
11754
- let hasEllipsis = showTitle || showTooltip || showEllipsis;
12096
+ const hasEllipsis = showTitle || showTooltip || showEllipsis;
11755
12097
  let isDirty;
11756
12098
  const tdOns = {};
12099
+ const rest = fullAllDataRowIdData[rowid];
11757
12100
  const cellAlign = align || (compConf ? compConf.tableCellAlign : '') || allAlign;
11758
12101
  const errorValidItem = validErrorMaps[`${rowid}:${column.id}`];
11759
12102
  const showValidTip = editRules && validOpts.showMessage && (validOpts.message === 'default' ? height || tableData.length > 1 : validOpts.message === 'inline');
@@ -11785,10 +12128,6 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
11785
12128
  data: tableData,
11786
12129
  items
11787
12130
  };
11788
- // 虚拟滚动不支持动态高度
11789
- if ((scrollXLoad || scrollYLoad) && !hasEllipsis) {
11790
- showEllipsis = hasEllipsis = true;
11791
- }
11792
12131
  // hover 进入事件
11793
12132
  if (showTitle || showTooltip || showAllTip || bindMouseenter || tooltipConfig) {
11794
12133
  tdOns.mouseenter = evnt => {
@@ -11933,6 +12272,7 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
11933
12272
  return h('td', {
11934
12273
  class: ['vxe-body--column', column.id, {
11935
12274
  [`col--${cellAlign}`]: cellAlign,
12275
+ [`col--vertical-${verticalAlign}`]: verticalAlign,
11936
12276
  [`col--${type}`]: type,
11937
12277
  'col--last': $columnIndex === columns.length - 1,
11938
12278
  'col--tree-node': treeNode,
@@ -11948,7 +12288,7 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
11948
12288
  key: columnKey || columnOpts.useKey ? column.id : $columnIndex,
11949
12289
  attrs,
11950
12290
  style: Object.assign({
11951
- height: hasEllipsis && (scrollYRHeight || rowHeight) ? `${scrollYRHeight || rowHeight}px` : ''
12291
+ height: hasEllipsis && (scrollYRHeight || rowHeight) ? `${scrollYRHeight || rowHeight}px` : scrollYLoad ? `${rest.height || scrollYRHeight || rowHeight}px` : ''
11952
12292
  }, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(compCellStyle) ? compCellStyle(params) : compCellStyle, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(cellStyle) ? cellStyle(params) : cellStyle),
11953
12293
  on: tdOns
11954
12294
  }, tdVNs);
@@ -12112,45 +12452,6 @@ function renderRows(h, _vm, $xetable, fixedType, tableData, tableColumn) {
12112
12452
  });
12113
12453
  return rows;
12114
12454
  }
12115
- /**
12116
- * 同步滚动条
12117
- */
12118
- let scrollProcessTimeout;
12119
- function syncBodyScroll(_vm, fixedType, scrollTop, elem1, elem2) {
12120
- if (elem1 || elem2) {
12121
- if (elem1) {
12122
- removeScrollListener(elem1);
12123
- elem1.scrollTop = scrollTop;
12124
- }
12125
- if (elem2) {
12126
- removeScrollListener(elem2);
12127
- elem2.scrollTop = scrollTop;
12128
- }
12129
- clearTimeout(scrollProcessTimeout);
12130
- scrollProcessTimeout = setTimeout(() => {
12131
- // const { tableBody, leftBody, rightBody } = _vm.$refs
12132
- // const bodyElem = tableBody.$el
12133
- // const leftElem = leftBody ? leftBody.$el : null
12134
- // const rightElem = rightBody ? rightBody.$el : null
12135
- restoreScrollListener(elem1);
12136
- restoreScrollListener(elem2);
12137
- // 检查滚动条是的同步
12138
- // let targetTop = bodyElem.scrollTop
12139
- // if (fixedType === 'left') {
12140
- // if (leftElem) {
12141
- // targetTop = leftElem.scrollTop
12142
- // }
12143
- // } else if (fixedType === 'right') {
12144
- // if (rightElem) {
12145
- // targetTop = rightElem.scrollTop
12146
- // }
12147
- // }
12148
- // setScrollTop(bodyElem, targetTop)
12149
- // setScrollTop(leftElem, targetTop)
12150
- // setScrollTop(rightElem, targetTop)
12151
- }, 300);
12152
- }
12153
- }
12154
12455
  /* harmony default export */ var body = ({
12155
12456
  name: 'VxeTableBody',
12156
12457
  props: {
@@ -12186,17 +12487,9 @@ function syncBodyScroll(_vm, fixedType, scrollTop, elem1, elem2) {
12186
12487
  elemStore[`${prefix}xSpace`] = $refs.xSpace;
12187
12488
  elemStore[`${prefix}ySpace`] = $refs.ySpace;
12188
12489
  elemStore[`${prefix}emptyBlock`] = $refs.emptyBlock;
12189
- if (this.$el) {
12190
- this.$el.onscroll = this.scrollEvent;
12191
- this.$el._onscroll = this.scrollEvent;
12192
- }
12193
12490
  },
12194
12491
  beforeDestroy() {
12195
12492
  clearTimeout(this.wheelTime);
12196
- if (this.$el) {
12197
- this.$el._onscroll = null;
12198
- this.$el.onscroll = null;
12199
- }
12200
12493
  },
12201
12494
  destroyed() {
12202
12495
  const {
@@ -12284,9 +12577,11 @@ function syncBodyScroll(_vm, fixedType, scrollTop, elem1, elem2) {
12284
12577
  attrs: {
12285
12578
  xid: tId
12286
12579
  },
12287
- on: scrollYLoad && sYOpts.mode === 'wheel' ? {
12580
+ on: Object.assign({
12581
+ scroll: this.scrollEvent
12582
+ }, scrollYLoad && sYOpts.mode === 'wheel' ? {
12288
12583
  wheel: this.wheelEvent
12289
- } : {}
12584
+ } : null)
12290
12585
  }, [fixedType ? _e() : h('div', {
12291
12586
  class: 'vxe-body--x-space',
12292
12587
  ref: 'xSpace'
@@ -12362,89 +12657,68 @@ function syncBodyScroll(_vm, fixedType, scrollTop, elem1, elem2) {
12362
12657
  scrollEvent(evnt) {
12363
12658
  const {
12364
12659
  $el: scrollBodyElem,
12365
- $parent: $xetable,
12660
+ $parent: $xeTable,
12366
12661
  fixedType
12367
12662
  } = this;
12368
12663
  const {
12369
12664
  $refs,
12370
- elemStore,
12371
- highlightHoverRow,
12372
- scrollXLoad,
12373
- scrollYLoad,
12374
12665
  lastScrollTop,
12375
- lastScrollLeft,
12376
- rowOpts
12377
- } = $xetable;
12666
+ lastScrollLeft
12667
+ } = $xeTable;
12378
12668
  const {
12379
12669
  tableHeader,
12380
12670
  tableBody,
12381
12671
  leftBody,
12382
12672
  rightBody,
12383
- tableFooter,
12384
- validTip
12673
+ tableFooter
12385
12674
  } = $refs;
12386
12675
  const headerElem = tableHeader ? tableHeader.$el : null;
12387
12676
  const footerElem = tableFooter ? tableFooter.$el : null;
12388
12677
  const bodyElem = tableBody.$el;
12389
12678
  const leftElem = leftBody ? leftBody.$el : null;
12390
12679
  const rightElem = rightBody ? rightBody.$el : null;
12391
- const bodyYElem = elemStore['main-body-ySpace'];
12392
- const bodyXElem = elemStore['main-body-xSpace'];
12393
- const bodyHeight = scrollYLoad && bodyYElem ? bodyYElem.clientHeight : bodyElem.clientHeight;
12394
- const bodyWidth = scrollXLoad && bodyXElem ? bodyXElem.clientWidth : bodyElem.clientWidth;
12395
- let scrollTop = scrollBodyElem.scrollTop;
12680
+ const scrollTop = scrollBodyElem.scrollTop;
12396
12681
  const scrollLeft = bodyElem.scrollLeft;
12397
12682
  const isRollX = scrollLeft !== lastScrollLeft;
12398
12683
  const isRollY = scrollTop !== lastScrollTop;
12399
- $xetable.lastScrollTop = scrollTop;
12400
- $xetable.lastScrollLeft = scrollLeft;
12401
- $xetable.lastScrollTime = Date.now();
12402
- if (rowOpts.isHover || highlightHoverRow) {
12403
- $xetable.clearHoverRow();
12404
- }
12405
- if (leftElem && fixedType === 'left') {
12406
- scrollTop = leftElem.scrollTop;
12407
- syncBodyScroll($xetable, fixedType, scrollTop, bodyElem, rightElem);
12408
- } else if (rightElem && fixedType === 'right') {
12409
- scrollTop = rightElem.scrollTop;
12410
- syncBodyScroll($xetable, fixedType, scrollTop, bodyElem, leftElem);
12411
- } else {
12412
- if (isRollX) {
12413
- if (headerElem) {
12414
- headerElem.scrollLeft = bodyElem.scrollLeft;
12415
- }
12416
- if (footerElem) {
12417
- footerElem.scrollLeft = bodyElem.scrollLeft;
12418
- }
12419
- }
12420
- if (leftElem || rightElem) {
12421
- $xetable.checkScrolling();
12422
- if (isRollY) {
12423
- syncBodyScroll($xetable, fixedType, scrollTop, leftElem, rightElem);
12424
- }
12684
+ const xHandleEl = $refs.refScrollXHandleElem;
12685
+ const yHandleEl = $refs.refScrollYHandleElem;
12686
+ if (yHandleEl) {
12687
+ yHandleEl.scrollTop = scrollTop;
12688
+ } else if (isRollY) {
12689
+ $xeTable.lastScrollTop = scrollTop;
12690
+ $xeTable.lastScrollLeft = scrollLeft;
12691
+ if (leftElem && fixedType === 'left') {
12692
+ setScrollTop(bodyElem, scrollTop);
12693
+ setScrollTop(rightElem, scrollTop);
12694
+ } else if (rightElem && fixedType === 'right') {
12695
+ setScrollTop(bodyElem, scrollTop);
12696
+ setScrollTop(leftElem, scrollTop);
12697
+ } else {
12698
+ setScrollTop(leftElem, scrollTop);
12699
+ setScrollTop(rightElem, scrollTop);
12425
12700
  }
12701
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
12702
+ type: renderType,
12703
+ fixed: fixedType,
12704
+ scrollTop,
12705
+ scrollLeft
12706
+ });
12426
12707
  }
12427
- if (scrollXLoad && isRollX) {
12428
- $xetable.triggerScrollXEvent(evnt);
12429
- }
12430
- if (scrollYLoad && isRollY) {
12431
- $xetable.triggerScrollYEvent(evnt);
12432
- }
12433
- if (isRollX && validTip && validTip.visible) {
12434
- validTip.updatePlacement();
12708
+ if (xHandleEl) {
12709
+ xHandleEl.scrollLeft = scrollLeft;
12710
+ } else if (isRollX) {
12711
+ $xeTable.lastScrollTop = scrollTop;
12712
+ $xeTable.lastScrollLeft = scrollLeft;
12713
+ setScrollLeft(headerElem, scrollLeft);
12714
+ setScrollLeft(footerElem, scrollLeft);
12715
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
12716
+ type: renderType,
12717
+ fixed: fixedType,
12718
+ scrollTop,
12719
+ scrollLeft
12720
+ });
12435
12721
  }
12436
- $xetable.emitEvent('scroll', {
12437
- type: renderType,
12438
- fixed: fixedType,
12439
- scrollTop,
12440
- scrollLeft,
12441
- scrollHeight: bodyElem.scrollHeight,
12442
- scrollWidth: bodyElem.scrollWidth,
12443
- bodyHeight,
12444
- bodyWidth,
12445
- isX: isRollX,
12446
- isY: isRollY
12447
- }, evnt);
12448
12722
  },
12449
12723
  handleWheel(evnt, isTopWheel, deltaTop, isRollX, isRollY) {
12450
12724
  const {
@@ -12956,7 +13230,7 @@ const cellType = 'header';
12956
13230
 
12957
13231
 
12958
13232
 
12959
- const footer_cellType = 'footer';
13233
+ const footer_renderType = 'footer';
12960
13234
  const {
12961
13235
  renderer: footer_renderer
12962
13236
  } = core_.VxeUI;
@@ -13120,7 +13394,7 @@ function mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex) {
13120
13394
  _rowIndex,
13121
13395
  $rowIndex,
13122
13396
  fixed: fixedType,
13123
- type: footer_cellType
13397
+ type: footer_renderType
13124
13398
  };
13125
13399
  return h('tr', {
13126
13400
  class: ['vxe-footer--row', footerRowClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''],
@@ -13166,7 +13440,7 @@ function mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex) {
13166
13440
  itemIndex,
13167
13441
  items: list,
13168
13442
  fixed: fixedType,
13169
- type: footer_cellType,
13443
+ type: footer_renderType,
13170
13444
  data: footerTableData
13171
13445
  };
13172
13446
  // 虚拟滚动不支持动态高度
@@ -13270,48 +13544,39 @@ function mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex) {
13270
13544
  */
13271
13545
  scrollEvent(evnt) {
13272
13546
  const {
13273
- $parent: $xetable,
13547
+ $parent: $xeTable,
13274
13548
  fixedType
13275
13549
  } = this;
13276
13550
  const {
13277
- $refs,
13278
- scrollXLoad,
13279
- triggerScrollXEvent,
13280
- lastScrollLeft
13281
- } = $xetable;
13551
+ $refs
13552
+ } = $xeTable;
13282
13553
  const {
13283
13554
  tableHeader,
13284
13555
  tableBody,
13285
- tableFooter,
13286
- validTip
13556
+ tableFooter
13287
13557
  } = $refs;
13288
13558
  const headerElem = tableHeader ? tableHeader.$el : null;
13289
13559
  const footerElem = tableFooter ? tableFooter.$el : null;
13290
13560
  const bodyElem = tableBody.$el;
13291
13561
  const scrollLeft = footerElem ? footerElem.scrollLeft : 0;
13292
- const isX = scrollLeft !== lastScrollLeft;
13293
- $xetable.lastScrollLeft = scrollLeft;
13294
- $xetable.lastScrollTime = Date.now();
13295
- if (headerElem) {
13296
- headerElem.scrollLeft = scrollLeft;
13297
- }
13298
- if (bodyElem) {
13299
- bodyElem.scrollLeft = scrollLeft;
13300
- }
13301
- if (scrollXLoad && isX) {
13302
- triggerScrollXEvent(evnt);
13303
- }
13304
- if (isX && validTip && validTip.visible) {
13305
- validTip.updatePlacement();
13562
+ const xHandleEl = $refs.refScrollXHandleElem;
13563
+ if (xHandleEl) {
13564
+ xHandleEl.scrollLeft = scrollLeft;
13565
+ } else {
13566
+ const isRollX = true;
13567
+ const isRollY = false;
13568
+ const scrollTop = bodyElem.scrollTop;
13569
+ $xeTable.lastScrollLeft = scrollLeft;
13570
+ $xeTable.lastScrollTime = Date.now();
13571
+ setScrollLeft(headerElem, scrollLeft);
13572
+ setScrollLeft(bodyElem, scrollLeft);
13573
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
13574
+ type: footer_renderType,
13575
+ fixed: fixedType,
13576
+ scrollTop,
13577
+ scrollLeft
13578
+ });
13306
13579
  }
13307
- $xetable.emitEvent('scroll', {
13308
- type: footer_cellType,
13309
- fixed: fixedType,
13310
- scrollTop: bodyElem.scrollTop,
13311
- scrollLeft,
13312
- isX,
13313
- isY: false
13314
- }, evnt);
13315
13580
  }
13316
13581
  }
13317
13582
  });
@@ -13496,6 +13761,8 @@ const {
13496
13761
  resizeConfig: Object,
13497
13762
  // 列配置信息
13498
13763
  columnConfig: Object,
13764
+ // 单元格配置信息
13765
+ cellConfig: Object,
13499
13766
  // 行配置信息
13500
13767
  rowConfig: Object,
13501
13768
  // 列调整配置项
@@ -16272,7 +16539,8 @@ function insertTreeRow(_vm, newRecords, isAppend) {
16272
16539
  $index: -1,
16273
16540
  items: parentChilds,
16274
16541
  parent: parentRow,
16275
- level: parentLevel + 1
16542
+ level: parentLevel + 1,
16543
+ height: 0
16276
16544
  };
16277
16545
  fullDataRowIdData[rowid] = rest;
16278
16546
  fullAllDataRowIdData[rowid] = rest;
@@ -16293,7 +16561,8 @@ function insertTreeRow(_vm, newRecords, isAppend) {
16293
16561
  $index: -1,
16294
16562
  items: tableFullTreeData,
16295
16563
  parent: null,
16296
- level: 0
16564
+ level: 0,
16565
+ height: 0
16297
16566
  };
16298
16567
  fullDataRowIdData[rowid] = rest;
16299
16568
  fullAllDataRowIdData[rowid] = rest;
@@ -16400,7 +16669,8 @@ function handleInsertRowAt(_vm, records, row, isInsertNextRow) {
16400
16669
  $index: -1,
16401
16670
  items: parentMapChilds,
16402
16671
  parent: parentRow,
16403
- level: parentLevel + 1
16672
+ level: parentLevel + 1,
16673
+ height: 0
16404
16674
  };
16405
16675
  fullDataRowIdData[rowid] = rest;
16406
16676
  fullAllDataRowIdData[rowid] = rest;
@@ -20148,7 +20418,8 @@ const {
20148
20418
  renderer: table_renderer,
20149
20419
  globalResize: table_globalResize,
20150
20420
  globalEvents: table_globalEvents,
20151
- globalMixins: table_globalMixins
20421
+ globalMixins: table_globalMixins,
20422
+ renderEmptyElement: table_renderEmptyElement
20152
20423
  } = core_.VxeUI;
20153
20424
  /**
20154
20425
  * 渲染浮固定列
@@ -20204,7 +20475,7 @@ function renderFixed(h, $xetable, fixedType) {
20204
20475
  ref: `${fixedType}Footer`
20205
20476
  }) : _e()]);
20206
20477
  }
20207
- function renderEmptyContenet(h, _vm) {
20478
+ function renderEmptyBody(h, _vm) {
20208
20479
  const {
20209
20480
  $scopedSlots,
20210
20481
  emptyOpts
@@ -20525,6 +20796,9 @@ function handleUupdateResize(_vm) {
20525
20796
  computeColumnOpts() {
20526
20797
  return Object.assign({}, table_getConfig().table.columnConfig, this.columnConfig);
20527
20798
  },
20799
+ computeCellOpts() {
20800
+ return Object.assign({}, table_getConfig().table.cellConfig, this.rowConfig);
20801
+ },
20528
20802
  rowOpts() {
20529
20803
  return this.computeRowOpts;
20530
20804
  },
@@ -20781,6 +21055,20 @@ function handleUupdateResize(_vm) {
20781
21055
  }
20782
21056
  return false;
20783
21057
  },
21058
+ computeVirtualScrollBars() {
21059
+ const $xeTable = this;
21060
+ const reactData = $xeTable;
21061
+ const {
21062
+ overflowX,
21063
+ scrollXLoad,
21064
+ overflowY,
21065
+ scrollYLoad
21066
+ } = reactData;
21067
+ return {
21068
+ x: overflowX && scrollXLoad,
21069
+ y: overflowY && scrollYLoad
21070
+ };
21071
+ },
20784
21072
  tabsResizeFlag() {
20785
21073
  const $xeTable = this;
20786
21074
  const $xeTabs = $xeTable.$xeTabs;
@@ -21183,6 +21471,7 @@ function handleUupdateResize(_vm) {
21183
21471
  // 使用已安装的组件,如果未安装则不渲染
21184
21472
  const VxeUILoadingComponent = core_.VxeUI.getComponent('VxeLoading');
21185
21473
  const VxeUITooltipComponent = core_.VxeUI.getComponent('VxeTooltip');
21474
+ const $xeTable = this;
21186
21475
  const {
21187
21476
  _e,
21188
21477
  $scopedSlots,
@@ -21226,13 +21515,14 @@ function handleUupdateResize(_vm) {
21226
21515
  checkboxOpts,
21227
21516
  loadingOpts,
21228
21517
  editRules
21229
- } = this;
21518
+ } = $xeTable;
21230
21519
  const {
21231
21520
  leftList,
21232
21521
  rightList
21233
21522
  } = columnStore;
21234
21523
  const currLoading = this._isLoading || loading;
21235
21524
  const vSize = computeSize;
21525
+ const virtualScrollBars = $xeTable.computeVirtualScrollBars;
21236
21526
  return h('div', {
21237
21527
  class: ['vxe-table', 'vxe-table--render-default', `tid_${tId}`, vSize ? `size--${vSize}` : '', `border--${tableBorder}`, {
21238
21528
  [`valid-msg--${validOpts.msgMode}`]: !!editRules,
@@ -21276,6 +21566,7 @@ function handleUupdateResize(_vm) {
21276
21566
  class: 'vxe-table-slots',
21277
21567
  ref: 'hideColumn'
21278
21568
  }, this.$slots.default), h('div', {
21569
+ key: 'tw',
21279
21570
  class: 'vxe-table--render-wrapper'
21280
21571
  }, [h('div', {
21281
21572
  class: 'vxe-table--main-wrapper'
@@ -21315,34 +21606,55 @@ function handleUupdateResize(_vm) {
21315
21606
  }
21316
21607
  }) : _e()]), h('div', {
21317
21608
  class: 'vxe-table--fixed-wrapper'
21318
- }, [
21319
- /**
21320
- * 左侧固定区域
21321
- */
21322
- leftList && leftList.length && overflowX ? renderFixed(h, this, 'left') : _e(),
21323
- /**
21324
- * 右侧固定区域
21325
- */
21326
- rightList && rightList.length && overflowX ? renderFixed(h, this, 'right') : _e()])]),
21609
+ }, [leftList && leftList.length && overflowX ? renderFixed(h, this, 'left') : _e(), rightList && rightList.length && overflowX ? renderFixed(h, this, 'right') : _e()])]), virtualScrollBars.x ? h('div', {
21610
+ key: 'vx',
21611
+ ref: 'refScrollXVirtualElem',
21612
+ class: 'vxe-table--scroll-x-virtual'
21613
+ }, [h('div', {
21614
+ ref: 'refScrollXHandleElem',
21615
+ class: 'vxe-table--scroll-x-handle',
21616
+ on: {
21617
+ scroll: $xeTable.scrollXEvent
21618
+ }
21619
+ }, [h('div', {
21620
+ ref: 'refScrollXSpaceElem',
21621
+ class: 'vxe-table--scroll-x-space'
21622
+ })])]) : table_renderEmptyElement($xeTable), virtualScrollBars.y ? h('div', {
21623
+ key: 'vy',
21624
+ ref: 'refScrollYVirtualElem',
21625
+ class: 'vxe-table--scroll-y-virtual'
21626
+ }, [h('div', {
21627
+ ref: 'refScrollYHandleElem',
21628
+ class: 'vxe-table--scroll-y-handle',
21629
+ on: {
21630
+ scroll: $xeTable.scrollYEvent
21631
+ }
21632
+ }, [h('div', {
21633
+ ref: 'refScrollYSpaceElem',
21634
+ class: 'vxe-table--scroll-x-space'
21635
+ })])]) : table_renderEmptyElement($xeTable),
21327
21636
  /**
21328
21637
  * 空数据
21329
21638
  */
21330
21639
  h('div', {
21640
+ key: 'tn',
21331
21641
  ref: 'emptyPlaceholder',
21332
21642
  class: 'vxe-table--empty-placeholder'
21333
21643
  }, [h('div', {
21334
21644
  class: 'vxe-table--empty-content'
21335
- }, renderEmptyContenet(h, this))]),
21645
+ }, renderEmptyBody(h, this))]),
21336
21646
  /**
21337
21647
  * 边框线
21338
21648
  */
21339
21649
  h('div', {
21650
+ key: 'tl',
21340
21651
  class: 'vxe-table--border-line'
21341
21652
  }),
21342
21653
  /**
21343
21654
  * 列宽线
21344
21655
  */
21345
21656
  h('div', {
21657
+ key: 'cl',
21346
21658
  class: 'vxe-table--resizable-bar',
21347
21659
  style: overflowX ? {
21348
21660
  'padding-bottom': `${scrollbarHeight}px`
@@ -21353,6 +21665,7 @@ function handleUupdateResize(_vm) {
21353
21665
  * 加载中
21354
21666
  */
21355
21667
  VxeUILoadingComponent ? h(VxeUILoadingComponent, {
21668
+ key: 'lg',
21356
21669
  class: 'vxe-table--loading',
21357
21670
  props: {
21358
21671
  value: currLoading,
@@ -21364,6 +21677,7 @@ function handleUupdateResize(_vm) {
21364
21677
  * 自定义列
21365
21678
  */
21366
21679
  initStore.custom ? h(panel, {
21680
+ key: 'cs',
21367
21681
  ref: 'customWrapper',
21368
21682
  props: {
21369
21683
  customStore
@@ -21373,6 +21687,7 @@ function handleUupdateResize(_vm) {
21373
21687
  * 筛选
21374
21688
  */
21375
21689
  initStore.filter ? h(filter_panel, {
21690
+ key: 'tf',
21376
21691
  ref: 'filterWrapper',
21377
21692
  props: {
21378
21693
  filterStore
@@ -21382,6 +21697,7 @@ function handleUupdateResize(_vm) {
21382
21697
  * 导入
21383
21698
  */
21384
21699
  initStore.import && this.importConfig ? h(import_panel, {
21700
+ key: 'it',
21385
21701
  props: {
21386
21702
  defaultOptions: this.importParams,
21387
21703
  storeData: this.importStore
@@ -21391,6 +21707,7 @@ function handleUupdateResize(_vm) {
21391
21707
  * 导出
21392
21708
  */
21393
21709
  initStore.export && (this.exportConfig || this.printConfig) ? h(export_panel, {
21710
+ key: 'et',
21394
21711
  props: {
21395
21712
  defaultOptions: this.exportParams,
21396
21713
  storeData: this.exportStore
@@ -21400,6 +21717,7 @@ function handleUupdateResize(_vm) {
21400
21717
  * 快捷菜单
21401
21718
  */
21402
21719
  ctxMenuStore.visible && this.isCtxMenu ? h(menu_panel, {
21720
+ key: 'tm',
21403
21721
  ref: 'ctxWrapper',
21404
21722
  props: {
21405
21723
  ctxMenuStore,
@@ -21410,6 +21728,7 @@ function handleUupdateResize(_vm) {
21410
21728
  * 通用提示
21411
21729
  */
21412
21730
  VxeUITooltipComponent ? h(VxeUITooltipComponent, {
21731
+ key: 'ctp',
21413
21732
  ref: 'commTip',
21414
21733
  props: {
21415
21734
  isArrow: false,
@@ -21420,6 +21739,7 @@ function handleUupdateResize(_vm) {
21420
21739
  * 工具提示
21421
21740
  */
21422
21741
  VxeUITooltipComponent ? h(VxeUITooltipComponent, {
21742
+ key: 'btp',
21423
21743
  ref: 'tooltip',
21424
21744
  props: Object.assign({}, this.tipConfig, this.tooltipStore.currOpts)
21425
21745
  }) : _e(),
@@ -21427,6 +21747,7 @@ function handleUupdateResize(_vm) {
21427
21747
  * 校验提示
21428
21748
  */
21429
21749
  VxeUITooltipComponent && this.editRules && validOpts.showMessage && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip') ? h(VxeUITooltipComponent, {
21750
+ key: 'vtp',
21430
21751
  ref: 'validTip',
21431
21752
  class: [{
21432
21753
  'old-cell-valid': editRules && table_getConfig().cellVaildMode === 'obsolete'
@@ -21451,7 +21772,7 @@ const {
21451
21772
  getI18n: toolbar_getI18n,
21452
21773
  renderer: toolbar_renderer,
21453
21774
  commands: toolbar_commands,
21454
- createEvent,
21775
+ createEvent: toolbar_createEvent,
21455
21776
  globalMixins: toolbar_globalMixins,
21456
21777
  renderEmptyElement: toolbar_renderEmptyElement
21457
21778
  } = core_.VxeUI;
@@ -21566,7 +21887,7 @@ const {
21566
21887
  //
21567
21888
  dispatchEvent(type, params, evnt) {
21568
21889
  const $xeToolbar = this;
21569
- $xeToolbar.$emit(type, createEvent(evnt, {
21890
+ $xeToolbar.$emit(type, toolbar_createEvent(evnt, {
21570
21891
  $toolbar: $xeToolbar
21571
21892
  }, params));
21572
21893
  },
@@ -25415,11 +25736,11 @@ const Toolbar = VxeToolbar;
25415
25736
  clearSort: '清除排序',
25416
25737
  sortAsc: '升序',
25417
25738
  sortDesc: '降序',
25418
- fixedColumn: '锁定列',
25419
- fixedGroup: '锁定组',
25420
- cancelFixed: '取消锁定',
25421
- fixedLeft: '锁定左侧',
25422
- fixedRight: '锁定右侧',
25739
+ fixedColumn: '冻结列',
25740
+ fixedGroup: '冻结分组',
25741
+ cancelFixed: '取消冻结',
25742
+ fixedLeft: '冻结到左侧',
25743
+ fixedRight: '冻结到右侧',
25423
25744
  clearFilter: '清除筛选',
25424
25745
  textOption: '文本筛选',
25425
25746
  numberOption: '数值筛选'