vxe-table 3.18.0-beta.6 → 3.18.0-beta.7

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 (48) 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/module/custom/panel.js +0 -20
  6. package/es/table/src/anime.js +4 -4
  7. package/es/table/src/methods.js +60 -17
  8. package/es/table/src/table.js +79 -55
  9. package/es/table/style.css +178 -163
  10. package/es/table/style.min.css +1 -1
  11. package/es/ui/index.js +1 -1
  12. package/es/ui/src/log.js +1 -1
  13. package/es/vxe-table/style.css +178 -163
  14. package/es/vxe-table/style.min.css +1 -1
  15. package/lib/index.css +1 -1
  16. package/lib/index.min.css +1 -1
  17. package/lib/index.umd.js +104 -61
  18. package/lib/index.umd.min.js +1 -1
  19. package/lib/style.css +1 -1
  20. package/lib/style.min.css +1 -1
  21. package/lib/table/module/custom/panel.js +0 -22
  22. package/lib/table/module/custom/panel.min.js +1 -1
  23. package/lib/table/src/anime.js +4 -4
  24. package/lib/table/src/anime.min.js +1 -1
  25. package/lib/table/src/methods.js +62 -17
  26. package/lib/table/src/methods.min.js +1 -1
  27. package/lib/table/src/table.js +36 -16
  28. package/lib/table/src/table.min.js +1 -1
  29. package/lib/table/style/style.css +178 -163
  30. package/lib/table/style/style.min.css +1 -1
  31. package/lib/ui/index.js +1 -1
  32. package/lib/ui/index.min.js +1 -1
  33. package/lib/ui/src/log.js +1 -1
  34. package/lib/ui/src/log.min.js +1 -1
  35. package/lib/vxe-table/style/style.css +178 -163
  36. package/lib/vxe-table/style/style.min.css +1 -1
  37. package/package.json +1 -1
  38. package/packages/table/module/custom/panel.ts +0 -21
  39. package/packages/table/src/anime.ts +4 -4
  40. package/packages/table/src/methods.ts +60 -18
  41. package/packages/table/src/table.ts +80 -55
  42. package/styles/components/table.scss +166 -165
  43. /package/es/{iconfont.1755597272692.ttf → iconfont.1755650997091.ttf} +0 -0
  44. /package/es/{iconfont.1755597272692.woff → iconfont.1755650997091.woff} +0 -0
  45. /package/es/{iconfont.1755597272692.woff2 → iconfont.1755650997091.woff2} +0 -0
  46. /package/lib/{iconfont.1755597272692.ttf → iconfont.1755650997091.ttf} +0 -0
  47. /package/lib/{iconfont.1755597272692.woff → iconfont.1755650997091.woff} +0 -0
  48. /package/lib/{iconfont.1755597272692.woff2 → iconfont.1755650997091.woff2} +0 -0
@@ -894,8 +894,6 @@ export default {
894
894
  const VxeUIRadioGroupComponent = VxeUI.getComponent('VxeRadioGroup');
895
895
  $xeTableCustomPanel.$nextTick(() => {
896
896
  const $xeTable = $xeTableCustomPanel.$xeTable;
897
- const $xeGantt = $xeTable.$xeGantt;
898
- const tableInternalData = $xeTable;
899
897
  const { customOpts } = $xeTable;
900
898
  const { mode } = customOpts;
901
899
  if (!VxeUIModalComponent && (mode === 'modal')) {
@@ -913,26 +911,8 @@ export default {
913
911
  if (!VxeUIRadioGroupComponent) {
914
912
  errLog('vxe.error.reqComp', ['vxe-radio-group']);
915
913
  }
916
- if ($xeGantt) {
917
- const { teleportToWrapperElem } = tableInternalData;
918
- const el = $xeTableCustomPanel.$refs.refElem;
919
- if (el && teleportToWrapperElem) {
920
- teleportToWrapperElem.appendChild(el);
921
- }
922
- }
923
914
  });
924
915
  },
925
- beforeDestroy() {
926
- const $xeTableCustomPanel = this;
927
- const $xeTable = $xeTableCustomPanel.$xeTable;
928
- const $xeGantt = $xeTable.$xeGantt;
929
- if ($xeGantt) {
930
- const el = $xeTableCustomPanel.$refs.refElem;
931
- if (el && el.parentElement) {
932
- el.parentElement.removeChild(el);
933
- }
934
- }
935
- },
936
916
  render(h) {
937
917
  const $xeTableCustomPanel = this;
938
918
  const $xeTable = $xeTableCustomPanel.$xeTable;
@@ -16,10 +16,10 @@ export function moveRowAnimateToTb(elemList, offsetTop) {
16
16
  });
17
17
  });
