vxe-table 3.15.0-beta.4 → 3.15.0

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 (40) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/style.css +1 -1
  4. package/es/style.min.css +1 -1
  5. package/es/table/src/methods.js +58 -43
  6. package/es/table/src/table.js +2 -1
  7. package/es/table/style.css +12 -0
  8. package/es/table/style.min.css +1 -1
  9. package/es/ui/index.js +1 -1
  10. package/es/ui/src/log.js +1 -1
  11. package/es/vxe-table/style.css +12 -0
  12. package/es/vxe-table/style.min.css +1 -1
  13. package/lib/index.css +1 -1
  14. package/lib/index.min.css +1 -1
  15. package/lib/index.umd.js +67 -46
  16. package/lib/index.umd.min.js +1 -1
  17. package/lib/style.css +1 -1
  18. package/lib/style.min.css +1 -1
  19. package/lib/table/src/methods.js +63 -43
  20. package/lib/table/src/methods.min.js +1 -1
  21. package/lib/table/src/table.js +2 -1
  22. package/lib/table/src/table.min.js +1 -1
  23. package/lib/table/style/style.css +12 -0
  24. package/lib/table/style/style.min.css +1 -1
  25. package/lib/ui/index.js +1 -1
  26. package/lib/ui/index.min.js +1 -1
  27. package/lib/ui/src/log.js +1 -1
  28. package/lib/ui/src/log.min.js +1 -1
  29. package/lib/vxe-table/style/style.css +12 -0
  30. package/lib/vxe-table/style/style.min.css +1 -1
  31. package/package.json +2 -2
  32. package/packages/table/src/methods.ts +65 -44
  33. package/packages/table/src/table.ts +23 -22
  34. package/styles/components/table.scss +19 -0
  35. /package/es/{iconfont.1744095177947.ttf → iconfont.1744252945243.ttf} +0 -0
  36. /package/es/{iconfont.1744095177947.woff → iconfont.1744252945243.woff} +0 -0
  37. /package/es/{iconfont.1744095177947.woff2 → iconfont.1744252945243.woff2} +0 -0
  38. /package/lib/{iconfont.1744095177947.ttf → iconfont.1744252945243.ttf} +0 -0
  39. /package/lib/{iconfont.1744095177947.woff → iconfont.1744252945243.woff} +0 -0
  40. /package/lib/{iconfont.1744095177947.woff2 → iconfont.1744252945243.woff2} +0 -0
@@ -1757,10 +1757,8 @@ function autoCellWidth($xeTable) {
1757
1757
  const {
1758
1758
  elemStore
1759
1759
  } = internalData;
1760
- const scrollbarOpts = $xeTable.computeScrollbarOpts;
1761
- const tableBody = $xeTable.$refs.refTableBody;
1762
- const bodyElem = tableBody ? tableBody.$el : null;
1763
- if (!bodyElem) {
1760
+ const bodyWrapperElem = (0, _util.getRefElem)(elemStore['main-body-wrapper']);
1761
+ if (!bodyWrapperElem) {
1764
1762
  return;
1765
1763
  }
1766
1764
  const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
@@ -1773,7 +1771,7 @@ function autoCellWidth($xeTable) {
1773
1771
  }
1774
1772
  let tWidth = 0;
1775
1773
  const minCellWidth = 40; // 列宽最少限制 40px
1776
- const bodyWidth = bodyElem.clientWidth;
1774
+ const bodyWidth = bodyWrapperElem.clientWidth;
1777
1775
  let remainWidth = bodyWidth;
1778
1776
  let meanWidth = remainWidth / 100;
1779
1777
  const {
@@ -1854,9 +1852,9 @@ function autoCellWidth($xeTable) {
1854
1852
  });
1855
1853
  if (fit) {
1856
1854
  /**
1857
- * 偏移量算法
1858
- * 如果所有列足够放的情况下,从最后动态列开始分配
1859
- */
1855
+ * 偏移量算法
1856
+ * 如果所有列足够放的情况下,从最后动态列开始分配
1857
+ */
1860
1858
  const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList);
1861
1859
  let dynamicSize = dynamicList.length - 1;
1862
1860
  if (dynamicSize > 0) {
@@ -1870,28 +1868,10 @@ function autoCellWidth($xeTable) {
1870
1868
  }
1871
1869
  }
1872
1870
  }
1873
- const tableHeight = bodyElem.offsetHeight;
1874
- const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight;
1875
- reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth);
1876
- reactData.overflowY = overflowY;
1877
1871
  reactData.scrollXWidth = tWidth;
1878
- internalData.tableHeight = tableHeight;
1879
- const headerTableElem = (0, _util.getRefElem)(elemStore['main-header-table']);
1880
- const footerTableElem = (0, _util.getRefElem)(elemStore['main-footer-table']);
1881
- const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0;
1882
- const overflowX = tWidth > bodyWidth;
1883
- const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0;
1884
- reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight);
1885
- internalData.headerHeight = headerHeight;
1886
- internalData.footerHeight = footerHeight;
1887
- reactData.overflowX = overflowX;
1888
1872
  reactData.resizeWidthFlag++;
1889
1873
  updateColumnOffsetLeft($xeTable);
1890
1874
  updateHeight($xeTable);
1891
- reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight());
1892
- if (overflowX) {
1893
- $xeTable.checkScrolling();
1894
- }
1895
1875
  }
1896
1876
  const calcCellAutoHeight = (rowRest, wrapperEl) => {
1897
1877
  const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);
@@ -2300,7 +2280,7 @@ function computeScrollLoad($xeTable) {
2300
2280
  }
2301
2281
  // 计算 Y 逻辑
2302
2282
  const rowHeight = computeRowHeight($xeTable);
