vxe-table 4.8.16 → 4.9.1
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.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/README.zh-TW.md +1 -1
- package/es/locale/lang/en-US.js +1 -0
- package/es/locale/lang/es-ES.js +1 -0
- package/es/locale/lang/hu-HU.js +1 -0
- package/es/locale/lang/ja-JP.js +1 -0
- package/es/locale/lang/ko-KR.js +1 -0
- package/es/locale/lang/pt-BR.js +1 -0
- package/es/locale/lang/ru-RU.js +1 -0
- package/es/locale/lang/uk-UA.js +1 -0
- package/es/locale/lang/vi-VN.js +1 -0
- package/es/locale/lang/zh-CHT.js +1 -0
- package/es/locale/lang/zh-CN.js +1 -0
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/hook.js +4 -0
- package/es/table/module/edit/hook.js +53 -34
- package/es/table/module/filter/hook.js +2 -3
- package/es/table/module/keyboard/hook.js +2 -2
- package/es/table/src/body.js +31 -24
- package/es/table/src/cell.js +99 -59
- package/es/table/src/emits.js +3 -0
- package/es/table/src/footer.js +177 -147
- package/es/table/src/header.js +144 -107
- package/es/table/src/props.js +5 -1
- package/es/table/src/table.js +346 -108
- package/es/table/src/util.js +9 -0
- package/es/table/style.css +33 -20
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +9 -4
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +33 -20
- package/es/vxe-table/style.min.css +1 -1
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/index.umd.js +1035 -573
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/en-US.js +1 -0
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +1 -0
- package/lib/locale/lang/es-ES.js +1 -0
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +1 -0
- package/lib/locale/lang/hu-HU.js +1 -0
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +1 -0
- package/lib/locale/lang/ja-JP.js +1 -0
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +1 -0
- package/lib/locale/lang/ko-KR.js +1 -0
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +1 -0
- package/lib/locale/lang/pt-BR.js +1 -0
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +1 -0
- package/lib/locale/lang/ru-RU.js +1 -0
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +1 -0
- package/lib/locale/lang/uk-UA.js +1 -0
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +1 -0
- package/lib/locale/lang/vi-VN.js +1 -0
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +1 -0
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CN.js +1 -0
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +1 -0
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/custom/hook.js +4 -0
- package/lib/table/module/custom/hook.min.js +1 -1
- package/lib/table/module/edit/hook.js +63 -42
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/module/filter/hook.js +1 -2
- package/lib/table/module/filter/hook.min.js +1 -1
- package/lib/table/module/keyboard/hook.js +2 -2
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/src/body.js +34 -21
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +110 -51
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/emits.js +1 -1
- package/lib/table/src/emits.min.js +1 -1
- package/lib/table/src/footer.js +222 -183
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +188 -150
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/props.js +5 -1
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +380 -110
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +10 -0
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +33 -20
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +9 -4
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-table/style/style.css +33 -20
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +3 -3
- package/packages/locale/lang/en-US.ts +1 -0
- package/packages/locale/lang/es-ES.ts +1 -0
- package/packages/locale/lang/hu-HU.ts +1 -0
- package/packages/locale/lang/ja-JP.ts +1 -0
- package/packages/locale/lang/ko-KR.ts +1 -0
- package/packages/locale/lang/pt-BR.ts +1 -0
- package/packages/locale/lang/ru-RU.ts +1 -0
- package/packages/locale/lang/uk-UA.ts +1 -0
- package/packages/locale/lang/vi-VN.ts +1 -0
- package/packages/locale/lang/zh-CHT.ts +1 -0
- package/packages/locale/lang/zh-CN.ts +1 -0
- package/packages/table/module/custom/hook.ts +4 -0
- package/packages/table/module/edit/hook.ts +54 -34
- package/packages/table/module/filter/hook.ts +2 -3
- package/packages/table/module/keyboard/hook.ts +2 -2
- package/packages/table/src/body.ts +46 -31
- package/packages/table/src/cell.ts +140 -92
- package/packages/table/src/emits.ts +3 -0
- package/packages/table/src/footer.ts +189 -152
- package/packages/table/src/header.ts +157 -116
- package/packages/table/src/props.ts +5 -1
- package/packages/table/src/table.ts +358 -109
- package/packages/table/src/util.ts +10 -0
- package/packages/ui/index.ts +8 -3
- package/styles/components/table.scss +42 -35
- /package/es/{iconfont.1731633504443.ttf → iconfont.1731937248477.ttf} +0 -0
- /package/es/{iconfont.1731633504443.woff → iconfont.1731937248477.woff} +0 -0
- /package/es/{iconfont.1731633504443.woff2 → iconfont.1731937248477.woff2} +0 -0
- /package/lib/{iconfont.1731633504443.ttf → iconfont.1731937248477.ttf} +0 -0
- /package/lib/{iconfont.1731633504443.woff → iconfont.1731937248477.woff} +0 -0
- /package/lib/{iconfont.1731633504443.woff2 → iconfont.1731937248477.woff2} +0 -0
|
@@ -9,7 +9,7 @@ import TableHeaderComponent from './header'
|
|
|
9
9
|
import TableFooterComponent from './footer'
|
|
10
10
|
import tableProps from './props'
|
|
11
11
|
import tableEmits from './emits'
|
|
12
|
-
import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, XEBodyScrollElement, getRootColumn } from './util'
|
|
12
|
+
import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, XEBodyScrollElement, getRootColumn, getRefElem } from './util'
|
|
13
13
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
14
14
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
15
15
|
import TableCustomPanelComponent from '../module/custom/panel'
|
|
@@ -259,10 +259,14 @@ export default defineComponent({
|
|
|
259
259
|
isHeader: false,
|
|
260
260
|
isFooter: false
|
|
261
261
|
},
|
|
262
|
+
|
|
262
263
|
scrollVMLoading: false,
|
|
263
264
|
isDragRowMove: false,
|
|
264
265
|
dragRow: null,
|
|
266
|
+
isDragColMove: false,
|
|
267
|
+
dragCol: null,
|
|
265
268
|
dragTipText: '',
|
|
269
|
+
|
|
266
270
|
_isResize: false,
|
|
267
271
|
_isLoading: false
|
|
268
272
|
})
|
|
@@ -372,7 +376,9 @@ export default defineComponent({
|
|
|
372
376
|
const refCellResizeBar = ref() as Ref<HTMLDivElement>
|
|
373
377
|
const refEmptyPlaceholder = ref() as Ref<HTMLDivElement>
|
|
374
378
|
|
|
375
|
-
const
|
|
379
|
+
const refDragTipElem = ref<HTMLDivElement>()
|
|
380
|
+
const refDragRowLineElem = ref<HTMLDivElement>()
|
|
381
|
+
const refDragColLineElem = ref<HTMLDivElement>()
|
|
376
382
|
|
|
377
383
|
const refScrollXVirtualElem = ref<HTMLDivElement>()
|
|
378
384
|
const refScrollYVirtualElem = ref<HTMLDivElement>()
|
|
@@ -446,8 +452,12 @@ export default defineComponent({
|
|
|
446
452
|
return Object.assign({}, getConfig().table.rowConfig, props.rowConfig) as VxeTablePropTypes.RowOpts
|
|
447
453
|
})
|
|
448
454
|
|
|
449
|
-
const
|
|
450
|
-
return Object.assign({}, getConfig().table.
|
|
455
|
+
const computeRowDragOpts = computed(() => {
|
|
456
|
+
return Object.assign({}, getConfig().table.rowDragConfig, props.rowDragConfig)
|
|
457
|
+
})
|
|
458
|
+
|
|
459
|
+
const computeColumnDragOpts = computed(() => {
|
|
460
|
+
return Object.assign({}, getConfig().table.columnDragConfig, props.columnDragConfig)
|
|
451
461
|
})
|
|
452
462
|
|
|
453
463
|
const computeResizeOpts = computed(() => {
|
|
@@ -702,7 +712,8 @@ export default defineComponent({
|
|
|
702
712
|
computeColumnOpts,
|
|
703
713
|
computeCellOpts,
|
|
704
714
|
computeRowOpts,
|
|
705
|
-
|
|
715
|
+
computeRowDragOpts,
|
|
716
|
+
computeColumnDragOpts,
|
|
706
717
|
computeResizeOpts,
|
|
707
718
|
computeResizableOpts,
|
|
708
719
|
computeSeqOpts,
|
|
@@ -1662,8 +1673,7 @@ export default defineComponent({
|
|
|
1662
1673
|
const cellOffsetWidth = computeCellOffsetWidth.value
|
|
1663
1674
|
const mouseOpts = computeMouseOpts.value
|
|
1664
1675
|
const keyboardOpts = computeKeyboardOpts.value
|
|
1665
|
-
const
|
|
1666
|
-
const bodyWrapperElem = bodyWrapperRef ? bodyWrapperRef.value : null
|
|
1676
|
+
const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper'])
|
|
1667
1677
|
if (emptyPlaceholderElem) {
|
|
1668
1678
|
emptyPlaceholderElem.style.top = `${headerHeight}px`
|
|
1669
1679
|
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - scrollbarHeight}px` : ''
|
|
@@ -1711,10 +1721,8 @@ export default defineComponent({
|
|
|
1711
1721
|
fixedWrapperElem = isFixedLeft ? refLeftContainer.value : refRightContainer.value
|
|
1712
1722
|
}
|
|
1713
1723
|
layoutList.forEach(layout => {
|
|
1714
|
-
const
|
|
1715
|
-
const
|
|
1716
|
-
const tableRef = elemStore[`${name}-${layout}-table`]
|
|
1717
|
-
const tableElem = tableRef ? tableRef.value : null
|
|
1724
|
+
const wrapperElem = getRefElem(elemStore[`${name}-${layout}-wrapper`])
|
|
1725
|
+
const tableElem = getRefElem(elemStore[`${name}-${layout}-table`])
|
|
1718
1726
|
if (layout === 'header') {
|
|
1719
1727
|
// 表头体样式处理
|
|
1720
1728
|
// 横向滚动渲染
|
|
@@ -1738,14 +1746,12 @@ export default defineComponent({
|
|
|
1738
1746
|
tableElem.style.width = tWidth ? `${tWidth + scrollbarWidth}px` : ''
|
|
1739
1747
|
}
|
|
1740
1748
|
|
|
1741
|
-
const
|
|
1742
|
-
const repairElem = repairRef ? repairRef.value : null
|
|
1749
|
+
const repairElem = getRefElem(elemStore[`${name}-${layout}-repair`])
|
|
1743
1750
|
if (repairElem) {
|
|
1744
1751
|
repairElem.style.width = `${tableWidth}px`
|
|
1745
1752
|
}
|
|
1746
1753
|
|
|
1747
|
-
const
|
|
1748
|
-
const listElem = listRef ? listRef.value : null
|
|
1754
|
+
const listElem = getRefElem(elemStore[`${name}-${layout}-list`])
|
|
1749
1755
|
if (isGroup && listElem) {
|
|
1750
1756
|
XEUtils.arrayEach(listElem.querySelectorAll('.col--group'), (thElem: any) => {
|
|
1751
1757
|
const colNode = tableMethods.getColumnNode(thElem)
|
|
@@ -1772,8 +1778,7 @@ export default defineComponent({
|
|
|
1772
1778
|
})
|
|
1773
1779
|
}
|
|
1774
1780
|
} else if (layout === 'body') {
|
|
1775
|
-
const
|
|
1776
|
-
const emptyBlockElem = emptyBlockRef ? emptyBlockRef.value : null
|
|
1781
|
+
const emptyBlockElem = getRefElem(elemStore[`${name}-${layout}-emptyBlock`])
|
|
1777
1782
|
if (isNodeElement(wrapperElem)) {
|
|
1778
1783
|
let bodyMaxHeight = 0
|
|
1779
1784
|
const bodyMinHeight = customMinHeight - headerHeight - footerHeight
|
|
@@ -1867,8 +1872,7 @@ export default defineComponent({
|
|
|
1867
1872
|
tableElem.style.width = tWidth ? `${tWidth + scrollbarWidth}px` : ''
|
|
1868
1873
|
}
|
|
1869
1874
|
}
|
|
1870
|
-
const
|
|
1871
|
-
const colgroupElem = colgroupRef ? colgroupRef.value : null
|
|
1875
|
+
const colgroupElem = getRefElem(elemStore[`${name}-${layout}-colgroup`])
|
|
1872
1876
|
if (colgroupElem) {
|
|
1873
1877
|
XEUtils.arrayEach(colgroupElem.children, (colElem: any) => {
|
|
1874
1878
|
const colid = colElem.getAttribute('name')
|
|
@@ -1892,8 +1896,7 @@ export default defineComponent({
|
|
|
1892
1896
|
const showTitle = cellOverflow === 'title'
|
|
1893
1897
|
const showTooltip = cellOverflow === true || cellOverflow === 'tooltip'
|
|
1894
1898
|
let hasEllipsis = showTitle || showTooltip || showEllipsis
|
|
1895
|
-
const
|
|
1896
|
-
const listElem = listRef ? listRef.value : null
|
|
1899
|
+
const listElem = getRefElem(elemStore[`${name}-${layout}-list`])
|
|
1897
1900
|
// 纵向虚拟滚动不支持动态行高
|
|
1898
1901
|
if (scrollYLoad && !hasEllipsis) {
|
|
1899
1902
|
hasEllipsis = true
|
|
@@ -2504,6 +2507,7 @@ export default defineComponent({
|
|
|
2504
2507
|
editStore.removeMaps = {}
|
|
2505
2508
|
const sYLoad = updateScrollYStatus(fullData)
|
|
2506
2509
|
reactData.scrollYLoad = sYLoad
|
|
2510
|
+
reactData.isDragRowMove = false
|
|
2507
2511
|
// 全量数据
|
|
2508
2512
|
internalData.tableFullData = fullData
|
|
2509
2513
|
internalData.tableFullTreeData = treeData
|
|
@@ -2762,6 +2766,7 @@ export default defineComponent({
|
|
|
2762
2766
|
const tableFullColumn = getColumnList(collectColumn)
|
|
2763
2767
|
internalData.tableFullColumn = tableFullColumn
|
|
2764
2768
|
reactData._isLoading = true
|
|
2769
|
+
reactData.isDragColMove = false
|
|
2765
2770
|
initColumnSort()
|
|
2766
2771
|
return Promise.resolve(
|
|
2767
2772
|
restoreCustomStorage()
|
|
@@ -4988,8 +4993,8 @@ export default defineComponent({
|
|
|
4988
4993
|
updateCellAreas () {
|
|
4989
4994
|
const { mouseConfig } = props
|
|
4990
4995
|
const mouseOpts = computeMouseOpts.value
|
|
4991
|
-
if (mouseConfig && mouseOpts.area && $xeTable.
|
|
4992
|
-
return $xeTable.
|
|
4996
|
+
if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreas) {
|
|
4997
|
+
return $xeTable.handleRecalculateCellAreas()
|
|
4993
4998
|
}
|
|
4994
4999
|
return nextTick()
|
|
4995
5000
|
},
|
|
@@ -5182,7 +5187,7 @@ export default defineComponent({
|
|
|
5182
5187
|
!getEventTargetNode(evnt, el).flag
|
|
5183
5188
|
) {
|
|
5184
5189
|
setTimeout(() => {
|
|
5185
|
-
$xeTable.
|
|
5190
|
+
$xeTable.handleClearEdit(evnt).then(() => {
|
|
5186
5191
|
// 如果存在校验,点击了表格之外则清除
|
|
5187
5192
|
if (!internalData.isActivated && editRules && validOpts.autoClear) {
|
|
5188
5193
|
reactData.validErrorMaps = {}
|
|
@@ -5262,8 +5267,8 @@ export default defineComponent({
|
|
|
5262
5267
|
if (isEsc) {
|
|
5263
5268
|
tablePrivateMethods.preventEvent(evnt, 'event.keydown', null, () => {
|
|
5264
5269
|
dispatchEvent('keydown-start', {}, evnt)
|
|
5265
|
-
if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.
|
|
5266
|
-
$xeTable.
|
|
5270
|
+
if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.handleKeyboardCellAreaEvent) {
|
|
5271
|
+
$xeTable.handleKeyboardCellAreaEvent(evnt)
|
|
5267
5272
|
} else if (actived.row || filterStore.visible || ctxMenuStore.visible) {
|
|
5268
5273
|
evnt.stopPropagation()
|
|
5269
5274
|
// 如果按下了 Esc 键,关闭快捷菜单、筛选
|
|
@@ -5275,7 +5280,7 @@ export default defineComponent({
|
|
|
5275
5280
|
// 如果是激活编辑状态,则取消编辑
|
|
5276
5281
|
if (actived.row) {
|
|
5277
5282
|
const params = actived.args
|
|
5278
|
-
$xeTable.
|
|
5283
|
+
$xeTable.handleClearEdit(evnt)
|
|
5279
5284
|
// 如果配置了选中功能,则为选中状态
|
|
5280
5285
|
if (mouseOpts.selected) {
|
|
5281
5286
|
nextTick(() => $xeTable.handleSelected(params, evnt))
|
|
@@ -5337,8 +5342,8 @@ export default defineComponent({
|
|
|
5337
5342
|
} else {
|
|
5338
5343
|
$xeTable.moveCtxMenu(evnt, ctxMenuStore, 'selected', isRightArrow, true, menuList)
|
|
5339
5344
|
}
|
|
5340
|
-
} else if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.
|
|
5341
|
-
$xeTable.
|
|
5345
|
+
} else if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.handleKeyboardCellAreaEvent) {
|
|
5346
|
+
$xeTable.handleKeyboardCellAreaEvent(evnt)
|
|
5342
5347
|
} else if (isEsc) {
|
|
5343
5348
|
// 如果按下了 Esc 键,关闭快捷菜单、筛选
|
|
5344
5349
|
if ($xeTable.closeMenu) {
|
|
@@ -5349,7 +5354,7 @@ export default defineComponent({
|
|
|
5349
5354
|
// 如果是激活编辑状态,则取消编辑
|
|
5350
5355
|
if (actived.row) {
|
|
5351
5356
|
const params = actived.args
|
|
5352
|
-
$xeTable.
|
|
5357
|
+
$xeTable.handleClearEdit(evnt)
|
|
5353
5358
|
// 如果配置了选中功能,则为选中状态
|
|
5354
5359
|
if (mouseOpts.selected) {
|
|
5355
5360
|
nextTick(() => $xeTable.handleSelected(params, evnt))
|
|
@@ -5385,7 +5390,7 @@ export default defineComponent({
|
|
|
5385
5390
|
// 如果是激活编辑状态,则取消编辑
|
|
5386
5391
|
if (actived.row) {
|
|
5387
5392
|
const params = actived.args
|
|
5388
|
-
$xeTable.
|
|
5393
|
+
$xeTable.handleClearEdit(evnt)
|
|
5389
5394
|
// 如果配置了选中功能,则为选中状态
|
|
5390
5395
|
if (mouseOpts.selected) {
|
|
5391
5396
|
nextTick(() => $xeTable.handleSelected(params, evnt))
|
|
@@ -5599,8 +5604,8 @@ export default defineComponent({
|
|
|
5599
5604
|
if (!el || !el.clientWidth) {
|
|
5600
5605
|
return nextTick()
|
|
5601
5606
|
}
|
|
5602
|
-
tableMethods.updateCellAreas()
|
|
5603
5607
|
tableMethods.recalculate(true)
|
|
5608
|
+
tableMethods.updateCellAreas()
|
|
5604
5609
|
}
|
|
5605
5610
|
|
|
5606
5611
|
const handleTargetEnterEvent = (isClear: boolean) => {
|
|
@@ -5637,65 +5642,112 @@ export default defineComponent({
|
|
|
5637
5642
|
}
|
|
5638
5643
|
}
|
|
5639
5644
|
|
|
5640
|
-
const
|
|
5645
|
+
const updateRowDropTipContent = (tdEl: HTMLElement) => {
|
|
5646
|
+
const { dragConfig } = props
|
|
5647
|
+
const { dragRow } = reactData
|
|
5648
|
+
const rowDragOpts = computeRowDragOpts.value
|
|
5649
|
+
const { tooltipMethod } = rowDragOpts
|
|
5650
|
+
const rTooltipMethod = tooltipMethod || (dragConfig ? dragConfig.rowTooltipMethod : null)
|
|
5651
|
+
let tipContent = ''
|
|
5652
|
+
if (rTooltipMethod) {
|
|
5653
|
+
tipContent = `${rTooltipMethod({
|
|
5654
|
+
row: dragRow
|
|
5655
|
+
}) || ''}`
|
|
5656
|
+
} else {
|
|
5657
|
+
tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || ''])
|
|
5658
|
+
}
|
|
5659
|
+
reactData.dragTipText = tipContent
|
|
5660
|
+
}
|
|
5661
|
+
|
|
5662
|
+
const updateColDropOrigin = (column: VxeTableDefines.ColumnInfo) => {
|
|
5641
5663
|
const el = refElem.value
|
|
5642
5664
|
if (el) {
|
|
5643
|
-
const clss = '
|
|
5644
|
-
XEUtils.arrayEach(el.querySelectorAll(
|
|
5645
|
-
|
|
5665
|
+
const clss = 'col--drag-origin'
|
|
5666
|
+
XEUtils.arrayEach(el.querySelectorAll(`[colid="${column.id}"]`), (elem) => {
|
|
5667
|
+
addClass(elem, clss)
|
|
5646
5668
|
})
|
|
5647
5669
|
}
|
|
5648
5670
|
}
|
|
5649
5671
|
|
|
5650
|
-
const
|
|
5672
|
+
const clearColDropOrigin = () => {
|
|
5651
5673
|
const el = refElem.value
|
|
5652
5674
|
if (el) {
|
|
5653
|
-
const clss = '
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
elem.setAttribute('drag-pos', dragPos)
|
|
5675
|
+
const clss = 'col--drag-origin'
|
|
5676
|
+
XEUtils.arrayEach(el.querySelectorAll(`.${clss}`), (elem) => {
|
|
5677
|
+
(elem as HTMLTableCellElement).draggable = false
|
|
5678
|
+
removeClass(elem, clss)
|
|
5658
5679
|
})
|
|
5659
5680
|
}
|
|
5660
5681
|
}
|
|
5661
5682
|
|
|
5662
|
-
const
|
|
5663
|
-
const
|
|
5664
|
-
|
|
5665
|
-
|
|
5683
|
+
const updateColDropTipContent = (tdEl: HTMLElement) => {
|
|
5684
|
+
const { dragCol } = reactData
|
|
5685
|
+
const columnDragOpts = computeColumnDragOpts.value
|
|
5686
|
+
const { tooltipMethod } = columnDragOpts
|
|
5687
|
+
let tipContent = ''
|
|
5688
|
+
if (tooltipMethod) {
|
|
5689
|
+
tipContent = `${tooltipMethod({
|
|
5690
|
+
column: dragCol
|
|
5691
|
+
}) || ''}`
|
|
5692
|
+
} else {
|
|
5693
|
+
tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || ''])
|
|
5666
5694
|
}
|
|
5695
|
+
reactData.dragTipText = tipContent
|
|
5696
|
+
}
|
|
5697
|
+
|
|
5698
|
+
const showDropTip = (evnt: DragEvent | MouseEvent, trEl: HTMLElement | null, thEl: HTMLElement | null, dragPos: string) => {
|
|
5667
5699
|
const el = refElem.value
|
|
5668
5700
|
if (!el) {
|
|
5669
5701
|
return
|
|
5670
5702
|
}
|
|
5703
|
+
const { scrollbarWidth, scrollbarHeight } = reactData
|
|
5704
|
+
const wrapperRect = el.getBoundingClientRect()
|
|
5705
|
+
if (trEl) {
|
|
5706
|
+
const rdLineEl = refDragRowLineElem.value
|
|
5707
|
+
if (rdLineEl) {
|
|
5708
|
+
const trRect = trEl.getBoundingClientRect()
|
|
5709
|
+
let top = Math.max(1, trRect.y - wrapperRect.y)
|
|
5710
|
+
if (dragPos === 'bottom') {
|
|
5711
|
+
top = Math.min(wrapperRect.height - 1, trRect.y - wrapperRect.y + trRect.height)
|
|
5712
|
+
}
|
|
5713
|
+
rdLineEl.style.top = `${top}px`
|
|
5714
|
+
rdLineEl.style.width = `${wrapperRect.width - scrollbarWidth}px`
|
|
5715
|
+
rdLineEl.style.display = 'block'
|
|
5716
|
+
}
|
|
5717
|
+
} else if (thEl) {
|
|
5718
|
+
const cdLineEl = refDragColLineElem.value
|
|
5719
|
+
if (cdLineEl) {
|
|
5720
|
+
const thRect = thEl.getBoundingClientRect()
|
|
5721
|
+
let left = Math.max(1, thRect.x - wrapperRect.x)
|
|
5722
|
+
if (dragPos === 'right') {
|
|
5723
|
+
left = Math.min(wrapperRect.width - 2, thRect.x - wrapperRect.x + thRect.width)
|
|
5724
|
+
}
|
|
5725
|
+
cdLineEl.style.left = `${left}px`
|
|
5726
|
+
cdLineEl.style.height = `${wrapperRect.height - scrollbarHeight}px`
|
|
5727
|
+
cdLineEl.style.display = 'block'
|
|
5728
|
+
}
|
|
5729
|
+
}
|
|
5730
|
+
const rdTipEl = refDragTipElem.value
|
|
5671
5731
|
if (rdTipEl) {
|
|
5672
|
-
const wrapperRect = el.getBoundingClientRect()
|
|
5673
5732
|
rdTipEl.style.display = 'block'
|
|
5674
5733
|
rdTipEl.style.top = `${Math.min(el.clientHeight - el.scrollTop - rdTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`
|
|
5675
5734
|
rdTipEl.style.left = `${Math.min(el.clientWidth - el.scrollLeft - rdTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`
|
|
5676
5735
|
}
|
|
5677
5736
|
}
|
|
5678
5737
|
|
|
5679
|
-
const
|
|
5680
|
-
const rdTipEl =
|
|
5738
|
+
const hideDropTip = () => {
|
|
5739
|
+
const rdTipEl = refDragTipElem.value
|
|
5740
|
+
const rdLineEl = refDragRowLineElem.value
|
|
5741
|
+
const cdLineEl = refDragColLineElem.value
|
|
5681
5742
|
if (rdTipEl) {
|
|
5682
5743
|
rdTipEl.style.display = ''
|
|
5683
5744
|
}
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
const { rowTooltipMethod } = dragOpts
|
|
5690
|
-
let tipContent = ''
|
|
5691
|
-
if (rowTooltipMethod) {
|
|
5692
|
-
tipContent = `${rowTooltipMethod({
|
|
5693
|
-
row: dragRow
|
|
5694
|
-
}) || ''}`
|
|
5695
|
-
} else {
|
|
5696
|
-
tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || ''])
|
|
5745
|
+
if (rdLineEl) {
|
|
5746
|
+
rdLineEl.style.display = ''
|
|
5747
|
+
}
|
|
5748
|
+
if (cdLineEl) {
|
|
5749
|
+
cdLineEl.style.display = ''
|
|
5697
5750
|
}
|
|
5698
|
-
reactData.dragTipText = tipContent
|
|
5699
5751
|
}
|
|
5700
5752
|
|
|
5701
5753
|
/**
|
|
@@ -6751,6 +6803,9 @@ export default defineComponent({
|
|
|
6751
6803
|
dispatchEvent('sort-change', params, evnt)
|
|
6752
6804
|
}
|
|
6753
6805
|
},
|
|
6806
|
+
/**
|
|
6807
|
+
* 行拖拽
|
|
6808
|
+
*/
|
|
6754
6809
|
handleRowDragDragstartEvent (evnt) {
|
|
6755
6810
|
const img = new Image()
|
|
6756
6811
|
if (evnt.dataTransfer) {
|
|
@@ -6758,28 +6813,31 @@ export default defineComponent({
|
|
|
6758
6813
|
}
|
|
6759
6814
|
},
|
|
6760
6815
|
handleRowDragDragendEvent (evnt) {
|
|
6761
|
-
const { treeConfig } = props
|
|
6762
|
-
const
|
|
6763
|
-
const { dragEndMethod } =
|
|
6816
|
+
const { treeConfig, dragConfig } = props
|
|
6817
|
+
const rowDragOpts = computeRowDragOpts.value
|
|
6818
|
+
const { dragEndMethod } = rowDragOpts
|
|
6764
6819
|
const treeOpts = computeTreeOpts.value
|
|
6765
6820
|
const { transform } = treeOpts
|
|
6766
6821
|
const { dragRow } = reactData
|
|
6767
6822
|
const { afterFullData, afterTreeFullData, tableFullData, tableFullTreeData, prevDragRow, prevDragPos } = internalData
|
|
6823
|
+
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null)
|
|
6824
|
+
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
|
|
6768
6825
|
if (prevDragRow && dragRow) {
|
|
6769
6826
|
// 判断是否有拖动
|
|
6770
6827
|
if (prevDragRow !== dragRow) {
|
|
6771
6828
|
Promise.resolve(
|
|
6772
|
-
|
|
6773
|
-
?
|
|
6829
|
+
dEndMethod
|
|
6830
|
+
? dEndMethod({
|
|
6774
6831
|
oldRow: dragRow,
|
|
6775
|
-
newRow: prevDragRow
|
|
6832
|
+
newRow: prevDragRow,
|
|
6833
|
+
dragPos: prevDragPos as any,
|
|
6834
|
+
offsetIndex: dragOffsetIndex
|
|
6776
6835
|
})
|
|
6777
6836
|
: true
|
|
6778
6837
|
).then((status) => {
|
|
6779
6838
|
if (!status) {
|
|
6780
6839
|
return
|
|
6781
6840
|
}
|
|
6782
|
-
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
|
|
6783
6841
|
|
|
6784
6842
|
let oafIndex = -1
|
|
6785
6843
|
let nafIndex = -1
|
|
@@ -6790,7 +6848,7 @@ export default defineComponent({
|
|
|
6790
6848
|
afterTreeFullData.splice(oafIndex, 1)
|
|
6791
6849
|
tableFullTreeData.splice(otfIndex, 1)
|
|
6792
6850
|
|
|
6793
|
-
//
|
|
6851
|
+
// 插入新位置
|
|
6794
6852
|
const pafIndex = $xeTable.findRowIndexOf(afterTreeFullData, prevDragRow)
|
|
6795
6853
|
const ptfIndex = $xeTable.findRowIndexOf(tableFullTreeData, prevDragRow)
|
|
6796
6854
|
nafIndex = pafIndex + dragOffsetIndex
|
|
@@ -6803,7 +6861,7 @@ export default defineComponent({
|
|
|
6803
6861
|
const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow)
|
|
6804
6862
|
afterFullData.splice(oafIndex, 1)
|
|
6805
6863
|
tableFullData.splice(otfIndex, 1)
|
|
6806
|
-
//
|
|
6864
|
+
// 插入新位置
|
|
6807
6865
|
const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow)
|
|
6808
6866
|
const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow)
|
|
6809
6867
|
nafIndex = pafIndex + dragOffsetIndex
|
|
@@ -6814,24 +6872,25 @@ export default defineComponent({
|
|
|
6814
6872
|
|
|
6815
6873
|
reactData.isDragRowMove = true
|
|
6816
6874
|
$xeTable.cacheRowMap()
|
|
6817
|
-
|
|
6875
|
+
updateScrollYStatus()
|
|
6818
6876
|
$xeTable.handleTableData(treeConfig && transform)
|
|
6819
6877
|
if (!(treeConfig && transform)) {
|
|
6820
6878
|
$xeTable.updateAfterDataIndex()
|
|
6821
6879
|
}
|
|
6822
|
-
$xeTable.updateFooter()
|
|
6823
6880
|
$xeTable.checkSelectionStatus()
|
|
6824
6881
|
if (reactData.scrollYLoad) {
|
|
6825
6882
|
$xeTable.updateScrollYSpace()
|
|
6826
6883
|
}
|
|
6827
6884
|
nextTick().then(() => {
|
|
6828
6885
|
$xeTable.updateCellAreas()
|
|
6829
|
-
|
|
6886
|
+
$xeTable.recalculate()
|
|
6830
6887
|
})
|
|
6831
6888
|
|
|
6832
6889
|
dispatchEvent('row-dragend', {
|
|
6833
6890
|
oldRow: dragRow,
|
|
6834
6891
|
newRow: prevDragRow,
|
|
6892
|
+
dragPos: prevDragPos as any,
|
|
6893
|
+
offsetIndex: dragOffsetIndex,
|
|
6835
6894
|
_index: {
|
|
6836
6895
|
newIndex: nafIndex,
|
|
6837
6896
|
oldIndex: oafIndex
|
|
@@ -6841,65 +6900,217 @@ export default defineComponent({
|
|
|
6841
6900
|
})
|
|
6842
6901
|
}
|
|
6843
6902
|
}
|
|
6844
|
-
|
|
6903
|
+
hideDropTip()
|
|
6845
6904
|
clearRowDropOrigin()
|
|
6846
|
-
clearRowDropTarget()
|
|
6847
6905
|
reactData.dragRow = null
|
|
6906
|
+
reactData.dragCol = null
|
|
6848
6907
|
setTimeout(() => {
|
|
6849
6908
|
reactData.isDragRowMove = false
|
|
6850
6909
|
}, 500)
|
|
6851
6910
|
},
|
|
6852
6911
|
handleRowDragDragoverEvent (evnt) {
|
|
6912
|
+
const { dragRow } = reactData
|
|
6913
|
+
if (!dragRow) {
|
|
6914
|
+
evnt.preventDefault()
|
|
6915
|
+
return
|
|
6916
|
+
}
|
|
6853
6917
|
const trEl = evnt.currentTarget as HTMLElement
|
|
6854
6918
|
const rowid = trEl.getAttribute('rowid')
|
|
6855
6919
|
const row = $xeTable.getRowById(rowid)
|
|
6856
|
-
clearRowDropTarget()
|
|
6857
6920
|
if (row) {
|
|
6858
6921
|
evnt.preventDefault()
|
|
6859
6922
|
evnt.preventDefault()
|
|
6860
6923
|
const { dragRow } = reactData
|
|
6861
6924
|
const offsetY = evnt.clientY - trEl.getBoundingClientRect().y
|
|
6862
6925
|
const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom'
|
|
6863
|
-
updateRowDropTarget(row, dragPos)
|
|
6864
6926
|
internalData.prevDragRow = row
|
|
6865
6927
|
internalData.prevDragPos = dragPos
|
|
6928
|
+
showDropTip(evnt, trEl, null, dragPos)
|
|
6866
6929
|
dispatchEvent('row-dragover', {
|
|
6867
6930
|
oldRow: dragRow,
|
|
6868
6931
|
targetRow: row,
|
|
6869
6932
|
dragPos
|
|
6870
6933
|
}, evnt)
|
|
6871
6934
|
}
|
|
6872
|
-
showRowDropTip(evnt)
|
|
6873
6935
|
},
|
|
6874
6936
|
handleCellDragMousedownEvent (evnt, params) {
|
|
6875
6937
|
evnt.stopPropagation()
|
|
6876
|
-
const
|
|
6877
|
-
const
|
|
6938
|
+
const { dragConfig } = props
|
|
6939
|
+
const rowDragOpts = computeRowDragOpts.value
|
|
6940
|
+
const { dragStartMethod } = rowDragOpts
|
|
6878
6941
|
const { row } = params
|
|
6879
6942
|
const dragEl = evnt.currentTarget as HTMLElement
|
|
6880
|
-
const tdEl = dragEl.
|
|
6881
|
-
const trEl = tdEl.
|
|
6943
|
+
const tdEl = dragEl.parentElement?.parentElement as HTMLElement
|
|
6944
|
+
const trEl = tdEl.parentElement as HTMLElement
|
|
6945
|
+
const dStartMethod = dragStartMethod || (dragConfig ? dragConfig.dragStartMethod : null)
|
|
6882
6946
|
reactData.isDragRowMove = false
|
|
6883
6947
|
clearRowDropOrigin()
|
|
6884
|
-
if (
|
|
6948
|
+
if (dStartMethod && !dStartMethod(params)) {
|
|
6885
6949
|
trEl.draggable = false
|
|
6886
6950
|
reactData.dragRow = null
|
|
6887
|
-
|
|
6951
|
+
reactData.dragCol = null
|
|
6952
|
+
hideDropTip()
|
|
6888
6953
|
return
|
|
6889
6954
|
}
|
|
6890
6955
|
reactData.dragRow = row
|
|
6956
|
+
reactData.dragCol = null
|
|
6891
6957
|
trEl.draggable = true
|
|
6892
6958
|
updateRowDropOrigin(row)
|
|
6893
|
-
showRowDropTip(evnt)
|
|
6894
6959
|
updateRowDropTipContent(tdEl)
|
|
6895
6960
|
dispatchEvent('row-dragstart', params, evnt)
|
|
6896
6961
|
},
|
|
6897
6962
|
handleCellDragMouseupEvent () {
|
|
6898
6963
|
clearRowDropOrigin()
|
|
6899
|
-
|
|
6964
|
+
hideDropTip()
|
|
6900
6965
|
reactData.dragRow = null
|
|
6966
|
+
reactData.dragCol = null
|
|
6901
6967
|
reactData.isDragRowMove = false
|
|
6902
6968
|
},
|
|
6969
|
+
/**
|
|
6970
|
+
* 列拖拽
|
|
6971
|
+
*/
|
|
6972
|
+
handleHeaderCellDragDragstartEvent (evnt) {
|
|
6973
|
+
const img = new Image()
|
|
6974
|
+
if (evnt.dataTransfer) {
|
|
6975
|
+
evnt.dataTransfer.setDragImage(img, 0, 0)
|
|
6976
|
+
}
|
|
6977
|
+
},
|
|
6978
|
+
handleHeaderCellDragDragendEvent (evnt) {
|
|
6979
|
+
const { mouseConfig } = props
|
|
6980
|
+
const columnDragOpts = computeColumnDragOpts.value
|
|
6981
|
+
const { dragEndMethod } = columnDragOpts
|
|
6982
|
+
const { dragCol } = reactData
|
|
6983
|
+
const { collectColumn, prevDragCol, prevDragPos } = internalData
|
|
6984
|
+
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0
|
|
6985
|
+
if (prevDragCol && dragCol) {
|
|
6986
|
+
// 判断是否有拖动
|
|
6987
|
+
if (prevDragCol !== dragCol) {
|
|
6988
|
+
Promise.resolve(
|
|
6989
|
+
dragEndMethod
|
|
6990
|
+
? dragEndMethod({
|
|
6991
|
+
oldColumn: dragCol,
|
|
6992
|
+
newColumn: prevDragCol,
|
|
6993
|
+
dragPos: prevDragPos as any,
|
|
6994
|
+
offsetIndex: dragOffsetIndex
|
|
6995
|
+
})
|
|
6996
|
+
: true
|
|
6997
|
+
).then((status) => {
|
|
6998
|
+
if (!status) {
|
|
6999
|
+
return
|
|
7000
|
+
}
|
|
7001
|
+
|
|
7002
|
+
XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
|
|
7003
|
+
if (!parent) {
|
|
7004
|
+
const sortIndex = index + 1
|
|
7005
|
+
column.renderSortNumber = sortIndex
|
|
7006
|
+
}
|
|
7007
|
+
})
|
|
7008
|
+
|
|
7009
|
+
const oafIndex = XEUtils.findIndexOf(collectColumn, item => item.id === dragCol.id)
|
|
7010
|
+
const nafIndex = XEUtils.findIndexOf(collectColumn, item => item.id === prevDragCol.id) + dragOffsetIndex
|
|
7011
|
+
|
|
7012
|
+
const newTargetCol = collectColumn[nafIndex]
|
|
7013
|
+
if (newTargetCol) {
|
|
7014
|
+
// 插入最后位置
|
|
7015
|
+
dragCol.renderSortNumber = newTargetCol.renderSortNumber
|
|
7016
|
+
newTargetCol.renderSortNumber = dragCol.renderSortNumber + 0.5
|
|
7017
|
+
} else {
|
|
7018
|
+
// 插入新位置
|
|
7019
|
+
dragCol.renderSortNumber = collectColumn.length + 1.5
|
|
7020
|
+
}
|
|
7021
|
+
|
|
7022
|
+
reactData.isDragColMove = true
|
|
7023
|
+
if (mouseConfig) {
|
|
7024
|
+
if ($xeTable.clearSelected) {
|
|
7025
|
+
$xeTable.clearSelected()
|
|
7026
|
+
}
|
|
7027
|
+
if ($xeTable.clearCellAreas) {
|
|
7028
|
+
$xeTable.clearCellAreas()
|
|
7029
|
+
$xeTable.clearCopyCellArea()
|
|
7030
|
+
}
|
|
7031
|
+
}
|
|
7032
|
+
tablePrivateMethods.analyColumnWidth()
|
|
7033
|
+
nextTick().then(() => {
|
|
7034
|
+
$xeTable.updateCellAreas()
|
|
7035
|
+
tableMethods.refreshColumn(true)
|
|
7036
|
+
})
|
|
7037
|
+
|
|
7038
|
+
dispatchEvent('column-dragend', {
|
|
7039
|
+
oldColumn: dragCol,
|
|
7040
|
+
newColumn: prevDragCol,
|
|
7041
|
+
dragPos: prevDragPos,
|
|
7042
|
+
offsetIndex: dragOffsetIndex,
|
|
7043
|
+
_index: {
|
|
7044
|
+
newIndex: nafIndex,
|
|
7045
|
+
oldIndex: oafIndex
|
|
7046
|
+
}
|
|
7047
|
+
}, evnt)
|
|
7048
|
+
}).catch(() => {
|
|
7049
|
+
})
|
|
7050
|
+
}
|
|
7051
|
+
}
|
|
7052
|
+
hideDropTip()
|
|
7053
|
+
clearColDropOrigin()
|
|
7054
|
+
reactData.dragRow = null
|
|
7055
|
+
reactData.dragCol = null
|
|
7056
|
+
setTimeout(() => {
|
|
7057
|
+
reactData.isDragColMove = false
|
|
7058
|
+
}, 500)
|
|
7059
|
+
},
|
|
7060
|
+
handleHeaderCellDragDragoverEvent (evnt) {
|
|
7061
|
+
const { dragCol } = reactData
|
|
7062
|
+
if (!dragCol) {
|
|
7063
|
+
evnt.preventDefault()
|
|
7064
|
+
return
|
|
7065
|
+
}
|
|
7066
|
+
const thEl = evnt.currentTarget as HTMLElement
|
|
7067
|
+
const colid = thEl.getAttribute('colid')
|
|
7068
|
+
const column = $xeTable.getColumnById(colid)
|
|
7069
|
+
if (column) {
|
|
7070
|
+
evnt.preventDefault()
|
|
7071
|
+
const { dragCol } = reactData
|
|
7072
|
+
const offsetX = evnt.clientX - thEl.getBoundingClientRect().x
|
|
7073
|
+
const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right'
|
|
7074
|
+
internalData.prevDragCol = column
|
|
7075
|
+
internalData.prevDragPos = dragPos
|
|
7076
|
+
showDropTip(evnt, null, thEl, dragPos)
|
|
7077
|
+
dispatchEvent('column-dragover', {
|
|
7078
|
+
oldColumn: dragCol,
|
|
7079
|
+
targetColumn: column,
|
|
7080
|
+
dragPos
|
|
7081
|
+
}, evnt)
|
|
7082
|
+
}
|
|
7083
|
+
},
|
|
7084
|
+
handleHeaderCellDragMousedownEvent (evnt, params) {
|
|
7085
|
+
evnt.stopPropagation()
|
|
7086
|
+
const columnDragOpts = computeColumnDragOpts.value
|
|
7087
|
+
const { dragStartMethod } = columnDragOpts
|
|
7088
|
+
const { column } = params
|
|
7089
|
+
const dragEl = evnt.currentTarget as HTMLElement
|
|
7090
|
+
const thEl = dragEl.parentElement?.parentElement as HTMLElement
|
|
7091
|
+
reactData.isDragColMove = false
|
|
7092
|
+
clearColDropOrigin()
|
|
7093
|
+
if (dragStartMethod && !dragStartMethod(params)) {
|
|
7094
|
+
thEl.draggable = false
|
|
7095
|
+
reactData.dragRow = null
|
|
7096
|
+
reactData.dragCol = null
|
|
7097
|
+
hideDropTip()
|
|
7098
|
+
return
|
|
7099
|
+
}
|
|
7100
|
+
reactData.dragCol = column
|
|
7101
|
+
reactData.dragRow = null
|
|
7102
|
+
thEl.draggable = true
|
|
7103
|
+
updateColDropOrigin(column)
|
|
7104
|
+
updateColDropTipContent(thEl)
|
|
7105
|
+
dispatchEvent('column-dragstart', params, evnt)
|
|
7106
|
+
},
|
|
7107
|
+
handleHeaderCellDragMouseupEvent () {
|
|
7108
|
+
clearColDropOrigin()
|
|
7109
|
+
hideDropTip()
|
|
7110
|
+
reactData.dragRow = null
|
|
7111
|
+
reactData.dragCol = null
|
|
7112
|
+
reactData.isDragColMove = false
|
|
7113
|
+
},
|
|
6903
7114
|
/**
|
|
6904
7115
|
* 横向 X 可视渲染事件处理
|
|
6905
7116
|
*/
|
|
@@ -7066,8 +7277,7 @@ export default defineComponent({
|
|
|
7066
7277
|
containerList.forEach(name => {
|
|
7067
7278
|
const layoutList = ['header', 'body', 'footer']
|
|
7068
7279
|
layoutList.forEach(layout => {
|
|
7069
|
-
const
|
|
7070
|
-
const xSpaceElem = xSpaceRef ? xSpaceRef.value : null
|
|
7280
|
+
const xSpaceElem = getRefElem(elemStore[`${name}-${layout}-xSpace`])
|
|
7071
7281
|
if (xSpaceElem) {
|
|
7072
7282
|
xSpaceElem.style.width = scrollXLoad ? `${tableWidth + (layout === 'header' ? scrollbarWidth : 0)}px` : ''
|
|
7073
7283
|
}
|
|
@@ -7118,14 +7328,12 @@ export default defineComponent({
|
|
|
7118
7328
|
}
|
|
7119
7329
|
containerList.forEach(name => {
|
|
7120
7330
|
const layoutList = ['header', 'body', 'footer']
|
|
7121
|
-
const
|
|
7122
|
-
const tableElem = tableRef ? tableRef.value : null
|
|
7331
|
+
const tableElem = getRefElem(elemStore[`${name}-body-table`])
|
|
7123
7332
|
if (tableElem) {
|
|
7124
7333
|
tableElem.style.marginTop = marginTop
|
|
7125
7334
|
}
|
|
7126
7335
|
layoutList.forEach(layout => {
|
|
7127
|
-
const
|
|
7128
|
-
const ySpaceElem = ySpaceRef ? ySpaceRef.value : null
|
|
7336
|
+
const ySpaceElem = getRefElem(elemStore[`${name}-${layout}-ySpace`])
|
|
7129
7337
|
if (ySpaceElem) {
|
|
7130
7338
|
ySpaceElem.style.height = ySpaceHeight
|
|
7131
7339
|
}
|
|
@@ -7305,6 +7513,50 @@ export default defineComponent({
|
|
|
7305
7513
|
return getFuncText(props.emptyText) || getI18n('vxe.table.emptyText')
|
|
7306
7514
|
}
|
|
7307
7515
|
|
|
7516
|
+
const renderDragTipContents = () => {
|
|
7517
|
+
const { dragConfig } = props
|
|
7518
|
+
const { dragRow, dragCol, dragTipText } = reactData
|
|
7519
|
+
const columnDragOpts = computeColumnDragOpts.value
|
|
7520
|
+
const rowDragOpts = computeRowDragOpts.value
|
|
7521
|
+
const rowDragSlots = rowDragOpts.slots || {}
|
|
7522
|
+
const rTipSlot = rowDragSlots.tip || (dragConfig && dragConfig.slots ? dragConfig.slots.rowTip : null)
|
|
7523
|
+
const columnDragSlots = columnDragOpts.slots || {}
|
|
7524
|
+
const cTipSlot = columnDragSlots.tip
|
|
7525
|
+
|
|
7526
|
+
if (dragRow && rTipSlot) {
|
|
7527
|
+
return callSlot(rTipSlot, { row: dragRow })
|
|
7528
|
+
}
|
|
7529
|
+
if (dragCol && cTipSlot) {
|
|
7530
|
+
return callSlot(cTipSlot, { column: dragCol })
|
|
7531
|
+
}
|
|
7532
|
+
return [h('span', dragTipText)]
|
|
7533
|
+
}
|
|
7534
|
+
|
|
7535
|
+
const renderDragTip = () => {
|
|
7536
|
+
const rowOpts = computeRowOpts.value
|
|
7537
|
+
const columnOpts = computeColumnOpts.value
|
|
7538
|
+
|
|
7539
|
+
if (rowOpts.drag || columnOpts.drag) {
|
|
7540
|
+
return h('div', {
|
|
7541
|
+
class: 'vxe-table--drag-wrapper'
|
|
7542
|
+
}, [
|
|
7543
|
+
h('div', {
|
|
7544
|
+
ref: refDragRowLineElem,
|
|
7545
|
+
class: 'vxe-table--drag-row-line'
|
|
7546
|
+
}),
|
|
7547
|
+
h('div', {
|
|
7548
|
+
ref: refDragColLineElem,
|
|
7549
|
+
class: 'vxe-table--drag-col-line'
|
|
7550
|
+
}),
|
|
7551
|
+
h('div', {
|
|
7552
|
+
ref: refDragTipElem,
|
|
7553
|
+
class: 'vxe-table--drag-sort-tip'
|
|
7554
|
+
}, renderDragTipContents())
|
|
7555
|
+
])
|
|
7556
|
+
}
|
|
7557
|
+
return renderEmptyElement($xeTable)
|
|
7558
|
+
}
|
|
7559
|
+
|
|
7308
7560
|
function handleUupdateResize () {
|
|
7309
7561
|
const el = refElem.value
|
|
7310
7562
|
if (el && el.clientWidth && el.clientHeight) {
|
|
@@ -7314,7 +7566,7 @@ export default defineComponent({
|
|
|
7314
7566
|
|
|
7315
7567
|
const renderVN = () => {
|
|
7316
7568
|
const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules } = props
|
|
7317
|
-
const { isCalcColumn, isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, scrollbarHeight, tableData, tableColumn, tableGroupColumn, footerTableData, initStore, columnStore, filterStore, customStore, tooltipStore
|
|
7569
|
+
const { isCalcColumn, isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, scrollbarHeight, tableData, tableColumn, tableGroupColumn, footerTableData, initStore, columnStore, filterStore, customStore, tooltipStore } = reactData
|
|
7318
7570
|
const { leftList, rightList } = columnStore
|
|
7319
7571
|
const loadingSlot = slots.loading
|
|
7320
7572
|
const tipConfig = computeTipConfig.value
|
|
@@ -7322,18 +7574,17 @@ export default defineComponent({
|
|
|
7322
7574
|
const checkboxOpts = computeCheckboxOpts.value
|
|
7323
7575
|
const treeOpts = computeTreeOpts.value
|
|
7324
7576
|
const rowOpts = computeRowOpts.value
|
|
7325
|
-
const dragOpts = computeDragOpts.value
|
|
7326
7577
|
const columnOpts = computeColumnOpts.value
|
|
7327
7578
|
const vSize = computeSize.value
|
|
7328
7579
|
const tableBorder = computeTableBorder.value
|
|
7329
7580
|
const mouseOpts = computeMouseOpts.value
|
|
7581
|
+
const areaOpts = computeAreaOpts.value
|
|
7330
7582
|
const validTipOpts = computeValidTipOpts.value
|
|
7331
7583
|
const loadingOpts = computeLoadingOpts.value
|
|
7332
7584
|
const isMenu = computeIsMenu.value
|
|
7333
7585
|
const currLoading = reactData._isLoading || loading
|
|
7334
7586
|
const virtualScrollBars = computeVirtualScrollBars.value
|
|
7335
|
-
const
|
|
7336
|
-
const rowTipSlot = dragSlots.rowTip
|
|
7587
|
+
const isArea = mouseConfig && mouseOpts.area
|
|
7337
7588
|
return h('div', {
|
|
7338
7589
|
ref: refElem,
|
|
7339
7590
|
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, {
|
|
@@ -7343,7 +7594,9 @@ export default defineComponent({
|
|
|
7343
7594
|
'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete',
|
|
7344
7595
|
'cell--highlight': highlightCell,
|
|
7345
7596
|
'cell--selected': mouseConfig && mouseOpts.selected,
|
|
7346
|
-
'cell--area':
|
|
7597
|
+
'cell--area': isArea,
|
|
7598
|
+
'header-cell--area': isArea && areaOpts.selectCellByHeader,
|
|
7599
|
+
'body-cell--area': isArea && areaOpts.selectCellByBody,
|
|
7347
7600
|
'row--highlight': rowOpts.isHover || highlightHoverRow,
|
|
7348
7601
|
'column--highlight': columnOpts.isHover || highlightHoverColumn,
|
|
7349
7602
|
'checkbox--range': checkboxOpts.range,
|
|
@@ -7552,16 +7805,9 @@ export default defineComponent({
|
|
|
7552
7805
|
})
|
|
7553
7806
|
: renderEmptyElement($xeTable),
|
|
7554
7807
|
/**
|
|
7555
|
-
*
|
|
7808
|
+
* 拖拽排序提示
|
|
7556
7809
|
*/
|
|
7557
|
-
|
|
7558
|
-
? h('div', {
|
|
7559
|
-
ref: refRowDragTipElem,
|
|
7560
|
-
class: 'vxe-table--row-drag-tip'
|
|
7561
|
-
}, rowTipSlot
|
|
7562
|
-
? (dragRow ? callSlot(rowTipSlot, { row: dragRow }) : [renderEmptyElement($xeTable)])
|
|
7563
|
-
: (dragTipText ? [h('span', dragTipText)] : [renderEmptyElement($xeTable)]))
|
|
7564
|
-
: renderEmptyElement($xeTable),
|
|
7810
|
+
renderDragTip(),
|
|
7565
7811
|
/**
|
|
7566
7812
|
* 提示相关
|
|
7567
7813
|
*/
|
|
@@ -7845,7 +8091,7 @@ export default defineComponent({
|
|
|
7845
8091
|
if (rowOpts.height && !props.showOverflow) {
|
|
7846
8092
|
warnLog('vxe.error.notProp', ['table.show-overflow'])
|
|
7847
8093
|
}
|
|
7848
|
-
if (!$xeTable.
|
|
8094
|
+
if (!$xeTable.handleRecalculateCellAreas) {
|
|
7849
8095
|
if (props.clipConfig) {
|
|
7850
8096
|
warnLog('vxe.error.notProp', ['clip-config'])
|
|
7851
8097
|
}
|
|
@@ -7857,6 +8103,9 @@ export default defineComponent({
|
|
|
7857
8103
|
return
|
|
7858
8104
|
}
|
|
7859
8105
|
}
|
|
8106
|
+
if (props.dragConfig) {
|
|
8107
|
+
warnLog('vxe.error.delProp', ['drag-config', 'row-drag-config'])
|
|
8108
|
+
}
|
|
7860
8109
|
if (props.treeConfig && treeOpts.children) {
|
|
7861
8110
|
warnLog('vxe.error.delProp', ['tree-config.children', 'tree-config.childrenField'])
|
|
7862
8111
|
}
|