vxe-table 4.10.6-beta.3 → 4.10.6-beta.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/grid/src/grid.js +1 -1
- 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/hook.js +7 -7
- package/es/table/module/export/hook.js +97 -62
- package/es/table/module/keyboard/hook.js +63 -27
- package/es/table/src/body.js +112 -77
- package/es/table/src/cell.js +41 -55
- package/es/table/src/column.js +13 -1
- package/es/table/src/columnInfo.js +3 -0
- package/es/table/src/emits.js +2 -0
- package/es/table/src/footer.js +32 -8
- package/es/table/src/header.js +73 -158
- package/es/table/src/props.js +14 -4
- package/es/table/src/table.js +1179 -634
- package/es/table/src/util.js +77 -62
- package/es/table/style.css +357 -213
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +26 -11
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +357 -213
- package/es/vxe-table/style.min.css +1 -1
- package/lib/grid/src/grid.js +1 -1
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +1852 -1165
- 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-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/hook.js +12 -2
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/module/export/hook.js +97 -57
- package/lib/table/module/export/hook.min.js +1 -1
- package/lib/table/module/keyboard/hook.js +71 -28
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/src/body.js +104 -76
- 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 +13 -1
- 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/emits.js +1 -1
- package/lib/table/src/emits.min.js +1 -1
- package/lib/table/src/footer.js +30 -8
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +57 -169
- package/lib/table/src/header.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 +1234 -626
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +100 -82
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +357 -213
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +26 -11
- 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 +357 -213
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +1 -1
- 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/hook.ts +7 -7
- package/packages/table/module/export/hook.ts +118 -65
- package/packages/table/module/keyboard/hook.ts +59 -25
- package/packages/table/src/body.ts +122 -80
- package/packages/table/src/cell.ts +41 -63
- package/packages/table/src/column.ts +13 -1
- package/packages/table/src/columnInfo.ts +3 -0
- package/packages/table/src/emits.ts +5 -1
- package/packages/table/src/footer.ts +32 -8
- package/packages/table/src/header.ts +73 -158
- package/packages/table/src/props.ts +14 -5
- package/packages/table/src/table.ts +1183 -632
- package/packages/table/src/util.ts +81 -62
- package/packages/ui/index.ts +25 -10
- package/styles/components/table.scss +428 -290
- 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 -1
- /package/es/{iconfont.1736748534420.ttf → iconfont.1737526556258.ttf} +0 -0
- /package/es/{iconfont.1736748534420.woff → iconfont.1737526556258.woff} +0 -0
- /package/es/{iconfont.1736748534420.woff2 → iconfont.1737526556258.woff2} +0 -0
- /package/lib/{iconfont.1736748534420.ttf → iconfont.1737526556258.ttf} +0 -0
- /package/lib/{iconfont.1736748534420.woff → iconfont.1737526556258.woff} +0 -0
- /package/lib/{iconfont.1736748534420.woff2 → iconfont.1737526556258.woff2} +0 -0
package/es/table/src/table.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, h, reactive, ref, provide, inject, nextTick, onActivated, onDeactivated, onBeforeUnmount, onUnmounted, watch, computed, onMounted } from 'vue';
|
|
2
2
|
import XEUtils from 'xe-utils';
|
|
3
|
-
import { browse, initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft } from '../../ui/src/dom';
|
|
3
|
+
import { browse, initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, getOffsetPos, setScrollTop, setScrollLeft } from '../../ui/src/dom';
|
|
4
4
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
|
|
5
5
|
import { VxeUI } from '../../ui';
|
|
6
6
|
import Cell from './cell';
|
|
@@ -32,7 +32,6 @@ export default defineComponent({
|
|
|
32
32
|
const $xeTabs = inject('$xeTabs', null);
|
|
33
33
|
const { computeSize } = useFns.useSize(props);
|
|
34
34
|
const reactData = reactive({
|
|
35
|
-
isCalcColumn: false,
|
|
36
35
|
// 低性能的静态列
|
|
37
36
|
staticColumns: [],
|
|
38
37
|
// 渲染的列分组
|
|
@@ -245,14 +244,15 @@ export default defineComponent({
|
|
|
245
244
|
isFooter: false
|
|
246
245
|
},
|
|
247
246
|
scrollVMLoading: false,
|
|
248
|
-
|
|
247
|
+
calcCellHeightFlag: 0,
|
|
248
|
+
resizeHeightFlag: 0,
|
|
249
249
|
isCustomStatus: false,
|
|
250
250
|
isDragRowMove: false,
|
|
251
251
|
dragRow: null,
|
|
252
252
|
isDragColMove: false,
|
|
253
253
|
dragCol: null,
|
|
254
254
|
dragTipText: '',
|
|
255
|
-
|
|
255
|
+
isDragResize: false,
|
|
256
256
|
isLoading: false
|
|
257
257
|
});
|
|
258
258
|
const internalData = {
|
|
@@ -327,10 +327,6 @@ export default defineComponent({
|
|
|
327
327
|
fullDataRowIdData: {},
|
|
328
328
|
fullColumnIdData: {},
|
|
329
329
|
fullColumnFieldData: {},
|
|
330
|
-
// 列选取状态
|
|
331
|
-
columnStatusMaps: {},
|
|
332
|
-
// 行选取状态
|
|
333
|
-
rowStatusMaps: {},
|
|
334
330
|
// prevDragRow: null,
|
|
335
331
|
inited: false,
|
|
336
332
|
tooltipTimeout: null,
|
|
@@ -358,8 +354,8 @@ export default defineComponent({
|
|
|
358
354
|
const refTableRightFooter = ref();
|
|
359
355
|
const refLeftContainer = ref();
|
|
360
356
|
const refRightContainer = ref();
|
|
361
|
-
const
|
|
362
|
-
const
|
|
357
|
+
const refColResizeBar = ref();
|
|
358
|
+
const refRowResizeBar = ref();
|
|
363
359
|
const refEmptyPlaceholder = ref();
|
|
364
360
|
const refDragTipElem = ref();
|
|
365
361
|
const refDragRowLineElem = ref();
|
|
@@ -367,9 +363,12 @@ export default defineComponent({
|
|
|
367
363
|
const refScrollXVirtualElem = ref();
|
|
368
364
|
const refScrollYVirtualElem = ref();
|
|
369
365
|
const refScrollXHandleElem = ref();
|
|
366
|
+
const refScrollXLeftCornerElem = ref();
|
|
370
367
|
const refScrollXRightCornerElem = ref();
|
|
371
368
|
const refScrollYHandleElem = ref();
|
|
372
369
|
const refScrollYTopCornerElem = ref();
|
|
370
|
+
const refScrollXWrapperElem = ref();
|
|
371
|
+
const refScrollYWrapperElem = ref();
|
|
373
372
|
const refScrollYBottomCornerElem = ref();
|
|
374
373
|
const refScrollXSpaceElem = ref();
|
|
375
374
|
const refScrollYSpaceElem = ref();
|
|
@@ -419,6 +418,14 @@ export default defineComponent({
|
|
|
419
418
|
const computeScrollbarOpts = computed(() => {
|
|
420
419
|
return Object.assign({}, getConfig().table.scrollbarConfig, props.scrollbarConfig);
|
|
421
420
|
});
|
|
421
|
+
const computeScrollbarXToTop = computed(() => {
|
|
422
|
+
const scrollbarOpts = computeScrollbarOpts.value;
|
|
423
|
+
return !!(scrollbarOpts.x && scrollbarOpts.x.position === 'top');
|
|
424
|
+
});
|
|
425
|
+
const computeScrollbarYToLeft = computed(() => {
|
|
426
|
+
const scrollbarOpts = computeScrollbarOpts.value;
|
|
427
|
+
return !!(scrollbarOpts.y && scrollbarOpts.y.position === 'left');
|
|
428
|
+
});
|
|
422
429
|
const computeScrollYThreshold = computed(() => {
|
|
423
430
|
const sYOpts = computeSYOpts.value;
|
|
424
431
|
const { threshold } = sYOpts;
|
|
@@ -438,7 +445,7 @@ export default defineComponent({
|
|
|
438
445
|
const computeDefaultRowHeight = computed(() => {
|
|
439
446
|
const vSize = computeSize.value;
|
|
440
447
|
const rowHeightMaps = computeRowHeightMaps.value;
|
|
441
|
-
return rowHeightMaps[vSize || 'default'];
|
|
448
|
+
return rowHeightMaps[vSize || 'default'] || 18;
|
|
442
449
|
});
|
|
443
450
|
const computeColumnOpts = computed(() => {
|
|
444
451
|
return Object.assign({}, getConfig().table.columnConfig, props.columnConfig);
|
|
@@ -446,6 +453,12 @@ export default defineComponent({
|
|
|
446
453
|
const computeCellOpts = computed(() => {
|
|
447
454
|
return Object.assign({}, getConfig().table.cellConfig, props.cellConfig);
|
|
448
455
|
});
|
|
456
|
+
const computeHeaderCellOpts = computed(() => {
|
|
457
|
+
return Object.assign({}, getConfig().table.headerCellConfig, props.headerCellConfig);
|
|
458
|
+
});
|
|
459
|
+
const computeFooterCellOpts = computed(() => {
|
|
460
|
+
return Object.assign({}, getConfig().table.footerCellConfig, props.footerCellConfig);
|
|
461
|
+
});
|
|
449
462
|
const computeRowOpts = computed(() => {
|
|
450
463
|
return Object.assign({}, getConfig().table.rowConfig, props.rowConfig);
|
|
451
464
|
});
|
|
@@ -473,6 +486,15 @@ export default defineComponent({
|
|
|
473
486
|
const computeTooltipOpts = computed(() => {
|
|
474
487
|
return Object.assign({}, getConfig().tooltip, getConfig().table.tooltipConfig, props.tooltipConfig);
|
|
475
488
|
});
|
|
489
|
+
const computeTableTipConfig = computed(() => {
|
|
490
|
+
const { tooltipStore } = reactData;
|
|
491
|
+
const tooltipOpts = computeTooltipOpts.value;
|
|
492
|
+
return Object.assign({}, tooltipOpts, tooltipStore.currOpts);
|
|
493
|
+
});
|
|
494
|
+
const computeValidTipConfig = computed(() => {
|
|
495
|
+
const tooltipOpts = computeTooltipOpts.value;
|
|
496
|
+
return Object.assign({}, tooltipOpts);
|
|
497
|
+
});
|
|
476
498
|
const computeEditOpts = computed(() => {
|
|
477
499
|
return Object.assign({}, getConfig().table.editConfig, props.editConfig);
|
|
478
500
|
});
|
|
@@ -663,8 +685,8 @@ export default defineComponent({
|
|
|
663
685
|
refTableRightFooter,
|
|
664
686
|
refLeftContainer,
|
|
665
687
|
refRightContainer,
|
|
666
|
-
|
|
667
|
-
|
|
688
|
+
refColResizeBar,
|
|
689
|
+
refRowResizeBar,
|
|
668
690
|
refScrollXVirtualElem,
|
|
669
691
|
refScrollYVirtualElem,
|
|
670
692
|
refScrollXHandleElem,
|
|
@@ -679,11 +701,15 @@ export default defineComponent({
|
|
|
679
701
|
computeVirtualXOpts,
|
|
680
702
|
computeVirtualYOpts,
|
|
681
703
|
computeScrollbarOpts,
|
|
704
|
+
computeScrollbarXToTop,
|
|
705
|
+
computeScrollbarYToLeft,
|
|
682
706
|
computeColumnOpts,
|
|
683
707
|
computeScrollXThreshold,
|
|
684
708
|
computeScrollYThreshold,
|
|
685
709
|
computeDefaultRowHeight,
|
|
686
710
|
computeCellOpts,
|
|
711
|
+
computeHeaderCellOpts,
|
|
712
|
+
computeFooterCellOpts,
|
|
687
713
|
computeRowOpts,
|
|
688
714
|
computeRowDragOpts,
|
|
689
715
|
computeColumnDragOpts,
|
|
@@ -814,49 +840,59 @@ export default defineComponent({
|
|
|
814
840
|
return { toVisibleIndex: 0, visibleSize: 6 };
|
|
815
841
|
};
|
|
816
842
|
const computeRowHeight = () => {
|
|
843
|
+
const { isAllOverflow } = reactData;
|
|
817
844
|
const tableHeader = refTableHeader.value;
|
|
818
845
|
const tableBody = refTableBody.value;
|
|
819
846
|
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
820
847
|
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
821
848
|
let rowHeight = 0;
|
|
822
|
-
if (
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
firstTrElem
|
|
849
|
+
if (isAllOverflow) {
|
|
850
|
+
if (tableBodyElem) {
|
|
851
|
+
const tableHeaderElem = tableHeader ? tableHeader.$el : null;
|
|
852
|
+
let firstTrElem;
|
|
853
|
+
firstTrElem = tableBodyElem.querySelector('tr');
|
|
854
|
+
if (!firstTrElem && tableHeaderElem) {
|
|
855
|
+
firstTrElem = tableHeaderElem.querySelector('tr');
|
|
856
|
+
}
|
|
857
|
+
if (firstTrElem) {
|
|
858
|
+
rowHeight = firstTrElem.clientHeight;
|
|
859
|
+
}
|
|
828
860
|
}
|
|
829
|
-
if (
|
|
830
|
-
rowHeight =
|
|
861
|
+
if (!rowHeight) {
|
|
862
|
+
rowHeight = defaultRowHeight;
|
|
831
863
|
}
|
|
832
864
|
}
|
|
833
|
-
|
|
865
|
+
else {
|
|
834
866
|
rowHeight = defaultRowHeight;
|
|
835
867
|
}
|
|
836
868
|
// 最低支持 18px 行高
|
|
837
869
|
return Math.max(18, rowHeight);
|
|
838
870
|
};
|
|
839
|
-
const handleVirtualYVisible = () => {
|
|
840
|
-
const {
|
|
841
|
-
const {
|
|
842
|
-
const
|
|
871
|
+
const handleVirtualYVisible = (currScrollTop) => {
|
|
872
|
+
const { isAllOverflow } = reactData;
|
|
873
|
+
const { elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData;
|
|
874
|
+
const rowOpts = computeRowOpts.value;
|
|
875
|
+
const cellOpts = computeCellOpts.value;
|
|
876
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
843
877
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
844
878
|
if (bodyScrollElem) {
|
|
845
|
-
const
|
|
879
|
+
const clientHeight = bodyScrollElem.clientHeight;
|
|
880
|
+
const scrollTop = XEUtils.isNumber(currScrollTop) ? currScrollTop : bodyScrollElem.scrollTop;
|
|
846
881
|
const endHeight = scrollTop + clientHeight;
|
|
847
882
|
let toVisibleIndex = -1;
|
|
848
883
|
let offsetTop = 0;
|
|
849
884
|
let visibleSize = 0;
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
885
|
+
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
|
|
886
|
+
if (!isCustomCellHeight && isAllOverflow) {
|
|
887
|
+
toVisibleIndex = Math.floor(scrollTop / defaultRowHeight);
|
|
888
|
+
visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
|
|
853
889
|
}
|
|
854
890
|
else {
|
|
855
891
|
for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
856
892
|
const row = afterFullData[rIndex];
|
|
857
893
|
const rowid = getRowid($xeTable, row);
|
|
858
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
859
|
-
offsetTop += rowRest
|
|
894
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
895
|
+
offsetTop += rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
860
896
|
if (toVisibleIndex === -1 && scrollTop < offsetTop) {
|
|
861
897
|
toVisibleIndex = rIndex;
|
|
862
898
|
}
|
|
@@ -1097,7 +1133,7 @@ export default defineComponent({
|
|
|
1097
1133
|
fullColumnFieldData[field] = rest;
|
|
1098
1134
|
}
|
|
1099
1135
|
else {
|
|
1100
|
-
if (storage || (columnOpts.drag && (isCrossDrag || isSelfToChildDrag))) {
|
|
1136
|
+
if ((storage && !type) || (columnOpts.drag && (isCrossDrag || isSelfToChildDrag))) {
|
|
1101
1137
|
errLog('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field`]);
|
|
1102
1138
|
}
|
|
1103
1139
|
}
|
|
@@ -1188,55 +1224,38 @@ export default defineComponent({
|
|
|
1188
1224
|
internalData.customMaxHeight = calcTableHeight('maxHeight');
|
|
1189
1225
|
};
|
|
1190
1226
|
const calcColumnAutoWidth = (column, wrapperEl) => {
|
|
1191
|
-
const
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
if (firstCellEl) {
|
|
1195
|
-
const cellStyle = getComputedStyle(firstCellEl);
|
|
1196
|
-
|
|
1197
|
-
}
|
|
1198
|
-
let colWidth = column.renderAutoWidth -
|
|
1199
|
-
|
|
1200
|
-
const
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
XEUtils.arrayEach(cellEl.children, (btnEl) => {
|
|
1205
|
-
titleWidth += btnEl.offsetWidth + 1;
|
|
1206
|
-
});
|
|
1207
|
-
}
|
|
1208
|
-
else {
|
|
1209
|
-
const labelEl = cellEl.firstElementChild;
|
|
1210
|
-
if (labelEl) {
|
|
1211
|
-
titleWidth = labelEl.offsetWidth;
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
if (titleWidth) {
|
|
1215
|
-
colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4);
|
|
1216
|
-
}
|
|
1217
|
-
});
|
|
1218
|
-
return colWidth + paddingSize;
|
|
1227
|
+
const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[colid="${column.id}"]`);
|
|
1228
|
+
let leftRightPadding = 0;
|
|
1229
|
+
const firstCellEl = cellElemList[0];
|
|
1230
|
+
if (firstCellEl && firstCellEl.parentElement) {
|
|
1231
|
+
const cellStyle = getComputedStyle(firstCellEl.parentElement);
|
|
1232
|
+
leftRightPadding = Math.ceil(XEUtils.toNumber(cellStyle.paddingLeft) + XEUtils.toNumber(cellStyle.paddingRight));
|
|
1233
|
+
}
|
|
1234
|
+
let colWidth = column.renderAutoWidth - leftRightPadding;
|
|
1235
|
+
for (let i = 0; i < cellElemList.length; i++) {
|
|
1236
|
+
const celEl = cellElemList[i];
|
|
1237
|
+
colWidth = Math.max(colWidth, celEl ? Math.ceil(celEl.scrollWidth) + 4 : 0);
|
|
1238
|
+
}
|
|
1239
|
+
return colWidth + leftRightPadding;
|
|
1219
1240
|
};
|
|
1220
1241
|
const calcCellWidth = () => {
|
|
1221
1242
|
const autoWidthColumnList = computeAutoWidthColumnList.value;
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
reactData.isCalcColumn = false;
|
|
1239
|
-
});
|
|
1243
|
+
const { fullColumnIdData } = internalData;
|
|
1244
|
+
const el = refElem.value;
|
|
1245
|
+
if (el) {
|
|
1246
|
+
el.setAttribute('data-calc-col', 'Y');
|
|
1247
|
+
autoWidthColumnList.forEach(column => {
|
|
1248
|
+
const colid = column.id;
|
|
1249
|
+
const colRest = fullColumnIdData[colid];
|
|
1250
|
+
const colWidth = calcColumnAutoWidth(column, el);
|
|
1251
|
+
if (colRest) {
|
|
1252
|
+
colRest.width = Math.max(colWidth, colRest.width);
|
|
1253
|
+
}
|
|
1254
|
+
column.renderAutoWidth = colWidth;
|
|
1255
|
+
});
|
|
1256
|
+
$xeTable.analyColumnWidth();
|
|
1257
|
+
el.removeAttribute('data-calc-col');
|
|
1258
|
+
}
|
|
1240
1259
|
};
|
|
1241
1260
|
/**
|
|
1242
1261
|
* 列宽算法,计算单元格列宽,动态分配可用剩余空间
|
|
@@ -1277,39 +1296,39 @@ export default defineComponent({
|
|
|
1277
1296
|
});
|
|
1278
1297
|
// 最小自适应
|
|
1279
1298
|
autoMinList.forEach((column) => {
|
|
1280
|
-
const
|
|
1281
|
-
tableWidth +=
|
|
1282
|
-
column.renderWidth =
|
|
1299
|
+
const caWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth));
|
|
1300
|
+
tableWidth += caWidth;
|
|
1301
|
+
column.renderWidth = caWidth;
|
|
1283
1302
|
});
|
|
1284
1303
|
// 最小百分比
|
|
1285
1304
|
scaleMinList.forEach((column) => {
|
|
1286
|
-
const
|
|
1287
|
-
tableWidth +=
|
|
1288
|
-
column.renderWidth =
|
|
1305
|
+
const smWidth = Math.floor(XEUtils.toInteger(column.minWidth) * meanWidth);
|
|
1306
|
+
tableWidth += smWidth;
|
|
1307
|
+
column.renderWidth = smWidth;
|
|
1289
1308
|
});
|
|
1290
1309
|
// 固定百分比
|
|
1291
1310
|
scaleList.forEach((column) => {
|
|
1292
|
-
const
|
|
1293
|
-
tableWidth +=
|
|
1294
|
-
column.renderWidth =
|
|
1311
|
+
const sfWidth = Math.floor(XEUtils.toInteger(column.width) * meanWidth);
|
|
1312
|
+
tableWidth += sfWidth;
|
|
1313
|
+
column.renderWidth = sfWidth;
|
|
1295
1314
|
});
|
|
1296
1315
|
// 固定宽
|
|
1297
1316
|
pxList.forEach((column) => {
|
|
1298
|
-
const
|
|
1299
|
-
tableWidth +=
|
|
1300
|
-
column.renderWidth =
|
|
1317
|
+
const pWidth = XEUtils.toInteger(column.width);
|
|
1318
|
+
tableWidth += pWidth;
|
|
1319
|
+
column.renderWidth = pWidth;
|
|
1301
1320
|
});
|
|
1302
1321
|
// 自适应宽
|
|
1303
1322
|
autoList.forEach((column) => {
|
|
1304
|
-
const
|
|
1305
|
-
tableWidth +=
|
|
1306
|
-
column.renderWidth =
|
|
1323
|
+
const aWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth));
|
|
1324
|
+
tableWidth += aWidth;
|
|
1325
|
+
column.renderWidth = aWidth;
|
|
1307
1326
|
});
|
|
1308
1327
|
// 调整了列宽
|
|
1309
1328
|
resizeList.forEach((column) => {
|
|
1310
|
-
const
|
|
1311
|
-
tableWidth +=
|
|
1312
|
-
column.renderWidth =
|
|
1329
|
+
const reWidth = XEUtils.toInteger(column.resizeWidth);
|
|
1330
|
+
tableWidth += reWidth;
|
|
1331
|
+
column.renderWidth = reWidth;
|
|
1313
1332
|
});
|
|
1314
1333
|
remainWidth -= tableWidth;
|
|
1315
1334
|
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoMinList.length + remainList.length)) : 0;
|
|
@@ -1350,7 +1369,7 @@ export default defineComponent({
|
|
|
1350
1369
|
}
|
|
1351
1370
|
const tableHeight = bodyElem.offsetHeight;
|
|
1352
1371
|
const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight;
|
|
1353
|
-
reactData.scrollbarWidth =
|
|
1372
|
+
reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth);
|
|
1354
1373
|
reactData.overflowY = overflowY;
|
|
1355
1374
|
internalData.tableWidth = tableWidth;
|
|
1356
1375
|
internalData.tableHeight = tableHeight;
|
|
@@ -1359,7 +1378,7 @@ export default defineComponent({
|
|
|
1359
1378
|
const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0;
|
|
1360
1379
|
const overflowX = tableWidth > bodyWidth;
|
|
1361
1380
|
const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0;
|
|
1362
|
-
reactData.scrollbarHeight =
|
|
1381
|
+
reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight);
|
|
1363
1382
|
internalData.headerHeight = headerHeight;
|
|
1364
1383
|
internalData.footerHeight = footerHeight;
|
|
1365
1384
|
reactData.overflowX = overflowX;
|
|
@@ -1369,57 +1388,36 @@ export default defineComponent({
|
|
|
1369
1388
|
$xeTable.checkScrolling();
|
|
1370
1389
|
}
|
|
1371
1390
|
};
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
// }
|
|
1391
|
+
const calcCellAutoHeight = (rowRest, wrapperEl) => {
|
|
1392
|
+
const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);
|
|
1393
|
+
let colHeight = rowRest.height;
|
|
1394
|
+
for (let i = 0; i < cellElemList.length; i++) {
|
|
1395
|
+
const cellElem = cellElemList[i];
|
|
1396
|
+
const tdEl = cellElem.parentElement;
|
|
1397
|
+
const topBottomPadding = Math.ceil(XEUtils.toNumber(tdEl.style.paddingTop) + XEUtils.toNumber(tdEl.style.paddingBottom));
|
|
1398
|
+
const cellHeight = cellElem ? cellElem.clientHeight : 0;
|
|
1399
|
+
colHeight = Math.max(colHeight - topBottomPadding, Math.ceil(cellHeight));
|
|
1400
|
+
}
|
|
1401
|
+
return colHeight;
|
|
1402
|
+
};
|
|
1385
1403
|
const calcCellHeight = () => {
|
|
1386
|
-
const {
|
|
1387
|
-
const { tableData, scrollXLoad } = reactData;
|
|
1404
|
+
const { tableData, isAllOverflow, scrollYLoad, scrollXLoad } = reactData;
|
|
1388
1405
|
const { fullAllDataRowIdData } = internalData;
|
|
1406
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
1389
1407
|
const el = refElem.value;
|
|
1390
|
-
if (!
|
|
1391
|
-
|
|
1392
|
-
let paddingBottom = 0;
|
|
1393
|
-
let calcPadding = false;
|
|
1408
|
+
if (!isAllOverflow && scrollYLoad && el) {
|
|
1409
|
+
el.setAttribute('data-calc-row', 'Y');
|
|
1394
1410
|
tableData.forEach(row => {
|
|
1395
1411
|
const rowid = getRowid($xeTable, row);
|
|
1396
1412
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
for (let i = 0; i < cellList.length; i++) {
|
|
1401
|
-
const cellElem = cellList[i];
|
|
1402
|
-
const tdEl = cellElem.parentElement;
|
|
1403
|
-
if (!tdEl || !tdEl.clientWidth) {
|
|
1404
|
-
break;
|
|
1405
|
-
}
|
|
1406
|
-
if (!calcPadding) {
|
|
1407
|
-
paddingTop = XEUtils.toNumber(getComputedStyle(tdEl).paddingTop);
|
|
1408
|
-
paddingBottom = XEUtils.toNumber(getComputedStyle(tdEl).paddingBottom);
|
|
1409
|
-
calcPadding = true;
|
|
1410
|
-
}
|
|
1411
|
-
let cellHeight = paddingTop + paddingBottom;
|
|
1412
|
-
if (cellElem) {
|
|
1413
|
-
cellHeight += cellElem.clientHeight;
|
|
1414
|
-
}
|
|
1415
|
-
height = Math.max(height, cellHeight);
|
|
1416
|
-
}
|
|
1417
|
-
rowRest.height = scrollXLoad ? Math.max(rowRest.height, height) : height;
|
|
1413
|
+
if (rowRest) {
|
|
1414
|
+
const reHeight = calcCellAutoHeight(rowRest, el);
|
|
1415
|
+
rowRest.height = Math.max(defaultRowHeight, scrollXLoad ? Math.max(rowRest.height, reHeight) : reHeight);
|
|
1418
1416
|
}
|
|
1417
|
+
el.removeAttribute('data-calc-row');
|
|
1419
1418
|
});
|
|
1420
|
-
reactData.
|
|
1419
|
+
reactData.calcCellHeightFlag++;
|
|
1421
1420
|
}
|
|
1422
|
-
// updateCellOffset()
|
|
1423
1421
|
};
|
|
1424
1422
|
const getOrderField = (column) => {
|
|
1425
1423
|
const { sortBy, sortType } = column;
|
|
@@ -1443,14 +1441,35 @@ export default defineComponent({
|
|
|
1443
1441
|
return cellValue;
|
|
1444
1442
|
};
|
|
1445
1443
|
};
|
|
1444
|
+
const updateAfterListIndex = () => {
|
|
1445
|
+
const { afterFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData;
|
|
1446
|
+
const fullMaps = {};
|
|
1447
|
+
afterFullData.forEach((row, index) => {
|
|
1448
|
+
const rowid = getRowid($xeTable, row);
|
|
1449
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
1450
|
+
const seq = index + 1;
|
|
1451
|
+
if (rowRest) {
|
|
1452
|
+
rowRest.seq = seq;
|
|
1453
|
+
rowRest._index = index;
|
|
1454
|
+
}
|
|
1455
|
+
else {
|
|
1456
|
+
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 };
|
|
1457
|
+
fullAllDataRowIdData[rowid] = rest;
|
|
1458
|
+
fullDataRowIdData[rowid] = rest;
|
|
1459
|
+
}
|
|
1460
|
+
fullMaps[rowid] = row;
|
|
1461
|
+
});
|
|
1462
|
+
internalData.afterFullRowMaps = fullMaps;
|
|
1463
|
+
};
|
|
1446
1464
|
/**
|
|
1447
1465
|
* 预编译
|
|
1448
1466
|
* 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
|
|
1449
1467
|
*/
|
|
1450
1468
|
const updateAfterDataIndex = () => {
|
|
1451
1469
|
const { treeConfig } = props;
|
|
1452
|
-
const {
|
|
1470
|
+
const { fullDataRowIdData, fullAllDataRowIdData, afterTreeFullData } = internalData;
|
|
1453
1471
|
const treeOpts = computeTreeOpts.value;
|
|
1472
|
+
const { transform } = treeOpts;
|
|
1454
1473
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
1455
1474
|
const fullMaps = {};
|
|
1456
1475
|
if (treeConfig) {
|
|
@@ -1460,34 +1479,21 @@ export default defineComponent({
|
|
|
1460
1479
|
const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('');
|
|
1461
1480
|
if (rowRest) {
|
|
1462
1481
|
rowRest.seq = seq;
|
|
1463
|
-
rowRest.
|
|
1482
|
+
rowRest.treeIndex = index;
|
|
1464
1483
|
}
|
|
1465
1484
|
else {
|
|
1466
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, items: [], parent: null, level: 0, height: 0, oTop: 0 };
|
|
1485
|
+
const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 };
|
|
1467
1486
|
fullAllDataRowIdData[rowid] = rest;
|
|
1468
1487
|
fullDataRowIdData[rowid] = rest;
|
|
1469
1488
|
}
|
|
1470
1489
|
fullMaps[rowid] = row;
|
|
1471
|
-
}, { children:
|
|
1490
|
+
}, { children: transform ? treeOpts.mapChildrenField : childrenField });
|
|
1491
|
+
internalData.afterFullRowMaps = fullMaps;
|
|
1492
|
+
updateAfterListIndex();
|
|
1472
1493
|
}
|
|
1473
1494
|
else {
|
|
1474
|
-
|
|
1475
|
-
const rowid = getRowid($xeTable, row);
|
|
1476
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
1477
|
-
const seq = index + 1;
|
|
1478
|
-
if (rowRest) {
|
|
1479
|
-
rowRest.seq = seq;
|
|
1480
|
-
rowRest._index = index;
|
|
1481
|
-
}
|
|
1482
|
-
else {
|
|
1483
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0, height: 0, oTop: 0 };
|
|
1484
|
-
fullAllDataRowIdData[rowid] = rest;
|
|
1485
|
-
fullDataRowIdData[rowid] = rest;
|
|
1486
|
-
}
|
|
1487
|
-
fullMaps[rowid] = row;
|
|
1488
|
-
});
|
|
1495
|
+
updateAfterListIndex();
|
|
1489
1496
|
}
|
|
1490
|
-
internalData.afterFullRowMaps = fullMaps;
|
|
1491
1497
|
};
|
|
1492
1498
|
/**
|
|
1493
1499
|
* 如果为虚拟树,将树结构拍平
|
|
@@ -1665,14 +1671,16 @@ export default defineComponent({
|
|
|
1665
1671
|
updateAfterDataIndex();
|
|
1666
1672
|
};
|
|
1667
1673
|
const updateStyle = () => {
|
|
1668
|
-
const { border,
|
|
1669
|
-
const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, scrollbarWidth, scrollbarHeight, columnStore, editStore, isAllOverflow, expandColumn } = reactData;
|
|
1674
|
+
const { border, showHeaderOverflow: allColumnHeaderOverflow, showFooterOverflow: allColumnFooterOverflow, mouseConfig, spanMethod, footerSpanMethod } = props;
|
|
1675
|
+
const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, overflowX, scrollbarWidth, overflowY, scrollbarHeight, columnStore, editStore, isAllOverflow, expandColumn } = reactData;
|
|
1670
1676
|
const { visibleColumn, fullColumnIdData, tableHeight, tableWidth, headerHeight, footerHeight, elemStore, customHeight, customMinHeight, customMaxHeight } = internalData;
|
|
1671
1677
|
const el = refElem.value;
|
|
1672
1678
|
if (!el) {
|
|
1673
1679
|
return;
|
|
1674
1680
|
}
|
|
1675
1681
|
const containerList = ['main', 'left', 'right'];
|
|
1682
|
+
const osbWidth = overflowY ? scrollbarWidth : 0;
|
|
1683
|
+
const osbHeight = overflowX ? scrollbarHeight : 0;
|
|
1676
1684
|
const emptyPlaceholderElem = refEmptyPlaceholder.value;
|
|
1677
1685
|
const cellOffsetWidth = computeCellOffsetWidth.value;
|
|
1678
1686
|
const mouseOpts = computeMouseOpts.value;
|
|
@@ -1680,16 +1688,16 @@ export default defineComponent({
|
|
|
1680
1688
|
const bodyTableElem = getRefElem(elemStore['main-body-table']);
|
|
1681
1689
|
if (emptyPlaceholderElem) {
|
|
1682
1690
|
emptyPlaceholderElem.style.top = `${headerHeight}px`;
|
|
1683
|
-
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight -
|
|
1691
|
+
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : '';
|
|
1684
1692
|
}
|
|
1685
1693
|
let bodyHeight = 0;
|
|
1686
1694
|
let bodyMaxHeight = 0;
|
|
1687
|
-
const bodyMinHeight = customMinHeight - headerHeight - footerHeight -
|
|
1695
|
+
const bodyMinHeight = customMinHeight - headerHeight - footerHeight - osbHeight;
|
|
1688
1696
|
if (customMaxHeight) {
|
|
1689
|
-
bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight -
|
|
1697
|
+
bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - osbHeight);
|
|
1690
1698
|
}
|
|
1691
1699
|
if (customHeight) {
|
|
1692
|
-
bodyHeight = customHeight - headerHeight - footerHeight -
|
|
1700
|
+
bodyHeight = customHeight - headerHeight - footerHeight - osbHeight;
|
|
1693
1701
|
}
|
|
1694
1702
|
if (!bodyHeight) {
|
|
1695
1703
|
if (bodyTableElem) {
|
|
@@ -1702,35 +1710,42 @@ export default defineComponent({
|
|
|
1702
1710
|
}
|
|
1703
1711
|
bodyHeight = Math.max(bodyMinHeight, bodyHeight);
|
|
1704
1712
|
}
|
|
1713
|
+
const xLeftCornerEl = refScrollXLeftCornerElem.value;
|
|
1714
|
+
const xRightCornerEl = refScrollXRightCornerElem.value;
|
|
1715
|
+
const scrollbarXToTop = computeScrollbarXToTop.value;
|
|
1705
1716
|
const scrollXVirtualEl = refScrollXVirtualElem.value;
|
|
1706
1717
|
if (scrollXVirtualEl) {
|
|
1707
|
-
scrollXVirtualEl.style.height = `${
|
|
1708
|
-
scrollXVirtualEl.style.visibility =
|
|
1718
|
+
scrollXVirtualEl.style.height = `${osbHeight}px`;
|
|
1719
|
+
scrollXVirtualEl.style.visibility = overflowX ? 'visible' : 'hidden';
|
|
1709
1720
|
}
|
|
1710
|
-
const
|
|
1711
|
-
if (
|
|
1712
|
-
|
|
1721
|
+
const xWrapperEl = refScrollXWrapperElem.value;
|
|
1722
|
+
if (xWrapperEl) {
|
|
1723
|
+
xWrapperEl.style.left = scrollbarXToTop ? `${osbWidth}px` : '';
|
|
1724
|
+
xWrapperEl.style.width = `${el.clientWidth - osbWidth}px`;
|
|
1725
|
+
}
|
|
1726
|
+
if (xLeftCornerEl) {
|
|
1727
|
+
xLeftCornerEl.style.width = scrollbarXToTop ? `${osbWidth}px` : '';
|
|
1728
|
+
xLeftCornerEl.style.display = scrollbarXToTop ? (osbWidth && osbHeight ? 'block' : '') : '';
|
|
1713
1729
|
}
|
|
1714
|
-
const xRightCornerEl = refScrollXRightCornerElem.value;
|
|
1715
1730
|
if (xRightCornerEl) {
|
|
1716
|
-
xRightCornerEl.style.width = `${
|
|
1717
|
-
xRightCornerEl.style.display =
|
|
1731
|
+
xRightCornerEl.style.width = scrollbarXToTop ? '' : `${osbWidth}px`;
|
|
1732
|
+
xRightCornerEl.style.display = scrollbarXToTop ? '' : (osbWidth && osbHeight ? 'block' : '');
|
|
1718
1733
|
}
|
|
1719
1734
|
const scrollYVirtualEl = refScrollYVirtualElem.value;
|
|
1720
1735
|
if (scrollYVirtualEl) {
|
|
1721
|
-
scrollYVirtualEl.style.width = `${
|
|
1736
|
+
scrollYVirtualEl.style.width = `${osbWidth}px`;
|
|
1722
1737
|
scrollYVirtualEl.style.height = `${bodyHeight + headerHeight + footerHeight}px`;
|
|
1723
|
-
scrollYVirtualEl.style.visibility =
|
|
1738
|
+
scrollYVirtualEl.style.visibility = overflowY ? 'visible' : 'hidden';
|
|
1724
1739
|
}
|
|
1725
1740
|
const yTopCornerEl = refScrollYTopCornerElem.value;
|
|
1726
1741
|
if (yTopCornerEl) {
|
|
1727
1742
|
yTopCornerEl.style.height = `${headerHeight}px`;
|
|
1728
1743
|
yTopCornerEl.style.display = headerHeight ? 'block' : '';
|
|
1729
1744
|
}
|
|
1730
|
-
const
|
|
1731
|
-
if (
|
|
1732
|
-
|
|
1733
|
-
|
|
1745
|
+
const yWrapperEl = refScrollYWrapperElem.value;
|
|
1746
|
+
if (yWrapperEl) {
|
|
1747
|
+
yWrapperEl.style.height = `${bodyHeight}px`;
|
|
1748
|
+
yWrapperEl.style.top = `${headerHeight}px`;
|
|
1734
1749
|
}
|
|
1735
1750
|
const yBottomCornerEl = refScrollYBottomCornerElem.value;
|
|
1736
1751
|
if (yBottomCornerEl) {
|
|
@@ -1838,14 +1853,14 @@ export default defineComponent({
|
|
|
1838
1853
|
if (wrapperElem) {
|
|
1839
1854
|
wrapperElem.style.top = `${headerHeight}px`;
|
|
1840
1855
|
}
|
|
1841
|
-
fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + headerHeight + footerHeight +
|
|
1856
|
+
fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + headerHeight + footerHeight + osbHeight)}px`;
|
|
1842
1857
|
fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`;
|
|
1843
1858
|
}
|
|
1844
1859
|
let tWidth = tableWidth;
|
|
1845
1860
|
let renderColumnList = tableColumn;
|
|
1846
1861
|
let isOptimizeMode = false;
|
|
1847
1862
|
// 如果是使用优化模式
|
|
1848
|
-
if (scrollXLoad || scrollYLoad ||
|
|
1863
|
+
if (scrollXLoad || scrollYLoad || isAllOverflow) {
|
|
1849
1864
|
if (expandColumn || spanMethod || footerSpanMethod) {
|
|
1850
1865
|
// 如果不支持优化模式
|
|
1851
1866
|
}
|
|
@@ -1868,7 +1883,7 @@ export default defineComponent({
|
|
|
1868
1883
|
if (tableElem) {
|
|
1869
1884
|
tableElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
1870
1885
|
// 兼容性处理
|
|
1871
|
-
tableElem.style.paddingRight =
|
|
1886
|
+
tableElem.style.paddingRight = osbWidth && fixedType && (browse['-moz'] || browse.safari) ? `${osbWidth}px` : '';
|
|
1872
1887
|
}
|
|
1873
1888
|
const emptyBlockElem = getRefElem(elemStore[`${name}-${layout}-emptyBlock`]);
|
|
1874
1889
|
if (emptyBlockElem) {
|
|
@@ -1905,7 +1920,7 @@ export default defineComponent({
|
|
|
1905
1920
|
// 如果是固定列
|
|
1906
1921
|
if (fixedWrapperElem) {
|
|
1907
1922
|
if (wrapperElem) {
|
|
1908
|
-
wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight -
|
|
1923
|
+
wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight - osbHeight : tableHeight + headerHeight}px`;
|
|
1909
1924
|
}
|
|
1910
1925
|
}
|
|
1911
1926
|
}
|
|
@@ -1930,7 +1945,7 @@ export default defineComponent({
|
|
|
1930
1945
|
cellOverflow = XEUtils.isUndefined(showFooterOverflow) || XEUtils.isNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
|
|
1931
1946
|
}
|
|
1932
1947
|
else {
|
|
1933
|
-
cellOverflow = XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow) ?
|
|
1948
|
+
cellOverflow = XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow) ? isAllOverflow : showOverflow;
|
|
1934
1949
|
}
|
|
1935
1950
|
const showEllipsis = cellOverflow === 'ellipsis';
|
|
1936
1951
|
const showTitle = cellOverflow === 'title';
|
|
@@ -2448,13 +2463,13 @@ export default defineComponent({
|
|
|
2448
2463
|
return nextTick().then(() => {
|
|
2449
2464
|
const { scrollXLoad, scrollYLoad } = reactData;
|
|
2450
2465
|
const { scrollXStore, scrollYStore } = internalData;
|
|
2451
|
-
const
|
|
2452
|
-
const
|
|
2466
|
+
const virtualYOpts = computeVirtualYOpts.value;
|
|
2467
|
+
const virtualXOpts = computeVirtualXOpts.value;
|
|
2453
2468
|
// 计算 X 逻辑
|
|
2454
2469
|
if (scrollXLoad) {
|
|
2455
2470
|
const { toVisibleIndex: toXVisibleIndex, visibleSize: visibleXSize } = handleVirtualXVisible();
|
|
2456
|
-
const offsetXSize = Math.max(0,
|
|
2457
|
-
scrollXStore.preloadSize =
|
|
2471
|
+
const offsetXSize = Math.max(0, virtualXOpts.oSize ? XEUtils.toNumber(virtualXOpts.oSize) : 0);
|
|
2472
|
+
scrollXStore.preloadSize = XEUtils.toNumber(virtualXOpts.preSize);
|
|
2458
2473
|
scrollXStore.offsetSize = offsetXSize;
|
|
2459
2474
|
scrollXStore.visibleSize = visibleXSize;
|
|
2460
2475
|
scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
|
|
@@ -2467,15 +2482,14 @@ export default defineComponent({
|
|
|
2467
2482
|
else {
|
|
2468
2483
|
$xeTable.updateScrollXSpace();
|
|
2469
2484
|
}
|
|
2470
|
-
calcCellHeight();
|
|
2471
2485
|
// 计算 Y 逻辑
|
|
2472
2486
|
const rowHeight = computeRowHeight();
|
|
2473
2487
|
scrollYStore.rowHeight = rowHeight;
|
|
2474
2488
|
reactData.rowHeight = rowHeight;
|
|
2475
2489
|
const { toVisibleIndex: toYVisibleIndex, visibleSize: visibleYSize } = handleVirtualYVisible();
|
|
2476
2490
|
if (scrollYLoad) {
|
|
2477
|
-
const offsetYSize = Math.max(0,
|
|
2478
|
-
scrollYStore.preloadSize =
|
|
2491
|
+
const offsetYSize = Math.max(0, virtualYOpts.oSize ? XEUtils.toNumber(virtualYOpts.oSize) : 0);
|
|
2492
|
+
scrollYStore.preloadSize = XEUtils.toNumber(virtualYOpts.preSize);
|
|
2479
2493
|
scrollYStore.offsetSize = offsetYSize;
|
|
2480
2494
|
scrollYStore.visibleSize = visibleYSize;
|
|
2481
2495
|
scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
|
|
@@ -2501,12 +2515,13 @@ export default defineComponent({
|
|
|
2501
2515
|
}
|
|
2502
2516
|
calcCellWidth();
|
|
2503
2517
|
autoCellWidth();
|
|
2518
|
+
updateStyle();
|
|
2504
2519
|
return computeScrollLoad().then(() => {
|
|
2505
2520
|
if (reFull === true) {
|
|
2506
2521
|
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
2507
|
-
calcCellHeight();
|
|
2508
2522
|
calcCellWidth();
|
|
2509
2523
|
autoCellWidth();
|
|
2524
|
+
updateStyle();
|
|
2510
2525
|
return computeScrollLoad();
|
|
2511
2526
|
}
|
|
2512
2527
|
});
|
|
@@ -2515,12 +2530,11 @@ export default defineComponent({
|
|
|
2515
2530
|
* 加载表格数据
|
|
2516
2531
|
* @param {Array} datas 数据
|
|
2517
2532
|
*/
|
|
2518
|
-
const loadTableData = (datas) => {
|
|
2519
|
-
const { keepSource, treeConfig
|
|
2533
|
+
const loadTableData = (datas, isReset) => {
|
|
2534
|
+
const { keepSource, treeConfig } = props;
|
|
2520
2535
|
const { editStore, scrollYLoad: oldScrollYLoad } = reactData;
|
|
2521
2536
|
const { scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop } = internalData;
|
|
2522
2537
|
const treeOpts = computeTreeOpts.value;
|
|
2523
|
-
const rowOpts = computeRowOpts.value;
|
|
2524
2538
|
const { transform } = treeOpts;
|
|
2525
2539
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2526
2540
|
let treeData = [];
|
|
@@ -2575,34 +2589,20 @@ export default defineComponent({
|
|
|
2575
2589
|
internalData.tableFullData = fullData;
|
|
2576
2590
|
internalData.tableFullTreeData = treeData;
|
|
2577
2591
|
// 缓存数据
|
|
2578
|
-
tablePrivateMethods.cacheRowMap(true);
|
|
2592
|
+
tablePrivateMethods.cacheRowMap(true, isReset);
|
|
2579
2593
|
// 原始数据
|
|
2580
2594
|
internalData.tableSynchData = datas;
|
|
2595
|
+
if (isReset) {
|
|
2596
|
+
internalData.isResizeCellHeight = false;
|
|
2597
|
+
reactData.rowExpandedMaps = {};
|
|
2598
|
+
reactData.rowExpandLazyLoadedMaps = {};
|
|
2599
|
+
reactData.treeExpandedMaps = {};
|
|
2600
|
+
reactData.treeExpandLazyLoadedMaps = {};
|
|
2601
|
+
}
|
|
2581
2602
|
// 克隆原数据,用于显示编辑状态,与编辑值做对比
|
|
2582
2603
|
if (keepSource) {
|
|
2583
2604
|
tablePrivateMethods.cacheSourceMap(fullData);
|
|
2584
2605
|
}
|
|
2585
|
-
if (sYLoad) {
|
|
2586
|
-
if (showOverflow) {
|
|
2587
|
-
if (!rowOpts.height) {
|
|
2588
|
-
const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false);
|
|
2589
|
-
if (errColumn) {
|
|
2590
|
-
errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true']);
|
|
2591
|
-
}
|
|
2592
|
-
}
|
|
2593
|
-
}
|
|
2594
|
-
if (process.env.NODE_ENV === 'development') {
|
|
2595
|
-
if (!(props.height || props.maxHeight)) {
|
|
2596
|
-
errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
|
|
2597
|
-
}
|
|
2598
|
-
// if (!props.showOverflow) {
|
|
2599
|
-
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2600
|
-
// }
|
|
2601
|
-
if (props.spanMethod) {
|
|
2602
|
-
warnLog('vxe.error.scrollErrProp', ['table.span-method']);
|
|
2603
|
-
}
|
|
2604
|
-
}
|
|
2605
|
-
}
|
|
2606
2606
|
if ($xeTable.clearCellAreas && props.mouseConfig) {
|
|
2607
2607
|
$xeTable.clearCellAreas();
|
|
2608
2608
|
$xeTable.clearCopyCellArea();
|
|
@@ -2621,6 +2621,27 @@ export default defineComponent({
|
|
|
2621
2621
|
if (sYLoad) {
|
|
2622
2622
|
scrollYStore.endIndex = scrollYStore.visibleSize;
|
|
2623
2623
|
}
|
|
2624
|
+
if (sYLoad) {
|
|
2625
|
+
// if (showOverflow) {
|
|
2626
|
+
// if (!rowOpts.height) {
|
|
2627
|
+
// const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
|
|
2628
|
+
// if (errColumn) {
|
|
2629
|
+
// errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
|
|
2630
|
+
// }
|
|
2631
|
+
// }
|
|
2632
|
+
// }
|
|
2633
|
+
if (process.env.NODE_ENV === 'development') {
|
|
2634
|
+
if (!(props.height || props.maxHeight)) {
|
|
2635
|
+
errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
|
|
2636
|
+
}
|
|
2637
|
+
// if (!props.showOverflow) {
|
|
2638
|
+
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2639
|
+
// }
|
|
2640
|
+
if (props.spanMethod) {
|
|
2641
|
+
warnLog('vxe.error.scrollErrProp', ['table.span-method']);
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2624
2645
|
handleReserveStatus();
|
|
2625
2646
|
tablePrivateMethods.checkSelectionStatus();
|
|
2626
2647
|
return new Promise(resolve => {
|
|
@@ -2638,6 +2659,7 @@ export default defineComponent({
|
|
|
2638
2659
|
if (sYOpts.scrollToTopOnChange) {
|
|
2639
2660
|
targetScrollTop = 0;
|
|
2640
2661
|
}
|
|
2662
|
+
calcCellHeight();
|
|
2641
2663
|
// 是否变更虚拟滚动
|
|
2642
2664
|
if (oldScrollYLoad === sYLoad) {
|
|
2643
2665
|
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
@@ -2993,8 +3015,9 @@ export default defineComponent({
|
|
|
2993
3015
|
handleVirtualTreeToList();
|
|
2994
3016
|
tablePrivateMethods.handleTableData();
|
|
2995
3017
|
updateAfterDataIndex();
|
|
3018
|
+
return nextTick();
|
|
2996
3019
|
}).then(() => {
|
|
2997
|
-
return tableMethods.recalculate();
|
|
3020
|
+
return tableMethods.recalculate(true);
|
|
2998
3021
|
}).then(() => {
|
|
2999
3022
|
setTimeout(() => {
|
|
3000
3023
|
tableMethods.updateCellAreas();
|
|
@@ -3015,13 +3038,12 @@ export default defineComponent({
|
|
|
3015
3038
|
/**
|
|
3016
3039
|
* 纵向 Y 可视渲染处理
|
|
3017
3040
|
*/
|
|
3018
|
-
const loadScrollYData = () => {
|
|
3019
|
-
const {
|
|
3020
|
-
const { mergeList } = reactData;
|
|
3041
|
+
const loadScrollYData = (scrollTop) => {
|
|
3042
|
+
const { mergeList, isAllOverflow } = reactData;
|
|
3021
3043
|
const { scrollYStore } = internalData;
|
|
3022
3044
|
const { preloadSize, startIndex, endIndex, offsetSize } = scrollYStore;
|
|
3023
|
-
const autoOffsetYSize =
|
|
3024
|
-
const { toVisibleIndex, visibleSize } = handleVirtualYVisible();
|
|
3045
|
+
const autoOffsetYSize = isAllOverflow ? offsetSize : offsetSize + 1;
|
|
3046
|
+
const { toVisibleIndex, visibleSize } = handleVirtualYVisible(scrollTop);
|
|
3025
3047
|
const offsetItem = {
|
|
3026
3048
|
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
3027
3049
|
endIndex: toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize
|
|
@@ -3066,7 +3088,7 @@ export default defineComponent({
|
|
|
3066
3088
|
const lazyScrollXData = () => {
|
|
3067
3089
|
const { lxTimeout, lxRunTime, scrollXStore } = internalData;
|
|
3068
3090
|
const { visibleSize } = scrollXStore;
|
|
3069
|
-
const fpsTime = Math.max(5, Math.min(
|
|
3091
|
+
const fpsTime = Math.max(5, Math.min(10, Math.floor(visibleSize / 3)));
|
|
3070
3092
|
if (lxTimeout) {
|
|
3071
3093
|
clearTimeout(lxTimeout);
|
|
3072
3094
|
}
|
|
@@ -3081,10 +3103,9 @@ export default defineComponent({
|
|
|
3081
3103
|
}, fpsTime);
|
|
3082
3104
|
};
|
|
3083
3105
|
const lazyScrollYData = () => {
|
|
3084
|
-
const { showOverflow } = props;
|
|
3085
3106
|
const { lyTimeout, lyRunTime, scrollYStore } = internalData;
|
|
3086
3107
|
const { visibleSize } = scrollYStore;
|
|
3087
|
-
const fpsTime =
|
|
3108
|
+
const fpsTime = Math.floor(Math.max(4, Math.min(10, visibleSize / 3)));
|
|
3088
3109
|
if (lyTimeout) {
|
|
3089
3110
|
clearTimeout(lyTimeout);
|
|
3090
3111
|
}
|
|
@@ -3098,68 +3119,6 @@ export default defineComponent({
|
|
|
3098
3119
|
loadScrollYData();
|
|
3099
3120
|
}, fpsTime);
|
|
3100
3121
|
};
|
|
3101
|
-
const scrollXEvent = (evnt) => {
|
|
3102
|
-
const { elemStore, inWheelScroll, lastScrollTop, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
3103
|
-
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
3104
|
-
return;
|
|
3105
|
-
}
|
|
3106
|
-
if (inWheelScroll) {
|
|
3107
|
-
return;
|
|
3108
|
-
}
|
|
3109
|
-
const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
|
|
3110
|
-
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
3111
|
-
const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
|
|
3112
|
-
const yHandleEl = refScrollYHandleElem.value;
|
|
3113
|
-
const wrapperEl = evnt.currentTarget;
|
|
3114
|
-
const { scrollLeft } = wrapperEl;
|
|
3115
|
-
const yBodyEl = yHandleEl || bodyScrollElem;
|
|
3116
|
-
let scrollTop = 0;
|
|
3117
|
-
if (yBodyEl) {
|
|
3118
|
-
scrollTop = yBodyEl.scrollTop;
|
|
3119
|
-
}
|
|
3120
|
-
const isRollX = true;
|
|
3121
|
-
const isRollY = scrollTop !== lastScrollTop;
|
|
3122
|
-
internalData.inVirtualScroll = true;
|
|
3123
|
-
setScrollLeft(bodyScrollElem, scrollLeft);
|
|
3124
|
-
setScrollLeft(headerScrollElem, scrollLeft);
|
|
3125
|
-
setScrollLeft(footerScrollElem, scrollLeft);
|
|
3126
|
-
$xeTable.triggerScrollXEvent(evnt);
|
|
3127
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
3128
|
-
type: 'table',
|
|
3129
|
-
fixed: ''
|
|
3130
|
-
});
|
|
3131
|
-
};
|
|
3132
|
-
const scrollYEvent = (evnt) => {
|
|
3133
|
-
const { elemStore, inWheelScroll, lastScrollLeft, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
3134
|
-
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
3135
|
-
return;
|
|
3136
|
-
}
|
|
3137
|
-
if (inWheelScroll) {
|
|
3138
|
-
return;
|
|
3139
|
-
}
|
|
3140
|
-
const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
|
|
3141
|
-
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
3142
|
-
const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
|
|
3143
|
-
const xHandleEl = refScrollXHandleElem.value;
|
|
3144
|
-
const wrapperEl = evnt.currentTarget;
|
|
3145
|
-
const { scrollTop } = wrapperEl;
|
|
3146
|
-
const xBodyEl = xHandleEl || bodyScrollElem;
|
|
3147
|
-
let scrollLeft = 0;
|
|
3148
|
-
if (xBodyEl) {
|
|
3149
|
-
scrollLeft = xBodyEl.scrollLeft;
|
|
3150
|
-
}
|
|
3151
|
-
const isRollX = scrollLeft !== lastScrollLeft;
|
|
3152
|
-
const isRollY = true;
|
|
3153
|
-
internalData.inVirtualScroll = true;
|
|
3154
|
-
setScrollTop(bodyScrollElem, scrollTop);
|
|
3155
|
-
setScrollTop(leftScrollElem, scrollTop);
|
|
3156
|
-
setScrollTop(rightScrollElem, scrollTop);
|
|
3157
|
-
$xeTable.triggerScrollYEvent(evnt);
|
|
3158
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
3159
|
-
type: 'table',
|
|
3160
|
-
fixed: ''
|
|
3161
|
-
});
|
|
3162
|
-
};
|
|
3163
3122
|
const checkLastSyncScroll = (isRollX, isRollY) => {
|
|
3164
3123
|
const { scrollXLoad, scrollYLoad } = reactData;
|
|
3165
3124
|
const { lcsTimeout } = internalData;
|
|
@@ -3169,27 +3128,68 @@ export default defineComponent({
|
|
|
3169
3128
|
internalData.lcsTimeout = setTimeout(() => {
|
|
3170
3129
|
internalData.lcsRunTime = Date.now();
|
|
3171
3130
|
internalData.lcsTimeout = undefined;
|
|
3131
|
+
internalData.intoRunScroll = false;
|
|
3172
3132
|
internalData.inVirtualScroll = false;
|
|
3173
3133
|
internalData.inWheelScroll = false;
|
|
3174
3134
|
internalData.inHeaderScroll = false;
|
|
3175
3135
|
internalData.inBodyScroll = false;
|
|
3176
3136
|
internalData.inFooterScroll = false;
|
|
3177
3137
|
internalData.scrollRenderType = '';
|
|
3138
|
+
calcCellHeight();
|
|
3178
3139
|
if (isRollX && scrollXLoad) {
|
|
3179
|
-
$xeTable.updateScrollXData()
|
|
3180
|
-
calcCellHeight();
|
|
3181
|
-
loadScrollXData();
|
|
3182
|
-
});
|
|
3140
|
+
$xeTable.updateScrollXData();
|
|
3183
3141
|
}
|
|
3184
3142
|
if (isRollY && scrollYLoad) {
|
|
3185
3143
|
$xeTable.updateScrollYData().then(() => {
|
|
3186
3144
|
calcCellHeight();
|
|
3187
|
-
|
|
3145
|
+
$xeTable.updateScrollYSpace();
|
|
3188
3146
|
});
|
|
3189
3147
|
}
|
|
3190
3148
|
$xeTable.updateCellAreas();
|
|
3191
3149
|
}, 200);
|
|
3192
3150
|
};
|
|
3151
|
+
const getWheelSpeed = (lastScrollTime) => {
|
|
3152
|
+
let multiple = 1;
|
|
3153
|
+
const currTime = Date.now();
|
|
3154
|
+
if (lastScrollTime + 25 > currTime) {
|
|
3155
|
+
multiple = 1.18;
|
|
3156
|
+
}
|
|
3157
|
+
else if (lastScrollTime + 30 > currTime) {
|
|
3158
|
+
multiple = 1.15;
|
|
3159
|
+
}
|
|
3160
|
+
else if (lastScrollTime + 40 > currTime) {
|
|
3161
|
+
multiple = 1.12;
|
|
3162
|
+
}
|
|
3163
|
+
else if (lastScrollTime + 55 > currTime) {
|
|
3164
|
+
multiple = 1.09;
|
|
3165
|
+
}
|
|
3166
|
+
else if (lastScrollTime + 75 > currTime) {
|
|
3167
|
+
multiple = 1.06;
|
|
3168
|
+
}
|
|
3169
|
+
else if (lastScrollTime + 100 > currTime) {
|
|
3170
|
+
multiple = 1.03;
|
|
3171
|
+
}
|
|
3172
|
+
return multiple;
|
|
3173
|
+
};
|
|
3174
|
+
const wheelScrollTo = (diffNum, cb) => {
|
|
3175
|
+
const duration = Math.abs(diffNum);
|
|
3176
|
+
const startTime = performance.now();
|
|
3177
|
+
let countTop = 0;
|
|
3178
|
+
const step = (timestamp) => {
|
|
3179
|
+
let progress = (timestamp - startTime) / duration;
|
|
3180
|
+
if (progress > 1) {
|
|
3181
|
+
progress = 1;
|
|
3182
|
+
}
|
|
3183
|
+
const easedProgress = Math.pow(progress, 2);
|
|
3184
|
+
const offsetTop = Math.floor((diffNum * easedProgress)) - countTop;
|
|
3185
|
+
countTop += offsetTop;
|
|
3186
|
+
cb(offsetTop);
|
|
3187
|
+
if (progress < 1) {
|
|
3188
|
+
requestAnimationFrame(step);
|
|
3189
|
+
}
|
|
3190
|
+
};
|
|
3191
|
+
requestAnimationFrame(step);
|
|
3192
|
+
};
|
|
3193
3193
|
const dispatchEvent = (type, params, evnt) => {
|
|
3194
3194
|
emit(type, createEvent(evnt, { $table: $xeTable, $grid: $xeGrid }, params));
|
|
3195
3195
|
};
|
|
@@ -3201,6 +3201,31 @@ export default defineComponent({
|
|
|
3201
3201
|
}
|
|
3202
3202
|
return nextTick();
|
|
3203
3203
|
};
|
|
3204
|
+
const handleUpdateResize = () => {
|
|
3205
|
+
const el = refElem.value;
|
|
3206
|
+
if (el && el.clientWidth && el.clientHeight) {
|
|
3207
|
+
tableMethods.recalculate();
|
|
3208
|
+
}
|
|
3209
|
+
};
|
|
3210
|
+
const handleUpdateColResize = (evnt, params) => {
|
|
3211
|
+
$xeTable.analyColumnWidth();
|
|
3212
|
+
$xeTable.recalculate(true).then(() => {
|
|
3213
|
+
$xeTable.saveCustomStore('update:width');
|
|
3214
|
+
$xeTable.updateCellAreas();
|
|
3215
|
+
$xeTable.dispatchEvent('column-resizable-change', params, evnt);
|
|
3216
|
+
// 已废弃 resizable-change
|
|
3217
|
+
$xeTable.dispatchEvent('resizable-change', params, evnt);
|
|
3218
|
+
setTimeout(() => $xeTable.recalculate(true), 300);
|
|
3219
|
+
});
|
|
3220
|
+
};
|
|
3221
|
+
const handleUpdateRowResize = (evnt, params) => {
|
|
3222
|
+
reactData.resizeHeightFlag++;
|
|
3223
|
+
$xeTable.recalculate(true).then(() => {
|
|
3224
|
+
$xeTable.updateCellAreas();
|
|
3225
|
+
$xeTable.dispatchEvent('row-resizable-change', params, evnt);
|
|
3226
|
+
setTimeout(() => $xeTable.recalculate(true), 300);
|
|
3227
|
+
});
|
|
3228
|
+
};
|
|
3204
3229
|
tableMethods = {
|
|
3205
3230
|
dispatchEvent,
|
|
3206
3231
|
/**
|
|
@@ -3253,7 +3278,7 @@ export default defineComponent({
|
|
|
3253
3278
|
*/
|
|
3254
3279
|
loadData(datas) {
|
|
3255
3280
|
const { initStatus } = internalData;
|
|
3256
|
-
return loadTableData(datas).then(() => {
|
|
3281
|
+
return loadTableData(datas, false).then(() => {
|
|
3257
3282
|
internalData.inited = true;
|
|
3258
3283
|
internalData.initStatus = true;
|
|
3259
3284
|
if (!initStatus) {
|
|
@@ -3271,7 +3296,7 @@ export default defineComponent({
|
|
|
3271
3296
|
.then(() => {
|
|
3272
3297
|
internalData.inited = true;
|
|
3273
3298
|
internalData.initStatus = true;
|
|
3274
|
-
return loadTableData(datas);
|
|
3299
|
+
return loadTableData(datas, true);
|
|
3275
3300
|
}).then(() => {
|
|
3276
3301
|
handleLoadDefaults();
|
|
3277
3302
|
return tableMethods.recalculate();
|
|
@@ -3362,7 +3387,7 @@ export default defineComponent({
|
|
|
3362
3387
|
XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
|
|
3363
3388
|
const rowid = getRowid($xeTable, childRow);
|
|
3364
3389
|
const parentRow = parentItem || parentRest.row;
|
|
3365
|
-
const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, oTop: 0 };
|
|
3390
|
+
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 };
|
|
3366
3391
|
fullDataRowIdData[rowid] = rest;
|
|
3367
3392
|
fullAllDataRowIdData[rowid] = rest;
|
|
3368
3393
|
}, { children: childrenField });
|
|
@@ -3591,30 +3616,31 @@ export default defineComponent({
|
|
|
3591
3616
|
return nextTick();
|
|
3592
3617
|
},
|
|
3593
3618
|
getCellElement(row, fieldOrColumn) {
|
|
3619
|
+
const { elemStore } = internalData;
|
|
3594
3620
|
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
3595
3621
|
if (!column) {
|
|
3596
3622
|
return null;
|
|
3597
3623
|
}
|
|
3598
3624
|
const rowid = getRowid($xeTable, row);
|
|
3599
|
-
const
|
|
3600
|
-
const
|
|
3601
|
-
const
|
|
3625
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
3626
|
+
const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
|
|
3627
|
+
const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
|
|
3602
3628
|
let bodyElem;
|
|
3603
3629
|
if (column) {
|
|
3604
3630
|
if (column.fixed) {
|
|
3605
3631
|
if (column.fixed === 'left') {
|
|
3606
|
-
if (
|
|
3607
|
-
bodyElem =
|
|
3632
|
+
if (leftScrollElem) {
|
|
3633
|
+
bodyElem = leftScrollElem;
|
|
3608
3634
|
}
|
|
3609
3635
|
}
|
|
3610
3636
|
else {
|
|
3611
|
-
if (
|
|
3612
|
-
bodyElem =
|
|
3637
|
+
if (rightScrollElem) {
|
|
3638
|
+
bodyElem = rightScrollElem;
|
|
3613
3639
|
}
|
|
3614
3640
|
}
|
|
3615
3641
|
}
|
|
3616
3642
|
if (!bodyElem) {
|
|
3617
|
-
bodyElem =
|
|
3643
|
+
bodyElem = bodyScrollElem;
|
|
3618
3644
|
}
|
|
3619
3645
|
if (bodyElem) {
|
|
3620
3646
|
return bodyElem.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`);
|
|
@@ -4023,29 +4049,34 @@ export default defineComponent({
|
|
|
4023
4049
|
return nextTick();
|
|
4024
4050
|
},
|
|
4025
4051
|
setColumnWidth(fieldOrColumn, width) {
|
|
4052
|
+
const { elemStore } = internalData;
|
|
4026
4053
|
let status = false;
|
|
4027
4054
|
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4055
|
+
let cWidth = XEUtils.toInteger(width);
|
|
4056
|
+
if (isScale(width)) {
|
|
4057
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
4058
|
+
const bodyWidth = bodyScrollElem ? bodyScrollElem.clientWidth - 1 : 0;
|
|
4059
|
+
cWidth = Math.floor(cWidth * bodyWidth);
|
|
4060
|
+
}
|
|
4061
|
+
if (cWidth) {
|
|
4062
|
+
cols.forEach(item => {
|
|
4063
|
+
const column = handleFieldOrColumn($xeTable, item);
|
|
4064
|
+
if (column) {
|
|
4065
|
+
column.resizeWidth = cWidth;
|
|
4066
|
+
if (!status) {
|
|
4067
|
+
status = true;
|
|
4068
|
+
}
|
|
4042
4069
|
}
|
|
4070
|
+
});
|
|
4071
|
+
if (status) {
|
|
4072
|
+
return $xeTable.refreshColumn().then(() => {
|
|
4073
|
+
return { status };
|
|
4074
|
+
});
|
|
4043
4075
|
}
|
|
4044
|
-
});
|
|
4045
|
-
if (status) {
|
|
4046
|
-
return tableMethods.refreshColumn();
|
|
4047
4076
|
}
|
|
4048
|
-
return nextTick()
|
|
4077
|
+
return nextTick().then(() => {
|
|
4078
|
+
return { status };
|
|
4079
|
+
});
|
|
4049
4080
|
},
|
|
4050
4081
|
getColumnWidth(fieldOrColumn) {
|
|
4051
4082
|
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
@@ -4078,6 +4109,93 @@ export default defineComponent({
|
|
|
4078
4109
|
return tableMethods.recalculate();
|
|
4079
4110
|
});
|
|
4080
4111
|
},
|
|
4112
|
+
setRowHeightConf(heightConf) {
|
|
4113
|
+
const { fullAllDataRowIdData } = internalData;
|
|
4114
|
+
let status = false;
|
|
4115
|
+
if (heightConf) {
|
|
4116
|
+
XEUtils.each(heightConf, (height, rowid) => {
|
|
4117
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
4118
|
+
if (rowRest) {
|
|
4119
|
+
const rHeight = XEUtils.toInteger(height);
|
|
4120
|
+
if (rHeight) {
|
|
4121
|
+
rowRest.resizeHeight = rHeight;
|
|
4122
|
+
if (!status) {
|
|
4123
|
+
status = true;
|
|
4124
|
+
}
|
|
4125
|
+
}
|
|
4126
|
+
}
|
|
4127
|
+
});
|
|
4128
|
+
if (status) {
|
|
4129
|
+
internalData.isResizeCellHeight = true;
|
|
4130
|
+
reactData.resizeHeightFlag++;
|
|
4131
|
+
}
|
|
4132
|
+
}
|
|
4133
|
+
return nextTick().then(() => {
|
|
4134
|
+
return { status };
|
|
4135
|
+
});
|
|
4136
|
+
},
|
|
4137
|
+
getRowHeightConf(isFull) {
|
|
4138
|
+
const { fullAllDataRowIdData, afterFullData } = internalData;
|
|
4139
|
+
const rowOpts = computeRowOpts.value;
|
|
4140
|
+
const cellOpts = computeCellOpts.value;
|
|
4141
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
4142
|
+
const rest = {};
|
|
4143
|
+
afterFullData.forEach(row => {
|
|
4144
|
+
const rowid = getRowid($xeTable, row);
|
|
4145
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
4146
|
+
if (rowRest) {
|
|
4147
|
+
const resizeHeight = rowRest.resizeHeight;
|
|
4148
|
+
if (resizeHeight || isFull) {
|
|
4149
|
+
const currCellHeight = resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
4150
|
+
rest[rowid] = currCellHeight;
|
|
4151
|
+
}
|
|
4152
|
+
}
|
|
4153
|
+
});
|
|
4154
|
+
return rest;
|
|
4155
|
+
},
|
|
4156
|
+
setRowHeight(rowOrId, height) {
|
|
4157
|
+
const { fullAllDataRowIdData } = internalData;
|
|
4158
|
+
let status = false;
|
|
4159
|
+
const rows = XEUtils.isArray(rowOrId) ? rowOrId : [rowOrId];
|
|
4160
|
+
let rHeight = XEUtils.toInteger(height);
|
|
4161
|
+
if (isScale(height)) {
|
|
4162
|
+
const tableBody = refTableBody.value;
|
|
4163
|
+
const bodyElem = tableBody ? tableBody.$el : null;
|
|
4164
|
+
const bodyHeight = bodyElem ? bodyElem.clientHeight - 1 : 0;
|
|
4165
|
+
rHeight = Math.floor(rHeight * bodyHeight);
|
|
4166
|
+
}
|
|
4167
|
+
if (rHeight) {
|
|
4168
|
+
rows.forEach(row => {
|
|
4169
|
+
const rowid = XEUtils.isString(row) || XEUtils.isNumber(row) ? row : getRowid($xeTable, row);
|
|
4170
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
4171
|
+
if (rowRest) {
|
|
4172
|
+
rowRest.resizeHeight = rHeight;
|
|
4173
|
+
if (!status) {
|
|
4174
|
+
status = true;
|
|
4175
|
+
}
|
|
4176
|
+
}
|
|
4177
|
+
});
|
|
4178
|
+
if (status) {
|
|
4179
|
+
internalData.isResizeCellHeight = true;
|
|
4180
|
+
reactData.resizeHeightFlag++;
|
|
4181
|
+
}
|
|
4182
|
+
}
|
|
4183
|
+
return nextTick().then(() => {
|
|
4184
|
+
return { status };
|
|
4185
|
+
});
|
|
4186
|
+
},
|
|
4187
|
+
getRowHeight(rowOrId) {
|
|
4188
|
+
const { fullAllDataRowIdData } = internalData;
|
|
4189
|
+
const rowOpts = computeRowOpts.value;
|
|
4190
|
+
const cellOpts = computeCellOpts.value;
|
|
4191
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
4192
|
+
const rowid = XEUtils.isString(rowOrId) || XEUtils.isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId);
|
|
4193
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
4194
|
+
if (rowRest) {
|
|
4195
|
+
return rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
4196
|
+
}
|
|
4197
|
+
return 0;
|
|
4198
|
+
},
|
|
4081
4199
|
/**
|
|
4082
4200
|
* 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
|
|
4083
4201
|
*/
|
|
@@ -5108,13 +5226,13 @@ export default defineComponent({
|
|
|
5108
5226
|
*/
|
|
5109
5227
|
getScroll() {
|
|
5110
5228
|
const { scrollXLoad, scrollYLoad } = reactData;
|
|
5111
|
-
const
|
|
5112
|
-
const
|
|
5229
|
+
const { elemStore } = internalData;
|
|
5230
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
5113
5231
|
return {
|
|
5114
5232
|
virtualX: scrollXLoad,
|
|
5115
5233
|
virtualY: scrollYLoad,
|
|
5116
|
-
scrollTop:
|
|
5117
|
-
scrollLeft:
|
|
5234
|
+
scrollTop: bodyScrollElem ? bodyScrollElem.scrollTop : 0,
|
|
5235
|
+
scrollLeft: bodyScrollElem ? bodyScrollElem.scrollLeft : 0
|
|
5118
5236
|
};
|
|
5119
5237
|
},
|
|
5120
5238
|
/**
|
|
@@ -5162,8 +5280,7 @@ export default defineComponent({
|
|
|
5162
5280
|
* @param {ColumnInfo} fieldOrColumn 列配置
|
|
5163
5281
|
*/
|
|
5164
5282
|
scrollToRow(row, fieldOrColumn) {
|
|
5165
|
-
const {
|
|
5166
|
-
const { scrollYLoad, scrollXLoad } = reactData;
|
|
5283
|
+
const { isAllOverflow, scrollYLoad, scrollXLoad } = reactData;
|
|
5167
5284
|
const rest = [];
|
|
5168
5285
|
if (row) {
|
|
5169
5286
|
if (props.treeConfig) {
|
|
@@ -5178,7 +5295,7 @@ export default defineComponent({
|
|
|
5178
5295
|
}
|
|
5179
5296
|
return Promise.all(rest).then(() => {
|
|
5180
5297
|
if (row) {
|
|
5181
|
-
if (!
|
|
5298
|
+
if (!isAllOverflow && (scrollYLoad || scrollXLoad)) {
|
|
5182
5299
|
calcCellHeight();
|
|
5183
5300
|
calcCellWidth();
|
|
5184
5301
|
}
|
|
@@ -6143,25 +6260,29 @@ export default defineComponent({
|
|
|
6143
6260
|
if (!el) {
|
|
6144
6261
|
return;
|
|
6145
6262
|
}
|
|
6146
|
-
const { scrollbarWidth, scrollbarHeight } = reactData;
|
|
6263
|
+
const { overflowX, scrollbarWidth, overflowY, scrollbarHeight } = reactData;
|
|
6147
6264
|
const { prevDragToChild } = internalData;
|
|
6148
6265
|
const wrapperRect = el.getBoundingClientRect();
|
|
6266
|
+
const osbWidth = overflowY ? scrollbarWidth : 0;
|
|
6267
|
+
const osbHeight = overflowX ? scrollbarHeight : 0;
|
|
6149
6268
|
const tableWidth = el.clientWidth;
|
|
6150
6269
|
const tableHeight = el.clientHeight;
|
|
6151
6270
|
if (trEl) {
|
|
6152
6271
|
const rdLineEl = refDragRowLineElem.value;
|
|
6153
6272
|
if (rdLineEl) {
|
|
6154
6273
|
if (showLine) {
|
|
6274
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value;
|
|
6155
6275
|
const trRect = trEl.getBoundingClientRect();
|
|
6156
6276
|
let trHeight = trEl.clientHeight;
|
|
6157
6277
|
const offsetTop = Math.max(1, trRect.y - wrapperRect.y);
|
|
6158
|
-
if (offsetTop + trHeight > tableHeight -
|
|
6159
|
-
trHeight = tableHeight - offsetTop -
|
|
6278
|
+
if (offsetTop + trHeight > tableHeight - osbHeight) {
|
|
6279
|
+
trHeight = tableHeight - offsetTop - osbHeight;
|
|
6160
6280
|
}
|
|
6161
6281
|
rdLineEl.style.display = 'block';
|
|
6282
|
+
rdLineEl.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
|
|
6162
6283
|
rdLineEl.style.top = `${offsetTop}px`;
|
|
6163
6284
|
rdLineEl.style.height = `${trHeight}px`;
|
|
6164
|
-
rdLineEl.style.width = `${tableWidth -
|
|
6285
|
+
rdLineEl.style.width = `${tableWidth - osbWidth}px`;
|
|
6165
6286
|
rdLineEl.setAttribute('drag-pos', dragPos);
|
|
6166
6287
|
rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
|
|
6167
6288
|
}
|
|
@@ -6174,6 +6295,7 @@ export default defineComponent({
|
|
|
6174
6295
|
const cdLineEl = refDragColLineElem.value;
|
|
6175
6296
|
if (cdLineEl) {
|
|
6176
6297
|
if (showLine) {
|
|
6298
|
+
const scrollbarXToTop = computeScrollbarXToTop.value;
|
|
6177
6299
|
const leftContainerElem = refLeftContainer.value;
|
|
6178
6300
|
const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
|
|
6179
6301
|
const rightContainerElem = refRightContainer.value;
|
|
@@ -6187,7 +6309,7 @@ export default defineComponent({
|
|
|
6187
6309
|
thWidth -= startX - offsetLeft;
|
|
6188
6310
|
offsetLeft = startX;
|
|
6189
6311
|
}
|
|
6190
|
-
const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 :
|
|
6312
|
+
const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 : osbWidth);
|
|
6191
6313
|
if (offsetLeft + thWidth > endX) {
|
|
6192
6314
|
thWidth = endX - offsetLeft;
|
|
6193
6315
|
}
|
|
@@ -6199,7 +6321,7 @@ export default defineComponent({
|
|
|
6199
6321
|
cdLineEl.style.height = `${thRect.height}px`;
|
|
6200
6322
|
}
|
|
6201
6323
|
else {
|
|
6202
|
-
cdLineEl.style.height = `${tableHeight - offsetTop -
|
|
6324
|
+
cdLineEl.style.height = `${tableHeight - offsetTop - (scrollbarXToTop ? 0 : osbHeight)}px`;
|
|
6203
6325
|
}
|
|
6204
6326
|
cdLineEl.setAttribute('drag-pos', dragPos);
|
|
6205
6327
|
cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
|
|
@@ -6236,11 +6358,11 @@ export default defineComponent({
|
|
|
6236
6358
|
* @param {Event} evnt 事件
|
|
6237
6359
|
* @param {Row} row 行对象
|
|
6238
6360
|
*/
|
|
6239
|
-
const handleTooltip = (evnt,
|
|
6361
|
+
const handleTooltip = (evnt, tdEl, overflowElem, tipElem, params) => {
|
|
6240
6362
|
if (!overflowElem) {
|
|
6241
6363
|
return nextTick();
|
|
6242
6364
|
}
|
|
6243
|
-
params.cell =
|
|
6365
|
+
params.cell = tdEl;
|
|
6244
6366
|
const { tooltipStore } = reactData;
|
|
6245
6367
|
const tooltipOpts = computeTooltipOpts.value;
|
|
6246
6368
|
const { column, row } = params;
|
|
@@ -6389,9 +6511,8 @@ export default defineComponent({
|
|
|
6389
6511
|
},
|
|
6390
6512
|
/**
|
|
6391
6513
|
* 更新数据行的 Map
|
|
6392
|
-
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
6393
6514
|
*/
|
|
6394
|
-
cacheRowMap(isSource) {
|
|
6515
|
+
cacheRowMap(isReset, isSource) {
|
|
6395
6516
|
const { treeConfig } = props;
|
|
6396
6517
|
const treeOpts = computeTreeOpts.value;
|
|
6397
6518
|
const { fullAllDataRowIdData, tableFullData, tableFullTreeData } = internalData;
|
|
@@ -6413,8 +6534,8 @@ export default defineComponent({
|
|
|
6413
6534
|
row[childrenField] = null;
|
|
6414
6535
|
}
|
|
6415
6536
|
let cacheItem = fullAllDataRowIdData[rowid];
|
|
6416
|
-
if (!cacheItem) {
|
|
6417
|
-
cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, items, parent: parentRow, level, height: 0, oTop: 0 };
|
|
6537
|
+
if (isReset || !cacheItem) {
|
|
6538
|
+
cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0 };
|
|
6418
6539
|
}
|
|
6419
6540
|
cacheItem.row = row;
|
|
6420
6541
|
cacheItem.items = items;
|
|
@@ -6513,34 +6634,329 @@ export default defineComponent({
|
|
|
6513
6634
|
});
|
|
6514
6635
|
Object.assign(reactData.columnStore, { resizeList, pxList, pxMinList, autoMinList, scaleList, scaleMinList, autoList, remainList });
|
|
6515
6636
|
},
|
|
6516
|
-
|
|
6637
|
+
handleColResizeMousedownEvent(evnt, fixedType, params) {
|
|
6638
|
+
evnt.stopPropagation();
|
|
6639
|
+
evnt.preventDefault();
|
|
6640
|
+
const { column } = params;
|
|
6641
|
+
const { overflowX, scrollbarHeight } = reactData;
|
|
6642
|
+
const { elemStore, visibleColumn } = internalData;
|
|
6517
6643
|
const resizableOpts = computeResizableOpts.value;
|
|
6518
|
-
const
|
|
6519
|
-
const
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
column.
|
|
6534
|
-
|
|
6535
|
-
internalData._lastResizeTime = Date.now();
|
|
6536
|
-
$xeTable.analyColumnWidth();
|
|
6537
|
-
$xeTable.recalculate(true).then(() => {
|
|
6538
|
-
$xeTable.saveCustomStore('update:visible');
|
|
6539
|
-
$xeTable.updateCellAreas();
|
|
6540
|
-
$xeTable.dispatchEvent('resizable-change', Object.assign(Object.assign({}, params), { resizeWidth }), evnt);
|
|
6541
|
-
setTimeout(() => $xeTable.recalculate(true), 300);
|
|
6644
|
+
const osbHeight = overflowX ? scrollbarHeight : 0;
|
|
6645
|
+
const tableEl = refElem.value;
|
|
6646
|
+
const leftContainerElem = refLeftContainer.value;
|
|
6647
|
+
const rightContainerElem = refRightContainer.value;
|
|
6648
|
+
const resizeBarElem = refColResizeBar.value;
|
|
6649
|
+
if (!resizeBarElem) {
|
|
6650
|
+
return;
|
|
6651
|
+
}
|
|
6652
|
+
const resizeTipElem = resizeBarElem.firstElementChild;
|
|
6653
|
+
const scrollbarXToTop = computeScrollbarXToTop.value;
|
|
6654
|
+
const { clientX: dragClientX } = evnt;
|
|
6655
|
+
const wrapperElem = refElem.value;
|
|
6656
|
+
const dragBtnElem = evnt.target;
|
|
6657
|
+
let resizeColumn = column;
|
|
6658
|
+
if (column.children && column.children.length) {
|
|
6659
|
+
XEUtils.eachTree(column.children, childColumn => {
|
|
6660
|
+
resizeColumn = childColumn;
|
|
6542
6661
|
});
|
|
6543
6662
|
}
|
|
6663
|
+
const cell = dragBtnElem.parentNode;
|
|
6664
|
+
const cellParams = Object.assign(params, { cell });
|
|
6665
|
+
let dragLeft = 0;
|
|
6666
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
6667
|
+
if (!bodyScrollElem) {
|
|
6668
|
+
return;
|
|
6669
|
+
}
|
|
6670
|
+
const pos = getOffsetPos(dragBtnElem, wrapperElem);
|
|
6671
|
+
const dragBtnWidth = dragBtnElem.clientWidth;
|
|
6672
|
+
const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2);
|
|
6673
|
+
const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
|
|
6674
|
+
let dragMinLeft = pos.left - cell.clientWidth + dragBtnWidth + minInterval;
|
|
6675
|
+
let dragPosLeft = pos.left + dragBtnOffsetWidth;
|
|
6676
|
+
const isLeftFixed = fixedType === 'left';
|
|
6677
|
+
const isRightFixed = fixedType === 'right';
|
|
6678
|
+
// 计算左右侧固定列偏移量
|
|
6679
|
+
let fixedOffsetWidth = 0;
|
|
6680
|
+
if (isLeftFixed || isRightFixed) {
|
|
6681
|
+
const siblingProp = isLeftFixed ? 'nextElementSibling' : 'previousElementSibling';
|
|
6682
|
+
let tempCellElem = cell[siblingProp];
|
|
6683
|
+
while (tempCellElem) {
|
|
6684
|
+
if (hasClass(tempCellElem, 'fixed--hidden')) {
|
|
6685
|
+
break;
|
|
6686
|
+
}
|
|
6687
|
+
else if (!hasClass(tempCellElem, 'col--group')) {
|
|
6688
|
+
fixedOffsetWidth += tempCellElem.offsetWidth;
|
|
6689
|
+
}
|
|
6690
|
+
tempCellElem = tempCellElem[siblingProp];
|
|
6691
|
+
}
|
|
6692
|
+
if (isRightFixed && rightContainerElem) {
|
|
6693
|
+
dragPosLeft = rightContainerElem.offsetLeft + fixedOffsetWidth;
|
|
6694
|
+
}
|
|
6695
|
+
}
|
|
6696
|
+
// 处理拖动事件
|
|
6697
|
+
const updateEvent = (evnt) => {
|
|
6698
|
+
evnt.stopPropagation();
|
|
6699
|
+
evnt.preventDefault();
|
|
6700
|
+
const tableHeight = tableEl.clientHeight;
|
|
6701
|
+
const offsetX = evnt.clientX - dragClientX;
|
|
6702
|
+
let left = dragPosLeft + offsetX;
|
|
6703
|
+
const scrollLeft = fixedType ? 0 : bodyScrollElem.scrollLeft;
|
|
6704
|
+
if (isLeftFixed) {
|
|
6705
|
+
// 左固定列(不允许超过右侧固定列、不允许超过右边距)
|
|
6706
|
+
left = Math.min(left, (rightContainerElem ? rightContainerElem.offsetLeft : bodyScrollElem.clientWidth) - fixedOffsetWidth - minInterval);
|
|
6707
|
+
}
|
|
6708
|
+
else if (isRightFixed) {
|
|
6709
|
+
// 右侧固定列(不允许超过左侧固定列、不允许超过左边距)
|
|
6710
|
+
dragMinLeft = (leftContainerElem ? leftContainerElem.clientWidth : 0) + fixedOffsetWidth + minInterval;
|
|
6711
|
+
left = Math.min(left, dragPosLeft + cell.clientWidth - minInterval);
|
|
6712
|
+
}
|
|
6713
|
+
else {
|
|
6714
|
+
dragMinLeft = Math.max(bodyScrollElem.scrollLeft, dragMinLeft);
|
|
6715
|
+
// left = Math.min(left, bodyScrollElem.clientWidth + bodyScrollElem.scrollLeft - 40)
|
|
6716
|
+
}
|
|
6717
|
+
dragLeft = Math.max(left, dragMinLeft);
|
|
6718
|
+
const resizeBarLeft = Math.max(1, dragLeft - scrollLeft);
|
|
6719
|
+
resizeBarElem.style.left = `${resizeBarLeft}px`;
|
|
6720
|
+
resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`;
|
|
6721
|
+
resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - osbHeight : tableHeight}px`;
|
|
6722
|
+
if (resizableOpts.showDragTip && resizeTipElem) {
|
|
6723
|
+
resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
|
|
6724
|
+
const tableWidth = tableEl.clientWidth;
|
|
6725
|
+
const wrapperRect = wrapperElem.getBoundingClientRect();
|
|
6726
|
+
const resizeBarWidth = resizeBarElem.clientWidth;
|
|
6727
|
+
const resizeTipWidth = resizeTipElem.clientWidth;
|
|
6728
|
+
const resizeTipHeight = resizeTipElem.clientHeight;
|
|
6729
|
+
let resizeTipLeft = -resizeTipWidth;
|
|
6730
|
+
if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
|
|
6731
|
+
resizeTipLeft = 0;
|
|
6732
|
+
}
|
|
6733
|
+
else if (resizeBarLeft > tableWidth) {
|
|
6734
|
+
resizeTipLeft += tableWidth - resizeBarLeft;
|
|
6735
|
+
}
|
|
6736
|
+
resizeTipElem.style.left = `${resizeTipLeft}px`;
|
|
6737
|
+
resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
|
|
6738
|
+
}
|
|
6739
|
+
reactData.isDragResize = true;
|
|
6740
|
+
};
|
|
6741
|
+
reactData.isDragResize = true;
|
|
6742
|
+
addClass(tableEl, 'col-drag--resize');
|
|
6743
|
+
resizeBarElem.style.display = 'block';
|
|
6744
|
+
document.onmousemove = updateEvent;
|
|
6745
|
+
document.onmouseup = function (evnt) {
|
|
6746
|
+
document.onmousemove = null;
|
|
6747
|
+
document.onmouseup = null;
|
|
6748
|
+
resizeBarElem.style.display = 'none';
|
|
6749
|
+
internalData._lastResizeTime = Date.now();
|
|
6750
|
+
setTimeout(() => {
|
|
6751
|
+
reactData.isDragResize = false;
|
|
6752
|
+
}, 50);
|
|
6753
|
+
const resizeWidth = resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
|
|
6754
|
+
const resizeParams = Object.assign(Object.assign({}, params), { resizeWidth, resizeColumn });
|
|
6755
|
+
if (resizableOpts.dragMode === 'fixed') {
|
|
6756
|
+
visibleColumn.forEach(item => {
|
|
6757
|
+
if (item.id !== resizeColumn.id) {
|
|
6758
|
+
if (!item.resizeWidth) {
|
|
6759
|
+
item.resizeWidth = item.renderWidth;
|
|
6760
|
+
}
|
|
6761
|
+
}
|
|
6762
|
+
});
|
|
6763
|
+
}
|
|
6764
|
+
if ($xeTable.handleColResizeCellAreaEvent) {
|
|
6765
|
+
$xeTable.handleColResizeCellAreaEvent(evnt, resizeParams);
|
|
6766
|
+
}
|
|
6767
|
+
else {
|
|
6768
|
+
resizeColumn.resizeWidth = resizeWidth;
|
|
6769
|
+
handleUpdateColResize(evnt, resizeParams);
|
|
6770
|
+
}
|
|
6771
|
+
removeClass(tableEl, 'col-drag--resize');
|
|
6772
|
+
};
|
|
6773
|
+
updateEvent(evnt);
|
|
6774
|
+
if ($xeTable.closeMenu) {
|
|
6775
|
+
$xeTable.closeMenu();
|
|
6776
|
+
}
|
|
6777
|
+
},
|
|
6778
|
+
handleColResizeDblclickEvent(evnt, params) {
|
|
6779
|
+
const resizableOpts = computeResizableOpts.value;
|
|
6780
|
+
const { isDblclickAutoWidth } = resizableOpts;
|
|
6781
|
+
const el = refElem.value;
|
|
6782
|
+
if (isDblclickAutoWidth && el) {
|
|
6783
|
+
evnt.stopPropagation();
|
|
6784
|
+
evnt.preventDefault();
|
|
6785
|
+
const { fullColumnIdData } = internalData;
|
|
6786
|
+
const { column } = params;
|
|
6787
|
+
let resizeColumn = column;
|
|
6788
|
+
if (column.children && column.children.length) {
|
|
6789
|
+
XEUtils.eachTree(column.children, childColumn => {
|
|
6790
|
+
resizeColumn = childColumn;
|
|
6791
|
+
});
|
|
6792
|
+
}
|
|
6793
|
+
const colid = resizeColumn.id;
|
|
6794
|
+
const colRest = fullColumnIdData[colid];
|
|
6795
|
+
const dragBtnElem = evnt.target;
|
|
6796
|
+
const cell = dragBtnElem.parentNode;
|
|
6797
|
+
const cellParams = Object.assign(params, { cell });
|
|
6798
|
+
const colMinWidth = getColReMinWidth(cellParams);
|
|
6799
|
+
el.setAttribute('data-calc-col', 'Y');
|
|
6800
|
+
let resizeWidth = calcColumnAutoWidth(resizeColumn, el);
|
|
6801
|
+
el.removeAttribute('data-calc-col');
|
|
6802
|
+
if (colRest) {
|
|
6803
|
+
resizeWidth = Math.max(resizeWidth, colRest.width);
|
|
6804
|
+
}
|
|
6805
|
+
resizeWidth = Math.max(colMinWidth, resizeWidth);
|
|
6806
|
+
const resizeParams = Object.assign(Object.assign({}, params), { resizeWidth, resizeColumn });
|
|
6807
|
+
reactData.isDragResize = false;
|
|
6808
|
+
internalData._lastResizeTime = Date.now();
|
|
6809
|
+
if ($xeTable.handleColResizeDblclickCellAreaEvent) {
|
|
6810
|
+
$xeTable.handleColResizeDblclickCellAreaEvent(evnt, resizeParams);
|
|
6811
|
+
}
|
|
6812
|
+
else {
|
|
6813
|
+
resizeColumn.resizeWidth = resizeWidth;
|
|
6814
|
+
handleUpdateColResize(evnt, resizeParams);
|
|
6815
|
+
}
|
|
6816
|
+
}
|
|
6817
|
+
},
|
|
6818
|
+
handleRowResizeMousedownEvent(evnt, params) {
|
|
6819
|
+
evnt.stopPropagation();
|
|
6820
|
+
evnt.preventDefault();
|
|
6821
|
+
const { row } = params;
|
|
6822
|
+
const { overflowX, scrollbarWidth, overflowY, scrollbarHeight } = reactData;
|
|
6823
|
+
const { elemStore, fullAllDataRowIdData } = internalData;
|
|
6824
|
+
const osbWidth = overflowY ? scrollbarWidth : 0;
|
|
6825
|
+
const osbHeight = overflowX ? scrollbarHeight : 0;
|
|
6826
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value;
|
|
6827
|
+
const resizableOpts = computeResizableOpts.value;
|
|
6828
|
+
const rowOpts = computeRowOpts.value;
|
|
6829
|
+
const cellOpts = computeCellOpts.value;
|
|
6830
|
+
const tableEl = refElem.value;
|
|
6831
|
+
const resizeBarElem = refRowResizeBar.value;
|
|
6832
|
+
if (!resizeBarElem) {
|
|
6833
|
+
return;
|
|
6834
|
+
}
|
|
6835
|
+
const { clientY: dragClientY } = evnt;
|
|
6836
|
+
const resizeTipElem = resizeBarElem.firstElementChild;
|
|
6837
|
+
const dragBtnElem = evnt.currentTarget;
|
|
6838
|
+
const tdEl = dragBtnElem.parentNode;
|
|
6839
|
+
const trEl = tdEl.parentNode;
|
|
6840
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
6841
|
+
if (!bodyScrollElem) {
|
|
6842
|
+
return;
|
|
6843
|
+
}
|
|
6844
|
+
const rowid = getRowid($xeTable, row);
|
|
6845
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
6846
|
+
if (!rowRest) {
|
|
6847
|
+
return;
|
|
6848
|
+
}
|
|
6849
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
6850
|
+
const currCellHeight = rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
6851
|
+
const tableRect = tableEl.getBoundingClientRect();
|
|
6852
|
+
const trRect = trEl.getBoundingClientRect();
|
|
6853
|
+
const targetOffsetY = dragClientY - trRect.y - trEl.clientHeight;
|
|
6854
|
+
let resizeHeight = currCellHeight;
|
|
6855
|
+
const cellEl = tdEl.querySelector('.vxe-cell');
|
|
6856
|
+
let cellMinHeight = 0;
|
|
6857
|
+
if (cellEl) {
|
|
6858
|
+
const cellStyle = getComputedStyle(cellEl);
|
|
6859
|
+
cellMinHeight = Math.max(1, Math.ceil(XEUtils.toNumber(cellStyle.paddingTop) + XEUtils.toNumber(cellStyle.paddingBottom)));
|
|
6860
|
+
}
|
|
6861
|
+
const minTop = trRect.y - tableRect.y + cellMinHeight;
|
|
6862
|
+
// 处理拖动事件
|
|
6863
|
+
const updateEvent = (evnt) => {
|
|
6864
|
+
evnt.stopPropagation();
|
|
6865
|
+
evnt.preventDefault();
|
|
6866
|
+
const tableWidth = tableEl.clientWidth - osbWidth;
|
|
6867
|
+
const tableHeight = tableEl.clientHeight - osbHeight;
|
|
6868
|
+
let dragTop = evnt.clientY - tableRect.y - targetOffsetY;
|
|
6869
|
+
if (dragTop < minTop) {
|
|
6870
|
+
dragTop = minTop;
|
|
6871
|
+
}
|
|
6872
|
+
else {
|
|
6873
|
+
resizeHeight = Math.max(cellMinHeight, currCellHeight + evnt.clientY - dragClientY);
|
|
6874
|
+
}
|
|
6875
|
+
resizeBarElem.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
|
|
6876
|
+
resizeBarElem.style.top = `${dragTop}px`;
|
|
6877
|
+
resizeBarElem.style.width = `${tableWidth}px`;
|
|
6878
|
+
if (resizableOpts.showDragTip && resizeTipElem) {
|
|
6879
|
+
resizeTipElem.textContent = getI18n('vxe.table.resizeRowTip', [resizeHeight]);
|
|
6880
|
+
const resizeTipWidth = resizeTipElem.clientWidth;
|
|
6881
|
+
const resizeTipHeight = resizeTipElem.clientHeight;
|
|
6882
|
+
let resizeBarLeft = Math.max(2, evnt.clientX - tableRect.x);
|
|
6883
|
+
let resizeBarTop = 0;
|
|
6884
|
+
if (resizeBarLeft + resizeTipWidth >= tableWidth - 2) {
|
|
6885
|
+
resizeBarLeft = tableWidth - resizeTipWidth - 2;
|
|
6886
|
+
}
|
|
6887
|
+
if (dragTop + resizeTipHeight >= tableHeight) {
|
|
6888
|
+
resizeBarTop = tableHeight - (dragTop + resizeTipHeight);
|
|
6889
|
+
}
|
|
6890
|
+
resizeTipElem.style.left = `${resizeBarLeft}px`;
|
|
6891
|
+
resizeTipElem.style.top = `${resizeBarTop}px`;
|
|
6892
|
+
}
|
|
6893
|
+
reactData.isDragResize = true;
|
|
6894
|
+
};
|
|
6895
|
+
reactData.isDragResize = true;
|
|
6896
|
+
addClass(tableEl, 'row-drag--resize');
|
|
6897
|
+
resizeBarElem.style.display = 'block';
|
|
6898
|
+
document.onmousemove = updateEvent;
|
|
6899
|
+
document.onmouseup = function (evnt) {
|
|
6900
|
+
document.onmousemove = null;
|
|
6901
|
+
document.onmouseup = null;
|
|
6902
|
+
resizeBarElem.style.display = 'none';
|
|
6903
|
+
internalData._lastResizeTime = Date.now();
|
|
6904
|
+
setTimeout(() => {
|
|
6905
|
+
reactData.isDragResize = false;
|
|
6906
|
+
}, 50);
|
|
6907
|
+
if (resizeHeight !== currCellHeight) {
|
|
6908
|
+
const resizeParams = Object.assign(Object.assign({}, params), { resizeHeight, resizeRow: row });
|
|
6909
|
+
internalData.isResizeCellHeight = true;
|
|
6910
|
+
if ($xeTable.handleRowResizeCellAreaEvent) {
|
|
6911
|
+
$xeTable.handleRowResizeCellAreaEvent(evnt, resizeParams);
|
|
6912
|
+
}
|
|
6913
|
+
else {
|
|
6914
|
+
rowRest.resizeHeight = resizeHeight;
|
|
6915
|
+
handleUpdateRowResize(evnt, resizeParams);
|
|
6916
|
+
}
|
|
6917
|
+
}
|
|
6918
|
+
removeClass(tableEl, 'row-drag--resize');
|
|
6919
|
+
};
|
|
6920
|
+
updateEvent(evnt);
|
|
6921
|
+
},
|
|
6922
|
+
handleRowResizeDblclickEvent(evnt, params) {
|
|
6923
|
+
const resizableOpts = computeResizableOpts.value;
|
|
6924
|
+
const { isDblclickAutoHeight } = resizableOpts;
|
|
6925
|
+
const el = refElem.value;
|
|
6926
|
+
if (isDblclickAutoHeight && el) {
|
|
6927
|
+
evnt.stopPropagation();
|
|
6928
|
+
evnt.preventDefault();
|
|
6929
|
+
const { editStore } = reactData;
|
|
6930
|
+
const { fullAllDataRowIdData } = internalData;
|
|
6931
|
+
const { actived } = editStore;
|
|
6932
|
+
const { row } = params;
|
|
6933
|
+
const rowid = getRowid($xeTable, row);
|
|
6934
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
6935
|
+
if (!rowRest) {
|
|
6936
|
+
return;
|
|
6937
|
+
}
|
|
6938
|
+
const handleRsHeight = () => {
|
|
6939
|
+
el.setAttribute('data-calc-row', 'Y');
|
|
6940
|
+
const resizeHeight = calcCellAutoHeight(rowRest, el);
|
|
6941
|
+
el.removeAttribute('data-calc-row');
|
|
6942
|
+
const resizeParams = Object.assign(Object.assign({}, params), { resizeHeight, resizeRow: row });
|
|
6943
|
+
reactData.isDragResize = false;
|
|
6944
|
+
internalData._lastResizeTime = Date.now();
|
|
6945
|
+
if ($xeTable.handleRowResizeDblclickCellAreaEvent) {
|
|
6946
|
+
$xeTable.handleRowResizeDblclickCellAreaEvent(evnt, resizeParams);
|
|
6947
|
+
}
|
|
6948
|
+
else {
|
|
6949
|
+
rowRest.resizeHeight = resizeHeight;
|
|
6950
|
+
handleUpdateRowResize(evnt, resizeParams);
|
|
6951
|
+
}
|
|
6952
|
+
};
|
|
6953
|
+
if (actived.row || actived.column) {
|
|
6954
|
+
$xeTable.clearEdit().then(handleRsHeight);
|
|
6955
|
+
}
|
|
6956
|
+
else {
|
|
6957
|
+
handleRsHeight();
|
|
6958
|
+
}
|
|
6959
|
+
}
|
|
6544
6960
|
},
|
|
6545
6961
|
saveCustomStore(type) {
|
|
6546
6962
|
const { customConfig } = props;
|
|
@@ -6768,7 +7184,7 @@ export default defineComponent({
|
|
|
6768
7184
|
}
|
|
6769
7185
|
vLen++;
|
|
6770
7186
|
});
|
|
6771
|
-
const isSelected =
|
|
7187
|
+
const isSelected = vLen > 0 ? sLen >= vLen : sLen >= rootList.length;
|
|
6772
7188
|
const halfSelect = !isSelected && (sLen >= 1 || hLen >= 1);
|
|
6773
7189
|
reactData.isAllSelected = isSelected;
|
|
6774
7190
|
reactData.isIndeterminate = halfSelect;
|
|
@@ -6890,10 +7306,21 @@ export default defineComponent({
|
|
|
6890
7306
|
triggerHeaderTooltipEvent(evnt, params) {
|
|
6891
7307
|
const { tooltipStore } = reactData;
|
|
6892
7308
|
const { column } = params;
|
|
6893
|
-
const titleElem = evnt.currentTarget;
|
|
6894
7309
|
handleTargetEnterEvent(true);
|
|
7310
|
+
const titleElem = evnt.currentTarget;
|
|
7311
|
+
if (!titleElem) {
|
|
7312
|
+
return;
|
|
7313
|
+
}
|
|
7314
|
+
const cellEl = titleElem.parentElement;
|
|
7315
|
+
if (!cellEl) {
|
|
7316
|
+
return;
|
|
7317
|
+
}
|
|
7318
|
+
const thEl = cellEl.parentElement;
|
|
7319
|
+
if (!thEl) {
|
|
7320
|
+
return;
|
|
7321
|
+
}
|
|
6895
7322
|
if (tooltipStore.column !== column || !tooltipStore.visible) {
|
|
6896
|
-
handleTooltip(evnt,
|
|
7323
|
+
handleTooltip(evnt, thEl, cellEl, null, params);
|
|
6897
7324
|
}
|
|
6898
7325
|
},
|
|
6899
7326
|
/**
|
|
@@ -6906,7 +7333,7 @@ export default defineComponent({
|
|
|
6906
7333
|
const editOpts = computeEditOpts.value;
|
|
6907
7334
|
const { actived } = editStore;
|
|
6908
7335
|
const { row, column } = params;
|
|
6909
|
-
const
|
|
7336
|
+
const tdEl = evnt.currentTarget;
|
|
6910
7337
|
handleTargetEnterEvent(tooltipStore.column !== column || tooltipStore.row !== row);
|
|
6911
7338
|
// 单元格处于编辑状态时不触发提示框
|
|
6912
7339
|
if (column.editRender && isEnableConf(editConfig)) {
|
|
@@ -6920,18 +7347,7 @@ export default defineComponent({
|
|
|
6920
7347
|
}
|
|
6921
7348
|
}
|
|
6922
7349
|
if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
|
|
6923
|
-
|
|
6924
|
-
let tipElem;
|
|
6925
|
-
if (column.treeNode) {
|
|
6926
|
-
overflowElem = cell.querySelector('.vxe-tree-cell');
|
|
6927
|
-
if (column.type === 'html') {
|
|
6928
|
-
tipElem = cell.querySelector('.vxe-cell--html');
|
|
6929
|
-
}
|
|
6930
|
-
}
|
|
6931
|
-
else {
|
|
6932
|
-
tipElem = cell.querySelector(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label');
|
|
6933
|
-
}
|
|
6934
|
-
handleTooltip(evnt, cell, (overflowElem || cell.children[0]), tipElem, params);
|
|
7350
|
+
handleTooltip(evnt, tdEl, tdEl.querySelector('.vxe-cell--wrapper'), null, params);
|
|
6935
7351
|
}
|
|
6936
7352
|
},
|
|
6937
7353
|
/**
|
|
@@ -6943,7 +7359,7 @@ export default defineComponent({
|
|
|
6943
7359
|
const cell = evnt.currentTarget;
|
|
6944
7360
|
handleTargetEnterEvent(tooltipStore.column !== column || !!tooltipStore.row);
|
|
6945
7361
|
if (tooltipStore.column !== column || !tooltipStore.visible) {
|
|
6946
|
-
handleTooltip(evnt, cell, cell.querySelector('.vxe-cell--
|
|
7362
|
+
handleTooltip(evnt, cell, cell.querySelector('.vxe-cell--wrapper') || cell.children[0], null, params);
|
|
6947
7363
|
}
|
|
6948
7364
|
},
|
|
6949
7365
|
handleTargetLeaveEvent() {
|
|
@@ -6956,12 +7372,12 @@ export default defineComponent({
|
|
|
6956
7372
|
internalData.tooltipTimeout = setTimeout(() => {
|
|
6957
7373
|
$tooltip = refTooltip.value;
|
|
6958
7374
|
if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
|
|
6959
|
-
|
|
7375
|
+
$xeTable.closeTooltip();
|
|
6960
7376
|
}
|
|
6961
7377
|
}, tooltipOpts.leaveDelay);
|
|
6962
7378
|
}
|
|
6963
7379
|
else {
|
|
6964
|
-
|
|
7380
|
+
$xeTable.closeTooltip();
|
|
6965
7381
|
}
|
|
6966
7382
|
},
|
|
6967
7383
|
triggerHeaderCellClickEvent(evnt, params) {
|
|
@@ -6991,7 +7407,10 @@ export default defineComponent({
|
|
|
6991
7407
|
*/
|
|
6992
7408
|
triggerCellClickEvent(evnt, params) {
|
|
6993
7409
|
const { highlightCurrentRow, editConfig } = props;
|
|
6994
|
-
const { editStore } = reactData;
|
|
7410
|
+
const { editStore, isDragResize } = reactData;
|
|
7411
|
+
if (isDragResize) {
|
|
7412
|
+
return;
|
|
7413
|
+
}
|
|
6995
7414
|
const expandOpts = computeExpandOpts.value;
|
|
6996
7415
|
const editOpts = computeEditOpts.value;
|
|
6997
7416
|
const treeOpts = computeTreeOpts.value;
|
|
@@ -7086,7 +7505,10 @@ export default defineComponent({
|
|
|
7086
7505
|
*/
|
|
7087
7506
|
triggerCellDblclickEvent(evnt, params) {
|
|
7088
7507
|
const { editConfig } = props;
|
|
7089
|
-
const { editStore } = reactData;
|
|
7508
|
+
const { editStore, isDragResize } = reactData;
|
|
7509
|
+
if (isDragResize) {
|
|
7510
|
+
return;
|
|
7511
|
+
}
|
|
7090
7512
|
const editOpts = computeEditOpts.value;
|
|
7091
7513
|
const { actived } = editStore;
|
|
7092
7514
|
const cell = evnt.currentTarget;
|
|
@@ -7299,10 +7721,13 @@ export default defineComponent({
|
|
|
7299
7721
|
*/
|
|
7300
7722
|
triggerSortEvent(evnt, column, order) {
|
|
7301
7723
|
const sortOpts = computeSortOpts.value;
|
|
7724
|
+
const { multiple, allowClear } = sortOpts;
|
|
7302
7725
|
const { field, sortable } = column;
|
|
7303
7726
|
if (sortable) {
|
|
7304
7727
|
if (!order || column.order === order) {
|
|
7305
|
-
|
|
7728
|
+
if (allowClear) {
|
|
7729
|
+
tableMethods.clearSort(multiple ? column : null);
|
|
7730
|
+
}
|
|
7306
7731
|
}
|
|
7307
7732
|
else {
|
|
7308
7733
|
tableMethods.sort({ field, order });
|
|
@@ -7395,7 +7820,7 @@ export default defineComponent({
|
|
|
7395
7820
|
const { treeConfig, dragConfig } = props;
|
|
7396
7821
|
const rowDragOpts = computeRowDragOpts.value;
|
|
7397
7822
|
const { fullAllDataRowIdData } = internalData;
|
|
7398
|
-
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod } = rowDragOpts;
|
|
7823
|
+
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod, dragToChildMethod } = rowDragOpts;
|
|
7399
7824
|
const treeOpts = computeTreeOpts.value;
|
|
7400
7825
|
const { transform, rowField, mapChildrenField, parentField } = treeOpts;
|
|
7401
7826
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
@@ -7405,15 +7830,15 @@ export default defineComponent({
|
|
|
7405
7830
|
if (prevDragRow && dragRow) {
|
|
7406
7831
|
// 判断是否有拖动
|
|
7407
7832
|
if (prevDragRow !== dragRow) {
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7833
|
+
const dragParams = {
|
|
7834
|
+
oldRow: dragRow,
|
|
7835
|
+
newRow: prevDragRow,
|
|
7836
|
+
dragPos: prevDragPos,
|
|
7837
|
+
dragToChild: !!prevDragToChild,
|
|
7838
|
+
offsetIndex: dragOffsetIndex
|
|
7839
|
+
};
|
|
7840
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
7841
|
+
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
7417
7842
|
if (!status) {
|
|
7418
7843
|
return;
|
|
7419
7844
|
}
|
|
@@ -7488,7 +7913,11 @@ export default defineComponent({
|
|
|
7488
7913
|
else {
|
|
7489
7914
|
// 根到根
|
|
7490
7915
|
}
|
|
7491
|
-
const fullList = XEUtils.toTreeArray(internalData.afterTreeFullData, {
|
|
7916
|
+
const fullList = XEUtils.toTreeArray(internalData.afterTreeFullData, {
|
|
7917
|
+
key: rowField,
|
|
7918
|
+
parentKey: parentField,
|
|
7919
|
+
children: mapChildrenField
|
|
7920
|
+
});
|
|
7492
7921
|
// 移出
|
|
7493
7922
|
const otfIndex = $xeTable.findRowIndexOf(fullList, dragRow);
|
|
7494
7923
|
fullList.splice(otfIndex, 1);
|
|
@@ -7502,12 +7931,12 @@ export default defineComponent({
|
|
|
7502
7931
|
childRow[parentField] = dragRow[parentField];
|
|
7503
7932
|
});
|
|
7504
7933
|
}
|
|
7505
|
-
dragRow[parentField] =
|
|
7934
|
+
dragRow[parentField] = isDragToChildFlag ? prevDragRow[rowField] : prevDragRow[parentField];
|
|
7506
7935
|
internalData.tableFullTreeData = XEUtils.toArrayTree(fullList, {
|
|
7507
|
-
key:
|
|
7508
|
-
parentKey:
|
|
7936
|
+
key: rowField,
|
|
7937
|
+
parentKey: parentField,
|
|
7509
7938
|
children: childrenField,
|
|
7510
|
-
mapChildren:
|
|
7939
|
+
mapChildren: mapChildrenField
|
|
7511
7940
|
});
|
|
7512
7941
|
}
|
|
7513
7942
|
}
|
|
@@ -7528,7 +7957,7 @@ export default defineComponent({
|
|
|
7528
7957
|
}
|
|
7529
7958
|
reactData.isDragRowMove = true;
|
|
7530
7959
|
$xeTable.handleTableData(treeConfig && transform);
|
|
7531
|
-
$xeTable.cacheRowMap();
|
|
7960
|
+
$xeTable.cacheRowMap(false);
|
|
7532
7961
|
updateScrollYStatus();
|
|
7533
7962
|
if (!(treeConfig && transform)) {
|
|
7534
7963
|
$xeTable.updateAfterDataIndex();
|
|
@@ -7545,7 +7974,7 @@ export default defineComponent({
|
|
|
7545
7974
|
oldRow: dragRow,
|
|
7546
7975
|
newRow: prevDragRow,
|
|
7547
7976
|
dragPos: prevDragPos,
|
|
7548
|
-
dragToChild:
|
|
7977
|
+
dragToChild: isDragToChildFlag,
|
|
7549
7978
|
offsetIndex: dragOffsetIndex,
|
|
7550
7979
|
_index: {
|
|
7551
7980
|
newIndex: nafIndex,
|
|
@@ -7566,20 +7995,18 @@ export default defineComponent({
|
|
|
7566
7995
|
const { lazy } = treeOpts;
|
|
7567
7996
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
7568
7997
|
const { prevDragRow, prevDragPos } = internalData;
|
|
7569
|
-
if (treeConfig && prevDragToChild) {
|
|
7998
|
+
if (treeConfig && lazy && prevDragToChild) {
|
|
7570
7999
|
// 懒加载
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
if (
|
|
7575
|
-
if (rowRest && rowRest.treeLoaded) {
|
|
7576
|
-
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
7577
|
-
}
|
|
7578
|
-
}
|
|
7579
|
-
else {
|
|
8000
|
+
const newRowid = getRowid($xeTable, prevDragRow);
|
|
8001
|
+
const rowRest = fullAllDataRowIdData[newRowid];
|
|
8002
|
+
if (prevDragRow[hasChildField]) {
|
|
8003
|
+
if (rowRest && rowRest.treeLoaded) {
|
|
7580
8004
|
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
7581
8005
|
}
|
|
7582
8006
|
}
|
|
8007
|
+
else {
|
|
8008
|
+
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
8009
|
+
}
|
|
7583
8010
|
}
|
|
7584
8011
|
else {
|
|
7585
8012
|
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
@@ -7682,7 +8109,7 @@ export default defineComponent({
|
|
|
7682
8109
|
handleColDragSwapEvent(evnt, isSyncColumn, dragCol, prevDragCol, prevDragPos, prevDragToChild) {
|
|
7683
8110
|
const { mouseConfig } = props;
|
|
7684
8111
|
const columnDragOpts = computeColumnDragOpts.value;
|
|
7685
|
-
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts;
|
|
8112
|
+
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts;
|
|
7686
8113
|
const { collectColumn } = internalData;
|
|
7687
8114
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
|
|
7688
8115
|
if (prevDragCol && dragCol) {
|
|
@@ -7690,15 +8117,15 @@ export default defineComponent({
|
|
|
7690
8117
|
if (prevDragCol !== dragCol) {
|
|
7691
8118
|
const oldColumn = dragCol;
|
|
7692
8119
|
const newColumn = prevDragCol;
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
8120
|
+
const dragParams = {
|
|
8121
|
+
oldColumn,
|
|
8122
|
+
newColumn,
|
|
8123
|
+
dragPos: prevDragPos,
|
|
8124
|
+
dragToChild: !!prevDragToChild,
|
|
8125
|
+
offsetIndex: dragOffsetIndex
|
|
8126
|
+
};
|
|
8127
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
8128
|
+
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
7702
8129
|
if (!status) {
|
|
7703
8130
|
return;
|
|
7704
8131
|
}
|
|
@@ -7788,7 +8215,7 @@ export default defineComponent({
|
|
|
7788
8215
|
if (newMatchRest) {
|
|
7789
8216
|
const { items: nCols, index: nIndex, parent: nParent } = newMatchRest;
|
|
7790
8217
|
// 转子级
|
|
7791
|
-
if ((isCrossDrag && isToChildDrag) &&
|
|
8218
|
+
if ((isCrossDrag && isToChildDrag) && isDragToChildFlag) {
|
|
7792
8219
|
oldColumn.parentId = newColumn.id;
|
|
7793
8220
|
newColumn.children = (newColumn.children || []).concat([oldColumn]);
|
|
7794
8221
|
}
|
|
@@ -7820,7 +8247,7 @@ export default defineComponent({
|
|
|
7820
8247
|
oldColumn,
|
|
7821
8248
|
newColumn,
|
|
7822
8249
|
dragPos: prevDragPos,
|
|
7823
|
-
dragToChild:
|
|
8250
|
+
dragToChild: isDragToChildFlag,
|
|
7824
8251
|
offsetIndex: dragOffsetIndex,
|
|
7825
8252
|
_index: {
|
|
7826
8253
|
newIndex: nafIndex,
|
|
@@ -8065,7 +8492,7 @@ export default defineComponent({
|
|
|
8065
8492
|
}
|
|
8066
8493
|
},
|
|
8067
8494
|
triggerBodyScrollEvent(evnt, fixedType) {
|
|
8068
|
-
const { elemStore, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData;
|
|
8495
|
+
const { elemStore, intoRunScroll, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData;
|
|
8069
8496
|
const xHandleEl = refScrollXHandleElem.value;
|
|
8070
8497
|
const yHandleEl = refScrollYHandleElem.value;
|
|
8071
8498
|
const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
|
|
@@ -8076,6 +8503,9 @@ export default defineComponent({
|
|
|
8076
8503
|
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
|
|
8077
8504
|
return;
|
|
8078
8505
|
}
|
|
8506
|
+
if (intoRunScroll) {
|
|
8507
|
+
return;
|
|
8508
|
+
}
|
|
8079
8509
|
if (!bodyScrollElem) {
|
|
8080
8510
|
return;
|
|
8081
8511
|
}
|
|
@@ -8134,22 +8564,16 @@ export default defineComponent({
|
|
|
8134
8564
|
});
|
|
8135
8565
|
},
|
|
8136
8566
|
triggerHeaderScrollEvent(evnt, fixedType) {
|
|
8137
|
-
const { elemStore, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
8567
|
+
const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
8138
8568
|
const yHandleEl = refScrollYHandleElem.value;
|
|
8139
8569
|
const xHandleEl = refScrollXHandleElem.value;
|
|
8140
8570
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
8141
8571
|
const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
|
|
8142
8572
|
const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
|
|
8143
|
-
if (inWheelScroll) {
|
|
8144
|
-
return;
|
|
8145
|
-
}
|
|
8146
|
-
if (inVirtualScroll) {
|
|
8147
|
-
return;
|
|
8148
|
-
}
|
|
8149
|
-
if (inBodyScroll) {
|
|
8573
|
+
if (inWheelScroll || inVirtualScroll || inBodyScroll || inFooterScroll) {
|
|
8150
8574
|
return;
|
|
8151
8575
|
}
|
|
8152
|
-
if (
|
|
8576
|
+
if (intoRunScroll) {
|
|
8153
8577
|
return;
|
|
8154
8578
|
}
|
|
8155
8579
|
if (!headerScrollElem) {
|
|
@@ -8176,22 +8600,16 @@ export default defineComponent({
|
|
|
8176
8600
|
});
|
|
8177
8601
|
},
|
|
8178
8602
|
triggerFooterScrollEvent(evnt, fixedType) {
|
|
8179
|
-
const { elemStore, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData;
|
|
8603
|
+
const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData;
|
|
8180
8604
|
const yHandleEl = refScrollYHandleElem.value;
|
|
8181
8605
|
const xHandleEl = refScrollXHandleElem.value;
|
|
8182
8606
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
8183
8607
|
const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
|
|
8184
8608
|
const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
|
|
8185
|
-
if (inWheelScroll) {
|
|
8186
|
-
return;
|
|
8187
|
-
}
|
|
8188
|
-
if (inVirtualScroll) {
|
|
8189
|
-
return;
|
|
8190
|
-
}
|
|
8191
|
-
if (inHeaderScroll) {
|
|
8609
|
+
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inBodyScroll) {
|
|
8192
8610
|
return;
|
|
8193
8611
|
}
|
|
8194
|
-
if (
|
|
8612
|
+
if (intoRunScroll) {
|
|
8195
8613
|
return;
|
|
8196
8614
|
}
|
|
8197
8615
|
if (!footerScrollElem) {
|
|
@@ -8218,7 +8636,10 @@ export default defineComponent({
|
|
|
8218
8636
|
});
|
|
8219
8637
|
},
|
|
8220
8638
|
triggerBodyWheelEvent(evnt) {
|
|
8221
|
-
const { deltaY, deltaX } = evnt;
|
|
8639
|
+
const { target, deltaY, deltaX } = evnt;
|
|
8640
|
+
if (target && /^textarea$/i.test(target.tagName)) {
|
|
8641
|
+
return;
|
|
8642
|
+
}
|
|
8222
8643
|
const { highlightHoverRow } = tableProps;
|
|
8223
8644
|
const { elemStore, lastScrollTop, lastScrollLeft } = internalData;
|
|
8224
8645
|
const rowOpts = computeRowOpts.value;
|
|
@@ -8236,31 +8657,13 @@ export default defineComponent({
|
|
|
8236
8657
|
if (!bodyScrollElem) {
|
|
8237
8658
|
return;
|
|
8238
8659
|
}
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
-
}
|
|
8243
|
-
else if (reactData.lastScrollTime + 30 > Date.now()) {
|
|
8244
|
-
multiple = 1.15;
|
|
8245
|
-
}
|
|
8246
|
-
else if (reactData.lastScrollTime + 40 > Date.now()) {
|
|
8247
|
-
multiple = 1.12;
|
|
8248
|
-
}
|
|
8249
|
-
else if (reactData.lastScrollTime + 55 > Date.now()) {
|
|
8250
|
-
multiple = 1.09;
|
|
8251
|
-
}
|
|
8252
|
-
else if (reactData.lastScrollTime + 75 > Date.now()) {
|
|
8253
|
-
multiple = 1.06;
|
|
8254
|
-
}
|
|
8255
|
-
else if (reactData.lastScrollTime + 100 > Date.now()) {
|
|
8256
|
-
multiple = 1.03;
|
|
8257
|
-
}
|
|
8258
|
-
const deltaTop = deltaY * multiple;
|
|
8259
|
-
const deltaLeft = deltaX * multiple;
|
|
8660
|
+
const wheelSpeed = getWheelSpeed(reactData.lastScrollTime);
|
|
8661
|
+
const deltaTop = deltaY * wheelSpeed;
|
|
8662
|
+
const deltaLeft = deltaX * wheelSpeed;
|
|
8260
8663
|
const isTopWheel = deltaTop < 0;
|
|
8261
|
-
const currScrollTop =
|
|
8664
|
+
const currScrollTop = bodyScrollElem.scrollTop;
|
|
8262
8665
|
// 如果滚动位置已经是顶部或底部,则不需要触发
|
|
8263
|
-
if (isTopWheel ? currScrollTop <= 0 : currScrollTop >=
|
|
8666
|
+
if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= bodyScrollElem.scrollHeight - bodyScrollElem.clientHeight) {
|
|
8264
8667
|
return;
|
|
8265
8668
|
}
|
|
8266
8669
|
const scrollTop = bodyScrollElem.scrollTop + deltaTop;
|
|
@@ -8273,17 +8676,92 @@ export default defineComponent({
|
|
|
8273
8676
|
if (rowOpts.isHover || highlightHoverRow) {
|
|
8274
8677
|
$xeTable.clearHoverRow();
|
|
8275
8678
|
}
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8679
|
+
wheelScrollTo(scrollTop - bodyScrollElem.scrollTop, (offsetTop) => {
|
|
8680
|
+
const currTopNum = bodyScrollElem.scrollTop + offsetTop;
|
|
8681
|
+
internalData.inWheelScroll = true;
|
|
8682
|
+
setScrollTop(yHandleEl, currTopNum);
|
|
8683
|
+
setScrollTop(bodyScrollElem, currTopNum);
|
|
8684
|
+
setScrollTop(leftScrollElem, currTopNum);
|
|
8685
|
+
setScrollTop(rightScrollElem, currTopNum);
|
|
8686
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
8687
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, scrollLeft, {
|
|
8688
|
+
type: 'table',
|
|
8689
|
+
fixed: ''
|
|
8690
|
+
});
|
|
8285
8691
|
});
|
|
8692
|
+
// internalData.inWheelScroll = true
|
|
8693
|
+
// setScrollTop(yHandleEl, scrollTop)
|
|
8694
|
+
// setScrollTop(bodyScrollElem, scrollTop)
|
|
8695
|
+
// setScrollTop(leftScrollElem, scrollTop)
|
|
8696
|
+
// setScrollTop(rightScrollElem, scrollTop)
|
|
8697
|
+
// loadScrollYData(scrollTop)
|
|
8698
|
+
// $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8699
|
+
// type: 'footer',
|
|
8700
|
+
// fixed: ''
|
|
8701
|
+
// })
|
|
8702
|
+
}
|
|
8703
|
+
},
|
|
8704
|
+
triggerVirtualScrollXEvent(evnt) {
|
|
8705
|
+
const { elemStore, inWheelScroll, lastScrollTop, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
8706
|
+
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
8707
|
+
return;
|
|
8708
|
+
}
|
|
8709
|
+
if (inWheelScroll) {
|
|
8710
|
+
return;
|
|
8711
|
+
}
|
|
8712
|
+
const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
|
|
8713
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
8714
|
+
const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
|
|
8715
|
+
const yHandleEl = refScrollYHandleElem.value;
|
|
8716
|
+
const wrapperEl = evnt.currentTarget;
|
|
8717
|
+
const { scrollLeft } = wrapperEl;
|
|
8718
|
+
const yBodyEl = yHandleEl || bodyScrollElem;
|
|
8719
|
+
let scrollTop = 0;
|
|
8720
|
+
if (yBodyEl) {
|
|
8721
|
+
scrollTop = yBodyEl.scrollTop;
|
|
8286
8722
|
}
|
|
8723
|
+
const isRollX = true;
|
|
8724
|
+
const isRollY = scrollTop !== lastScrollTop;
|
|
8725
|
+
internalData.inVirtualScroll = true;
|
|
8726
|
+
setScrollLeft(bodyScrollElem, scrollLeft);
|
|
8727
|
+
setScrollLeft(headerScrollElem, scrollLeft);
|
|
8728
|
+
setScrollLeft(footerScrollElem, scrollLeft);
|
|
8729
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
8730
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8731
|
+
type: 'table',
|
|
8732
|
+
fixed: ''
|
|
8733
|
+
});
|
|
8734
|
+
},
|
|
8735
|
+
triggerVirtualScrollYEvent(evnt) {
|
|
8736
|
+
const { elemStore, inWheelScroll, lastScrollLeft, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
8737
|
+
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
8738
|
+
return;
|
|
8739
|
+
}
|
|
8740
|
+
if (inWheelScroll) {
|
|
8741
|
+
return;
|
|
8742
|
+
}
|
|
8743
|
+
const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
|
|
8744
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
8745
|
+
const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
|
|
8746
|
+
const xHandleEl = refScrollXHandleElem.value;
|
|
8747
|
+
const wrapperEl = evnt.currentTarget;
|
|
8748
|
+
const { scrollTop } = wrapperEl;
|
|
8749
|
+
const xBodyEl = xHandleEl || bodyScrollElem;
|
|
8750
|
+
let scrollLeft = 0;
|
|
8751
|
+
if (xBodyEl) {
|
|
8752
|
+
scrollLeft = xBodyEl.scrollLeft;
|
|
8753
|
+
}
|
|
8754
|
+
const isRollX = scrollLeft !== lastScrollLeft;
|
|
8755
|
+
const isRollY = true;
|
|
8756
|
+
internalData.inVirtualScroll = true;
|
|
8757
|
+
setScrollTop(bodyScrollElem, scrollTop);
|
|
8758
|
+
setScrollTop(leftScrollElem, scrollTop);
|
|
8759
|
+
setScrollTop(rightScrollElem, scrollTop);
|
|
8760
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
8761
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8762
|
+
type: 'table',
|
|
8763
|
+
fixed: ''
|
|
8764
|
+
});
|
|
8287
8765
|
},
|
|
8288
8766
|
/**
|
|
8289
8767
|
* 对于树形结构中,可以直接滚动到指定深层节点中
|
|
@@ -8357,35 +8835,34 @@ export default defineComponent({
|
|
|
8357
8835
|
},
|
|
8358
8836
|
// 更新纵向 Y 可视渲染上下剩余空间大小
|
|
8359
8837
|
updateScrollYSpace() {
|
|
8360
|
-
const {
|
|
8361
|
-
const {
|
|
8362
|
-
const { scrollYStore, elemStore, afterFullData, fullAllDataRowIdData } = internalData;
|
|
8838
|
+
const { isAllOverflow, scrollYLoad } = reactData;
|
|
8839
|
+
const { scrollYStore, elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData;
|
|
8363
8840
|
const { startIndex } = scrollYStore;
|
|
8841
|
+
const rowOpts = computeRowOpts.value;
|
|
8842
|
+
const cellOpts = computeCellOpts.value;
|
|
8843
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
8364
8844
|
const bodyTableElem = getRefElem(elemStore['main-body-table']);
|
|
8365
8845
|
const containerList = ['main', 'left', 'right'];
|
|
8366
8846
|
let topSpaceHeight = 0;
|
|
8367
8847
|
let ySpaceHeight = 0;
|
|
8368
8848
|
if (scrollYLoad) {
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8849
|
+
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
|
|
8850
|
+
if (!isCustomCellHeight && isAllOverflow) {
|
|
8851
|
+
ySpaceHeight = afterFullData.length * defaultRowHeight;
|
|
8852
|
+
topSpaceHeight = Math.max(0, startIndex * defaultRowHeight);
|
|
8372
8853
|
}
|
|
8373
8854
|
else {
|
|
8374
8855
|
for (let i = 0; i < afterFullData.length; i++) {
|
|
8375
8856
|
const row = afterFullData[i];
|
|
8376
8857
|
const rowid = getRowid($xeTable, row);
|
|
8377
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
8378
|
-
|
|
8379
|
-
ySpaceHeight += rowRest.height || rowHeight;
|
|
8380
|
-
}
|
|
8858
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
8859
|
+
ySpaceHeight += rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
8381
8860
|
}
|
|
8382
8861
|
for (let i = 0; i < startIndex; i++) {
|
|
8383
8862
|
const row = afterFullData[i];
|
|
8384
8863
|
const rowid = getRowid($xeTable, row);
|
|
8385
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
8386
|
-
|
|
8387
|
-
topSpaceHeight += rowRest.height || rowHeight;
|
|
8388
|
-
}
|
|
8864
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
8865
|
+
topSpaceHeight += rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
8389
8866
|
}
|
|
8390
8867
|
}
|
|
8391
8868
|
}
|
|
@@ -8411,28 +8888,24 @@ export default defineComponent({
|
|
|
8411
8888
|
if (scrollYSpaceEl) {
|
|
8412
8889
|
scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
|
|
8413
8890
|
}
|
|
8414
|
-
nextTick(() => {
|
|
8891
|
+
return nextTick().then(() => {
|
|
8415
8892
|
updateStyle();
|
|
8416
8893
|
});
|
|
8417
8894
|
},
|
|
8418
8895
|
updateScrollXData() {
|
|
8419
|
-
const {
|
|
8896
|
+
const { isAllOverflow } = reactData;
|
|
8420
8897
|
handleTableColumn();
|
|
8421
|
-
// calcCellHeight()
|
|
8422
8898
|
return nextTick().then(() => {
|
|
8423
|
-
// calcCellHeight()
|
|
8424
8899
|
handleTableColumn();
|
|
8425
8900
|
$xeTable.updateScrollXSpace();
|
|
8426
|
-
if (!
|
|
8901
|
+
if (!isAllOverflow) {
|
|
8427
8902
|
$xeTable.updateScrollYSpace();
|
|
8428
8903
|
}
|
|
8429
8904
|
});
|
|
8430
8905
|
},
|
|
8431
8906
|
updateScrollYData() {
|
|
8432
8907
|
$xeTable.handleTableData();
|
|
8433
|
-
// calcCellHeight()
|
|
8434
8908
|
return nextTick().then(() => {
|
|
8435
|
-
// calcCellHeight()
|
|
8436
8909
|
$xeTable.handleTableData();
|
|
8437
8910
|
$xeTable.updateScrollYSpace();
|
|
8438
8911
|
});
|
|
@@ -8657,18 +9130,137 @@ export default defineComponent({
|
|
|
8657
9130
|
}
|
|
8658
9131
|
return renderEmptyElement($xeTable);
|
|
8659
9132
|
};
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
9133
|
+
const renderScrollX = () => {
|
|
9134
|
+
return h('div', {
|
|
9135
|
+
key: 'vsx',
|
|
9136
|
+
ref: refScrollXVirtualElem,
|
|
9137
|
+
class: 'vxe-table--scroll-x-virtual'
|
|
9138
|
+
}, [
|
|
9139
|
+
h('div', {
|
|
9140
|
+
ref: refScrollXLeftCornerElem,
|
|
9141
|
+
class: 'vxe-table--scroll-x-left-corner'
|
|
9142
|
+
}),
|
|
9143
|
+
h('div', {
|
|
9144
|
+
ref: refScrollXWrapperElem,
|
|
9145
|
+
class: 'vxe-table--scroll-x-wrapper'
|
|
9146
|
+
}, [
|
|
9147
|
+
h('div', {
|
|
9148
|
+
ref: refScrollXHandleElem,
|
|
9149
|
+
class: 'vxe-table--scroll-x-handle',
|
|
9150
|
+
onScroll: $xeTable.triggerVirtualScrollXEvent
|
|
9151
|
+
}, [
|
|
9152
|
+
h('div', {
|
|
9153
|
+
ref: refScrollXSpaceElem,
|
|
9154
|
+
class: 'vxe-table--scroll-x-space'
|
|
9155
|
+
})
|
|
9156
|
+
])
|
|
9157
|
+
]),
|
|
9158
|
+
h('div', {
|
|
9159
|
+
ref: refScrollXRightCornerElem,
|
|
9160
|
+
class: 'vxe-table--scroll-x-right-corner'
|
|
9161
|
+
})
|
|
9162
|
+
]);
|
|
9163
|
+
};
|
|
9164
|
+
const renderScrollY = () => {
|
|
9165
|
+
return h('div', {
|
|
9166
|
+
ref: refScrollYVirtualElem,
|
|
9167
|
+
class: 'vxe-table--scroll-y-virtual'
|
|
9168
|
+
}, [
|
|
9169
|
+
h('div', {
|
|
9170
|
+
ref: refScrollYTopCornerElem,
|
|
9171
|
+
class: 'vxe-table--scroll-y-top-corner'
|
|
9172
|
+
}),
|
|
9173
|
+
h('div', {
|
|
9174
|
+
ref: refScrollYWrapperElem,
|
|
9175
|
+
class: 'vxe-table--scroll-y-wrapper'
|
|
9176
|
+
}, [
|
|
9177
|
+
h('div', {
|
|
9178
|
+
ref: refScrollYHandleElem,
|
|
9179
|
+
class: 'vxe-table--scroll-y-handle',
|
|
9180
|
+
onScroll: $xeTable.triggerVirtualScrollYEvent
|
|
9181
|
+
}, [
|
|
9182
|
+
h('div', {
|
|
9183
|
+
ref: refScrollYSpaceElem,
|
|
9184
|
+
class: 'vxe-table--scroll-y-space'
|
|
9185
|
+
})
|
|
9186
|
+
])
|
|
9187
|
+
]),
|
|
9188
|
+
h('div', {
|
|
9189
|
+
ref: refScrollYBottomCornerElem,
|
|
9190
|
+
class: 'vxe-table--scroll-y-bottom-corner'
|
|
9191
|
+
})
|
|
9192
|
+
]);
|
|
9193
|
+
};
|
|
9194
|
+
const renderViewport = () => {
|
|
9195
|
+
const { showHeader, showFooter } = props;
|
|
9196
|
+
const { overflowX, tableData, tableColumn, tableGroupColumn, footerTableData, columnStore } = reactData;
|
|
9197
|
+
const { leftList, rightList } = columnStore;
|
|
9198
|
+
return h('div', {
|
|
9199
|
+
ref: refTableViewportElem,
|
|
9200
|
+
class: 'vxe-table--viewport-wrapper'
|
|
9201
|
+
}, [
|
|
9202
|
+
h('div', {
|
|
9203
|
+
class: 'vxe-table--main-wrapper'
|
|
9204
|
+
}, [
|
|
9205
|
+
/**
|
|
9206
|
+
* 表头
|
|
9207
|
+
*/
|
|
9208
|
+
showHeader
|
|
9209
|
+
? h(TableHeaderComponent, {
|
|
9210
|
+
ref: refTableHeader,
|
|
9211
|
+
tableData,
|
|
9212
|
+
tableColumn,
|
|
9213
|
+
tableGroupColumn
|
|
9214
|
+
})
|
|
9215
|
+
: renderEmptyElement($xeTable),
|
|
9216
|
+
/**
|
|
9217
|
+
* 表体
|
|
9218
|
+
*/
|
|
9219
|
+
h(TableBodyComponent, {
|
|
9220
|
+
ref: refTableBody,
|
|
9221
|
+
tableData,
|
|
9222
|
+
tableColumn
|
|
9223
|
+
}),
|
|
9224
|
+
/**
|
|
9225
|
+
* 表尾
|
|
9226
|
+
*/
|
|
9227
|
+
showFooter
|
|
9228
|
+
? h(TableFooterComponent, {
|
|
9229
|
+
ref: refTableFooter,
|
|
9230
|
+
footerTableData,
|
|
9231
|
+
tableColumn
|
|
9232
|
+
})
|
|
9233
|
+
: renderEmptyElement($xeTable)
|
|
9234
|
+
]),
|
|
9235
|
+
h('div', {
|
|
9236
|
+
class: 'vxe-table--fixed-wrapper'
|
|
9237
|
+
}, [
|
|
9238
|
+
leftList && leftList.length && overflowX ? renderFixed('left') : renderEmptyElement($xeTable),
|
|
9239
|
+
rightList && rightList.length && overflowX ? renderFixed('right') : renderEmptyElement($xeTable)
|
|
9240
|
+
])
|
|
9241
|
+
]);
|
|
9242
|
+
};
|
|
9243
|
+
const renderBody = () => {
|
|
9244
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value;
|
|
9245
|
+
return h('div', {
|
|
9246
|
+
class: 'vxe-table--layout-wrapper'
|
|
9247
|
+
}, scrollbarYToLeft
|
|
9248
|
+
? [
|
|
9249
|
+
renderScrollY(),
|
|
9250
|
+
renderViewport()
|
|
9251
|
+
]
|
|
9252
|
+
: [
|
|
9253
|
+
renderViewport(),
|
|
9254
|
+
renderScrollY()
|
|
9255
|
+
]);
|
|
9256
|
+
};
|
|
8666
9257
|
const renderVN = () => {
|
|
8667
9258
|
const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules } = props;
|
|
8668
|
-
const {
|
|
9259
|
+
const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, columnStore, filterStore, customStore } = reactData;
|
|
8669
9260
|
const { leftList, rightList } = columnStore;
|
|
8670
9261
|
const loadingSlot = slots.loading;
|
|
8671
|
-
const
|
|
9262
|
+
const tableTipConfig = computeTableTipConfig.value;
|
|
9263
|
+
const validTipConfig = computeValidTipConfig.value;
|
|
8672
9264
|
const validOpts = computeValidOpts.value;
|
|
8673
9265
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
8674
9266
|
const treeOpts = computeTreeOpts.value;
|
|
@@ -8684,9 +9276,11 @@ export default defineComponent({
|
|
|
8684
9276
|
const resizableOpts = computeResizableOpts.value;
|
|
8685
9277
|
const isArea = mouseConfig && mouseOpts.area;
|
|
8686
9278
|
const columnDragOpts = computeColumnDragOpts.value;
|
|
9279
|
+
const scrollbarXToTop = computeScrollbarXToTop.value;
|
|
9280
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value;
|
|
8687
9281
|
return h('div', {
|
|
8688
9282
|
ref: refElem,
|
|
8689
|
-
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, {
|
|
9283
|
+
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
|
|
8690
9284
|
[`size--${vSize}`]: vSize,
|
|
8691
9285
|
[`valid-msg--${validOpts.msgMode}`]: !!editRules,
|
|
8692
9286
|
'vxe-editable': !!editConfig,
|
|
@@ -8699,7 +9293,6 @@ export default defineComponent({
|
|
|
8699
9293
|
'row--highlight': rowOpts.isHover || highlightHoverRow,
|
|
8700
9294
|
'column--highlight': columnOpts.isHover || highlightHoverColumn,
|
|
8701
9295
|
'checkbox--range': checkboxOpts.range,
|
|
8702
|
-
'column--calc': isCalcColumn,
|
|
8703
9296
|
'col--drag-cell': columnOpts.drag && columnDragOpts.trigger === 'cell',
|
|
8704
9297
|
'is--header': showHeader,
|
|
8705
9298
|
'is--footer': showFooter,
|
|
@@ -8708,7 +9301,6 @@ export default defineComponent({
|
|
|
8708
9301
|
'is--fixed-left': leftList.length,
|
|
8709
9302
|
'is--fixed-right': rightList.length,
|
|
8710
9303
|
'is--animat': !!props.animat,
|
|
8711
|
-
'is--padding': props.padding,
|
|
8712
9304
|
'is--round': props.round,
|
|
8713
9305
|
'is--stripe': !treeConfig && stripe,
|
|
8714
9306
|
'is--loading': currLoading,
|
|
@@ -8730,95 +9322,15 @@ export default defineComponent({
|
|
|
8730
9322
|
h('div', {
|
|
8731
9323
|
key: 'tw',
|
|
8732
9324
|
class: 'vxe-table--render-wrapper'
|
|
8733
|
-
},
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
/**
|
|
8742
|
-
* 表头
|
|
8743
|
-
*/
|
|
8744
|
-
showHeader
|
|
8745
|
-
? h(TableHeaderComponent, {
|
|
8746
|
-
ref: refTableHeader,
|
|
8747
|
-
tableData,
|
|
8748
|
-
tableColumn,
|
|
8749
|
-
tableGroupColumn
|
|
8750
|
-
})
|
|
8751
|
-
: renderEmptyElement($xeTable),
|
|
8752
|
-
/**
|
|
8753
|
-
* 表体
|
|
8754
|
-
*/
|
|
8755
|
-
h(TableBodyComponent, {
|
|
8756
|
-
ref: refTableBody,
|
|
8757
|
-
tableData,
|
|
8758
|
-
tableColumn
|
|
8759
|
-
}),
|
|
8760
|
-
/**
|
|
8761
|
-
* 表尾
|
|
8762
|
-
*/
|
|
8763
|
-
showFooter
|
|
8764
|
-
? h(TableFooterComponent, {
|
|
8765
|
-
ref: refTableFooter,
|
|
8766
|
-
footerTableData,
|
|
8767
|
-
tableColumn
|
|
8768
|
-
})
|
|
8769
|
-
: renderEmptyElement($xeTable)
|
|
8770
|
-
]),
|
|
8771
|
-
h('div', {
|
|
8772
|
-
class: 'vxe-table--fixed-wrapper'
|
|
8773
|
-
}, [
|
|
8774
|
-
leftList && leftList.length && overflowX ? renderFixed('left') : renderEmptyElement($xeTable),
|
|
8775
|
-
rightList && rightList.length && overflowX ? renderFixed('right') : renderEmptyElement($xeTable)
|
|
8776
|
-
])
|
|
8777
|
-
]),
|
|
8778
|
-
h('div', {
|
|
8779
|
-
ref: refScrollYVirtualElem,
|
|
8780
|
-
class: 'vxe-table--scroll-y-virtual'
|
|
8781
|
-
}, [
|
|
8782
|
-
h('div', {
|
|
8783
|
-
ref: refScrollYTopCornerElem,
|
|
8784
|
-
class: 'vxe-table--scroll-y-top-corner'
|
|
8785
|
-
}),
|
|
8786
|
-
h('div', {
|
|
8787
|
-
ref: refScrollYHandleElem,
|
|
8788
|
-
class: 'vxe-table--scroll-y-handle',
|
|
8789
|
-
onScroll: scrollYEvent
|
|
8790
|
-
}, [
|
|
8791
|
-
h('div', {
|
|
8792
|
-
ref: refScrollYSpaceElem,
|
|
8793
|
-
class: 'vxe-table--scroll-y-space'
|
|
8794
|
-
})
|
|
8795
|
-
]),
|
|
8796
|
-
h('div', {
|
|
8797
|
-
ref: refScrollYBottomCornerElem,
|
|
8798
|
-
class: 'vxe-table--scroll-y-bottom-corner'
|
|
8799
|
-
})
|
|
8800
|
-
])
|
|
8801
|
-
]),
|
|
8802
|
-
h('div', {
|
|
8803
|
-
key: 'vx',
|
|
8804
|
-
ref: refScrollXVirtualElem,
|
|
8805
|
-
class: 'vxe-table--scroll-x-virtual'
|
|
8806
|
-
}, [
|
|
8807
|
-
h('div', {
|
|
8808
|
-
ref: refScrollXHandleElem,
|
|
8809
|
-
class: 'vxe-table--scroll-x-handle',
|
|
8810
|
-
onScroll: scrollXEvent
|
|
8811
|
-
}, [
|
|
8812
|
-
h('div', {
|
|
8813
|
-
ref: refScrollXSpaceElem,
|
|
8814
|
-
class: 'vxe-table--scroll-x-space'
|
|
8815
|
-
})
|
|
9325
|
+
}, scrollbarXToTop
|
|
9326
|
+
? [
|
|
9327
|
+
renderScrollX(),
|
|
9328
|
+
renderBody()
|
|
9329
|
+
]
|
|
9330
|
+
: [
|
|
9331
|
+
renderBody(),
|
|
9332
|
+
renderScrollX()
|
|
8816
9333
|
]),
|
|
8817
|
-
h('div', {
|
|
8818
|
-
ref: refScrollXRightCornerElem,
|
|
8819
|
-
class: 'vxe-table--scroll-x-right-corner'
|
|
8820
|
-
})
|
|
8821
|
-
]),
|
|
8822
9334
|
/**
|
|
8823
9335
|
* 空数据
|
|
8824
9336
|
*/
|
|
@@ -8842,18 +9354,26 @@ export default defineComponent({
|
|
|
8842
9354
|
* 列宽线
|
|
8843
9355
|
*/
|
|
8844
9356
|
h('div', {
|
|
8845
|
-
key: '
|
|
8846
|
-
ref:
|
|
8847
|
-
class: 'vxe-table--resizable-bar'
|
|
8848
|
-
|
|
8849
|
-
|
|
8850
|
-
|
|
8851
|
-
|
|
8852
|
-
|
|
9357
|
+
key: 'tcl',
|
|
9358
|
+
ref: refColResizeBar,
|
|
9359
|
+
class: 'vxe-table--resizable-col-bar'
|
|
9360
|
+
}, resizableOpts.showDragTip
|
|
9361
|
+
? [
|
|
9362
|
+
h('div', {
|
|
9363
|
+
class: 'vxe-table--resizable-number-tip'
|
|
9364
|
+
})
|
|
9365
|
+
]
|
|
9366
|
+
: []),
|
|
9367
|
+
/**
|
|
9368
|
+
* 行高线
|
|
9369
|
+
*/
|
|
9370
|
+
h('div', {
|
|
9371
|
+
key: 'trl',
|
|
9372
|
+
ref: refRowResizeBar,
|
|
9373
|
+
class: 'vxe-table--resizable-row-bar'
|
|
8853
9374
|
}, resizableOpts.showDragTip
|
|
8854
9375
|
? [
|
|
8855
9376
|
h('div', {
|
|
8856
|
-
ref: refCellResizeTip,
|
|
8857
9377
|
class: 'vxe-table--resizable-number-tip'
|
|
8858
9378
|
})
|
|
8859
9379
|
]
|
|
@@ -8950,17 +9470,29 @@ export default defineComponent({
|
|
|
8950
9470
|
/**
|
|
8951
9471
|
* 工具提示
|
|
8952
9472
|
*/
|
|
8953
|
-
h(VxeUITooltipComponent,
|
|
9473
|
+
h(VxeUITooltipComponent, {
|
|
8954
9474
|
key: 'btp',
|
|
8955
|
-
ref: refTooltip
|
|
8956
|
-
|
|
9475
|
+
ref: refTooltip,
|
|
9476
|
+
theme: tableTipConfig.theme,
|
|
9477
|
+
enterable: tableTipConfig.enterable,
|
|
9478
|
+
enterDelay: tableTipConfig.enterDelay,
|
|
9479
|
+
leaveDelay: tableTipConfig.leaveDelay
|
|
9480
|
+
}),
|
|
8957
9481
|
/**
|
|
8958
9482
|
* 校验提示
|
|
8959
9483
|
*/
|
|
8960
9484
|
props.editRules && validOpts.showMessage && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip')
|
|
8961
|
-
? h(VxeUITooltipComponent,
|
|
9485
|
+
? h(VxeUITooltipComponent, {
|
|
9486
|
+
key: 'vtp',
|
|
9487
|
+
ref: refValidTooltip,
|
|
9488
|
+
class: [{
|
|
8962
9489
|
'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete'
|
|
8963
|
-
}, 'vxe-table--valid-error']
|
|
9490
|
+
}, 'vxe-table--valid-error'],
|
|
9491
|
+
theme: validTipConfig.theme,
|
|
9492
|
+
enterable: validTipConfig.enterable,
|
|
9493
|
+
enterDelay: validTipConfig.enterDelay,
|
|
9494
|
+
leaveDelay: validTipConfig.leaveDelay
|
|
9495
|
+
})
|
|
8964
9496
|
: renderEmptyElement($xeTable)
|
|
8965
9497
|
])
|
|
8966
9498
|
: renderEmptyElement($xeTable)
|
|
@@ -8979,7 +9511,7 @@ export default defineComponent({
|
|
|
8979
9511
|
if (value && value.length >= 50000) {
|
|
8980
9512
|
warnLog('vxe.error.errLargeData', ['loadData(data), reloadData(data)']);
|
|
8981
9513
|
}
|
|
8982
|
-
loadTableData(value).then(() => {
|
|
9514
|
+
loadTableData(value, true).then(() => {
|
|
8983
9515
|
const { scrollXLoad, scrollYLoad, expandColumn } = reactData;
|
|
8984
9516
|
internalData.inited = true;
|
|
8985
9517
|
internalData.initStatus = true;
|
|
@@ -9027,16 +9559,37 @@ export default defineComponent({
|
|
|
9027
9559
|
tableMethods.refreshColumn();
|
|
9028
9560
|
});
|
|
9029
9561
|
});
|
|
9562
|
+
const reScrollFlag = ref(0);
|
|
9563
|
+
watch(computeSize, () => {
|
|
9564
|
+
reScrollFlag.value++;
|
|
9565
|
+
});
|
|
9030
9566
|
watch(() => props.showHeader, () => {
|
|
9031
|
-
|
|
9032
|
-
tableMethods.recalculate(true).then(() => tableMethods.refreshScroll());
|
|
9033
|
-
});
|
|
9567
|
+
reScrollFlag.value++;
|
|
9034
9568
|
});
|
|
9035
9569
|
watch(() => props.showFooter, () => {
|
|
9570
|
+
reScrollFlag.value++;
|
|
9571
|
+
});
|
|
9572
|
+
watch(reScrollFlag, () => {
|
|
9036
9573
|
nextTick(() => {
|
|
9037
9574
|
tableMethods.recalculate(true).then(() => tableMethods.refreshScroll());
|
|
9038
9575
|
});
|
|
9039
9576
|
});
|
|
9577
|
+
const reLayoutFlag = ref(0);
|
|
9578
|
+
watch(() => props.height, () => {
|
|
9579
|
+
reLayoutFlag.value++;
|
|
9580
|
+
});
|
|
9581
|
+
watch(() => props.maxHeight, () => {
|
|
9582
|
+
reLayoutFlag.value++;
|
|
9583
|
+
});
|
|
9584
|
+
watch(computeScrollbarXToTop, () => {
|
|
9585
|
+
reLayoutFlag.value++;
|
|
9586
|
+
});
|
|
9587
|
+
watch(computeScrollbarYToLeft, () => {
|
|
9588
|
+
reLayoutFlag.value++;
|
|
9589
|
+
});
|
|
9590
|
+
watch(reLayoutFlag, () => {
|
|
9591
|
+
nextTick(() => tableMethods.recalculate(true));
|
|
9592
|
+
});
|
|
9040
9593
|
const footFlag = ref(0);
|
|
9041
9594
|
watch(() => props.footerData ? props.footerData.length : -1, () => {
|
|
9042
9595
|
footFlag.value++;
|
|
@@ -9047,23 +9600,12 @@ export default defineComponent({
|
|
|
9047
9600
|
watch(footFlag, () => {
|
|
9048
9601
|
tableMethods.updateFooter();
|
|
9049
9602
|
});
|
|
9050
|
-
watch(() => props.height, () => {
|
|
9051
|
-
nextTick(() => tableMethods.recalculate(true));
|
|
9052
|
-
});
|
|
9053
|
-
watch(() => props.maxHeight, () => {
|
|
9054
|
-
nextTick(() => tableMethods.recalculate(true));
|
|
9055
|
-
});
|
|
9056
|
-
watch(computeSize, () => {
|
|
9057
|
-
nextTick(() => {
|
|
9058
|
-
tableMethods.recalculate(true).then(() => tableMethods.refreshScroll());
|
|
9059
|
-
});
|
|
9060
|
-
});
|
|
9061
9603
|
watch(() => props.syncResize, (value) => {
|
|
9062
9604
|
if (value) {
|
|
9063
|
-
|
|
9605
|
+
handleUpdateResize();
|
|
9064
9606
|
nextTick(() => {
|
|
9065
|
-
|
|
9066
|
-
setTimeout(() =>
|
|
9607
|
+
handleUpdateResize();
|
|
9608
|
+
setTimeout(() => handleUpdateResize());
|
|
9067
9609
|
});
|
|
9068
9610
|
}
|
|
9069
9611
|
});
|
|
@@ -9163,6 +9705,9 @@ export default defineComponent({
|
|
|
9163
9705
|
if (props.showFooter && !(props.footerMethod || props.footerData)) {
|
|
9164
9706
|
warnLog('vxe.error.reqProp', ['footer-data | footer-method']);
|
|
9165
9707
|
}
|
|
9708
|
+
if (rowOpts.height) {
|
|
9709
|
+
warnLog('vxe.error.delProp', ['row-config.height', 'cell-config.height']);
|
|
9710
|
+
}
|
|
9166
9711
|
// if (props.highlightCurrentRow) {
|
|
9167
9712
|
// warnLog('vxe.error.delProp', ['highlight-current-row', 'row-config.isCurrent'])
|
|
9168
9713
|
// }
|
|
@@ -9270,7 +9815,7 @@ export default defineComponent({
|
|
|
9270
9815
|
endIndex: 0,
|
|
9271
9816
|
visibleSize: 0
|
|
9272
9817
|
});
|
|
9273
|
-
loadTableData(data || []).then(() => {
|
|
9818
|
+
loadTableData(data || [], true).then(() => {
|
|
9274
9819
|
if (data && data.length) {
|
|
9275
9820
|
internalData.inited = true;
|
|
9276
9821
|
internalData.initStatus = true;
|