vxe-table 4.16.0-beta.6 → 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 (44) 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/table.js +136 -70
  8. package/es/table/style.css +178 -163
  9. package/es/table/style.min.css +1 -1
  10. package/es/ui/index.js +1 -1
  11. package/es/ui/src/log.js +1 -1
  12. package/es/vxe-table/style.css +178 -163
  13. package/es/vxe-table/style.min.css +1 -1
  14. package/lib/index.css +1 -1
  15. package/lib/index.min.css +1 -1
  16. package/lib/index.umd.js +31 -36
  17. package/lib/index.umd.min.js +1 -1
  18. package/lib/style.css +1 -1
  19. package/lib/style.min.css +1 -1
  20. package/lib/table/module/custom/panel.js +2 -8
  21. package/lib/table/module/custom/panel.min.js +1 -1
  22. package/lib/table/src/anime.js +4 -4
  23. package/lib/table/src/anime.min.js +1 -1
  24. package/lib/table/src/table.js +22 -22
  25. package/lib/table/src/table.min.js +1 -1
  26. package/lib/table/style/style.css +178 -163
  27. package/lib/table/style/style.min.css +1 -1
  28. package/lib/ui/index.js +1 -1
  29. package/lib/ui/index.min.js +1 -1
  30. package/lib/ui/src/log.js +1 -1
  31. package/lib/ui/src/log.min.js +1 -1
  32. package/lib/vxe-table/style/style.css +178 -163
  33. package/lib/vxe-table/style/style.min.css +1 -1
  34. package/package.json +3 -2
  35. package/packages/table/module/custom/panel.ts +128 -134
  36. package/packages/table/src/anime.ts +4 -4
  37. package/packages/table/src/table.ts +139 -71
  38. package/styles/components/table.scss +166 -165
  39. /package/es/{iconfont.1755597300201.ttf → iconfont.1755651021240.ttf} +0 -0
  40. /package/es/{iconfont.1755597300201.woff → iconfont.1755651021240.woff} +0 -0
  41. /package/es/{iconfont.1755597300201.woff2 → iconfont.1755651021240.woff2} +0 -0
  42. /package/lib/{iconfont.1755597300201.ttf → iconfont.1755651021240.ttf} +0 -0
  43. /package/lib/{iconfont.1755597300201.woff → iconfont.1755651021240.woff} +0 -0
  44. /package/lib/{iconfont.1755597300201.woff2 → iconfont.1755651021240.woff2} +0 -0
