vxe-table 4.11.18 → 4.11.20
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/es/grid/src/grid.js +45 -34
- package/es/style.css +1 -1
- package/es/table/module/keyboard/hook.js +30 -1
- package/es/table/src/body.js +11 -6
- package/es/table/src/footer.js +7 -2
- package/es/table/src/table.js +164 -48
- package/es/table/src/util.js +13 -3
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +43 -39
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +293 -104
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/keyboard/hook.js +31 -1
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/src/body.js +10 -5
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/footer.js +7 -2
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/table.js +184 -49
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +16 -6
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +1 -1
- 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/package.json +2 -2
- package/packages/grid/src/grid.ts +49 -40
- package/packages/table/module/keyboard/hook.ts +29 -2
- package/packages/table/src/body.ts +10 -5
- package/packages/table/src/footer.ts +7 -2
- package/packages/table/src/table.ts +167 -50
- package/packages/table/src/util.ts +15 -3
- /package/es/{iconfont.1741224125327.ttf → iconfont.1741665718304.ttf} +0 -0
- /package/es/{iconfont.1741224125327.woff → iconfont.1741665718304.woff} +0 -0
- /package/es/{iconfont.1741224125327.woff2 → iconfont.1741665718304.woff2} +0 -0
- /package/lib/{iconfont.1741224125327.ttf → iconfont.1741665718304.ttf} +0 -0
- /package/lib/{iconfont.1741224125327.woff → iconfont.1741665718304.woff} +0 -0
- /package/lib/{iconfont.1741224125327.woff2 → iconfont.1741665718304.woff2} +0 -0
package/es/table/src/body.js
CHANGED
|
@@ -205,6 +205,7 @@ export default defineComponent({
|
|
|
205
205
|
tdOns.onDblclick = (evnt) => {
|
|
206
206
|
$xeTable.triggerCellDblclickEvent(evnt, cellParams);
|
|
207
207
|
};
|
|
208
|
+
let isMergeCell = false;
|
|
208
209
|
// 合并行或列
|
|
209
210
|
if (mergeList.length) {
|
|
210
211
|
const spanRest = mergeBodyMethod(mergeList, _rowIndex, _columnIndex);
|
|
@@ -214,9 +215,11 @@ export default defineComponent({
|
|
|
214
215
|
return null;
|
|
215
216
|
}
|
|
216
217
|
if (rowspan > 1) {
|
|
218
|
+
isMergeCell = true;
|
|
217
219
|
tdAttrs.rowspan = rowspan;
|
|
218
220
|
}
|
|
219
221
|
if (colspan > 1) {
|
|
222
|
+
isMergeCell = true;
|
|
220
223
|
tdAttrs.colspan = colspan;
|
|
221
224
|
}
|
|
222
225
|
}
|
|
@@ -249,12 +252,14 @@ export default defineComponent({
|
|
|
249
252
|
const isLastColumn = $columnIndex === columns.length - 1;
|
|
250
253
|
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
|
|
251
254
|
let isVNPreEmptyStatus = false;
|
|
252
|
-
if (!
|
|
253
|
-
if (
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
255
|
+
if (!isMergeCell) {
|
|
256
|
+
if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
|
|
257
|
+
if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
|
|
258
|
+
isVNPreEmptyStatus = true;
|
|
259
|
+
}
|
|
260
|
+
else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
|
|
261
|
+
isVNPreEmptyStatus = true;
|
|
262
|
+
}
|
|
258
263
|
}
|
|
259
264
|
}
|
|
260
265
|
const tcStyle = {};
|
package/es/table/src/footer.js
CHANGED
|
@@ -126,6 +126,7 @@ export default defineComponent({
|
|
|
126
126
|
tfOns.onDblclick = (evnt) => {
|
|
127
127
|
$xeTable.dispatchEvent('footer-cell-dblclick', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt);
|
|
128
128
|
};
|
|
129
|
+
let isMergeCell = false;
|
|
129
130
|
// 合并行或列
|
|
130
131
|
if (mergeFooterList.length) {
|
|
131
132
|
const spanRest = mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex);
|
|
@@ -135,9 +136,11 @@ export default defineComponent({
|
|
|
135
136
|
return null;
|
|
136
137
|
}
|
|
137
138
|
if (rowspan > 1) {
|
|
139
|
+
isMergeCell = true;
|
|
138
140
|
attrs.rowspan = rowspan;
|
|
139
141
|
}
|
|
140
142
|
if (colspan > 1) {
|
|
143
|
+
isMergeCell = true;
|
|
141
144
|
attrs.colspan = colspan;
|
|
142
145
|
}
|
|
143
146
|
}
|
|
@@ -158,8 +161,10 @@ export default defineComponent({
|
|
|
158
161
|
const isLastColumn = $columnIndex === tableColumn.length - 1;
|
|
159
162
|
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
|
|
160
163
|
let isVNPreEmptyStatus = false;
|
|
161
|
-
if (
|
|
162
|
-
|
|
164
|
+
if (!isMergeCell) {
|
|
165
|
+
if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
|
|
166
|
+
isVNPreEmptyStatus = true;
|
|
167
|
+
}
|
|
163
168
|
}
|
|
164
169
|
const tcStyle = {};
|
|
165
170
|
if (hasEllipsis) {
|
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, getRefElem, getColReMinWidth } from './util';
|
|
12
|
+
import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth } 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';
|
|
@@ -3374,6 +3374,9 @@ export default defineComponent({
|
|
|
3374
3374
|
};
|
|
3375
3375
|
tableMethods = {
|
|
3376
3376
|
dispatchEvent,
|
|
3377
|
+
getEl() {
|
|
3378
|
+
return refElem.value;
|
|
3379
|
+
},
|
|
3377
3380
|
/**
|
|
3378
3381
|
* 重置表格的一切数据状态
|
|
3379
3382
|
*/
|
|
@@ -3693,7 +3696,9 @@ export default defineComponent({
|
|
|
3693
3696
|
*/
|
|
3694
3697
|
revertData(rows, field) {
|
|
3695
3698
|
const { keepSource, treeConfig } = props;
|
|
3699
|
+
const { editStore } = reactData;
|
|
3696
3700
|
const { fullAllDataRowIdData, fullDataRowIdData, tableSourceData, sourceDataRowIdData, tableFullData, afterFullData } = internalData;
|
|
3701
|
+
const removeTempMaps = Object.assign({}, editStore.removeMaps);
|
|
3697
3702
|
const treeOpts = computeTreeOpts.value;
|
|
3698
3703
|
const { transform } = treeOpts;
|
|
3699
3704
|
if (!keepSource) {
|
|
@@ -3728,6 +3733,7 @@ export default defineComponent({
|
|
|
3728
3733
|
XEUtils.destructuring(row, XEUtils.clone(oRow, true));
|
|
3729
3734
|
}
|
|
3730
3735
|
if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
|
|
3736
|
+
delete removeTempMaps[rowid];
|
|
3731
3737
|
tableFullData.unshift(row);
|
|
3732
3738
|
afterFullData.unshift(row);
|
|
3733
3739
|
reDelFlag = true;
|
|
@@ -3739,6 +3745,7 @@ export default defineComponent({
|
|
|
3739
3745
|
}
|
|
3740
3746
|
if (rows) {
|
|
3741
3747
|
if (reDelFlag) {
|
|
3748
|
+
editStore.removeMaps = removeTempMaps;
|
|
3742
3749
|
$xeTable.updateFooter();
|
|
3743
3750
|
$xeTable.cacheRowMap(false);
|
|
3744
3751
|
$xeTable.handleTableData(treeConfig && transform);
|
|
@@ -3891,18 +3898,20 @@ export default defineComponent({
|
|
|
3891
3898
|
},
|
|
3892
3899
|
/**
|
|
3893
3900
|
* 检查行或列数据是否发生改变
|
|
3894
|
-
* @param {Row}
|
|
3901
|
+
* @param {Row} rowOrId 行对象
|
|
3895
3902
|
* @param {String} field 字段名
|
|
3896
3903
|
*/
|
|
3897
|
-
isUpdateByRow(
|
|
3904
|
+
isUpdateByRow(rowOrId, field) {
|
|
3898
3905
|
const { keepSource } = props;
|
|
3899
3906
|
const { tableFullColumn, fullDataRowIdData, sourceDataRowIdData } = internalData;
|
|
3900
3907
|
if (keepSource) {
|
|
3901
|
-
const rowid = getRowid($xeTable,
|
|
3908
|
+
const rowid = XEUtils.isString(rowOrId) || XEUtils.isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId);
|
|
3909
|
+
const rowRest = fullDataRowIdData[rowid];
|
|
3902
3910
|
// 新增的数据不需要检测
|
|
3903
|
-
if (!
|
|
3911
|
+
if (!rowRest) {
|
|
3904
3912
|
return false;
|
|
3905
3913
|
}
|
|
3914
|
+
const row = rowRest.row;
|
|
3906
3915
|
const oRow = sourceDataRowIdData[rowid];
|
|
3907
3916
|
if (oRow) {
|
|
3908
3917
|
if (arguments.length > 1) {
|
|
@@ -3966,6 +3975,94 @@ export default defineComponent({
|
|
|
3966
3975
|
tableColumn: reactData.tableColumn.slice(0)
|
|
3967
3976
|
};
|
|
3968
3977
|
},
|
|
3978
|
+
/**
|
|
3979
|
+
* 移动列到指定列的位置
|
|
3980
|
+
* @param fieldOrColumn
|
|
3981
|
+
* @param targetFieldOrColumn
|
|
3982
|
+
* @param options
|
|
3983
|
+
*/
|
|
3984
|
+
moveColumnTo(fieldOrColumn, targetFieldOrColumn, options) {
|
|
3985
|
+
const { fullColumnIdData, visibleColumn } = internalData;
|
|
3986
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options);
|
|
3987
|
+
const dragCol = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
3988
|
+
let prevDragCol = null;
|
|
3989
|
+
const colRest = dragCol ? fullColumnIdData[dragCol.id] : null;
|
|
3990
|
+
let defPos = 'left';
|
|
3991
|
+
if (XEUtils.isNumber(targetFieldOrColumn)) {
|
|
3992
|
+
if (colRest && targetFieldOrColumn) {
|
|
3993
|
+
let currList = colRest.items;
|
|
3994
|
+
let offsetIndex = colRest._index + targetFieldOrColumn;
|
|
3995
|
+
if (isCrossDrag) {
|
|
3996
|
+
currList = visibleColumn;
|
|
3997
|
+
offsetIndex = colRest._index + targetFieldOrColumn;
|
|
3998
|
+
}
|
|
3999
|
+
if (offsetIndex > 0 && offsetIndex < currList.length - 1) {
|
|
4000
|
+
prevDragCol = currList[offsetIndex];
|
|
4001
|
+
}
|
|
4002
|
+
if (targetFieldOrColumn > 0) {
|
|
4003
|
+
defPos = 'right';
|
|
4004
|
+
}
|
|
4005
|
+
}
|
|
4006
|
+
}
|
|
4007
|
+
else {
|
|
4008
|
+
prevDragCol = handleFieldOrColumn($xeTable, targetFieldOrColumn);
|
|
4009
|
+
const targetColRest = prevDragCol ? fullColumnIdData[prevDragCol.id] : null;
|
|
4010
|
+
if (colRest && targetColRest) {
|
|
4011
|
+
if (targetColRest._index > colRest._index) {
|
|
4012
|
+
defPos = 'right';
|
|
4013
|
+
}
|
|
4014
|
+
}
|
|
4015
|
+
}
|
|
4016
|
+
return $xeTable.handleColDragSwapEvent(null, true, dragCol, prevDragCol, dragPos || defPos, dragToChild === true);
|
|
4017
|
+
},
|
|
4018
|
+
/**
|
|
4019
|
+
* 移动行到指定行的位置
|
|
4020
|
+
* @param rowidOrRow
|
|
4021
|
+
* @param targetRowidOrRow
|
|
4022
|
+
* @param options
|
|
4023
|
+
*/
|
|
4024
|
+
moveRowTo(rowidOrRow, targetRowidOrRow, options) {
|
|
4025
|
+
const { treeConfig } = props;
|
|
4026
|
+
const { fullAllDataRowIdData, afterFullData } = internalData;
|
|
4027
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options);
|
|
4028
|
+
const treeOpts = computeTreeOpts.value;
|
|
4029
|
+
const dragRow = handleRowidOrRow($xeTable, rowidOrRow);
|
|
4030
|
+
let prevDragRow = null;
|
|
4031
|
+
let defPos = 'top';
|
|
4032
|
+
const rowRest = dragRow ? fullAllDataRowIdData[getRowid($xeTable, dragRow)] : null;
|
|
4033
|
+
if (XEUtils.isNumber(targetRowidOrRow)) {
|
|
4034
|
+
if (rowRest && targetRowidOrRow) {
|
|
4035
|
+
let currList = afterFullData;
|
|
4036
|
+
let offsetIndex = rowRest._index + targetRowidOrRow;
|
|
4037
|
+
if (treeConfig) {
|
|
4038
|
+
currList = rowRest.items;
|
|
4039
|
+
if (treeOpts.transform) {
|
|
4040
|
+
offsetIndex = rowRest.treeIndex + targetRowidOrRow;
|
|
4041
|
+
if (isCrossDrag) {
|
|
4042
|
+
currList = afterFullData;
|
|
4043
|
+
offsetIndex = rowRest._index + targetRowidOrRow;
|
|
4044
|
+
}
|
|
4045
|
+
}
|
|
4046
|
+
}
|
|
4047
|
+
if (offsetIndex >= 0 && offsetIndex <= currList.length - 1) {
|
|
4048
|
+
prevDragRow = currList[offsetIndex];
|
|
4049
|
+
}
|
|
4050
|
+
if (targetRowidOrRow > 0) {
|
|
4051
|
+
defPos = 'bottom';
|
|
4052
|
+
}
|
|
4053
|
+
}
|
|
4054
|
+
}
|
|
4055
|
+
else {
|
|
4056
|
+
prevDragRow = handleRowidOrRow($xeTable, targetRowidOrRow);
|
|
4057
|
+
const targetRowRest = prevDragRow ? fullAllDataRowIdData[getRowid($xeTable, prevDragRow)] : null;
|
|
4058
|
+
if (rowRest && targetRowRest) {
|
|
4059
|
+
if (targetRowRest._index > rowRest._index) {
|
|
4060
|
+
defPos = 'bottom';
|
|
4061
|
+
}
|
|
4062
|
+
}
|
|
4063
|
+
}
|
|
4064
|
+
return $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true);
|
|
4065
|
+
},
|
|
3969
4066
|
/**
|
|
3970
4067
|
* 获取表格的全量列
|
|
3971
4068
|
*/
|
|
@@ -6146,8 +6243,8 @@ export default defineComponent({
|
|
|
6146
6243
|
if (selected.row && selected.column) {
|
|
6147
6244
|
$xeTable.moveSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
|
|
6148
6245
|
}
|
|
6149
|
-
|
|
6150
|
-
|
|
6246
|
+
// 当前行按键上下移动
|
|
6247
|
+
if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
|
|
6151
6248
|
$xeTable.moveCurrentRow(isUpArrow, isDwArrow, evnt);
|
|
6152
6249
|
}
|
|
6153
6250
|
}
|
|
@@ -8039,6 +8136,9 @@ export default defineComponent({
|
|
|
8039
8136
|
const { afterFullData, tableFullData } = internalData;
|
|
8040
8137
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
|
|
8041
8138
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
8139
|
+
const errRest = {
|
|
8140
|
+
status: false
|
|
8141
|
+
};
|
|
8042
8142
|
if (prevDragRow && dragRow) {
|
|
8043
8143
|
// 判断是否有拖动
|
|
8044
8144
|
if (prevDragRow !== dragRow) {
|
|
@@ -8053,7 +8153,7 @@ export default defineComponent({
|
|
|
8053
8153
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
8054
8154
|
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
8055
8155
|
if (!status) {
|
|
8056
|
-
return;
|
|
8156
|
+
return errRest;
|
|
8057
8157
|
}
|
|
8058
8158
|
let oafIndex = -1;
|
|
8059
8159
|
let nafIndex = -1;
|
|
@@ -8078,12 +8178,12 @@ export default defineComponent({
|
|
|
8078
8178
|
if (isPeerDrag && !isCrossDrag) {
|
|
8079
8179
|
if (oldRest.row[parentField] !== newRest.row[parentField]) {
|
|
8080
8180
|
// 非同级
|
|
8081
|
-
return;
|
|
8181
|
+
return errRest;
|
|
8082
8182
|
}
|
|
8083
8183
|
}
|
|
8084
8184
|
else {
|
|
8085
8185
|
if (!isCrossDrag) {
|
|
8086
|
-
return;
|
|
8186
|
+
return errRest;
|
|
8087
8187
|
}
|
|
8088
8188
|
if (oldAllMaps[newRowid]) {
|
|
8089
8189
|
isSelfToChildStatus = true;
|
|
@@ -8094,7 +8194,7 @@ export default defineComponent({
|
|
|
8094
8194
|
content: getI18n('vxe.error.treeDragChild')
|
|
8095
8195
|
});
|
|
8096
8196
|
}
|
|
8097
|
-
return;
|
|
8197
|
+
return errRest;
|
|
8098
8198
|
}
|
|
8099
8199
|
}
|
|
8100
8200
|
}
|
|
@@ -8102,13 +8202,13 @@ export default defineComponent({
|
|
|
8102
8202
|
else if (oldLevel) {
|
|
8103
8203
|
// 子到根
|
|
8104
8204
|
if (!isCrossDrag) {
|
|
8105
|
-
return;
|
|
8205
|
+
return errRest;
|
|
8106
8206
|
}
|
|
8107
8207
|
}
|
|
8108
8208
|
else if (newLevel) {
|
|
8109
8209
|
// 根到子
|
|
8110
8210
|
if (!isCrossDrag) {
|
|
8111
|
-
return;
|
|
8211
|
+
return errRest;
|
|
8112
8212
|
}
|
|
8113
8213
|
if (oldAllMaps[newRowid]) {
|
|
8114
8214
|
isSelfToChildStatus = true;
|
|
@@ -8119,7 +8219,7 @@ export default defineComponent({
|
|
|
8119
8219
|
content: getI18n('vxe.error.treeDragChild')
|
|
8120
8220
|
});
|
|
8121
8221
|
}
|
|
8122
|
-
return;
|
|
8222
|
+
return errRest;
|
|
8123
8223
|
}
|
|
8124
8224
|
}
|
|
8125
8225
|
}
|
|
@@ -8179,27 +8279,34 @@ export default defineComponent({
|
|
|
8179
8279
|
if (reactData.scrollYLoad) {
|
|
8180
8280
|
$xeTable.updateScrollYSpace();
|
|
8181
8281
|
}
|
|
8182
|
-
|
|
8282
|
+
if (evnt) {
|
|
8283
|
+
dispatchEvent('row-dragend', {
|
|
8284
|
+
oldRow: dragRow,
|
|
8285
|
+
newRow: prevDragRow,
|
|
8286
|
+
dragRow,
|
|
8287
|
+
dragPos: prevDragPos,
|
|
8288
|
+
dragToChild: isDragToChildFlag,
|
|
8289
|
+
offsetIndex: dragOffsetIndex,
|
|
8290
|
+
_index: {
|
|
8291
|
+
newIndex: nafIndex,
|
|
8292
|
+
oldIndex: oafIndex
|
|
8293
|
+
}
|
|
8294
|
+
}, evnt);
|
|
8295
|
+
}
|
|
8296
|
+
return nextTick().then(() => {
|
|
8183
8297
|
$xeTable.updateCellAreas();
|
|
8184
8298
|
$xeTable.recalculate();
|
|
8299
|
+
}).then(() => {
|
|
8300
|
+
return {
|
|
8301
|
+
status: true
|
|
8302
|
+
};
|
|
8185
8303
|
});
|
|
8186
|
-
dispatchEvent('row-dragend', {
|
|
8187
|
-
oldRow: dragRow,
|
|
8188
|
-
newRow: prevDragRow,
|
|
8189
|
-
dragRow,
|
|
8190
|
-
dragPos: prevDragPos,
|
|
8191
|
-
dragToChild: isDragToChildFlag,
|
|
8192
|
-
offsetIndex: dragOffsetIndex,
|
|
8193
|
-
_index: {
|
|
8194
|
-
newIndex: nafIndex,
|
|
8195
|
-
oldIndex: oafIndex
|
|
8196
|
-
}
|
|
8197
|
-
}, evnt);
|
|
8198
8304
|
}).catch(() => {
|
|
8305
|
+
return errRest;
|
|
8199
8306
|
});
|
|
8200
8307
|
}
|
|
8201
8308
|
}
|
|
8202
|
-
return Promise.resolve();
|
|
8309
|
+
return Promise.resolve(errRest);
|
|
8203
8310
|
},
|
|
8204
8311
|
handleRowDragDragendEvent(evnt) {
|
|
8205
8312
|
const { treeConfig } = props;
|
|
@@ -8326,6 +8433,9 @@ export default defineComponent({
|
|
|
8326
8433
|
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts;
|
|
8327
8434
|
const { collectColumn } = internalData;
|
|
8328
8435
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
|
|
8436
|
+
const errRest = {
|
|
8437
|
+
status: false
|
|
8438
|
+
};
|
|
8329
8439
|
if (prevDragCol && dragCol) {
|
|
8330
8440
|
// 判断是否有拖动
|
|
8331
8441
|
if (prevDragCol !== dragCol) {
|
|
@@ -8342,7 +8452,7 @@ export default defineComponent({
|
|
|
8342
8452
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
8343
8453
|
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
8344
8454
|
if (!status) {
|
|
8345
|
-
return;
|
|
8455
|
+
return errRest;
|
|
8346
8456
|
}
|
|
8347
8457
|
let oafIndex = -1;
|
|
8348
8458
|
let nafIndex = -1;
|
|
@@ -8356,12 +8466,12 @@ export default defineComponent({
|
|
|
8356
8466
|
if (isPeerDrag && !isCrossDrag) {
|
|
8357
8467
|
if (dragColumn.parentId !== newColumn.parentId) {
|
|
8358
8468
|
// 非同级
|
|
8359
|
-
return;
|
|
8469
|
+
return errRest;
|
|
8360
8470
|
}
|
|
8361
8471
|
}
|
|
8362
8472
|
else {
|
|
8363
8473
|
if (!isCrossDrag) {
|
|
8364
|
-
return;
|
|
8474
|
+
return errRest;
|
|
8365
8475
|
}
|
|
8366
8476
|
if (oldAllMaps[newColumn.id]) {
|
|
8367
8477
|
isSelfToChildStatus = true;
|
|
@@ -8372,7 +8482,7 @@ export default defineComponent({
|
|
|
8372
8482
|
content: getI18n('vxe.error.treeDragChild')
|
|
8373
8483
|
});
|
|
8374
8484
|
}
|
|
8375
|
-
return;
|
|
8485
|
+
return errRest;
|
|
8376
8486
|
}
|
|
8377
8487
|
}
|
|
8378
8488
|
}
|
|
@@ -8380,13 +8490,13 @@ export default defineComponent({
|
|
|
8380
8490
|
else if (dragColumn.parentId) {
|
|
8381
8491
|
// 子到根
|
|
8382
8492
|
if (!isCrossDrag) {
|
|
8383
|
-
return;
|
|
8493
|
+
return errRest;
|
|
8384
8494
|
}
|
|
8385
8495
|
}
|
|
8386
8496
|
else if (newColumn.parentId) {
|
|
8387
8497
|
// 根到子
|
|
8388
8498
|
if (!isCrossDrag) {
|
|
8389
|
-
return;
|
|
8499
|
+
return errRest;
|
|
8390
8500
|
}
|
|
8391
8501
|
if (oldAllMaps[newColumn.id]) {
|
|
8392
8502
|
isSelfToChildStatus = true;
|
|
@@ -8397,7 +8507,7 @@ export default defineComponent({
|
|
|
8397
8507
|
content: getI18n('vxe.error.treeDragChild')
|
|
8398
8508
|
});
|
|
8399
8509
|
}
|
|
8400
|
-
return;
|
|
8510
|
+
return errRest;
|
|
8401
8511
|
}
|
|
8402
8512
|
}
|
|
8403
8513
|
}
|
|
@@ -8458,26 +8568,32 @@ export default defineComponent({
|
|
|
8458
8568
|
$xeTable.clearCopyCellArea();
|
|
8459
8569
|
}
|
|
8460
8570
|
}
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8571
|
+
if (evnt) {
|
|
8572
|
+
dispatchEvent('column-dragend', {
|
|
8573
|
+
oldColumn: dragColumn,
|
|
8574
|
+
newColumn,
|
|
8575
|
+
dragColumn,
|
|
8576
|
+
dragPos: prevDragPos,
|
|
8577
|
+
dragToChild: isDragToChildFlag,
|
|
8578
|
+
offsetIndex: dragOffsetIndex,
|
|
8579
|
+
_index: {
|
|
8580
|
+
newIndex: nafIndex,
|
|
8581
|
+
oldIndex: oafIndex
|
|
8582
|
+
}
|
|
8583
|
+
}, evnt);
|
|
8584
|
+
}
|
|
8473
8585
|
if (isSyncColumn) {
|
|
8474
8586
|
$xeTable.handleColDragSwapColumn();
|
|
8475
8587
|
}
|
|
8588
|
+
return {
|
|
8589
|
+
status: true
|
|
8590
|
+
};
|
|
8476
8591
|
}).catch(() => {
|
|
8592
|
+
return errRest;
|
|
8477
8593
|
});
|
|
8478
8594
|
}
|
|
8479
8595
|
}
|
|
8480
|
-
return Promise.resolve();
|
|
8596
|
+
return Promise.resolve(errRest);
|
|
8481
8597
|
},
|
|
8482
8598
|
handleHeaderCellDragDragendEvent(evnt) {
|
|
8483
8599
|
const { dragCol } = reactData;
|
package/es/table/src/util.js
CHANGED
|
@@ -90,14 +90,17 @@ export function getRowUniqueId() {
|
|
|
90
90
|
export function getRowkey($xeTable) {
|
|
91
91
|
const { props } = $xeTable;
|
|
92
92
|
const { computeRowOpts } = $xeTable.getComputeMaps();
|
|
93
|
-
const { rowId } = props;
|
|
94
93
|
const rowOpts = computeRowOpts.value;
|
|
95
|
-
return rowId || rowOpts.keyField || '_X_ROW_KEY'
|
|
94
|
+
return `${props.rowId || rowOpts.keyField || '_X_ROW_KEY'}`;
|
|
96
95
|
}
|
|
97
96
|
// 行主键 value
|
|
98
97
|
export function getRowid($xeTable, row) {
|
|
99
98
|
const rowid = XEUtils.get(row, getRowkey($xeTable));
|
|
100
|
-
return
|
|
99
|
+
return encodeRowid(rowid);
|
|
100
|
+
}
|
|
101
|
+
// 编码行主键
|
|
102
|
+
export function encodeRowid(rowVal) {
|
|
103
|
+
return XEUtils.eqNull(rowVal) ? '' : encodeURIComponent(rowVal);
|
|
101
104
|
}
|
|
102
105
|
export const handleFieldOrColumn = ($xeTable, fieldOrColumn) => {
|
|
103
106
|
if (fieldOrColumn) {
|
|
@@ -105,6 +108,13 @@ export const handleFieldOrColumn = ($xeTable, fieldOrColumn) => {
|
|
|
105
108
|
}
|
|
106
109
|
return null;
|
|
107
110
|
};
|
|
111
|
+
export const handleRowidOrRow = ($xeTable, rowidOrRow) => {
|
|
112
|
+
if (rowidOrRow) {
|
|
113
|
+
const rowid = XEUtils.isString(rowidOrRow) || XEUtils.isNumber(rowidOrRow) ? rowidOrRow : getRowid($xeTable, rowidOrRow);
|
|
114
|
+
return $xeTable.getRowById(rowid);
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
};
|
|
108
118
|
function getPaddingLeftRightSize(elem) {
|
|
109
119
|
if (elem) {
|
|
110
120
|
const computedStyle = getComputedStyle(elem);
|
package/es/ui/index.js
CHANGED
package/es/ui/src/log.js
CHANGED