vxe-table 3.12.10-beta.2 → 3.12.10-beta.21

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 (178) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/locale/lang/ar-EG.js +2 -1
  4. package/es/locale/lang/de-DE.js +2 -1
  5. package/es/locale/lang/en-US.js +2 -1
  6. package/es/locale/lang/es-ES.js +2 -1
  7. package/es/locale/lang/fr-FR.js +2 -1
  8. package/es/locale/lang/hu-HU.js +2 -1
  9. package/es/locale/lang/hy-AM.js +2 -1
  10. package/es/locale/lang/it-IT.js +2 -1
  11. package/es/locale/lang/ja-JP.js +2 -1
  12. package/es/locale/lang/ko-KR.js +2 -1
  13. package/es/locale/lang/nb-NO.js +2 -1
  14. package/es/locale/lang/pt-BR.js +2 -1
  15. package/es/locale/lang/ru-RU.js +4 -3
  16. package/es/locale/lang/th-TH.js +2 -1
  17. package/es/locale/lang/ug-CN.js +2 -1
  18. package/es/locale/lang/uk-UA.js +518 -517
  19. package/es/locale/lang/vi-VN.js +2 -1
  20. package/es/locale/lang/zh-CHT.js +2 -1
  21. package/es/locale/lang/zh-CN.js +2 -1
  22. package/es/style.css +1 -1
  23. package/es/style.min.css +1 -1
  24. package/es/table/module/edit/mixin.js +7 -7
  25. package/es/table/module/export/mixin.js +55 -32
  26. package/es/table/module/keyboard/mixin.js +68 -25
  27. package/es/table/module/menu/mixin.js +3 -1
  28. package/es/table/src/body.js +96 -64
  29. package/es/table/src/cell.js +3 -7
  30. package/es/table/src/column.js +2 -0
  31. package/es/table/src/columnInfo.js +1 -0
  32. package/es/table/src/footer.js +31 -6
  33. package/es/table/src/header.js +45 -141
  34. package/es/table/src/methods.js +918 -456
  35. package/es/table/src/props.js +6 -2
  36. package/es/table/src/table.js +299 -149
  37. package/es/table/src/util.js +67 -57
  38. package/es/table/style.css +299 -191
  39. package/es/table/style.min.css +1 -1
  40. package/es/ui/index.js +20 -10
  41. package/es/ui/src/log.js +1 -1
  42. package/es/vxe-table/style.css +299 -191
  43. package/es/vxe-table/style.min.css +1 -1
  44. package/lib/index.css +1 -1
  45. package/lib/index.min.css +1 -1
  46. package/lib/index.umd.js +1735 -1025
  47. package/lib/index.umd.min.js +1 -1
  48. package/lib/locale/lang/ar-EG.js +2 -1
  49. package/lib/locale/lang/ar-EG.min.js +1 -1
  50. package/lib/locale/lang/de-DE.js +2 -1
  51. package/lib/locale/lang/de-DE.min.js +1 -1
  52. package/lib/locale/lang/en-US.js +2 -1
  53. package/lib/locale/lang/en-US.min.js +1 -1
  54. package/lib/locale/lang/en-US.umd.js +2 -1
  55. package/lib/locale/lang/es-ES.js +2 -1
  56. package/lib/locale/lang/es-ES.min.js +1 -1
  57. package/lib/locale/lang/es-ES.umd.js +2 -1
  58. package/lib/locale/lang/fr-FR.js +2 -1
  59. package/lib/locale/lang/fr-FR.min.js +1 -1
  60. package/lib/locale/lang/hu-HU.js +2 -1
  61. package/lib/locale/lang/hu-HU.min.js +1 -1
  62. package/lib/locale/lang/hu-HU.umd.js +2 -1
  63. package/lib/locale/lang/hy-AM.js +2 -1
  64. package/lib/locale/lang/hy-AM.min.js +1 -1
  65. package/lib/locale/lang/it-IT.js +2 -1
  66. package/lib/locale/lang/it-IT.min.js +1 -1
  67. package/lib/locale/lang/ja-JP.js +2 -1
  68. package/lib/locale/lang/ja-JP.min.js +1 -1
  69. package/lib/locale/lang/ja-JP.umd.js +2 -1
  70. package/lib/locale/lang/ko-KR.js +2 -1
  71. package/lib/locale/lang/ko-KR.min.js +1 -1
  72. package/lib/locale/lang/ko-KR.umd.js +2 -1
  73. package/lib/locale/lang/nb-NO.js +2 -1
  74. package/lib/locale/lang/nb-NO.min.js +1 -1
  75. package/lib/locale/lang/pt-BR.js +2 -1
  76. package/lib/locale/lang/pt-BR.min.js +1 -1
  77. package/lib/locale/lang/pt-BR.umd.js +2 -1
  78. package/lib/locale/lang/ru-RU.js +4 -3
  79. package/lib/locale/lang/ru-RU.min.js +1 -1
  80. package/lib/locale/lang/ru-RU.umd.js +4 -3
  81. package/lib/locale/lang/th-TH.js +2 -1
  82. package/lib/locale/lang/th-TH.min.js +1 -1
  83. package/lib/locale/lang/ug-CN.js +2 -1
  84. package/lib/locale/lang/ug-CN.min.js +1 -1
  85. package/lib/locale/lang/uk-UA.js +518 -517
  86. package/lib/locale/lang/uk-UA.min.js +1 -1
  87. package/lib/locale/lang/uk-UA.umd.js +518 -517
  88. package/lib/locale/lang/vi-VN.js +2 -1
  89. package/lib/locale/lang/vi-VN.min.js +1 -1
  90. package/lib/locale/lang/zh-CHT.js +2 -1
  91. package/lib/locale/lang/zh-CHT.min.js +1 -1
  92. package/lib/locale/lang/zh-CHT.umd.js +2 -1
  93. package/lib/locale/lang/zh-CN.js +2 -1
  94. package/lib/locale/lang/zh-CN.min.js +1 -1
  95. package/lib/locale/lang/zh-CN.umd.js +2 -1
  96. package/lib/style.css +1 -1
  97. package/lib/style.min.css +1 -1
  98. package/lib/table/module/edit/mixin.js +12 -2
  99. package/lib/table/module/edit/mixin.min.js +1 -1
  100. package/lib/table/module/export/mixin.js +52 -27
  101. package/lib/table/module/export/mixin.min.js +1 -1
  102. package/lib/table/module/keyboard/mixin.js +73 -27
  103. package/lib/table/module/keyboard/mixin.min.js +1 -1
  104. package/lib/table/module/menu/mixin.js +3 -1
  105. package/lib/table/src/body.js +89 -60
  106. package/lib/table/src/body.min.js +1 -1
  107. package/lib/table/src/cell.js +3 -5
  108. package/lib/table/src/cell.min.js +1 -1
  109. package/lib/table/src/column.js +2 -0
  110. package/lib/table/src/column.min.js +1 -1
  111. package/lib/table/src/columnInfo.js +1 -0
  112. package/lib/table/src/columnInfo.min.js +1 -1
  113. package/lib/table/src/footer.js +26 -6
  114. package/lib/table/src/footer.min.js +1 -1
  115. package/lib/table/src/header.js +38 -153
  116. package/lib/table/src/header.min.js +1 -1
  117. package/lib/table/src/methods.js +1076 -551
  118. package/lib/table/src/methods.min.js +1 -1
  119. package/lib/table/src/props.js +6 -2
  120. package/lib/table/src/props.min.js +1 -1
  121. package/lib/table/src/table.js +269 -129
  122. package/lib/table/src/table.min.js +1 -1
  123. package/lib/table/src/util.js +80 -70
  124. package/lib/table/src/util.min.js +1 -1
  125. package/lib/table/style/style.css +299 -191
  126. package/lib/table/style/style.min.css +1 -1
  127. package/lib/ui/index.js +20 -10
  128. package/lib/ui/index.min.js +1 -1
  129. package/lib/ui/src/log.js +1 -1
  130. package/lib/ui/src/log.min.js +1 -1
  131. package/lib/vxe-table/style/style.css +299 -191
  132. package/lib/vxe-table/style/style.min.css +1 -1
  133. package/package.json +2 -2
  134. package/packages/locale/lang/ar-EG.ts +2 -1
  135. package/packages/locale/lang/de-DE.ts +2 -1
  136. package/packages/locale/lang/en-US.ts +2 -1
  137. package/packages/locale/lang/es-ES.ts +2 -1
  138. package/packages/locale/lang/fr-FR.ts +2 -1
  139. package/packages/locale/lang/hu-HU.ts +2 -1
  140. package/packages/locale/lang/hy-AM.ts +2 -1
  141. package/packages/locale/lang/it-IT.ts +2 -1
  142. package/packages/locale/lang/ja-JP.ts +2 -1
  143. package/packages/locale/lang/ko-KR.ts +2 -1
  144. package/packages/locale/lang/nb-NO.ts +2 -1
  145. package/packages/locale/lang/pt-BR.ts +2 -1
  146. package/packages/locale/lang/ru-RU.ts +4 -3
  147. package/packages/locale/lang/th-TH.ts +2 -1
  148. package/packages/locale/lang/ug-CN.ts +2 -1
  149. package/packages/locale/lang/uk-UA.ts +518 -517
  150. package/packages/locale/lang/vi-VN.ts +2 -1
  151. package/packages/locale/lang/zh-CHT.ts +2 -1
  152. package/packages/locale/lang/zh-CN.ts +2 -1
  153. package/packages/table/module/edit/mixin.ts +7 -7
  154. package/packages/table/module/export/mixin.ts +50 -27
  155. package/packages/table/module/keyboard/mixin.ts +65 -24
  156. package/packages/table/module/menu/mixin.ts +4 -1
  157. package/packages/table/src/body.ts +102 -61
  158. package/packages/table/src/cell.ts +3 -7
  159. package/packages/table/src/column.ts +7 -2
  160. package/packages/table/src/columnInfo.ts +1 -0
  161. package/packages/table/src/footer.ts +31 -6
  162. package/packages/table/src/header.ts +45 -141
  163. package/packages/table/src/methods.ts +957 -461
  164. package/packages/table/src/props.ts +6 -2
  165. package/packages/table/src/table.ts +325 -149
  166. package/packages/table/src/util.ts +75 -62
  167. package/packages/ui/index.ts +21 -9
  168. package/styles/components/table.scss +352 -260
  169. package/styles/theme/base.scss +4 -6
  170. package/styles/theme/dark.scss +1 -0
  171. package/styles/theme/light.scss +1 -0
  172. package/styles/variable.scss +1 -0
  173. /package/es/{iconfont.1736736807414.ttf → iconfont.1737182271148.ttf} +0 -0
  174. /package/es/{iconfont.1736736807414.woff → iconfont.1737182271148.woff} +0 -0
  175. /package/es/{iconfont.1736736807414.woff2 → iconfont.1737182271148.woff2} +0 -0
  176. /package/lib/{iconfont.1736736807414.ttf → iconfont.1737182271148.ttf} +0 -0
  177. /package/lib/{iconfont.1736736807414.woff → iconfont.1737182271148.woff} +0 -0
  178. /package/lib/{iconfont.1736736807414.woff2 → iconfont.1737182271148.woff2} +0 -0
@@ -1,5 +1,5 @@
1
1
  import XEUtils from 'xe-utils';
2
- import { browse, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft } from '../../ui/src/dom';
2
+ import { browse, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, getOffsetPos, setScrollTop, setScrollLeft } from '../../ui/src/dom';
3
3
  import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
4
4
  import { VxeUI } from '../../ui';
5
5
  import Cell from './cell';
@@ -196,7 +196,7 @@ function cacheColumnMap($xeTable) {
196
196
  fullColumnFieldData[field] = rest;
197
197
  }
