vxe-table 3.12.10-beta.9 → 3.12.10
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/locale/lang/ar-EG.js +2 -1
- package/es/locale/lang/de-DE.js +2 -1
- package/es/locale/lang/en-US.js +4 -3
- package/es/locale/lang/es-ES.js +2 -1
- package/es/locale/lang/fr-FR.js +2 -1
- package/es/locale/lang/hu-HU.js +2 -1
- package/es/locale/lang/hy-AM.js +2 -1
- package/es/locale/lang/it-IT.js +2 -1
- package/es/locale/lang/ja-JP.js +2 -1
- package/es/locale/lang/ko-KR.js +2 -1
- package/es/locale/lang/nb-NO.js +2 -1
- package/es/locale/lang/pt-BR.js +2 -1
- package/es/locale/lang/ru-RU.js +4 -3
- package/es/locale/lang/th-TH.js +2 -1
- package/es/locale/lang/ug-CN.js +2 -1
- package/es/locale/lang/uk-UA.js +518 -517
- package/es/locale/lang/vi-VN.js +2 -1
- package/es/locale/lang/zh-CHT.js +2 -1
- package/es/locale/lang/zh-CN.js +2 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/edit/mixin.js +7 -7
- package/es/table/module/export/mixin.js +105 -69
- package/es/table/module/keyboard/mixin.js +68 -25
- package/es/table/module/menu/mixin.js +3 -1
- package/es/table/src/body.js +125 -86
- package/es/table/src/cell.js +43 -57
- package/es/table/src/column.js +43 -8
- package/es/table/src/columnInfo.js +3 -0
- package/es/table/src/footer.js +47 -6
- package/es/table/src/header.js +67 -165
- package/es/table/src/methods.js +962 -480
- package/es/table/src/props.js +14 -4
- package/es/table/src/table.js +114 -33
- package/es/table/src/util.js +73 -57
- package/es/table/style.css +246 -191
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +20 -6
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +246 -191
- 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 +1734 -1020
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +2 -1
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +2 -1
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +4 -3
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +4 -3
- package/lib/locale/lang/es-ES.js +2 -1
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +2 -1
- package/lib/locale/lang/fr-FR.js +2 -1
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +2 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +2 -1
- package/lib/locale/lang/hy-AM.js +2 -1
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/it-IT.js +2 -1
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +2 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +2 -1
- package/lib/locale/lang/ko-KR.js +2 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +2 -1
- package/lib/locale/lang/nb-NO.js +2 -1
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +2 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +2 -1
- package/lib/locale/lang/ru-RU.js +4 -3
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +4 -3
- package/lib/locale/lang/th-TH.js +2 -1
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/ug-CN.js +2 -1
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +518 -517
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +518 -517
- package/lib/locale/lang/vi-VN.js +2 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +2 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +2 -1
- package/lib/locale/lang/zh-CN.js +2 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +2 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/edit/mixin.js +7 -2
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/export/mixin.js +105 -64
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/module/keyboard/mixin.js +73 -27
- package/lib/table/module/keyboard/mixin.min.js +1 -1
- package/lib/table/module/menu/mixin.js +3 -1
- package/lib/table/src/body.js +124 -79
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +32 -42
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +12 -0
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +3 -0
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/footer.js +43 -4
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +49 -172
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +1072 -538
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +14 -4
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +113 -36
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +87 -70
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +246 -191
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +20 -6
- 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 +246 -191
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/locale/lang/ar-EG.ts +2 -1
- package/packages/locale/lang/de-DE.ts +2 -1
- package/packages/locale/lang/en-US.ts +4 -3
- package/packages/locale/lang/es-ES.ts +2 -1
- package/packages/locale/lang/fr-FR.ts +2 -1
- package/packages/locale/lang/hu-HU.ts +2 -1
- package/packages/locale/lang/hy-AM.ts +2 -1
- package/packages/locale/lang/it-IT.ts +2 -1
- package/packages/locale/lang/ja-JP.ts +2 -1
- package/packages/locale/lang/ko-KR.ts +2 -1
- package/packages/locale/lang/nb-NO.ts +2 -1
- package/packages/locale/lang/pt-BR.ts +2 -1
- package/packages/locale/lang/ru-RU.ts +4 -3
- package/packages/locale/lang/th-TH.ts +2 -1
- package/packages/locale/lang/ug-CN.ts +2 -1
- package/packages/locale/lang/uk-UA.ts +518 -517
- package/packages/locale/lang/vi-VN.ts +2 -1
- package/packages/locale/lang/zh-CHT.ts +2 -1
- package/packages/locale/lang/zh-CN.ts +2 -1
- package/packages/table/module/edit/mixin.ts +7 -7
- package/packages/table/module/export/mixin.ts +138 -80
- package/packages/table/module/keyboard/mixin.ts +65 -24
- package/packages/table/module/menu/mixin.ts +4 -1
- package/packages/table/src/body.ts +136 -89
- package/packages/table/src/cell.ts +45 -67
- package/packages/table/src/column.ts +48 -10
- package/packages/table/src/columnInfo.ts +3 -0
- package/packages/table/src/footer.ts +50 -7
- package/packages/table/src/header.ts +67 -166
- package/packages/table/src/methods.ts +1007 -492
- package/packages/table/src/props.ts +16 -6
- package/packages/table/src/table.ts +124 -33
- package/packages/table/src/util.ts +82 -62
- package/packages/ui/index.ts +19 -5
- package/styles/components/table.scss +313 -274
- package/styles/theme/base.scss +4 -6
- package/styles/theme/dark.scss +1 -0
- package/styles/theme/light.scss +1 -0
- package/styles/variable.scss +1 -0
- /package/es/{iconfont.1736854649055.ttf → iconfont.1738985837413.ttf} +0 -0
- /package/es/{iconfont.1736854649055.woff → iconfont.1738985837413.woff} +0 -0
- /package/es/{iconfont.1736854649055.woff2 → iconfont.1738985837413.woff2} +0 -0
- /package/lib/{iconfont.1736854649055.ttf → iconfont.1738985837413.ttf} +0 -0
- /package/lib/{iconfont.1736854649055.woff → iconfont.1738985837413.woff} +0 -0
- /package/lib/{iconfont.1736854649055.woff2 → iconfont.1738985837413.woff2} +0 -0
package/es/table/src/methods.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils';
|
|
2
|
-
import { browse, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft } from '../../ui/src/dom';
|
|
2
|
+
import { browse, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, getOffsetPos, setScrollTop, setScrollLeft } from '../../ui/src/dom';
|
|
3
3
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
|
|
4
4
|
import { VxeUI } from '../../ui';
|
|
5
5
|
import Cell from './cell';
|
|
@@ -308,7 +308,7 @@ function updateAfterListIndex($xeTable) {
|
|
|
308
308
|
rowRest._index = index;
|
|
309
309
|
}
|
|
310
310
|
else {
|
|
311
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, treeIndex: -1, items: [], parent: null, level: 0, height: 0, oTop: 0 };
|
|
311
|
+
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 };
|
|
312
312
|
fullAllDataRowIdData[rowid] = rest;
|
|
313
313
|
fullDataRowIdData[rowid] = rest;
|
|
314
314
|
}
|
|
@@ -339,7 +339,7 @@ function updateAfterDataIndex($xeTable) {
|
|
|
339
339
|
rowRest.treeIndex = index;
|
|
340
340
|
}
|
|
341
341
|
else {
|
|
342
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, items: [], parent: null, level: 0, height: 0, oTop: 0 };
|
|
342
|
+
const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 };
|
|
343
343
|
fullAllDataRowIdData[rowid] = rest;
|
|
344
344
|
fullDataRowIdData[rowid] = rest;
|
|
345
345
|
}
|
|
@@ -390,14 +390,16 @@ function updateStyle($xeTable) {
|
|
|
390
390
|
const props = $xeTable;
|
|
391
391
|
const reactData = $xeTable;
|
|
392
392
|
const internalData = $xeTable;
|
|
393
|
-
const { border,
|
|
394
|
-
const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, scrollbarWidth, scrollbarHeight, columnStore, editStore, isAllOverflow, expandColumn } = reactData;
|
|
393
|
+
const { border, showHeaderOverflow: allColumnHeaderOverflow, showFooterOverflow: allColumnFooterOverflow, mouseConfig, spanMethod, footerSpanMethod } = props;
|
|
394
|
+
const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, overflowX, scrollbarWidth, overflowY, scrollbarHeight, columnStore, editStore, isAllOverflow, expandColumn } = reactData;
|
|
395
395
|
const { visibleColumn, fullColumnIdData, tableHeight, tableWidth, headerHeight, footerHeight, elemStore, customHeight, customMinHeight, customMaxHeight } = internalData;
|
|
396
396
|
const el = $xeTable.$refs.refElem;
|
|
397
397
|
if (!el) {
|
|
398
398
|
return;
|
|
399
399
|
}
|
|
400
400
|
const containerList = ['main', 'left', 'right'];
|
|
401
|
+
const osbWidth = overflowY ? scrollbarWidth : 0;
|
|
402
|
+
const osbHeight = overflowX ? scrollbarHeight : 0;
|
|
401
403
|
const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder;
|
|
402
404
|
const cellOffsetWidth = $xeTable.computeCellOffsetWidth;
|
|
403
405
|
const mouseOpts = $xeTable.computeMouseOpts;
|
|
@@ -405,16 +407,16 @@ function updateStyle($xeTable) {
|
|
|
405
407
|
const bodyTableElem = getRefElem(elemStore['main-body-table']);
|
|
406
408
|
if (emptyPlaceholderElem) {
|
|
407
409
|
emptyPlaceholderElem.style.top = `${headerHeight}px`;
|
|
408
|
-
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight -
|
|
410
|
+
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : '';
|
|
409
411
|
}
|
|
410
412
|
let bodyHeight = 0;
|
|
411
413
|
let bodyMaxHeight = 0;
|
|
412
|
-
const bodyMinHeight = customMinHeight - headerHeight - footerHeight -
|
|
414
|
+
const bodyMinHeight = customMinHeight - headerHeight - footerHeight - osbHeight;
|
|
413
415
|
if (customMaxHeight) {
|
|
414
|
-
bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight -
|
|
416
|
+
bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - osbHeight);
|
|
415
417
|
}
|
|
416
418
|
if (customHeight) {
|
|
417
|
-
bodyHeight = customHeight - headerHeight - footerHeight -
|
|
419
|
+
bodyHeight = customHeight - headerHeight - footerHeight - osbHeight;
|
|
418
420
|
}
|
|
419
421
|
if (!bodyHeight) {
|
|
420
422
|
if (bodyTableElem) {
|
|
@@ -432,27 +434,27 @@ function updateStyle($xeTable) {
|
|
|
432
434
|
const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
|
|
433
435
|
const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem;
|
|
434
436
|
if (scrollXVirtualEl) {
|
|
435
|
-
scrollXVirtualEl.style.height = `${
|
|
436
|
-
scrollXVirtualEl.style.visibility =
|
|
437
|
+
scrollXVirtualEl.style.height = `${osbHeight}px`;
|
|
438
|
+
scrollXVirtualEl.style.visibility = overflowX ? 'visible' : 'hidden';
|
|
437
439
|
}
|
|
438
440
|
const xWrapperEl = $xeTable.$refs.refScrollXWrapperElem;
|
|
439
441
|
if (xWrapperEl) {
|
|
440
|
-
xWrapperEl.style.left = scrollbarXToTop ? `${
|
|
441
|
-
xWrapperEl.style.width = `${el.clientWidth -
|
|
442
|
+
xWrapperEl.style.left = scrollbarXToTop ? `${osbWidth}px` : '';
|
|
443
|
+
xWrapperEl.style.width = `${el.clientWidth - osbWidth}px`;
|
|
442
444
|
}
|
|
443
445
|
if (xLeftCornerEl) {
|
|
444
|
-
xLeftCornerEl.style.width = scrollbarXToTop ? `${
|
|
445
|
-
xLeftCornerEl.style.display = scrollbarXToTop ? (
|
|
446
|
+
xLeftCornerEl.style.width = scrollbarXToTop ? `${osbWidth}px` : '';
|
|
447
|
+
xLeftCornerEl.style.display = scrollbarXToTop ? (osbWidth && osbHeight ? 'block' : '') : '';
|
|
446
448
|
}
|
|
447
449
|
if (xRightCornerEl) {
|
|
448
|
-
xRightCornerEl.style.width = scrollbarXToTop ? '' : `${
|
|
449
|
-
xRightCornerEl.style.display = scrollbarXToTop ? '' : (
|
|
450
|
+
xRightCornerEl.style.width = scrollbarXToTop ? '' : `${osbWidth}px`;
|
|
451
|
+
xRightCornerEl.style.display = scrollbarXToTop ? '' : (osbWidth && osbHeight ? 'block' : '');
|
|
450
452
|
}
|
|
451
453
|
const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem;
|
|
452
454
|
if (scrollYVirtualEl) {
|
|
453
|
-
scrollYVirtualEl.style.width = `${
|
|
455
|
+
scrollYVirtualEl.style.width = `${osbWidth}px`;
|
|
454
456
|
scrollYVirtualEl.style.height = `${bodyHeight + headerHeight + footerHeight}px`;
|
|
455
|
-
scrollYVirtualEl.style.visibility =
|
|
457
|
+
scrollYVirtualEl.style.visibility = overflowY ? 'visible' : 'hidden';
|
|
456
458
|
}
|
|
457
459
|
const yTopCornerEl = $xeTable.$refs.refScrollYTopCornerElem;
|
|
458
460
|
if (yTopCornerEl) {
|
|
@@ -570,14 +572,14 @@ function updateStyle($xeTable) {
|
|
|
570
572
|
if (wrapperElem) {
|
|
571
573
|
wrapperElem.style.top = `${headerHeight}px`;
|
|
572
574
|
}
|
|
573
|
-
fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + headerHeight + footerHeight +
|
|
575
|
+
fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + headerHeight + footerHeight + osbHeight)}px`;
|
|
574
576
|
fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`;
|
|
575
577
|
}
|
|
576
578
|
let tWidth = tableWidth;
|
|
577
579
|
let renderColumnList = tableColumn;
|
|
578
580
|
let isOptimizeMode = false;
|
|
579
581
|
// 如果是使用优化模式
|
|
580
|
-
if (scrollXLoad || scrollYLoad ||
|
|
582
|
+
if (scrollXLoad || scrollYLoad || isAllOverflow) {
|
|
581
583
|
if (expandColumn || spanMethod || footerSpanMethod) {
|
|
582
584
|
// 如果不支持优化模式
|
|
583
585
|
}
|
|
@@ -600,7 +602,7 @@ function updateStyle($xeTable) {
|
|
|
600
602
|
if (tableElem) {
|
|
601
603
|
tableElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
602
604
|
// 兼容性处理
|
|
603
|
-
tableElem.style.paddingRight =
|
|
605
|
+
tableElem.style.paddingRight = osbWidth && fixedType && (browse['-moz'] || browse.safari) ? `${osbWidth}px` : '';
|
|
604
606
|
}
|
|
605
607
|
const emptyBlockElem = getRefElem(elemStore[`${name}-${layout}-emptyBlock`]);
|
|
606
608
|
if (emptyBlockElem) {
|
|
@@ -637,7 +639,7 @@ function updateStyle($xeTable) {
|
|
|
637
639
|
// 如果是固定列
|
|
638
640
|
if (fixedWrapperElem) {
|
|
639
641
|
if (wrapperElem) {
|
|
640
|
-
wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight -
|
|
642
|
+
wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight - osbHeight : tableHeight + headerHeight}px`;
|
|
641
643
|
}
|
|
642
644
|
}
|
|
643
645
|
}
|
|
@@ -662,7 +664,7 @@ function updateStyle($xeTable) {
|
|
|
662
664
|
cellOverflow = XEUtils.isUndefined(showFooterOverflow) || XEUtils.isNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
|
|
663
665
|
}
|
|
664
666
|
else {
|
|
665
|
-
cellOverflow = XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow) ?
|
|
667
|
+
cellOverflow = XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow) ? isAllOverflow : showOverflow;
|
|
666
668
|
}
|
|
667
669
|
const showEllipsis = cellOverflow === 'ellipsis';
|
|
668
670
|
const showTitle = cellOverflow === 'title';
|
|
@@ -706,14 +708,14 @@ function updateStyle($xeTable) {
|
|
|
706
708
|
return $xeTable.$nextTick();
|
|
707
709
|
}
|
|
708
710
|
function computeRowHeight($xeTable) {
|
|
709
|
-
const
|
|
710
|
-
const {
|
|
711
|
+
const reactData = $xeTable;
|
|
712
|
+
const { isAllOverflow } = reactData;
|
|
711
713
|
const tableHeader = $xeTable.$refs.refTableHeader;
|
|
712
714
|
const tableBody = $xeTable.$refs.refTableBody;
|
|
713
715
|
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
714
716
|
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
715
717
|
let rowHeight = 0;
|
|
716
|
-
if (
|
|
718
|
+
if (isAllOverflow) {
|
|
717
719
|
if (tableBodyElem) {
|
|
718
720
|
const tableHeaderElem = tableHeader ? tableHeader.$el : null;
|
|
719
721
|
let firstTrElem;
|
|
@@ -735,30 +737,33 @@ function computeRowHeight($xeTable) {
|
|
|
735
737
|
// 最低支持 18px 行高
|
|
736
738
|
return Math.max(18, rowHeight);
|
|
737
739
|
}
|
|
738
|
-
function handleVirtualYVisible($xeTable) {
|
|
739
|
-
const props = $xeTable;
|
|
740
|
+
function handleVirtualYVisible($xeTable, currScrollTop) {
|
|
740
741
|
const reactData = $xeTable;
|
|
741
742
|
const internalData = $xeTable;
|
|
742
|
-
const {
|
|
743
|
-
const {
|
|
744
|
-
const
|
|
743
|
+
const { isAllOverflow } = reactData;
|
|
744
|
+
const { elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData;
|
|
745
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
746
|
+
const cellOpts = $xeTable.computeCellOpts;
|
|
747
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
745
748
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
746
749
|
if (bodyScrollElem) {
|
|
747
|
-
const
|
|
750
|
+
const clientHeight = bodyScrollElem.clientHeight;
|
|
751
|
+
const scrollTop = XEUtils.isNumber(currScrollTop) ? currScrollTop : bodyScrollElem.scrollTop;
|
|
748
752
|
const endHeight = scrollTop + clientHeight;
|
|
749
753
|
let toVisibleIndex = -1;
|
|
750
754
|
let offsetTop = 0;
|
|
751
755
|
let visibleSize = 0;
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
756
|
+
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
|
|
757
|
+
if (!isCustomCellHeight && isAllOverflow) {
|
|
758
|
+
toVisibleIndex = Math.floor(scrollTop / defaultRowHeight);
|
|
759
|
+
visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
|
|
755
760
|
}
|
|
756
761
|
else {
|
|
757
762
|
for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
758
763
|
const row = afterFullData[rIndex];
|
|
759
764
|
const rowid = getRowid($xeTable, row);
|
|
760
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
761
|
-
offsetTop += rowRest
|
|
765
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
766
|
+
offsetTop += rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
762
767
|
if (toVisibleIndex === -1 && scrollTop < offsetTop) {
|
|
763
768
|
toVisibleIndex = rIndex;
|
|
764
769
|
}
|
|
@@ -1010,7 +1015,7 @@ function autoCellWidth($xeTable) {
|
|
|
1010
1015
|
}
|
|
1011
1016
|
const tableHeight = bodyElem.offsetHeight;
|
|
1012
1017
|
const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight;
|
|
1013
|
-
reactData.scrollbarWidth =
|
|
1018
|
+
reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth);
|
|
1014
1019
|
reactData.overflowY = overflowY;
|
|
1015
1020
|
internalData.tableWidth = tableWidth;
|
|
1016
1021
|
internalData.tableHeight = tableHeight;
|
|
@@ -1019,7 +1024,7 @@ function autoCellWidth($xeTable) {
|
|
|
1019
1024
|
const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0;
|
|
1020
1025
|
const overflowX = tableWidth > bodyWidth;
|
|
1021
1026
|
const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0;
|
|
1022
|
-
reactData.scrollbarHeight =
|
|
1027
|
+
reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight);
|
|
1023
1028
|
internalData.headerHeight = headerHeight;
|
|
1024
1029
|
internalData.footerHeight = footerHeight;
|
|
1025
1030
|
reactData.overflowX = overflowX;
|
|
@@ -1029,61 +1034,36 @@ function autoCellWidth($xeTable) {
|
|
|
1029
1034
|
$xeTable.checkScrolling();
|
|
1030
1035
|
}
|
|
1031
1036
|
}
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
// }, 80)
|
|
1045
|
-
// }
|
|
1037
|
+
const calcCellAutoHeight = (rowRest, wrapperEl) => {
|
|
1038
|
+
const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);
|
|
1039
|
+
let colHeight = rowRest.height;
|
|
1040
|
+
for (let i = 0; i < cellElemList.length; i++) {
|
|
1041
|
+
const cellElem = cellElemList[i];
|
|
1042
|
+
const tdEl = cellElem.parentElement;
|
|
1043
|
+
const topBottomPadding = Math.ceil(XEUtils.toNumber(tdEl.style.paddingTop) + XEUtils.toNumber(tdEl.style.paddingBottom));
|
|
1044
|
+
const cellHeight = cellElem ? cellElem.clientHeight : 0;
|
|
1045
|
+
colHeight = Math.max(colHeight - topBottomPadding, Math.ceil(cellHeight));
|
|
1046
|
+
}
|
|
1047
|
+
return colHeight;
|
|
1048
|
+
};
|
|
1046
1049
|
const calcCellHeight = ($xeTable) => {
|
|
1047
|
-
const props = $xeTable;
|
|
1048
1050
|
const reactData = $xeTable;
|
|
1049
1051
|
const internalData = $xeTable;
|
|
1050
|
-
const {
|
|
1051
|
-
const { tableData, scrollXLoad } = reactData;
|
|
1052
|
+
const { tableData, isAllOverflow, scrollYLoad, scrollXLoad } = reactData;
|
|
1052
1053
|
const { fullAllDataRowIdData } = internalData;
|
|
1054
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
1053
1055
|
const el = $xeTable.$refs.refElem;
|
|
1054
|
-
if (!
|
|
1055
|
-
let paddingTop = 0;
|
|
1056
|
-
let paddingBottom = 0;
|
|
1057
|
-
let calcPadding = false;
|
|
1056
|
+
if (!isAllOverflow && scrollYLoad && el) {
|
|
1058
1057
|
tableData.forEach(row => {
|
|
1059
1058
|
const rowid = getRowid($xeTable, row);
|
|
1060
1059
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
for (let i = 0; i < cellList.length; i++) {
|
|
1065
|
-
const cellElem = cellList[i];
|
|
1066
|
-
const tdEl = cellElem.parentElement;
|
|
1067
|
-
if (!tdEl || !tdEl.clientWidth) {
|
|
1068
|
-
break;
|
|
1069
|
-
}
|
|
1070
|
-
if (!calcPadding) {
|
|
1071
|
-
paddingTop = XEUtils.toNumber(getComputedStyle(tdEl).paddingTop);
|
|
1072
|
-
paddingBottom = XEUtils.toNumber(getComputedStyle(tdEl).paddingBottom);
|
|
1073
|
-
calcPadding = true;
|
|
1074
|
-
}
|
|
1075
|
-
let cellHeight = paddingTop + paddingBottom;
|
|
1076
|
-
if (cellElem) {
|
|
1077
|
-
cellHeight += cellElem.clientHeight;
|
|
1078
|
-
}
|
|
1079
|
-
height = Math.max(height, cellHeight);
|
|
1080
|
-
}
|
|
1081
|
-
rowRest.height = scrollXLoad ? Math.max(rowRest.height, height) : height;
|
|
1060
|
+
if (rowRest) {
|
|
1061
|
+
const height = calcCellAutoHeight(rowRest, el);
|
|
1062
|
+
rowRest.height = Math.max(defaultRowHeight, scrollXLoad ? Math.max(rowRest.height, height) : height);
|
|
1082
1063
|
}
|
|
1083
1064
|
});
|
|
1084
|
-
reactData.
|
|
1065
|
+
reactData.calcCellHeightFlag++;
|
|
1085
1066
|
}
|
|
1086
|
-
// updateCellOffset()
|
|
1087
1067
|
};
|
|
1088
1068
|
function getOrderField(_vm, column) {
|
|
1089
1069
|
const { sortBy, sortType } = column;
|
|
@@ -1107,6 +1087,19 @@ function getOrderField(_vm, column) {
|
|
|
1107
1087
|
return cellValue;
|
|
1108
1088
|
};
|
|
1109
1089
|
}
|
|
1090
|
+
function handleTargetEnterEvent($xeTable, isClear) {
|
|
1091
|
+
const internalData = $xeTable;
|
|
1092
|
+
const $tooltip = $xeTable.$refs.refTooltip;
|
|
1093
|
+
clearTimeout(internalData.tooltipTimeout);
|
|
1094
|
+
if (isClear) {
|
|
1095
|
+
$xeTable.closeTooltip();
|
|
1096
|
+
}
|
|
1097
|
+
else {
|
|
1098
|
+
if ($tooltip && $tooltip.setActived) {
|
|
1099
|
+
$tooltip.setActived(true);
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1110
1103
|
function clearDragStatus($xeTable) {
|
|
1111
1104
|
const reactData = $xeTable;
|
|
1112
1105
|
const { dragRow, dragCol } = reactData;
|
|
@@ -1205,9 +1198,11 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
|
|
|
1205
1198
|
if (!el) {
|
|
1206
1199
|
return;
|
|
1207
1200
|
}
|
|
1208
|
-
const { scrollbarWidth, scrollbarHeight } = reactData;
|
|
1201
|
+
const { overflowX, scrollbarWidth, overflowY, scrollbarHeight } = reactData;
|
|
1209
1202
|
const { prevDragToChild } = internalData;
|
|
1210
1203
|
const wrapperRect = el.getBoundingClientRect();
|
|
1204
|
+
const osbWidth = overflowY ? scrollbarWidth : 0;
|
|
1205
|
+
const osbHeight = overflowX ? scrollbarHeight : 0;
|
|
1211
1206
|
const tableWidth = el.clientWidth;
|
|
1212
1207
|
const tableHeight = el.clientHeight;
|
|
1213
1208
|
if (trEl) {
|
|
@@ -1218,14 +1213,14 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
|
|
|
1218
1213
|
const trRect = trEl.getBoundingClientRect();
|
|
1219
1214
|
let trHeight = trEl.clientHeight;
|
|
1220
1215
|
const offsetTop = Math.max(1, trRect.y - wrapperRect.y);
|
|
1221
|
-
if (offsetTop + trHeight > tableHeight -
|
|
1222
|
-
trHeight = tableHeight - offsetTop -
|
|
1216
|
+
if (offsetTop + trHeight > tableHeight - osbHeight) {
|
|
1217
|
+
trHeight = tableHeight - offsetTop - osbHeight;
|
|
1223
1218
|
}
|
|
1224
1219
|
rdLineEl.style.display = 'block';
|
|
1225
|
-
rdLineEl.style.left = `${scrollbarYToLeft ?
|
|
1220
|
+
rdLineEl.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
|
|
1226
1221
|
rdLineEl.style.top = `${offsetTop}px`;
|
|
1227
1222
|
rdLineEl.style.height = `${trHeight}px`;
|
|
1228
|
-
rdLineEl.style.width = `${tableWidth -
|
|
1223
|
+
rdLineEl.style.width = `${tableWidth - osbWidth}px`;
|
|
1229
1224
|
rdLineEl.setAttribute('drag-pos', dragPos);
|
|
1230
1225
|
rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
|
|
1231
1226
|
}
|
|
@@ -1252,7 +1247,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
|
|
|
1252
1247
|
thWidth -= startX - offsetLeft;
|
|
1253
1248
|
offsetLeft = startX;
|
|
1254
1249
|
}
|
|
1255
|
-
const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 :
|
|
1250
|
+
const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 : osbWidth);
|
|
1256
1251
|
if (offsetLeft + thWidth > endX) {
|
|
1257
1252
|
thWidth = endX - offsetLeft;
|
|
1258
1253
|
}
|
|
@@ -1264,7 +1259,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
|
|
|
1264
1259
|
cdLineEl.style.height = `${thRect.height}px`;
|
|
1265
1260
|
}
|
|
1266
1261
|
else {
|
|
1267
|
-
cdLineEl.style.height = `${tableHeight - offsetTop - (scrollbarXToTop ? 0 :
|
|
1262
|
+
cdLineEl.style.height = `${tableHeight - offsetTop - (scrollbarXToTop ? 0 : osbHeight)}px`;
|
|
1268
1263
|
}
|
|
1269
1264
|
cdLineEl.setAttribute('drag-pos', dragPos);
|
|
1270
1265
|
cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
|
|
@@ -1296,6 +1291,41 @@ function hideDropTip($xeTable) {
|
|
|
1296
1291
|
cdLineEl.style.display = '';
|
|
1297
1292
|
}
|
|
1298
1293
|
}
|
|
1294
|
+
/**
|
|
1295
|
+
* 处理显示 tooltip
|
|
1296
|
+
* @param {Event} evnt 事件
|
|
1297
|
+
* @param {Row} row 行对象
|
|
1298
|
+
*/
|
|
1299
|
+
function handleTooltip($xeTable, evnt, tdEl, overflowElem, tipElem, params) {
|
|
1300
|
+
const reactData = $xeTable;
|
|
1301
|
+
if (!overflowElem) {
|
|
1302
|
+
return $xeTable.$nextTick();
|
|
1303
|
+
}
|
|
1304
|
+
params.cell = tdEl;
|
|
1305
|
+
const { tooltipStore } = reactData;
|
|
1306
|
+
const tooltipOpts = $xeTable.computeTooltipOpts;
|
|
1307
|
+
const { column, row } = params;
|
|
1308
|
+
const { showAll, contentMethod } = tooltipOpts;
|
|
1309
|
+
const customContent = contentMethod ? contentMethod(params) : null;
|
|
1310
|
+
const useCustom = contentMethod && !XEUtils.eqNull(customContent);
|
|
1311
|
+
const content = useCustom ? customContent : XEUtils.toString(column.type === 'html' ? overflowElem.innerText : overflowElem.textContent).trim();
|
|
1312
|
+
const isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth;
|
|
1313
|
+
if (content && (showAll || useCustom || isCellOverflow)) {
|
|
1314
|
+
Object.assign(tooltipStore, {
|
|
1315
|
+
row,
|
|
1316
|
+
column,
|
|
1317
|
+
visible: true,
|
|
1318
|
+
currOpts: {}
|
|
1319
|
+
});
|
|
1320
|
+
$xeTable.$nextTick(() => {
|
|
1321
|
+
const $tooltip = $xeTable.$refs.refTooltip;
|
|
1322
|
+
if ($tooltip && $tooltip.open) {
|
|
1323
|
+
$tooltip.open(isCellOverflow ? overflowElem : (tipElem || overflowElem), formatText(content));
|
|
1324
|
+
}
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
return $xeTable.$nextTick();
|
|
1328
|
+
}
|
|
1299
1329
|
function handleScrollToRowColumn($xeTable, fieldOrColumn, row) {
|
|
1300
1330
|
const internalData = $xeTable;
|
|
1301
1331
|
const { fullColumnIdData } = internalData;
|
|
@@ -1583,11 +1613,10 @@ function handleColumn($xeTable, collectColumn) {
|
|
|
1583
1613
|
internalData.collectColumn = collectColumn;
|
|
1584
1614
|
const tableFullColumn = getColumnList(collectColumn);
|
|
1585
1615
|
internalData.tableFullColumn = tableFullColumn;
|
|
1586
|
-
reactData.
|
|
1616
|
+
reactData.isColLoading = true;
|
|
1587
1617
|
reactData.isDragColMove = false;
|
|
1588
1618
|
initColumnSort($xeTable);
|
|
1589
1619
|
return Promise.resolve(restoreCustomStorage($xeTable)).then(() => {
|
|
1590
|
-
reactData.isLoading = false;
|
|
1591
1620
|
cacheColumnMap($xeTable);
|
|
1592
1621
|
parseColumns($xeTable, true).then(() => {
|
|
1593
1622
|
if (reactData.scrollXLoad) {
|
|
@@ -1612,6 +1641,7 @@ function handleColumn($xeTable, collectColumn) {
|
|
|
1612
1641
|
if ($xeTable.handleUpdateCustomColumn) {
|
|
1613
1642
|
$xeTable.handleUpdateCustomColumn();
|
|
1614
1643
|
}
|
|
1644
|
+
reactData.isColLoading = false;
|
|
1615
1645
|
return $xeTable.recalculate();
|
|
1616
1646
|
});
|
|
1617
1647
|
});
|
|
@@ -1619,16 +1649,14 @@ function handleColumn($xeTable, collectColumn) {
|
|
|
1619
1649
|
/**
|
|
1620
1650
|
* 纵向 Y 可视渲染处理
|
|
1621
1651
|
*/
|
|
1622
|
-
function loadScrollYData($xeTable) {
|
|
1623
|
-
const props = $xeTable;
|
|
1652
|
+
function loadScrollYData($xeTable, scrollTop) {
|
|
1624
1653
|
const reactData = $xeTable;
|
|
1625
1654
|
const internalData = $xeTable;
|
|
1626
|
-
const {
|
|
1627
|
-
const { mergeList } = reactData;
|
|
1655
|
+
const { mergeList, isAllOverflow } = reactData;
|
|
1628
1656
|
const { scrollYStore } = internalData;
|
|
1629
1657
|
const { preloadSize, startIndex, endIndex, offsetSize } = scrollYStore;
|
|
1630
|
-
const autoOffsetYSize =
|
|
1631
|
-
const { toVisibleIndex, visibleSize } = handleVirtualYVisible($xeTable);
|
|
1658
|
+
const autoOffsetYSize = isAllOverflow ? offsetSize : offsetSize + 1;
|
|
1659
|
+
const { toVisibleIndex, visibleSize } = handleVirtualYVisible($xeTable, scrollTop);
|
|
1632
1660
|
const offsetItem = {
|
|
1633
1661
|
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
1634
1662
|
endIndex: toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize
|
|
@@ -1645,6 +1673,42 @@ function loadScrollYData($xeTable) {
|
|
|
1645
1673
|
}
|
|
1646
1674
|
}
|
|
1647
1675
|
}
|
|
1676
|
+
function lazyScrollXData($xeTable) {
|
|
1677
|
+
const internalData = $xeTable;
|
|
1678
|
+
const { lxTimeout, lxRunTime, scrollXStore } = internalData;
|
|
1679
|
+
const { visibleSize } = scrollXStore;
|
|
1680
|
+
const fpsTime = Math.max(5, Math.min(10, Math.floor(visibleSize / 3)));
|
|
1681
|
+
if (lxTimeout) {
|
|
1682
|
+
clearTimeout(lxTimeout);
|
|
1683
|
+
}
|
|
1684
|
+
if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
|
|
1685
|
+
internalData.lxRunTime = Date.now();
|
|
1686
|
+
loadScrollXData($xeTable);
|
|
1687
|
+
}
|
|
1688
|
+
internalData.lxTimeout = setTimeout(() => {
|
|
1689
|
+
internalData.lxTimeout = undefined;
|
|
1690
|
+
internalData.lxRunTime = undefined;
|
|
1691
|
+
loadScrollXData($xeTable);
|
|
1692
|
+
}, fpsTime);
|
|
1693
|
+
}
|
|
1694
|
+
function lazyScrollYData($xeTable) {
|
|
1695
|
+
const internalData = $xeTable;
|
|
1696
|
+
const { lyTimeout, lyRunTime, scrollYStore } = internalData;
|
|
1697
|
+
const { visibleSize } = scrollYStore;
|
|
1698
|
+
const fpsTime = Math.floor(Math.max(4, Math.min(10, visibleSize / 3)));
|
|
1699
|
+
if (lyTimeout) {
|
|
1700
|
+
clearTimeout(lyTimeout);
|
|
1701
|
+
}
|
|
1702
|
+
if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
|
|
1703
|
+
internalData.lyRunTime = Date.now();
|
|
1704
|
+
loadScrollYData($xeTable);
|
|
1705
|
+
}
|
|
1706
|
+
internalData.lyTimeout = setTimeout(() => {
|
|
1707
|
+
internalData.lyTimeout = undefined;
|
|
1708
|
+
internalData.lyRunTime = undefined;
|
|
1709
|
+
loadScrollYData($xeTable);
|
|
1710
|
+
}, fpsTime);
|
|
1711
|
+
}
|
|
1648
1712
|
function checkLastSyncScroll($xeTable, isRollX, isRollY) {
|
|
1649
1713
|
const reactData = $xeTable;
|
|
1650
1714
|
const internalData = $xeTable;
|
|
@@ -1656,6 +1720,7 @@ function checkLastSyncScroll($xeTable, isRollX, isRollY) {
|
|
|
1656
1720
|
internalData.lcsTimeout = setTimeout(() => {
|
|
1657
1721
|
internalData.lcsRunTime = Date.now();
|
|
1658
1722
|
internalData.lcsTimeout = undefined;
|
|
1723
|
+
internalData.intoRunScroll = false;
|
|
1659
1724
|
internalData.inVirtualScroll = false;
|
|
1660
1725
|
internalData.inWheelScroll = false;
|
|
1661
1726
|
internalData.inHeaderScroll = false;
|
|
@@ -1675,6 +1740,48 @@ function checkLastSyncScroll($xeTable, isRollX, isRollY) {
|
|
|
1675
1740
|
$xeTable.updateCellAreas();
|
|
1676
1741
|
}, 200);
|
|
1677
1742
|
}
|
|
1743
|
+
const getWheelSpeed = (lastScrollTime) => {
|
|
1744
|
+
let multiple = 1;
|
|
1745
|
+
const currTime = Date.now();
|
|
1746
|
+
if (lastScrollTime + 25 > currTime) {
|
|
1747
|
+
multiple = 1.18;
|
|
1748
|
+
}
|
|
1749
|
+
else if (lastScrollTime + 30 > currTime) {
|
|
1750
|
+
multiple = 1.15;
|
|
1751
|
+
}
|
|
1752
|
+
else if (lastScrollTime + 40 > currTime) {
|
|
1753
|
+
multiple = 1.12;
|
|
1754
|
+
}
|
|
1755
|
+
else if (lastScrollTime + 55 > currTime) {
|
|
1756
|
+
multiple = 1.09;
|
|
1757
|
+
}
|
|
1758
|
+
else if (lastScrollTime + 75 > currTime) {
|
|
1759
|
+
multiple = 1.06;
|
|
1760
|
+
}
|
|
1761
|
+
else if (lastScrollTime + 100 > currTime) {
|
|
1762
|
+
multiple = 1.03;
|
|
1763
|
+
}
|
|
1764
|
+
return multiple;
|
|
1765
|
+
};
|
|
1766
|
+
const wheelScrollTo = (diffNum, cb) => {
|
|
1767
|
+
const duration = Math.abs(diffNum);
|
|
1768
|
+
const startTime = performance.now();
|
|
1769
|
+
let countTop = 0;
|
|
1770
|
+
const step = (timestamp) => {
|
|
1771
|
+
let progress = (timestamp - startTime) / duration;
|
|
1772
|
+
if (progress > 1) {
|
|
1773
|
+
progress = 1;
|
|
1774
|
+
}
|
|
1775
|
+
const easedProgress = Math.pow(progress, 2);
|
|
1776
|
+
const offsetTop = Math.floor((diffNum * easedProgress)) - countTop;
|
|
1777
|
+
countTop += offsetTop;
|
|
1778
|
+
cb(offsetTop);
|
|
1779
|
+
if (progress < 1) {
|
|
1780
|
+
requestAnimationFrame(step);
|
|
1781
|
+
}
|
|
1782
|
+
};
|
|
1783
|
+
requestAnimationFrame(step);
|
|
1784
|
+
};
|
|
1678
1785
|
function updateHeight($xeTable) {
|
|
1679
1786
|
const internalData = $xeTable;
|
|
1680
1787
|
internalData.customHeight = calcTableHeight($xeTable, 'height');
|
|
@@ -1682,58 +1789,60 @@ function updateHeight($xeTable) {
|
|
|
1682
1789
|
internalData.customMaxHeight = calcTableHeight($xeTable, 'maxHeight');
|
|
1683
1790
|
}
|
|
1684
1791
|
function calcColumnAutoWidth(column, wrapperEl) {
|
|
1685
|
-
const
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
if (firstCellEl) {
|
|
1689
|
-
const cellStyle = getComputedStyle(firstCellEl);
|
|
1690
|
-
|
|
1792
|
+
const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[colid="${column.id}"]`);
|
|
1793
|
+
let leftRightPadding = 0;
|
|
1794
|
+
const firstCellEl = cellElemList[0];
|
|
1795
|
+
if (firstCellEl && firstCellEl.parentElement) {
|
|
1796
|
+
const cellStyle = getComputedStyle(firstCellEl.parentElement);
|
|
1797
|
+
leftRightPadding = Math.ceil(XEUtils.toNumber(cellStyle.paddingLeft) + XEUtils.toNumber(cellStyle.paddingRight));
|
|
1691
1798
|
}
|
|
1692
|
-
let colWidth = column.renderAutoWidth -
|
|
1693
|
-
|
|
1694
|
-
const
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
XEUtils.arrayEach(cellEl.children, (btnEl) => {
|
|
1699
|
-
titleWidth += btnEl.offsetWidth + 1;
|
|
1700
|
-
});
|
|
1701
|
-
}
|
|
1702
|
-
else {
|
|
1703
|
-
const labelEl = cellEl.firstElementChild;
|
|
1704
|
-
if (labelEl) {
|
|
1705
|
-
titleWidth = labelEl.offsetWidth;
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1708
|
-
if (titleWidth) {
|
|
1709
|
-
colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4);
|
|
1710
|
-
}
|
|
1711
|
-
});
|
|
1712
|
-
return colWidth + paddingSize;
|
|
1799
|
+
let colWidth = column.renderAutoWidth - leftRightPadding;
|
|
1800
|
+
for (let i = 0; i < cellElemList.length; i++) {
|
|
1801
|
+
const celEl = cellElemList[i];
|
|
1802
|
+
colWidth = Math.max(colWidth, celEl ? Math.ceil(celEl.scrollWidth) + 4 : 0);
|
|
1803
|
+
}
|
|
1804
|
+
return colWidth + leftRightPadding;
|
|
1713
1805
|
}
|
|
1714
1806
|
function calcCellWidth($xeTable) {
|
|
1715
|
-
const reactData = $xeTable;
|
|
1716
1807
|
const internalData = $xeTable;
|
|
1717
1808
|
const autoWidthColumnList = $xeTable.computeAutoWidthColumnList;
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
reactData.isCalcColumn = false;
|
|
1735
|
-
});
|
|
1809
|
+
const { fullColumnIdData } = internalData;
|
|
1810
|
+
const el = $xeTable.$refs.refElem;
|
|
1811
|
+
if (el) {
|
|
1812
|
+
el.setAttribute('data-calc-col', 'Y');
|
|
1813
|
+
autoWidthColumnList.forEach(column => {
|
|
1814
|
+
const colid = column.id;
|
|
1815
|
+
const colRest = fullColumnIdData[colid];
|
|
1816
|
+
const colWidth = calcColumnAutoWidth(column, el);
|
|
1817
|
+
if (colRest) {
|
|
1818
|
+
colRest.width = Math.max(colWidth, colRest.width);
|
|
1819
|
+
}
|
|
1820
|
+
column.renderAutoWidth = colWidth;
|
|
1821
|
+
});
|
|
1822
|
+
$xeTable.analyColumnWidth();
|
|
1823
|
+
el.removeAttribute('data-calc-col');
|
|
1824
|
+
}
|
|
1736
1825
|
}
|
|
1826
|
+
const handleUpdateColResize = ($xeTable, evnt, params) => {
|
|
1827
|
+
$xeTable.analyColumnWidth();
|
|
1828
|
+
$xeTable.recalculate(true).then(() => {
|
|
1829
|
+
$xeTable.saveCustomStore('update:width');
|
|
1830
|
+
$xeTable.updateCellAreas();
|
|
1831
|
+
$xeTable.dispatchEvent('column-resizable-change', params, evnt);
|
|
1832
|
+
// 已废弃 resizable-change
|
|
1833
|
+
$xeTable.dispatchEvent('resizable-change', params, evnt);
|
|
1834
|
+
setTimeout(() => $xeTable.recalculate(true), 300);
|
|
1835
|
+
});
|
|
1836
|
+
};
|
|
1837
|
+
const handleUpdateRowResize = ($xeTable, evnt, params) => {
|
|
1838
|
+
const reactData = $xeTable;
|
|
1839
|
+
reactData.resizeHeightFlag++;
|
|
1840
|
+
$xeTable.recalculate(true).then(() => {
|
|
1841
|
+
$xeTable.updateCellAreas();
|
|
1842
|
+
$xeTable.dispatchEvent('row-resizable-change', params, evnt);
|
|
1843
|
+
setTimeout(() => $xeTable.recalculate(true), 300);
|
|
1844
|
+
});
|
|
1845
|
+
};
|
|
1737
1846
|
const Methods = {
|
|
1738
1847
|
callSlot(slotFunc, params, h, vNodes) {
|
|
1739
1848
|
if (slotFunc) {
|
|
@@ -1787,7 +1896,7 @@ const Methods = {
|
|
|
1787
1896
|
warnLog('vxe.error.delFunc', ['syncData', 'getData']);
|
|
1788
1897
|
return this.$nextTick().then(() => {
|
|
1789
1898
|
this.tableData = [];
|
|
1790
|
-
return this.$nextTick().then(() => this.loadTableData(this.tableFullData));
|
|
1899
|
+
return this.$nextTick().then(() => this.loadTableData(this.tableFullData, true));
|
|
1791
1900
|
});
|
|
1792
1901
|
},
|
|
1793
1902
|
/**
|
|
@@ -1841,11 +1950,12 @@ const Methods = {
|
|
|
1841
1950
|
* 加载表格数据
|
|
1842
1951
|
* @param {Array} datas 数据
|
|
1843
1952
|
*/
|
|
1844
|
-
loadTableData(datas) {
|
|
1953
|
+
loadTableData(datas, isReset) {
|
|
1845
1954
|
const $xeTable = this;
|
|
1846
|
-
const
|
|
1955
|
+
const reactData = $xeTable;
|
|
1956
|
+
const internalData = $xeTable;
|
|
1957
|
+
const { keepSource, treeConfig, treeOpts, editStore, scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop, scrollYLoad: oldScrollYLoad, sXOpts, sYOpts } = this;
|
|
1847
1958
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
1848
|
-
const rowOpts = $xeTable.computeRowOpts;
|
|
1849
1959
|
let treeData = [];
|
|
1850
1960
|
let fullData = datas ? datas.slice(0) : [];
|
|
1851
1961
|
if (treeConfig) {
|
|
@@ -1889,42 +1999,30 @@ const Methods = {
|
|
|
1889
1999
|
scrollYStore.endIndex = 1;
|
|
1890
2000
|
scrollXStore.startIndex = 0;
|
|
1891
2001
|
scrollXStore.endIndex = 1;
|
|
2002
|
+
reactData.isRowLoading = true;
|
|
2003
|
+
reactData.scrollVMLoading = false;
|
|
1892
2004
|
editStore.insertMaps = {};
|
|
1893
|
-
editStore.removeList = [];
|
|
1894
2005
|
editStore.removeMaps = {};
|
|
1895
2006
|
const sYLoad = updateScrollYStatus($xeTable, fullData);
|
|
1896
|
-
|
|
2007
|
+
reactData.isDragColMove = false;
|
|
2008
|
+
reactData.isDragRowMove = false;
|
|
1897
2009
|
// 全量数据
|
|
1898
|
-
|
|
1899
|
-
|
|
2010
|
+
internalData.tableFullData = fullData;
|
|
2011
|
+
internalData.tableFullTreeData = treeData;
|
|
1900
2012
|
// 缓存数据
|
|
1901
|
-
|
|
2013
|
+
$xeTable.cacheRowMap(true, isReset);
|
|
1902
2014
|
// 原始数据
|
|
1903
|
-
|
|
2015
|
+
internalData.tableSynchData = datas;
|
|
2016
|
+
if (isReset) {
|
|
2017
|
+
internalData.isResizeCellHeight = false;
|
|
2018
|
+
reactData.rowExpandedMaps = {};
|
|
2019
|
+
reactData.rowExpandLazyLoadedMaps = {};
|
|
2020
|
+
reactData.treeExpandedMaps = {};
|
|
2021
|
+
reactData.treeExpandLazyLoadedMaps = {};
|
|
2022
|
+
}
|
|
1904
2023
|
// 克隆原数据,用于显示编辑状态,与编辑值做对比
|
|
1905
2024
|
if (keepSource) {
|
|
1906
|
-
|
|
1907
|
-
}
|
|
1908
|
-
if (sYLoad) {
|
|
1909
|
-
if (showOverflow) {
|
|
1910
|
-
if (!rowOpts.height) {
|
|
1911
|
-
const errColumn = this.tableFullColumn.find((column) => column.showOverflow === false);
|
|
1912
|
-
if (errColumn) {
|
|
1913
|
-
errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true']);
|
|
1914
|
-
}
|
|
1915
|
-
}
|
|
1916
|
-
}
|
|
1917
|
-
if (process.env.NODE_ENV === 'development') {
|
|
1918
|
-
if (!(this.height || this.maxHeight)) {
|
|
1919
|
-
errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
|
|
1920
|
-
}
|
|
1921
|
-
// if (!this.showOverflow) {
|
|
1922
|
-
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
1923
|
-
// }
|
|
1924
|
-
if (this.spanMethod) {
|
|
1925
|
-
warnLog('vxe.error.scrollErrProp', ['table.span-method']);
|
|
1926
|
-
}
|
|
1927
|
-
}
|
|
2025
|
+
$xeTable.cacheSourceMap(fullData);
|
|
1928
2026
|
}
|
|
1929
2027
|
if (this.clearCellAreas && this.mouseConfig) {
|
|
1930
2028
|
this.clearCellAreas();
|
|
@@ -1944,6 +2042,27 @@ const Methods = {
|
|
|
1944
2042
|
if (sYLoad) {
|
|
1945
2043
|
scrollYStore.endIndex = scrollYStore.visibleSize;
|
|
1946
2044
|
}
|
|
2045
|
+
if (sYLoad) {
|
|
2046
|
+
// if (showOverflow) {
|
|
2047
|
+
// if (!rowOpts.height) {
|
|
2048
|
+
// const errColumn = this.tableFullColumn.find((column: any) => column.showOverflow === false)
|
|
2049
|
+
// if (errColumn) {
|
|
2050
|
+
// errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
|
|
2051
|
+
// }
|
|
2052
|
+
// }
|
|
2053
|
+
// }
|
|
2054
|
+
if (process.env.NODE_ENV === 'development') {
|
|
2055
|
+
if (!(this.height || this.maxHeight)) {
|
|
2056
|
+
errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
|
|
2057
|
+
}
|
|
2058
|
+
// if (!this.showOverflow) {
|
|
2059
|
+
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2060
|
+
// }
|
|
2061
|
+
if (this.spanMethod) {
|
|
2062
|
+
warnLog('vxe.error.scrollErrProp', ['table.span-method']);
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
1947
2066
|
this.handleReserveStatus();
|
|
1948
2067
|
this.checkSelectionStatus();
|
|
1949
2068
|
return new Promise(resolve => {
|
|
@@ -1959,6 +2078,7 @@ const Methods = {
|
|
|
1959
2078
|
if (sYOpts.scrollToTopOnChange) {
|
|
1960
2079
|
targetScrollTop = 0;
|
|
1961
2080
|
}
|
|
2081
|
+
reactData.isRowLoading = false;
|
|
1962
2082
|
calcCellHeight($xeTable);
|
|
1963
2083
|
// 是否变更虚拟滚动
|
|
1964
2084
|
if (oldScrollYLoad === sYLoad) {
|
|
@@ -1985,7 +2105,7 @@ const Methods = {
|
|
|
1985
2105
|
*/
|
|
1986
2106
|
loadData(datas) {
|
|
1987
2107
|
const { initStatus } = this;
|
|
1988
|
-
return this.loadTableData(datas).then(() => {
|
|
2108
|
+
return this.loadTableData(datas, false).then(() => {
|
|
1989
2109
|
this.inited = true;
|
|
1990
2110
|
this.initStatus = true;
|
|
1991
2111
|
if (!initStatus) {
|
|
@@ -2003,7 +2123,7 @@ const Methods = {
|
|
|
2003
2123
|
.then(() => {
|
|
2004
2124
|
this.inited = true;
|
|
2005
2125
|
this.initStatus = true;
|
|
2006
|
-
return this.loadTableData(datas);
|
|
2126
|
+
return this.loadTableData(datas, true);
|
|
2007
2127
|
})
|
|
2008
2128
|
.then(() => {
|
|
2009
2129
|
this.handleLoadDefaults();
|
|
@@ -2081,9 +2201,8 @@ const Methods = {
|
|
|
2081
2201
|
},
|
|
2082
2202
|
/**
|
|
2083
2203
|
* 更新数据行的 Map
|
|
2084
|
-
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
2085
2204
|
*/
|
|
2086
|
-
cacheRowMap(isSource) {
|
|
2205
|
+
cacheRowMap(isReset, isSource) {
|
|
2087
2206
|
const { treeConfig, treeOpts, tableFullData, fullAllDataRowIdData, tableFullTreeData } = this;
|
|
2088
2207
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2089
2208
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
@@ -2103,8 +2222,8 @@ const Methods = {
|
|
|
2103
2222
|
row[childrenField] = null;
|
|
2104
2223
|
}
|
|
2105
2224
|
let cacheItem = fullAllDataRowIdData[rowid];
|
|
2106
|
-
if (!cacheItem) {
|
|
2107
|
-
cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, oTop: 0 };
|
|
2225
|
+
if (isReset || !cacheItem) {
|
|
2226
|
+
cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0 };
|
|
2108
2227
|
}
|
|
2109
2228
|
cacheItem.row = row;
|
|
2110
2229
|
cacheItem.items = items;
|
|
@@ -2178,7 +2297,7 @@ const Methods = {
|
|
|
2178
2297
|
XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
|
|
2179
2298
|
const rowid = getRowid($xeTable, childRow);
|
|
2180
2299
|
const parentRow = parentItem || parentRest.row;
|
|
2181
|
-
const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, treeIndex: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, oTop: 0 };
|
|
2300
|
+
const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, treeIndex: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, resizeHeight: 0, oTop: 0 };
|
|
2182
2301
|
fullDataRowIdData[rowid] = rest;
|
|
2183
2302
|
fullAllDataRowIdData[rowid] = rest;
|
|
2184
2303
|
}, { children: childrenField });
|
|
@@ -2534,18 +2653,37 @@ const Methods = {
|
|
|
2534
2653
|
return this.$nextTick();
|
|
2535
2654
|
},
|
|
2536
2655
|
getCellElement(row, fieldOrColumn) {
|
|
2537
|
-
const
|
|
2656
|
+
const $xeTable = this;
|
|
2657
|
+
const internalData = $xeTable;
|
|
2658
|
+
const { elemStore } = internalData;
|
|
2659
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
2538
2660
|
if (!column) {
|
|
2539
2661
|
return null;
|
|
2540
2662
|
}
|
|
2541
|
-
const
|
|
2542
|
-
const
|
|
2543
|
-
|
|
2663
|
+
const rowid = getRowid($xeTable, row);
|
|
2664
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
2665
|
+
const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
|
|
2666
|
+
const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
|
|
2667
|
+
let bodyElem;
|
|
2544
2668
|
if (column) {
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2669
|
+
if (column.fixed) {
|
|
2670
|
+
if (column.fixed === 'left') {
|
|
2671
|
+
if (leftScrollElem) {
|
|
2672
|
+
bodyElem = leftScrollElem;
|
|
2673
|
+
}
|
|
2674
|
+
}
|
|
2675
|
+
else {
|
|
2676
|
+
if (rightScrollElem) {
|
|
2677
|
+
bodyElem = rightScrollElem;
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
if (!bodyElem) {
|
|
2682
|
+
bodyElem = bodyScrollElem;
|
|
2683
|
+
}
|
|
2684
|
+
if (bodyElem) {
|
|
2685
|
+
return bodyElem.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`);
|
|
2686
|
+
}
|
|
2549
2687
|
}
|
|
2550
2688
|
return null;
|
|
2551
2689
|
},
|
|
@@ -2948,7 +3086,9 @@ const Methods = {
|
|
|
2948
3086
|
* @param {String/Number} rowid 行主键
|
|
2949
3087
|
*/
|
|
2950
3088
|
getRowById(cellValue) {
|
|
2951
|
-
const
|
|
3089
|
+
const $xeTable = this;
|
|
3090
|
+
const internalData = $xeTable;
|
|
3091
|
+
const { fullDataRowIdData } = internalData;
|
|
2952
3092
|
const rowid = XEUtils.eqNull(cellValue) ? '' : encodeURIComponent(cellValue);
|
|
2953
3093
|
return fullDataRowIdData[rowid] ? fullDataRowIdData[rowid].row : null;
|
|
2954
3094
|
},
|
|
@@ -2956,12 +3096,9 @@ const Methods = {
|
|
|
2956
3096
|
* 根据行获取行的唯一主键
|
|
2957
3097
|
* @param {Row} row 行对象
|
|
2958
3098
|
*/
|
|
2959
|
-
getRowid(
|
|
3099
|
+
getRowid(row) {
|
|
2960
3100
|
const $xeTable = this;
|
|
2961
|
-
|
|
2962
|
-
const { fullDataRowIdData } = internalData;
|
|
2963
|
-
const rowid = XEUtils.eqNull(cellValue) ? '' : encodeURIComponent(cellValue || '');
|
|
2964
|
-
return fullDataRowIdData[rowid] ? fullDataRowIdData[rowid].row : null;
|
|
3101
|
+
return getRowid($xeTable, row);
|
|
2965
3102
|
},
|
|
2966
3103
|
/**
|
|
2967
3104
|
* 获取处理后的表格数据
|
|
@@ -3146,29 +3283,35 @@ const Methods = {
|
|
|
3146
3283
|
},
|
|
3147
3284
|
setColumnWidth(fieldOrColumn, width) {
|
|
3148
3285
|
const $xeTable = this;
|
|
3286
|
+
const internalData = $xeTable;
|
|
3287
|
+
const { elemStore } = internalData;
|
|
3149
3288
|
let status = false;
|
|
3150
3289
|
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3290
|
+
let cWidth = XEUtils.toInteger(width);
|
|
3291
|
+
if (isScale(width)) {
|
|
3292
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
3293
|
+
const bodyWidth = bodyScrollElem ? bodyScrollElem.clientWidth - 1 : 0;
|
|
3294
|
+
cWidth = Math.floor(cWidth * bodyWidth);
|
|
3295
|
+
}
|
|
3296
|
+
if (cWidth) {
|
|
3297
|
+
cols.forEach(item => {
|
|
3298
|
+
const column = handleFieldOrColumn($xeTable, item);
|
|
3299
|
+
if (column) {
|
|
3300
|
+
column.resizeWidth = cWidth;
|
|
3301
|
+
if (!status) {
|
|
3302
|
+
status = true;
|
|
3303
|
+
}
|
|
3165
3304
|
}
|
|
3305
|
+
});
|
|
3306
|
+
if (status) {
|
|
3307
|
+
return $xeTable.refreshColumn().then(() => {
|
|
3308
|
+
return { status };
|
|
3309
|
+
});
|
|
3166
3310
|
}
|
|
3167
|
-
});
|
|
3168
|
-
if (status) {
|
|
3169
|
-
return $xeTable.refreshColumn();
|
|
3170
3311
|
}
|
|
3171
|
-
return $xeTable.$nextTick()
|
|
3312
|
+
return $xeTable.$nextTick().then(() => {
|
|
3313
|
+
return { status };
|
|
3314
|
+
});
|
|
3172
3315
|
},
|
|
3173
3316
|
getColumnWidth(fieldOrColumn) {
|
|
3174
3317
|
const column = handleFieldOrColumn(this, fieldOrColumn);
|
|
@@ -3461,7 +3604,151 @@ const Methods = {
|
|
|
3461
3604
|
});
|
|
3462
3605
|
Object.assign(this.columnStore, { resizeList, pxList, pxMinList, autoMinList, scaleList, scaleMinList, autoList, remainList });
|
|
3463
3606
|
},
|
|
3464
|
-
|
|
3607
|
+
handleColResizeMousedownEvent(evnt, fixedType, params) {
|
|
3608
|
+
const $xeTable = this;
|
|
3609
|
+
const reactData = $xeTable;
|
|
3610
|
+
const internalData = $xeTable;
|
|
3611
|
+
evnt.stopPropagation();
|
|
3612
|
+
evnt.preventDefault();
|
|
3613
|
+
const { column } = params;
|
|
3614
|
+
const { overflowX, scrollbarHeight } = reactData;
|
|
3615
|
+
const { elemStore, visibleColumn } = internalData;
|
|
3616
|
+
const resizableOpts = $xeTable.computeResizableOpts;
|
|
3617
|
+
const osbHeight = overflowX ? scrollbarHeight : 0;
|
|
3618
|
+
const tableEl = $xeTable.$refs.refElem;
|
|
3619
|
+
const leftContainerElem = $xeTable.$refs.refLeftContainer;
|
|
3620
|
+
const rightContainerElem = $xeTable.$refs.refRightContainer;
|
|
3621
|
+
const resizeBarElem = $xeTable.$refs.refColResizeBar;
|
|
3622
|
+
if (!resizeBarElem) {
|
|
3623
|
+
return;
|
|
3624
|
+
}
|
|
3625
|
+
const resizeTipElem = resizeBarElem.firstElementChild;
|
|
3626
|
+
const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
|
|
3627
|
+
const { clientX: dragClientX } = evnt;
|
|
3628
|
+
const wrapperElem = $xeTable.$refs.refElem;
|
|
3629
|
+
const dragBtnElem = evnt.target;
|
|
3630
|
+
let resizeColumn = column;
|
|
3631
|
+
if (column.children && column.children.length) {
|
|
3632
|
+
XEUtils.eachTree(column.children, childColumn => {
|
|
3633
|
+
resizeColumn = childColumn;
|
|
3634
|
+
});
|
|
3635
|
+
}
|
|
3636
|
+
const cell = dragBtnElem.parentNode;
|
|
3637
|
+
const cellParams = Object.assign(params, { cell });
|
|
3638
|
+
let dragLeft = 0;
|
|
3639
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
3640
|
+
if (!bodyScrollElem) {
|
|
3641
|
+
return;
|
|
3642
|
+
}
|
|
3643
|
+
const pos = getOffsetPos(dragBtnElem, wrapperElem);
|
|
3644
|
+
const dragBtnWidth = dragBtnElem.clientWidth;
|
|
3645
|
+
const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2);
|
|
3646
|
+
const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
|
|
3647
|
+
let dragMinLeft = pos.left - cell.clientWidth + dragBtnWidth + minInterval;
|
|
3648
|
+
let dragPosLeft = pos.left + dragBtnOffsetWidth;
|
|
3649
|
+
const isLeftFixed = fixedType === 'left';
|
|
3650
|
+
const isRightFixed = fixedType === 'right';
|
|
3651
|
+
// 计算左右侧固定列偏移量
|
|
3652
|
+
let fixedOffsetWidth = 0;
|
|
3653
|
+
if (isLeftFixed || isRightFixed) {
|
|
3654
|
+
const siblingProp = isLeftFixed ? 'nextElementSibling' : 'previousElementSibling';
|
|
3655
|
+
let tempCellElem = cell[siblingProp];
|
|
3656
|
+
while (tempCellElem) {
|
|
3657
|
+
if (hasClass(tempCellElem, 'fixed--hidden')) {
|
|
3658
|
+
break;
|
|
3659
|
+
}
|
|
3660
|
+
else if (!hasClass(tempCellElem, 'col--group')) {
|
|
3661
|
+
fixedOffsetWidth += tempCellElem.offsetWidth;
|
|
3662
|
+
}
|
|
3663
|
+
tempCellElem = tempCellElem[siblingProp];
|
|
3664
|
+
}
|
|
3665
|
+
if (isRightFixed && rightContainerElem) {
|
|
3666
|
+
dragPosLeft = rightContainerElem.offsetLeft + fixedOffsetWidth;
|
|
3667
|
+
}
|
|
3668
|
+
}
|
|
3669
|
+
// 处理拖动事件
|
|
3670
|
+
const updateEvent = (evnt) => {
|
|
3671
|
+
evnt.stopPropagation();
|
|
3672
|
+
evnt.preventDefault();
|
|
3673
|
+
const tableHeight = tableEl.clientHeight;
|
|
3674
|
+
const offsetX = evnt.clientX - dragClientX;
|
|
3675
|
+
let left = dragPosLeft + offsetX;
|
|
3676
|
+
const scrollLeft = fixedType ? 0 : bodyScrollElem.scrollLeft;
|
|
3677
|
+
if (isLeftFixed) {
|
|
3678
|
+
// 左固定列(不允许超过右侧固定列、不允许超过右边距)
|
|
3679
|
+
left = Math.min(left, (rightContainerElem ? rightContainerElem.offsetLeft : bodyScrollElem.clientWidth) - fixedOffsetWidth - minInterval);
|
|
3680
|
+
}
|
|
3681
|
+
else if (isRightFixed) {
|
|
3682
|
+
// 右侧固定列(不允许超过左侧固定列、不允许超过左边距)
|
|
3683
|
+
dragMinLeft = (leftContainerElem ? leftContainerElem.clientWidth : 0) + fixedOffsetWidth + minInterval;
|
|
3684
|
+
left = Math.min(left, dragPosLeft + cell.clientWidth - minInterval);
|
|
3685
|
+
}
|
|
3686
|
+
else {
|
|
3687
|
+
dragMinLeft = Math.max(bodyScrollElem.scrollLeft, dragMinLeft);
|
|
3688
|
+
// left = Math.min(left, bodyScrollElem.clientWidth + bodyScrollElem.scrollLeft - 40)
|
|
3689
|
+
}
|
|
3690
|
+
dragLeft = Math.max(left, dragMinLeft);
|
|
3691
|
+
const resizeBarLeft = Math.max(1, dragLeft - scrollLeft);
|
|
3692
|
+
resizeBarElem.style.left = `${resizeBarLeft}px`;
|
|
3693
|
+
resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`;
|
|
3694
|
+
resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - osbHeight : tableHeight}px`;
|
|
3695
|
+
if (resizableOpts.showDragTip && resizeTipElem) {
|
|
3696
|
+
resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
|
|
3697
|
+
const tableWidth = tableEl.clientWidth;
|
|
3698
|
+
const wrapperRect = wrapperElem.getBoundingClientRect();
|
|
3699
|
+
const resizeBarWidth = resizeBarElem.clientWidth;
|
|
3700
|
+
const resizeTipWidth = resizeTipElem.clientWidth;
|
|
3701
|
+
const resizeTipHeight = resizeTipElem.clientHeight;
|
|
3702
|
+
let resizeTipLeft = -resizeTipWidth;
|
|
3703
|
+
if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
|
|
3704
|
+
resizeTipLeft = 0;
|
|
3705
|
+
}
|
|
3706
|
+
else if (resizeBarLeft > tableWidth) {
|
|
3707
|
+
resizeTipLeft += tableWidth - resizeBarLeft;
|
|
3708
|
+
}
|
|
3709
|
+
resizeTipElem.style.left = `${resizeTipLeft}px`;
|
|
3710
|
+
resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
|
|
3711
|
+
}
|
|
3712
|
+
reactData.isDragResize = true;
|
|
3713
|
+
};
|
|
3714
|
+
reactData.isDragResize = true;
|
|
3715
|
+
addClass(tableEl, 'col-drag--resize');
|
|
3716
|
+
resizeBarElem.style.display = 'block';
|
|
3717
|
+
document.onmousemove = updateEvent;
|
|
3718
|
+
document.onmouseup = function (evnt) {
|
|
3719
|
+
document.onmousemove = null;
|
|
3720
|
+
document.onmouseup = null;
|
|
3721
|
+
resizeBarElem.style.display = 'none';
|
|
3722
|
+
internalData._lastResizeTime = Date.now();
|
|
3723
|
+
setTimeout(() => {
|
|
3724
|
+
reactData.isDragResize = false;
|
|
3725
|
+
}, 50);
|
|
3726
|
+
const resizeWidth = resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
|
|
3727
|
+
const resizeParams = Object.assign(Object.assign({}, params), { resizeWidth, resizeColumn });
|
|
3728
|
+
if (resizableOpts.dragMode === 'fixed') {
|
|
3729
|
+
visibleColumn.forEach(item => {
|
|
3730
|
+
if (item.id !== resizeColumn.id) {
|
|
3731
|
+
if (!item.resizeWidth) {
|
|
3732
|
+
item.resizeWidth = item.renderWidth;
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
});
|
|
3736
|
+
}
|
|
3737
|
+
if ($xeTable.handleColResizeCellAreaEvent) {
|
|
3738
|
+
$xeTable.handleColResizeCellAreaEvent(evnt, resizeParams);
|
|
3739
|
+
}
|
|
3740
|
+
else {
|
|
3741
|
+
resizeColumn.resizeWidth = resizeWidth;
|
|
3742
|
+
handleUpdateColResize($xeTable, evnt, resizeParams);
|
|
3743
|
+
}
|
|
3744
|
+
removeClass(tableEl, 'col-drag--resize');
|
|
3745
|
+
};
|
|
3746
|
+
updateEvent(evnt);
|
|
3747
|
+
if ($xeTable.closeMenu) {
|
|
3748
|
+
$xeTable.closeMenu();
|
|
3749
|
+
}
|
|
3750
|
+
},
|
|
3751
|
+
handleColResizeDblclickEvent(evnt, params) {
|
|
3465
3752
|
const $xeTable = this;
|
|
3466
3753
|
const reactData = $xeTable;
|
|
3467
3754
|
const internalData = $xeTable;
|
|
@@ -3469,6 +3756,8 @@ const Methods = {
|
|
|
3469
3756
|
const { isDblclickAutoWidth } = resizableOpts;
|
|
3470
3757
|
const el = $xeTable.$refs.refElem;
|
|
3471
3758
|
if (isDblclickAutoWidth && el) {
|
|
3759
|
+
evnt.stopPropagation();
|
|
3760
|
+
evnt.preventDefault();
|
|
3472
3761
|
const { fullColumnIdData } = internalData;
|
|
3473
3762
|
const { column } = params;
|
|
3474
3763
|
let resizeColumn = column;
|
|
@@ -3483,21 +3772,266 @@ const Methods = {
|
|
|
3483
3772
|
const cell = dragBtnElem.parentNode;
|
|
3484
3773
|
const cellParams = Object.assign(params, { cell });
|
|
3485
3774
|
const colMinWidth = getColReMinWidth(cellParams);
|
|
3775
|
+
el.setAttribute('data-calc-col', 'Y');
|
|
3486
3776
|
let resizeWidth = calcColumnAutoWidth(resizeColumn, el);
|
|
3777
|
+
el.removeAttribute('data-calc-col');
|
|
3487
3778
|
if (colRest) {
|
|
3488
3779
|
resizeWidth = Math.max(resizeWidth, colRest.width);
|
|
3489
3780
|
}
|
|
3490
|
-
|
|
3491
|
-
|
|
3781
|
+
resizeWidth = Math.max(colMinWidth, resizeWidth);
|
|
3782
|
+
const resizeParams = Object.assign(Object.assign({}, params), { resizeWidth, resizeColumn });
|
|
3783
|
+
reactData.isDragResize = false;
|
|
3492
3784
|
internalData._lastResizeTime = Date.now();
|
|
3493
|
-
$xeTable.
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3785
|
+
if ($xeTable.handleColResizeDblclickCellAreaEvent) {
|
|
3786
|
+
$xeTable.handleColResizeDblclickCellAreaEvent(evnt, resizeParams);
|
|
3787
|
+
}
|
|
3788
|
+
else {
|
|
3789
|
+
resizeColumn.resizeWidth = resizeWidth;
|
|
3790
|
+
handleUpdateColResize($xeTable, evnt, resizeParams);
|
|
3791
|
+
}
|
|
3792
|
+
}
|
|
3793
|
+
},
|
|
3794
|
+
handleRowResizeMousedownEvent(evnt, params) {
|
|
3795
|
+
const $xeTable = this;
|
|
3796
|
+
const reactData = $xeTable;
|
|
3797
|
+
const internalData = $xeTable;
|
|
3798
|
+
evnt.stopPropagation();
|
|
3799
|
+
evnt.preventDefault();
|
|
3800
|
+
const { row } = params;
|
|
3801
|
+
const { overflowX, scrollbarWidth, overflowY, scrollbarHeight } = reactData;
|
|
3802
|
+
const { elemStore, fullAllDataRowIdData } = internalData;
|
|
3803
|
+
const osbWidth = overflowY ? scrollbarWidth : 0;
|
|
3804
|
+
const osbHeight = overflowX ? scrollbarHeight : 0;
|
|
3805
|
+
const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
|
|
3806
|
+
const resizableOpts = $xeTable.computeResizableOpts;
|
|
3807
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
3808
|
+
const cellOpts = $xeTable.computeCellOpts;
|
|
3809
|
+
const tableEl = $xeTable.$refs.refElem;
|
|
3810
|
+
const resizeBarElem = $xeTable.$refs.refRowResizeBar;
|
|
3811
|
+
if (!resizeBarElem) {
|
|
3812
|
+
return;
|
|
3813
|
+
}
|
|
3814
|
+
const { clientY: dragClientY } = evnt;
|
|
3815
|
+
const resizeTipElem = resizeBarElem.firstElementChild;
|
|
3816
|
+
const dragBtnElem = evnt.currentTarget;
|
|
3817
|
+
const tdEl = dragBtnElem.parentNode;
|
|
3818
|
+
const trEl = tdEl.parentNode;
|
|
3819
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
3820
|
+
if (!bodyScrollElem) {
|
|
3821
|
+
return;
|
|
3822
|
+
}
|
|
3823
|
+
const rowid = getRowid($xeTable, row);
|
|
3824
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
3825
|
+
if (!rowRest) {
|
|
3826
|
+
return;
|
|
3827
|
+
}
|
|
3828
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
3829
|
+
const currCellHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
3830
|
+
const tableRect = tableEl.getBoundingClientRect();
|
|
3831
|
+
const trRect = trEl.getBoundingClientRect();
|
|
3832
|
+
const targetOffsetY = dragClientY - trRect.y - trEl.clientHeight;
|
|
3833
|
+
let resizeHeight = currCellHeight;
|
|
3834
|
+
const cellEl = tdEl.querySelector('.vxe-cell');
|
|
3835
|
+
let cellMinHeight = 0;
|
|
3836
|
+
if (cellEl) {
|
|
3837
|
+
const cellStyle = getComputedStyle(cellEl);
|
|
3838
|
+
cellMinHeight = Math.max(1, Math.ceil(XEUtils.toNumber(cellStyle.paddingTop) + XEUtils.toNumber(cellStyle.paddingBottom)));
|
|
3839
|
+
}
|
|
3840
|
+
const minTop = trRect.y - tableRect.y + cellMinHeight;
|
|
3841
|
+
// 处理拖动事件
|
|
3842
|
+
const updateEvent = (evnt) => {
|
|
3843
|
+
evnt.stopPropagation();
|
|
3844
|
+
evnt.preventDefault();
|
|
3845
|
+
const tableWidth = tableEl.clientWidth - osbWidth;
|
|
3846
|
+
const tableHeight = tableEl.clientHeight - osbHeight;
|
|
3847
|
+
let dragTop = evnt.clientY - tableRect.y - targetOffsetY;
|
|
3848
|
+
if (dragTop < minTop) {
|
|
3849
|
+
dragTop = minTop;
|
|
3850
|
+
}
|
|
3851
|
+
else {
|
|
3852
|
+
resizeHeight = Math.max(cellMinHeight, currCellHeight + evnt.clientY - dragClientY);
|
|
3853
|
+
}
|
|
3854
|
+
resizeBarElem.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
|
|
3855
|
+
resizeBarElem.style.top = `${dragTop}px`;
|
|
3856
|
+
resizeBarElem.style.width = `${tableWidth}px`;
|
|
3857
|
+
if (resizableOpts.showDragTip && resizeTipElem) {
|
|
3858
|
+
resizeTipElem.textContent = getI18n('vxe.table.resizeRowTip', [resizeHeight]);
|
|
3859
|
+
const resizeTipWidth = resizeTipElem.clientWidth;
|
|
3860
|
+
const resizeTipHeight = resizeTipElem.clientHeight;
|
|
3861
|
+
let resizeBarLeft = Math.max(2, evnt.clientX - tableRect.x);
|
|
3862
|
+
let resizeBarTop = 0;
|
|
3863
|
+
if (resizeBarLeft + resizeTipWidth >= tableWidth - 2) {
|
|
3864
|
+
resizeBarLeft = tableWidth - resizeTipWidth - 2;
|
|
3865
|
+
}
|
|
3866
|
+
if (dragTop + resizeTipHeight >= tableHeight) {
|
|
3867
|
+
resizeBarTop = tableHeight - (dragTop + resizeTipHeight);
|
|
3868
|
+
}
|
|
3869
|
+
resizeTipElem.style.left = `${resizeBarLeft}px`;
|
|
3870
|
+
resizeTipElem.style.top = `${resizeBarTop}px`;
|
|
3871
|
+
}
|
|
3872
|
+
reactData.isDragResize = true;
|
|
3873
|
+
};
|
|
3874
|
+
reactData.isDragResize = true;
|
|
3875
|
+
addClass(tableEl, 'row-drag--resize');
|
|
3876
|
+
resizeBarElem.style.display = 'block';
|
|
3877
|
+
document.onmousemove = updateEvent;
|
|
3878
|
+
document.onmouseup = function (evnt) {
|
|
3879
|
+
document.onmousemove = null;
|
|
3880
|
+
document.onmouseup = null;
|
|
3881
|
+
resizeBarElem.style.display = 'none';
|
|
3882
|
+
internalData._lastResizeTime = Date.now();
|
|
3883
|
+
setTimeout(() => {
|
|
3884
|
+
reactData.isDragResize = false;
|
|
3885
|
+
}, 50);
|
|
3886
|
+
if (resizeHeight !== currCellHeight) {
|
|
3887
|
+
const resizeParams = Object.assign(Object.assign({}, params), { resizeHeight, resizeRow: row });
|
|
3888
|
+
internalData.isResizeCellHeight = true;
|
|
3889
|
+
if ($xeTable.handleRowResizeCellAreaEvent) {
|
|
3890
|
+
$xeTable.handleRowResizeCellAreaEvent(evnt, resizeParams);
|
|
3891
|
+
}
|
|
3892
|
+
else {
|
|
3893
|
+
rowRest.resizeHeight = resizeHeight;
|
|
3894
|
+
handleUpdateRowResize($xeTable, evnt, resizeParams);
|
|
3895
|
+
}
|
|
3896
|
+
}
|
|
3897
|
+
removeClass(tableEl, 'row-drag--resize');
|
|
3898
|
+
};
|
|
3899
|
+
updateEvent(evnt);
|
|
3900
|
+
},
|
|
3901
|
+
handleRowResizeDblclickEvent(evnt, params) {
|
|
3902
|
+
const $xeTable = this;
|
|
3903
|
+
const reactData = $xeTable;
|
|
3904
|
+
const internalData = $xeTable;
|
|
3905
|
+
const resizableOpts = $xeTable.computeResizableOpts;
|
|
3906
|
+
const { isDblclickAutoHeight } = resizableOpts;
|
|
3907
|
+
const el = $xeTable.$refs.refElem;
|
|
3908
|
+
if (isDblclickAutoHeight && el) {
|
|
3909
|
+
evnt.stopPropagation();
|
|
3910
|
+
evnt.preventDefault();
|
|
3911
|
+
const { editStore } = reactData;
|
|
3912
|
+
const { fullAllDataRowIdData } = internalData;
|
|
3913
|
+
const { actived } = editStore;
|
|
3914
|
+
const { row } = params;
|
|
3915
|
+
const rowid = getRowid($xeTable, row);
|
|
3916
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
3917
|
+
if (!rowRest) {
|
|
3918
|
+
return;
|
|
3919
|
+
}
|
|
3920
|
+
const handleRsHeight = () => {
|
|
3921
|
+
const resizeHeight = calcCellAutoHeight(rowRest, el);
|
|
3922
|
+
const resizeParams = Object.assign(Object.assign({}, params), { resizeHeight, resizeRow: row });
|
|
3923
|
+
reactData.isDragResize = false;
|
|
3924
|
+
internalData._lastResizeTime = Date.now();
|
|
3925
|
+
if ($xeTable.handleRowResizeDblclickCellAreaEvent) {
|
|
3926
|
+
$xeTable.handleRowResizeDblclickCellAreaEvent(evnt, resizeParams);
|
|
3927
|
+
}
|
|
3928
|
+
else {
|
|
3929
|
+
rowRest.resizeHeight = resizeHeight;
|
|
3930
|
+
handleUpdateRowResize($xeTable, evnt, resizeParams);
|
|
3931
|
+
}
|
|
3932
|
+
};
|
|
3933
|
+
if (actived.row || actived.column) {
|
|
3934
|
+
$xeTable.clearEdit().then(handleRsHeight);
|
|
3935
|
+
}
|
|
3936
|
+
else {
|
|
3937
|
+
handleRsHeight();
|
|
3938
|
+
}
|
|
3939
|
+
}
|
|
3940
|
+
},
|
|
3941
|
+
setRowHeightConf(heightConf) {
|
|
3942
|
+
const $xeTable = this;
|
|
3943
|
+
const reactData = $xeTable;
|
|
3944
|
+
const internalData = $xeTable;
|
|
3945
|
+
const { fullAllDataRowIdData } = internalData;
|
|
3946
|
+
let status = false;
|
|
3947
|
+
if (heightConf) {
|
|
3948
|
+
XEUtils.each(heightConf, (height, rowid) => {
|
|
3949
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
3950
|
+
if (rowRest) {
|
|
3951
|
+
const rHeight = XEUtils.toInteger(height);
|
|
3952
|
+
if (rHeight) {
|
|
3953
|
+
rowRest.resizeHeight = rHeight;
|
|
3954
|
+
if (!status) {
|
|
3955
|
+
status = true;
|
|
3956
|
+
}
|
|
3957
|
+
}
|
|
3958
|
+
}
|
|
3959
|
+
});
|
|
3960
|
+
if (status) {
|
|
3961
|
+
internalData.isResizeCellHeight = true;
|
|
3962
|
+
reactData.resizeHeightFlag++;
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3965
|
+
return $xeTable.$nextTick().then(() => {
|
|
3966
|
+
return { status };
|
|
3967
|
+
});
|
|
3968
|
+
},
|
|
3969
|
+
getRowHeightConf(isFull) {
|
|
3970
|
+
const $xeTable = this;
|
|
3971
|
+
const internalData = $xeTable;
|
|
3972
|
+
const { fullAllDataRowIdData, afterFullData } = internalData;
|
|
3973
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
3974
|
+
const cellOpts = $xeTable.computeCellOpts;
|
|
3975
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
3976
|
+
const rest = {};
|
|
3977
|
+
afterFullData.forEach(row => {
|
|
3978
|
+
const rowid = getRowid($xeTable, row);
|
|
3979
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
3980
|
+
if (rowRest) {
|
|
3981
|
+
const resizeHeight = rowRest.resizeHeight;
|
|
3982
|
+
if (resizeHeight || isFull) {
|
|
3983
|
+
const currCellHeight = resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
3984
|
+
rest[rowid] = currCellHeight;
|
|
3985
|
+
}
|
|
3986
|
+
}
|
|
3987
|
+
});
|
|
3988
|
+
return rest;
|
|
3989
|
+
},
|
|
3990
|
+
setRowHeight(rowOrId, height) {
|
|
3991
|
+
const $xeTable = this;
|
|
3992
|
+
const reactData = $xeTable;
|
|
3993
|
+
const internalData = $xeTable;
|
|
3994
|
+
const { fullAllDataRowIdData } = internalData;
|
|
3995
|
+
let status = false;
|
|
3996
|
+
const rows = XEUtils.isArray(rowOrId) ? rowOrId : [rowOrId];
|
|
3997
|
+
let rHeight = XEUtils.toInteger(height);
|
|
3998
|
+
if (isScale(height)) {
|
|
3999
|
+
const tableBody = $xeTable.$refs.refTableBody;
|
|
4000
|
+
const bodyElem = tableBody ? tableBody.$el : null;
|
|
4001
|
+
const bodyHeight = bodyElem ? bodyElem.clientHeight - 1 : 0;
|
|
4002
|
+
rHeight = Math.floor(rHeight * bodyHeight);
|
|
4003
|
+
}
|
|
4004
|
+
if (rHeight) {
|
|
4005
|
+
rows.forEach(row => {
|
|
4006
|
+
const rowid = XEUtils.isString(row) || XEUtils.isNumber(row) ? row : getRowid($xeTable, row);
|
|
4007
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
4008
|
+
if (rowRest) {
|
|
4009
|
+
rowRest.resizeHeight = rHeight;
|
|
4010
|
+
if (!status) {
|
|
4011
|
+
status = true;
|
|
4012
|
+
}
|
|
4013
|
+
}
|
|
3499
4014
|
});
|
|
4015
|
+
if (status) {
|
|
4016
|
+
internalData.isResizeCellHeight = true;
|
|
4017
|
+
reactData.resizeHeightFlag++;
|
|
4018
|
+
}
|
|
4019
|
+
}
|
|
4020
|
+
return $xeTable.$nextTick();
|
|
4021
|
+
},
|
|
4022
|
+
getRowHeight(rowOrId) {
|
|
4023
|
+
const $xeTable = this;
|
|
4024
|
+
const internalData = $xeTable;
|
|
4025
|
+
const { fullAllDataRowIdData } = internalData;
|
|
4026
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
4027
|
+
const cellOpts = $xeTable.computeCellOpts;
|
|
4028
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
4029
|
+
const rowid = XEUtils.isString(rowOrId) || XEUtils.isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId);
|
|
4030
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
4031
|
+
if (rowRest) {
|
|
4032
|
+
return rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
3500
4033
|
}
|
|
4034
|
+
return 0;
|
|
3501
4035
|
},
|
|
3502
4036
|
/**
|
|
3503
4037
|
* 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
|
|
@@ -3878,10 +4412,10 @@ const Methods = {
|
|
|
3878
4412
|
}
|
|
3879
4413
|
else if (isContextMenu) {
|
|
3880
4414
|
// 如果按下上下文键
|
|
3881
|
-
|
|
4415
|
+
internalData._keyCtx = selected.row && selected.column && bodyCtxMenu.length;
|
|
3882
4416
|
clearTimeout(internalData.keyCtxTimeout);
|
|
3883
4417
|
internalData.keyCtxTimeout = setTimeout(() => {
|
|
3884
|
-
|
|
4418
|
+
internalData._keyCtx = false;
|
|
3885
4419
|
}, 1000);
|
|
3886
4420
|
}
|
|
3887
4421
|
else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow))) {
|
|
@@ -4130,50 +4664,42 @@ const Methods = {
|
|
|
4130
4664
|
this.updateCellAreas();
|
|
4131
4665
|
this.recalculate(true);
|
|
4132
4666
|
},
|
|
4133
|
-
handleTargetEnterEvent(isClear) {
|
|
4134
|
-
const $tooltip = this.$refs.tooltip;
|
|
4135
|
-
clearTimeout(this.tooltipTimeout);
|
|
4136
|
-
if (isClear) {
|
|
4137
|
-
this.closeTooltip();
|
|
4138
|
-
}
|
|
4139
|
-
else {
|
|
4140
|
-
if ($tooltip) {
|
|
4141
|
-
$tooltip.setActived(true);
|
|
4142
|
-
}
|
|
4143
|
-
}
|
|
4144
|
-
},
|
|
4145
4667
|
handleTargetLeaveEvent() {
|
|
4146
|
-
const
|
|
4147
|
-
|
|
4148
|
-
|
|
4668
|
+
const $xeTable = this;
|
|
4669
|
+
const internalData = $xeTable;
|
|
4670
|
+
const tooltipOpts = $xeTable.computeTooltipOpts;
|
|
4671
|
+
let $tooltip = $xeTable.$refs.refTooltip;
|
|
4672
|
+
if ($tooltip && $tooltip.setActived) {
|
|
4149
4673
|
$tooltip.setActived(false);
|
|
4150
4674
|
}
|
|
4151
4675
|
if (tooltipOpts.enterable) {
|
|
4152
|
-
|
|
4153
|
-
$tooltip =
|
|
4154
|
-
if ($tooltip && !$tooltip.isActived()) {
|
|
4155
|
-
|
|
4676
|
+
internalData.tooltipTimeout = setTimeout(() => {
|
|
4677
|
+
$tooltip = $xeTable.$refs.refTooltip;
|
|
4678
|
+
if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
|
|
4679
|
+
$xeTable.closeTooltip();
|
|
4156
4680
|
}
|
|
4157
4681
|
}, tooltipOpts.leaveDelay);
|
|
4158
4682
|
}
|
|
4159
4683
|
else {
|
|
4160
|
-
|
|
4684
|
+
$xeTable.closeTooltip();
|
|
4161
4685
|
}
|
|
4162
4686
|
},
|
|
4163
4687
|
triggerHeaderTitleEvent(evnt, iconParams, params) {
|
|
4688
|
+
const $xeTable = this;
|
|
4689
|
+
const reactData = $xeTable;
|
|
4164
4690
|
const tipContent = iconParams.content || iconParams.message;
|
|
4165
4691
|
if (tipContent) {
|
|
4166
|
-
const {
|
|
4692
|
+
const { tooltipStore } = reactData;
|
|
4167
4693
|
const { column } = params;
|
|
4168
4694
|
const content = getFuncText(tipContent);
|
|
4169
|
-
|
|
4695
|
+
handleTargetEnterEvent($xeTable, true);
|
|
4170
4696
|
tooltipStore.row = null;
|
|
4171
4697
|
tooltipStore.column = column;
|
|
4172
4698
|
tooltipStore.visible = true;
|
|
4173
4699
|
tooltipStore.currOpts = iconParams;
|
|
4174
|
-
|
|
4175
|
-
const $tooltip = $refs.
|
|
4176
|
-
if ($tooltip) {
|
|
4700
|
+
$xeTable.$nextTick(() => {
|
|
4701
|
+
const $tooltip = $xeTable.$refs.refTooltip;
|
|
4702
|
+
if ($tooltip && $tooltip.open) {
|
|
4177
4703
|
$tooltip.open(evnt.currentTarget, content);
|
|
4178
4704
|
}
|
|
4179
4705
|
});
|
|
@@ -4183,23 +4709,42 @@ const Methods = {
|
|
|
4183
4709
|
* 触发表头 tooltip 事件
|
|
4184
4710
|
*/
|
|
4185
4711
|
triggerHeaderTooltipEvent(evnt, params) {
|
|
4186
|
-
const
|
|
4712
|
+
const $xeTable = this;
|
|
4713
|
+
const reactData = $xeTable;
|
|
4714
|
+
const { tooltipStore } = reactData;
|
|
4187
4715
|
const { column } = params;
|
|
4716
|
+
handleTargetEnterEvent($xeTable, true);
|
|
4188
4717
|
const titleElem = evnt.currentTarget;
|
|
4189
|
-
|
|
4718
|
+
if (!titleElem) {
|
|
4719
|
+
return;
|
|
4720
|
+
}
|
|
4721
|
+
const cellEl = titleElem.parentElement;
|
|
4722
|
+
if (!cellEl) {
|
|
4723
|
+
return;
|
|
4724
|
+
}
|
|
4725
|
+
const thEl = cellEl.parentElement;
|
|
4726
|
+
if (!thEl) {
|
|
4727
|
+
return;
|
|
4728
|
+
}
|
|
4190
4729
|
if (tooltipStore.column !== column || !tooltipStore.visible) {
|
|
4191
|
-
|
|
4730
|
+
handleTooltip($xeTable, evnt, thEl, cellEl, null, params);
|
|
4192
4731
|
}
|
|
4193
4732
|
},
|
|
4194
4733
|
/**
|
|
4195
4734
|
* 触发单元格 tooltip 事件
|
|
4196
4735
|
*/
|
|
4197
4736
|
triggerBodyTooltipEvent(evnt, params) {
|
|
4198
|
-
const
|
|
4737
|
+
const $xeTable = this;
|
|
4738
|
+
const props = $xeTable;
|
|
4739
|
+
const reactData = $xeTable;
|
|
4740
|
+
const { editConfig } = props;
|
|
4741
|
+
const { editStore } = reactData;
|
|
4742
|
+
const { tooltipStore } = reactData;
|
|
4743
|
+
const editOpts = $xeTable.computeEditOpts;
|
|
4199
4744
|
const { actived } = editStore;
|
|
4200
4745
|
const { row, column } = params;
|
|
4201
|
-
const
|
|
4202
|
-
|
|
4746
|
+
const tdEl = evnt.currentTarget;
|
|
4747
|
+
handleTargetEnterEvent($xeTable, tooltipStore.column !== column || tooltipStore.row !== row);
|
|
4203
4748
|
// 单元格处于编辑状态时不触发提示框
|
|
4204
4749
|
if (column.editRender && isEnableConf(editConfig)) {
|
|
4205
4750
|
// 如果是行编辑模式
|
|
@@ -4212,67 +4757,23 @@ const Methods = {
|
|
|
4212
4757
|
}
|
|
4213
4758
|
}
|
|
4214
4759
|
if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
|
|
4215
|
-
|
|
4216
|
-
let tipElem;
|
|
4217
|
-
if (column.treeNode) {
|
|
4218
|
-
overflowElem = cell.querySelector('.vxe-tree-cell');
|
|
4219
|
-
if (column.type === 'html') {
|
|
4220
|
-
tipElem = cell.querySelector('.vxe-cell--html');
|
|
4221
|
-
}
|
|
4222
|
-
}
|
|
4223
|
-
else {
|
|
4224
|
-
tipElem = cell.querySelector(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label');
|
|
4225
|
-
}
|
|
4226
|
-
this.handleTooltip(evnt, cell, overflowElem || cell.children[0], tipElem, params);
|
|
4760
|
+
handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--wrapper'), null, params);
|
|
4227
4761
|
}
|
|
4228
4762
|
},
|
|
4229
4763
|
/**
|
|
4230
4764
|
* 触发表尾 tooltip 事件
|
|
4231
4765
|
*/
|
|
4232
4766
|
triggerFooterTooltipEvent(evnt, params) {
|
|
4767
|
+
const $xeTable = this;
|
|
4768
|
+
const reactData = $xeTable;
|
|
4233
4769
|
const { column } = params;
|
|
4234
|
-
const { tooltipStore } =
|
|
4770
|
+
const { tooltipStore } = reactData;
|
|
4235
4771
|
const cell = evnt.currentTarget;
|
|
4236
|
-
|
|
4772
|
+
handleTargetEnterEvent($xeTable, tooltipStore.column !== column || !!tooltipStore.row);
|
|
4237
4773
|
if (tooltipStore.column !== column || !tooltipStore.visible) {
|
|
4238
|
-
|
|
4774
|
+
handleTooltip($xeTable, evnt, cell, cell.querySelector('.vxe-cell--wrapper') || cell.children[0], null, params);
|
|
4239
4775
|
}
|
|
4240
4776
|
},
|
|
4241
|
-
/**
|
|
4242
|
-
* 处理显示 tooltip
|
|
4243
|
-
* @param {Event} evnt 事件
|
|
4244
|
-
* @param {ColumnInfo} column 列配置
|
|
4245
|
-
* @param {Row} row 行对象
|
|
4246
|
-
*/
|
|
4247
|
-
handleTooltip(evnt, cell, overflowElem, tipElem, params) {
|
|
4248
|
-
const $xeTable = this;
|
|
4249
|
-
if (!overflowElem) {
|
|
4250
|
-
return $xeTable.$nextTick();
|
|
4251
|
-
}
|
|
4252
|
-
params.cell = cell;
|
|
4253
|
-
const { $refs, tooltipOpts, tooltipStore } = this;
|
|
4254
|
-
const { column, row } = params;
|
|
4255
|
-
const { showAll, enabled, contentMethod } = tooltipOpts;
|
|
4256
|
-
const customContent = contentMethod ? contentMethod(params) : null;
|
|
4257
|
-
const useCustom = contentMethod && !XEUtils.eqNull(customContent);
|
|
4258
|
-
const content = useCustom ? customContent : (column.type === 'html' ? overflowElem.innerText : overflowElem.textContent).trim();
|
|
4259
|
-
const isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth;
|
|
4260
|
-
if (content && (showAll || enabled || useCustom || isCellOverflow)) {
|
|
4261
|
-
Object.assign(tooltipStore, {
|
|
4262
|
-
row,
|
|
4263
|
-
column,
|
|
4264
|
-
visible: true,
|
|
4265
|
-
currOpts: {}
|
|
4266
|
-
});
|
|
4267
|
-
this.$nextTick(() => {
|
|
4268
|
-
const $tooltip = $refs.tooltip;
|
|
4269
|
-
if ($tooltip) {
|
|
4270
|
-
$tooltip.open(isCellOverflow ? overflowElem : (tipElem || overflowElem), formatText(content));
|
|
4271
|
-
}
|
|
4272
|
-
});
|
|
4273
|
-
}
|
|
4274
|
-
return this.$nextTick();
|
|
4275
|
-
},
|
|
4276
4777
|
openTooltip(target, content) {
|
|
4277
4778
|
const { $refs } = this;
|
|
4278
4779
|
const commTip = $refs.refCommTooltip;
|
|
@@ -4285,9 +4786,11 @@ const Methods = {
|
|
|
4285
4786
|
* 关闭 tooltip
|
|
4286
4787
|
*/
|
|
4287
4788
|
closeTooltip() {
|
|
4288
|
-
const
|
|
4289
|
-
const
|
|
4290
|
-
const
|
|
4789
|
+
const $xeTable = this;
|
|
4790
|
+
const reactData = $xeTable;
|
|
4791
|
+
const { tooltipStore } = reactData;
|
|
4792
|
+
const tooltip = $xeTable.$refs.refTooltip;
|
|
4793
|
+
const commTip = $xeTable.$refs.refCommTooltip;
|
|
4291
4794
|
if (tooltipStore.visible) {
|
|
4292
4795
|
Object.assign(tooltipStore, {
|
|
4293
4796
|
row: null,
|
|
@@ -5289,20 +5792,24 @@ const Methods = {
|
|
|
5289
5792
|
this.hoverRow = null;
|
|
5290
5793
|
},
|
|
5291
5794
|
triggerHeaderCellClickEvent(evnt, params) {
|
|
5292
|
-
const
|
|
5795
|
+
const $xeTable = this;
|
|
5796
|
+
const internalData = $xeTable;
|
|
5797
|
+
const { _lastResizeTime } = internalData;
|
|
5798
|
+
const sortOpts = $xeTable.computeSortOpts;
|
|
5799
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
5293
5800
|
const { column } = params;
|
|
5294
5801
|
const cell = evnt.currentTarget;
|
|
5295
5802
|
const triggerResizable = _lastResizeTime && _lastResizeTime > Date.now() - 300;
|
|
5296
5803
|
const triggerSort = getEventTargetNode(evnt, cell, 'vxe-cell--sort').flag;
|
|
5297
5804
|
const triggerFilter = getEventTargetNode(evnt, cell, 'vxe-cell--filter').flag;
|
|
5298
5805
|
if (sortOpts.trigger === 'cell' && !(triggerResizable || triggerSort || triggerFilter)) {
|
|
5299
|
-
|
|
5806
|
+
$xeTable.triggerSortEvent(evnt, column, getNextSortOrder($xeTable, column));
|
|
5300
5807
|
}
|
|
5301
|
-
|
|
5302
|
-
if (
|
|
5303
|
-
|
|
5808
|
+
$xeTable.dispatchEvent('header-cell-click', Object.assign({ triggerResizable, triggerSort, triggerFilter, cell }, params), evnt);
|
|
5809
|
+
if (columnOpts.isCurrent || $xeTable.highlightCurrentColumn) {
|
|
5810
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params);
|
|
5304
5811
|
}
|
|
5305
|
-
return
|
|
5812
|
+
return $xeTable.$nextTick();
|
|
5306
5813
|
},
|
|
5307
5814
|
triggerHeaderCellDblclickEvent(evnt, params) {
|
|
5308
5815
|
this.emitEvent('header-cell-dblclick', Object.assign({ cell: evnt.currentTarget }, params), evnt);
|
|
@@ -5356,7 +5863,20 @@ const Methods = {
|
|
|
5356
5863
|
*/
|
|
5357
5864
|
triggerCellClickEvent(evnt, params) {
|
|
5358
5865
|
const $xeTable = this;
|
|
5359
|
-
const
|
|
5866
|
+
const props = $xeTable;
|
|
5867
|
+
const reactData = $xeTable;
|
|
5868
|
+
const { highlightCurrentRow, editConfig } = props;
|
|
5869
|
+
const { editStore, isDragResize } = reactData;
|
|
5870
|
+
if (isDragResize) {
|
|
5871
|
+
return;
|
|
5872
|
+
}
|
|
5873
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
5874
|
+
const editOpts = $xeTable.computeEditOpts;
|
|
5875
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
5876
|
+
const radioOpts = $xeTable.computeRadioOpts;
|
|
5877
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
5878
|
+
const keyboardOpts = $xeTable.computeKeyboardOpts;
|
|
5879
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
5360
5880
|
const { actived, focused } = editStore;
|
|
5361
5881
|
const { row, column } = params;
|
|
5362
5882
|
const { type, treeNode } = column;
|
|
@@ -5443,7 +5963,15 @@ const Methods = {
|
|
|
5443
5963
|
* 如果是双击模式,则激活为编辑状态
|
|
5444
5964
|
*/
|
|
5445
5965
|
triggerCellDblclickEvent(evnt, params) {
|
|
5446
|
-
const
|
|
5966
|
+
const $xeTable = this;
|
|
5967
|
+
const props = $xeTable;
|
|
5968
|
+
const reactData = $xeTable;
|
|
5969
|
+
const { editConfig } = props;
|
|
5970
|
+
const { editStore, isDragResize } = reactData;
|
|
5971
|
+
if (isDragResize) {
|
|
5972
|
+
return;
|
|
5973
|
+
}
|
|
5974
|
+
const editOpts = $xeTable.computeEditOpts;
|
|
5447
5975
|
const { actived } = editStore;
|
|
5448
5976
|
const cell = evnt.currentTarget;
|
|
5449
5977
|
params = Object.assign({ cell }, params);
|
|
@@ -5512,10 +6040,13 @@ const Methods = {
|
|
|
5512
6040
|
triggerSortEvent(evnt, column, order) {
|
|
5513
6041
|
const $xeTable = this;
|
|
5514
6042
|
const sortOpts = $xeTable.computeSortOpts;
|
|
6043
|
+
const { multiple, allowClear } = sortOpts;
|
|
5515
6044
|
const { field, sortable, remoteSort } = column;
|
|
5516
6045
|
if (sortable || remoteSort) {
|
|
5517
6046
|
if (!order || column.order === order) {
|
|
5518
|
-
|
|
6047
|
+
if (allowClear) {
|
|
6048
|
+
$xeTable.clearSort(multiple ? column : null);
|
|
6049
|
+
}
|
|
5519
6050
|
}
|
|
5520
6051
|
else {
|
|
5521
6052
|
$xeTable.sort({ field, order });
|
|
@@ -5616,7 +6147,7 @@ const Methods = {
|
|
|
5616
6147
|
const { treeConfig, dragConfig } = props;
|
|
5617
6148
|
const rowDragOpts = $xeTable.computeRowDragOpts;
|
|
5618
6149
|
const { fullAllDataRowIdData } = internalData;
|
|
5619
|
-
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod } = rowDragOpts;
|
|
6150
|
+
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod, dragToChildMethod } = rowDragOpts;
|
|
5620
6151
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
5621
6152
|
const { transform, rowField, mapChildrenField, parentField } = treeOpts;
|
|
5622
6153
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
@@ -5626,15 +6157,15 @@ const Methods = {
|
|
|
5626
6157
|
if (prevDragRow && dragRow) {
|
|
5627
6158
|
// 判断是否有拖动
|
|
5628
6159
|
if (prevDragRow !== dragRow) {
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
6160
|
+
const dragParams = {
|
|
6161
|
+
oldRow: dragRow,
|
|
6162
|
+
newRow: prevDragRow,
|
|
6163
|
+
dragPos: prevDragPos,
|
|
6164
|
+
dragToChild: !!prevDragToChild,
|
|
6165
|
+
offsetIndex: dragOffsetIndex
|
|
6166
|
+
};
|
|
6167
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
6168
|
+
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
5638
6169
|
if (!status) {
|
|
5639
6170
|
return;
|
|
5640
6171
|
}
|
|
@@ -5709,7 +6240,11 @@ const Methods = {
|
|
|
5709
6240
|
else {
|
|
5710
6241
|
// 根到根
|
|
5711
6242
|
}
|
|
5712
|
-
const fullList = XEUtils.toTreeArray(internalData.afterTreeFullData, {
|
|
6243
|
+
const fullList = XEUtils.toTreeArray(internalData.afterTreeFullData, {
|
|
6244
|
+
key: rowField,
|
|
6245
|
+
parentKey: parentField,
|
|
6246
|
+
children: mapChildrenField
|
|
6247
|
+
});
|
|
5713
6248
|
// 移出
|
|
5714
6249
|
const otfIndex = $xeTable.findRowIndexOf(fullList, dragRow);
|
|
5715
6250
|
fullList.splice(otfIndex, 1);
|
|
@@ -5723,12 +6258,12 @@ const Methods = {
|
|
|
5723
6258
|
childRow[parentField] = dragRow[parentField];
|
|
5724
6259
|
});
|
|
5725
6260
|
}
|
|
5726
|
-
dragRow[parentField] =
|
|
6261
|
+
dragRow[parentField] = isDragToChildFlag ? prevDragRow[rowField] : prevDragRow[parentField];
|
|
5727
6262
|
internalData.tableFullTreeData = XEUtils.toArrayTree(fullList, {
|
|
5728
|
-
key:
|
|
5729
|
-
parentKey:
|
|
6263
|
+
key: rowField,
|
|
6264
|
+
parentKey: parentField,
|
|
5730
6265
|
children: childrenField,
|
|
5731
|
-
mapChildren:
|
|
6266
|
+
mapChildren: mapChildrenField
|
|
5732
6267
|
});
|
|
5733
6268
|
}
|
|
5734
6269
|
}
|
|
@@ -5749,7 +6284,7 @@ const Methods = {
|
|
|
5749
6284
|
}
|
|
5750
6285
|
reactData.isDragRowMove = true;
|
|
5751
6286
|
$xeTable.handleTableData(treeConfig && transform);
|
|
5752
|
-
$xeTable.cacheRowMap();
|
|
6287
|
+
$xeTable.cacheRowMap(false);
|
|
5753
6288
|
updateScrollYStatus($xeTable);
|
|
5754
6289
|
if (!(treeConfig && transform)) {
|
|
5755
6290
|
updateAfterDataIndex($xeTable);
|
|
@@ -5766,7 +6301,7 @@ const Methods = {
|
|
|
5766
6301
|
oldRow: dragRow,
|
|
5767
6302
|
newRow: prevDragRow,
|
|
5768
6303
|
dragPos: prevDragPos,
|
|
5769
|
-
dragToChild:
|
|
6304
|
+
dragToChild: isDragToChildFlag,
|
|
5770
6305
|
offsetIndex: dragOffsetIndex,
|
|
5771
6306
|
_index: {
|
|
5772
6307
|
newIndex: nafIndex,
|
|
@@ -5791,20 +6326,18 @@ const Methods = {
|
|
|
5791
6326
|
const { lazy } = treeOpts;
|
|
5792
6327
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
5793
6328
|
const { prevDragRow, prevDragPos } = internalData;
|
|
5794
|
-
if (treeConfig && prevDragToChild) {
|
|
6329
|
+
if (treeConfig && lazy && prevDragToChild) {
|
|
5795
6330
|
// 懒加载
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
if (
|
|
5800
|
-
if (rowRest && rowRest.treeLoaded) {
|
|
5801
|
-
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
5802
|
-
}
|
|
5803
|
-
}
|
|
5804
|
-
else {
|
|
6331
|
+
const newRowid = getRowid($xeTable, prevDragRow);
|
|
6332
|
+
const rowRest = fullAllDataRowIdData[newRowid];
|
|
6333
|
+
if (prevDragRow[hasChildField]) {
|
|
6334
|
+
if (rowRest && rowRest.treeLoaded) {
|
|
5805
6335
|
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
5806
6336
|
}
|
|
5807
6337
|
}
|
|
6338
|
+
else {
|
|
6339
|
+
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
6340
|
+
}
|
|
5808
6341
|
}
|
|
5809
6342
|
else {
|
|
5810
6343
|
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
@@ -5921,7 +6454,7 @@ const Methods = {
|
|
|
5921
6454
|
const internalData = $xeTable;
|
|
5922
6455
|
const { mouseConfig } = props;
|
|
5923
6456
|
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
5924
|
-
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts;
|
|
6457
|
+
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts;
|
|
5925
6458
|
const { collectColumn } = internalData;
|
|
5926
6459
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
|
|
5927
6460
|
if (prevDragCol && dragCol) {
|
|
@@ -5929,15 +6462,15 @@ const Methods = {
|
|
|
5929
6462
|
if (prevDragCol !== dragCol) {
|
|
5930
6463
|
const oldColumn = dragCol;
|
|
5931
6464
|
const newColumn = prevDragCol;
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
6465
|
+
const dragParams = {
|
|
6466
|
+
oldColumn,
|
|
6467
|
+
newColumn,
|
|
6468
|
+
dragPos: prevDragPos,
|
|
6469
|
+
dragToChild: !!prevDragToChild,
|
|
6470
|
+
offsetIndex: dragOffsetIndex
|
|
6471
|
+
};
|
|
6472
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
6473
|
+
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
5941
6474
|
if (!status) {
|
|
5942
6475
|
return;
|
|
5943
6476
|
}
|
|
@@ -6027,7 +6560,7 @@ const Methods = {
|
|
|
6027
6560
|
if (newMatchRest) {
|
|
6028
6561
|
const { items: nCols, index: nIndex, parent: nParent } = newMatchRest;
|
|
6029
6562
|
// 转子级
|
|
6030
|
-
if ((isCrossDrag && isToChildDrag) &&
|
|
6563
|
+
if ((isCrossDrag && isToChildDrag) && isDragToChildFlag) {
|
|
6031
6564
|
oldColumn.parentId = newColumn.id;
|
|
6032
6565
|
newColumn.children = (newColumn.children || []).concat([oldColumn]);
|
|
6033
6566
|
}
|
|
@@ -6059,7 +6592,7 @@ const Methods = {
|
|
|
6059
6592
|
oldColumn,
|
|
6060
6593
|
newColumn,
|
|
6061
6594
|
dragPos: prevDragPos,
|
|
6062
|
-
dragToChild:
|
|
6595
|
+
dragToChild: isDragToChildFlag,
|
|
6063
6596
|
offsetIndex: dragOffsetIndex,
|
|
6064
6597
|
_index: {
|
|
6065
6598
|
newIndex: nafIndex,
|
|
@@ -7084,13 +7617,17 @@ const Methods = {
|
|
|
7084
7617
|
* 获取表格的滚动状态
|
|
7085
7618
|
*/
|
|
7086
7619
|
getScroll() {
|
|
7087
|
-
const
|
|
7088
|
-
const
|
|
7620
|
+
const $xeTable = this;
|
|
7621
|
+
const reactData = $xeTable;
|
|
7622
|
+
const internalData = $xeTable;
|
|
7623
|
+
const { scrollXLoad, scrollYLoad } = reactData;
|
|
7624
|
+
const { elemStore } = internalData;
|
|
7625
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
7089
7626
|
return {
|
|
7090
7627
|
virtualX: scrollXLoad,
|
|
7091
7628
|
virtualY: scrollYLoad,
|
|
7092
|
-
scrollTop:
|
|
7093
|
-
scrollLeft:
|
|
7629
|
+
scrollTop: bodyScrollElem ? bodyScrollElem.scrollTop : 0,
|
|
7630
|
+
scrollLeft: bodyScrollElem ? bodyScrollElem.scrollLeft : 0
|
|
7094
7631
|
};
|
|
7095
7632
|
},
|
|
7096
7633
|
handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, params) {
|
|
@@ -7190,46 +7727,6 @@ const Methods = {
|
|
|
7190
7727
|
}
|
|
7191
7728
|
$xeTable.dispatchEvent('scroll', evntParams, evnt);
|
|
7192
7729
|
},
|
|
7193
|
-
lazyScrollXData() {
|
|
7194
|
-
const $xeTable = this;
|
|
7195
|
-
const internalData = $xeTable;
|
|
7196
|
-
const { lxTimeout, lxRunTime, scrollXStore } = internalData;
|
|
7197
|
-
const { visibleSize } = scrollXStore;
|
|
7198
|
-
const fpsTime = Math.max(5, Math.min(80, Math.floor(visibleSize * 3)));
|
|
7199
|
-
if (lxTimeout) {
|
|
7200
|
-
clearTimeout(lxTimeout);
|
|
7201
|
-
}
|
|
7202
|
-
if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
|
|
7203
|
-
internalData.lxRunTime = Date.now();
|
|
7204
|
-
loadScrollXData($xeTable);
|
|
7205
|
-
}
|
|
7206
|
-
internalData.lxTimeout = setTimeout(() => {
|
|
7207
|
-
internalData.lxTimeout = undefined;
|
|
7208
|
-
internalData.lxRunTime = undefined;
|
|
7209
|
-
loadScrollXData($xeTable);
|
|
7210
|
-
}, fpsTime);
|
|
7211
|
-
},
|
|
7212
|
-
lazyScrollYData() {
|
|
7213
|
-
const $xeTable = this;
|
|
7214
|
-
const props = $xeTable;
|
|
7215
|
-
const internalData = $xeTable;
|
|
7216
|
-
const { showOverflow } = props;
|
|
7217
|
-
const { lyTimeout, lyRunTime, scrollYStore } = internalData;
|
|
7218
|
-
const { visibleSize } = scrollYStore;
|
|
7219
|
-
const fpsTime = showOverflow ? 5 : Math.max(5, Math.min(80, Math.floor(visibleSize / 2)));
|
|
7220
|
-
if (lyTimeout) {
|
|
7221
|
-
clearTimeout(lyTimeout);
|
|
7222
|
-
}
|
|
7223
|
-
if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
|
|
7224
|
-
internalData.lyRunTime = Date.now();
|
|
7225
|
-
loadScrollYData($xeTable);
|
|
7226
|
-
}
|
|
7227
|
-
internalData.lyTimeout = setTimeout(() => {
|
|
7228
|
-
internalData.lyTimeout = undefined;
|
|
7229
|
-
internalData.lyRunTime = undefined;
|
|
7230
|
-
loadScrollYData($xeTable);
|
|
7231
|
-
}, fpsTime);
|
|
7232
|
-
},
|
|
7233
7730
|
/**
|
|
7234
7731
|
* 横向 X 可视渲染事件处理
|
|
7235
7732
|
*/
|
|
@@ -7240,7 +7737,7 @@ const Methods = {
|
|
|
7240
7737
|
loadScrollXData($xeTable);
|
|
7241
7738
|
}
|
|
7242
7739
|
else {
|
|
7243
|
-
$xeTable
|
|
7740
|
+
lazyScrollXData($xeTable);
|
|
7244
7741
|
}
|
|
7245
7742
|
},
|
|
7246
7743
|
/**
|
|
@@ -7253,13 +7750,13 @@ const Methods = {
|
|
|
7253
7750
|
loadScrollYData($xeTable);
|
|
7254
7751
|
}
|
|
7255
7752
|
else {
|
|
7256
|
-
$xeTable
|
|
7753
|
+
lazyScrollYData($xeTable);
|
|
7257
7754
|
}
|
|
7258
7755
|
},
|
|
7259
7756
|
triggerBodyScrollEvent(evnt, fixedType) {
|
|
7260
7757
|
const $xeTable = this;
|
|
7261
7758
|
const internalData = $xeTable;
|
|
7262
|
-
const { elemStore, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData;
|
|
7759
|
+
const { elemStore, intoRunScroll, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData;
|
|
7263
7760
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
7264
7761
|
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
7265
7762
|
const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
|
|
@@ -7270,6 +7767,9 @@ const Methods = {
|
|
|
7270
7767
|
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
|
|
7271
7768
|
return;
|
|
7272
7769
|
}
|
|
7770
|
+
if (intoRunScroll) {
|
|
7771
|
+
return;
|
|
7772
|
+
}
|
|
7273
7773
|
if (!bodyScrollElem) {
|
|
7274
7774
|
return;
|
|
7275
7775
|
}
|
|
@@ -7330,22 +7830,16 @@ const Methods = {
|
|
|
7330
7830
|
triggerHeaderScrollEvent(evnt, fixedType) {
|
|
7331
7831
|
const $xeTable = this;
|
|
7332
7832
|
const internalData = $xeTable;
|
|
7333
|
-
const { elemStore, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
7833
|
+
const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
7334
7834
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
7335
7835
|
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
7336
7836
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
7337
7837
|
const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
|
|
7338
7838
|
const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
|
|
7339
|
-
if (inWheelScroll) {
|
|
7340
|
-
return;
|
|
7341
|
-
}
|
|
7342
|
-
if (inVirtualScroll) {
|
|
7343
|
-
return;
|
|
7344
|
-
}
|
|
7345
|
-
if (inBodyScroll) {
|
|
7839
|
+
if (inWheelScroll || inVirtualScroll || inBodyScroll || inFooterScroll) {
|
|
7346
7840
|
return;
|
|
7347
7841
|
}
|
|
7348
|
-
if (
|
|
7842
|
+
if (intoRunScroll) {
|
|
7349
7843
|
return;
|
|
7350
7844
|
}
|
|
7351
7845
|
if (!headerScrollElem) {
|
|
@@ -7374,22 +7868,16 @@ const Methods = {
|
|
|
7374
7868
|
triggerFooterScrollEvent(evnt, fixedType) {
|
|
7375
7869
|
const $xeTable = this;
|
|
7376
7870
|
const internalData = $xeTable;
|
|
7377
|
-
const { elemStore, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData;
|
|
7871
|
+
const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData;
|
|
7378
7872
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
7379
7873
|
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
7380
7874
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
7381
7875
|
const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
|
|
7382
7876
|
const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
|
|
7383
|
-
if (inWheelScroll) {
|
|
7384
|
-
return;
|
|
7385
|
-
}
|
|
7386
|
-
if (inVirtualScroll) {
|
|
7877
|
+
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inBodyScroll) {
|
|
7387
7878
|
return;
|
|
7388
7879
|
}
|
|
7389
|
-
if (
|
|
7390
|
-
return;
|
|
7391
|
-
}
|
|
7392
|
-
if (inBodyScroll) {
|
|
7880
|
+
if (intoRunScroll) {
|
|
7393
7881
|
return;
|
|
7394
7882
|
}
|
|
7395
7883
|
if (!footerScrollElem) {
|
|
@@ -7420,7 +7908,10 @@ const Methods = {
|
|
|
7420
7908
|
const tableProps = $xeTable;
|
|
7421
7909
|
const reactData = $xeTable;
|
|
7422
7910
|
const internalData = $xeTable;
|
|
7423
|
-
const { deltaY, deltaX } = evnt;
|
|
7911
|
+
const { target, deltaY, deltaX } = evnt;
|
|
7912
|
+
if (target && /^textarea$/i.test(target.tagName)) {
|
|
7913
|
+
return;
|
|
7914
|
+
}
|
|
7424
7915
|
const { highlightHoverRow } = tableProps;
|
|
7425
7916
|
const { elemStore, lastScrollTop, lastScrollLeft } = internalData;
|
|
7426
7917
|
const rowOpts = $xeTable.computeRowOpts;
|
|
@@ -7438,31 +7929,13 @@ const Methods = {
|
|
|
7438
7929
|
if (!bodyScrollElem) {
|
|
7439
7930
|
return;
|
|
7440
7931
|
}
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
}
|
|
7445
|
-
else if (reactData.lastScrollTime + 30 > Date.now()) {
|
|
7446
|
-
multiple = 1.15;
|
|
7447
|
-
}
|
|
7448
|
-
else if (reactData.lastScrollTime + 40 > Date.now()) {
|
|
7449
|
-
multiple = 1.12;
|
|
7450
|
-
}
|
|
7451
|
-
else if (reactData.lastScrollTime + 55 > Date.now()) {
|
|
7452
|
-
multiple = 1.09;
|
|
7453
|
-
}
|
|
7454
|
-
else if (reactData.lastScrollTime + 75 > Date.now()) {
|
|
7455
|
-
multiple = 1.06;
|
|
7456
|
-
}
|
|
7457
|
-
else if (reactData.lastScrollTime + 100 > Date.now()) {
|
|
7458
|
-
multiple = 1.03;
|
|
7459
|
-
}
|
|
7460
|
-
const deltaTop = deltaY * multiple;
|
|
7461
|
-
const deltaLeft = deltaX * multiple;
|
|
7932
|
+
const wheelSpeed = getWheelSpeed(reactData.lastScrollTime);
|
|
7933
|
+
const deltaTop = deltaY * wheelSpeed;
|
|
7934
|
+
const deltaLeft = deltaX * wheelSpeed;
|
|
7462
7935
|
const isTopWheel = deltaTop < 0;
|
|
7463
|
-
const currScrollTop =
|
|
7936
|
+
const currScrollTop = bodyScrollElem.scrollTop;
|
|
7464
7937
|
// 如果滚动位置已经是顶部或底部,则不需要触发
|
|
7465
|
-
if (isTopWheel ? currScrollTop <= 0 : currScrollTop >=
|
|
7938
|
+
if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= bodyScrollElem.scrollHeight - bodyScrollElem.clientHeight) {
|
|
7466
7939
|
return;
|
|
7467
7940
|
}
|
|
7468
7941
|
const scrollTop = bodyScrollElem.scrollTop + deltaTop;
|
|
@@ -7475,16 +7948,29 @@ const Methods = {
|
|
|
7475
7948
|
if (rowOpts.isHover || highlightHoverRow) {
|
|
7476
7949
|
$xeTable.clearHoverRow();
|
|
7477
7950
|
}
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7951
|
+
wheelScrollTo(scrollTop - bodyScrollElem.scrollTop, (offsetTop) => {
|
|
7952
|
+
const currTopNum = bodyScrollElem.scrollTop + offsetTop;
|
|
7953
|
+
internalData.inWheelScroll = true;
|
|
7954
|
+
setScrollTop(yHandleEl, currTopNum);
|
|
7955
|
+
setScrollTop(bodyScrollElem, currTopNum);
|
|
7956
|
+
setScrollTop(leftScrollElem, currTopNum);
|
|
7957
|
+
setScrollTop(rightScrollElem, currTopNum);
|
|
7958
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
7959
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, scrollLeft, {
|
|
7960
|
+
type: 'table',
|
|
7961
|
+
fixed: ''
|
|
7962
|
+
});
|
|
7487
7963
|
});
|
|
7964
|
+
// internalData.inWheelScroll = true
|
|
7965
|
+
// setScrollTop(yHandleEl, scrollTop)
|
|
7966
|
+
// setScrollTop(bodyScrollElem, scrollTop)
|
|
7967
|
+
// setScrollTop(leftScrollElem, scrollTop)
|
|
7968
|
+
// setScrollTop(rightScrollElem, scrollTop)
|
|
7969
|
+
// loadScrollYData($xeTable, scrollTop)
|
|
7970
|
+
// $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
7971
|
+
// type: 'footer',
|
|
7972
|
+
// fixed: ''
|
|
7973
|
+
// })
|
|
7488
7974
|
}
|
|
7489
7975
|
},
|
|
7490
7976
|
triggerVirtualScrollXEvent(evnt) {
|
|
@@ -7555,13 +8041,13 @@ const Methods = {
|
|
|
7555
8041
|
},
|
|
7556
8042
|
updateScrollXData() {
|
|
7557
8043
|
const $xeTable = this;
|
|
7558
|
-
const
|
|
7559
|
-
const {
|
|
8044
|
+
const reactData = $xeTable;
|
|
8045
|
+
const { isAllOverflow } = reactData;
|
|
7560
8046
|
handleTableColumn($xeTable);
|
|
7561
8047
|
return $xeTable.$nextTick().then(() => {
|
|
7562
8048
|
handleTableColumn($xeTable);
|
|
7563
8049
|
$xeTable.updateScrollXSpace();
|
|
7564
|
-
if (!
|
|
8050
|
+
if (!isAllOverflow) {
|
|
7565
8051
|
$xeTable.updateScrollYSpace();
|
|
7566
8052
|
}
|
|
7567
8053
|
});
|
|
@@ -7625,38 +8111,36 @@ const Methods = {
|
|
|
7625
8111
|
// 更新纵向 Y 可视渲染上下剩余空间大小
|
|
7626
8112
|
updateScrollYSpace() {
|
|
7627
8113
|
const $xeTable = this;
|
|
7628
|
-
const props = $xeTable;
|
|
7629
8114
|
const reactData = $xeTable;
|
|
7630
8115
|
const internalData = $xeTable;
|
|
7631
|
-
const {
|
|
7632
|
-
const {
|
|
7633
|
-
const { scrollYStore, elemStore, afterFullData, fullAllDataRowIdData } = internalData;
|
|
8116
|
+
const { isAllOverflow, scrollYLoad } = reactData;
|
|
8117
|
+
const { scrollYStore, elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData;
|
|
7634
8118
|
const { startIndex } = scrollYStore;
|
|
8119
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
8120
|
+
const cellOpts = $xeTable.computeCellOpts;
|
|
8121
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
7635
8122
|
const bodyTableElem = getRefElem(elemStore['main-body-table']);
|
|
7636
8123
|
const containerList = ['main', 'left', 'right'];
|
|
7637
8124
|
let topSpaceHeight = 0;
|
|
7638
8125
|
let ySpaceHeight = 0;
|
|
7639
8126
|
if (scrollYLoad) {
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
8127
|
+
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
|
|
8128
|
+
if (!isCustomCellHeight && isAllOverflow) {
|
|
8129
|
+
ySpaceHeight = afterFullData.length * defaultRowHeight;
|
|
8130
|
+
topSpaceHeight = Math.max(0, startIndex * defaultRowHeight);
|
|
7643
8131
|
}
|
|
7644
8132
|
else {
|
|
7645
8133
|
for (let i = 0; i < afterFullData.length; i++) {
|
|
7646
8134
|
const row = afterFullData[i];
|
|
7647
8135
|
const rowid = getRowid($xeTable, row);
|
|
7648
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
7649
|
-
|
|
7650
|
-
ySpaceHeight += rowRest.height || rowHeight;
|
|
7651
|
-
}
|
|
8136
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
8137
|
+
ySpaceHeight += rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
7652
8138
|
}
|
|
7653
8139
|
for (let i = 0; i < startIndex; i++) {
|
|
7654
8140
|
const row = afterFullData[i];
|
|
7655
8141
|
const rowid = getRowid($xeTable, row);
|
|
7656
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
7657
|
-
|
|
7658
|
-
topSpaceHeight += rowRest.height || rowHeight;
|
|
7659
|
-
}
|
|
8142
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
8143
|
+
topSpaceHeight += rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
7660
8144
|
}
|
|
7661
8145
|
}
|
|
7662
8146
|
}
|
|
@@ -7682,7 +8166,7 @@ const Methods = {
|
|
|
7682
8166
|
if (scrollYSpaceEl) {
|
|
7683
8167
|
scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
|
|
7684
8168
|
}
|
|
7685
|
-
$xeTable.$nextTick(() => {
|
|
8169
|
+
return $xeTable.$nextTick().then(() => {
|
|
7686
8170
|
updateStyle($xeTable);
|
|
7687
8171
|
});
|
|
7688
8172
|
},
|
|
@@ -7747,10 +8231,8 @@ const Methods = {
|
|
|
7747
8231
|
*/
|
|
7748
8232
|
scrollToRow(row, fieldOrColumn) {
|
|
7749
8233
|
const $xeTable = this;
|
|
7750
|
-
const props = $xeTable;
|
|
7751
8234
|
const reactData = $xeTable;
|
|
7752
|
-
const {
|
|
7753
|
-
const { scrollYLoad, scrollXLoad } = reactData;
|
|
8235
|
+
const { isAllOverflow, scrollYLoad, scrollXLoad } = reactData;
|
|
7754
8236
|
const rest = [];
|
|
7755
8237
|
if (row) {
|
|
7756
8238
|
if (this.treeConfig) {
|
|
@@ -7765,7 +8247,7 @@ const Methods = {
|
|
|
7765
8247
|
}
|
|
7766
8248
|
return Promise.all(rest).then(() => {
|
|
7767
8249
|
if (row) {
|
|
7768
|
-
if (!
|
|
8250
|
+
if (!isAllOverflow && (scrollYLoad || scrollXLoad)) {
|
|
7769
8251
|
calcCellHeight($xeTable);
|
|
7770
8252
|
calcCellWidth($xeTable);
|
|
7771
8253
|
}
|