vxe-table 4.16.0-beta.5 → 4.16.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 +119 -125
  6. package/es/table/src/anime.js +4 -4
  7. package/es/table/src/cell.js +29 -6
  8. package/es/table/src/table.js +145 -70
  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 +70 -39
  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 +2 -8
  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/cell.js +39 -3
  26. package/lib/table/src/cell.min.js +1 -1
  27. package/lib/table/src/table.js +22 -22
  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 +3 -2
  38. package/packages/table/module/custom/panel.ts +128 -134
  39. package/packages/table/src/anime.ts +4 -4
  40. package/packages/table/src/cell.ts +30 -6
  41. package/packages/table/src/table.ts +149 -71
  42. package/styles/components/table.scss +166 -165
  43. /package/es/{iconfont.1755588973979.ttf → iconfont.1755651021240.ttf} +0 -0
  44. /package/es/{iconfont.1755588973979.woff → iconfont.1755651021240.woff} +0 -0
  45. /package/es/{iconfont.1755588973979.woff2 → iconfont.1755651021240.woff2} +0 -0
  46. /package/lib/{iconfont.1755588973979.ttf → iconfont.1755651021240.ttf} +0 -0
  47. /package/lib/{iconfont.1755588973979.woff → iconfont.1755651021240.woff} +0 -0
  48. /package/lib/{iconfont.1755588973979.woff2 → iconfont.1755651021240.woff2} +0 -0
@@ -1,4 +1,4 @@
1
- import { h, reactive, ref, provide, inject, nextTick, onActivated, onDeactivated, onBeforeUnmount, onUnmounted, watch, computed, onMounted } from 'vue';
1
+ import { h, reactive, ref, provide, inject, nextTick, Teleport, onActivated, onDeactivated, onBeforeUnmount, onUnmounted, watch, computed, onMounted } from 'vue';
2
2
  import { defineVxeComponent } from '../../ui/src/comp';
3
3
  import XEUtils from 'xe-utils';
4
4
  import { initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, toCssUnit, hasControlKey } from '../../ui/src/dom';