18
18
  }
19
- export function clearRowAnimate(elem) {
19
+ export function clearRowAnimate(elem, clss) {
20
20
  setTimeout(() => {
21
21
  if (elem) {
22
- XEUtils.arrayEach(elem.querySelectorAll(`.vxe-body--row.${rowMoveCls}`), elem => removeClass(elem, rowMoveCls));
22
+ XEUtils.arrayEach(elem.querySelectorAll(clss.map(cls => `${cls}.${rowMoveCls}`).join(',')), elem => removeClass(elem, rowMoveCls));
23
23
  }
24
24
  }, 500);
25
25
  }
@@ -37,10 +37,10 @@ export function moveColAnimateToLr(elemList, offsetLeft) {
37
37
  });
38
38
  });
39
39
  }
40
- export function clearColAnimate(elem) {
40
+ export function clearColAnimate(elem, clss) {
41
41
  setTimeout(() => {
42
42
  if (elem) {
43
- XEUtils.arrayEach(elem.querySelectorAll(`.vxe-table--column.${colMoveClass}`), elem => removeClass(elem, colMoveClass));
43
+ XEUtils.arrayEach(elem.querySelectorAll(clss.map(cls => `${cls}.${rowMoveCls}`).join(',')), elem => removeClass(elem, colMoveClass));
44
44
  }
45
45
  }, 500);
46
46
  }
@@ -2442,19 +2442,26 @@ function updateColDropTipContent($xeTable, tdEl) {
2442
2442
  reactData.dragTipText = tipContent;
2443
2443
  }
2444
2444
  function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
2445
+ const $xeGantt = $xeTable.$xeGantt;
2445
2446
  const reactData = $xeTable;
2446
2447
  const internalData = $xeTable;
2447
- const el = $xeTable.$refs.refElem;
2448
- if (!el) {
2448
+ let wrapperEl = $xeTable.$refs.refElem;
2449
+ if ($xeGantt && trEl) {
2450
+ const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
2451
+ if (ganttContainerElem) {
2452
+ wrapperEl = ganttContainerElem;
2453
+ }
2454
+ }
2455
+ if (!wrapperEl) {
2449
2456
  return;
2450
2457
  }
2451
2458
  const { overflowX, scrollbarWidth, overflowY, scrollbarHeight } = reactData;
2452
2459
  const { prevDragToChild } = internalData;
2453
- const wrapperRect = el.getBoundingClientRect();
2460
+ const wrapperRect = wrapperEl.getBoundingClientRect();
2454
2461
  const osbWidth = overflowY ? scrollbarWidth : 0;
2455
2462
  const osbHeight = overflowX ? scrollbarHeight : 0;
2456
- const tableWrapperWidth = el.clientWidth;
2457
- const tableWrapperHeight = el.clientHeight;
2463
+ const tableWrapperWidth = wrapperEl.clientWidth;
2464
+ const tableWrapperHeight = wrapperEl.clientHeight;
2458
2465
  if (trEl) {
2459
2466
  const rdLineEl = $xeTable.$refs.refDragRowLineElem;
2460
2467
  if (rdLineEl) {
@@ -2522,8 +2529,8 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
2522
2529
  const rdTipEl = $xeTable.$refs.refDragTipElem;
2523
2530
  if (rdTipEl) {
2524
2531
  rdTipEl.style.display = 'block';
2525
- rdTipEl.style.top = `${Math.min(el.clientHeight - el.scrollTop - rdTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`;
2526
- rdTipEl.style.left = `${Math.min(el.clientWidth - el.scrollLeft - rdTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`;
2532
+ rdTipEl.style.top = `${Math.min(wrapperEl.clientHeight - wrapperEl.scrollTop - rdTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`;
2533
+ rdTipEl.style.left = `${Math.min(wrapperEl.clientWidth - wrapperEl.scrollLeft - rdTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`;
2527
2534
  rdTipEl.setAttribute('drag-status', showLine ? (prevDragToChild ? 'sub' : 'normal') : 'disabled');
2528
2535
  }
2529
2536
  }
@@ -5515,7 +5522,7 @@ const Methods = {
5515
5522
  if (!cell) {
5516
5523
  return;
5517
5524
  }
5518
- const cellParams = XEUtils.assign(params, { cell });
5525
+ const cellParams = XEUtils.assign(params, { cell, $table: $xeTable });
5519
5526
  let dragLeft = 0;
5520
5527
  const tableRect = tableEl.getBoundingClientRect();
5521
5528
  const rightContainerRect = rightContainerElem ? rightContainerElem.getBoundingClientRect() : null;
@@ -5645,7 +5652,7 @@ const Methods = {
5645
5652
  const colRest = fullColumnIdData[colid];
5646
5653
  const dragBtnElem = evnt.target;
5647
5654
  const cell = dragBtnElem.parentNode;
5648
- const cellParams = Object.assign(params, { cell });
5655
+ const cellParams = Object.assign(params, { cell, $table: $xeTable });
5649
5656
  const colMinWidth = getColReMinWidth(cellParams);
5650
5657
  el.setAttribute('data-calc-col', 'Y');
5651
5658
  let resizeWidth = calcColumnAutoWidth($xeTable, resizeColumn, el);
@@ -5673,6 +5680,7 @@ const Methods = {
5673
5680
  const internalData = $xeTable;
5674
5681
  evnt.stopPropagation();
5675
5682
  evnt.preventDefault();
5683
+ const $xeGantt = $xeTable.$xeGantt;
5676
5684
  const { row } = params;
5677
5685
  const { showOverflow } = props;
5678
5686
  const { overflowX, scrollbarWidth, overflowY, scrollbarHeight } = reactData;
@@ -5683,7 +5691,13 @@ const Methods = {
5683
5691
  const resizableOpts = $xeTable.computeResizableOpts;
5684
5692
  const rowOpts = $xeTable.computeRowOpts;
5685
5693
  const cellOpts = $xeTable.computeCellOpts;
5686
- const tableEl = $xeTable.$refs.refElem;
5694
+ let tableEl = $xeTable.$refs.refElem;
5695
+ if ($xeGantt) {
5696
+ const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
5697
+ if (ganttContainerElem) {
5698
+ tableEl = ganttContainerElem;
5699
+ }
5700
+ }
5687
5701
  const resizeBarElem = $xeTable.$refs.refRowResizeBar;
5688
5702
  if (!resizeBarElem) {
5689
5703
  return;
@@ -8115,6 +8129,7 @@ const Methods = {
8115
8129
  },
8116
8130
  handleRowDragSwapEvent(evnt, isSyncRow, dragRow, prevDragRow, prevDragPos, prevDragToChild) {
8117
8131
  const $xeTable = this;
8132
+ const $xeGantt = $xeTable.$xeGantt;
8118
8133
  const props = $xeTable;
8119
8134
  const reactData = $xeTable;
8120
8135
  const internalData = $xeTable;
@@ -8307,6 +8322,13 @@ const Methods = {
8307
8322
  const _newRowIndex = dragRowRest._index;
8308
8323
  const firstRow = tableData[0];
8309
8324
  const firstRowRest = fullAllDataRowIdData[getRowid($xeTable, firstRow)];
8325
+ let wrapperEl = el;
8326
+ if ($xeGantt) {
8327
+ const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
8328
+ if (ganttContainerElem) {
8329
+ wrapperEl = ganttContainerElem;
8330
+ }
8331
+ }
8310
8332
  if (firstRowRest) {
8311
8333
  const _firstRowIndex = firstRowRest._index;
8312
8334
  const _lastRowIndex = _firstRowIndex + tableData.length;
@@ -8340,14 +8362,26 @@ const Methods = {
8340
8362
  }
8341
8363
  const dragRangeList = tableData.slice(rsIndex, reIndex);
8342
8364
  if (dragRangeList.length) {
8343
- const dtTrList = el.querySelectorAll(dragRangeList.map(row => `.vxe-body--row[rowid="${getRowid($xeTable, row)}"]`).join(','));
8365
+ const dtClss = [];
8366
+ dragRangeList.forEach(row => {
8367
+ const rowid = getRowid($xeTable, row);
8368
+ dtClss.push(`.vxe-body--row[rowid="${rowid}"]`);
8369
+ if ($xeGantt) {
8370
+ dtClss.push(`.vxe-gantt-view--body-row[rowid="${rowid}"]`, `.vxe-gantt-view--chart-row[rowid="${rowid}"]`);
8371
+ }
8372
+ });
8373
+ const dtTrList = wrapperEl.querySelectorAll(dtClss.join(','));
8344
8374
  moveRowAnimateToTb(dtTrList, offsetRate * dragRowHeight);
8345
8375
  }
8346
8376
  }
8347
- const newTrList = el.querySelectorAll(`.vxe-body--row[rowid="${dragRowid}"]`);
8348
- const newTrEl = newTrList[0];
8377
+ const drClss = [`.vxe-body--row[rowid="${dragRowid}"]`];
8378
+ if ($xeGantt) {
8379
+ drClss.push(`.vxe-gantt-view--body-row[rowid="${dragRowid}"]`, `.vxe-gantt-view--chart-row[rowid="${dragRowid}"]`);
8380
+ }
8381
+ const newDtTrList = wrapperEl.querySelectorAll(drClss.join(','));
8382
+ const newTrEl = newDtTrList[0];
8349
8383
  if (dragOffsetTop > -1 && newTrEl) {
8350
- moveRowAnimateToTb(newTrList, dragOffsetTop - newTrEl.offsetTop);
8384
+ moveRowAnimateToTb(newDtTrList, dragOffsetTop - newTrEl.offsetTop);
8351
8385
  }
8352
8386
  }
8353
8387
  updateRowOffsetTop($xeTable);
@@ -8367,6 +8401,7 @@ const Methods = {
8367
8401
  },
8368
8402
  handleRowDragDragendEvent(evnt) {
8369
8403
  const $xeTable = this;
8404
+ const $xeGantt = $xeTable.$xeGantt;
8370
8405
  const props = $xeTable;
8371
8406
  const reactData = $xeTable;
8372
8407
  const internalData = $xeTable;
@@ -8377,7 +8412,7 @@ const Methods = {
8377
8412
  const { lazy } = treeOpts;
8378
8413
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
8379
8414
  const { prevDragRow, prevDragPos } = internalData;
8380
- const el = $xeTable.$refs.refElem;
8415
+ let wrapperEl = $xeTable.$refs.refElem;
8381
8416
  if (treeConfig && lazy && prevDragToChild) {
8382
8417
  // 懒加载
8383
8418
  const newRowid = getRowid($xeTable, prevDragRow);
@@ -8394,9 +8429,17 @@ const Methods = {
8394
8429
  else {
8395
8430
  $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
8396
8431
  }
8432
+ const dtClss = ['.vxe-body--row'];
8433
+ if ($xeGantt) {
8434
+ const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
8435
+ if (ganttContainerElem) {
8436
+ wrapperEl = ganttContainerElem;
8437
+ }
8438
+ dtClss.push('.vxe-gantt-view--body-row', '.vxe-gantt-view--chart-row');
8439
+ }
8397
8440
  hideDropTip($xeTable);
8398
8441
  clearRowDropOrigin($xeTable);
8399
- clearRowAnimate(el);
8442
+ clearRowAnimate(wrapperEl, dtClss);
8400
8443
  internalData.prevDragToChild = false;
8401
8444
  reactData.dragRow = null;
8402
8445
  reactData.dragCol = null;
@@ -8785,7 +8828,7 @@ const Methods = {
8785
8828
  $xeTable.handleColDragSwapEvent(evnt, true, dragCol, prevDragCol, prevDragPos, prevDragToChild);
8786
8829
  hideDropTip($xeTable);
8787
8830
  clearColDropOrigin($xeTable);
8788
- clearColAnimate(el);
8831
+ clearColAnimate(el, ['.vxe-table--column']);
8789
8832
  internalData.prevDragToChild = false;
8790
8833
  reactData.dragRow = null;
8791
8834
  reactData.dragCol = null;
@@ -1568,6 +1568,14 @@ export default {
1568
1568
  if (checkboxOpts.halfField) {
1569
1569
  warnLog('vxe.error.delProp', ['checkbox-config.halfField', 'checkbox-config.indeterminateField']);
1570
1570
  }
1571
+ if (treeConfig) {
1572
+ XEUtils.arrayEach(['rowField', 'parentField', 'childrenField', 'hasChildField', 'mapChildrenField'], key => {
1573
+ const val = treeOpts[key];
1574
+ if (val && val.indexOf('.') > -1) {
1575
+ errLog('vxe.error.errProp', [`${key}=${val}`, `${key}=${val.split('.')[0]}`]);
1576
+ }
1577
+ });
1578
+ }
1571
1579
  // 在 v3.0 中废弃 context-menu
1572
1580
  if (this.contextMenu) {
1573
1581
  warnLog('vxe.error.delProp', ['context-menu', 'menu-config']);
@@ -1680,7 +1688,11 @@ export default {
1680
1688
  const virtualYOpts = $xeTable.computeVirtualYOpts;
1681
1689
  if ($xeGantt) {
1682
1690
  const classifyWrapperEl = $xeGantt.$refs.refClassifyWrapperElem;
1691
+ const teleportWrapperEl = $xeTable.$refs.refTeleportWrapper;
1683
1692
  if (classifyWrapperEl) {
1693
+ if (teleportWrapperEl) {
1694
+ classifyWrapperEl.appendChild(teleportWrapperEl);
1695
+ }
1684
1696
  internalData.teleportToWrapperElem = classifyWrapperEl;
1685
1697
  }
1686
1698
  }
@@ -1758,6 +1770,10 @@ export default {
1758
1770
  },
1759
1771
  beforeDestroy() {
1760
1772
  const $xeTable = this;
1773
+ const teleportWrapperEl = $xeTable.$refs.refTeleportWrapper;
1774
+ if (teleportWrapperEl && teleportWrapperEl.parentElement) {
1775
+ teleportWrapperEl.parentElement.removeChild(teleportWrapperEl);
1776
+ }
1761
1777
  const tableViewportEl = $xeTable.$refs.refTableViewportElem;
1762
1778
  if (tableViewportEl) {
1763
1779
  tableViewportEl.removeEventListener('wheel', $xeTable.triggerBodyWheelEvent);
@@ -1928,57 +1944,69 @@ export default {
1928
1944
  })
1929
1945
  ]
1930
1946
  : []),
1931
- /**
1932
- * 行高线
1933
- */
1934
1947
  h('div', {
1935
- key: 'trl',
1936
- ref: 'refRowResizeBar',
1937
- class: 'vxe-table--resizable-row-bar'
1938
- }, resizableOpts.showDragTip
1939
- ? [
1948
+ key: 'ttw'
1949
+ }, [
1950
+ h('div', {
1951
+ ref: 'refTeleportWrapper'
1952
+ }, [
1953
+ /**
1954
+ * 行高线
1955
+ */
1940
1956
  h('div', {
1941
- class: 'vxe-table--resizable-number-tip'
1942
- })
1943
- ]
1944
- : []),
1945
- /**
1946
- * 加载中
1947
- */
1948
- VxeUILoadingComponent
1949
- ? h(VxeUILoadingComponent, {
1950
- key: 'lg',
1951
- class: 'vxe-table--loading',
1952
- props: {
1953
- value: currLoading,
1954
- icon: loadingOpts.icon,
1955
- text: loadingOpts.text
1956
- },
1957
- scopedSlots: loadingSlot
1958
- ? {
1959
- default: () => $xeTable.callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, loading: currLoading }, h)
1960
- }
1961
- : {}
1962
- })
1963
- : loadingSlot
1964
- ? h('div', {
1965
- class: ['vxe-loading--custom-wrapper', {
1966
- 'is--visible': currLoading
1967
- }]
1968
- }, $xeTable.callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, loading: currLoading }, h))
1969
- : renderEmptyElement($xeTable),
1970
- /**
1971
- * 自定义列
1972
- */
1973
- initStore.custom
1974
- ? h(TableCustomPanelComponent, {
1975
- key: 'cs',
1976
- ref: 'refTableCustom',
1977
- props: {
1978
- customStore
1979
- }
1980
- })
1981
- : renderEmptyElement($xeTable),
1957
+ key: 'trl',
1958
+ ref: 'refRowResizeBar',
1959
+ class: 'vxe-table--resizable-row-bar'
1960
+ }, resizableOpts.showDragTip
1961
+ ? [
1962
+ h('div', {
1963
+ class: 'vxe-table--resizable-number-tip'
1964
+ })
1965
+ ]
1966
+ : []),
1967
+ /**
1968
+ * 自定义列
1969
+ */
1970
+ initStore.custom
1971
+ ? h(TableCustomPanelComponent, {
1972
+ key: 'cs',
1973
+ ref: 'refTableCustom',
1974
+ props: {
1975
+ customStore
1976
+ }
1977
+ })
1978
+ : renderEmptyElement($xeTable),
1979
+ /**
1980
+ * 加载中
1981
+ */
1982
+ VxeUILoadingComponent
1983
+ ? h(VxeUILoadingComponent, {
1984
+ key: 'lg',
1985
+ class: 'vxe-table--loading',
1986
+ props: {
1987
+ value: currLoading,
1988
+ icon: loadingOpts.icon,
1989
+ text: loadingOpts.text
1990
+ },
1991
+ scopedSlots: loadingSlot
1992
+ ? {
1993
+ default: () => $xeTable.callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, loading: currLoading }, h)
1994
+ }
1995
+ : {}
1996
+ })
1997
+ : loadingSlot
1998
+ ? h('div', {
1999
+ class: ['vxe-loading--custom-wrapper', {
2000
+ 'is--visible': currLoading
2001
+ }]
2002
+ }, $xeTable.callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, loading: currLoading }, h))
2003
+ : renderEmptyElement($xeTable),
2004
+ /**
2005
+ * 拖拽提示
2006
+ */
2007
+ renderDragTip(h, this)
2008
+ ])
2009
+ ]),
1982
2010
  /**
1983
2011
  * 筛选
1984
2012
  */
@@ -2016,8 +2044,8 @@ export default {
2016
2044
  })
2017
2045
  : renderEmptyElement($xeTable),
2018
2046
  /**
2019
- * 快捷菜单
2020
- */
2047
+ * 快捷菜单
2048
+ */
2021
2049
  isMenu
2022
2050
  ? h(TableMenuPanelComponent, {
2023
2051
  key: 'tm',
@@ -2028,10 +2056,6 @@ export default {
2028
2056
  }
2029
2057
  })
2030
2058
  : renderEmptyElement($xeTable),
2031
- /**
2032
- * 拖拽提示
2033
- */
2034
- renderDragTip(h, this),
2035
2059
  h('div', {}, [
2036
2060
  /**
2037
2061
  * 提示相关