@@ -1,4 +1,4 @@
1
- import { h, ComponentPublicInstance, reactive, ref, Ref, provide, inject, nextTick, onActivated, onDeactivated, onBeforeUnmount, onUnmounted, watch, computed, onMounted } from 'vue'
1
+ import { h, ComponentPublicInstance, reactive, ref, 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'
@@ -30,6 +30,7 @@ import '../module/custom/hook'
30
30
  import '../render'
31
31
 
32
32
  import type { VxeTooltipInstance, VxeTabsConstructor, VxeTabsPrivateMethods, ValueOf, VxeComponentSlotType } from 'vxe-pc-ui'
33
+ import type { VxeGanttConstructor, VxeGanttPrivateMethods } from 'vxe-gantt'
33
34
  import type { VxeGridConstructor, VxeGridPrivateMethods, VxeTableConstructor, TableReactData, VxeTablePropTypes, VxeToolbarConstructor, TablePrivateMethods, VxeTablePrivateRef, VxeTablePrivateComputed, VxeTablePrivateMethods, TableMethods, VxeTableMethods, VxeTableDefines, VxeTableEmits, VxeTableProps, VxeColumnPropTypes, VxeTableCustomPanelConstructor } from '../../../types'
34
35
 
35
36
  const { getConfig, getIcon, getI18n, renderer, formats, createEvent, globalResize, interceptor, hooks, globalEvents, GLOBAL_EVENT_KEYS, useFns, renderEmptyElement } = VxeUI
@@ -55,6 +56,9 @@ export default defineVxeComponent({
55
56
  const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip')
56
57
 
57
58
  const $xeTabs = inject<(VxeTabsConstructor & VxeTabsPrivateMethods) | null>('$xeTabs', null)
59
+ const $xeGrid = inject<(VxeGridConstructor & VxeGridPrivateMethods) | null>('$xeGrid', null)
60
+ const $xeGantt = inject<(VxeGanttConstructor & VxeGanttPrivateMethods) | null>('$xeGantt', null)
61
+ const $xeGGWrapper = $xeGrid || $xeGantt
58
62
 
59
63
  const { computeSize } = useFns.useSize(props)
60
64
 
@@ -334,6 +338,8 @@ export default defineVxeComponent({
334
338
  const refTableRightBody = ref() as Ref<ComponentPublicInstance>
335
339
  const refTableRightFooter = ref() as Ref<ComponentPublicInstance>
336
340
 
341
+ const refTeleportWrapper = ref<HTMLDivElement>()
342
+
337
343
  const refLeftContainer = ref() as Ref<HTMLDivElement>
338
344
  const refRightContainer = ref() as Ref<HTMLDivElement>
339
345
  const refColResizeBar = ref() as Ref<HTMLDivElement>
@@ -360,10 +366,6 @@ export default defineVxeComponent({
360
366
  const refScrollXSpaceElem = ref<HTMLDivElement>()
361
367
  const refScrollYSpaceElem = ref<HTMLDivElement>()
362
368
 
363
- const $xeGrid = inject<(VxeGridConstructor & VxeGridPrivateMethods) | null>('$xeGrid', null)
364
- const $xeGantt = inject('$xeGantt', null)
365
- const $xeGGWrapper = $xeGrid || $xeGantt
366
-
367
369
  let $xeToolbar: VxeToolbarConstructor
368
370
 
369
371
  const computeTableId = computed(() => {
@@ -7859,17 +7861,24 @@ export default defineVxeComponent({
7859
7861
  }
7860
7862
 
7861
7863
  const showDropTip = (evnt: DragEvent | MouseEvent, trEl: HTMLElement | null, thEl: HTMLElement | null, showLine: boolean, dragPos: string) => {
7862
- const el = refElem.value
7863
- if (!el) {
7864
+ let wrapperEl = refElem.value
7865
+ if ($xeGantt && trEl) {
7866
+ const { refGanttContainerElem } = $xeGantt.getRefMaps()
7867
+ const ganttContainerElem = refGanttContainerElem.value
7868
+ if (ganttContainerElem) {
7869
+ wrapperEl = ganttContainerElem
7870
+ }
7871
+ }
7872
+ if (!wrapperEl) {
7864
7873
  return
7865
7874
  }
7866
7875
  const { overflowX, scrollbarWidth, overflowY, scrollbarHeight } = reactData
7867
7876
  const { prevDragToChild } = internalData
7868
- const wrapperRect = el.getBoundingClientRect()
7877
+ const wrapperRect = wrapperEl.getBoundingClientRect()
7869
7878
  const osbWidth = overflowY ? scrollbarWidth : 0
7870
7879
  const osbHeight = overflowX ? scrollbarHeight : 0
7871
- const tableWrapperWidth = el.clientWidth
7872
- const tableWrapperHeight = el.clientHeight
7880
+ const tableWrapperWidth = wrapperEl.clientWidth
7881
+ const tableWrapperHeight = wrapperEl.clientHeight
7873
7882
  if (trEl) {
7874
7883
  const rdLineEl = refDragRowLineElem.value
7875
7884
  if (rdLineEl) {
@@ -7933,8 +7942,8 @@ export default defineVxeComponent({
7933
7942
  const rdTipEl = refDragTipElem.value
7934
7943
  if (rdTipEl) {
7935
7944
  rdTipEl.style.display = 'block'
7936
- rdTipEl.style.top = `${Math.min(el.clientHeight - el.scrollTop - rdTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`
7937
- rdTipEl.style.left = `${Math.min(el.clientWidth - el.scrollLeft - rdTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`
7945
+ rdTipEl.style.top = `${Math.min(wrapperEl.clientHeight - wrapperEl.scrollTop - rdTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`
7946
+ rdTipEl.style.left = `${Math.min(wrapperEl.clientWidth - wrapperEl.scrollLeft - rdTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`
7938
7947
  rdTipEl.setAttribute('drag-status', showLine ? (prevDragToChild ? 'sub' : 'normal') : 'disabled')
7939
7948
  }
7940
7949
  }
@@ -8305,7 +8314,7 @@ export default defineVxeComponent({
8305
8314
  if (!cell) {
8306
8315
  return
8307
8316
  }
8308
- const cellParams = XEUtils.assign(params, { cell })
8317
+ const cellParams = XEUtils.assign(params, { cell, $table: $xeTable })
8309
8318
  let dragLeft = 0
8310
8319
  const tableRect = tableEl.getBoundingClientRect()
8311
8320
  const rightContainerRect = rightContainerElem ? rightContainerElem.getBoundingClientRect() : null
@@ -8439,7 +8448,7 @@ export default defineVxeComponent({
8439
8448
  const colRest = fullColumnIdData[colid]
8440
8449
  const dragBtnElem = evnt.target as HTMLDivElement
8441
8450
  const cell = dragBtnElem.parentNode as HTMLTableCellElement
8442
- const cellParams = Object.assign(params, { cell })
8451
+ const cellParams = Object.assign(params, { cell, $table: $xeTable })
8443
8452
  const colMinWidth = getColReMinWidth(cellParams)
8444
8453
 
8445
8454
  el.setAttribute('data-calc-col', 'Y')
@@ -8474,7 +8483,14 @@ export default defineVxeComponent({
8474
8483
  const resizableOpts = computeResizableOpts.value
8475
8484
  const rowOpts = computeRowOpts.value
8476
8485
  const cellOpts = computeCellOpts.value
8477
- const tableEl = refElem.value
8486
+ let tableEl = refElem.value
8487
+ if ($xeGantt) {
8488
+ const { refGanttContainerElem } = $xeGantt.getRefMaps()
8489
+ const ganttContainerElem = refGanttContainerElem.value
8490
+ if (ganttContainerElem) {
8491
+ tableEl = ganttContainerElem
8492
+ }
8493
+ }
8478
8494
  const resizeBarElem = refRowResizeBar.value
8479
8495
  if (!resizeBarElem) {
8480
8496
  return
@@ -9705,6 +9721,7 @@ export default defineVxeComponent({
9705
9721
  const { treeConfig, dragConfig } = props
9706
9722
  const rowDragOpts = computeRowDragOpts.value
9707
9723
  const { afterFullData, tableFullData, fullAllDataRowIdData } = internalData
9724
+ const $xeGanttView = internalData.xeGanttView
9708
9725
  const { animation, isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod, dragToChildMethod } = rowDragOpts
9709
9726
  const treeOpts = computeTreeOpts.value
9710
9727
  const cellOpts = computeCellOpts.value
@@ -9903,7 +9920,15 @@ export default defineVxeComponent({
9903
9920
  const _newRowIndex = dragRowRest._index
9904
9921
  const firstRow = tableData[0]
9905
9922
  const firstRowRest = fullAllDataRowIdData[getRowid($xeTable, firstRow)]
9923
+ let wrapperEl = el
9906
9924
 
9925
+ if ($xeGantt && $xeGanttView) {
9926
+ const { refGanttContainerElem } = $xeGantt.getRefMaps()
9927
+ const ganttContainerElem = refGanttContainerElem.value
9928
+ if (ganttContainerElem) {
9929
+ wrapperEl = ganttContainerElem
9930
+ }
9931
+ }
9907
9932
  if (firstRowRest) {
9908
9933
  const _firstRowIndex = firstRowRest._index
9909
9934
  const _lastRowIndex = _firstRowIndex + tableData.length
@@ -9936,15 +9961,27 @@ export default defineVxeComponent({
9936
9961
 
9937
9962
  const dragRangeList = tableData.slice(rsIndex, reIndex)
9938
9963
  if (dragRangeList.length) {
9939
- const dtTrList = el.querySelectorAll<HTMLElement>(dragRangeList.map(row => `.vxe-body--row[rowid="${getRowid($xeTable, row)}"]`).join(','))
9964
+ const dtClss: string[] = []
9965
+ dragRangeList.forEach(row => {
9966
+ const rowid = getRowid($xeTable, row)
9967
+ dtClss.push(`.vxe-body--row[rowid="${rowid}"]`)
9968
+ if ($xeGantt) {
9969
+ dtClss.push(`.vxe-gantt-view--body-row[rowid="${rowid}"]`, `.vxe-gantt-view--chart-row[rowid="${rowid}"]`)
9970
+ }
9971
+ })
9972
+ const dtTrList = wrapperEl.querySelectorAll<HTMLElement>(dtClss.join(','))
9940
9973
  moveRowAnimateToTb(dtTrList, offsetRate * dragRowHeight)
9941
9974
  }
9942
9975
  }
9943
9976
 
9944
- const newTrList = el.querySelectorAll<HTMLElement>(`.vxe-body--row[rowid="${dragRowid}"]`)
9945
- const newTrEl = newTrList[0]
9977
+ const drClss = [`.vxe-body--row[rowid="${dragRowid}"]`]
9978
+ if ($xeGantt) {
9979
+ drClss.push(`.vxe-gantt-view--body-row[rowid="${dragRowid}"]`, `.vxe-gantt-view--chart-row[rowid="${dragRowid}"]`)
9980
+ }
9981
+ const newDtTrList = wrapperEl.querySelectorAll<HTMLElement>(drClss.join(','))
9982
+ const newTrEl = newDtTrList[0]
9946
9983
  if (dragOffsetTop > -1 && newTrEl) {
9947
- moveRowAnimateToTb(newTrList, dragOffsetTop - newTrEl.offsetTop)
9984
+ moveRowAnimateToTb(newDtTrList, dragOffsetTop - newTrEl.offsetTop)
9948
9985
  }
9949
9986
  }
9950
9987
 
@@ -9971,7 +10008,7 @@ export default defineVxeComponent({
9971
10008
  const { lazy } = treeOpts
9972
10009
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
9973
10010
  const { prevDragRow, prevDragPos } = internalData
9974
- const el = refElem.value
10011
+ let wrapperEl = refElem.value
9975
10012
  if (treeConfig && lazy && prevDragToChild) {
9976
10013
  // 懒加载
9977
10014
  const newRowid = getRowid($xeTable, prevDragRow)
@@ -9986,9 +10023,18 @@ export default defineVxeComponent({
9986
10023
  } else {
9987
10024
  $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild)
9988
10025
  }
10026
+ const dtClss = ['.vxe-body--row']
10027
+ if ($xeGantt) {
10028
+ const { refGanttContainerElem } = $xeGantt.getRefMaps()
10029
+ const ganttContainerElem = refGanttContainerElem.value
10030
+ if (ganttContainerElem) {
10031
+ wrapperEl = ganttContainerElem
10032
+ }
10033
+ dtClss.push('.vxe-gantt-view--body-row', '.vxe-gantt-view--chart-row')
10034
+ }
9989
10035
  hideDropTip()
9990
10036
  clearRowDropOrigin()
9991
- clearRowAnimate(el)
10037
+ clearRowAnimate(wrapperEl, dtClss)
9992
10038
  internalData.prevDragToChild = false
9993
10039
  reactData.dragRow = null
9994
10040
  reactData.dragCol = null
@@ -10375,7 +10421,7 @@ export default defineVxeComponent({
10375
10421
  $xeTable.handleColDragSwapEvent(evnt, true, dragCol, prevDragCol, prevDragPos, prevDragToChild)
10376
10422
  hideDropTip()
10377
10423
  clearColDropOrigin()
10378
- clearColAnimate(el)
10424
+ clearColAnimate(el, ['.vxe-table--column'])
10379
10425
  internalData.prevDragToChild = false
10380
10426
  reactData.dragRow = null
10381
10427
  reactData.dragCol = null
@@ -11672,6 +11718,7 @@ export default defineVxeComponent({
11672
11718
  const renderVN = () => {
11673
11719
  const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules } = props
11674
11720
  const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, isRowGroupStatus, columnStore, filterStore, customStore } = reactData
11721
+ const { teleportToWrapperElem } = internalData
11675
11722
  const { leftList, rightList } = columnStore
11676
11723
  const loadingSlot = slots.loading
11677
11724
  const tableTipConfig = computeTableTipConfig.value
@@ -11797,52 +11844,69 @@ export default defineVxeComponent({
11797
11844
  })
11798
11845
  ]
11799
11846
  : []),
11800
- /**
11801
- * 行高线
11802
- */
11803
11847
  h('div', {
11804
- key: 'trl',
11805
- ref: refRowResizeBar,
11806
- class: 'vxe-table--resizable-row-bar'
11807
- }, resizableOpts.showDragTip
11808
- ? [
11848
+ key: 'ttw'
11849
+ }, [
11850
+ h(Teleport, {
11851
+ to: teleportToWrapperElem,
11852
+ disabled: !($xeGantt && teleportToWrapperElem)
11853
+ }, [
11854
+ h('div', {
11855
+ ref: refTeleportWrapper
11856
+ }, [
11857
+ /**
11858
+ * 行高线
11859
+ */
11809
11860
  h('div', {
11810
- class: 'vxe-table--resizable-number-tip'
11811
- })
11812
- ]
11813
- : []),
11814
- /**
11815
- * 加载中
11816
- */
11817
- VxeUILoadingComponent
11818
- ? h(VxeUILoadingComponent, {
11819
- key: 'lg',
11820
- class: 'vxe-table--loading',
11821
- modelValue: currLoading,
11822
- icon: loadingOpts.icon,
11823
- text: loadingOpts.text
11824
- }, loadingSlot
11825
- ? {
11826
- default: () => callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, loading: currLoading })
11827
- }
11828
- : {})
11829
- : loadingSlot
11830
- ? h('div', {
11831
- class: ['vxe-loading--custom-wrapper', {
11832
- 'is--visible': currLoading
11833
- }]
11834
- }, callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, loading: currLoading }))
11835
- : renderEmptyElement($xeTable),
11836
- /**
11837
- * 自定义列
11838
- */
11839
- initStore.custom
11840
- ? h(TableCustomPanelComponent, {
11841
- key: 'cs',
11842
- ref: refTableCustom,
11843
- customStore
11844
- })
11845
- : renderEmptyElement($xeTable),
11861
+ key: 'trl',
11862
+ ref: refRowResizeBar,
11863
+ class: 'vxe-table--resizable-row-bar'
11864
+ }, resizableOpts.showDragTip
11865
+ ? [
11866
+ h('div', {
11867
+ class: 'vxe-table--resizable-number-tip'
11868
+ })
11869
+ ]
11870
+ : []),
11871
+ /**
11872
+ * 自定义列
11873
+ */
11874
+ initStore.custom
11875
+ ? h(TableCustomPanelComponent, {
11876
+ key: 'cs',
11877
+ ref: refTableCustom,
11878
+ customStore
11879
+ })
11880
+ : renderEmptyElement($xeTable),
11881
+ /**
11882
+ * 加载中
11883
+ */
11884
+ VxeUILoadingComponent
11885
+ ? h(VxeUILoadingComponent, {
11886
+ key: 'lg',
11887
+ class: 'vxe-table--loading',
11888
+ modelValue: currLoading,
11889
+ icon: loadingOpts.icon,
11890
+ text: loadingOpts.text
11891
+ }, loadingSlot
11892
+ ? {
11893
+ default: () => callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, loading: currLoading })
11894
+ }
11895
+ : {})
11896
+ : loadingSlot
11897
+ ? h('div', {
11898
+ class: ['vxe-loading--custom-wrapper', {
11899
+ 'is--visible': currLoading
11900
+ }]
11901
+ }, callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, loading: currLoading }))
11902
+ : renderEmptyElement($xeTable),
11903
+ /**
11904
+ * 拖拽排序提示
11905
+ */
11906
+ renderDragTip()
11907
+ ])
11908
+ ])
11909
+ ]),
11846
11910
  /**
11847
11911
  * 筛选
11848
11912
  */
@@ -11882,10 +11946,6 @@ export default defineVxeComponent({
11882
11946
  ref: refTableMenu
11883
11947
  })
11884
11948
  : renderEmptyElement($xeTable),
11885
- /**
11886
- * 拖拽排序提示
11887
- */
11888
- renderDragTip(),
11889
11949
  /**
11890
11950
  * 提示相关
11891
11951
  */
@@ -12127,7 +12187,6 @@ export default defineVxeComponent({
12127
12187
  })
12128
12188
 
12129
12189
  onMounted(() => {
12130
- const $xeGantt = $xeTable.xeGantt
12131
12190
  const columnOpts = computeColumnOpts.value
12132
12191
  const rowOpts = computeRowOpts.value
12133
12192
  const customOpts = computeCustomOpts.value
@@ -12309,6 +12368,15 @@ export default defineVxeComponent({
12309
12368
  warnLog('vxe.error.delProp', ['checkbox-config.halfField', 'checkbox-config.indeterminateField'])
12310
12369
  }
12311
12370
 
12371
+ if (treeConfig) {
12372
+ XEUtils.arrayEach(['rowField', 'parentField', 'childrenField', 'hasChildField', 'mapChildrenField'], key => {
12373
+ const val = treeOpts[key as 'rowField']
12374
+ if (val && val.indexOf('.') > -1) {
12375
+ errLog('vxe.error.errProp', [`${key}=${val}`, `${key}=${val.split('.')[0]}`])
12376
+ }
12377
+ })
12378
+ }
12379
+
12312
12380
  if (rowOpts.currentMethod) {
12313
12381
  warnLog('vxe.error.delProp', ['row-config.currentMethod', 'current-row-config.beforeSelectMethod'])
12314
12382
  }