@@ -44,6 +44,9 @@ export default defineVxeComponent({
44
44
  const VxeUILoadingComponent = VxeUI.getComponent('VxeLoading');
45
45
  const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip');
46
46
  const $xeTabs = inject('$xeTabs', null);
47
+ const $xeGrid = inject('$xeGrid', null);
48
+ const $xeGantt = inject('$xeGantt', null);
49
+ const $xeGGWrapper = $xeGrid || $xeGantt;
47
50
  const { computeSize } = useFns.useSize(props);
48
51
  const reactData = reactive({
49
52
  // 低性能的静态列
@@ -306,6 +309,7 @@ export default defineVxeComponent({
306
309
  const refTableRightHeader = ref();
307
310
  const refTableRightBody = ref();
308
311
  const refTableRightFooter = ref();
312
+ const refTeleportWrapper = ref();
309
313
  const refLeftContainer = ref();
310
314
  const refRightContainer = ref();
311
315
  const refColResizeBar = ref();
@@ -328,9 +332,6 @@ export default defineVxeComponent({
328
332
  const refScrollYBottomCornerElem = ref();
329
333
  const refScrollXSpaceElem = ref();
330
334
  const refScrollYSpaceElem = ref();
331
- const $xeGrid = inject('$xeGrid', null);
332
- const $xeGantt = inject('$xeGantt', null);
333
- const $xeGGWrapper = $xeGrid || $xeGantt;
334
335
  let $xeToolbar;
335
336
  const computeTableId = computed(() => {
336
337
  const { id } = props;
@@ -7706,17 +7707,24 @@ export default defineVxeComponent({
7706
7707
  reactData.dragTipText = tipContent;
7707
7708
  };
7708
7709
  const showDropTip = (evnt, trEl, thEl, showLine, dragPos) => {
7709
- const el = refElem.value;
7710
- if (!el) {
7710
+ let wrapperEl = refElem.value;
7711
+ if ($xeGantt && trEl) {
7712
+ const { refGanttContainerElem } = $xeGantt.getRefMaps();
7713
+ const ganttContainerElem = refGanttContainerElem.value;
7714
+ if (ganttContainerElem) {
7715
+ wrapperEl = ganttContainerElem;
7716
+ }
7717
+ }
7718
+ if (!wrapperEl) {
7711
7719
  return;
7712
7720
  }
7713
7721
  const { overflowX, scrollbarWidth, overflowY, scrollbarHeight } = reactData;
7714
7722
  const { prevDragToChild } = internalData;
7715
- const wrapperRect = el.getBoundingClientRect();
7723
+ const wrapperRect = wrapperEl.getBoundingClientRect();
7716
7724
  const osbWidth = overflowY ? scrollbarWidth : 0;
7717
7725
  const osbHeight = overflowX ? scrollbarHeight : 0;
7718
- const tableWrapperWidth = el.clientWidth;
7719
- const tableWrapperHeight = el.clientHeight;
7726
+ const tableWrapperWidth = wrapperEl.clientWidth;
7727
+ const tableWrapperHeight = wrapperEl.clientHeight;
7720
7728
  if (trEl) {
7721
7729
  const rdLineEl = refDragRowLineElem.value;
7722
7730
  if (rdLineEl) {
@@ -7784,8 +7792,8 @@ export default defineVxeComponent({
7784
7792
  const rdTipEl = refDragTipElem.value;
7785
7793
  if (rdTipEl) {
7786
7794
  rdTipEl.style.display = 'block';
7787
- rdTipEl.style.top = `${Math.min(el.clientHeight - el.scrollTop - rdTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`;
7788
- rdTipEl.style.left = `${Math.min(el.clientWidth - el.scrollLeft - rdTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`;
7795
+ rdTipEl.style.top = `${Math.min(wrapperEl.clientHeight - wrapperEl.scrollTop - rdTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`;
7796
+ rdTipEl.style.left = `${Math.min(wrapperEl.clientWidth - wrapperEl.scrollLeft - rdTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`;
7789
7797
  rdTipEl.setAttribute('drag-status', showLine ? (prevDragToChild ? 'sub' : 'normal') : 'disabled');
7790
7798
  }
7791
7799
  };
@@ -8159,7 +8167,7 @@ export default defineVxeComponent({
8159
8167
  if (!cell) {
8160
8168
  return;
8161
8169
  }
8162
- const cellParams = XEUtils.assign(params, { cell });
8170
+ const cellParams = XEUtils.assign(params, { cell, $table: $xeTable });
8163
8171
  let dragLeft = 0;
8164
8172
  const tableRect = tableEl.getBoundingClientRect();
8165
8173
  const rightContainerRect = rightContainerElem ? rightContainerElem.getBoundingClientRect() : null;
@@ -8286,7 +8294,7 @@ export default defineVxeComponent({
8286
8294
  const colRest = fullColumnIdData[colid];
8287
8295
  const dragBtnElem = evnt.target;
8288
8296
  const cell = dragBtnElem.parentNode;
8289
- const cellParams = Object.assign(params, { cell });
8297
+ const cellParams = Object.assign(params, { cell, $table: $xeTable });
8290
8298
  const colMinWidth = getColReMinWidth(cellParams);
8291
8299
  el.setAttribute('data-calc-col', 'Y');
8292
8300
  let resizeWidth = calcColumnAutoWidth(resizeColumn, el);
@@ -8320,7 +8328,14 @@ export default defineVxeComponent({
8320
8328
  const resizableOpts = computeResizableOpts.value;
8321
8329
  const rowOpts = computeRowOpts.value;
8322
8330
  const cellOpts = computeCellOpts.value;
8323
- const tableEl = refElem.value;
8331
+ let tableEl = refElem.value;
8332
+ if ($xeGantt) {
8333
+ const { refGanttContainerElem } = $xeGantt.getRefMaps();
8334
+ const ganttContainerElem = refGanttContainerElem.value;
8335
+ if (ganttContainerElem) {
8336
+ tableEl = ganttContainerElem;
8337
+ }
8338
+ }
8324
8339
  const resizeBarElem = refRowResizeBar.value;
8325
8340
  if (!resizeBarElem) {
8326
8341
  return;
@@ -9570,6 +9585,7 @@ export default defineVxeComponent({
9570
9585
  const { treeConfig, dragConfig } = props;
9571
9586
  const rowDragOpts = computeRowDragOpts.value;
9572
9587
  const { afterFullData, tableFullData, fullAllDataRowIdData } = internalData;
9588
+ const $xeGanttView = internalData.xeGanttView;
9573
9589
  const { animation, isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod, dragToChildMethod } = rowDragOpts;
9574
9590
  const treeOpts = computeTreeOpts.value;
9575
9591
  const cellOpts = computeCellOpts.value;
@@ -9756,6 +9772,14 @@ export default defineVxeComponent({
9756
9772
  const _newRowIndex = dragRowRest._index;
9757
9773
  const firstRow = tableData[0];
9758
9774
  const firstRowRest = fullAllDataRowIdData[getRowid($xeTable, firstRow)];
9775
+ let wrapperEl = el;
9776
+ if ($xeGantt && $xeGanttView) {
9777
+ const { refGanttContainerElem } = $xeGantt.getRefMaps();
9778
+ const ganttContainerElem = refGanttContainerElem.value;
9779
+ if (ganttContainerElem) {
9780
+ wrapperEl = ganttContainerElem;
9781
+ }
9782
+ }
9759
9783
  if (firstRowRest) {
9760
9784
  const _firstRowIndex = firstRowRest._index;
9761
9785
  const _lastRowIndex = _firstRowIndex + tableData.length;
@@ -9789,14 +9813,26 @@ export default defineVxeComponent({
9789
9813
  }
9790
9814
  const dragRangeList = tableData.slice(rsIndex, reIndex);
9791
9815
  if (dragRangeList.length) {
9792
- const dtTrList = el.querySelectorAll(dragRangeList.map(row => `.vxe-body--row[rowid="${getRowid($xeTable, row)}"]`).join(','));
9816
+ const dtClss = [];
9817
+ dragRangeList.forEach(row => {
9818
+ const rowid = getRowid($xeTable, row);
9819
+ dtClss.push(`.vxe-body--row[rowid="${rowid}"]`);
9820
+ if ($xeGantt) {
9821
+ dtClss.push(`.vxe-gantt-view--body-row[rowid="${rowid}"]`, `.vxe-gantt-view--chart-row[rowid="${rowid}"]`);
9822
+ }
9823
+ });
9824
+ const dtTrList = wrapperEl.querySelectorAll(dtClss.join(','));
9793
9825
  moveRowAnimateToTb(dtTrList, offsetRate * dragRowHeight);
9794
9826
  }
9795
9827
  }
9796
- const newTrList = el.querySelectorAll(`.vxe-body--row[rowid="${dragRowid}"]`);
9797
- const newTrEl = newTrList[0];
9828
+ const drClss = [`.vxe-body--row[rowid="${dragRowid}"]`];
9829
+ if ($xeGantt) {
9830
+ drClss.push(`.vxe-gantt-view--body-row[rowid="${dragRowid}"]`, `.vxe-gantt-view--chart-row[rowid="${dragRowid}"]`);
9831
+ }
9832
+ const newDtTrList = wrapperEl.querySelectorAll(drClss.join(','));
9833
+ const newTrEl = newDtTrList[0];
9798
9834
  if (dragOffsetTop > -1 && newTrEl) {
9799
- moveRowAnimateToTb(newTrList, dragOffsetTop - newTrEl.offsetTop);
9835
+ moveRowAnimateToTb(newDtTrList, dragOffsetTop - newTrEl.offsetTop);
9800
9836
  }
9801
9837
  }
9802
9838
  updateRowOffsetTop();
@@ -9822,7 +9858,7 @@ export default defineVxeComponent({
9822
9858
  const { lazy } = treeOpts;
9823
9859
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
9824
9860
  const { prevDragRow, prevDragPos } = internalData;
9825
- const el = refElem.value;
9861
+ let wrapperEl = refElem.value;
9826
9862
  if (treeConfig && lazy && prevDragToChild) {
9827
9863
  // 懒加载
9828
9864
  const newRowid = getRowid($xeTable, prevDragRow);
@@ -9839,9 +9875,18 @@ export default defineVxeComponent({
9839
9875
  else {
9840
9876
  $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
9841
9877
  }
9878
+ const dtClss = ['.vxe-body--row'];
9879
+ if ($xeGantt) {
9880
+ const { refGanttContainerElem } = $xeGantt.getRefMaps();
9881
+ const ganttContainerElem = refGanttContainerElem.value;
9882
+ if (ganttContainerElem) {
9883
+ wrapperEl = ganttContainerElem;
9884
+ }
9885
+ dtClss.push('.vxe-gantt-view--body-row', '.vxe-gantt-view--chart-row');
9886
+ }
9842
9887
  hideDropTip();
9843
9888
  clearRowDropOrigin();
9844
- clearRowAnimate(el);
9889
+ clearRowAnimate(wrapperEl, dtClss);
9845
9890
  internalData.prevDragToChild = false;
9846
9891
  reactData.dragRow = null;
9847
9892
  reactData.dragCol = null;
@@ -10214,7 +10259,7 @@ export default defineVxeComponent({
10214
10259
  $xeTable.handleColDragSwapEvent(evnt, true, dragCol, prevDragCol, prevDragPos, prevDragToChild);
10215
10260
  hideDropTip();
10216
10261
  clearColDropOrigin();
10217
- clearColAnimate(el);
10262
+ clearColAnimate(el, ['.vxe-table--column']);
10218
10263
  internalData.prevDragToChild = false;
10219
10264
  reactData.dragRow = null;
10220
10265
  reactData.dragCol = null;
@@ -11485,6 +11530,7 @@ export default defineVxeComponent({
11485
11530
  const renderVN = () => {
11486
11531
  const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules } = props;
11487
11532
  const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, isRowGroupStatus, columnStore, filterStore, customStore } = reactData;
11533
+ const { teleportToWrapperElem } = internalData;
11488
11534
  const { leftList, rightList } = columnStore;
11489
11535
  const loadingSlot = slots.loading;
11490
11536
  const tableTipConfig = computeTableTipConfig.value;
@@ -11610,52 +11656,69 @@ export default defineVxeComponent({
11610
11656
  })
11611
11657
  ]
11612
11658
  : []),
11613
- /**
11614
- * 行高线
11615
- */
11616
11659
  h('div', {
11617
- key: 'trl',
11618
- ref: refRowResizeBar,
11619
- class: 'vxe-table--resizable-row-bar'
11620
- }, resizableOpts.showDragTip
11621
- ? [
11660
+ key: 'ttw'
11661
+ }, [
11662
+ h(Teleport, {
11663
+ to: teleportToWrapperElem,
11664
+ disabled: !($xeGantt && teleportToWrapperElem)
11665
+ }, [
11622
11666
  h('div', {
11623
- class: 'vxe-table--resizable-number-tip'
11624
- })
11625
- ]
11626
- : []),
11627
- /**
11628
- * 加载中
11629
- */
11630
- VxeUILoadingComponent
11631
- ? h(VxeUILoadingComponent, {
11632
- key: 'lg',
11633
- class: 'vxe-table--loading',
11634
- modelValue: currLoading,
11635
- icon: loadingOpts.icon,
11636
- text: loadingOpts.text
11637
- }, loadingSlot
11638
- ? {
11639
- default: () => callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, loading: currLoading })
11640
- }
11641
- : {})
11642
- : loadingSlot
11643
- ? h('div', {
11644
- class: ['vxe-loading--custom-wrapper', {
11645
- 'is--visible': currLoading
11646
- }]
11647
- }, callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, loading: currLoading }))
11648
- : renderEmptyElement($xeTable),
11649
- /**
11650
- * 自定义列
11651
- */
11652
- initStore.custom
11653
- ? h(TableCustomPanelComponent, {
11654
- key: 'cs',
11655
- ref: refTableCustom,
11656
- customStore
11657
- })
11658
- : renderEmptyElement($xeTable),
11667
+ ref: refTeleportWrapper
11668
+ }, [
11669
+ /**
11670
+ * 行高线
11671
+ */
11672
+ h('div', {
11673
+ key: 'trl',
11674
+ ref: refRowResizeBar,
11675
+ class: 'vxe-table--resizable-row-bar'
11676
+ }, resizableOpts.showDragTip
11677
+ ? [
11678
+ h('div', {
11679
+ class: 'vxe-table--resizable-number-tip'
11680
+ })
11681
+ ]
11682
+ : []),
11683
+ /**
11684
+ * 自定义列
11685
+ */
11686
+ initStore.custom
11687
+ ? h(TableCustomPanelComponent, {
11688
+ key: 'cs',
11689
+ ref: refTableCustom,
11690
+ customStore
11691
+ })
11692
+ : renderEmptyElement($xeTable),
11693
+ /**
11694
+ * 加载中
11695
+ */
11696
+ VxeUILoadingComponent
11697
+ ? h(VxeUILoadingComponent, {
11698
+ key: 'lg',
11699
+ class: 'vxe-table--loading',
11700
+ modelValue: currLoading,
11701
+ icon: loadingOpts.icon,
11702
+ text: loadingOpts.text
11703
+ }, loadingSlot
11704
+ ? {
11705
+ default: () => callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, loading: currLoading })
11706
+ }
11707
+ : {})
11708
+ : loadingSlot
11709
+ ? h('div', {
11710
+ class: ['vxe-loading--custom-wrapper', {
11711
+ 'is--visible': currLoading
11712
+ }]
11713
+ }, callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, loading: currLoading }))
11714
+ : renderEmptyElement($xeTable),
11715
+ /**
11716
+ * 拖拽排序提示
11717
+ */
11718
+ renderDragTip()
11719
+ ])
11720
+ ])
11721
+ ]),
11659
11722
  /**
11660
11723
  * 筛选
11661
11724
  */
@@ -11695,10 +11758,6 @@ export default defineVxeComponent({
11695
11758
  ref: refTableMenu
11696
11759
  })
11697
11760
  : renderEmptyElement($xeTable),
11698
- /**
11699
- * 拖拽排序提示
11700
- */
11701
- renderDragTip(),
11702
11761
  /**
11703
11762
  * 提示相关
11704
11763
  */
@@ -11920,7 +11979,6 @@ export default defineVxeComponent({
11920
11979
  tablePrivateMethods.preventEvent(null, 'deactivated', { $table: $xeTable });
11921
11980
  });
11922
11981
  onMounted(() => {
11923
- const $xeGantt = $xeTable.xeGantt;
11924
11982
  const columnOpts = computeColumnOpts.value;
11925
11983
  const rowOpts = computeRowOpts.value;
11926
11984
  const customOpts = computeCustomOpts.value;
@@ -11997,6 +12055,15 @@ export default defineVxeComponent({
11997
12055
  if (props.resizable) {
11998
12056
  warnLog('vxe.error.delProp', ['resizable', 'column-config.resizable']);
11999
12057
  }
12058
+ if (props.virtualXConfig && props.scrollX) {
12059
+ warnLog('vxe.error.notSupportProp', ['virtual-x-config', 'scroll-x', 'scroll-x=null']);
12060
+ }
12061
+ if (props.virtualYConfig && props.scrollY) {
12062
+ warnLog('vxe.error.notSupportProp', ['virtual-y-config', 'scroll-y', 'scroll-y=null']);
12063
+ }
12064
+ if (props.aggregateConfig && props.rowGroupConfig) {
12065
+ warnLog('vxe.error.notSupportProp', ['aggregate-config', 'row-group-config', 'row-group-config=null']);
12066
+ }
12000
12067
  // if (props.scrollY) {
12001
12068
  // warnLog('vxe.error.delProp', ['scroll-y', 'virtual-y-config'])
12002
12069
  // }
@@ -12085,6 +12152,14 @@ export default defineVxeComponent({
12085
12152
  if (checkboxOpts.halfField) {
12086
12153
  warnLog('vxe.error.delProp', ['checkbox-config.halfField', 'checkbox-config.indeterminateField']);
12087
12154
  }
12155
+ if (treeConfig) {
12156
+ XEUtils.arrayEach(['rowField', 'parentField', 'childrenField', 'hasChildField', 'mapChildrenField'], key => {
12157
+ const val = treeOpts[key];
12158
+ if (val && val.indexOf('.') > -1) {
12159
+ errLog('vxe.error.errProp', [`${key}=${val}`, `${key}=${val.split('.')[0]}`]);
12160
+ }
12161
+ });
12162
+ }
12088
12163
  if (rowOpts.currentMethod) {
12089
12164
  warnLog('vxe.error.delProp', ['row-config.currentMethod', 'current-row-config.beforeSelectMethod']);
12090
12165
  }