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/lib/table/src/table.js
CHANGED
|
@@ -275,6 +275,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
275
275
|
scrollVMLoading: false,
|
|
276
276
|
isDragRowMove: false,
|
|
277
277
|
dragRow: null,
|
|
278
|
+
isDragColMove: false,
|
|
279
|
+
dragCol: null,
|
|
278
280
|
dragTipText: '',
|
|
279
281
|
_isResize: false,
|
|
280
282
|
_isLoading: false
|
|
@@ -378,7 +380,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
378
380
|
const refRightContainer = (0, _vue.ref)();
|
|
379
381
|
const refCellResizeBar = (0, _vue.ref)();
|
|
380
382
|
const refEmptyPlaceholder = (0, _vue.ref)();
|
|
381
|
-
const
|
|
383
|
+
const refDragTipElem = (0, _vue.ref)();
|
|
384
|
+
const refDragRowLineElem = (0, _vue.ref)();
|
|
385
|
+
const refDragColLineElem = (0, _vue.ref)();
|
|
382
386
|
const refScrollXVirtualElem = (0, _vue.ref)();
|
|
383
387
|
const refScrollYVirtualElem = (0, _vue.ref)();
|
|
384
388
|
const refScrollXHandleElem = (0, _vue.ref)();
|
|
@@ -448,8 +452,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
448
452
|
const computeRowOpts = (0, _vue.computed)(() => {
|
|
449
453
|
return Object.assign({}, getConfig().table.rowConfig, props.rowConfig);
|
|
450
454
|
});
|
|
451
|
-
const
|
|
452
|
-
return Object.assign({}, getConfig().table.
|
|
455
|
+
const computeRowDragOpts = (0, _vue.computed)(() => {
|
|
456
|
+
return Object.assign({}, getConfig().table.rowDragConfig, props.rowDragConfig);
|
|
457
|
+
});
|
|
458
|
+
const computeColumnDragOpts = (0, _vue.computed)(() => {
|
|
459
|
+
return Object.assign({}, getConfig().table.columnDragConfig, props.columnDragConfig);
|
|
453
460
|
});
|
|
454
461
|
const computeResizeOpts = (0, _vue.computed)(() => {
|
|
455
462
|
return Object.assign({}, getConfig().table.resizeConfig, props.resizeConfig);
|
|
@@ -696,7 +703,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
696
703
|
computeColumnOpts,
|
|
697
704
|
computeCellOpts,
|
|
698
705
|
computeRowOpts,
|
|
699
|
-
|
|
706
|
+
computeRowDragOpts,
|
|
707
|
+
computeColumnDragOpts,
|
|
700
708
|
computeResizeOpts,
|
|
701
709
|
computeResizableOpts,
|
|
702
710
|
computeSeqOpts,
|
|
@@ -1885,8 +1893,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1885
1893
|
const cellOffsetWidth = computeCellOffsetWidth.value;
|
|
1886
1894
|
const mouseOpts = computeMouseOpts.value;
|
|
1887
1895
|
const keyboardOpts = computeKeyboardOpts.value;
|
|
1888
|
-
const
|
|
1889
|
-
const bodyWrapperElem = bodyWrapperRef ? bodyWrapperRef.value : null;
|
|
1896
|
+
const bodyWrapperElem = (0, _util.getRefElem)(elemStore['main-body-wrapper']);
|
|
1890
1897
|
if (emptyPlaceholderElem) {
|
|
1891
1898
|
emptyPlaceholderElem.style.top = `${headerHeight}px`;
|
|
1892
1899
|
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - scrollbarHeight}px` : '';
|
|
@@ -1931,10 +1938,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1931
1938
|
fixedWrapperElem = isFixedLeft ? refLeftContainer.value : refRightContainer.value;
|
|
1932
1939
|
}
|
|
1933
1940
|
layoutList.forEach(layout => {
|
|
1934
|
-
const
|
|
1935
|
-
const
|
|
1936
|
-
const tableRef = elemStore[`${name}-${layout}-table`];
|
|
1937
|
-
const tableElem = tableRef ? tableRef.value : null;
|
|
1941
|
+
const wrapperElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-wrapper`]);
|
|
1942
|
+
const tableElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-table`]);
|
|
1938
1943
|
if (layout === 'header') {
|
|
1939
1944
|
// 表头体样式处理
|
|
1940
1945
|
// 横向滚动渲染
|
|
@@ -1954,13 +1959,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1954
1959
|
if (tableElem) {
|
|
1955
1960
|
tableElem.style.width = tWidth ? `${tWidth + scrollbarWidth}px` : '';
|
|
1956
1961
|
}
|
|
1957
|
-
const
|
|
1958
|
-
const repairElem = repairRef ? repairRef.value : null;
|
|
1962
|
+
const repairElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-repair`]);
|
|
1959
1963
|
if (repairElem) {
|
|
1960
1964
|
repairElem.style.width = `${tableWidth}px`;
|
|
1961
1965
|
}
|
|
1962
|
-
const
|
|
1963
|
-
const listElem = listRef ? listRef.value : null;
|
|
1966
|
+
const listElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-list`]);
|
|
1964
1967
|
if (isGroup && listElem) {
|
|
1965
1968
|
_xeUtils.default.arrayEach(listElem.querySelectorAll('.col--group'), thElem => {
|
|
1966
1969
|
const colNode = tableMethods.getColumnNode(thElem);
|
|
@@ -1991,8 +1994,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1991
1994
|
});
|
|
1992
1995
|
}
|
|
1993
1996
|
} else if (layout === 'body') {
|
|
1994
|
-
const
|
|
1995
|
-
const emptyBlockElem = emptyBlockRef ? emptyBlockRef.value : null;
|
|
1997
|
+
const emptyBlockElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-emptyBlock`]);
|
|
1996
1998
|
if ((0, _dom.isNodeElement)(wrapperElem)) {
|
|
1997
1999
|
let bodyMaxHeight = 0;
|
|
1998
2000
|
const bodyMinHeight = customMinHeight - headerHeight - footerHeight;
|
|
@@ -2080,8 +2082,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
2080
2082
|
tableElem.style.width = tWidth ? `${tWidth + scrollbarWidth}px` : '';
|
|
2081
2083
|
}
|
|
2082
2084
|
}
|
|
2083
|
-
const
|
|
2084
|
-
const colgroupElem = colgroupRef ? colgroupRef.value : null;
|
|
2085
|
+
const colgroupElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-colgroup`]);
|
|
2085
2086
|
if (colgroupElem) {
|
|
2086
2087
|
_xeUtils.default.arrayEach(colgroupElem.children, colElem => {
|
|
2087
2088
|
const colid = colElem.getAttribute('name');
|
|
@@ -2109,8 +2110,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
2109
2110
|
const showTitle = cellOverflow === 'title';
|
|
2110
2111
|
const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
|
|
2111
2112
|
let hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
2112
|
-
const
|
|
2113
|
-
const listElem = listRef ? listRef.value : null;
|
|
2113
|
+
const listElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-list`]);
|
|
2114
2114
|
// 纵向虚拟滚动不支持动态行高
|
|
2115
2115
|
if (scrollYLoad && !hasEllipsis) {
|
|
2116
2116
|
hasEllipsis = true;
|
|
@@ -2844,6 +2844,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
2844
2844
|
editStore.removeMaps = {};
|
|
2845
2845
|
const sYLoad = updateScrollYStatus(fullData);
|
|
2846
2846
|
reactData.scrollYLoad = sYLoad;
|
|
2847
|
+
reactData.isDragRowMove = false;
|
|
2847
2848
|
// 全量数据
|
|
2848
2849
|
internalData.tableFullData = fullData;
|
|
2849
2850
|
internalData.tableFullTreeData = treeData;
|
|
@@ -3129,6 +3130,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3129
3130
|
const tableFullColumn = getColumnList(collectColumn);
|
|
3130
3131
|
internalData.tableFullColumn = tableFullColumn;
|
|
3131
3132
|
reactData._isLoading = true;
|
|
3133
|
+
reactData.isDragColMove = false;
|
|
3132
3134
|
initColumnSort();
|
|
3133
3135
|
return Promise.resolve(restoreCustomStorage()).then(() => {
|
|
3134
3136
|
reactData._isLoading = false;
|
|
@@ -5696,8 +5698,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
5696
5698
|
mouseConfig
|
|
5697
5699
|
} = props;
|
|
5698
5700
|
const mouseOpts = computeMouseOpts.value;
|
|
5699
|
-
if (mouseConfig && mouseOpts.area && $xeTable.
|
|
5700
|
-
return $xeTable.
|
|
5701
|
+
if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreas) {
|
|
5702
|
+
return $xeTable.handleRecalculateCellAreas();
|
|
5701
5703
|
}
|
|
5702
5704
|
return (0, _vue.nextTick)();
|
|
5703
5705
|
},
|
|
@@ -5907,7 +5909,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
5907
5909
|
// 如果点击了当前表格之外
|
|
5908
5910
|
!(0, _dom.getEventTargetNode)(evnt, el).flag) {
|
|
5909
5911
|
setTimeout(() => {
|
|
5910
|
-
$xeTable.
|
|
5912
|
+
$xeTable.handleClearEdit(evnt).then(() => {
|
|
5911
5913
|
// 如果存在校验,点击了表格之外则清除
|
|
5912
5914
|
if (!internalData.isActivated && editRules && validOpts.autoClear) {
|
|
5913
5915
|
reactData.validErrorMaps = {};
|
|
@@ -5995,8 +5997,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
5995
5997
|
if (isEsc) {
|
|
5996
5998
|
tablePrivateMethods.preventEvent(evnt, 'event.keydown', null, () => {
|
|
5997
5999
|
dispatchEvent('keydown-start', {}, evnt);
|
|
5998
|
-
if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.
|
|
5999
|
-
$xeTable.
|
|
6000
|
+
if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.handleKeyboardCellAreaEvent) {
|
|
6001
|
+
$xeTable.handleKeyboardCellAreaEvent(evnt);
|
|
6000
6002
|
} else if (actived.row || filterStore.visible || ctxMenuStore.visible) {
|
|
6001
6003
|
evnt.stopPropagation();
|
|
6002
6004
|
// 如果按下了 Esc 键,关闭快捷菜单、筛选
|
|
@@ -6008,7 +6010,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
6008
6010
|
// 如果是激活编辑状态,则取消编辑
|
|
6009
6011
|
if (actived.row) {
|
|
6010
6012
|
const params = actived.args;
|
|
6011
|
-
$xeTable.
|
|
6013
|
+
$xeTable.handleClearEdit(evnt);
|
|
6012
6014
|
// 如果配置了选中功能,则为选中状态
|
|
6013
6015
|
if (mouseOpts.selected) {
|
|
6014
6016
|
(0, _vue.nextTick)(() => $xeTable.handleSelected(params, evnt));
|
|
@@ -6082,8 +6084,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
6082
6084
|
} else {
|
|
6083
6085
|
$xeTable.moveCtxMenu(evnt, ctxMenuStore, 'selected', isRightArrow, true, menuList);
|
|
6084
6086
|
}
|
|
6085
|
-
} else if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.
|
|
6086
|
-
$xeTable.
|
|
6087
|
+
} else if (keyboardConfig && mouseConfig && mouseOpts.area && $xeTable.handleKeyboardCellAreaEvent) {
|
|
6088
|
+
$xeTable.handleKeyboardCellAreaEvent(evnt);
|
|
6087
6089
|
} else if (isEsc) {
|
|
6088
6090
|
// 如果按下了 Esc 键,关闭快捷菜单、筛选
|
|
6089
6091
|
if ($xeTable.closeMenu) {
|
|
@@ -6094,7 +6096,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
6094
6096
|
// 如果是激活编辑状态,则取消编辑
|
|
6095
6097
|
if (actived.row) {
|
|
6096
6098
|
const params = actived.args;
|
|
6097
|
-
$xeTable.
|
|
6099
|
+
$xeTable.handleClearEdit(evnt);
|
|
6098
6100
|
// 如果配置了选中功能,则为选中状态
|
|
6099
6101
|
if (mouseOpts.selected) {
|
|
6100
6102
|
(0, _vue.nextTick)(() => $xeTable.handleSelected(params, evnt));
|
|
@@ -6130,7 +6132,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
6130
6132
|
// 如果是激活编辑状态,则取消编辑
|
|
6131
6133
|
if (actived.row) {
|
|
6132
6134
|
const params = actived.args;
|
|
6133
|
-
$xeTable.
|
|
6135
|
+
$xeTable.handleClearEdit(evnt);
|
|
6134
6136
|
// 如果配置了选中功能,则为选中状态
|
|
6135
6137
|
if (mouseOpts.selected) {
|
|
6136
6138
|
(0, _vue.nextTick)(() => $xeTable.handleSelected(params, evnt));
|
|
@@ -6379,8 +6381,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
6379
6381
|
if (!el || !el.clientWidth) {
|
|
6380
6382
|
return (0, _vue.nextTick)();
|
|
6381
6383
|
}
|
|
6382
|
-
tableMethods.updateCellAreas();
|
|
6383
6384
|
tableMethods.recalculate(true);
|
|
6385
|
+
tableMethods.updateCellAreas();
|
|
6384
6386
|
};
|
|
6385
6387
|
const handleTargetEnterEvent = isClear => {
|
|
6386
6388
|
const $tooltip = refTooltip.value;
|
|
@@ -6413,65 +6415,120 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
6413
6415
|
});
|
|
6414
6416
|
}
|
|
6415
6417
|
};
|
|
6416
|
-
const
|
|
6418
|
+
const updateRowDropTipContent = tdEl => {
|
|
6419
|
+
const {
|
|
6420
|
+
dragConfig
|
|
6421
|
+
} = props;
|
|
6422
|
+
const {
|
|
6423
|
+
dragRow
|
|
6424
|
+
} = reactData;
|
|
6425
|
+
const rowDragOpts = computeRowDragOpts.value;
|
|
6426
|
+
const {
|
|
6427
|
+
tooltipMethod
|
|
6428
|
+
} = rowDragOpts;
|
|
6429
|
+
const rTooltipMethod = tooltipMethod || (dragConfig ? dragConfig.rowTooltipMethod : null);
|
|
6430
|
+
let tipContent = '';
|
|
6431
|
+
if (rTooltipMethod) {
|
|
6432
|
+
tipContent = `${rTooltipMethod({
|
|
6433
|
+
row: dragRow
|
|
6434
|
+
}) || ''}`;
|
|
6435
|
+
} else {
|
|
6436
|
+
tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
|
|
6437
|
+
}
|
|
6438
|
+
reactData.dragTipText = tipContent;
|
|
6439
|
+
};
|
|
6440
|
+
const updateColDropOrigin = column => {
|
|
6417
6441
|
const el = refElem.value;
|
|
6418
6442
|
if (el) {
|
|
6419
|
-
const clss = '
|
|
6420
|
-
_xeUtils.default.arrayEach(el.querySelectorAll(
|
|
6421
|
-
(0, _dom.
|
|
6443
|
+
const clss = 'col--drag-origin';
|
|
6444
|
+
_xeUtils.default.arrayEach(el.querySelectorAll(`[colid="${column.id}"]`), elem => {
|
|
6445
|
+
(0, _dom.addClass)(elem, clss);
|
|
6422
6446
|
});
|
|
6423
6447
|
}
|
|
6424
6448
|
};
|
|
6425
|
-
const
|
|
6449
|
+
const clearColDropOrigin = () => {
|
|
6426
6450
|
const el = refElem.value;
|
|
6427
6451
|
if (el) {
|
|
6428
|
-
const clss = '
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
(0, _dom.
|
|
6432
|
-
elem.setAttribute('drag-pos', dragPos);
|
|
6452
|
+
const clss = 'col--drag-origin';
|
|
6453
|
+
_xeUtils.default.arrayEach(el.querySelectorAll(`.${clss}`), elem => {
|
|
6454
|
+
elem.draggable = false;
|
|
6455
|
+
(0, _dom.removeClass)(elem, clss);
|
|
6433
6456
|
});
|
|
6434
6457
|
}
|
|
6435
6458
|
};
|
|
6436
|
-
const
|
|
6437
|
-
const
|
|
6438
|
-
|
|
6439
|
-
|
|
6459
|
+
const updateColDropTipContent = tdEl => {
|
|
6460
|
+
const {
|
|
6461
|
+
dragCol
|
|
6462
|
+
} = reactData;
|
|
6463
|
+
const columnDragOpts = computeColumnDragOpts.value;
|
|
6464
|
+
const {
|
|
6465
|
+
tooltipMethod
|
|
6466
|
+
} = columnDragOpts;
|
|
6467
|
+
let tipContent = '';
|
|
6468
|
+
if (tooltipMethod) {
|
|
6469
|
+
tipContent = `${tooltipMethod({
|
|
6470
|
+
column: dragCol
|
|
6471
|
+
}) || ''}`;
|
|
6472
|
+
} else {
|
|
6473
|
+
tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
|
|
6440
6474
|
}
|
|
6475
|
+
reactData.dragTipText = tipContent;
|
|
6476
|
+
};
|
|
6477
|
+
const showDropTip = (evnt, trEl, thEl, dragPos) => {
|
|
6441
6478
|
const el = refElem.value;
|
|
6442
6479
|
if (!el) {
|
|
6443
6480
|
return;
|
|
6444
6481
|
}
|
|
6482
|
+
const {
|
|
6483
|
+
scrollbarWidth,
|
|
6484
|
+
scrollbarHeight
|
|
6485
|
+
} = reactData;
|
|
6486
|
+
const wrapperRect = el.getBoundingClientRect();
|
|
6487
|
+
if (trEl) {
|
|
6488
|
+
const rdLineEl = refDragRowLineElem.value;
|
|
6489
|
+
if (rdLineEl) {
|
|
6490
|
+
const trRect = trEl.getBoundingClientRect();
|
|
6491
|
+
let top = Math.max(1, trRect.y - wrapperRect.y);
|
|
6492
|
+
if (dragPos === 'bottom') {
|
|
6493
|
+
top = Math.min(wrapperRect.height - 1, trRect.y - wrapperRect.y + trRect.height);
|
|
6494
|
+
}
|
|
6495
|
+
rdLineEl.style.top = `${top}px`;
|
|
6496
|
+
rdLineEl.style.width = `${wrapperRect.width - scrollbarWidth}px`;
|
|
6497
|
+
rdLineEl.style.display = 'block';
|
|
6498
|
+
}
|
|
6499
|
+
} else if (thEl) {
|
|
6500
|
+
const cdLineEl = refDragColLineElem.value;
|
|
6501
|
+
if (cdLineEl) {
|
|
6502
|
+
const thRect = thEl.getBoundingClientRect();
|
|
6503
|
+
let left = Math.max(1, thRect.x - wrapperRect.x);
|
|
6504
|
+
if (dragPos === 'right') {
|
|
6505
|
+
left = Math.min(wrapperRect.width - 2, thRect.x - wrapperRect.x + thRect.width);
|
|
6506
|
+
}
|
|
6507
|
+
cdLineEl.style.left = `${left}px`;
|
|
6508
|
+
cdLineEl.style.height = `${wrapperRect.height - scrollbarHeight}px`;
|
|
6509
|
+
cdLineEl.style.display = 'block';
|
|
6510
|
+
}
|
|
6511
|
+
}
|
|
6512
|
+
const rdTipEl = refDragTipElem.value;
|
|
6445
6513
|
if (rdTipEl) {
|
|
6446
|
-
const wrapperRect = el.getBoundingClientRect();
|
|
6447
6514
|
rdTipEl.style.display = 'block';
|
|
6448
6515
|
rdTipEl.style.top = `${Math.min(el.clientHeight - el.scrollTop - rdTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`;
|
|
6449
6516
|
rdTipEl.style.left = `${Math.min(el.clientWidth - el.scrollLeft - rdTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`;
|
|
6450
6517
|
}
|
|
6451
6518
|
};
|
|
6452
|
-
const
|
|
6453
|
-
const rdTipEl =
|
|
6519
|
+
const hideDropTip = () => {
|
|
6520
|
+
const rdTipEl = refDragTipElem.value;
|
|
6521
|
+
const rdLineEl = refDragRowLineElem.value;
|
|
6522
|
+
const cdLineEl = refDragColLineElem.value;
|
|
6454
6523
|
if (rdTipEl) {
|
|
6455
6524
|
rdTipEl.style.display = '';
|
|
6456
6525
|
}
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
const dragOpts = computeDragOpts.value;
|
|
6463
|
-
const {
|
|
6464
|
-
rowTooltipMethod
|
|
6465
|
-
} = dragOpts;
|
|
6466
|
-
let tipContent = '';
|
|
6467
|
-
if (rowTooltipMethod) {
|
|
6468
|
-
tipContent = `${rowTooltipMethod({
|
|
6469
|
-
row: dragRow
|
|
6470
|
-
}) || ''}`;
|
|
6471
|
-
} else {
|
|
6472
|
-
tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
|
|
6526
|
+
if (rdLineEl) {
|
|
6527
|
+
rdLineEl.style.display = '';
|
|
6528
|
+
}
|
|
6529
|
+
if (cdLineEl) {
|
|
6530
|
+
cdLineEl.style.display = '';
|
|
6473
6531
|
}
|
|
6474
|
-
reactData.dragTipText = tipContent;
|
|
6475
6532
|
};
|
|
6476
6533
|
/**
|
|
6477
6534
|
* 处理显示 tooltip
|
|
@@ -7793,6 +7850,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7793
7850
|
dispatchEvent('sort-change', params, evnt);
|
|
7794
7851
|
}
|
|
7795
7852
|
},
|
|
7853
|
+
/**
|
|
7854
|
+
* 行拖拽
|
|
7855
|
+
*/
|
|
7796
7856
|
handleRowDragDragstartEvent(evnt) {
|
|
7797
7857
|
const img = new Image();
|
|
7798
7858
|
if (evnt.dataTransfer) {
|
|
@@ -7801,12 +7861,13 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7801
7861
|
},
|
|
7802
7862
|
handleRowDragDragendEvent(evnt) {
|
|
7803
7863
|
const {
|
|
7804
|
-
treeConfig
|
|
7864
|
+
treeConfig,
|
|
7865
|
+
dragConfig
|
|
7805
7866
|
} = props;
|
|
7806
|
-
const
|
|
7867
|
+
const rowDragOpts = computeRowDragOpts.value;
|
|
7807
7868
|
const {
|
|
7808
7869
|
dragEndMethod
|
|
7809
|
-
} =
|
|
7870
|
+
} = rowDragOpts;
|
|
7810
7871
|
const treeOpts = computeTreeOpts.value;
|
|
7811
7872
|
const {
|
|
7812
7873
|
transform
|
|
@@ -7822,17 +7883,20 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7822
7883
|
prevDragRow,
|
|
7823
7884
|
prevDragPos
|
|
7824
7885
|
} = internalData;
|
|
7886
|
+
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
|
|
7887
|
+
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
7825
7888
|
if (prevDragRow && dragRow) {
|
|
7826
7889
|
// 判断是否有拖动
|
|
7827
7890
|
if (prevDragRow !== dragRow) {
|
|
7828
|
-
Promise.resolve(
|
|
7891
|
+
Promise.resolve(dEndMethod ? dEndMethod({
|
|
7829
7892
|
oldRow: dragRow,
|
|
7830
|
-
newRow: prevDragRow
|
|
7893
|
+
newRow: prevDragRow,
|
|
7894
|
+
dragPos: prevDragPos,
|
|
7895
|
+
offsetIndex: dragOffsetIndex
|
|
7831
7896
|
}) : true).then(status => {
|
|
7832
7897
|
if (!status) {
|
|
7833
7898
|
return;
|
|
7834
7899
|
}
|
|
7835
|
-
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
7836
7900
|
let oafIndex = -1;
|
|
7837
7901
|
let nafIndex = -1;
|
|
7838
7902
|
if (treeConfig) {
|
|
@@ -7841,7 +7905,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7841
7905
|
const otfIndex = $xeTable.findRowIndexOf(tableFullTreeData, dragRow);
|
|
7842
7906
|
afterTreeFullData.splice(oafIndex, 1);
|
|
7843
7907
|
tableFullTreeData.splice(otfIndex, 1);
|
|
7844
|
-
//
|
|
7908
|
+
// 插入新位置
|
|
7845
7909
|
const pafIndex = $xeTable.findRowIndexOf(afterTreeFullData, prevDragRow);
|
|
7846
7910
|
const ptfIndex = $xeTable.findRowIndexOf(tableFullTreeData, prevDragRow);
|
|
7847
7911
|
nafIndex = pafIndex + dragOffsetIndex;
|
|
@@ -7854,7 +7918,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7854
7918
|
const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow);
|
|
7855
7919
|
afterFullData.splice(oafIndex, 1);
|
|
7856
7920
|
tableFullData.splice(otfIndex, 1);
|
|
7857
|
-
//
|
|
7921
|
+
// 插入新位置
|
|
7858
7922
|
const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow);
|
|
7859
7923
|
const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow);
|
|
7860
7924
|
nafIndex = pafIndex + dragOffsetIndex;
|
|
@@ -7864,23 +7928,24 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7864
7928
|
}
|
|
7865
7929
|
reactData.isDragRowMove = true;
|
|
7866
7930
|
$xeTable.cacheRowMap();
|
|
7867
|
-
|
|
7931
|
+
updateScrollYStatus();
|
|
7868
7932
|
$xeTable.handleTableData(treeConfig && transform);
|
|
7869
7933
|
if (!(treeConfig && transform)) {
|
|
7870
7934
|
$xeTable.updateAfterDataIndex();
|
|
7871
7935
|
}
|
|
7872
|
-
$xeTable.updateFooter();
|
|
7873
7936
|
$xeTable.checkSelectionStatus();
|
|
7874
7937
|
if (reactData.scrollYLoad) {
|
|
7875
7938
|
$xeTable.updateScrollYSpace();
|
|
7876
7939
|
}
|
|
7877
7940
|
(0, _vue.nextTick)().then(() => {
|
|
7878
7941
|
$xeTable.updateCellAreas();
|
|
7879
|
-
|
|
7942
|
+
$xeTable.recalculate();
|
|
7880
7943
|
});
|
|
7881
7944
|
dispatchEvent('row-dragend', {
|
|
7882
7945
|
oldRow: dragRow,
|
|
7883
7946
|
newRow: prevDragRow,
|
|
7947
|
+
dragPos: prevDragPos,
|
|
7948
|
+
offsetIndex: dragOffsetIndex,
|
|
7884
7949
|
_index: {
|
|
7885
7950
|
newIndex: nafIndex,
|
|
7886
7951
|
oldIndex: oafIndex
|
|
@@ -7889,19 +7954,25 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7889
7954
|
}).catch(() => {});
|
|
7890
7955
|
}
|
|
7891
7956
|
}
|
|
7892
|
-
|
|
7957
|
+
hideDropTip();
|
|
7893
7958
|
clearRowDropOrigin();
|
|
7894
|
-
clearRowDropTarget();
|
|
7895
7959
|
reactData.dragRow = null;
|
|
7960
|
+
reactData.dragCol = null;
|
|
7896
7961
|
setTimeout(() => {
|
|
7897
7962
|
reactData.isDragRowMove = false;
|
|
7898
7963
|
}, 500);
|
|
7899
7964
|
},
|
|
7900
7965
|
handleRowDragDragoverEvent(evnt) {
|
|
7966
|
+
const {
|
|
7967
|
+
dragRow
|
|
7968
|
+
} = reactData;
|
|
7969
|
+
if (!dragRow) {
|
|
7970
|
+
evnt.preventDefault();
|
|
7971
|
+
return;
|
|
7972
|
+
}
|
|
7901
7973
|
const trEl = evnt.currentTarget;
|
|
7902
7974
|
const rowid = trEl.getAttribute('rowid');
|
|
7903
7975
|
const row = $xeTable.getRowById(rowid);
|
|
7904
|
-
clearRowDropTarget();
|
|
7905
7976
|
if (row) {
|
|
7906
7977
|
evnt.preventDefault();
|
|
7907
7978
|
evnt.preventDefault();
|
|
@@ -7910,51 +7981,210 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7910
7981
|
} = reactData;
|
|
7911
7982
|
const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
|
|
7912
7983
|
const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
|
|
7913
|
-
updateRowDropTarget(row, dragPos);
|
|
7914
7984
|
internalData.prevDragRow = row;
|
|
7915
7985
|
internalData.prevDragPos = dragPos;
|
|
7986
|
+
showDropTip(evnt, trEl, null, dragPos);
|
|
7916
7987
|
dispatchEvent('row-dragover', {
|
|
7917
7988
|
oldRow: dragRow,
|
|
7918
7989
|
targetRow: row,
|
|
7919
7990
|
dragPos
|
|
7920
7991
|
}, evnt);
|
|
7921
7992
|
}
|
|
7922
|
-
showRowDropTip(evnt);
|
|
7923
7993
|
},
|
|
7924
7994
|
handleCellDragMousedownEvent(evnt, params) {
|
|
7925
7995
|
var _a;
|
|
7926
7996
|
evnt.stopPropagation();
|
|
7927
|
-
const
|
|
7997
|
+
const {
|
|
7998
|
+
dragConfig
|
|
7999
|
+
} = props;
|
|
8000
|
+
const rowDragOpts = computeRowDragOpts.value;
|
|
7928
8001
|
const {
|
|
7929
8002
|
dragStartMethod
|
|
7930
|
-
} =
|
|
8003
|
+
} = rowDragOpts;
|
|
7931
8004
|
const {
|
|
7932
8005
|
row
|
|
7933
8006
|
} = params;
|
|
7934
8007
|
const dragEl = evnt.currentTarget;
|
|
7935
|
-
const tdEl = (_a = dragEl.
|
|
7936
|
-
const trEl = tdEl.
|
|
8008
|
+
const tdEl = (_a = dragEl.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
8009
|
+
const trEl = tdEl.parentElement;
|
|
8010
|
+
const dStartMethod = dragStartMethod || (dragConfig ? dragConfig.dragStartMethod : null);
|
|
7937
8011
|
reactData.isDragRowMove = false;
|
|
7938
8012
|
clearRowDropOrigin();
|
|
7939
|
-
if (
|
|
8013
|
+
if (dStartMethod && !dStartMethod(params)) {
|
|
7940
8014
|
trEl.draggable = false;
|
|
7941
8015
|
reactData.dragRow = null;
|
|
7942
|
-
|
|
8016
|
+
reactData.dragCol = null;
|
|
8017
|
+
hideDropTip();
|
|
7943
8018
|
return;
|
|
7944
8019
|
}
|
|
7945
8020
|
reactData.dragRow = row;
|
|
8021
|
+
reactData.dragCol = null;
|
|
7946
8022
|
trEl.draggable = true;
|
|
7947
8023
|
updateRowDropOrigin(row);
|
|
7948
|
-
showRowDropTip(evnt);
|
|
7949
8024
|
updateRowDropTipContent(tdEl);
|
|
7950
8025
|
dispatchEvent('row-dragstart', params, evnt);
|
|
7951
8026
|
},
|
|
7952
8027
|
handleCellDragMouseupEvent() {
|
|
7953
8028
|
clearRowDropOrigin();
|
|
7954
|
-
|
|
8029
|
+
hideDropTip();
|
|
7955
8030
|
reactData.dragRow = null;
|
|
8031
|
+
reactData.dragCol = null;
|
|
7956
8032
|
reactData.isDragRowMove = false;
|
|
7957
8033
|
},
|
|
8034
|
+
/**
|
|
8035
|
+
* 列拖拽
|
|
8036
|
+
*/
|
|
8037
|
+
handleHeaderCellDragDragstartEvent(evnt) {
|
|
8038
|
+
const img = new Image();
|
|
8039
|
+
if (evnt.dataTransfer) {
|
|
8040
|
+
evnt.dataTransfer.setDragImage(img, 0, 0);
|
|
8041
|
+
}
|
|
8042
|
+
},
|
|
8043
|
+
handleHeaderCellDragDragendEvent(evnt) {
|
|
8044
|
+
const {
|
|
8045
|
+
mouseConfig
|
|
8046
|
+
} = props;
|
|
8047
|
+
const columnDragOpts = computeColumnDragOpts.value;
|
|
8048
|
+
const {
|
|
8049
|
+
dragEndMethod
|
|
8050
|
+
} = columnDragOpts;
|
|
8051
|
+
const {
|
|
8052
|
+
dragCol
|
|
8053
|
+
} = reactData;
|
|
8054
|
+
const {
|
|
8055
|
+
collectColumn,
|
|
8056
|
+
prevDragCol,
|
|
8057
|
+
prevDragPos
|
|
8058
|
+
} = internalData;
|
|
8059
|
+
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
|
|
8060
|
+
if (prevDragCol && dragCol) {
|
|
8061
|
+
// 判断是否有拖动
|
|
8062
|
+
if (prevDragCol !== dragCol) {
|
|
8063
|
+
Promise.resolve(dragEndMethod ? dragEndMethod({
|
|
8064
|
+
oldColumn: dragCol,
|
|
8065
|
+
newColumn: prevDragCol,
|
|
8066
|
+
dragPos: prevDragPos,
|
|
8067
|
+
offsetIndex: dragOffsetIndex
|
|
8068
|
+
}) : true).then(status => {
|
|
8069
|
+
if (!status) {
|
|
8070
|
+
return;
|
|
8071
|
+
}
|
|
8072
|
+
_xeUtils.default.eachTree(collectColumn, (column, index, items, path, parent) => {
|
|
8073
|
+
if (!parent) {
|
|
8074
|
+
const sortIndex = index + 1;
|
|
8075
|
+
column.renderSortNumber = sortIndex;
|
|
8076
|
+
}
|
|
8077
|
+
});
|
|
8078
|
+
const oafIndex = _xeUtils.default.findIndexOf(collectColumn, item => item.id === dragCol.id);
|
|
8079
|
+
const nafIndex = _xeUtils.default.findIndexOf(collectColumn, item => item.id === prevDragCol.id) + dragOffsetIndex;
|
|
8080
|
+
const newTargetCol = collectColumn[nafIndex];
|
|
8081
|
+
if (newTargetCol) {
|
|
8082
|
+
// 插入最后位置
|
|
8083
|
+
dragCol.renderSortNumber = newTargetCol.renderSortNumber;
|
|
8084
|
+
newTargetCol.renderSortNumber = dragCol.renderSortNumber + 0.5;
|
|
8085
|
+
} else {
|
|
8086
|
+
// 插入新位置
|
|
8087
|
+
dragCol.renderSortNumber = collectColumn.length + 1.5;
|
|
8088
|
+
}
|
|
8089
|
+
reactData.isDragColMove = true;
|
|
8090
|
+
if (mouseConfig) {
|
|
8091
|
+
if ($xeTable.clearSelected) {
|
|
8092
|
+
$xeTable.clearSelected();
|
|
8093
|
+
}
|
|
8094
|
+
if ($xeTable.clearCellAreas) {
|
|
8095
|
+
$xeTable.clearCellAreas();
|
|
8096
|
+
$xeTable.clearCopyCellArea();
|
|
8097
|
+
}
|
|
8098
|
+
}
|
|
8099
|
+
tablePrivateMethods.analyColumnWidth();
|
|
8100
|
+
(0, _vue.nextTick)().then(() => {
|
|
8101
|
+
$xeTable.updateCellAreas();
|
|
8102
|
+
tableMethods.refreshColumn(true);
|
|
8103
|
+
});
|
|
8104
|
+
dispatchEvent('column-dragend', {
|
|
8105
|
+
oldColumn: dragCol,
|
|
8106
|
+
newColumn: prevDragCol,
|
|
8107
|
+
dragPos: prevDragPos,
|
|
8108
|
+
offsetIndex: dragOffsetIndex,
|
|
8109
|
+
_index: {
|
|
8110
|
+
newIndex: nafIndex,
|
|
8111
|
+
oldIndex: oafIndex
|
|
8112
|
+
}
|
|
8113
|
+
}, evnt);
|
|
8114
|
+
}).catch(() => {});
|
|
8115
|
+
}
|
|
8116
|
+
}
|
|
8117
|
+
hideDropTip();
|
|
8118
|
+
clearColDropOrigin();
|
|
8119
|
+
reactData.dragRow = null;
|
|
8120
|
+
reactData.dragCol = null;
|
|
8121
|
+
setTimeout(() => {
|
|
8122
|
+
reactData.isDragColMove = false;
|
|
8123
|
+
}, 500);
|
|
8124
|
+
},
|
|
8125
|
+
handleHeaderCellDragDragoverEvent(evnt) {
|
|
8126
|
+
const {
|
|
8127
|
+
dragCol
|
|
8128
|
+
} = reactData;
|
|
8129
|
+
if (!dragCol) {
|
|
8130
|
+
evnt.preventDefault();
|
|
8131
|
+
return;
|
|
8132
|
+
}
|
|
8133
|
+
const thEl = evnt.currentTarget;
|
|
8134
|
+
const colid = thEl.getAttribute('colid');
|
|
8135
|
+
const column = $xeTable.getColumnById(colid);
|
|
8136
|
+
if (column) {
|
|
8137
|
+
evnt.preventDefault();
|
|
8138
|
+
const {
|
|
8139
|
+
dragCol
|
|
8140
|
+
} = reactData;
|
|
8141
|
+
const offsetX = evnt.clientX - thEl.getBoundingClientRect().x;
|
|
8142
|
+
const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
|
|
8143
|
+
internalData.prevDragCol = column;
|
|
8144
|
+
internalData.prevDragPos = dragPos;
|
|
8145
|
+
showDropTip(evnt, null, thEl, dragPos);
|
|
8146
|
+
dispatchEvent('column-dragover', {
|
|
8147
|
+
oldColumn: dragCol,
|
|
8148
|
+
targetColumn: column,
|
|
8149
|
+
dragPos
|
|
8150
|
+
}, evnt);
|
|
8151
|
+
}
|
|
8152
|
+
},
|
|
8153
|
+
handleHeaderCellDragMousedownEvent(evnt, params) {
|
|
8154
|
+
var _a;
|
|
8155
|
+
evnt.stopPropagation();
|
|
8156
|
+
const columnDragOpts = computeColumnDragOpts.value;
|
|
8157
|
+
const {
|
|
8158
|
+
dragStartMethod
|
|
8159
|
+
} = columnDragOpts;
|
|
8160
|
+
const {
|
|
8161
|
+
column
|
|
8162
|
+
} = params;
|
|
8163
|
+
const dragEl = evnt.currentTarget;
|
|
8164
|
+
const thEl = (_a = dragEl.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
8165
|
+
reactData.isDragColMove = false;
|
|
8166
|
+
clearColDropOrigin();
|
|
8167
|
+
if (dragStartMethod && !dragStartMethod(params)) {
|
|
8168
|
+
thEl.draggable = false;
|
|
8169
|
+
reactData.dragRow = null;
|
|
8170
|
+
reactData.dragCol = null;
|
|
8171
|
+
hideDropTip();
|
|
8172
|
+
return;
|
|
8173
|
+
}
|
|
8174
|
+
reactData.dragCol = column;
|
|
8175
|
+
reactData.dragRow = null;
|
|
8176
|
+
thEl.draggable = true;
|
|
8177
|
+
updateColDropOrigin(column);
|
|
8178
|
+
updateColDropTipContent(thEl);
|
|
8179
|
+
dispatchEvent('column-dragstart', params, evnt);
|
|
8180
|
+
},
|
|
8181
|
+
handleHeaderCellDragMouseupEvent() {
|
|
8182
|
+
clearColDropOrigin();
|
|
8183
|
+
hideDropTip();
|
|
8184
|
+
reactData.dragRow = null;
|
|
8185
|
+
reactData.dragCol = null;
|
|
8186
|
+
reactData.isDragColMove = false;
|
|
8187
|
+
},
|
|
7958
8188
|
/**
|
|
7959
8189
|
* 横向 X 可视渲染事件处理
|
|
7960
8190
|
*/
|
|
@@ -8146,8 +8376,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8146
8376
|
containerList.forEach(name => {
|
|
8147
8377
|
const layoutList = ['header', 'body', 'footer'];
|
|
8148
8378
|
layoutList.forEach(layout => {
|
|
8149
|
-
const
|
|
8150
|
-
const xSpaceElem = xSpaceRef ? xSpaceRef.value : null;
|
|
8379
|
+
const xSpaceElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-xSpace`]);
|
|
8151
8380
|
if (xSpaceElem) {
|
|
8152
8381
|
xSpaceElem.style.width = scrollXLoad ? `${tableWidth + (layout === 'header' ? scrollbarWidth : 0)}px` : '';
|
|
8153
8382
|
}
|
|
@@ -8210,14 +8439,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8210
8439
|
}
|
|
8211
8440
|
containerList.forEach(name => {
|
|
8212
8441
|
const layoutList = ['header', 'body', 'footer'];
|
|
8213
|
-
const
|
|
8214
|
-
const tableElem = tableRef ? tableRef.value : null;
|
|
8442
|
+
const tableElem = (0, _util.getRefElem)(elemStore[`${name}-body-table`]);
|
|
8215
8443
|
if (tableElem) {
|
|
8216
8444
|
tableElem.style.marginTop = marginTop;
|
|
8217
8445
|
}
|
|
8218
8446
|
layoutList.forEach(layout => {
|
|
8219
|
-
const
|
|
8220
|
-
const ySpaceElem = ySpaceRef ? ySpaceRef.value : null;
|
|
8447
|
+
const ySpaceElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-ySpace`]);
|
|
8221
8448
|
if (ySpaceElem) {
|
|
8222
8449
|
ySpaceElem.style.height = ySpaceHeight;
|
|
8223
8450
|
}
|
|
@@ -8397,6 +8624,52 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8397
8624
|
}
|
|
8398
8625
|
return (0, _utils.getFuncText)(props.emptyText) || getI18n('vxe.table.emptyText');
|
|
8399
8626
|
};
|
|
8627
|
+
const renderDragTipContents = () => {
|
|
8628
|
+
const {
|
|
8629
|
+
dragConfig
|
|
8630
|
+
} = props;
|
|
8631
|
+
const {
|
|
8632
|
+
dragRow,
|
|
8633
|
+
dragCol,
|
|
8634
|
+
dragTipText
|
|
8635
|
+
} = reactData;
|
|
8636
|
+
const columnDragOpts = computeColumnDragOpts.value;
|
|
8637
|
+
const rowDragOpts = computeRowDragOpts.value;
|
|
8638
|
+
const rowDragSlots = rowDragOpts.slots || {};
|
|
8639
|
+
const rTipSlot = rowDragSlots.tip || (dragConfig && dragConfig.slots ? dragConfig.slots.rowTip : null);
|
|
8640
|
+
const columnDragSlots = columnDragOpts.slots || {};
|
|
8641
|
+
const cTipSlot = columnDragSlots.tip;
|
|
8642
|
+
if (dragRow && rTipSlot) {
|
|
8643
|
+
return callSlot(rTipSlot, {
|
|
8644
|
+
row: dragRow
|
|
8645
|
+
});
|
|
8646
|
+
}
|
|
8647
|
+
if (dragCol && cTipSlot) {
|
|
8648
|
+
return callSlot(cTipSlot, {
|
|
8649
|
+
column: dragCol
|
|
8650
|
+
});
|
|
8651
|
+
}
|
|
8652
|
+
return [(0, _vue.h)('span', dragTipText)];
|
|
8653
|
+
};
|
|
8654
|
+
const renderDragTip = () => {
|
|
8655
|
+
const rowOpts = computeRowOpts.value;
|
|
8656
|
+
const columnOpts = computeColumnOpts.value;
|
|
8657
|
+
if (rowOpts.drag || columnOpts.drag) {
|
|
8658
|
+
return (0, _vue.h)('div', {
|
|
8659
|
+
class: 'vxe-table--drag-wrapper'
|
|
8660
|
+
}, [(0, _vue.h)('div', {
|
|
8661
|
+
ref: refDragRowLineElem,
|
|
8662
|
+
class: 'vxe-table--drag-row-line'
|
|
8663
|
+
}), (0, _vue.h)('div', {
|
|
8664
|
+
ref: refDragColLineElem,
|
|
8665
|
+
class: 'vxe-table--drag-col-line'
|
|
8666
|
+
}), (0, _vue.h)('div', {
|
|
8667
|
+
ref: refDragTipElem,
|
|
8668
|
+
class: 'vxe-table--drag-sort-tip'
|
|
8669
|
+
}, renderDragTipContents())]);
|
|
8670
|
+
}
|
|
8671
|
+
return renderEmptyElement($xeTable);
|
|
8672
|
+
};
|
|
8400
8673
|
function handleUupdateResize() {
|
|
8401
8674
|
const el = refElem.value;
|
|
8402
8675
|
if (el && el.clientWidth && el.clientHeight) {
|
|
@@ -8434,9 +8707,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8434
8707
|
columnStore,
|
|
8435
8708
|
filterStore,
|
|
8436
8709
|
customStore,
|
|
8437
|
-
tooltipStore
|
|
8438
|
-
dragRow,
|
|
8439
|
-
dragTipText
|
|
8710
|
+
tooltipStore
|
|
8440
8711
|
} = reactData;
|
|
8441
8712
|
const {
|
|
8442
8713
|
leftList,
|
|
@@ -8448,18 +8719,17 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8448
8719
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
8449
8720
|
const treeOpts = computeTreeOpts.value;
|
|
8450
8721
|
const rowOpts = computeRowOpts.value;
|
|
8451
|
-
const dragOpts = computeDragOpts.value;
|
|
8452
8722
|
const columnOpts = computeColumnOpts.value;
|
|
8453
8723
|
const vSize = computeSize.value;
|
|
8454
8724
|
const tableBorder = computeTableBorder.value;
|
|
8455
8725
|
const mouseOpts = computeMouseOpts.value;
|
|
8726
|
+
const areaOpts = computeAreaOpts.value;
|
|
8456
8727
|
const validTipOpts = computeValidTipOpts.value;
|
|
8457
8728
|
const loadingOpts = computeLoadingOpts.value;
|
|
8458
8729
|
const isMenu = computeIsMenu.value;
|
|
8459
8730
|
const currLoading = reactData._isLoading || loading;
|
|
8460
8731
|
const virtualScrollBars = computeVirtualScrollBars.value;
|
|
8461
|
-
const
|
|
8462
|
-
const rowTipSlot = dragSlots.rowTip;
|
|
8732
|
+
const isArea = mouseConfig && mouseOpts.area;
|
|
8463
8733
|
return (0, _vue.h)('div', {
|
|
8464
8734
|
ref: refElem,
|
|
8465
8735
|
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, {
|
|
@@ -8469,7 +8739,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8469
8739
|
'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete',
|
|
8470
8740
|
'cell--highlight': highlightCell,
|
|
8471
8741
|
'cell--selected': mouseConfig && mouseOpts.selected,
|
|
8472
|
-
'cell--area':
|
|
8742
|
+
'cell--area': isArea,
|
|
8743
|
+
'header-cell--area': isArea && areaOpts.selectCellByHeader,
|
|
8744
|
+
'body-cell--area': isArea && areaOpts.selectCellByBody,
|
|
8473
8745
|
'row--highlight': rowOpts.isHover || highlightHoverRow,
|
|
8474
8746
|
'column--highlight': columnOpts.isHover || highlightHoverColumn,
|
|
8475
8747
|
'checkbox--range': checkboxOpts.range,
|
|
@@ -8637,14 +8909,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8637
8909
|
ref: refTableMenu
|
|
8638
8910
|
}) : renderEmptyElement($xeTable),
|
|
8639
8911
|
/**
|
|
8640
|
-
*
|
|
8912
|
+
* 拖拽排序提示
|
|
8641
8913
|
*/
|
|
8642
|
-
|
|
8643
|
-
ref: refRowDragTipElem,
|
|
8644
|
-
class: 'vxe-table--row-drag-tip'
|
|
8645
|
-
}, rowTipSlot ? dragRow ? callSlot(rowTipSlot, {
|
|
8646
|
-
row: dragRow
|
|
8647
|
-
}) : [renderEmptyElement($xeTable)] : dragTipText ? [(0, _vue.h)('span', dragTipText)] : [renderEmptyElement($xeTable)]) : renderEmptyElement($xeTable),
|
|
8914
|
+
renderDragTip(),
|
|
8648
8915
|
/**
|
|
8649
8916
|
* 提示相关
|
|
8650
8917
|
*/
|
|
@@ -8924,7 +9191,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8924
9191
|
if (rowOpts.height && !props.showOverflow) {
|
|
8925
9192
|
(0, _log.warnLog)('vxe.error.notProp', ['table.show-overflow']);
|
|
8926
9193
|
}
|
|
8927
|
-
if (!$xeTable.
|
|
9194
|
+
if (!$xeTable.handleRecalculateCellAreas) {
|
|
8928
9195
|
if (props.clipConfig) {
|
|
8929
9196
|
(0, _log.warnLog)('vxe.error.notProp', ['clip-config']);
|
|
8930
9197
|
}
|
|
@@ -8936,6 +9203,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8936
9203
|
return;
|
|
8937
9204
|
}
|
|
8938
9205
|
}
|
|
9206
|
+
if (props.dragConfig) {
|
|
9207
|
+
(0, _log.warnLog)('vxe.error.delProp', ['drag-config', 'row-drag-config']);
|
|
9208
|
+
}
|
|
8939
9209
|
if (props.treeConfig && treeOpts.children) {
|
|
8940
9210
|
(0, _log.warnLog)('vxe.error.delProp', ['tree-config.children', 'tree-config.childrenField']);
|
|
8941
9211
|
}
|