vxe-table 3.12.4 → 3.12.6
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/style.css +1 -1
- package/es/table/module/custom/mixin.js +3 -3
- package/es/table/src/cell.js +1 -1
- package/es/table/src/methods.js +59 -20
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +76 -30
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/mixin.js +3 -3
- package/lib/table/src/cell.js +1 -1
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/methods.js +70 -24
- package/lib/table/src/methods.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/table/module/custom/mixin.ts +3 -3
- package/packages/table/src/cell.ts +1 -1
- package/packages/table/src/methods.ts +64 -24
- /package/es/{iconfont.1736149136555.ttf → iconfont.1736230307358.ttf} +0 -0
- /package/es/{iconfont.1736149136555.woff → iconfont.1736230307358.woff} +0 -0
- /package/es/{iconfont.1736149136555.woff2 → iconfont.1736230307358.woff2} +0 -0
- /package/lib/{iconfont.1736149136555.ttf → iconfont.1736230307358.ttf} +0 -0
- /package/lib/{iconfont.1736149136555.woff → iconfont.1736230307358.woff} +0 -0
- /package/lib/{iconfont.1736149136555.woff2 → iconfont.1736230307358.woff2} +0 -0
package/lib/table/src/methods.js
CHANGED
|
@@ -145,6 +145,10 @@ function cacheColumnMap($xeTable) {
|
|
|
145
145
|
isCrossDrag,
|
|
146
146
|
isSelfToChildDrag
|
|
147
147
|
} = columnDragOpts;
|
|
148
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
149
|
+
const {
|
|
150
|
+
storage
|
|
151
|
+
} = customOpts;
|
|
148
152
|
const rowOpts = $xeTable.computeRowOpts;
|
|
149
153
|
const isGroup = collectColumn.some(_utils.hasChildrenList);
|
|
150
154
|
let isAllOverflow = !!props.showOverflow;
|
|
@@ -178,8 +182,8 @@ function cacheColumnMap($xeTable) {
|
|
|
178
182
|
}
|
|
179
183
|
fullColumnFieldData[field] = rest;
|
|
180
184
|
} else {
|
|
181
|
-
if (isCrossDrag || isSelfToChildDrag) {
|
|
182
|
-
(0, _log.errLog)('vxe.error.
|
|
185
|
+
if (storage || isCrossDrag || isSelfToChildDrag) {
|
|
186
|
+
(0, _log.errLog)('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field`]);
|
|
183
187
|
}
|
|
184
188
|
}
|
|
185
189
|
if (!hasFixed && fixed) {
|
|
@@ -758,8 +762,9 @@ const calcCellHeight = $xeTable => {
|
|
|
758
762
|
rowRest.height = scrollXLoad ? Math.max(rowRest.height, height) : height;
|
|
759
763
|
}
|
|
760
764
|
});
|
|
765
|
+
reactData.isCalcCellHeight++;
|
|
761
766
|
}
|
|
762
|
-
// updateCellOffset(
|
|
767
|
+
// updateCellOffset()
|
|
763
768
|
};
|
|
764
769
|
function getOrderField(_vm, column) {
|
|
765
770
|
const {
|
|
@@ -1127,14 +1132,14 @@ function loadScrollYData($xeTable) {
|
|
|
1127
1132
|
endIndex,
|
|
1128
1133
|
offsetSize
|
|
1129
1134
|
} = scrollYStore;
|
|
1130
|
-
const
|
|
1135
|
+
const autoOffsetYSize = showOverflow ? offsetSize : offsetSize + Math.min(8, Math.ceil(tableHeight / 200));
|
|
1131
1136
|
const {
|
|
1132
1137
|
toVisibleIndex,
|
|
1133
1138
|
visibleSize
|
|
1134
1139
|
} = handleVirtualYVisible($xeTable);
|
|
1135
1140
|
const offsetItem = {
|
|
1136
|
-
startIndex: Math.max(0, toVisibleIndex - 1 -
|
|
1137
|
-
endIndex: toVisibleIndex + visibleSize +
|
|
1141
|
+
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
|
|
1142
|
+
endIndex: toVisibleIndex + visibleSize + autoOffsetYSize
|
|
1138
1143
|
};
|
|
1139
1144
|
calculateMergerOffsetIndex(mergeList, offsetItem, 'row');
|
|
1140
1145
|
const {
|
|
@@ -1163,11 +1168,12 @@ function checkLastSyncScroll($xeTable, isRollX, isRollY) {
|
|
|
1163
1168
|
clearTimeout(lcsTimeout);
|
|
1164
1169
|
}
|
|
1165
1170
|
internalData.lcsTimeout = setTimeout(() => {
|
|
1171
|
+
internalData.lcsRunTime = Date.now();
|
|
1166
1172
|
internalData.lcsTimeout = undefined;
|
|
1167
1173
|
internalData.inVirtualScroll = false;
|
|
1168
1174
|
internalData.inBodyScroll = false;
|
|
1169
|
-
internalData.bodyScrollType = '';
|
|
1170
1175
|
internalData.inFooterScroll = false;
|
|
1176
|
+
internalData.bodyScrollType = '';
|
|
1171
1177
|
if (isRollX && scrollXLoad) {
|
|
1172
1178
|
$xeTable.updateScrollXData().then(() => {
|
|
1173
1179
|
loadScrollXData($xeTable);
|
|
@@ -6404,7 +6410,7 @@ const Methods = {
|
|
|
6404
6410
|
evnt.dataTransfer.setDragImage((0, _dom.getTpImg)(), 0, 0);
|
|
6405
6411
|
}
|
|
6406
6412
|
},
|
|
6407
|
-
|
|
6413
|
+
handleRowDragSwapEvent(evnt, isSyncRow, dragRow, prevDragRow, prevDragPos, prevDragToChild) {
|
|
6408
6414
|
const $xeTable = this;
|
|
6409
6415
|
const props = $xeTable;
|
|
6410
6416
|
const reactData = $xeTable;
|
|
@@ -6415,8 +6421,7 @@ const Methods = {
|
|
|
6415
6421
|
} = props;
|
|
6416
6422
|
const rowDragOpts = $xeTable.computeRowDragOpts;
|
|
6417
6423
|
const {
|
|
6418
|
-
fullAllDataRowIdData
|
|
6419
|
-
prevDragToChild
|
|
6424
|
+
fullAllDataRowIdData
|
|
6420
6425
|
} = internalData;
|
|
6421
6426
|
const {
|
|
6422
6427
|
isPeerDrag,
|
|
@@ -6432,21 +6437,16 @@ const Methods = {
|
|
|
6432
6437
|
parentField
|
|
6433
6438
|
} = treeOpts;
|
|
6434
6439
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
6435
|
-
const {
|
|
6436
|
-
dragRow
|
|
6437
|
-
} = reactData;
|
|
6438
6440
|
const {
|
|
6439
6441
|
afterFullData,
|
|
6440
|
-
tableFullData
|
|
6441
|
-
prevDragRow,
|
|
6442
|
-
prevDragPos
|
|
6442
|
+
tableFullData
|
|
6443
6443
|
} = internalData;
|
|
6444
6444
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
|
|
6445
6445
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
6446
6446
|
if (prevDragRow && dragRow) {
|
|
6447
6447
|
// 判断是否有拖动
|
|
6448
6448
|
if (prevDragRow !== dragRow) {
|
|
6449
|
-
Promise.resolve(dEndMethod ? dEndMethod({
|
|
6449
|
+
return Promise.resolve(dEndMethod ? dEndMethod({
|
|
6450
6450
|
oldRow: dragRow,
|
|
6451
6451
|
newRow: prevDragRow,
|
|
6452
6452
|
dragPos: prevDragPos,
|
|
@@ -6597,6 +6597,48 @@ const Methods = {
|
|
|
6597
6597
|
}).catch(() => {});
|
|
6598
6598
|
}
|
|
6599
6599
|
}
|
|
6600
|
+
return Promise.resolve();
|
|
6601
|
+
},
|
|
6602
|
+
handleRowDragDragendEvent(evnt) {
|
|
6603
|
+
const $xeTable = this;
|
|
6604
|
+
const props = $xeTable;
|
|
6605
|
+
const reactData = $xeTable;
|
|
6606
|
+
const internalData = $xeTable;
|
|
6607
|
+
const {
|
|
6608
|
+
treeConfig
|
|
6609
|
+
} = props;
|
|
6610
|
+
const {
|
|
6611
|
+
fullAllDataRowIdData,
|
|
6612
|
+
prevDragToChild
|
|
6613
|
+
} = internalData;
|
|
6614
|
+
const {
|
|
6615
|
+
dragRow
|
|
6616
|
+
} = reactData;
|
|
6617
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
6618
|
+
const {
|
|
6619
|
+
lazy
|
|
6620
|
+
} = treeOpts;
|
|
6621
|
+
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
6622
|
+
const {
|
|
6623
|
+
prevDragRow,
|
|
6624
|
+
prevDragPos
|
|
6625
|
+
} = internalData;
|
|
6626
|
+
if (treeConfig && prevDragToChild) {
|
|
6627
|
+
// 懒加载
|
|
6628
|
+
if (lazy) {
|
|
6629
|
+
const newRowid = (0, _util.getRowid)($xeTable, prevDragRow);
|
|
6630
|
+
const rowRest = fullAllDataRowIdData[newRowid];
|
|
6631
|
+
if (prevDragRow[hasChildField]) {
|
|
6632
|
+
if (rowRest && rowRest.treeLoaded) {
|
|
6633
|
+
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
6634
|
+
}
|
|
6635
|
+
} else {
|
|
6636
|
+
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
6637
|
+
}
|
|
6638
|
+
}
|
|
6639
|
+
} else {
|
|
6640
|
+
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
6641
|
+
}
|
|
6600
6642
|
hideDropTip($xeTable);
|
|
6601
6643
|
clearRowDropOrigin($xeTable);
|
|
6602
6644
|
internalData.prevDragToChild = false;
|
|
@@ -6622,9 +6664,11 @@ const Methods = {
|
|
|
6622
6664
|
} = reactData;
|
|
6623
6665
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
6624
6666
|
const {
|
|
6667
|
+
lazy,
|
|
6625
6668
|
transform,
|
|
6626
6669
|
parentField
|
|
6627
6670
|
} = treeOpts;
|
|
6671
|
+
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
6628
6672
|
const rowDragOpts = $xeTable.computeRowDragOpts;
|
|
6629
6673
|
const {
|
|
6630
6674
|
isPeerDrag,
|
|
@@ -6641,19 +6685,21 @@ const Methods = {
|
|
|
6641
6685
|
const rest = fullAllDataRowIdData[rowid];
|
|
6642
6686
|
if (rest) {
|
|
6643
6687
|
const row = rest.row;
|
|
6688
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
6689
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
6644
6690
|
evnt.preventDefault();
|
|
6645
6691
|
const {
|
|
6646
6692
|
dragRow
|
|
6647
6693
|
} = reactData;
|
|
6648
6694
|
const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
|
|
6649
6695
|
const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
|
|
6650
|
-
if ($xeTable.eqRow(dragRow, row) || !isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level)) {
|
|
6651
|
-
showDropTip($xeTable, evnt, trEl, null, false, dragPos);
|
|
6652
|
-
return;
|
|
6653
|
-
}
|
|
6654
6696
|
internalData.prevDragToChild = !!(treeConfig && transform && isToChildDrag && hasCtrlKey);
|
|
6655
6697
|
internalData.prevDragRow = row;
|
|
6656
6698
|
internalData.prevDragPos = dragPos;
|
|
6699
|
+
if ($xeTable.eqRow(dragRow, row) || hasCtrlKey && treeConfig && lazy && row[hasChildField] && rowRest && !rowRest.treeLoaded || !isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level)) {
|
|
6700
|
+
showDropTip($xeTable, evnt, trEl, null, false, dragPos);
|
|
6701
|
+
return;
|
|
6702
|
+
}
|
|
6657
6703
|
showDropTip($xeTable, evnt, trEl, null, true, dragPos);
|
|
6658
6704
|
$xeTable.dispatchEvent('row-dragover', {
|
|
6659
6705
|
oldRow: dragRow,
|
|
@@ -6945,13 +6991,13 @@ const Methods = {
|
|
|
6945
6991
|
} = evnt;
|
|
6946
6992
|
const offsetX = clientX - thEl.getBoundingClientRect().x;
|
|
6947
6993
|
const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
|
|
6994
|
+
internalData.prevDragToChild = !!(isCrossDrag && isToChildDrag && hasCtrlKey);
|
|
6995
|
+
internalData.prevDragCol = column;
|
|
6996
|
+
internalData.prevDragPos = dragPos;
|
|
6948
6997
|
if (column.fixed || dragCol && dragCol.id === column.id || !isCrossDrag && (isPeerDrag ? dragCol.parentId !== column.parentId : column.parentId)) {
|
|
6949
6998
|
showDropTip($xeTable, evnt, null, thEl, false, dragPos);
|
|
6950
6999
|
return;
|
|
6951
7000
|
}
|
|
6952
|
-
internalData.prevDragToChild = !!(isCrossDrag && isToChildDrag && hasCtrlKey);
|
|
6953
|
-
internalData.prevDragCol = column;
|
|
6954
|
-
internalData.prevDragPos = dragPos;
|
|
6955
7001
|
showDropTip($xeTable, evnt, null, thEl, true, dragPos);
|
|
6956
7002
|
$xeTable.dispatchEvent('column-dragover', {
|
|
6957
7003
|
oldColumn: dragCol,
|