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
package/es/table/src/table.js
CHANGED
|
@@ -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, getRootColumn } from './util';
|
|
12
|
+
import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, 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';
|
|
@@ -250,6 +250,8 @@ export default defineComponent({
|
|
|
250
250
|
scrollVMLoading: false,
|
|
251
251
|
isDragRowMove: false,
|
|
252
252
|
dragRow: null,
|
|
253
|
+
isDragColMove: false,
|
|
254
|
+
dragCol: null,
|
|
253
255
|
dragTipText: '',
|
|
254
256
|
_isResize: false,
|
|
255
257
|
_isLoading: false
|
|
@@ -353,7 +355,9 @@ export default defineComponent({
|
|
|
353
355
|
const refRightContainer = ref();
|
|
354
356
|
const refCellResizeBar = ref();
|
|
355
357
|
const refEmptyPlaceholder = ref();
|
|
356
|
-
const
|
|
358
|
+
const refDragTipElem = ref();
|
|
359
|
+
const refDragRowLineElem = ref();
|
|
360
|
+
const refDragColLineElem = ref();
|
|
357
361
|
const refScrollXVirtualElem = ref();
|
|
358
362
|
const refScrollYVirtualElem = ref();
|
|
359
363
|
const refScrollXHandleElem = ref();
|
|
@@ -414,8 +418,11 @@ export default defineComponent({
|
|
|
414
418
|
const computeRowOpts = computed(() => {
|
|
415
419
|
return Object.assign({}, getConfig().table.rowConfig, props.rowConfig);
|
|
416
420
|
});
|
|
417
|
-
const
|
|
418
|
-
return Object.assign({}, getConfig().table.
|
|
421
|
+
const computeRowDragOpts = computed(() => {
|
|
422
|
+
return Object.assign({}, getConfig().table.rowDragConfig, props.rowDragConfig);
|
|
423
|
+
});
|
|
424
|
+
const computeColumnDragOpts = computed(() => {
|
|
425
|
+
return Object.assign({}, getConfig().table.columnDragConfig, props.columnDragConfig);
|
|
419
426
|
});
|
|
420
427
|
const computeResizeOpts = computed(() => {
|
|
421
428
|
return Object.assign({}, getConfig().table.resizeConfig, props.resizeConfig);
|
|
@@ -628,7 +635,8 @@ export default defineComponent({
|
|
|
628
635
|
computeColumnOpts,
|
|
629
636
|
computeCellOpts,
|
|
630
637
|
computeRowOpts,
|
|
631
|
-
|
|
638
|
+
computeRowDragOpts,
|
|
639
|
+
computeColumnDragOpts,
|
|
632
640
|
computeResizeOpts,
|
|
633
641
|
computeResizableOpts,
|
|
634
642
|
computeSeqOpts,
|
|
@@ -1573,8 +1581,7 @@ export default defineComponent({
|
|
|
1573
1581
|
const cellOffsetWidth = computeCellOffsetWidth.value;
|
|
1574
1582
|
const mouseOpts = computeMouseOpts.value;
|
|
1575
1583
|
const keyboardOpts = computeKeyboardOpts.value;
|
|
1576
|
-
const
|
|
1577
|
-
const bodyWrapperElem = bodyWrapperRef ? bodyWrapperRef.value : null;
|
|
1584
|
+
const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper']);
|
|
1578
1585
|
if (emptyPlaceholderElem) {
|
|
1579
1586
|
emptyPlaceholderElem.style.top = `${headerHeight}px`;
|
|
1580
1587
|
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - scrollbarHeight}px` : '';
|
|
@@ -1619,10 +1626,8 @@ export default defineComponent({
|
|
|
1619
1626
|
fixedWrapperElem = isFixedLeft ? refLeftContainer.value : refRightContainer.value;
|
|
1620
1627
|
}
|
|
1621
1628
|
layoutList.forEach(layout => {
|
|
1622
|
-
const
|
|
1623
|
-
const
|
|
1624
|
-
const tableRef = elemStore[`${name}-${layout}-table`];
|
|
1625
|
-
const tableElem = tableRef ? tableRef.value : null;
|
|
1629
|
+
const wrapperElem = getRefElem(elemStore[`${name}-${layout}-wrapper`]);
|
|
1630
|
+
const tableElem = getRefElem(elemStore[`${name}-${layout}-table`]);
|
|
1626
1631
|
if (layout === 'header') {
|
|
1627
1632
|
// 表头体样式处理
|
|
1628
1633
|
// 横向滚动渲染
|
|
@@ -1643,13 +1648,11 @@ export default defineComponent({
|
|
|
1643
1648
|
if (tableElem) {
|
|
1644
1649
|
tableElem.style.width = tWidth ? `${tWidth + scrollbarWidth}px` : '';
|
|
1645
1650
|
}
|
|
1646
|
-
const
|
|
1647
|
-
const repairElem = repairRef ? repairRef.value : null;
|
|
1651
|
+
const repairElem = getRefElem(elemStore[`${name}-${layout}-repair`]);
|
|
1648
1652
|
if (repairElem) {
|
|
1649
1653
|
repairElem.style.width = `${tableWidth}px`;
|
|
1650
1654
|
}
|
|
1651
|
-
const
|
|
1652
|
-
const listElem = listRef ? listRef.value : null;
|
|
1655
|
+
const listElem = getRefElem(elemStore[`${name}-${layout}-list`]);
|
|
1653
1656
|
if (isGroup && listElem) {
|
|
1654
1657
|
XEUtils.arrayEach(listElem.querySelectorAll('.col--group'), (thElem) => {
|
|
1655
1658
|
const colNode = tableMethods.getColumnNode(thElem);
|
|
@@ -1677,8 +1680,7 @@ export default defineComponent({
|
|
|
1677
1680
|
}
|
|
1678
1681
|
}
|
|
1679
1682
|
else if (layout === 'body') {
|
|
1680
|
-
const
|
|
1681
|
-
const emptyBlockElem = emptyBlockRef ? emptyBlockRef.value : null;
|
|
1683
|
+
const emptyBlockElem = getRefElem(elemStore[`${name}-${layout}-emptyBlock`]);
|
|
1682
1684
|
if (isNodeElement(wrapperElem)) {
|
|
1683
1685
|
let bodyMaxHeight = 0;
|
|
1684
1686
|
const bodyMinHeight = customMinHeight - headerHeight - footerHeight;
|
|
@@ -1772,8 +1774,7 @@ export default defineComponent({
|
|
|
1772
1774
|
tableElem.style.width = tWidth ? `${tWidth + scrollbarWidth}px` : '';
|
|
1773
1775
|
}
|
|
1774
1776
|
}
|
|
1775
|
-
const
|
|
1776
|
-
const colgroupElem = colgroupRef ? colgroupRef.value : null;
|
|
1777
|
+
const colgroupElem = getRefElem(elemStore[`${name}-${layout}-colgroup`]);
|
|
1777
1778
|
if (colgroupElem) {
|
|
1778
1779
|
XEUtils.arrayEach(colgroupElem.children, (colElem) => {
|
|
1779
1780
|
const colid = colElem.getAttribute('name');
|
|
@@ -1799,8 +1800,7 @@ export default defineComponent({
|
|
|
1799
1800
|
const showTitle = cellOverflow === 'title';
|
|
1800
1801
|
const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
|
|
1801
1802
|
let hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
1802
|
-
const
|
|
1803
|
-
const listElem = listRef ? listRef.value : null;
|
|
1803
|
+
const listElem = getRefElem(elemStore[`${name}-${layout}-list`]);
|
|
1804
1804
|
// 纵向虚拟滚动不支持动态行高
|
|
1805
1805
|
if (scrollYLoad && !hasEllipsis) {
|
|
1806
1806
|
hasEllipsis = true;
|
|
@@ -2407,6 +2407,7 @@ export default defineComponent({
|
|
|
2407
2407
|
editStore.removeMaps = {};
|
|
2408
2408
|
const sYLoad = updateScrollYStatus(fullData);
|
|
2409
2409
|
reactData.scrollYLoad = sYLoad;
|
|
2410
|
+
reactData.isDragRowMove = false;
|
|
2410
2411
|
// 全量数据
|
|
2411
2412
|
internalData.tableFullData = fullData;
|
|
2412
2413
|
internalData.tableFullTreeData = treeData;
|
|
@@ -2666,6 +2667,7 @@ export default defineComponent({
|
|
|
2666
2667
|
const tableFullColumn = getColumnList(collectColumn);
|
|
2667
2668
|
internalData.tableFullColumn = tableFullColumn;
|
|
2668
2669
|
reactData._isLoading = true;
|
|
2670
|
+
reactData.isDragColMove = false;
|
|
2669
2671
|
initColumnSort();
|
|
2670
2672
|
return Promise.resolve(restoreCustomStorage()).then(() => {
|
|
2671
2673
|
reactData._isLoading = false;
|
|
@@ -4907,8 +4909,8 @@ export default defineComponent({
|
|
|
4907
4909
|
updateCellAreas() {
|
|
4908
4910
|
const { mouseConfig } = props;
|
|
4909
4911
|
const mouseOpts = computeMouseOpts.value;
|
|
4910
|
-
if (mouseConfig && mouseOpts.area && $xeTable.
|
|
4911
|
-
return $xeTable.
|
|
4912
|
+
if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreas) {
|
|
4913
|
+
return $xeTable.handleRecalculateCellAreas();
|
|
4912
4914
|
}
|
|
4913
4915
|
return nextTick();
|
|
4914
4916
|
},
|
|
@@ -5105,7 +5107,7 @@ export default defineComponent({
|
|
|
5105
5107
|
// 如果点击了当前表格之外
|
|
5106
5108
|
!getEventTargetNode(evnt, el).flag) {
|
|
5107
5109
|
setTimeout(() => {
|
|
5108
|
-
$xeTable.
|
|
5110
|
+
$xeTable.handleClearEdit(evnt).then(() => {
|
|
5109
5111
|
// 如果存在校验,点击了表格之外则清除
|
|
5110
5112
|
if (!internalData.isActivated && editRules && validOpts.autoClear) {
|
|
5111
5113
|
reactData.validErrorMaps = {};
|
|
@@ -5183,8 +5185,8 @@ export default defineComponent({
|
|
|
5183
5185
|
if (isEsc) {
|
|
5184
5186
|
tablePrivateMethods.preventEvent(evnt, 'event.keydown', null, () => {
|
|
5185
5187
|
dispatchEvent('keydown-start', {}, evnt);
|
|
5186
|
-
if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.
|
|
5187
|
-
$xeTable.
|
|
5188
|
+
if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.handleKeyboardCellAreaEvent) {
|
|
5189
|
+
$xeTable.handleKeyboardCellAreaEvent(evnt);
|
|
5188
5190
|
}
|
|
5189
5191
|
else if (actived.row || filterStore.visible || ctxMenuStore.visible) {
|
|
5190
5192
|
evnt.stopPropagation();
|
|
@@ -5197,7 +5199,7 @@ export default defineComponent({
|
|
|
5197
5199
|
// 如果是激活编辑状态,则取消编辑
|
|
5198
5200
|
if (actived.row) {
|
|
5199
5201
|
const params = actived.args;
|
|
5200
|
-
$xeTable.
|
|
5202
|
+
$xeTable.handleClearEdit(evnt);
|
|
5201
5203
|
// 如果配置了选中功能,则为选中状态
|
|
5202
5204
|
if (mouseOpts.selected) {
|
|
5203
5205
|
nextTick(() => $xeTable.handleSelected(params, evnt));
|
|
@@ -5260,8 +5262,8 @@ export default defineComponent({
|
|
|
5260
5262
|
$xeTable.moveCtxMenu(evnt, ctxMenuStore, 'selected', isRightArrow, true, menuList);
|
|
5261
5263
|
}
|
|
5262
5264
|
}
|
|
5263
|
-
else if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.
|
|
5264
|
-
$xeTable.
|
|
5265
|
+
else if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.handleKeyboardCellAreaEvent) {
|
|
5266
|
+
$xeTable.handleKeyboardCellAreaEvent(evnt);
|
|
5265
5267
|
}
|
|
5266
5268
|
else if (isEsc) {
|
|
5267
5269
|
// 如果按下了 Esc 键,关闭快捷菜单、筛选
|
|
@@ -5273,7 +5275,7 @@ export default defineComponent({
|
|
|
5273
5275
|
// 如果是激活编辑状态,则取消编辑
|
|
5274
5276
|
if (actived.row) {
|
|
5275
5277
|
const params = actived.args;
|
|
5276
|
-
$xeTable.
|
|
5278
|
+
$xeTable.handleClearEdit(evnt);
|
|
5277
5279
|
// 如果配置了选中功能,则为选中状态
|
|
5278
5280
|
if (mouseOpts.selected) {
|
|
5279
5281
|
nextTick(() => $xeTable.handleSelected(params, evnt));
|
|
@@ -5314,7 +5316,7 @@ export default defineComponent({
|
|
|
5314
5316
|
// 如果是激活编辑状态,则取消编辑
|
|
5315
5317
|
if (actived.row) {
|
|
5316
5318
|
const params = actived.args;
|
|
5317
|
-
$xeTable.
|
|
5319
|
+
$xeTable.handleClearEdit(evnt);
|
|
5318
5320
|
// 如果配置了选中功能,则为选中状态
|
|
5319
5321
|
if (mouseOpts.selected) {
|
|
5320
5322
|
nextTick(() => $xeTable.handleSelected(params, evnt));
|
|
@@ -5540,8 +5542,8 @@ export default defineComponent({
|
|
|
5540
5542
|
if (!el || !el.clientWidth) {
|
|
5541
5543
|
return nextTick();
|
|
5542
5544
|
}
|
|
5543
|
-
tableMethods.updateCellAreas();
|
|
5544
5545
|
tableMethods.recalculate(true);
|
|
5546
|
+
tableMethods.updateCellAreas();
|
|
5545
5547
|
};
|
|
5546
5548
|
const handleTargetEnterEvent = (isClear) => {
|
|
5547
5549
|
const $tooltip = refTooltip.value;
|
|
@@ -5575,62 +5577,110 @@ export default defineComponent({
|
|
|
5575
5577
|
});
|
|
5576
5578
|
}
|
|
5577
5579
|
};
|
|
5578
|
-
const
|
|
5580
|
+
const updateRowDropTipContent = (tdEl) => {
|
|
5581
|
+
const { dragConfig } = props;
|
|
5582
|
+
const { dragRow } = reactData;
|
|
5583
|
+
const rowDragOpts = computeRowDragOpts.value;
|
|
5584
|
+
const { tooltipMethod } = rowDragOpts;
|
|
5585
|
+
const rTooltipMethod = tooltipMethod || (dragConfig ? dragConfig.rowTooltipMethod : null);
|
|
5586
|
+
let tipContent = '';
|
|
5587
|
+
if (rTooltipMethod) {
|
|
5588
|
+
tipContent = `${rTooltipMethod({
|
|
5589
|
+
row: dragRow
|
|
5590
|
+
}) || ''}`;
|
|
5591
|
+
}
|
|
5592
|
+
else {
|
|
5593
|
+
tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
|
|
5594
|
+
}
|
|
5595
|
+
reactData.dragTipText = tipContent;
|
|
5596
|
+
};
|
|
5597
|
+
const updateColDropOrigin = (column) => {
|
|
5579
5598
|
const el = refElem.value;
|
|
5580
5599
|
if (el) {
|
|
5581
|
-
const clss = '
|
|
5582
|
-
XEUtils.arrayEach(el.querySelectorAll(
|
|
5583
|
-
|
|
5600
|
+
const clss = 'col--drag-origin';
|
|
5601
|
+
XEUtils.arrayEach(el.querySelectorAll(`[colid="${column.id}"]`), (elem) => {
|
|
5602
|
+
addClass(elem, clss);
|
|
5584
5603
|
});
|
|
5585
5604
|
}
|
|
5586
5605
|
};
|
|
5587
|
-
const
|
|
5606
|
+
const clearColDropOrigin = () => {
|
|
5588
5607
|
const el = refElem.value;
|
|
5589
5608
|
if (el) {
|
|
5590
|
-
const clss = '
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
elem.setAttribute('drag-pos', dragPos);
|
|
5609
|
+
const clss = 'col--drag-origin';
|
|
5610
|
+
XEUtils.arrayEach(el.querySelectorAll(`.${clss}`), (elem) => {
|
|
5611
|
+
elem.draggable = false;
|
|
5612
|
+
removeClass(elem, clss);
|
|
5595
5613
|
});
|
|
5596
5614
|
}
|
|
5597
5615
|
};
|
|
5598
|
-
const
|
|
5599
|
-
const
|
|
5600
|
-
|
|
5601
|
-
|
|
5616
|
+
const updateColDropTipContent = (tdEl) => {
|
|
5617
|
+
const { dragCol } = reactData;
|
|
5618
|
+
const columnDragOpts = computeColumnDragOpts.value;
|
|
5619
|
+
const { tooltipMethod } = columnDragOpts;
|
|
5620
|
+
let tipContent = '';
|
|
5621
|
+
if (tooltipMethod) {
|
|
5622
|
+
tipContent = `${tooltipMethod({
|
|
5623
|
+
column: dragCol
|
|
5624
|
+
}) || ''}`;
|
|
5602
5625
|
}
|
|
5626
|
+
else {
|
|
5627
|
+
tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
|
|
5628
|
+
}
|
|
5629
|
+
reactData.dragTipText = tipContent;
|
|
5630
|
+
};
|
|
5631
|
+
const showDropTip = (evnt, trEl, thEl, dragPos) => {
|
|
5603
5632
|
const el = refElem.value;
|
|
5604
5633
|
if (!el) {
|
|
5605
5634
|
return;
|
|
5606
5635
|
}
|
|
5636
|
+
const { scrollbarWidth, scrollbarHeight } = reactData;
|
|
5637
|
+
const wrapperRect = el.getBoundingClientRect();
|
|
5638
|
+
if (trEl) {
|
|
5639
|
+
const rdLineEl = refDragRowLineElem.value;
|
|
5640
|
+
if (rdLineEl) {
|
|
5641
|
+
const trRect = trEl.getBoundingClientRect();
|
|
5642
|
+
let top = Math.max(1, trRect.y - wrapperRect.y);
|
|
5643
|
+
if (dragPos === 'bottom') {
|
|
5644
|
+
top = Math.min(wrapperRect.height - 1, trRect.y - wrapperRect.y + trRect.height);
|
|
5645
|
+
}
|
|
5646
|
+
rdLineEl.style.top = `${top}px`;
|
|
5647
|
+
rdLineEl.style.width = `${wrapperRect.width - scrollbarWidth}px`;
|
|
5648
|
+
rdLineEl.style.display = 'block';
|
|
5649
|
+
}
|
|
5650
|
+
}
|
|
5651
|
+
else if (thEl) {
|
|
5652
|
+
const cdLineEl = refDragColLineElem.value;
|
|
5653
|
+
if (cdLineEl) {
|
|
5654
|
+
const thRect = thEl.getBoundingClientRect();
|
|
5655
|
+
let left = Math.max(1, thRect.x - wrapperRect.x);
|
|
5656
|
+
if (dragPos === 'right') {
|
|
5657
|
+
left = Math.min(wrapperRect.width - 2, thRect.x - wrapperRect.x + thRect.width);
|
|
5658
|
+
}
|
|
5659
|
+
cdLineEl.style.left = `${left}px`;
|
|
5660
|
+
cdLineEl.style.height = `${wrapperRect.height - scrollbarHeight}px`;
|
|
5661
|
+
cdLineEl.style.display = 'block';
|
|
5662
|
+
}
|
|
5663
|
+
}
|
|
5664
|
+
const rdTipEl = refDragTipElem.value;
|
|
5607
5665
|
if (rdTipEl) {
|
|
5608
|
-
const wrapperRect = el.getBoundingClientRect();
|
|
5609
5666
|
rdTipEl.style.display = 'block';
|
|
5610
5667
|
rdTipEl.style.top = `${Math.min(el.clientHeight - el.scrollTop - rdTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`;
|
|
5611
5668
|
rdTipEl.style.left = `${Math.min(el.clientWidth - el.scrollLeft - rdTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`;
|
|
5612
5669
|
}
|
|
5613
5670
|
};
|
|
5614
|
-
const
|
|
5615
|
-
const rdTipEl =
|
|
5671
|
+
const hideDropTip = () => {
|
|
5672
|
+
const rdTipEl = refDragTipElem.value;
|
|
5673
|
+
const rdLineEl = refDragRowLineElem.value;
|
|
5674
|
+
const cdLineEl = refDragColLineElem.value;
|
|
5616
5675
|
if (rdTipEl) {
|
|
5617
5676
|
rdTipEl.style.display = '';
|
|
5618
5677
|
}
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
const { dragRow } = reactData;
|
|
5622
|
-
const dragOpts = computeDragOpts.value;
|
|
5623
|
-
const { rowTooltipMethod } = dragOpts;
|
|
5624
|
-
let tipContent = '';
|
|
5625
|
-
if (rowTooltipMethod) {
|
|
5626
|
-
tipContent = `${rowTooltipMethod({
|
|
5627
|
-
row: dragRow
|
|
5628
|
-
}) || ''}`;
|
|
5678
|
+
if (rdLineEl) {
|
|
5679
|
+
rdLineEl.style.display = '';
|
|
5629
5680
|
}
|
|
5630
|
-
|
|
5631
|
-
|
|
5681
|
+
if (cdLineEl) {
|
|
5682
|
+
cdLineEl.style.display = '';
|
|
5632
5683
|
}
|
|
5633
|
-
reactData.dragTipText = tipContent;
|
|
5634
5684
|
};
|
|
5635
5685
|
/**
|
|
5636
5686
|
* 处理显示 tooltip
|
|
@@ -6717,6 +6767,9 @@ export default defineComponent({
|
|
|
6717
6767
|
dispatchEvent('sort-change', params, evnt);
|
|
6718
6768
|
}
|
|
6719
6769
|
},
|
|
6770
|
+
/**
|
|
6771
|
+
* 行拖拽
|
|
6772
|
+
*/
|
|
6720
6773
|
handleRowDragDragstartEvent(evnt) {
|
|
6721
6774
|
const img = new Image();
|
|
6722
6775
|
if (evnt.dataTransfer) {
|
|
@@ -6724,26 +6777,29 @@ export default defineComponent({
|
|
|
6724
6777
|
}
|
|
6725
6778
|
},
|
|
6726
6779
|
handleRowDragDragendEvent(evnt) {
|
|
6727
|
-
const { treeConfig } = props;
|
|
6728
|
-
const
|
|
6729
|
-
const { dragEndMethod } =
|
|
6780
|
+
const { treeConfig, dragConfig } = props;
|
|
6781
|
+
const rowDragOpts = computeRowDragOpts.value;
|
|
6782
|
+
const { dragEndMethod } = rowDragOpts;
|
|
6730
6783
|
const treeOpts = computeTreeOpts.value;
|
|
6731
6784
|
const { transform } = treeOpts;
|
|
6732
6785
|
const { dragRow } = reactData;
|
|
6733
6786
|
const { afterFullData, afterTreeFullData, tableFullData, tableFullTreeData, prevDragRow, prevDragPos } = internalData;
|
|
6787
|
+
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
|
|
6788
|
+
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
6734
6789
|
if (prevDragRow && dragRow) {
|
|
6735
6790
|
// 判断是否有拖动
|
|
6736
6791
|
if (prevDragRow !== dragRow) {
|
|
6737
|
-
Promise.resolve(
|
|
6738
|
-
?
|
|
6792
|
+
Promise.resolve(dEndMethod
|
|
6793
|
+
? dEndMethod({
|
|
6739
6794
|
oldRow: dragRow,
|
|
6740
|
-
newRow: prevDragRow
|
|
6795
|
+
newRow: prevDragRow,
|
|
6796
|
+
dragPos: prevDragPos,
|
|
6797
|
+
offsetIndex: dragOffsetIndex
|
|
6741
6798
|
})
|
|
6742
6799
|
: true).then((status) => {
|
|
6743
6800
|
if (!status) {
|
|
6744
6801
|
return;
|
|
6745
6802
|
}
|
|
6746
|
-
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
6747
6803
|
let oafIndex = -1;
|
|
6748
6804
|
let nafIndex = -1;
|
|
6749
6805
|
if (treeConfig) {
|
|
@@ -6752,7 +6808,7 @@ export default defineComponent({
|
|
|
6752
6808
|
const otfIndex = $xeTable.findRowIndexOf(tableFullTreeData, dragRow);
|
|
6753
6809
|
afterTreeFullData.splice(oafIndex, 1);
|
|
6754
6810
|
tableFullTreeData.splice(otfIndex, 1);
|
|
6755
|
-
//
|
|
6811
|
+
// 插入新位置
|
|
6756
6812
|
const pafIndex = $xeTable.findRowIndexOf(afterTreeFullData, prevDragRow);
|
|
6757
6813
|
const ptfIndex = $xeTable.findRowIndexOf(tableFullTreeData, prevDragRow);
|
|
6758
6814
|
nafIndex = pafIndex + dragOffsetIndex;
|
|
@@ -6766,7 +6822,7 @@ export default defineComponent({
|
|
|
6766
6822
|
const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow);
|
|
6767
6823
|
afterFullData.splice(oafIndex, 1);
|
|
6768
6824
|
tableFullData.splice(otfIndex, 1);
|
|
6769
|
-
//
|
|
6825
|
+
// 插入新位置
|
|
6770
6826
|
const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow);
|
|
6771
6827
|
const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow);
|
|
6772
6828
|
nafIndex = pafIndex + dragOffsetIndex;
|
|
@@ -6776,23 +6832,24 @@ export default defineComponent({
|
|
|
6776
6832
|
}
|
|
6777
6833
|
reactData.isDragRowMove = true;
|
|
6778
6834
|
$xeTable.cacheRowMap();
|
|
6779
|
-
|
|
6835
|
+
updateScrollYStatus();
|
|
6780
6836
|
$xeTable.handleTableData(treeConfig && transform);
|
|
6781
6837
|
if (!(treeConfig && transform)) {
|
|
6782
6838
|
$xeTable.updateAfterDataIndex();
|
|
6783
6839
|
}
|
|
6784
|
-
$xeTable.updateFooter();
|
|
6785
6840
|
$xeTable.checkSelectionStatus();
|
|
6786
6841
|
if (reactData.scrollYLoad) {
|
|
6787
6842
|
$xeTable.updateScrollYSpace();
|
|
6788
6843
|
}
|
|
6789
6844
|
nextTick().then(() => {
|
|
6790
6845
|
$xeTable.updateCellAreas();
|
|
6791
|
-
|
|
6846
|
+
$xeTable.recalculate();
|
|
6792
6847
|
});
|
|
6793
6848
|
dispatchEvent('row-dragend', {
|
|
6794
6849
|
oldRow: dragRow,
|
|
6795
6850
|
newRow: prevDragRow,
|
|
6851
|
+
dragPos: prevDragPos,
|
|
6852
|
+
offsetIndex: dragOffsetIndex,
|
|
6796
6853
|
_index: {
|
|
6797
6854
|
newIndex: nafIndex,
|
|
6798
6855
|
oldIndex: oafIndex
|
|
@@ -6802,66 +6859,213 @@ export default defineComponent({
|
|
|
6802
6859
|
});
|
|
6803
6860
|
}
|
|
6804
6861
|
}
|
|
6805
|
-
|
|
6862
|
+
hideDropTip();
|
|
6806
6863
|
clearRowDropOrigin();
|
|
6807
|
-
clearRowDropTarget();
|
|
6808
6864
|
reactData.dragRow = null;
|
|
6865
|
+
reactData.dragCol = null;
|
|
6809
6866
|
setTimeout(() => {
|
|
6810
6867
|
reactData.isDragRowMove = false;
|
|
6811
6868
|
}, 500);
|
|
6812
6869
|
},
|
|
6813
6870
|
handleRowDragDragoverEvent(evnt) {
|
|
6871
|
+
const { dragRow } = reactData;
|
|
6872
|
+
if (!dragRow) {
|
|
6873
|
+
evnt.preventDefault();
|
|
6874
|
+
return;
|
|
6875
|
+
}
|
|
6814
6876
|
const trEl = evnt.currentTarget;
|
|
6815
6877
|
const rowid = trEl.getAttribute('rowid');
|
|
6816
6878
|
const row = $xeTable.getRowById(rowid);
|
|
6817
|
-
clearRowDropTarget();
|
|
6818
6879
|
if (row) {
|
|
6819
6880
|
evnt.preventDefault();
|
|
6820
6881
|
evnt.preventDefault();
|
|
6821
6882
|
const { dragRow } = reactData;
|
|
6822
6883
|
const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
|
|
6823
6884
|
const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
|
|
6824
|
-
updateRowDropTarget(row, dragPos);
|
|
6825
6885
|
internalData.prevDragRow = row;
|
|
6826
6886
|
internalData.prevDragPos = dragPos;
|
|
6887
|
+
showDropTip(evnt, trEl, null, dragPos);
|
|
6827
6888
|
dispatchEvent('row-dragover', {
|
|
6828
6889
|
oldRow: dragRow,
|
|
6829
6890
|
targetRow: row,
|
|
6830
6891
|
dragPos
|
|
6831
6892
|
}, evnt);
|
|
6832
6893
|
}
|
|
6833
|
-
showRowDropTip(evnt);
|
|
6834
6894
|
},
|
|
6835
6895
|
handleCellDragMousedownEvent(evnt, params) {
|
|
6836
6896
|
var _a;
|
|
6837
6897
|
evnt.stopPropagation();
|
|
6838
|
-
const
|
|
6839
|
-
const
|
|
6898
|
+
const { dragConfig } = props;
|
|
6899
|
+
const rowDragOpts = computeRowDragOpts.value;
|
|
6900
|
+
const { dragStartMethod } = rowDragOpts;
|
|
6840
6901
|
const { row } = params;
|
|
6841
6902
|
const dragEl = evnt.currentTarget;
|
|
6842
|
-
const tdEl = (_a = dragEl.
|
|
6843
|
-
const trEl = tdEl.
|
|
6903
|
+
const tdEl = (_a = dragEl.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
6904
|
+
const trEl = tdEl.parentElement;
|
|
6905
|
+
const dStartMethod = dragStartMethod || (dragConfig ? dragConfig.dragStartMethod : null);
|
|
6844
6906
|
reactData.isDragRowMove = false;
|
|
6845
6907
|
clearRowDropOrigin();
|
|
6846
|
-
if (
|
|
6908
|
+
if (dStartMethod && !dStartMethod(params)) {
|
|
6847
6909
|
trEl.draggable = false;
|
|
6848
6910
|
reactData.dragRow = null;
|
|
6849
|
-
|
|
6911
|
+
reactData.dragCol = null;
|
|
6912
|
+
hideDropTip();
|
|
6850
6913
|
return;
|
|
6851
6914
|
}
|
|
6852
6915
|
reactData.dragRow = row;
|
|
6916
|
+
reactData.dragCol = null;
|
|
6853
6917
|
trEl.draggable = true;
|
|
6854
6918
|
updateRowDropOrigin(row);
|
|
6855
|
-
showRowDropTip(evnt);
|
|
6856
6919
|
updateRowDropTipContent(tdEl);
|
|
6857
6920
|
dispatchEvent('row-dragstart', params, evnt);
|
|
6858
6921
|
},
|
|
6859
6922
|
handleCellDragMouseupEvent() {
|
|
6860
6923
|
clearRowDropOrigin();
|
|
6861
|
-
|
|
6924
|
+
hideDropTip();
|
|
6862
6925
|
reactData.dragRow = null;
|
|
6926
|
+
reactData.dragCol = null;
|
|
6863
6927
|
reactData.isDragRowMove = false;
|
|
6864
6928
|
},
|
|
6929
|
+
/**
|
|
6930
|
+
* 列拖拽
|
|
6931
|
+
*/
|
|
6932
|
+
handleHeaderCellDragDragstartEvent(evnt) {
|
|
6933
|
+
const img = new Image();
|
|
6934
|
+
if (evnt.dataTransfer) {
|
|
6935
|
+
evnt.dataTransfer.setDragImage(img, 0, 0);
|
|
6936
|
+
}
|
|
6937
|
+
},
|
|
6938
|
+
handleHeaderCellDragDragendEvent(evnt) {
|
|
6939
|
+
const { mouseConfig } = props;
|
|
6940
|
+
const columnDragOpts = computeColumnDragOpts.value;
|
|
6941
|
+
const { dragEndMethod } = columnDragOpts;
|
|
6942
|
+
const { dragCol } = reactData;
|
|
6943
|
+
const { collectColumn, prevDragCol, prevDragPos } = internalData;
|
|
6944
|
+
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
|
|
6945
|
+
if (prevDragCol && dragCol) {
|
|
6946
|
+
// 判断是否有拖动
|
|
6947
|
+
if (prevDragCol !== dragCol) {
|
|
6948
|
+
Promise.resolve(dragEndMethod
|
|
6949
|
+
? dragEndMethod({
|
|
6950
|
+
oldColumn: dragCol,
|
|
6951
|
+
newColumn: prevDragCol,
|
|
6952
|
+
dragPos: prevDragPos,
|
|
6953
|
+
offsetIndex: dragOffsetIndex
|
|
6954
|
+
})
|
|
6955
|
+
: true).then((status) => {
|
|
6956
|
+
if (!status) {
|
|
6957
|
+
return;
|
|
6958
|
+
}
|
|
6959
|
+
XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
|
|
6960
|
+
if (!parent) {
|
|
6961
|
+
const sortIndex = index + 1;
|
|
6962
|
+
column.renderSortNumber = sortIndex;
|
|
6963
|
+
}
|
|
6964
|
+
});
|
|
6965
|
+
const oafIndex = XEUtils.findIndexOf(collectColumn, item => item.id === dragCol.id);
|
|
6966
|
+
const nafIndex = XEUtils.findIndexOf(collectColumn, item => item.id === prevDragCol.id) + dragOffsetIndex;
|
|
6967
|
+
const newTargetCol = collectColumn[nafIndex];
|
|
6968
|
+
if (newTargetCol) {
|
|
6969
|
+
// 插入最后位置
|
|
6970
|
+
dragCol.renderSortNumber = newTargetCol.renderSortNumber;
|
|
6971
|
+
newTargetCol.renderSortNumber = dragCol.renderSortNumber + 0.5;
|
|
6972
|
+
}
|
|
6973
|
+
else {
|
|
6974
|
+
// 插入新位置
|
|
6975
|
+
dragCol.renderSortNumber = collectColumn.length + 1.5;
|
|
6976
|
+
}
|
|
6977
|
+
reactData.isDragColMove = true;
|
|
6978
|
+
if (mouseConfig) {
|
|
6979
|
+
if ($xeTable.clearSelected) {
|
|
6980
|
+
$xeTable.clearSelected();
|
|
6981
|
+
}
|
|
6982
|
+
if ($xeTable.clearCellAreas) {
|
|
6983
|
+
$xeTable.clearCellAreas();
|
|
6984
|
+
$xeTable.clearCopyCellArea();
|
|
6985
|
+
}
|
|
6986
|
+
}
|
|
6987
|
+
tablePrivateMethods.analyColumnWidth();
|
|
6988
|
+
nextTick().then(() => {
|
|
6989
|
+
$xeTable.updateCellAreas();
|
|
6990
|
+
tableMethods.refreshColumn(true);
|
|
6991
|
+
});
|
|
6992
|
+
dispatchEvent('column-dragend', {
|
|
6993
|
+
oldColumn: dragCol,
|
|
6994
|
+
newColumn: prevDragCol,
|
|
6995
|
+
dragPos: prevDragPos,
|
|
6996
|
+
offsetIndex: dragOffsetIndex,
|
|
6997
|
+
_index: {
|
|
6998
|
+
newIndex: nafIndex,
|
|
6999
|
+
oldIndex: oafIndex
|
|
7000
|
+
}
|
|
7001
|
+
}, evnt);
|
|
7002
|
+
}).catch(() => {
|
|
7003
|
+
});
|
|
7004
|
+
}
|
|
7005
|
+
}
|
|
7006
|
+
hideDropTip();
|
|
7007
|
+
clearColDropOrigin();
|
|
7008
|
+
reactData.dragRow = null;
|
|
7009
|
+
reactData.dragCol = null;
|
|
7010
|
+
setTimeout(() => {
|
|
7011
|
+
reactData.isDragColMove = false;
|
|
7012
|
+
}, 500);
|
|
7013
|
+
},
|
|
7014
|
+
handleHeaderCellDragDragoverEvent(evnt) {
|
|
7015
|
+
const { dragCol } = reactData;
|
|
7016
|
+
if (!dragCol) {
|
|
7017
|
+
evnt.preventDefault();
|
|
7018
|
+
return;
|
|
7019
|
+
}
|
|
7020
|
+
const thEl = evnt.currentTarget;
|
|
7021
|
+
const colid = thEl.getAttribute('colid');
|
|
7022
|
+
const column = $xeTable.getColumnById(colid);
|
|
7023
|
+
if (column) {
|
|
7024
|
+
evnt.preventDefault();
|
|
7025
|
+
const { dragCol } = reactData;
|
|
7026
|
+
const offsetX = evnt.clientX - thEl.getBoundingClientRect().x;
|
|
7027
|
+
const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
|
|
7028
|
+
internalData.prevDragCol = column;
|
|
7029
|
+
internalData.prevDragPos = dragPos;
|
|
7030
|
+
showDropTip(evnt, null, thEl, dragPos);
|
|
7031
|
+
dispatchEvent('column-dragover', {
|
|
7032
|
+
oldColumn: dragCol,
|
|
7033
|
+
targetColumn: column,
|
|
7034
|
+
dragPos
|
|
7035
|
+
}, evnt);
|
|
7036
|
+
}
|
|
7037
|
+
},
|
|
7038
|
+
handleHeaderCellDragMousedownEvent(evnt, params) {
|
|
7039
|
+
var _a;
|
|
7040
|
+
evnt.stopPropagation();
|
|
7041
|
+
const columnDragOpts = computeColumnDragOpts.value;
|
|
7042
|
+
const { dragStartMethod } = columnDragOpts;
|
|
7043
|
+
const { column } = params;
|
|
7044
|
+
const dragEl = evnt.currentTarget;
|
|
7045
|
+
const thEl = (_a = dragEl.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
7046
|
+
reactData.isDragColMove = false;
|
|
7047
|
+
clearColDropOrigin();
|
|
7048
|
+
if (dragStartMethod && !dragStartMethod(params)) {
|
|
7049
|
+
thEl.draggable = false;
|
|
7050
|
+
reactData.dragRow = null;
|
|
7051
|
+
reactData.dragCol = null;
|
|
7052
|
+
hideDropTip();
|
|
7053
|
+
return;
|
|
7054
|
+
}
|
|
7055
|
+
reactData.dragCol = column;
|
|
7056
|
+
reactData.dragRow = null;
|
|
7057
|
+
thEl.draggable = true;
|
|
7058
|
+
updateColDropOrigin(column);
|
|
7059
|
+
updateColDropTipContent(thEl);
|
|
7060
|
+
dispatchEvent('column-dragstart', params, evnt);
|
|
7061
|
+
},
|
|
7062
|
+
handleHeaderCellDragMouseupEvent() {
|
|
7063
|
+
clearColDropOrigin();
|
|
7064
|
+
hideDropTip();
|
|
7065
|
+
reactData.dragRow = null;
|
|
7066
|
+
reactData.dragCol = null;
|
|
7067
|
+
reactData.isDragColMove = false;
|
|
7068
|
+
},
|
|
6865
7069
|
/**
|
|
6866
7070
|
* 横向 X 可视渲染事件处理
|
|
6867
7071
|
*/
|
|
@@ -7026,8 +7230,7 @@ export default defineComponent({
|
|
|
7026
7230
|
containerList.forEach(name => {
|
|
7027
7231
|
const layoutList = ['header', 'body', 'footer'];
|
|
7028
7232
|
layoutList.forEach(layout => {
|
|
7029
|
-
const
|
|
7030
|
-
const xSpaceElem = xSpaceRef ? xSpaceRef.value : null;
|
|
7233
|
+
const xSpaceElem = getRefElem(elemStore[`${name}-${layout}-xSpace`]);
|
|
7031
7234
|
if (xSpaceElem) {
|
|
7032
7235
|
xSpaceElem.style.width = scrollXLoad ? `${tableWidth + (layout === 'header' ? scrollbarWidth : 0)}px` : '';
|
|
7033
7236
|
}
|
|
@@ -7079,14 +7282,12 @@ export default defineComponent({
|
|
|
7079
7282
|
}
|
|
7080
7283
|
containerList.forEach(name => {
|
|
7081
7284
|
const layoutList = ['header', 'body', 'footer'];
|
|
7082
|
-
const
|
|
7083
|
-
const tableElem = tableRef ? tableRef.value : null;
|
|
7285
|
+
const tableElem = getRefElem(elemStore[`${name}-body-table`]);
|
|
7084
7286
|
if (tableElem) {
|
|
7085
7287
|
tableElem.style.marginTop = marginTop;
|
|
7086
7288
|
}
|
|
7087
7289
|
layoutList.forEach(layout => {
|
|
7088
|
-
const
|
|
7089
|
-
const ySpaceElem = ySpaceRef ? ySpaceRef.value : null;
|
|
7290
|
+
const ySpaceElem = getRefElem(elemStore[`${name}-${layout}-ySpace`]);
|
|
7090
7291
|
if (ySpaceElem) {
|
|
7091
7292
|
ySpaceElem.style.height = ySpaceHeight;
|
|
7092
7293
|
}
|
|
@@ -7265,6 +7466,46 @@ export default defineComponent({
|
|
|
7265
7466
|
}
|
|
7266
7467
|
return getFuncText(props.emptyText) || getI18n('vxe.table.emptyText');
|
|
7267
7468
|
};
|
|
7469
|
+
const renderDragTipContents = () => {
|
|
7470
|
+
const { dragConfig } = props;
|
|
7471
|
+
const { dragRow, dragCol, dragTipText } = reactData;
|
|
7472
|
+
const columnDragOpts = computeColumnDragOpts.value;
|
|
7473
|
+
const rowDragOpts = computeRowDragOpts.value;
|
|
7474
|
+
const rowDragSlots = rowDragOpts.slots || {};
|
|
7475
|
+
const rTipSlot = rowDragSlots.tip || (dragConfig && dragConfig.slots ? dragConfig.slots.rowTip : null);
|
|
7476
|
+
const columnDragSlots = columnDragOpts.slots || {};
|
|
7477
|
+
const cTipSlot = columnDragSlots.tip;
|
|
7478
|
+
if (dragRow && rTipSlot) {
|
|
7479
|
+
return callSlot(rTipSlot, { row: dragRow });
|
|
7480
|
+
}
|
|
7481
|
+
if (dragCol && cTipSlot) {
|
|
7482
|
+
return callSlot(cTipSlot, { column: dragCol });
|
|
7483
|
+
}
|
|
7484
|
+
return [h('span', dragTipText)];
|
|
7485
|
+
};
|
|
7486
|
+
const renderDragTip = () => {
|
|
7487
|
+
const rowOpts = computeRowOpts.value;
|
|
7488
|
+
const columnOpts = computeColumnOpts.value;
|
|
7489
|
+
if (rowOpts.drag || columnOpts.drag) {
|
|
7490
|
+
return h('div', {
|
|
7491
|
+
class: 'vxe-table--drag-wrapper'
|
|
7492
|
+
}, [
|
|
7493
|
+
h('div', {
|
|
7494
|
+
ref: refDragRowLineElem,
|
|
7495
|
+
class: 'vxe-table--drag-row-line'
|
|
7496
|
+
}),
|
|
7497
|
+
h('div', {
|
|
7498
|
+
ref: refDragColLineElem,
|
|
7499
|
+
class: 'vxe-table--drag-col-line'
|
|
7500
|
+
}),
|
|
7501
|
+
h('div', {
|
|
7502
|
+
ref: refDragTipElem,
|
|
7503
|
+
class: 'vxe-table--drag-sort-tip'
|
|
7504
|
+
}, renderDragTipContents())
|
|
7505
|
+
]);
|
|
7506
|
+
}
|
|
7507
|
+
return renderEmptyElement($xeTable);
|
|
7508
|
+
};
|
|
7268
7509
|
function handleUupdateResize() {
|
|
7269
7510
|
const el = refElem.value;
|
|
7270
7511
|
if (el && el.clientWidth && el.clientHeight) {
|
|
@@ -7273,7 +7514,7 @@ export default defineComponent({
|
|
|
7273
7514
|
}
|
|
7274
7515
|
const renderVN = () => {
|
|
7275
7516
|
const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules } = props;
|
|
7276
|
-
const { isCalcColumn, isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, scrollbarHeight, tableData, tableColumn, tableGroupColumn, footerTableData, initStore, columnStore, filterStore, customStore, tooltipStore
|
|
7517
|
+
const { isCalcColumn, isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, scrollbarHeight, tableData, tableColumn, tableGroupColumn, footerTableData, initStore, columnStore, filterStore, customStore, tooltipStore } = reactData;
|
|
7277
7518
|
const { leftList, rightList } = columnStore;
|
|
7278
7519
|
const loadingSlot = slots.loading;
|
|
7279
7520
|
const tipConfig = computeTipConfig.value;
|
|
@@ -7281,18 +7522,17 @@ export default defineComponent({
|
|
|
7281
7522
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
7282
7523
|
const treeOpts = computeTreeOpts.value;
|
|
7283
7524
|
const rowOpts = computeRowOpts.value;
|
|
7284
|
-
const dragOpts = computeDragOpts.value;
|
|
7285
7525
|
const columnOpts = computeColumnOpts.value;
|
|
7286
7526
|
const vSize = computeSize.value;
|
|
7287
7527
|
const tableBorder = computeTableBorder.value;
|
|
7288
7528
|
const mouseOpts = computeMouseOpts.value;
|
|
7529
|
+
const areaOpts = computeAreaOpts.value;
|
|
7289
7530
|
const validTipOpts = computeValidTipOpts.value;
|
|
7290
7531
|
const loadingOpts = computeLoadingOpts.value;
|
|
7291
7532
|
const isMenu = computeIsMenu.value;
|
|
7292
7533
|
const currLoading = reactData._isLoading || loading;
|
|
7293
7534
|
const virtualScrollBars = computeVirtualScrollBars.value;
|
|
7294
|
-
const
|
|
7295
|
-
const rowTipSlot = dragSlots.rowTip;
|
|
7535
|
+
const isArea = mouseConfig && mouseOpts.area;
|
|
7296
7536
|
return h('div', {
|
|
7297
7537
|
ref: refElem,
|
|
7298
7538
|
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, {
|
|
@@ -7302,7 +7542,9 @@ export default defineComponent({
|
|
|
7302
7542
|
'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete',
|
|
7303
7543
|
'cell--highlight': highlightCell,
|
|
7304
7544
|
'cell--selected': mouseConfig && mouseOpts.selected,
|
|
7305
|
-
'cell--area':
|
|
7545
|
+
'cell--area': isArea,
|
|
7546
|
+
'header-cell--area': isArea && areaOpts.selectCellByHeader,
|
|
7547
|
+
'body-cell--area': isArea && areaOpts.selectCellByBody,
|
|
7306
7548
|
'row--highlight': rowOpts.isHover || highlightHoverRow,
|
|
7307
7549
|
'column--highlight': columnOpts.isHover || highlightHoverColumn,
|
|
7308
7550
|
'checkbox--range': checkboxOpts.range,
|
|
@@ -7511,16 +7753,9 @@ export default defineComponent({
|
|
|
7511
7753
|
})
|
|
7512
7754
|
: renderEmptyElement($xeTable),
|
|
7513
7755
|
/**
|
|
7514
|
-
*
|
|
7756
|
+
* 拖拽排序提示
|
|
7515
7757
|
*/
|
|
7516
|
-
|
|
7517
|
-
? h('div', {
|
|
7518
|
-
ref: refRowDragTipElem,
|
|
7519
|
-
class: 'vxe-table--row-drag-tip'
|
|
7520
|
-
}, rowTipSlot
|
|
7521
|
-
? (dragRow ? callSlot(rowTipSlot, { row: dragRow }) : [renderEmptyElement($xeTable)])
|
|
7522
|
-
: (dragTipText ? [h('span', dragTipText)] : [renderEmptyElement($xeTable)]))
|
|
7523
|
-
: renderEmptyElement($xeTable),
|
|
7758
|
+
renderDragTip(),
|
|
7524
7759
|
/**
|
|
7525
7760
|
* 提示相关
|
|
7526
7761
|
*/
|
|
@@ -7777,7 +8012,7 @@ export default defineComponent({
|
|
|
7777
8012
|
if (rowOpts.height && !props.showOverflow) {
|
|
7778
8013
|
warnLog('vxe.error.notProp', ['table.show-overflow']);
|
|
7779
8014
|
}
|
|
7780
|
-
if (!$xeTable.
|
|
8015
|
+
if (!$xeTable.handleRecalculateCellAreas) {
|
|
7781
8016
|
if (props.clipConfig) {
|
|
7782
8017
|
warnLog('vxe.error.notProp', ['clip-config']);
|
|
7783
8018
|
}
|
|
@@ -7789,6 +8024,9 @@ export default defineComponent({
|
|
|
7789
8024
|
return;
|
|
7790
8025
|
}
|
|
7791
8026
|
}
|
|
8027
|
+
if (props.dragConfig) {
|
|
8028
|
+
warnLog('vxe.error.delProp', ['drag-config', 'row-drag-config']);
|
|
8029
|
+
}
|
|
7792
8030
|
if (props.treeConfig && treeOpts.children) {
|
|
7793
8031
|
warnLog('vxe.error.delProp', ['tree-config.children', 'tree-config.childrenField']);
|
|
7794
8032
|
}
|