vxe-table 3.11.39 → 3.12.0-beta.0
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/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/render/index.js +3 -1
- package/es/table/src/body.js +56 -13
- package/es/table/src/footer.js +28 -3
- package/es/table/src/header.js +36 -6
- package/es/table/src/methods.js +136 -104
- package/es/table/src/table.js +5 -13
- package/es/table/style.css +3 -5
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +5 -3
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +3 -5
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +288 -162
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/render/index.js +3 -1
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/body.js +58 -13
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/footer.js +31 -3
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +39 -6
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +146 -120
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +5 -15
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +3 -5
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +5 -3
- 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 +3 -5
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/table/render/index.ts +3 -1
- package/packages/table/src/body.ts +56 -13
- package/packages/table/src/footer.ts +28 -3
- package/packages/table/src/header.ts +40 -7
- package/packages/table/src/methods.ts +140 -109
- package/packages/table/src/table.ts +6 -15
- package/packages/ui/index.ts +4 -2
- package/styles/components/table.scss +1 -3
- /package/es/{iconfont.1735027791418.ttf → iconfont.1735106128767.ttf} +0 -0
- /package/es/{iconfont.1735027791418.woff → iconfont.1735106128767.woff} +0 -0
- /package/es/{iconfont.1735027791418.woff2 → iconfont.1735106128767.woff2} +0 -0
- /package/lib/{iconfont.1735027791418.ttf → iconfont.1735106128767.ttf} +0 -0
- /package/lib/{iconfont.1735027791418.woff → iconfont.1735106128767.woff} +0 -0
- /package/lib/{iconfont.1735027791418.woff2 → iconfont.1735106128767.woff2} +0 -0
package/es/table/src/footer.js
CHANGED
|
@@ -219,13 +219,13 @@ export default {
|
|
|
219
219
|
const { tId } = $xeTable;
|
|
220
220
|
const { fixedType, fixedColumn, tableColumn } = props;
|
|
221
221
|
const { spanMethod, footerSpanMethod, showFooterOverflow: allColumnFooterOverflow } = tableProps;
|
|
222
|
-
const { visibleColumn } = tableInternalData;
|
|
223
|
-
const { scrollbarWidth } = tableReactData;
|
|
222
|
+
const { visibleColumn, fullColumnIdData } = tableInternalData;
|
|
223
|
+
const { scrollXLoad, scrollYLoad, scrollbarWidth, dragCol } = tableReactData;
|
|
224
224
|
let renderColumnList = tableColumn;
|
|
225
225
|
// 如果是使用优化模式
|
|
226
226
|
if (fixedType) {
|
|
227
227
|
// 如果是使用优化模式
|
|
228
|
-
if (allColumnFooterOverflow) {
|
|
228
|
+
if (scrollXLoad || scrollYLoad || allColumnFooterOverflow) {
|
|
229
229
|
// 如果不支持优化模式
|
|
230
230
|
if (spanMethod || footerSpanMethod) {
|
|
231
231
|
renderColumnList = visibleColumn;
|
|
@@ -238,6 +238,31 @@ export default {
|
|
|
238
238
|
renderColumnList = visibleColumn;
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
+
if (!fixedType) {
|
|
242
|
+
// 列拖拽
|
|
243
|
+
if (scrollXLoad && dragCol) {
|
|
244
|
+
if (renderColumnList.length > 2) {
|
|
245
|
+
const dCowRest = fullColumnIdData[dragCol.id];
|
|
246
|
+
if (dCowRest) {
|
|
247
|
+
const dcIndex = dCowRest._index;
|
|
248
|
+
const firstCol = renderColumnList[0];
|
|
249
|
+
const lastCol = renderColumnList[renderColumnList.length - 1];
|
|
250
|
+
const firstColRest = fullColumnIdData[firstCol.id];
|
|
251
|
+
const lastColRest = fullColumnIdData[lastCol.id];
|
|
252
|
+
if (firstColRest && lastColRest) {
|
|
253
|
+
const fcIndex = firstColRest._index;
|
|
254
|
+
const lcIndex = lastColRest._index;
|
|
255
|
+
if (dcIndex < fcIndex) {
|
|
256
|
+
renderColumnList = [dragCol].concat(renderColumnList);
|
|
257
|
+
}
|
|
258
|
+
else if (dcIndex > lcIndex) {
|
|
259
|
+
renderColumnList = renderColumnList.concat([dragCol]);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
241
266
|
const ons = {};
|
|
242
267
|
if (!fixedType) {
|
|
243
268
|
ons.scroll = this.scrollEvent;
|
package/es/table/src/header.js
CHANGED
|
@@ -75,6 +75,7 @@ const renderRows = (h, _vm, cols, $rowIndex) => {
|
|
|
75
75
|
'is--sortable': column.sortable,
|
|
76
76
|
'col--filter': !!column.filters,
|
|
77
77
|
'is--filter-active': hasFilter,
|
|
78
|
+
'is--drag-active': !column.fixed && !isDisabledDrag,
|
|
78
79
|
'is--drag-disabled': isDisabledDrag,
|
|
79
80
|
'col--current': currentColumn === column
|
|
80
81
|
}, getClass(headerClassName, params), getClass(headerCellClassName, params)],
|
|
@@ -202,9 +203,9 @@ export default {
|
|
|
202
203
|
const { fixedType, fixedColumn, tableColumn } = props;
|
|
203
204
|
const { headerColumn } = this;
|
|
204
205
|
const { showHeaderOverflow: allColumnHeaderOverflow, spanMethod, footerSpanMethod } = tableProps;
|
|
205
|
-
const { isGroup, scrollbarWidth } = tableReactData;
|
|
206
|
-
const { visibleColumn } = tableInternalData;
|
|
207
|
-
let
|
|
206
|
+
const { isGroup, scrollXLoad, scrollYLoad, scrollbarWidth, dragCol } = tableReactData;
|
|
207
|
+
const { visibleColumn, fullColumnIdData } = tableInternalData;
|
|
208
|
+
let renderHeaderList = headerColumn;
|
|
208
209
|
let renderColumnList = tableColumn;
|
|
209
210
|
if (isGroup) {
|
|
210
211
|
renderColumnList = visibleColumn;
|
|
@@ -212,7 +213,7 @@ export default {
|
|
|
212
213
|
else {
|
|
213
214
|
if (fixedType) {
|
|
214
215
|
// 如果是使用优化模式
|
|
215
|
-
if (allColumnHeaderOverflow) {
|
|
216
|
+
if (scrollXLoad || scrollYLoad || allColumnHeaderOverflow) {
|
|
216
217
|
// 如果不支持优化模式
|
|
217
218
|
if (spanMethod || footerSpanMethod) {
|
|
218
219
|
renderColumnList = visibleColumn;
|
|
@@ -225,7 +226,36 @@ export default {
|
|
|
225
226
|
renderColumnList = visibleColumn;
|
|
226
227
|
}
|
|
227
228
|
}
|
|
228
|
-
|
|
229
|
+
renderHeaderList = [renderColumnList];
|
|
230
|
+
}
|
|
231
|
+
if (!fixedType) {
|
|
232
|
+
// 列拖拽
|
|
233
|
+
if (scrollXLoad && dragCol) {
|
|
234
|
+
if (renderColumnList.length > 2) {
|
|
235
|
+
const dCowRest = fullColumnIdData[dragCol.id];
|
|
236
|
+
if (dCowRest) {
|
|
237
|
+
const dcIndex = dCowRest._index;
|
|
238
|
+
const firstCol = renderColumnList[0];
|
|
239
|
+
const lastCol = renderColumnList[renderColumnList.length - 1];
|
|
240
|
+
const firstColRest = fullColumnIdData[firstCol.id];
|
|
241
|
+
const lastColRest = fullColumnIdData[lastCol.id];
|
|
242
|
+
if (firstColRest && lastColRest) {
|
|
243
|
+
const fcIndex = firstColRest._index;
|
|
244
|
+
const lcIndex = lastColRest._index;
|
|
245
|
+
console.log(dragCol.id, dcIndex, fcIndex, lcIndex, renderColumnList.length);
|
|
246
|
+
if (dcIndex < fcIndex) {
|
|
247
|
+
renderColumnList = [dragCol].concat(renderColumnList);
|
|
248
|
+
renderHeaderList = [[dragCol].concat(renderHeaderList[0])].concat(renderHeaderList.slice(1));
|
|
249
|
+
}
|
|
250
|
+
else if (dcIndex > lcIndex) {
|
|
251
|
+
renderColumnList = renderColumnList.concat([dragCol]);
|
|
252
|
+
renderHeaderList = [renderHeaderList[0].concat([dragCol])].concat(renderHeaderList.slice(1));
|
|
253
|
+
}
|
|
254
|
+
console.log(renderColumnList.length);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
229
259
|
}
|
|
230
260
|
return h('div', {
|
|
231
261
|
class: ['vxe-table--header-wrapper', fixedType ? `fixed-${fixedType}--wrapper` : 'body--wrapper'],
|
|
@@ -275,7 +305,7 @@ export default {
|
|
|
275
305
|
*/
|
|
276
306
|
h('thead', {
|
|
277
307
|
ref: 'thead'
|
|
278
|
-
}, renderHeads(h, this,
|
|
308
|
+
}, renderHeads(h, this, renderHeaderList))
|
|
279
309
|
]),
|
|
280
310
|
/**
|
|
281
311
|
* 其他
|
package/es/table/src/methods.js
CHANGED
|
@@ -7,8 +7,6 @@ import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible,
|
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
8
8
|
import { warnLog, errLog } from '../../ui/src/log';
|
|
9
9
|
const { getConfig, getI18n, renderer, formats, interceptor, createEvent } = VxeUI;
|
|
10
|
-
// const isWebkit = browse['-webkit'] && !browse.edge
|
|
11
|
-
// const debounceScrollYDuration = browse.msie ? 80 : 20
|
|
12
10
|
const customStorageKey = 'VXE_CUSTOM_STORE';
|
|
13
11
|
// 获取所有的列,排除分组
|
|
14
12
|
const getColumnList = (columns) => {
|
|
@@ -280,7 +278,7 @@ const calcCellHeight = ($xeTable) => {
|
|
|
280
278
|
const { showOverflow } = props;
|
|
281
279
|
const { tableData, scrollXLoad, scrollYLoad } = reactData;
|
|
282
280
|
const { fullAllDataRowIdData } = internalData;
|
|
283
|
-
const el = $xeTable.$
|
|
281
|
+
const el = $xeTable.$refs.refElem;
|
|
284
282
|
if (!showOverflow && (scrollXLoad || scrollYLoad) && el) {
|
|
285
283
|
let paddingTop = 0;
|
|
286
284
|
let paddingBottom = 0;
|
|
@@ -288,28 +286,27 @@ const calcCellHeight = ($xeTable) => {
|
|
|
288
286
|
tableData.forEach((row) => {
|
|
289
287
|
const rowid = getRowid($xeTable, row);
|
|
290
288
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
291
|
-
const
|
|
292
|
-
if (rowRest &&
|
|
289
|
+
const cellList = el.querySelectorAll(`.vxe-body--row[rowid="${rowid}"]>.vxe-body--column>.vxe-cell`);
|
|
290
|
+
if (rowRest && cellList.length) {
|
|
293
291
|
let height = 0;
|
|
294
|
-
for (let i = 0; i <
|
|
295
|
-
const
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
const cellElem = tdEl.querySelector('.vxe-cell');
|
|
300
|
-
if (!calcPadding) {
|
|
301
|
-
paddingTop = XEUtils.toNumber(getComputedStyle(tdEl).paddingTop);
|
|
302
|
-
paddingBottom = XEUtils.toNumber(getComputedStyle(tdEl).paddingBottom);
|
|
303
|
-
calcPadding = true;
|
|
304
|
-
}
|
|
305
|
-
let cellHeight = paddingTop + paddingBottom;
|
|
306
|
-
if (cellElem) {
|
|
307
|
-
cellHeight += cellElem.offsetHeight;
|
|
308
|
-
}
|
|
309
|
-
height = Math.max(height, cellHeight);
|
|
292
|
+
for (let i = 0; i < cellList.length; i++) {
|
|
293
|
+
const cellElem = cellList[i];
|
|
294
|
+
const tdEl = cellElem.parentElement;
|
|
295
|
+
if (!tdEl || !tdEl.clientWidth) {
|
|
296
|
+
break;
|
|
310
297
|
}
|
|
298
|
+
if (!calcPadding) {
|
|
299
|
+
paddingTop = XEUtils.toNumber(getComputedStyle(tdEl).paddingTop);
|
|
300
|
+
paddingBottom = XEUtils.toNumber(getComputedStyle(tdEl).paddingBottom);
|
|
301
|
+
calcPadding = true;
|
|
302
|
+
}
|
|
303
|
+
let cellHeight = paddingTop + paddingBottom;
|
|
304
|
+
if (cellElem) {
|
|
305
|
+
cellHeight += cellElem.clientHeight;
|
|
306
|
+
}
|
|
307
|
+
height = Math.max(height, cellHeight);
|
|
311
308
|
}
|
|
312
|
-
rowRest.height = height;
|
|
309
|
+
rowRest.height = scrollXLoad ? Math.max(rowRest.height, height) : height;
|
|
313
310
|
}
|
|
314
311
|
});
|
|
315
312
|
}
|
|
@@ -424,15 +421,22 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
|
|
|
424
421
|
const { scrollbarWidth, scrollbarHeight } = reactData;
|
|
425
422
|
const { prevDragToChild } = internalData;
|
|
426
423
|
const wrapperRect = el.getBoundingClientRect();
|
|
424
|
+
const tableWidth = el.clientWidth;
|
|
425
|
+
const tableHeight = el.clientHeight;
|
|
427
426
|
if (trEl) {
|
|
428
427
|
const rdLineEl = $xeTable.$refs.refDragRowLineElem;
|
|
429
428
|
if (rdLineEl) {
|
|
430
429
|
if (showLine) {
|
|
431
430
|
const trRect = trEl.getBoundingClientRect();
|
|
431
|
+
let trHeight = trEl.clientHeight;
|
|
432
|
+
const offsetTop = Math.max(1, trRect.y - wrapperRect.y);
|
|
433
|
+
if (offsetTop + trHeight > tableHeight - scrollbarHeight) {
|
|
434
|
+
trHeight = tableHeight - offsetTop - scrollbarHeight;
|
|
435
|
+
}
|
|
432
436
|
rdLineEl.style.display = 'block';
|
|
433
|
-
rdLineEl.style.top = `${
|
|
434
|
-
rdLineEl.style.height = `${
|
|
435
|
-
rdLineEl.style.width = `${
|
|
437
|
+
rdLineEl.style.top = `${offsetTop}px`;
|
|
438
|
+
rdLineEl.style.height = `${trHeight}px`;
|
|
439
|
+
rdLineEl.style.width = `${tableWidth - scrollbarWidth}px`;
|
|
436
440
|
rdLineEl.setAttribute('drag-pos', dragPos);
|
|
437
441
|
rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
|
|
438
442
|
}
|
|
@@ -445,17 +449,32 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
|
|
|
445
449
|
const cdLineEl = $xeTable.$refs.refDragColLineElem;
|
|
446
450
|
if (cdLineEl) {
|
|
447
451
|
if (showLine) {
|
|
452
|
+
const leftContainerElem = $xeTable.$refs.leftContainer;
|
|
453
|
+
const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
|
|
454
|
+
const rightContainerElem = $xeTable.$refs.rightContainer;
|
|
455
|
+
const rightContainerWidth = rightContainerElem ? rightContainerElem.clientWidth : 0;
|
|
448
456
|
const thRect = thEl.getBoundingClientRect();
|
|
457
|
+
let thWidth = thEl.clientWidth;
|
|
449
458
|
const offsetTop = Math.max(0, thRect.y - wrapperRect.y);
|
|
459
|
+
const startX = leftContainerWidth;
|
|
460
|
+
let offsetLeft = thRect.x - wrapperRect.x;
|
|
461
|
+
if (offsetLeft < startX) {
|
|
462
|
+
thWidth -= startX - offsetLeft;
|
|
463
|
+
offsetLeft = startX;
|
|
464
|
+
}
|
|
465
|
+
const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 : scrollbarWidth);
|
|
466
|
+
if (offsetLeft + thWidth > endX) {
|
|
467
|
+
thWidth = endX - offsetLeft;
|
|
468
|
+
}
|
|
450
469
|
cdLineEl.style.display = 'block';
|
|
451
470
|
cdLineEl.style.top = `${offsetTop}px`;
|
|
452
|
-
cdLineEl.style.left = `${
|
|
453
|
-
cdLineEl.style.width = `${
|
|
471
|
+
cdLineEl.style.left = `${offsetLeft}px`;
|
|
472
|
+
cdLineEl.style.width = `${thWidth}px`;
|
|
454
473
|
if (prevDragToChild) {
|
|
455
474
|
cdLineEl.style.height = `${thRect.height}px`;
|
|
456
475
|
}
|
|
457
476
|
else {
|
|
458
|
-
cdLineEl.style.height = `${
|
|
477
|
+
cdLineEl.style.height = `${tableHeight - offsetTop - scrollbarHeight}px`;
|
|
459
478
|
}
|
|
460
479
|
cdLineEl.setAttribute('drag-pos', dragPos);
|
|
461
480
|
cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
|
|
@@ -895,7 +914,7 @@ const Methods = {
|
|
|
895
914
|
return Promise.resolve(this.restoreCustomStorage()).then(() => {
|
|
896
915
|
this._isLoading = false;
|
|
897
916
|
this.cacheColumnMap();
|
|
898
|
-
this.parseColumns().then(() => {
|
|
917
|
+
this.parseColumns(true).then(() => {
|
|
899
918
|
if (this.scrollXLoad) {
|
|
900
919
|
this.loadScrollXData(true);
|
|
901
920
|
}
|
|
@@ -2444,15 +2463,11 @@ const Methods = {
|
|
|
2444
2463
|
/**
|
|
2445
2464
|
* 刷新列配置
|
|
2446
2465
|
*/
|
|
2447
|
-
refreshColumn(
|
|
2448
|
-
if (
|
|
2449
|
-
|
|
2450
|
-
this.collectColumn = columnList;
|
|
2451
|
-
const tableFullColumn = getColumnList(columnList);
|
|
2452
|
-
this.tableFullColumn = tableFullColumn;
|
|
2453
|
-
this.cacheColumnMap();
|
|
2466
|
+
refreshColumn(initSort) {
|
|
2467
|
+
if (initSort) {
|
|
2468
|
+
this.handleUpdateColumn();
|
|
2454
2469
|
}
|
|
2455
|
-
return this.parseColumns().then(() => {
|
|
2470
|
+
return this.parseColumns(true).then(() => {
|
|
2456
2471
|
return this.refreshScroll();
|
|
2457
2472
|
}).then(() => {
|
|
2458
2473
|
return this.recalculate();
|
|
@@ -2462,7 +2477,7 @@ const Methods = {
|
|
|
2462
2477
|
* 刷新列信息
|
|
2463
2478
|
* 将固定的列左边、右边分别靠边
|
|
2464
2479
|
*/
|
|
2465
|
-
parseColumns() {
|
|
2480
|
+
parseColumns(isReset) {
|
|
2466
2481
|
const $xeTable = this;
|
|
2467
2482
|
const props = $xeTable;
|
|
2468
2483
|
const internalData = $xeTable;
|
|
@@ -2560,10 +2575,12 @@ const Methods = {
|
|
|
2560
2575
|
warnLog('vxe.error.scrollErrProp', ['footer-span-method']);
|
|
2561
2576
|
}
|
|
2562
2577
|
}
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2578
|
+
if (isReset) {
|
|
2579
|
+
const { visibleSize } = handleVirtualXVisible(this);
|
|
2580
|
+
scrollXStore.startIndex = 0;
|
|
2581
|
+
scrollXStore.endIndex = visibleSize;
|
|
2582
|
+
scrollXStore.visibleSize = visibleSize;
|
|
2583
|
+
}
|
|
2567
2584
|
}
|
|
2568
2585
|
// 如果列被显示/隐藏,则清除合并状态
|
|
2569
2586
|
// 如果列被设置为固定,则清除合并状态
|
|
@@ -2581,12 +2598,15 @@ const Methods = {
|
|
|
2581
2598
|
});
|
|
2582
2599
|
this.visibleColumn = visibleColumn;
|
|
2583
2600
|
this.handleTableColumn();
|
|
2584
|
-
|
|
2585
|
-
return this.
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2601
|
+
if (isReset) {
|
|
2602
|
+
return this.updateFooter().then(() => {
|
|
2603
|
+
return this.recalculate();
|
|
2604
|
+
}).then(() => {
|
|
2605
|
+
this.updateCellAreas();
|
|
2606
|
+
return this.recalculate();
|
|
2607
|
+
});
|
|
2608
|
+
}
|
|
2609
|
+
return this.updateFooter();
|
|
2590
2610
|
},
|
|
2591
2611
|
/**
|
|
2592
2612
|
* 指定列宽的列进行拆分
|
|
@@ -2881,48 +2901,6 @@ const Methods = {
|
|
|
2881
2901
|
this.checkScrolling();
|
|
2882
2902
|
}
|
|
2883
2903
|
},
|
|
2884
|
-
calcCellHeight() {
|
|
2885
|
-
const $xeTable = this;
|
|
2886
|
-
const props = $xeTable;
|
|
2887
|
-
const reactData = $xeTable;
|
|
2888
|
-
const internalData = $xeTable;
|
|
2889
|
-
const { showOverflow } = props;
|
|
2890
|
-
const { tableData, scrollXLoad, scrollYLoad } = reactData;
|
|
2891
|
-
const { fullAllDataRowIdData } = internalData;
|
|
2892
|
-
const el = $xeTable.$el;
|
|
2893
|
-
if (!showOverflow && (scrollXLoad || scrollYLoad) && el) {
|
|
2894
|
-
let paddingTop = 0;
|
|
2895
|
-
let paddingBottom = 0;
|
|
2896
|
-
let calcPadding = false;
|
|
2897
|
-
tableData.forEach((row) => {
|
|
2898
|
-
const rowid = getRowid($xeTable, row);
|
|
2899
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
2900
|
-
const trList = el.querySelectorAll(`.vxe-body--row[rowid="${rowid}"]`);
|
|
2901
|
-
if (rowRest && trList.length) {
|
|
2902
|
-
let height = 0;
|
|
2903
|
-
for (let i = 0; i < trList.length; i++) {
|
|
2904
|
-
const trEl = trList[i];
|
|
2905
|
-
const tdList = trEl.children;
|
|
2906
|
-
for (let j = 0; j < tdList.length; j++) {
|
|
2907
|
-
const tdEl = tdList[j];
|
|
2908
|
-
const cellElem = tdEl.querySelector('.vxe-cell');
|
|
2909
|
-
if (!calcPadding) {
|
|
2910
|
-
paddingTop = XEUtils.toNumber(getComputedStyle(tdEl).paddingTop);
|
|
2911
|
-
paddingBottom = XEUtils.toNumber(getComputedStyle(tdEl).paddingBottom);
|
|
2912
|
-
calcPadding = true;
|
|
2913
|
-
}
|
|
2914
|
-
let cellHeight = paddingTop + paddingBottom;
|
|
2915
|
-
if (cellElem) {
|
|
2916
|
-
cellHeight += cellElem.offsetHeight;
|
|
2917
|
-
}
|
|
2918
|
-
height = Math.max(height, cellHeight);
|
|
2919
|
-
}
|
|
2920
|
-
}
|
|
2921
|
-
rowRest.height = scrollXLoad ? Math.max(rowRest.height, height) : height;
|
|
2922
|
-
}
|
|
2923
|
-
});
|
|
2924
|
-
}
|
|
2925
|
-
},
|
|
2926
2904
|
updateHeight() {
|
|
2927
2905
|
this.customHeight = calcTableHeight(this, 'height');
|
|
2928
2906
|
this.customMinHeight = calcTableHeight(this, 'minHeight');
|
|
@@ -2986,7 +2964,7 @@ const Methods = {
|
|
|
2986
2964
|
else {
|
|
2987
2965
|
if (fixedType) {
|
|
2988
2966
|
// 如果是使用优化模式
|
|
2989
|
-
if (allColumnHeaderOverflow) {
|
|
2967
|
+
if (scrollXLoad || scrollYLoad || allColumnHeaderOverflow) {
|
|
2990
2968
|
// 如果不支持优化模式
|
|
2991
2969
|
if (spanMethod || footerSpanMethod) {
|
|
2992
2970
|
renderColumnList = visibleColumn;
|
|
@@ -3113,7 +3091,7 @@ const Methods = {
|
|
|
3113
3091
|
let renderColumnList = tableColumn;
|
|
3114
3092
|
if (fixedType) {
|
|
3115
3093
|
// 如果是使用优化模式
|
|
3116
|
-
if (allColumnFooterOverflow) {
|
|
3094
|
+
if (scrollXLoad || scrollYLoad || allColumnFooterOverflow) {
|
|
3117
3095
|
// 如果不支持优化模式
|
|
3118
3096
|
if (spanMethod || footerSpanMethod) {
|
|
3119
3097
|
renderColumnList = visibleColumn;
|
|
@@ -5164,7 +5142,8 @@ const Methods = {
|
|
|
5164
5142
|
const triggerFilter = getEventTargetNode(evnt, cell, 'vxe-cell--filter').flag;
|
|
5165
5143
|
let triggerDrag = false;
|
|
5166
5144
|
if (!(triggerInput || triggerCheckbox || triggerSort || triggerFilter)) {
|
|
5167
|
-
|
|
5145
|
+
const { column } = params;
|
|
5146
|
+
if (columnOpts.drag && !column.fixed && trigger === 'cell' && !(disabledMethod && disabledMethod(params))) {
|
|
5168
5147
|
triggerDrag = true;
|
|
5169
5148
|
$xeTable.handleHeaderCellDragMousedownEvent(evnt, params);
|
|
5170
5149
|
}
|
|
@@ -5486,7 +5465,7 @@ const Methods = {
|
|
|
5486
5465
|
evnt.dataTransfer.setDragImage(img, 0, 0);
|
|
5487
5466
|
}
|
|
5488
5467
|
},
|
|
5489
|
-
|
|
5468
|
+
handleColDragSwapEvent(evnt, isSyncColumn, dragCol, prevDragCol, prevDragPos, prevDragToChild) {
|
|
5490
5469
|
const $xeTable = this;
|
|
5491
5470
|
const props = $xeTable;
|
|
5492
5471
|
const reactData = $xeTable;
|
|
@@ -5494,15 +5473,14 @@ const Methods = {
|
|
|
5494
5473
|
const { mouseConfig } = props;
|
|
5495
5474
|
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
5496
5475
|
const { isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts;
|
|
5497
|
-
const {
|
|
5498
|
-
const { collectColumn, prevDragCol, prevDragPos, prevDragToChild } = internalData;
|
|
5476
|
+
const { collectColumn } = internalData;
|
|
5499
5477
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
|
|
5500
5478
|
if (prevDragCol && dragCol) {
|
|
5501
5479
|
// 判断是否有拖动
|
|
5502
5480
|
if (prevDragCol !== dragCol) {
|
|
5503
5481
|
const oldColumn = dragCol;
|
|
5504
5482
|
const newColumn = prevDragCol;
|
|
5505
|
-
Promise.resolve(dragEndMethod
|
|
5483
|
+
return Promise.resolve(dragEndMethod
|
|
5506
5484
|
? dragEndMethod({
|
|
5507
5485
|
oldColumn,
|
|
5508
5486
|
newColumn,
|
|
@@ -5619,9 +5597,6 @@ const Methods = {
|
|
|
5619
5597
|
$xeTable.clearCopyCellArea();
|
|
5620
5598
|
}
|
|
5621
5599
|
}
|
|
5622
|
-
$xeTable.refreshColumn(true).then(() => {
|
|
5623
|
-
$xeTable.updateCellAreas();
|
|
5624
|
-
});
|
|
5625
5600
|
$xeTable.dispatchEvent('column-dragend', {
|
|
5626
5601
|
oldColumn,
|
|
5627
5602
|
newColumn,
|
|
@@ -5632,11 +5607,26 @@ const Methods = {
|
|
|
5632
5607
|
oldIndex: oafIndex
|
|
5633
5608
|
}
|
|
5634
5609
|
}, evnt);
|
|
5635
|
-
|
|
5610
|
+
if (isSyncColumn) {
|
|
5611
|
+
$xeTable.handleUpdateColumn();
|
|
5612
|
+
$xeTable.parseColumns(false).then(() => {
|
|
5613
|
+
$xeTable.updateCellAreas();
|
|
5614
|
+
return $xeTable.saveCustomStore('update:sort');
|
|
5615
|
+
});
|
|
5616
|
+
}
|
|
5636
5617
|
}).catch(() => {
|
|
5637
5618
|
});
|
|
5638
5619
|
}
|
|
5639
5620
|
}
|
|
5621
|
+
return Promise.resolve();
|
|
5622
|
+
},
|
|
5623
|
+
handleHeaderCellDragDragendEvent(evnt) {
|
|
5624
|
+
const $xeTable = this;
|
|
5625
|
+
const reactData = $xeTable;
|
|
5626
|
+
const internalData = $xeTable;
|
|
5627
|
+
const { dragCol } = reactData;
|
|
5628
|
+
const { prevDragCol, prevDragPos, prevDragToChild } = internalData;
|
|
5629
|
+
$xeTable.handleColDragSwapEvent(evnt, true, dragCol, prevDragCol, prevDragPos, prevDragToChild);
|
|
5640
5630
|
hideDropTip($xeTable);
|
|
5641
5631
|
clearColDropOrigin($xeTable);
|
|
5642
5632
|
internalData.prevDragToChild = false;
|
|
@@ -5644,6 +5634,9 @@ const Methods = {
|
|
|
5644
5634
|
reactData.dragCol = null;
|
|
5645
5635
|
setTimeout(() => {
|
|
5646
5636
|
reactData.isDragColMove = false;
|
|
5637
|
+
$xeTable.recalculate().then(() => {
|
|
5638
|
+
$xeTable.loadScrollXData();
|
|
5639
|
+
});
|
|
5647
5640
|
}, 500);
|
|
5648
5641
|
},
|
|
5649
5642
|
handleHeaderCellDragDragoverEvent(evnt) {
|
|
@@ -5663,10 +5656,10 @@ const Methods = {
|
|
|
5663
5656
|
const column = $xeTable.getColumnById(colid);
|
|
5664
5657
|
if (column) {
|
|
5665
5658
|
evnt.preventDefault();
|
|
5666
|
-
const {
|
|
5667
|
-
const offsetX =
|
|
5659
|
+
const { clientX } = evnt;
|
|
5660
|
+
const offsetX = clientX - thEl.getBoundingClientRect().x;
|
|
5668
5661
|
const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
|
|
5669
|
-
if ((dragCol && dragCol.id === column.id) || (!isCrossDrag && column.parentId)) {
|
|
5662
|
+
if (column.fixed || (dragCol && dragCol.id === column.id) || (!isCrossDrag && column.parentId)) {
|
|
5670
5663
|
showDropTip($xeTable, evnt, null, thEl, false, dragPos);
|
|
5671
5664
|
return;
|
|
5672
5665
|
}
|
|
@@ -5679,6 +5672,36 @@ const Methods = {
|
|
|
5679
5672
|
targetColumn: column,
|
|
5680
5673
|
dragPos
|
|
5681
5674
|
}, evnt);
|
|
5675
|
+
// 边缘滚动
|
|
5676
|
+
const el = $xeTable.$refs.refElem;
|
|
5677
|
+
if (!el) {
|
|
5678
|
+
return;
|
|
5679
|
+
}
|
|
5680
|
+
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
5681
|
+
const tableBody = $xeTable.$refs.tableBody;
|
|
5682
|
+
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
5683
|
+
const scrollTargetEl = xHandleEl || tableBodyElem;
|
|
5684
|
+
if (scrollTargetEl) {
|
|
5685
|
+
const wrapperRect = el.getBoundingClientRect();
|
|
5686
|
+
const tableWidth = el.clientWidth;
|
|
5687
|
+
const leftContainerElem = $xeTable.$refs.leftContainer;
|
|
5688
|
+
const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
|
|
5689
|
+
const rightContainerElem = $xeTable.$refs.rightContainer;
|
|
5690
|
+
const rightContainerWidth = rightContainerElem ? rightContainerElem.clientWidth : 0;
|
|
5691
|
+
const srartX = wrapperRect.x + leftContainerWidth;
|
|
5692
|
+
const endX = wrapperRect.x + tableWidth - rightContainerWidth;
|
|
5693
|
+
const distSize = 28;
|
|
5694
|
+
const startDistSize = clientX - srartX;
|
|
5695
|
+
const endDistSize = endX - clientX;
|
|
5696
|
+
if (startDistSize > 0 && startDistSize <= distSize) {
|
|
5697
|
+
const scrollRatio = Math.floor(tableWidth / (startDistSize > distSize / 2 ? 240 : 120));
|
|
5698
|
+
scrollTargetEl.scrollLeft -= scrollRatio * (distSize - startDistSize);
|
|
5699
|
+
}
|
|
5700
|
+
else if (endDistSize > 0 && endDistSize <= distSize) {
|
|
5701
|
+
const scrollRatio = Math.floor(tableWidth / (endDistSize > distSize / 2 ? 240 : 120));
|
|
5702
|
+
scrollTargetEl.scrollLeft += scrollRatio * (distSize - endDistSize);
|
|
5703
|
+
}
|
|
5704
|
+
}
|
|
5682
5705
|
}
|
|
5683
5706
|
},
|
|
5684
5707
|
handleHeaderCellDragMousedownEvent(evnt, params) {
|
|
@@ -6925,6 +6948,15 @@ const Methods = {
|
|
|
6925
6948
|
});
|
|
6926
6949
|
this.tableColumn = tableColumn;
|
|
6927
6950
|
},
|
|
6951
|
+
handleUpdateColumn() {
|
|
6952
|
+
const $xeTable = this;
|
|
6953
|
+
const internalData = $xeTable;
|
|
6954
|
+
const columnList = XEUtils.orderBy(internalData.collectColumn, 'renderSortNumber');
|
|
6955
|
+
internalData.collectColumn = columnList;
|
|
6956
|
+
const tableFullColumn = getColumnList(columnList);
|
|
6957
|
+
internalData.tableFullColumn = tableFullColumn;
|
|
6958
|
+
$xeTable.cacheColumnMap();
|
|
6959
|
+
},
|
|
6928
6960
|
updateScrollXData() {
|
|
6929
6961
|
const $xeTable = this;
|
|
6930
6962
|
const props = $xeTable;
|
package/es/table/src/table.js
CHANGED
|
@@ -750,17 +750,6 @@ export default {
|
|
|
750
750
|
y: overflowY && scrollYLoad
|
|
751
751
|
};
|
|
752
752
|
},
|
|
753
|
-
computeTableStyle() {
|
|
754
|
-
const $xeTable = this;
|
|
755
|
-
const reactData = $xeTable;
|
|
756
|
-
const { tableData } = reactData;
|
|
757
|
-
const columnOpts = $xeTable.computeColumnOpts;
|
|
758
|
-
const stys = {};
|
|
759
|
-
if (columnOpts.drag) {
|
|
760
|
-
stys['--vxe-ui-table-drag-column-move-delay'] = `${Math.max(0.06, Math.min(0.3, tableData.length / 800))}s`;
|
|
761
|
-
}
|
|
762
|
-
return stys;
|
|
763
|
-
},
|
|
764
753
|
tabsResizeFlag() {
|
|
765
754
|
const $xeTable = this;
|
|
766
755
|
const $xeTabs = $xeTable.$xeTabs;
|
|
@@ -813,6 +802,11 @@ export default {
|
|
|
813
802
|
maxHeight() {
|
|
814
803
|
this.$nextTick(() => this.recalculate(true));
|
|
815
804
|
},
|
|
805
|
+
computeSize() {
|
|
806
|
+
this.$nextTick(() => {
|
|
807
|
+
this.recalculate(true).then(() => this.refreshScroll());
|
|
808
|
+
});
|
|
809
|
+
},
|
|
816
810
|
syncResize(value) {
|
|
817
811
|
if (value) {
|
|
818
812
|
handleUupdateResize(this);
|
|
@@ -1170,7 +1164,6 @@ export default {
|
|
|
1170
1164
|
const tableBorder = $xeTable.computeTableBorder;
|
|
1171
1165
|
const virtualScrollBars = $xeTable.computeVirtualScrollBars;
|
|
1172
1166
|
const isArea = mouseConfig && mouseOpts.area;
|
|
1173
|
-
const tableStyle = $xeTable.computeTableStyle;
|
|
1174
1167
|
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
1175
1168
|
return h('div', {
|
|
1176
1169
|
ref: 'refElem',
|
|
@@ -1205,7 +1198,6 @@ export default {
|
|
|
1205
1198
|
'is--virtual-x': scrollXLoad,
|
|
1206
1199
|
'is--virtual-y': scrollYLoad
|
|
1207
1200
|
}],
|
|
1208
|
-
style: tableStyle,
|
|
1209
1201
|
attrs: {
|
|
1210
1202
|
spellcheck: false
|
|
1211
1203
|
},
|
package/es/table/style.css
CHANGED
|
@@ -2260,13 +2260,13 @@
|
|
|
2260
2260
|
-moz-user-select: none;
|
|
2261
2261
|
user-select: none;
|
|
2262
2262
|
}
|
|
2263
|
-
.vxe-table--render-default.col--drag-cell .vxe-header--column
|
|
2263
|
+
.vxe-table--render-default.col--drag-cell .vxe-header--column.is--drag-active {
|
|
2264
2264
|
cursor: grab;
|
|
2265
2265
|
}
|
|
2266
|
-
.vxe-table--render-default.col--drag-cell .vxe-header--column
|
|
2266
|
+
.vxe-table--render-default.col--drag-cell .vxe-header--column.is--drag-active:active {
|
|
2267
2267
|
cursor: grabbing;
|
|
2268
2268
|
}
|
|
2269
|
-
.vxe-table--render-default.col--drag-cell .vxe-header--column
|
|
2269
|
+
.vxe-table--render-default.col--drag-cell .vxe-header--column.is--drag-active:hover {
|
|
2270
2270
|
color: var(--vxe-ui-font-primary-color);
|
|
2271
2271
|
}
|
|
2272
2272
|
.vxe-table--render-default.col--drag-cell .vxe-header--column.is--drag-disabled {
|
|
@@ -2799,7 +2799,6 @@
|
|
|
2799
2799
|
.vxe-table--render-default .vxe-header--col-list-move {
|
|
2800
2800
|
transition-property: transform;
|
|
2801
2801
|
transition-duration: 0.35s;
|
|
2802
|
-
transition-delay: var(--vxe-ui-table-drag-column-move-delay, 0.3s);
|
|
2803
2802
|
}
|
|
2804
2803
|
.vxe-table--render-default .vxe-table--drag-col-line,
|
|
2805
2804
|
.vxe-table--render-default .vxe-table--drag-row-line {
|
|
@@ -2874,7 +2873,6 @@
|
|
|
2874
2873
|
.vxe-table--render-default .vxe-body--row-list-move {
|
|
2875
2874
|
transition-property: transform;
|
|
2876
2875
|
transition-duration: 0.35s;
|
|
2877
|
-
transition-delay: 0.05s;
|
|
2878
2876
|
}
|
|
2879
2877
|
.vxe-table--render-default .vxe-table--drag-sort-tip {
|
|
2880
2878
|
display: none;
|