198
198
  else {
199
- if (storage || (columnOpts.drag && (isCrossDrag || isSelfToChildDrag))) {
199
+ if ((storage && !type) || (columnOpts.drag && (isCrossDrag || isSelfToChildDrag))) {
200
200
  errLog('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field`]);
201
201
  }
202
202
  }
@@ -295,6 +295,63 @@ const updateScrollYStatus = ($xeTable, fullData) => {
295
295
  reactData.scrollYLoad = scrollYLoad;
296
296
  return scrollYLoad;
297
297
  };
298
+ function updateAfterListIndex($xeTable) {
299
+ const internalData = $xeTable;
300
+ const { afterFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData;
301
+ const fullMaps = {};
302
+ afterFullData.forEach((row, index) => {
303
+ const rowid = getRowid($xeTable, row);
304
+ const rowRest = fullAllDataRowIdData[rowid];
305
+ const seq = index + 1;
306
+ if (rowRest) {
307
+ rowRest.seq = seq;
308
+ rowRest._index = index;
309
+ }
310
+ else {
311
+ const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 };
312
+ fullAllDataRowIdData[rowid] = rest;
313
+ fullDataRowIdData[rowid] = rest;
314
+ }
315
+ fullMaps[rowid] = row;
316
+ });
317
+ internalData.afterFullRowMaps = fullMaps;
318
+ }
319
+ /**
320
+ * 预编译
321
+ * 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
322
+ */
323
+ function updateAfterDataIndex($xeTable) {
324
+ const props = $xeTable;
325
+ const internalData = $xeTable;
326
+ const { treeConfig } = props;
327
+ const { fullDataRowIdData, fullAllDataRowIdData, afterTreeFullData } = internalData;
328
+ const treeOpts = $xeTable.computeTreeOpts;
329
+ const { transform } = treeOpts;
330
+ const childrenField = treeOpts.children || treeOpts.childrenField;
331
+ const fullMaps = {};
332
+ if (treeConfig) {
333
+ XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
334
+ const rowid = getRowid($xeTable, row);
335
+ const rowRest = fullAllDataRowIdData[rowid];
336
+ const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('');
337
+ if (rowRest) {
338
+ rowRest.seq = seq;
339
+ rowRest.treeIndex = index;
340
+ }
341
+ else {
342
+ const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 };
343
+ fullAllDataRowIdData[rowid] = rest;
344
+ fullDataRowIdData[rowid] = rest;
345
+ }
346
+ fullMaps[rowid] = row;
347
+ }, { children: transform ? treeOpts.mapChildrenField : childrenField });
348
+ internalData.afterFullRowMaps = fullMaps;
349
+ updateAfterListIndex($xeTable);
350
+ }
351
+ else {
352
+ updateAfterListIndex($xeTable);
353
+ }
354
+ }
298
355
  /**
299
356
  * 如果为虚拟树,将树结构拍平
300
357
  * @returns
@@ -334,13 +391,15 @@ function updateStyle($xeTable) {
334
391
  const reactData = $xeTable;
335
392
  const internalData = $xeTable;
336
393
  const { border, showOverflow: allColumnOverflow, showHeaderOverflow: allColumnHeaderOverflow, showFooterOverflow: allColumnFooterOverflow, mouseConfig, spanMethod, footerSpanMethod } = props;
337
- const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, scrollbarWidth, scrollbarHeight, columnStore, editStore, isAllOverflow, expandColumn } = reactData;
394
+ const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, overflowX, scrollbarWidth, overflowY, scrollbarHeight, columnStore, editStore, isAllOverflow, expandColumn } = reactData;
338
395
  const { visibleColumn, fullColumnIdData, tableHeight, tableWidth, headerHeight, footerHeight, elemStore, customHeight, customMinHeight, customMaxHeight } = internalData;
339
396
  const el = $xeTable.$refs.refElem;
340
397
  if (!el) {
341
398
  return;
342
399
  }
343
400
  const containerList = ['main', 'left', 'right'];
401
+ const osbWidth = overflowY ? scrollbarWidth : 0;
402
+ const osbHeight = overflowX ? scrollbarHeight : 0;
344
403
  const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder;
345
404
  const cellOffsetWidth = $xeTable.computeCellOffsetWidth;
346
405
  const mouseOpts = $xeTable.computeMouseOpts;
@@ -348,16 +407,16 @@ function updateStyle($xeTable) {
348
407
  const bodyTableElem = getRefElem(elemStore['main-body-table']);
349
408
  if (emptyPlaceholderElem) {
350
409
  emptyPlaceholderElem.style.top = `${headerHeight}px`;
351
- emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - scrollbarHeight}px` : '';
410
+ emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : '';
352
411
  }
353
412
  let bodyHeight = 0;
354
413
  let bodyMaxHeight = 0;
355
- const bodyMinHeight = customMinHeight - headerHeight - footerHeight - scrollbarHeight;
414
+ const bodyMinHeight = customMinHeight - headerHeight - footerHeight - osbHeight;
356
415
  if (customMaxHeight) {
357
- bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - scrollbarHeight);
416
+ bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - osbHeight);
358
417
  }
359
418
  if (customHeight) {
360
- bodyHeight = customHeight - headerHeight - footerHeight - scrollbarHeight;
419
+ bodyHeight = customHeight - headerHeight - footerHeight - osbHeight;
361
420
  }
362
421
  if (!bodyHeight) {
363
422
  if (bodyTableElem) {
@@ -370,35 +429,42 @@ function updateStyle($xeTable) {
370
429
  }
371
430
  bodyHeight = Math.max(bodyMinHeight, bodyHeight);
372
431
  }
432
+ const xLeftCornerEl = $xeTable.$refs.refScrollXLeftCornerElem;
433
+ const xRightCornerEl = $xeTable.$refs.refScrollXRightCornerElem;
434
+ const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
373
435
  const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem;
374
436
  if (scrollXVirtualEl) {
375
- scrollXVirtualEl.style.height = `${scrollbarHeight}px`;
376
- scrollXVirtualEl.style.visibility = scrollbarHeight ? 'visible' : 'hidden';
437
+ scrollXVirtualEl.style.height = `${osbHeight}px`;
438
+ scrollXVirtualEl.style.visibility = overflowX ? 'visible' : 'hidden';
377
439
  }
378
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
379
- if (xHandleEl) {
380
- xHandleEl.style.width = `${el.clientWidth - scrollbarWidth}px`;
440
+ const xWrapperEl = $xeTable.$refs.refScrollXWrapperElem;
441
+ if (xWrapperEl) {
442
+ xWrapperEl.style.left = scrollbarXToTop ? `${osbWidth}px` : '';
443
+ xWrapperEl.style.width = `${el.clientWidth - osbWidth}px`;
444
+ }
445
+ if (xLeftCornerEl) {
446
+ xLeftCornerEl.style.width = scrollbarXToTop ? `${osbWidth}px` : '';
447
+ xLeftCornerEl.style.display = scrollbarXToTop ? (osbWidth && osbHeight ? 'block' : '') : '';
381
448
  }
382
- const xRightCornerEl = $xeTable.$refs.refScrollXRightCornerElem;
383
449
  if (xRightCornerEl) {
384
- xRightCornerEl.style.width = `${scrollbarWidth}px`;
385
- xRightCornerEl.style.display = scrollbarWidth && scrollbarHeight ? 'block' : '';
450
+ xRightCornerEl.style.width = scrollbarXToTop ? '' : `${osbWidth}px`;
451
+ xRightCornerEl.style.display = scrollbarXToTop ? '' : (osbWidth && osbHeight ? 'block' : '');
386
452
  }
387
453
  const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem;
388
454
  if (scrollYVirtualEl) {
389
- scrollYVirtualEl.style.width = `${scrollbarWidth}px`;
455
+ scrollYVirtualEl.style.width = `${osbWidth}px`;
390
456
  scrollYVirtualEl.style.height = `${bodyHeight + headerHeight + footerHeight}px`;
391
- scrollYVirtualEl.style.visibility = scrollbarWidth ? 'visible' : 'hidden';
457
+ scrollYVirtualEl.style.visibility = overflowY ? 'visible' : 'hidden';
392
458
  }
393
459
  const yTopCornerEl = $xeTable.$refs.refScrollYTopCornerElem;
394
460
  if (yTopCornerEl) {
395
461
  yTopCornerEl.style.height = `${headerHeight}px`;
396
462
  yTopCornerEl.style.display = headerHeight ? 'block' : '';
397
463
  }
398
- const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
399
- if (yHandleEl) {
400
- yHandleEl.style.height = `${bodyHeight}px`;
401
- yHandleEl.style.top = `${headerHeight}px`;
464
+ const yWrapperEl = $xeTable.$refs.refScrollYWrapperElem;
465
+ if (yWrapperEl) {
466
+ yWrapperEl.style.height = `${bodyHeight}px`;
467
+ yWrapperEl.style.top = `${headerHeight}px`;
402
468
  }
403
469
  const yBottomCornerEl = $xeTable.$refs.refScrollYBottomCornerElem;
404
470
  if (yBottomCornerEl) {
@@ -506,7 +572,7 @@ function updateStyle($xeTable) {
506
572
  if (wrapperElem) {
507
573
  wrapperElem.style.top = `${headerHeight}px`;
508
574
  }
509
- fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + headerHeight + footerHeight + scrollbarHeight)}px`;
575
+ fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + headerHeight + footerHeight + osbHeight)}px`;
510
576
  fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`;
511
577
  }
512
578
  let tWidth = tableWidth;
@@ -536,7 +602,7 @@ function updateStyle($xeTable) {
536
602
  if (tableElem) {
537
603
  tableElem.style.width = tWidth ? `${tWidth}px` : '';
538
604
  // 兼容性处理
539
- tableElem.style.paddingRight = scrollbarWidth && fixedType && (browse['-moz'] || browse.safari) ? `${scrollbarWidth}px` : '';
605
+ tableElem.style.paddingRight = osbWidth && fixedType && (browse['-moz'] || browse.safari) ? `${osbWidth}px` : '';
540
606
  }
541
607
  const emptyBlockElem = getRefElem(elemStore[`${name}-${layout}-emptyBlock`]);
542
608
  if (emptyBlockElem) {
@@ -573,7 +639,7 @@ function updateStyle($xeTable) {
573
639
  // 如果是固定列
574
640
  if (fixedWrapperElem) {
575
641
  if (wrapperElem) {
576
- wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight - scrollbarHeight : tableHeight + headerHeight}px`;
642
+ wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight - osbHeight : tableHeight + headerHeight}px`;
577
643
  }
578
644
  }
579
645
  }
@@ -642,52 +708,62 @@ function updateStyle($xeTable) {
642
708
  return $xeTable.$nextTick();
643
709
  }
644
710
  function computeRowHeight($xeTable) {
711
+ const props = $xeTable;
712
+ const { showOverflow } = props;
645
713
  const tableHeader = $xeTable.$refs.refTableHeader;
646
714
  const tableBody = $xeTable.$refs.refTableBody;
647
715
  const tableBodyElem = tableBody ? tableBody.$el : null;
648
716
  const defaultRowHeight = $xeTable.computeDefaultRowHeight;
649
717
  let rowHeight = 0;
650
- if (tableBodyElem) {
651
- const tableHeaderElem = tableHeader ? tableHeader.$el : null;
652
- let firstTrElem;
653
- firstTrElem = tableBodyElem.querySelector('tr');
654
- if (!firstTrElem && tableHeaderElem) {
655
- firstTrElem = tableHeaderElem.querySelector('tr');
718
+ if (showOverflow) {
719
+ if (tableBodyElem) {
720
+ const tableHeaderElem = tableHeader ? tableHeader.$el : null;
721
+ let firstTrElem;
722
+ firstTrElem = tableBodyElem.querySelector('tr');
723
+ if (!firstTrElem && tableHeaderElem) {
724
+ firstTrElem = tableHeaderElem.querySelector('tr');
725
+ }
726
+ if (firstTrElem) {
727
+ rowHeight = firstTrElem.clientHeight;
728
+ }
656
729
  }
657
- if (firstTrElem) {
658
- rowHeight = firstTrElem.clientHeight;
730
+ if (!rowHeight) {
731
+ rowHeight = defaultRowHeight;
659
732
  }
660
733
  }
661
- if (!rowHeight) {
734
+ else {
662
735
  rowHeight = defaultRowHeight;
663
736
  }
664
737
  // 最低支持 18px 行高
665
738
  return Math.max(18, rowHeight);
666
739
  }
667
- function handleVirtualYVisible($xeTable) {
740
+ function handleVirtualYVisible($xeTable, currScrollTop) {
668
741
  const props = $xeTable;
669
- const reactData = $xeTable;
670
742
  const internalData = $xeTable;
671
743
  const { showOverflow } = props;
672
- const { rowHeight } = reactData;
673
- const { elemStore, afterFullData, fullAllDataRowIdData } = internalData;
744
+ const { elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData;
745
+ const rowOpts = $xeTable.computeRowOpts;
746
+ const cellOpts = $xeTable.computeCellOpts;
747
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
674
748
  const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
675
749
  if (bodyScrollElem) {
676
- const { scrollTop, clientHeight } = bodyScrollElem;
750
+ const clientHeight = bodyScrollElem.clientHeight;
751
+ const scrollTop = XEUtils.isNumber(currScrollTop) ? currScrollTop : bodyScrollElem.scrollTop;
677
752
  const endHeight = scrollTop + clientHeight;
678
753
  let toVisibleIndex = -1;
679
754
  let offsetTop = 0;
680
755
  let visibleSize = 0;
681
- if (showOverflow) {
682
- toVisibleIndex = Math.floor(scrollTop / rowHeight);
683
- visibleSize = Math.ceil(clientHeight / rowHeight) + 1;
756
+ const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
757
+ if (!isCustomCellHeight && showOverflow) {
758
+ toVisibleIndex = Math.floor(scrollTop / defaultRowHeight);
759
+ visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
684
760
  }
685
761
  else {
686
762
  for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
687
763
  const row = afterFullData[rIndex];
688
764
  const rowid = getRowid($xeTable, row);
689
765
  const rowRest = fullAllDataRowIdData[rowid];
690
- offsetTop += rowRest ? (rowRest.height || rowHeight) : rowHeight;
766
+ offsetTop += rowRest ? (rowRest.resizeHeight || cellOpts.height || rowOpts.height || defaultRowHeight) : defaultRowHeight;
691
767
  if (toVisibleIndex === -1 && scrollTop < offsetTop) {
692
768
  toVisibleIndex = rIndex;
693
769
  }
@@ -939,7 +1015,7 @@ function autoCellWidth($xeTable) {
939
1015
  }
940
1016
  const tableHeight = bodyElem.offsetHeight;
941
1017
  const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight;
942
- reactData.scrollbarWidth = overflowY ? Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth) : 0;
1018
+ reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth);
943
1019
  reactData.overflowY = overflowY;
944
1020
  internalData.tableWidth = tableWidth;
945
1021
  internalData.tableHeight = tableHeight;
@@ -948,7 +1024,7 @@ function autoCellWidth($xeTable) {
948
1024
  const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0;
949
1025
  const overflowX = tableWidth > bodyWidth;
950
1026
  const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0;
951
- reactData.scrollbarHeight = overflowX ? Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight) : 0;
1027
+ reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight);
952
1028
  internalData.headerHeight = headerHeight;
953
1029
  internalData.footerHeight = footerHeight;
954
1030
  reactData.overflowX = overflowX;
@@ -958,61 +1034,42 @@ function autoCellWidth($xeTable) {
958
1034
  $xeTable.checkScrolling();
959
1035
  }
960
1036
  }
961
- // const updateCellOffset = ($xeTable: VxeTableConstructor) => {
962
- // const internalData = $xeTable as unknown as TableInternalData
963
- // const { chTimeout, chRunTime } = internalData
964
- // if (chTimeout) {
965
- // clearTimeout(chTimeout)
966
- // }
967
- // if (!chRunTime || chRunTime + 10 < Date.now()) {
968
- // internalData.chRunTime = Date.now()
969
- // }
970
- // internalData.chTimeout = setTimeout(() => {
971
- // internalData.chRunTime = undefined
972
- // internalData.chTimeout = undefined
973
- // }, 80)
974
- // }
1037
+ const calcCellAutoHeight = (rowRest, wrapperEl) => {
1038
+ const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);
1039
+ let topBottomPadding = 0;
1040
+ const firstCellEl = cellElemList[0];
1041
+ if (firstCellEl && firstCellEl.parentElement) {
1042
+ const cellStyle = getComputedStyle(firstCellEl.parentElement);
1043
+ topBottomPadding = Math.ceil(XEUtils.toNumber(cellStyle.paddingTop) + XEUtils.toNumber(cellStyle.paddingBottom));
1044
+ }
1045
+ let colHeight = rowRest.height - topBottomPadding;
1046
+ for (let i = 0; i < cellElemList.length; i++) {
1047
+ const cellElem = cellElemList[i];
1048
+ const cellHeight = cellElem ? cellElem.clientHeight : 0;
1049
+ colHeight = Math.max(colHeight, Math.ceil(cellHeight));
1050
+ }
1051
+ return colHeight + topBottomPadding;
1052
+ };
975
1053
  const calcCellHeight = ($xeTable) => {
976
1054
  const props = $xeTable;
977
1055
  const reactData = $xeTable;
978
1056
  const internalData = $xeTable;
979
1057
  const { showOverflow } = props;
980
- const { tableData, scrollXLoad } = reactData;
1058
+ const { tableData, scrollYLoad, scrollXLoad } = reactData;
981
1059
  const { fullAllDataRowIdData } = internalData;
1060
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
982
1061
  const el = $xeTable.$refs.refElem;
983
- if (!showOverflow && el) {
984
- let paddingTop = 0;
985
- let paddingBottom = 0;
986
- let calcPadding = false;
1062
+ if (!showOverflow && scrollYLoad && el) {
987
1063
  tableData.forEach(row => {
988
1064
  const rowid = getRowid($xeTable, row);
989
1065
  const rowRest = fullAllDataRowIdData[rowid];
990
- const cellList = el.querySelectorAll(`.vxe-body--row[rowid="${rowid}"]>.vxe-body--column>.vxe-cell`);
991
- if (rowRest && cellList.length) {
992
- let height = 0;
993
- for (let i = 0; i < cellList.length; i++) {
994
- const cellElem = cellList[i];
995
- const tdEl = cellElem.parentElement;
996
- if (!tdEl || !tdEl.clientWidth) {
997
- break;
998
- }
999
- if (!calcPadding) {
1000
- paddingTop = XEUtils.toNumber(getComputedStyle(tdEl).paddingTop);
1001
- paddingBottom = XEUtils.toNumber(getComputedStyle(tdEl).paddingBottom);
1002
- calcPadding = true;
1003
- }
1004
- let cellHeight = paddingTop + paddingBottom;
1005
- if (cellElem) {
1006
- cellHeight += cellElem.clientHeight;
1007
- }
1008
- height = Math.max(height, cellHeight);
1009
- }
1010
- rowRest.height = scrollXLoad ? Math.max(rowRest.height, height) : height;
1066
+ if (rowRest) {
1067
+ const height = calcCellAutoHeight(rowRest, el);
1068
+ rowRest.height = Math.max(defaultRowHeight, scrollXLoad ? Math.max(rowRest.height, height) : height);
1011
1069
  }
1012
1070
  });
1013
- reactData.isCalcCellHeight++;
1071
+ reactData.calcCellHeightFlag++;
1014
1072
  }
1015
- // updateCellOffset()
1016
1073
  };
1017
1074
  function getOrderField(_vm, column) {
1018
1075
  const { sortBy, sortType } = column;
@@ -1036,6 +1093,19 @@ function getOrderField(_vm, column) {
1036
1093
  return cellValue;
1037
1094
  };
1038
1095
  }
1096
+ function handleTargetEnterEvent($xeTable, isClear) {
1097
+ const internalData = $xeTable;
1098
+ const $tooltip = $xeTable.$refs.refTooltip;
1099
+ clearTimeout(internalData.tooltipTimeout);
1100
+ if (isClear) {
1101
+ $xeTable.closeTooltip();
1102
+ }
1103
+ else {
1104
+ if ($tooltip && $tooltip.setActived) {
1105
+ $tooltip.setActived(true);
1106
+ }
1107
+ }
1108
+ }
1039
1109
  function clearDragStatus($xeTable) {
1040
1110
  const reactData = $xeTable;
1041
1111
  const { dragRow, dragCol } = reactData;
@@ -1134,25 +1204,29 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
1134
1204
  if (!el) {
1135
1205
  return;
1136
1206
  }
1137
- const { scrollbarWidth, scrollbarHeight } = reactData;
1207
+ const { overflowX, scrollbarWidth, overflowY, scrollbarHeight } = reactData;
1138
1208
  const { prevDragToChild } = internalData;
1139
1209
  const wrapperRect = el.getBoundingClientRect();
1210
+ const osbWidth = overflowY ? scrollbarWidth : 0;
1211
+ const osbHeight = overflowX ? scrollbarHeight : 0;
1140
1212
  const tableWidth = el.clientWidth;
1141
1213
  const tableHeight = el.clientHeight;
1142
1214
  if (trEl) {
1143
1215
  const rdLineEl = $xeTable.$refs.refDragRowLineElem;
1144
1216
  if (rdLineEl) {
1145
1217
  if (showLine) {
1218
+ const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
1146
1219
  const trRect = trEl.getBoundingClientRect();
1147
1220
  let trHeight = trEl.clientHeight;
1148
1221
  const offsetTop = Math.max(1, trRect.y - wrapperRect.y);
1149
- if (offsetTop + trHeight > tableHeight - scrollbarHeight) {
1150
- trHeight = tableHeight - offsetTop - scrollbarHeight;
1222
+ if (offsetTop + trHeight > tableHeight - osbHeight) {
1223
+ trHeight = tableHeight - offsetTop - osbHeight;
1151
1224
  }
1152
1225
  rdLineEl.style.display = 'block';
1226
+ rdLineEl.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
1153
1227
  rdLineEl.style.top = `${offsetTop}px`;
1154
1228
  rdLineEl.style.height = `${trHeight}px`;
1155
- rdLineEl.style.width = `${tableWidth - scrollbarWidth}px`;
1229
+ rdLineEl.style.width = `${tableWidth - osbWidth}px`;
1156
1230
  rdLineEl.setAttribute('drag-pos', dragPos);
1157
1231
  rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
1158
1232
  }
@@ -1165,6 +1239,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
1165
1239
  const cdLineEl = $xeTable.$refs.refDragColLineElem;
1166
1240
  if (cdLineEl) {
1167
1241
  if (showLine) {
1242
+ const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
1168
1243
  const leftContainerElem = $xeTable.$refs.refLeftContainer;
1169
1244
  const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
1170
1245
  const rightContainerElem = $xeTable.$refs.refRightContainer;
@@ -1178,7 +1253,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
1178
1253
  thWidth -= startX - offsetLeft;
1179
1254
  offsetLeft = startX;
1180
1255
  }
1181
- const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 : scrollbarWidth);
1256
+ const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 : osbWidth);
1182
1257
  if (offsetLeft + thWidth > endX) {
1183
1258
  thWidth = endX - offsetLeft;
1184
1259
  }
@@ -1190,7 +1265,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
1190
1265
  cdLineEl.style.height = `${thRect.height}px`;
1191
1266
  }
1192
1267
  else {
1193
- cdLineEl.style.height = `${tableHeight - offsetTop - scrollbarHeight}px`;
1268
+ cdLineEl.style.height = `${tableHeight - offsetTop - (scrollbarXToTop ? 0 : osbHeight)}px`;
1194
1269
  }
1195
1270
  cdLineEl.setAttribute('drag-pos', dragPos);
1196
1271
  cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
@@ -1222,6 +1297,41 @@ function hideDropTip($xeTable) {
1222
1297
  cdLineEl.style.display = '';
1223
1298
  }
1224
1299
  }
1300
+ /**
1301
+ * 处理显示 tooltip
1302
+ * @param {Event} evnt 事件
1303
+ * @param {Row} row 行对象
1304
+ */
1305
+ function handleTooltip($xeTable, evnt, tdEl, overflowElem, tipElem, params) {
1306
+ const reactData = $xeTable;
1307
+ if (!overflowElem) {
1308
+ return $xeTable.$nextTick();
1309
+ }
1310
+ params.cell = tdEl;
1311
+ const { tooltipStore } = reactData;
1312
+ const tooltipOpts = $xeTable.computeTooltipOpts;
1313
+ const { column, row } = params;
1314
+ const { showAll, contentMethod } = tooltipOpts;
1315
+ const customContent = contentMethod ? contentMethod(params) : null;
1316
+ const useCustom = contentMethod && !XEUtils.eqNull(customContent);
1317
+ const content = useCustom ? customContent : XEUtils.toString(column.type === 'html' ? overflowElem.innerText : overflowElem.textContent).trim();
1318
+ const isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth;
1319
+ if (content && (showAll || useCustom || isCellOverflow)) {
1320
+ Object.assign(tooltipStore, {
1321
+ row,
1322
+ column,
1323
+ visible: true,
1324
+ currOpts: {}
1325
+ });
1326
+ $xeTable.$nextTick(() => {
1327
+ const $tooltip = $xeTable.$refs.refTooltip;
1328
+ if ($tooltip && $tooltip.open) {
1329
+ $tooltip.open(isCellOverflow ? overflowElem : (tipElem || overflowElem), formatText(content));
1330
+ }
1331
+ });
1332
+ }
1333
+ return $xeTable.$nextTick();
1334
+ }
1225
1335
  function handleScrollToRowColumn($xeTable, fieldOrColumn, row) {
1226
1336
  const internalData = $xeTable;
1227
1337
  const { fullColumnIdData } = internalData;
@@ -1238,13 +1348,13 @@ function computeScrollLoad($xeTable) {
1238
1348
  return $xeTable.$nextTick().then(() => {
1239
1349
  const { scrollXLoad, scrollYLoad } = reactData;
1240
1350
  const { scrollXStore, scrollYStore } = internalData;
1241
- const sYOpts = $xeTable.computeSYOpts;
1242
- const sXOpts = $xeTable.computeSXOpts;
1351
+ const virtualYOpts = $xeTable.computeVirtualYOpts;
1352
+ const virtualXOpts = $xeTable.computeVirtualXOpts;
1243
1353
  // 计算 X 逻辑
1244
1354
  if (scrollXLoad) {
1245
1355
  const { toVisibleIndex: toXVisibleIndex, visibleSize: visibleXSize } = handleVirtualXVisible($xeTable);
1246
- const offsetXSize = Math.max(0, sXOpts.oSize ? XEUtils.toNumber(sXOpts.oSize) : 0);
1247
- scrollXStore.preloadSize = 4;
1356
+ const offsetXSize = Math.max(0, virtualXOpts.oSize ? XEUtils.toNumber(virtualXOpts.oSize) : 0);
1357
+ scrollXStore.preloadSize = XEUtils.toNumber(virtualXOpts.preSize);
1248
1358
  scrollXStore.offsetSize = offsetXSize;
1249
1359
  scrollXStore.visibleSize = visibleXSize;
1250
1360
  scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
@@ -1257,15 +1367,14 @@ function computeScrollLoad($xeTable) {
1257
1367
  else {
1258
1368
  $xeTable.updateScrollXSpace();
1259
1369
  }
1260
- calcCellHeight($xeTable);
1261
1370
  // 计算 Y 逻辑
1262
1371
  const rowHeight = computeRowHeight($xeTable);
1263
1372
  scrollYStore.rowHeight = rowHeight;
1264
1373
  reactData.rowHeight = rowHeight;
1265
1374
  const { toVisibleIndex: toYVisibleIndex, visibleSize: visibleYSize } = handleVirtualYVisible($xeTable);
1266
1375
  if (scrollYLoad) {
1267
- const offsetYSize = Math.max(0, sYOpts.oSize ? XEUtils.toNumber(sYOpts.oSize) : 0);
1268
- scrollYStore.preloadSize = 2;
1376
+ const offsetYSize = Math.max(0, virtualYOpts.oSize ? XEUtils.toNumber(virtualYOpts.oSize) : 0);
1377
+ scrollYStore.preloadSize = XEUtils.toNumber(virtualYOpts.preSize);
1269
1378
  scrollYStore.offsetSize = offsetYSize;
1270
1379
  scrollYStore.visibleSize = visibleYSize;
1271
1380
  scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
@@ -1292,12 +1401,14 @@ function handleRecalculateLayout($xeTable, reFull) {
1292
1401
  }
1293
1402
  calcCellWidth($xeTable);
1294
1403
  autoCellWidth($xeTable);
1404
+ updateStyle($xeTable);
1295
1405
  return computeScrollLoad($xeTable).then(() => {
1296
1406
  if (reFull === true) {
1297
1407
  // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
1298
1408
  calcCellHeight($xeTable);
1299
1409
  calcCellWidth($xeTable);
1300
1410
  autoCellWidth($xeTable);
1411
+ updateStyle($xeTable);
1301
1412
  return computeScrollLoad($xeTable);
1302
1413
  }
1303
1414
  });
@@ -1544,7 +1655,7 @@ function handleColumn($xeTable, collectColumn) {
1544
1655
  /**
1545
1656
  * 纵向 Y 可视渲染处理
1546
1657
  */
1547
- function loadScrollYData($xeTable) {
1658
+ function loadScrollYData($xeTable, scrollTop) {
1548
1659
  const props = $xeTable;
1549
1660
  const reactData = $xeTable;
1550
1661
  const internalData = $xeTable;
@@ -1553,7 +1664,7 @@ function loadScrollYData($xeTable) {
1553
1664
  const { scrollYStore } = internalData;
1554
1665
  const { preloadSize, startIndex, endIndex, offsetSize } = scrollYStore;
1555
1666
  const autoOffsetYSize = showOverflow ? offsetSize : offsetSize + 1;
1556
- const { toVisibleIndex, visibleSize } = handleVirtualYVisible($xeTable);
1667
+ const { toVisibleIndex, visibleSize } = handleVirtualYVisible($xeTable, scrollTop);
1557
1668
  const offsetItem = {
1558
1669
  startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
1559
1670
  endIndex: toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize
@@ -1570,6 +1681,42 @@ function loadScrollYData($xeTable) {
1570
1681
  }
1571
1682
  }
1572
1683
  }
1684
+ function lazyScrollXData($xeTable) {
1685
+ const internalData = $xeTable;
1686
+ const { lxTimeout, lxRunTime, scrollXStore } = internalData;
1687
+ const { visibleSize } = scrollXStore;
1688
+ const fpsTime = Math.max(5, Math.min(10, Math.floor(visibleSize / 3)));
1689
+ if (lxTimeout) {
1690
+ clearTimeout(lxTimeout);
1691
+ }
1692
+ if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
1693
+ internalData.lxRunTime = Date.now();
1694
+ loadScrollXData($xeTable);
1695
+ }
1696
+ internalData.lxTimeout = setTimeout(() => {
1697
+ internalData.lxTimeout = undefined;
1698
+ internalData.lxRunTime = undefined;
1699
+ loadScrollXData($xeTable);
1700
+ }, fpsTime);
1701
+ }
1702
+ function lazyScrollYData($xeTable) {
1703
+ const internalData = $xeTable;
1704
+ const { lyTimeout, lyRunTime, scrollYStore } = internalData;
1705
+ const { visibleSize } = scrollYStore;
1706
+ const fpsTime = Math.floor(Math.max(4, Math.min(10, visibleSize / 3)));
1707
+ if (lyTimeout) {
1708
+ clearTimeout(lyTimeout);
1709
+ }
1710
+ if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
1711
+ internalData.lyRunTime = Date.now();
1712
+ loadScrollYData($xeTable);
1713
+ }
1714
+ internalData.lyTimeout = setTimeout(() => {
1715
+ internalData.lyTimeout = undefined;
1716
+ internalData.lyRunTime = undefined;
1717
+ loadScrollYData($xeTable);
1718
+ }, fpsTime);
1719
+ }
1573
1720
  function checkLastSyncScroll($xeTable, isRollX, isRollY) {
1574
1721
  const reactData = $xeTable;
1575
1722
  const internalData = $xeTable;
@@ -1581,27 +1728,68 @@ function checkLastSyncScroll($xeTable, isRollX, isRollY) {
1581
1728
  internalData.lcsTimeout = setTimeout(() => {
1582
1729
  internalData.lcsRunTime = Date.now();
1583
1730
  internalData.lcsTimeout = undefined;
1731
+ internalData.intoRunScroll = false;
1584
1732
  internalData.inVirtualScroll = false;
1585
1733
  internalData.inWheelScroll = false;
1586
1734
  internalData.inHeaderScroll = false;
1587
1735
  internalData.inBodyScroll = false;
1588
1736
  internalData.inFooterScroll = false;
1589
1737
  internalData.scrollRenderType = '';
1738
+ calcCellHeight($xeTable);
1590
1739
  if (isRollX && scrollXLoad) {
1591
- $xeTable.updateScrollXData().then(() => {
1592
- calcCellHeight($xeTable);
1593
- loadScrollXData($xeTable);
1594
- });
1740
+ $xeTable.updateScrollXData();
1595
1741
  }
1596
1742
  if (isRollY && scrollYLoad) {
1597
1743
  $xeTable.updateScrollYData().then(() => {
1598
1744
  calcCellHeight($xeTable);
1599
- loadScrollYData($xeTable);
1745
+ $xeTable.updateScrollYSpace();
1600
1746
  });
1601
1747
  }
1602
1748
  $xeTable.updateCellAreas();
1603
1749
  }, 200);
1604
1750
  }
1751
+ const getWheelSpeed = (lastScrollTime) => {
1752
+ let multiple = 1;
1753
+ const currTime = Date.now();
1754
+ if (lastScrollTime + 25 > currTime) {
1755
+ multiple = 1.18;
1756
+ }
1757
+ else if (lastScrollTime + 30 > currTime) {
1758
+ multiple = 1.15;
1759
+ }
1760
+ else if (lastScrollTime + 40 > currTime) {
1761
+ multiple = 1.12;
1762
+ }
1763
+ else if (lastScrollTime + 55 > currTime) {
1764
+ multiple = 1.09;
1765
+ }
1766
+ else if (lastScrollTime + 75 > currTime) {
1767
+ multiple = 1.06;
1768
+ }
1769
+ else if (lastScrollTime + 100 > currTime) {
1770
+ multiple = 1.03;
1771
+ }
1772
+ return multiple;
1773
+ };
1774
+ const wheelScrollTo = (diffNum, cb) => {
1775
+ const duration = Math.abs(diffNum);
1776
+ const startTime = performance.now();
1777
+ let countTop = 0;
1778
+ const step = (timestamp) => {
1779
+ let progress = (timestamp - startTime) / duration;
1780
+ if (progress > 1) {
1781
+ progress = 1;
1782
+ }
1783
+ const easedProgress = Math.pow(progress, 2);
1784
+ const offsetTop = Math.floor((diffNum * easedProgress)) - countTop;
1785
+ countTop += offsetTop;
1786
+ cb(offsetTop);
1787
+ if (progress < 1) {
1788
+ requestAnimationFrame(step);
1789
+ }
1790
+ };
1791
+ requestAnimationFrame(step);
1792
+ };
1605
1793
  function updateHeight($xeTable) {
1606
1794
  const internalData = $xeTable;
1607
1795
  internalData.customHeight = calcTableHeight($xeTable, 'height');
@@ -1609,58 +1797,60 @@ function updateHeight($xeTable) {
1609
1797
  internalData.customMaxHeight = calcTableHeight($xeTable, 'maxHeight');
1610
1798
  }
1611
1799
  function calcColumnAutoWidth(column, wrapperEl) {
1612
- const cellElList = wrapperEl.querySelectorAll(`.vxe-header--column.${column.id}>.vxe-cell,.vxe-body--column.${column.id}>.vxe-cell,.vxe-footer--column.${column.id}>.vxe-cell`);
1613
- const firstCellEl = cellElList[0];
1614
- let paddingSize = 0;
1615
- if (firstCellEl) {
1616
- const cellStyle = getComputedStyle(firstCellEl);
1617
- paddingSize = Math.floor(XEUtils.toNumber(cellStyle.paddingLeft) + XEUtils.toNumber(cellStyle.paddingRight)) + 2;
1800
+ const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[colid="${column.id}"]`);
1801
+ let leftRightPadding = 0;
1802
+ const firstCellEl = cellElemList[0];
1803
+ if (firstCellEl && firstCellEl.parentElement) {
1804
+ const cellStyle = getComputedStyle(firstCellEl.parentElement);
1805
+ leftRightPadding = Math.ceil(XEUtils.toNumber(cellStyle.paddingLeft) + XEUtils.toNumber(cellStyle.paddingRight));
1618
1806
  }
1619
- let colWidth = column.renderAutoWidth - paddingSize;
1620
- XEUtils.arrayEach(cellElList, (itemEl) => {
1621
- const cellEl = itemEl;
1622
- const thElem = cellEl.parentElement;
1623
- let titleWidth = 0;
1624
- if (`${thElem.tagName}`.toLowerCase() === 'th') {
1625
- XEUtils.arrayEach(cellEl.children, (btnEl) => {
1626
- titleWidth += btnEl.offsetWidth + 1;
1627
- });
1628
- }
1629
- else {
1630
- const labelEl = cellEl.firstElementChild;
1631
- if (labelEl) {
1632
- titleWidth = labelEl.offsetWidth;
1633
- }
1634
- }
1635
- if (titleWidth) {
1636
- colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4);
1637
- }
1638
- });
1639
- return colWidth + paddingSize;
1807
+ let colWidth = column.renderAutoWidth - leftRightPadding;
1808
+ for (let i = 0; i < cellElemList.length; i++) {
1809
+ const celEl = cellElemList[i];
1810
+ colWidth = Math.max(colWidth, celEl ? Math.ceil(celEl.scrollWidth) + 4 : 0);
1811
+ }
1812
+ return colWidth + leftRightPadding;
1640
1813
  }
1641
1814
  function calcCellWidth($xeTable) {
1642
- const reactData = $xeTable;
1643
1815
  const internalData = $xeTable;
1644
1816
  const autoWidthColumnList = $xeTable.computeAutoWidthColumnList;
1645
- reactData.isCalcColumn = true;
1646
- return $xeTable.$nextTick().then(() => {
1647
- const { fullColumnIdData } = internalData;
1648
- const el = $xeTable.$refs.refElem;
1649
- if (el) {
1650
- autoWidthColumnList.forEach(column => {
1651
- const colid = column.id;
1652
- const colRest = fullColumnIdData[colid];
1653
- const colWidth = calcColumnAutoWidth(column, el);
1654
- if (colRest) {
1655
- colRest.width = Math.max(colWidth, colRest.width);
1656
- }
1657
- column.renderAutoWidth = colWidth;
1658
- });
1659
- $xeTable.analyColumnWidth();
1660
- }
1661
- reactData.isCalcColumn = false;
1662
- });
1817
+ const { fullColumnIdData } = internalData;
1818
+ const el = $xeTable.$refs.refElem;
1819
+ if (el) {
1820
+ el.setAttribute('data-calc-col', 'Y');
1821
+ autoWidthColumnList.forEach(column => {
1822
+ const colid = column.id;
1823
+ const colRest = fullColumnIdData[colid];
1824
+ const colWidth = calcColumnAutoWidth(column, el);
1825
+ if (colRest) {
1826
+ colRest.width = Math.max(colWidth, colRest.width);
1827
+ }
1828
+ column.renderAutoWidth = colWidth;
1829
+ });
1830
+ $xeTable.analyColumnWidth();
1831
+ el.removeAttribute('data-calc-col');
1832
+ }
1663
1833
  }
1834
+ const handleUpdateColResize = ($xeTable, evnt, params) => {
1835
+ $xeTable.analyColumnWidth();
1836
+ $xeTable.recalculate(true).then(() => {
1837
+ $xeTable.saveCustomStore('update:width');
1838
+ $xeTable.updateCellAreas();
1839
+ $xeTable.dispatchEvent('column-resizable-change', params, evnt);
1840
+ // 已废弃 resizable-change
1841
+ $xeTable.dispatchEvent('resizable-change', params, evnt);
1842
+ setTimeout(() => $xeTable.recalculate(true), 300);
1843
+ });
1844
+ };
1845
+ const handleUpdateRowResize = ($xeTable, evnt, params) => {
1846
+ const reactData = $xeTable;
1847
+ reactData.resizeHeightFlag++;
1848
+ $xeTable.recalculate(true).then(() => {
1849
+ $xeTable.updateCellAreas();
1850
+ $xeTable.dispatchEvent('row-resizable-change', params, evnt);
1851
+ setTimeout(() => $xeTable.recalculate(true), 300);
1852
+ });
1853
+ };
1664
1854
  const Methods = {
1665
1855
  callSlot(slotFunc, params, h, vNodes) {
1666
1856
  if (slotFunc) {
@@ -1714,7 +1904,7 @@ const Methods = {
1714
1904
  warnLog('vxe.error.delFunc', ['syncData', 'getData']);
1715
1905
  return this.$nextTick().then(() => {
1716
1906
  this.tableData = [];
1717
- return this.$nextTick().then(() => this.loadTableData(this.tableFullData));
1907
+ return this.$nextTick().then(() => this.loadTableData(this.tableFullData, true));
1718
1908
  });
1719
1909
  },
1720
1910
  /**
@@ -1768,8 +1958,9 @@ const Methods = {
1768
1958
  * 加载表格数据
1769
1959
  * @param {Array} datas 数据
1770
1960
  */
1771
- loadTableData(datas) {
1961
+ loadTableData(datas, isReset) {
1772
1962
  const $xeTable = this;
1963
+ const internalData = $xeTable;
1773
1964
  const { keepSource, showOverflow, treeConfig, treeOpts, editStore, scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop, scrollYLoad: oldScrollYLoad, sXOpts, sYOpts } = this;
1774
1965
  const childrenField = treeOpts.children || treeOpts.childrenField;
1775
1966
  const rowOpts = $xeTable.computeRowOpts;
@@ -1825,9 +2016,12 @@ const Methods = {
1825
2016
  this.tableFullData = fullData;
1826
2017
  this.tableFullTreeData = treeData;
1827
2018
  // 缓存数据
1828
- this.cacheRowMap(true);
2019
+ this.cacheRowMap(isReset, true);
1829
2020
  // 原始数据
1830
2021
  this.tableSynchData = datas;
2022
+ if (isReset) {
2023
+ internalData.isResizeCellHeight = false;
2024
+ }
1831
2025
  // 克隆原数据,用于显示编辑状态,与编辑值做对比
1832
2026
  if (keepSource) {
1833
2027
  this.cacheSourceMap(fullData);
@@ -1886,6 +2080,7 @@ const Methods = {
1886
2080
  if (sYOpts.scrollToTopOnChange) {
1887
2081
  targetScrollTop = 0;
1888
2082
  }
2083
+ calcCellHeight($xeTable);
1889
2084
  // 是否变更虚拟滚动
1890
2085
  if (oldScrollYLoad === sYLoad) {
1891
2086
  restoreScrollLocation(this, targetScrollLeft, targetScrollTop)
@@ -1911,7 +2106,7 @@ const Methods = {
1911
2106
  */
1912
2107
  loadData(datas) {
1913
2108
  const { initStatus } = this;
1914
- return this.loadTableData(datas).then(() => {
2109
+ return this.loadTableData(datas, false).then(() => {
1915
2110
  this.inited = true;
1916
2111
  this.initStatus = true;
1917
2112
  if (!initStatus) {
@@ -1929,7 +2124,7 @@ const Methods = {
1929
2124
  .then(() => {
1930
2125
  this.inited = true;
1931
2126
  this.initStatus = true;
1932
- return this.loadTableData(datas);
2127
+ return this.loadTableData(datas, true);
1933
2128
  })
1934
2129
  .then(() => {
1935
2130
  this.handleLoadDefaults();
@@ -2007,9 +2202,8 @@ const Methods = {
2007
2202
  },
2008
2203
  /**
2009
2204
  * 更新数据行的 Map
2010
- * 牺牲数据组装的耗时,用来换取使用过程中的流畅
2011
2205
  */
2012
- cacheRowMap(isSource) {
2206
+ cacheRowMap(isReset, isSource) {
2013
2207
  const { treeConfig, treeOpts, tableFullData, fullAllDataRowIdData, tableFullTreeData } = this;
2014
2208
  const childrenField = treeOpts.children || treeOpts.childrenField;
2015
2209
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
@@ -2029,8 +2223,8 @@ const Methods = {
2029
2223
  row[childrenField] = null;
2030
2224
  }
2031
2225
  let cacheItem = fullAllDataRowIdData[rowid];
2032
- if (!cacheItem) {
2033
- cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, items, parent: parentRow, level, height: 0, oTop: 0 };
2226
+ if (isReset || !cacheItem) {
2227
+ cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0 };
2034
2228
  }
2035
2229
  cacheItem.row = row;
2036
2230
  cacheItem.items = items;
@@ -2104,7 +2298,7 @@ const Methods = {
2104
2298
  XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
2105
2299
  const rowid = getRowid($xeTable, childRow);
2106
2300
  const parentRow = parentItem || parentRest.row;
2107
- const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, oTop: 0 };
2301
+ const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, treeIndex: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, resizeHeight: 0, oTop: 0 };
2108
2302
  fullDataRowIdData[rowid] = rest;
2109
2303
  fullAllDataRowIdData[rowid] = rest;
2110
2304
  }, { children: childrenField });
@@ -2112,7 +2306,7 @@ const Methods = {
2112
2306
  if (transform) {
2113
2307
  row[mapChildrenField] = XEUtils.clone(rows, false);
2114
2308
  }
2115
- this.updateAfterDataIndex();
2309
+ updateAfterDataIndex($xeTable);
2116
2310
  return rows;
2117
2311
  });
2118
2312
  },
@@ -2460,18 +2654,37 @@ const Methods = {
2460
2654
  return this.$nextTick();
2461
2655
  },
2462
2656
  getCellElement(row, fieldOrColumn) {
2463
- const column = handleFieldOrColumn(this, fieldOrColumn);
2657
+ const $xeTable = this;
2658
+ const internalData = $xeTable;
2659
+ const { elemStore } = internalData;
2660
+ const column = handleFieldOrColumn($xeTable, fieldOrColumn);
2464
2661
  if (!column) {
2465
2662
  return null;
2466
2663
  }
2467
- const { $refs } = this;
2468
- const rowid = getRowid(this, row);
2469
- let bodyElem = null;
2664
+ const rowid = getRowid($xeTable, row);
2665
+ const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
2666
+ const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
2667
+ const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
2668
+ let bodyElem;
2470
2669
  if (column) {
2471
- bodyElem = $refs[`${column.fixed || 'table'}Body`] || $refs.refTableBody;
2472
- }
2473
- if (bodyElem && bodyElem.$el) {
2474
- return bodyElem.$el.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`);
2670
+ if (column.fixed) {
2671
+ if (column.fixed === 'left') {
2672
+ if (leftScrollElem) {
2673
+ bodyElem = leftScrollElem;
2674
+ }
2675
+ }
2676
+ else {
2677
+ if (rightScrollElem) {
2678
+ bodyElem = rightScrollElem;
2679
+ }
2680
+ }
2681
+ }
2682
+ if (!bodyElem) {
2683
+ bodyElem = bodyScrollElem;
2684
+ }
2685
+ if (bodyElem) {
2686
+ return bodyElem.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`);
2687
+ }
2475
2688
  }
2476
2689
  return null;
2477
2690
  },
@@ -2674,6 +2887,7 @@ const Methods = {
2674
2887
  * 如果存在筛选条件,继续处理
2675
2888
  */
2676
2889
  updateAfterFullData() {
2890
+ const $xeTable = this;
2677
2891
  const { tableFullColumn, tableFullData, filterOpts, sortOpts, treeConfig, treeOpts, tableFullTreeData } = this;
2678
2892
  const { remote: allRemoteFilter, filterMethod: allFilterMethod } = filterOpts;
2679
2893
  const { remote: allRemoteSort, sortMethod: allSortMethod, multiple: sortMultiple, chronological } = sortOpts;
@@ -2799,7 +3013,7 @@ const Methods = {
2799
3013
  }
2800
3014
  this.afterFullData = tableData;
2801
3015
  this.afterTreeFullData = tableTree;
2802
- this.updateAfterDataIndex();
3016
+ updateAfterDataIndex($xeTable);
2803
3017
  },
2804
3018
  /**
2805
3019
  * 预编译
@@ -2807,48 +3021,7 @@ const Methods = {
2807
3021
  */
2808
3022
  updateAfterDataIndex() {
2809
3023
  const $xeTable = this;
2810
- const props = $xeTable;
2811
- const internalData = $xeTable;
2812
- const { treeConfig } = props;
2813
- const { afterFullData, fullDataRowIdData, fullAllDataRowIdData, afterTreeFullData } = internalData;
2814
- const treeOpts = $xeTable.computeTreeOpts;
2815
- const childrenField = treeOpts.children || treeOpts.childrenField;
2816
- const fullMaps = {};
2817
- if (treeConfig) {
2818
- XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
2819
- const rowid = getRowid($xeTable, row);
2820
- const rowRest = fullAllDataRowIdData[rowid];
2821
- const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('');
2822
- if (rowRest) {
2823
- rowRest.seq = seq;
2824
- rowRest._index = index;
2825
- }
2826
- else {
2827
- const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0, height: 0, oTop: 0 };
2828
- fullAllDataRowIdData[rowid] = rest;
2829
- fullDataRowIdData[rowid] = rest;
2830
- }
2831
- fullMaps[rowid] = row;
2832
- }, { children: treeOpts.transform ? treeOpts.mapChildrenField : childrenField });
2833
- }
2834
- else {
2835
- afterFullData.forEach((row, index) => {
2836
- const rowid = getRowid($xeTable, row);
2837
- const rowRest = fullAllDataRowIdData[rowid];
2838
- const seq = index + 1;
2839
- if (rowRest) {
2840
- rowRest.seq = seq;
2841
- rowRest._index = index;
2842
- }
2843
- else {
2844
- const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0, height: 0, oTop: 0 };
2845
- fullAllDataRowIdData[rowid] = rest;
2846
- fullDataRowIdData[rowid] = rest;
2847
- }
2848
- fullMaps[rowid] = row;
2849
- });
2850
- }
2851
- this.afterFullRowMaps = fullMaps;
3024
+ updateAfterDataIndex($xeTable);
2852
3025
  },
2853
3026
  /**
2854
3027
  * 只对 tree-config 有效,获取行的子级
@@ -2914,7 +3087,9 @@ const Methods = {
2914
3087
  * @param {String/Number} rowid 行主键
2915
3088
  */
2916
3089
  getRowById(cellValue) {
2917
- const fullDataRowIdData = this.fullDataRowIdData;
3090
+ const $xeTable = this;
3091
+ const internalData = $xeTable;
3092
+ const { fullDataRowIdData } = internalData;
2918
3093
  const rowid = XEUtils.eqNull(cellValue) ? '' : encodeURIComponent(cellValue);
2919
3094
  return fullDataRowIdData[rowid] ? fullDataRowIdData[rowid].row : null;
2920
3095
  },
@@ -2922,12 +3097,9 @@ const Methods = {
2922
3097
  * 根据行获取行的唯一主键
2923
3098
  * @param {Row} row 行对象
2924
3099
  */
2925
- getRowid(cellValue) {
3100
+ getRowid(row) {
2926
3101
  const $xeTable = this;
2927
- const internalData = $xeTable;
2928
- const { fullDataRowIdData } = internalData;
2929
- const rowid = XEUtils.eqNull(cellValue) ? '' : encodeURIComponent(cellValue || '');
2930
- return fullDataRowIdData[rowid] ? fullDataRowIdData[rowid].row : null;
3102
+ return getRowid($xeTable, row);
2931
3103
  },
2932
3104
  /**
2933
3105
  * 获取处理后的表格数据
@@ -3112,29 +3284,35 @@ const Methods = {
3112
3284
  },
3113
3285
  setColumnWidth(fieldOrColumn, width) {
3114
3286
  const $xeTable = this;
3287
+ const internalData = $xeTable;
3288
+ const { elemStore } = internalData;
3115
3289
  let status = false;
3116
3290
  const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
3117
- cols.forEach(item => {
3118
- const column = handleFieldOrColumn($xeTable, item);
3119
- if (column) {
3120
- const colWidth = XEUtils.toInteger(width);
3121
- let rdWidth = colWidth;
3122
- if (isScale(width)) {
3123
- const refTableBody = $xeTable.$refs.refTableBody;
3124
- const bodyElem = refTableBody ? refTableBody.$el : null;
3125
- const bodyWidth = bodyElem ? bodyElem.clientWidth - 1 : 0;
3126
- rdWidth = Math.floor(colWidth * bodyWidth);
3127
- }
3128
- column.resizeWidth = rdWidth;
3129
- if (!status) {
3130
- status = true;
3291
+ let cWidth = XEUtils.toInteger(width);
3292
+ if (isScale(width)) {
3293
+ const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
3294
+ const bodyWidth = bodyScrollElem ? bodyScrollElem.clientWidth - 1 : 0;
3295
+ cWidth = Math.floor(cWidth * bodyWidth);
3296
+ }
3297
+ if (cWidth) {
3298
+ cols.forEach(item => {
3299
+ const column = handleFieldOrColumn($xeTable, item);
3300
+ if (column) {
3301
+ column.resizeWidth = cWidth;
3302
+ if (!status) {
3303
+ status = true;
3304
+ }
3131
3305
  }
3306
+ });
3307
+ if (status) {
3308
+ return $xeTable.refreshColumn().then(() => {
3309
+ return { status };
3310
+ });
3132
3311
  }
3133
- });
3134
- if (status) {
3135
- return $xeTable.refreshColumn();
3136
3312
  }
3137
- return $xeTable.$nextTick();
3313
+ return $xeTable.$nextTick().then(() => {
3314
+ return { status };
3315
+ });
3138
3316
  },
3139
3317
  getColumnWidth(fieldOrColumn) {
3140
3318
  const column = handleFieldOrColumn(this, fieldOrColumn);
@@ -3427,7 +3605,148 @@ const Methods = {
3427
3605
  });
3428
3606
  Object.assign(this.columnStore, { resizeList, pxList, pxMinList, autoMinList, scaleList, scaleMinList, autoList, remainList });
3429
3607
  },
3430
- handleResizeDblclickEvent(evnt, params) {
3608
+ handleColResizeMousedownEvent(evnt, fixedType, params) {
3609
+ const $xeTable = this;
3610
+ const reactData = $xeTable;
3611
+ const internalData = $xeTable;
3612
+ evnt.stopPropagation();
3613
+ evnt.preventDefault();
3614
+ const { column } = params;
3615
+ const { overflowX, scrollbarHeight } = reactData;
3616
+ const { elemStore, visibleColumn } = internalData;
3617
+ const resizableOpts = $xeTable.computeResizableOpts;
3618
+ const osbHeight = overflowX ? scrollbarHeight : 0;
3619
+ const tableEl = $xeTable.$refs.refElem;
3620
+ const leftContainerElem = $xeTable.$refs.refLeftContainer;
3621
+ const rightContainerElem = $xeTable.$refs.refRightContainer;
3622
+ const resizeBarElem = $xeTable.$refs.refColResizeBar;
3623
+ if (!resizeBarElem) {
3624
+ return;
3625
+ }
3626
+ const resizeTipElem = resizeBarElem.firstElementChild;
3627
+ const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
3628
+ const { clientX: dragClientX } = evnt;
3629
+ const wrapperElem = $xeTable.$refs.refElem;
3630
+ const dragBtnElem = evnt.target;
3631
+ let resizeColumn = column;
3632
+ if (column.children && column.children.length) {
3633
+ XEUtils.eachTree(column.children, childColumn => {
3634
+ resizeColumn = childColumn;
3635
+ });
3636
+ }
3637
+ const cell = dragBtnElem.parentNode;
3638
+ const cellParams = Object.assign(params, { cell });
3639
+ let dragLeft = 0;
3640
+ const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
3641
+ if (!bodyScrollElem) {
3642
+ return;
3643
+ }
3644
+ const pos = getOffsetPos(dragBtnElem, wrapperElem);
3645
+ const dragBtnWidth = dragBtnElem.clientWidth;
3646
+ const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2);
3647
+ const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
3648
+ let dragMinLeft = pos.left - cell.clientWidth + dragBtnWidth + minInterval;
3649
+ let dragPosLeft = pos.left + dragBtnOffsetWidth;
3650
+ const isLeftFixed = fixedType === 'left';
3651
+ const isRightFixed = fixedType === 'right';
3652
+ // 计算左右侧固定列偏移量
3653
+ let fixedOffsetWidth = 0;
3654
+ if (isLeftFixed || isRightFixed) {
3655
+ const siblingProp = isLeftFixed ? 'nextElementSibling' : 'previousElementSibling';
3656
+ let tempCellElem = cell[siblingProp];
3657
+ while (tempCellElem) {
3658
+ if (hasClass(tempCellElem, 'fixed--hidden')) {
3659
+ break;
3660
+ }
3661
+ else if (!hasClass(tempCellElem, 'col--group')) {
3662
+ fixedOffsetWidth += tempCellElem.offsetWidth;
3663
+ }
3664
+ tempCellElem = tempCellElem[siblingProp];
3665
+ }
3666
+ if (isRightFixed && rightContainerElem) {
3667
+ dragPosLeft = rightContainerElem.offsetLeft + fixedOffsetWidth;
3668
+ }
3669
+ }
3670
+ // 处理拖动事件
3671
+ const updateEvent = (evnt) => {
3672
+ evnt.stopPropagation();
3673
+ evnt.preventDefault();
3674
+ const tableHeight = tableEl.clientHeight;
3675
+ const offsetX = evnt.clientX - dragClientX;
3676
+ let left = dragPosLeft + offsetX;
3677
+ const scrollLeft = fixedType ? 0 : bodyScrollElem.scrollLeft;
3678
+ if (isLeftFixed) {
3679
+ // 左固定列(不允许超过右侧固定列、不允许超过右边距)
3680
+ left = Math.min(left, (rightContainerElem ? rightContainerElem.offsetLeft : bodyScrollElem.clientWidth) - fixedOffsetWidth - minInterval);
3681
+ }
3682
+ else if (isRightFixed) {
3683
+ // 右侧固定列(不允许超过左侧固定列、不允许超过左边距)
3684
+ dragMinLeft = (leftContainerElem ? leftContainerElem.clientWidth : 0) + fixedOffsetWidth + minInterval;
3685
+ left = Math.min(left, dragPosLeft + cell.clientWidth - minInterval);
3686
+ }
3687
+ else {
3688
+ dragMinLeft = Math.max(bodyScrollElem.scrollLeft, dragMinLeft);
3689
+ // left = Math.min(left, bodyScrollElem.clientWidth + bodyScrollElem.scrollLeft - 40)
3690
+ }
3691
+ dragLeft = Math.max(left, dragMinLeft);
3692
+ const resizeBarLeft = Math.max(1, dragLeft - scrollLeft);
3693
+ resizeBarElem.style.left = `${resizeBarLeft}px`;
3694
+ resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`;
3695
+ resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - osbHeight : tableHeight}px`;
3696
+ if (resizableOpts.showDragTip && resizeTipElem) {
3697
+ resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
3698
+ const tableWidth = tableEl.clientWidth;
3699
+ const wrapperRect = wrapperElem.getBoundingClientRect();
3700
+ const resizeBarWidth = resizeBarElem.clientWidth;
3701
+ const resizeTipWidth = resizeTipElem.clientWidth;
3702
+ const resizeTipHeight = resizeTipElem.clientHeight;
3703
+ let resizeTipLeft = -resizeTipWidth;
3704
+ if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
3705
+ resizeTipLeft = 0;
3706
+ }
3707
+ else if (resizeBarLeft > tableWidth) {
3708
+ resizeTipLeft += tableWidth - resizeBarLeft;
3709
+ }
3710
+ resizeTipElem.style.left = `${resizeTipLeft}px`;
3711
+ resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
3712
+ }
3713
+ };
3714
+ reactData.isDragResize = true;
3715
+ addClass(tableEl, 'col-drag--resize');
3716
+ resizeBarElem.style.display = 'block';
3717
+ document.onmousemove = updateEvent;
3718
+ document.onmouseup = function (evnt) {
3719
+ document.onmousemove = null;
3720
+ document.onmouseup = null;
3721
+ resizeBarElem.style.display = 'none';
3722
+ reactData.isDragResize = false;
3723
+ internalData._lastResizeTime = Date.now();
3724
+ const resizeWidth = resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
3725
+ const resizeParams = Object.assign(Object.assign({}, params), { resizeWidth, resizeColumn });
3726
+ if (resizableOpts.dragMode === 'fixed') {
3727
+ visibleColumn.forEach(item => {
3728
+ if (item.id !== resizeColumn.id) {
3729
+ if (!item.resizeWidth) {
3730
+ item.resizeWidth = item.renderWidth;
3731
+ }
3732
+ }
3733
+ });
3734
+ }
3735
+ if ($xeTable.handleColResizeCellAreaEvent) {
3736
+ $xeTable.handleColResizeCellAreaEvent(evnt, resizeParams);
3737
+ }
3738
+ else {
3739
+ resizeColumn.resizeWidth = resizeWidth;
3740
+ handleUpdateColResize($xeTable, evnt, resizeParams);
3741
+ }
3742
+ removeClass(tableEl, 'col-drag--resize');
3743
+ };
3744
+ updateEvent(evnt);
3745
+ if ($xeTable.closeMenu) {
3746
+ $xeTable.closeMenu();
3747
+ }
3748
+ },
3749
+ handleColResizeDblclickEvent(evnt, params) {
3431
3750
  const $xeTable = this;
3432
3751
  const reactData = $xeTable;
3433
3752
  const internalData = $xeTable;
@@ -3437,27 +3756,261 @@ const Methods = {
3437
3756
  if (isDblclickAutoWidth && el) {
3438
3757
  const { fullColumnIdData } = internalData;
3439
3758
  const { column } = params;
3440
- const colid = column.id;
3759
+ let resizeColumn = column;
3760
+ if (column.children && column.children.length) {
3761
+ XEUtils.eachTree(column.children, childColumn => {
3762
+ resizeColumn = childColumn;
3763
+ });
3764
+ }
3765
+ const colid = resizeColumn.id;
3441
3766
  const colRest = fullColumnIdData[colid];
3442
3767
  const dragBtnElem = evnt.target;
3443
3768
  const cell = dragBtnElem.parentNode;
3444
3769
  const cellParams = Object.assign(params, { cell });
3445
3770
  const colMinWidth = getColReMinWidth(cellParams);
3446
- let resizeWidth = calcColumnAutoWidth(column, el);
3771
+ el.setAttribute('data-calc-col', 'Y');
3772
+ let resizeWidth = calcColumnAutoWidth(resizeColumn, el);
3773
+ el.removeAttribute('data-calc-col');
3447
3774
  if (colRest) {
3448
3775
  resizeWidth = Math.max(resizeWidth, colRest.width);
3449
3776
  }
3450
- column.resizeWidth = Math.max(colMinWidth, resizeWidth);
3451
- reactData._isResize = false;
3777
+ resizeWidth = Math.max(colMinWidth, resizeWidth);
3778
+ const resizeParams = Object.assign(Object.assign({}, params), { resizeWidth, resizeColumn });
3779
+ reactData.isDragResize = false;
3452
3780
  internalData._lastResizeTime = Date.now();
3453
- $xeTable.analyColumnWidth();
3454
- $xeTable.recalculate(true).then(() => {
3455
- $xeTable.saveCustomStore('update:visible');
3456
- $xeTable.updateCellAreas();
3457
- $xeTable.dispatchEvent('resizable-change', Object.assign(Object.assign({}, params), { resizeWidth }), evnt);
3458
- setTimeout(() => $xeTable.recalculate(true), 300);
3781
+ if ($xeTable.handleColResizeDblclickCellAreaEvent) {
3782
+ $xeTable.handleColResizeDblclickCellAreaEvent(evnt, resizeParams);
3783
+ }
3784
+ else {
3785
+ resizeColumn.resizeWidth = resizeWidth;
3786
+ handleUpdateColResize($xeTable, evnt, resizeParams);
3787
+ }
3788
+ }
3789
+ },
3790
+ handleRowResizeMousedownEvent(evnt, params) {
3791
+ const $xeTable = this;
3792
+ const reactData = $xeTable;
3793
+ const internalData = $xeTable;
3794
+ evnt.stopPropagation();
3795
+ evnt.preventDefault();
3796
+ const { row } = params;
3797
+ const { overflowX, scrollbarWidth, overflowY, scrollbarHeight } = reactData;
3798
+ const { elemStore, fullAllDataRowIdData } = internalData;
3799
+ const osbWidth = overflowY ? scrollbarWidth : 0;
3800
+ const osbHeight = overflowX ? scrollbarHeight : 0;
3801
+ const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
3802
+ const resizableOpts = $xeTable.computeResizableOpts;
3803
+ const rowOpts = $xeTable.computeRowOpts;
3804
+ const cellOpts = $xeTable.computeCellOpts;
3805
+ const tableEl = $xeTable.$refs.refElem;
3806
+ const resizeBarElem = $xeTable.$refs.refRowResizeBar;
3807
+ if (!resizeBarElem) {
3808
+ return;
3809
+ }
3810
+ const { clientY: dragClientY } = evnt;
3811
+ const resizeTipElem = resizeBarElem.firstElementChild;
3812
+ const dragBtnElem = evnt.currentTarget;
3813
+ const tdEl = dragBtnElem.parentNode;
3814
+ const trEl = tdEl.parentNode;
3815
+ const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
3816
+ if (!bodyScrollElem) {
3817
+ return;
3818
+ }
3819
+ const rowid = getRowid($xeTable, row);
3820
+ const rowRest = fullAllDataRowIdData[rowid];
3821
+ if (!rowRest) {
3822
+ return;
3823
+ }
3824
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
3825
+ const currCellHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || defaultRowHeight;
3826
+ const tableRect = tableEl.getBoundingClientRect();
3827
+ const trRect = trEl.getBoundingClientRect();
3828
+ const targetOffsetY = dragClientY - trRect.y - trEl.clientHeight;
3829
+ let resizeHeight = currCellHeight;
3830
+ const cellEl = tdEl.querySelector('.vxe-cell');
3831
+ let cellMinHeight = 0;
3832
+ if (cellEl) {
3833
+ const cellStyle = getComputedStyle(cellEl);
3834
+ cellMinHeight = Math.max(1, Math.ceil(XEUtils.toNumber(cellStyle.paddingTop) + XEUtils.toNumber(cellStyle.paddingBottom)));
3835
+ }
3836
+ const minTop = trRect.y - tableRect.y + cellMinHeight;
3837
+ // 处理拖动事件
3838
+ const updateEvent = (evnt) => {
3839
+ evnt.stopPropagation();
3840
+ evnt.preventDefault();
3841
+ const tableWidth = tableEl.clientWidth - osbWidth;
3842
+ const tableHeight = tableEl.clientHeight - osbHeight;
3843
+ let dragTop = evnt.clientY - tableRect.y - targetOffsetY;
3844
+ if (dragTop < minTop) {
3845
+ dragTop = minTop;
3846
+ }
3847
+ else {
3848
+ resizeHeight = Math.max(cellMinHeight, currCellHeight + evnt.clientY - dragClientY);
3849
+ }
3850
+ resizeBarElem.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
3851
+ resizeBarElem.style.top = `${dragTop}px`;
3852
+ resizeBarElem.style.width = `${tableWidth}px`;
3853
+ if (resizableOpts.showDragTip && resizeTipElem) {
3854
+ resizeTipElem.textContent = getI18n('vxe.table.resizeRowTip', [resizeHeight]);
3855
+ const resizeTipWidth = resizeTipElem.clientWidth;
3856
+ const resizeTipHeight = resizeTipElem.clientHeight;
3857
+ let resizeBarLeft = Math.max(2, evnt.clientX - tableRect.x);
3858
+ let resizeBarTop = 0;
3859
+ if (resizeBarLeft + resizeTipWidth >= tableWidth - 2) {
3860
+ resizeBarLeft = tableWidth - resizeTipWidth - 2;
3861
+ }
3862
+ if (dragTop + resizeTipHeight >= tableHeight) {
3863
+ resizeBarTop = tableHeight - (dragTop + resizeTipHeight);
3864
+ }
3865
+ resizeTipElem.style.left = `${resizeBarLeft}px`;
3866
+ resizeTipElem.style.top = `${resizeBarTop}px`;
3867
+ }
3868
+ };
3869
+ reactData.isDragResize = true;
3870
+ addClass(tableEl, 'row-drag--resize');
3871
+ resizeBarElem.style.display = 'block';
3872
+ document.onmousemove = updateEvent;
3873
+ document.onmouseup = function (evnt) {
3874
+ document.onmousemove = null;
3875
+ document.onmouseup = null;
3876
+ resizeBarElem.style.display = 'none';
3877
+ reactData.isDragResize = false;
3878
+ internalData._lastResizeTime = Date.now();
3879
+ if (resizeHeight !== currCellHeight) {
3880
+ const resizeParams = Object.assign(Object.assign({}, params), { resizeHeight, resizeRow: row });
3881
+ internalData.isResizeCellHeight = true;
3882
+ if ($xeTable.handleRowResizeCellAreaEvent) {
3883
+ $xeTable.handleRowResizeCellAreaEvent(evnt, resizeParams);
3884
+ }
3885
+ else {
3886
+ rowRest.resizeHeight = resizeHeight;
3887
+ handleUpdateRowResize($xeTable, evnt, resizeParams);
3888
+ }
3889
+ }
3890
+ removeClass(tableEl, 'row-drag--resize');
3891
+ };
3892
+ updateEvent(evnt);
3893
+ },
3894
+ handleRowResizeDblclickEvent(evnt, params) {
3895
+ const $xeTable = this;
3896
+ const reactData = $xeTable;
3897
+ const internalData = $xeTable;
3898
+ const resizableOpts = $xeTable.computeResizableOpts;
3899
+ const { isDblclickAutoHeight } = resizableOpts;
3900
+ const el = $xeTable.$refs.refElem;
3901
+ if (isDblclickAutoHeight && el) {
3902
+ const { fullAllDataRowIdData } = internalData;
3903
+ const { row } = params;
3904
+ const rowid = getRowid($xeTable, row);
3905
+ const rowRest = fullAllDataRowIdData[rowid];
3906
+ if (!rowRest) {
3907
+ return;
3908
+ }
3909
+ const resizeHeight = calcCellAutoHeight(rowRest, el);
3910
+ const resizeParams = Object.assign(Object.assign({}, params), { resizeHeight, resizeRow: row });
3911
+ reactData.isDragResize = false;
3912
+ internalData._lastResizeTime = Date.now();
3913
+ if ($xeTable.handleRowResizeDblclickCellAreaEvent) {
3914
+ $xeTable.handleRowResizeDblclickCellAreaEvent(evnt, resizeParams);
3915
+ }
3916
+ else {
3917
+ rowRest.resizeHeight = resizeHeight;
3918
+ handleUpdateRowResize($xeTable, evnt, resizeParams);
3919
+ }
3920
+ }
3921
+ },
3922
+ setRowHeightConf(heightConf) {
3923
+ const $xeTable = this;
3924
+ const reactData = $xeTable;
3925
+ const internalData = $xeTable;
3926
+ const { fullAllDataRowIdData } = internalData;
3927
+ let status = false;
3928
+ if (heightConf) {
3929
+ XEUtils.each(heightConf, (height, rowid) => {
3930
+ const rowRest = fullAllDataRowIdData[rowid];
3931
+ if (rowRest) {
3932
+ const rHeight = XEUtils.toInteger(height);
3933
+ if (rHeight) {
3934
+ rowRest.resizeHeight = rHeight;
3935
+ if (!status) {
3936
+ status = true;
3937
+ }
3938
+ }
3939
+ }
3940
+ });
3941
+ if (status) {
3942
+ internalData.isResizeCellHeight = true;
3943
+ reactData.resizeHeightFlag++;
3944
+ }
3945
+ }
3946
+ return $xeTable.$nextTick().then(() => {
3947
+ return { status };
3948
+ });
3949
+ },
3950
+ getRowHeightConf(isFull) {
3951
+ const $xeTable = this;
3952
+ const internalData = $xeTable;
3953
+ const { fullAllDataRowIdData, afterFullData } = internalData;
3954
+ const rowOpts = $xeTable.computeRowOpts;
3955
+ const cellOpts = $xeTable.computeCellOpts;
3956
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
3957
+ const rest = {};
3958
+ afterFullData.forEach(row => {
3959
+ const rowid = getRowid($xeTable, row);
3960
+ const rowRest = fullAllDataRowIdData[rowid];
3961
+ if (rowRest) {
3962
+ const resizeHeight = rowRest.resizeHeight;
3963
+ if (resizeHeight || isFull) {
3964
+ const currCellHeight = resizeHeight || cellOpts.height || rowOpts.height || defaultRowHeight;
3965
+ rest[rowid] = currCellHeight;
3966
+ }
3967
+ }
3968
+ });
3969
+ return rest;
3970
+ },
3971
+ setRowHeight(rowOrId, height) {
3972
+ const $xeTable = this;
3973
+ const reactData = $xeTable;
3974
+ const internalData = $xeTable;
3975
+ const { fullAllDataRowIdData } = internalData;
3976
+ let status = false;
3977
+ const rows = XEUtils.isArray(rowOrId) ? rowOrId : [rowOrId];
3978
+ let rHeight = XEUtils.toInteger(height);
3979
+ if (isScale(height)) {
3980
+ const tableBody = $xeTable.$refs.refTableBody;
3981
+ const bodyElem = tableBody ? tableBody.$el : null;
3982
+ const bodyHeight = bodyElem ? bodyElem.clientHeight - 1 : 0;
3983
+ rHeight = Math.floor(rHeight * bodyHeight);
3984
+ }
3985
+ if (rHeight) {
3986
+ rows.forEach(row => {
3987
+ const rowid = XEUtils.isString(row) || XEUtils.isNumber(row) ? row : getRowid($xeTable, row);
3988
+ const rowRest = fullAllDataRowIdData[rowid];
3989
+ if (rowRest) {
3990
+ rowRest.resizeHeight = rHeight;
3991
+ if (!status) {
3992
+ status = true;
3993
+ }
3994
+ }
3459
3995
  });
3996
+ if (status) {
3997
+ internalData.isResizeCellHeight = true;
3998
+ reactData.resizeHeightFlag++;
3999
+ }
3460
4000
  }
4001
+ return $xeTable.$nextTick();
4002
+ },
4003
+ getRowHeight(rowOrId) {
4004
+ const $xeTable = this;
4005
+ const internalData = $xeTable;
4006
+ const { fullAllDataRowIdData } = internalData;
4007
+ const rowOpts = $xeTable.computeRowOpts;
4008
+ const cellOpts = $xeTable.computeCellOpts;
4009
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
4010
+ const rowid = XEUtils.isString(rowOrId) || XEUtils.isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId);
4011
+ const rowRest = fullAllDataRowIdData[rowid];
4012
+ const currCellHeight = rowRest ? rowRest.resizeHeight : (cellOpts.height || rowOpts.height || defaultRowHeight);
4013
+ return currCellHeight;
3461
4014
  },
3462
4015
  /**
3463
4016
  * 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
@@ -3838,10 +4391,10 @@ const Methods = {
3838
4391
  }
3839
4392
  else if (isContextMenu) {
3840
4393
  // 如果按下上下文键
3841
- this._keyCtx = selected.row && selected.column && bodyCtxMenu.length;
4394
+ internalData._keyCtx = selected.row && selected.column && bodyCtxMenu.length;
3842
4395
  clearTimeout(internalData.keyCtxTimeout);
3843
4396
  internalData.keyCtxTimeout = setTimeout(() => {
3844
- this._keyCtx = false;
4397
+ internalData._keyCtx = false;
3845
4398
  }, 1000);
3846
4399
  }
3847
4400
  else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow))) {
@@ -4090,18 +4643,6 @@ const Methods = {
4090
4643
  this.updateCellAreas();
4091
4644
  this.recalculate(true);
4092
4645
  },
4093
- handleTargetEnterEvent(isClear) {
4094
- const $tooltip = this.$refs.tooltip;
4095
- clearTimeout(this.tooltipTimeout);
4096
- if (isClear) {
4097
- this.closeTooltip();
4098
- }
4099
- else {
4100
- if ($tooltip) {
4101
- $tooltip.setActived(true);
4102
- }
4103
- }
4104
- },
4105
4646
  handleTargetLeaveEvent() {
4106
4647
  const tooltipOpts = this.tooltipOpts;
4107
4648
  let $tooltip = this.$refs.tooltip;
@@ -4121,19 +4662,21 @@ const Methods = {
4121
4662
  }
4122
4663
  },
4123
4664
  triggerHeaderTitleEvent(evnt, iconParams, params) {
4665
+ const $xeTable = this;
4666
+ const reactData = $xeTable;
4124
4667
  const tipContent = iconParams.content || iconParams.message;
4125
4668
  if (tipContent) {
4126
- const { $refs, tooltipStore } = this;
4669
+ const { tooltipStore } = reactData;
4127
4670
  const { column } = params;
4128
4671
  const content = getFuncText(tipContent);
4129
- this.handleTargetEnterEvent(true);
4672
+ handleTargetEnterEvent($xeTable, true);
4130
4673
  tooltipStore.row = null;
4131
4674
  tooltipStore.column = column;
4132
4675
  tooltipStore.visible = true;
4133
4676
  tooltipStore.currOpts = iconParams;
4134
- this.$nextTick(() => {
4135
- const $tooltip = $refs.tooltip;
4136
- if ($tooltip) {
4677
+ $xeTable.$nextTick(() => {
4678
+ const $tooltip = $xeTable.$refs.refTooltip;
4679
+ if ($tooltip && $tooltip.open) {
4137
4680
  $tooltip.open(evnt.currentTarget, content);
4138
4681
  }
4139
4682
  });
@@ -4143,23 +4686,42 @@ const Methods = {
4143
4686
  * 触发表头 tooltip 事件
4144
4687
  */
4145
4688
  triggerHeaderTooltipEvent(evnt, params) {
4146
- const { tooltipStore } = this;
4689
+ const $xeTable = this;
4690
+ const reactData = $xeTable;
4691
+ const { tooltipStore } = reactData;
4147
4692
  const { column } = params;
4693
+ handleTargetEnterEvent($xeTable, true);
4148
4694
  const titleElem = evnt.currentTarget;
4149
- this.handleTargetEnterEvent(tooltipStore.column !== column || tooltipStore.row);
4695
+ if (!titleElem) {
4696
+ return;
4697
+ }
4698
+ const cellEl = titleElem.parentElement;
4699
+ if (!cellEl) {
4700
+ return;
4701
+ }
4702
+ const thEl = cellEl.parentElement;
4703
+ if (!thEl) {
4704
+ return;
4705
+ }
4150
4706
  if (tooltipStore.column !== column || !tooltipStore.visible) {
4151
- this.handleTooltip(evnt, titleElem, titleElem, null, params);
4707
+ handleTooltip($xeTable, evnt, thEl, cellEl, null, params);
4152
4708
  }
4153
4709
  },
4154
4710
  /**
4155
4711
  * 触发单元格 tooltip 事件
4156
4712
  */
4157
4713
  triggerBodyTooltipEvent(evnt, params) {
4158
- const { editConfig, editOpts, editStore, tooltipStore } = this;
4714
+ const $xeTable = this;
4715
+ const props = $xeTable;
4716
+ const reactData = $xeTable;
4717
+ const { editConfig } = props;
4718
+ const { editStore } = reactData;
4719
+ const { tooltipStore } = reactData;
4720
+ const editOpts = $xeTable.computeEditOpts;
4159
4721
  const { actived } = editStore;
4160
4722
  const { row, column } = params;
4161
- const cell = evnt.currentTarget;
4162
- this.handleTargetEnterEvent(tooltipStore.column !== column || tooltipStore.row !== row);
4723
+ const tdEl = evnt.currentTarget;
4724
+ handleTargetEnterEvent($xeTable, tooltipStore.column !== column || tooltipStore.row !== row);
4163
4725
  // 单元格处于编辑状态时不触发提示框
4164
4726
  if (column.editRender && isEnableConf(editConfig)) {
4165
4727
  // 如果是行编辑模式
@@ -4172,66 +4734,22 @@ const Methods = {
4172
4734
  }
4173
4735
  }
4174
4736
  if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
4175
- let overflowElem;
4176
- let tipElem;
4177
- if (column.treeNode) {
4178
- overflowElem = cell.querySelector('.vxe-tree-cell');
4179
- if (column.type === 'html') {
4180
- tipElem = cell.querySelector('.vxe-cell--html');
4181
- }
4182
- }
4183
- else {
4184
- tipElem = cell.querySelector(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label');
4185
- }
4186
- this.handleTooltip(evnt, cell, overflowElem || cell.children[0], tipElem, params);
4737
+ handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--wrapper'), null, params);
4187
4738
  }
4188
4739
  },
4189
4740
  /**
4190
4741
  * 触发表尾 tooltip 事件
4191
4742
  */
4192
4743
  triggerFooterTooltipEvent(evnt, params) {
4744
+ const $xeTable = this;
4745
+ const reactData = $xeTable;
4193
4746
  const { column } = params;
4194
- const { tooltipStore } = this;
4747
+ const { tooltipStore } = reactData;
4195
4748
  const cell = evnt.currentTarget;
4196
- this.handleTargetEnterEvent(true);
4749
+ handleTargetEnterEvent($xeTable, tooltipStore.column !== column || !!tooltipStore.row);
4197
4750
  if (tooltipStore.column !== column || !tooltipStore.visible) {
4198
- this.handleTooltip(evnt, cell, cell.querySelector('.vxe-cell--item') || cell.children[0], null, params);
4199
- }
4200
- },
4201
- /**
4202
- * 处理显示 tooltip
4203
- * @param {Event} evnt 事件
4204
- * @param {ColumnInfo} column 列配置
4205
- * @param {Row} row 行对象
4206
- */
4207
- handleTooltip(evnt, cell, overflowElem, tipElem, params) {
4208
- const $xeTable = this;
4209
- if (!overflowElem) {
4210
- return $xeTable.$nextTick();
4211
- }
4212
- params.cell = cell;
4213
- const { $refs, tooltipOpts, tooltipStore } = this;
4214
- const { column, row } = params;
4215
- const { showAll, enabled, contentMethod } = tooltipOpts;
4216
- const customContent = contentMethod ? contentMethod(params) : null;
4217
- const useCustom = contentMethod && !XEUtils.eqNull(customContent);
4218
- const content = useCustom ? customContent : (column.type === 'html' ? overflowElem.innerText : overflowElem.textContent).trim();
4219
- const isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth;
4220
- if (content && (showAll || enabled || useCustom || isCellOverflow)) {
4221
- Object.assign(tooltipStore, {
4222
- row,
4223
- column,
4224
- visible: true,
4225
- currOpts: {}
4226
- });
4227
- this.$nextTick(() => {
4228
- const $tooltip = $refs.tooltip;
4229
- if ($tooltip) {
4230
- $tooltip.open(isCellOverflow ? overflowElem : (tipElem || overflowElem), formatText(content));
4231
- }
4232
- });
4751
+ handleTooltip($xeTable, evnt, cell, cell.querySelector('.vxe-cell--wrapper') || cell.children[0], null, params);
4233
4752
  }
4234
- return this.$nextTick();
4235
4753
  },
4236
4754
  openTooltip(target, content) {
4237
4755
  const { $refs } = this;
@@ -4852,7 +5370,7 @@ const Methods = {
4852
5370
  }
4853
5371
  vLen++;
4854
5372
  });
4855
- const isSelected = rootList.length > 0 && sLen >= vLen;
5373
+ const isSelected = vLen > 0 ? sLen >= vLen : sLen >= rootList.length;
4856
5374
  const halfSelect = !isSelected && (sLen >= 1 || hLen >= 1);
4857
5375
  reactData.isAllSelected = isSelected;
4858
5376
  reactData.isIndeterminate = halfSelect;
@@ -5709,10 +6227,10 @@ const Methods = {
5709
6227
  }
5710
6228
  reactData.isDragRowMove = true;
5711
6229
  $xeTable.handleTableData(treeConfig && transform);
5712
- $xeTable.cacheRowMap();
6230
+ $xeTable.cacheRowMap(false);
5713
6231
  updateScrollYStatus($xeTable);
5714
6232
  if (!(treeConfig && transform)) {
5715
- $xeTable.updateAfterDataIndex();
6233
+ updateAfterDataIndex($xeTable);
5716
6234
  }
5717
6235
  $xeTable.checkSelectionStatus();
5718
6236
  if (reactData.scrollYLoad) {
@@ -5751,20 +6269,18 @@ const Methods = {
5751
6269
  const { lazy } = treeOpts;
5752
6270
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
5753
6271
  const { prevDragRow, prevDragPos } = internalData;
5754
- if (treeConfig && prevDragToChild) {
6272
+ if (treeConfig && lazy && prevDragToChild) {
5755
6273
  // 懒加载
5756
- if (lazy) {
5757
- const newRowid = getRowid($xeTable, prevDragRow);
5758
- const rowRest = fullAllDataRowIdData[newRowid];
5759
- if (prevDragRow[hasChildField]) {
5760
- if (rowRest && rowRest.treeLoaded) {
5761
- $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
5762
- }
5763
- }
5764
- else {
6274
+ const newRowid = getRowid($xeTable, prevDragRow);
6275
+ const rowRest = fullAllDataRowIdData[newRowid];
6276
+ if (prevDragRow[hasChildField]) {
6277
+ if (rowRest && rowRest.treeLoaded) {
5765
6278
  $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
5766
6279
  }
5767
6280
  }
6281
+ else {
6282
+ $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
6283
+ }
5768
6284
  }
5769
6285
  else {
5770
6286
  $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
@@ -6841,7 +7357,7 @@ const Methods = {
6841
7357
  return this.$nextTick().then(() => {
6842
7358
  if (transform) {
6843
7359
  this.handleTableData();
6844
- this.updateAfterDataIndex();
7360
+ updateAfterDataIndex($xeTable);
6845
7361
  return this.$nextTick();
6846
7362
  }
6847
7363
  });
@@ -6957,7 +7473,7 @@ const Methods = {
6957
7473
  return this.handleBaseTreeExpand(rows, expanded).then(() => {
6958
7474
  handleVirtualTreeToList($xeTable);
6959
7475
  this.handleTableData();
6960
- this.updateAfterDataIndex();
7476
+ updateAfterDataIndex($xeTable);
6961
7477
  }).then(() => {
6962
7478
  return this.recalculate();
6963
7479
  }).then(() => {
@@ -7044,13 +7560,17 @@ const Methods = {
7044
7560
  * 获取表格的滚动状态
7045
7561
  */
7046
7562
  getScroll() {
7047
- const { $refs, scrollXLoad, scrollYLoad } = this;
7048
- const bodyElem = $refs.refTableBody.$el;
7563
+ const $xeTable = this;
7564
+ const reactData = $xeTable;
7565
+ const internalData = $xeTable;
7566
+ const { scrollXLoad, scrollYLoad } = reactData;
7567
+ const { elemStore } = internalData;
7568
+ const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
7049
7569
  return {
7050
7570
  virtualX: scrollXLoad,
7051
7571
  virtualY: scrollYLoad,
7052
- scrollTop: bodyElem.scrollTop,
7053
- scrollLeft: bodyElem.scrollLeft
7572
+ scrollTop: bodyScrollElem ? bodyScrollElem.scrollTop : 0,
7573
+ scrollLeft: bodyScrollElem ? bodyScrollElem.scrollLeft : 0
7054
7574
  };
7055
7575
  },
7056
7576
  handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, params) {
@@ -7150,46 +7670,6 @@ const Methods = {
7150
7670
  }
7151
7671
  $xeTable.dispatchEvent('scroll', evntParams, evnt);
7152
7672
  },
7153
- lazyScrollXData() {
7154
- const $xeTable = this;
7155
- const internalData = $xeTable;
7156
- const { lxTimeout, lxRunTime, scrollXStore } = internalData;
7157
- const { visibleSize } = scrollXStore;
7158
- const fpsTime = Math.max(5, Math.min(80, Math.floor(visibleSize * 3)));
7159
- if (lxTimeout) {
7160
- clearTimeout(lxTimeout);
7161
- }
7162
- if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
7163
- internalData.lxRunTime = Date.now();
7164
- loadScrollXData($xeTable);
7165
- }
7166
- internalData.lxTimeout = setTimeout(() => {
7167
- internalData.lxTimeout = undefined;
7168
- internalData.lxRunTime = undefined;
7169
- loadScrollXData($xeTable);
7170
- }, fpsTime);
7171
- },
7172
- lazyScrollYData() {
7173
- const $xeTable = this;
7174
- const props = $xeTable;
7175
- const internalData = $xeTable;
7176
- const { showOverflow } = props;
7177
- const { lyTimeout, lyRunTime, scrollYStore } = internalData;
7178
- const { visibleSize } = scrollYStore;
7179
- const fpsTime = showOverflow ? 5 : Math.max(5, Math.min(80, Math.floor(visibleSize / 2)));
7180
- if (lyTimeout) {
7181
- clearTimeout(lyTimeout);
7182
- }
7183
- if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
7184
- internalData.lyRunTime = Date.now();
7185
- loadScrollYData($xeTable);
7186
- }
7187
- internalData.lyTimeout = setTimeout(() => {
7188
- internalData.lyTimeout = undefined;
7189
- internalData.lyRunTime = undefined;
7190
- loadScrollYData($xeTable);
7191
- }, fpsTime);
7192
- },
7193
7673
  /**
7194
7674
  * 横向 X 可视渲染事件处理
7195
7675
  */
@@ -7200,7 +7680,7 @@ const Methods = {
7200
7680
  loadScrollXData($xeTable);
7201
7681
  }
7202
7682
  else {
7203
- $xeTable.lazyScrollXData();
7683
+ lazyScrollXData($xeTable);
7204
7684
  }
7205
7685
  },
7206
7686
  /**
@@ -7213,13 +7693,13 @@ const Methods = {
7213
7693
  loadScrollYData($xeTable);
7214
7694
  }
7215
7695
  else {
7216
- $xeTable.lazyScrollYData();
7696
+ lazyScrollYData($xeTable);
7217
7697
  }
7218
7698
  },
7219
7699
  triggerBodyScrollEvent(evnt, fixedType) {
7220
7700
  const $xeTable = this;
7221
7701
  const internalData = $xeTable;
7222
- const { elemStore, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData;
7702
+ const { elemStore, intoRunScroll, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData;
7223
7703
  const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
7224
7704
  const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
7225
7705
  const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
@@ -7230,6 +7710,9 @@ const Methods = {
7230
7710
  if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
7231
7711
  return;
7232
7712
  }
7713
+ if (intoRunScroll) {
7714
+ return;
7715
+ }
7233
7716
  if (!bodyScrollElem) {
7234
7717
  return;
7235
7718
  }
@@ -7290,22 +7773,16 @@ const Methods = {
7290
7773
  triggerHeaderScrollEvent(evnt, fixedType) {
7291
7774
  const $xeTable = this;
7292
7775
  const internalData = $xeTable;
7293
- const { elemStore, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData;
7776
+ const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData;
7294
7777
  const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
7295
7778
  const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
7296
7779
  const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
7297
7780
  const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
7298
7781
  const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
7299
- if (inWheelScroll) {
7300
- return;
7301
- }
7302
- if (inVirtualScroll) {
7782
+ if (inWheelScroll || inVirtualScroll || inBodyScroll || inFooterScroll) {
7303
7783
  return;
7304
7784
  }
7305
- if (inBodyScroll) {
7306
- return;
7307
- }
7308
- if (inFooterScroll) {
7785
+ if (intoRunScroll) {
7309
7786
  return;
7310
7787
  }
7311
7788
  if (!headerScrollElem) {
@@ -7334,22 +7811,16 @@ const Methods = {
7334
7811
  triggerFooterScrollEvent(evnt, fixedType) {
7335
7812
  const $xeTable = this;
7336
7813
  const internalData = $xeTable;
7337
- const { elemStore, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData;
7814
+ const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData;
7338
7815
  const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
7339
7816
  const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
7340
7817
  const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
7341
7818
  const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
7342
7819
  const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
7343
- if (inWheelScroll) {
7344
- return;
7345
- }
7346
- if (inVirtualScroll) {
7347
- return;
7348
- }
7349
- if (inHeaderScroll) {
7820
+ if (inWheelScroll || inVirtualScroll || inHeaderScroll || inBodyScroll) {
7350
7821
  return;
7351
7822
  }
7352
- if (inBodyScroll) {
7823
+ if (intoRunScroll) {
7353
7824
  return;
7354
7825
  }
7355
7826
  if (!footerScrollElem) {
@@ -7398,31 +7869,13 @@ const Methods = {
7398
7869
  if (!bodyScrollElem) {
7399
7870
  return;
7400
7871
  }
7401
- let multiple = 1;
7402
- if (reactData.lastScrollTime + 25 > Date.now()) {
7403
- multiple = 1.18;
7404
- }
7405
- else if (reactData.lastScrollTime + 30 > Date.now()) {
7406
- multiple = 1.15;
7407
- }
7408
- else if (reactData.lastScrollTime + 40 > Date.now()) {
7409
- multiple = 1.12;
7410
- }
7411
- else if (reactData.lastScrollTime + 55 > Date.now()) {
7412
- multiple = 1.09;
7413
- }
7414
- else if (reactData.lastScrollTime + 75 > Date.now()) {
7415
- multiple = 1.06;
7416
- }
7417
- else if (reactData.lastScrollTime + 100 > Date.now()) {
7418
- multiple = 1.03;
7419
- }
7420
- const deltaTop = deltaY * multiple;
7421
- const deltaLeft = deltaX * multiple;
7872
+ const wheelSpeed = getWheelSpeed(reactData.lastScrollTime);
7873
+ const deltaTop = deltaY * wheelSpeed;
7874
+ const deltaLeft = deltaX * wheelSpeed;
7422
7875
  const isTopWheel = deltaTop < 0;
7423
- const currScrollTop = yHandleEl.scrollTop;
7876
+ const currScrollTop = bodyScrollElem.scrollTop;
7424
7877
  // 如果滚动位置已经是顶部或底部,则不需要触发
7425
- if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= yHandleEl.scrollHeight - yHandleEl.clientHeight) {
7878
+ if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= bodyScrollElem.scrollHeight - bodyScrollElem.clientHeight) {
7426
7879
  return;
7427
7880
  }
7428
7881
  const scrollTop = bodyScrollElem.scrollTop + deltaTop;
@@ -7435,19 +7888,32 @@ const Methods = {
7435
7888
  if (rowOpts.isHover || highlightHoverRow) {
7436
7889
  $xeTable.clearHoverRow();
7437
7890
  }
7438
- internalData.inWheelScroll = true;
7439
- setScrollTop(yHandleEl, scrollTop);
7440
- setScrollTop(bodyScrollElem, scrollTop);
7441
- setScrollTop(leftScrollElem, scrollTop);
7442
- setScrollTop(rightScrollElem, scrollTop);
7443
- $xeTable.triggerScrollYEvent(evnt);
7444
- $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
7445
- type: 'footer',
7446
- fixed: ''
7891
+ wheelScrollTo(scrollTop - bodyScrollElem.scrollTop, (offsetTop) => {
7892
+ const currTopNum = bodyScrollElem.scrollTop + offsetTop;
7893
+ internalData.inWheelScroll = true;
7894
+ setScrollTop(yHandleEl, currTopNum);
7895
+ setScrollTop(bodyScrollElem, currTopNum);
7896
+ setScrollTop(leftScrollElem, currTopNum);
7897
+ setScrollTop(rightScrollElem, currTopNum);
7898
+ $xeTable.triggerScrollYEvent(evnt);
7899
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, scrollLeft, {
7900
+ type: 'table',
7901
+ fixed: ''
7902
+ });
7447
7903
  });
7448
- }
7449
- },
7450
- scrollXEvent(evnt) {
7904
+ // internalData.inWheelScroll = true
7905
+ // setScrollTop(yHandleEl, scrollTop)
7906
+ // setScrollTop(bodyScrollElem, scrollTop)
7907
+ // setScrollTop(leftScrollElem, scrollTop)
7908
+ // setScrollTop(rightScrollElem, scrollTop)
7909
+ // loadScrollYData($xeTable, scrollTop)
7910
+ // $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
7911
+ // type: 'footer',
7912
+ // fixed: ''
7913
+ // })
7914
+ }
7915
+ },
7916
+ triggerVirtualScrollXEvent(evnt) {
7451
7917
  const $xeTable = this;
7452
7918
  const internalData = $xeTable;
7453
7919
  const { elemStore, inWheelScroll, lastScrollTop, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData;
@@ -7480,7 +7946,7 @@ const Methods = {
7480
7946
  fixed: ''
7481
7947
  });
7482
7948
  },
7483
- scrollYEvent(evnt) {
7949
+ triggerVirtualScrollYEvent(evnt) {
7484
7950
  const $xeTable = this;
7485
7951
  const internalData = $xeTable;
7486
7952
  const { elemStore, inWheelScroll, lastScrollLeft, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData;
@@ -7518,9 +7984,7 @@ const Methods = {
7518
7984
  const props = $xeTable;
7519
7985
  const { showOverflow } = props;
7520
7986
  handleTableColumn($xeTable);
7521
- // calcCellHeight()
7522
7987
  return $xeTable.$nextTick().then(() => {
7523
- // calcCellHeight()
7524
7988
  handleTableColumn($xeTable);
7525
7989
  $xeTable.updateScrollXSpace();
7526
7990
  if (!showOverflow) {
@@ -7579,9 +8043,7 @@ const Methods = {
7579
8043
  updateScrollYData() {
7580
8044
  const $xeTable = this;
7581
8045
  $xeTable.handleTableData();
7582
- // calcCellHeight()
7583
8046
  return $xeTable.$nextTick().then(() => {
7584
- // calcCellHeight()
7585
8047
  $xeTable.handleTableData();
7586
8048
  $xeTable.updateScrollYSpace();
7587
8049
  });
@@ -7593,34 +8055,34 @@ const Methods = {
7593
8055
  const reactData = $xeTable;
7594
8056
  const internalData = $xeTable;
7595
8057
  const { showOverflow } = props;
7596
- const { scrollYLoad, rowHeight } = reactData;
7597
- const { scrollYStore, elemStore, afterFullData, fullAllDataRowIdData } = internalData;
8058
+ const { scrollYLoad } = reactData;
8059
+ const { scrollYStore, elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData;
7598
8060
  const { startIndex } = scrollYStore;
8061
+ const rowOpts = $xeTable.computeRowOpts;
8062
+ const cellOpts = $xeTable.computeCellOpts;
8063
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
7599
8064
  const bodyTableElem = getRefElem(elemStore['main-body-table']);
7600
8065
  const containerList = ['main', 'left', 'right'];
7601
8066
  let topSpaceHeight = 0;
7602
8067
  let ySpaceHeight = 0;
7603
8068
  if (scrollYLoad) {
7604
- if (showOverflow) {
7605
- ySpaceHeight = afterFullData.length * rowHeight;
7606
- topSpaceHeight = Math.max(0, startIndex * rowHeight);
8069
+ const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
8070
+ if (!isCustomCellHeight && showOverflow) {
8071
+ ySpaceHeight = afterFullData.length * defaultRowHeight;
8072
+ topSpaceHeight = Math.max(0, startIndex * defaultRowHeight);
7607
8073
  }
7608
8074
  else {
7609
8075
  for (let i = 0; i < afterFullData.length; i++) {
7610
8076
  const row = afterFullData[i];
7611
8077
  const rowid = getRowid($xeTable, row);
7612
8078
  const rowRest = fullAllDataRowIdData[rowid];
7613
- if (rowRest) {
7614
- ySpaceHeight += rowRest.height || rowHeight;
7615
- }
8079
+ ySpaceHeight += rowRest ? (rowRest.resizeHeight || cellOpts.height || rowOpts.height || defaultRowHeight) : defaultRowHeight;
7616
8080
  }
7617
8081
  for (let i = 0; i < startIndex; i++) {
7618
8082
  const row = afterFullData[i];
7619
8083
  const rowid = getRowid($xeTable, row);
7620
8084
  const rowRest = fullAllDataRowIdData[rowid];
7621
- if (rowRest) {
7622
- topSpaceHeight += rowRest.height || rowHeight;
7623
- }
8085
+ topSpaceHeight += rowRest ? (rowRest.resizeHeight || cellOpts.height || rowOpts.height || defaultRowHeight) : defaultRowHeight;
7624
8086
  }
7625
8087
  }
7626
8088
  }
@@ -7646,7 +8108,7 @@ const Methods = {
7646
8108
  if (scrollYSpaceEl) {
7647
8109
  scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
7648
8110
  }
7649
- $xeTable.$nextTick(() => {
8111
+ return $xeTable.$nextTick().then(() => {
7650
8112
  updateStyle($xeTable);
7651
8113
  });
7652
8114
  },