2303
- scrollYStore.rowHeight = rowHeight;
2283
+ scrollYStore.rowHeight = rowHeight; // 已废弃
2304
2284
  reactData.rowHeight = rowHeight;
2305
2285
  const {
2306
2286
  toVisibleIndex: toYVisibleIndex,
@@ -2320,11 +2300,48 @@ function computeScrollLoad($xeTable) {
2320
2300
  } else {
2321
2301
  $xeTable.updateScrollYSpace();
2322
2302
  }
2323
- $xeTable.$nextTick(() => {
2324
- updateStyle($xeTable);
2325
- });
2326
2303
  });
2327
2304
  }
2305
+ function calcScrollbar($xeTable) {
2306
+ const reactData = $xeTable;
2307
+ const internalData = $xeTable;
2308
+ const {
2309
+ scrollXWidth,
2310
+ scrollYHeight
2311
+ } = reactData;
2312
+ const {
2313
+ elemStore
2314
+ } = internalData;
2315
+ const scrollbarOpts = $xeTable.computeScrollbarOpts;
2316
+ const bodyWrapperElem = (0, _util.getRefElem)(elemStore['main-body-wrapper']);
2317
+ const headerTableElem = (0, _util.getRefElem)(elemStore['main-header-table']);
2318
+ const footerTableElem = (0, _util.getRefElem)(elemStore['main-footer-table']);
2319
+ const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
2320
+ const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
2321
+ let overflowY = false;
2322
+ let overflowX = false;
2323
+ if (bodyWrapperElem) {
2324
+ overflowY = scrollYHeight > bodyWrapperElem.clientHeight;
2325
+ if (yHandleEl) {
2326
+ reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth);
2327
+ }
2328
+ reactData.overflowY = overflowY;
2329
+ overflowX = scrollXWidth > bodyWrapperElem.clientWidth;
2330
+ if (xHandleEl) {
2331
+ reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight);
2332
+ }
2333
+ reactData.overflowX = overflowX;
2334
+ const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0;
2335
+ const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0;
2336
+ internalData.tableHeight = bodyWrapperElem.offsetHeight;
2337
+ internalData.headerHeight = headerHeight;
2338
+ internalData.footerHeight = footerHeight;
2339
+ reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight());
2340
+ }
2341
+ if (overflowX) {
2342
+ $xeTable.checkScrolling();
2343
+ }
2344
+ }
2328
2345
  function handleRecalculateLayout($xeTable, reFull) {
2329
2346
  const internalData = $xeTable;
2330
2347
  const el = $xeTable.$refs.refElem;
@@ -2342,21 +2359,22 @@ function handleRecalculateLayout($xeTable, reFull) {
2342
2359
  }
2343
2360
  calcCellWidth($xeTable);
2344
2361
  autoCellWidth($xeTable);
2362
+ calcScrollbar($xeTable);
2345
2363
  updateStyle($xeTable);
2346
- if (reFull) {
2347
- updateRowOffsetTop($xeTable);
2348
- }
2349
2364
  updateRowExpandStyle($xeTable);
2350
2365
  return computeScrollLoad($xeTable).then(() => {
2351
- if (reFull === true) {
2352
- // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
2353
- calcCellWidth($xeTable);
2366
+ // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
2367
+ calcCellWidth($xeTable);
2368
+ if (reFull) {
2354
2369
  autoCellWidth($xeTable);
2355
- updateStyle($xeTable);
2356
- if (reFull) {
2357
- updateRowOffsetTop($xeTable);
2358
- }
2359
- updateRowExpandStyle($xeTable);
2370
+ }
2371
+ calcScrollbar($xeTable);
2372
+ updateStyle($xeTable);
2373
+ if (reFull) {
2374
+ updateRowOffsetTop($xeTable);
2375
+ }
2376
+ updateRowExpandStyle($xeTable);
2377
+ if (reFull) {
2360
2378
  return computeScrollLoad($xeTable);
2361
2379
  }
2362
2380
  });
@@ -3343,6 +3361,7 @@ const Methods = {
3343
3361
  }
3344
3362
  reactData.isRowLoading = false;
3345
3363
  calcCellHeight($xeTable);
3364
+ updateRowOffsetTop($xeTable);
3346
3365
  // 是否变更虚拟滚动
3347
3366
  if (oldScrollYLoad === sYLoad) {
3348
3367
  (0, _util.restoreScrollLocation)($xeTable, targetScrollLeft, targetScrollTop).then(() => {
@@ -5652,6 +5671,7 @@ const Methods = {
5652
5671
  }
5653
5672
  }
5654
5673
  return $xeTable.$nextTick().then(() => {
5674
+ updateRowOffsetTop($xeTable);
5655
5675
  return {
5656
5676
  status
5657
5677
  };
@@ -10490,11 +10510,11 @@ const Methods = {
10490
10510
  const firstRow = afterFullData[startIndex];
10491
10511
  let rowid = (0, _util.getRowid)($xeTable, firstRow);
10492
10512
  let rowRest = fullAllDataRowIdData[rowid] || {};
10493
- ySpaceTop = rowRest.oTop;
10513
+ ySpaceTop = rowRest.oTop || 0;
10494
10514
  const lastRow = afterFullData[afterFullData.length - 1];
10495
10515
  rowid = (0, _util.getRowid)($xeTable, lastRow);
10496
10516
  rowRest = fullAllDataRowIdData[rowid] || {};
10497
- scrollYHeight = rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
10517
+ scrollYHeight = (rowRest.oTop || 0) + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
10498
10518
  // 是否展开行
10499
10519
  if (expandColumn && rowExpandedMaps[rowid]) {
10500
10520
  scrollYHeight += rowRest.expandHeight || expandOpts.height || 0;