vxe-table 4.10.6-beta.3 → 4.10.6-beta.30
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 +28 -46
- 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 +6 -2
- package/es/table/src/table.js +1175 -633
- 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 +24 -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 +1833 -1161
- 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 +27 -38
- 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 +6 -2
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +1227 -625
- 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 +24 -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 +28 -54
- 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 +6 -2
- package/packages/table/src/table.ts +1179 -631
- package/packages/table/src/util.ts +81 -62
- package/packages/ui/index.ts +23 -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.1737460213413.ttf} +0 -0
- /package/es/{iconfont.1736748534420.woff → iconfont.1737460213413.woff} +0 -0
- /package/es/{iconfont.1736748534420.woff2 → iconfont.1737460213413.woff2} +0 -0
- /package/lib/{iconfont.1736748534420.ttf → iconfont.1737460213413.ttf} +0 -0
- /package/lib/{iconfont.1736748534420.woff → iconfont.1737460213413.woff} +0 -0
- /package/lib/{iconfont.1736748534420.woff2 → iconfont.1737460213413.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;
|
|
@@ -7395,7 +7817,7 @@ export default defineComponent({
|
|
|
7395
7817
|
const { treeConfig, dragConfig } = props;
|
|
7396
7818
|
const rowDragOpts = computeRowDragOpts.value;
|
|
7397
7819
|
const { fullAllDataRowIdData } = internalData;
|
|
7398
|
-
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod } = rowDragOpts;
|
|
7820
|
+
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod, dragToChildMethod } = rowDragOpts;
|
|
7399
7821
|
const treeOpts = computeTreeOpts.value;
|
|
7400
7822
|
const { transform, rowField, mapChildrenField, parentField } = treeOpts;
|
|
7401
7823
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
@@ -7405,15 +7827,15 @@ export default defineComponent({
|
|
|
7405
7827
|
if (prevDragRow && dragRow) {
|
|
7406
7828
|
// 判断是否有拖动
|
|
7407
7829
|
if (prevDragRow !== dragRow) {
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7830
|
+
const dragParams = {
|
|
7831
|
+
oldRow: dragRow,
|
|
7832
|
+
newRow: prevDragRow,
|
|
7833
|
+
dragPos: prevDragPos,
|
|
7834
|
+
dragToChild: !!prevDragToChild,
|
|
7835
|
+
offsetIndex: dragOffsetIndex
|
|
7836
|
+
};
|
|
7837
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
7838
|
+
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
7417
7839
|
if (!status) {
|
|
7418
7840
|
return;
|
|
7419
7841
|
}
|
|
@@ -7488,7 +7910,11 @@ export default defineComponent({
|
|
|
7488
7910
|
else {
|
|
7489
7911
|
// 根到根
|
|
7490
7912
|
}
|
|
7491
|
-
const fullList = XEUtils.toTreeArray(internalData.afterTreeFullData, {
|
|
7913
|
+
const fullList = XEUtils.toTreeArray(internalData.afterTreeFullData, {
|
|
7914
|
+
key: rowField,
|
|
7915
|
+
parentKey: parentField,
|
|
7916
|
+
children: mapChildrenField
|
|
7917
|
+
});
|
|
7492
7918
|
// 移出
|
|
7493
7919
|
const otfIndex = $xeTable.findRowIndexOf(fullList, dragRow);
|
|
7494
7920
|
fullList.splice(otfIndex, 1);
|
|
@@ -7502,12 +7928,12 @@ export default defineComponent({
|
|
|
7502
7928
|
childRow[parentField] = dragRow[parentField];
|
|
7503
7929
|
});
|
|
7504
7930
|
}
|
|
7505
|
-
dragRow[parentField] =
|
|
7931
|
+
dragRow[parentField] = isDragToChildFlag ? prevDragRow[rowField] : prevDragRow[parentField];
|
|
7506
7932
|
internalData.tableFullTreeData = XEUtils.toArrayTree(fullList, {
|
|
7507
|
-
key:
|
|
7508
|
-
parentKey:
|
|
7933
|
+
key: rowField,
|
|
7934
|
+
parentKey: parentField,
|
|
7509
7935
|
children: childrenField,
|
|
7510
|
-
mapChildren:
|
|
7936
|
+
mapChildren: mapChildrenField
|
|
7511
7937
|
});
|
|
7512
7938
|
}
|
|
7513
7939
|
}
|
|
@@ -7528,7 +7954,7 @@ export default defineComponent({
|
|
|
7528
7954
|
}
|
|
7529
7955
|
reactData.isDragRowMove = true;
|
|
7530
7956
|
$xeTable.handleTableData(treeConfig && transform);
|
|
7531
|
-
$xeTable.cacheRowMap();
|
|
7957
|
+
$xeTable.cacheRowMap(false);
|
|
7532
7958
|
updateScrollYStatus();
|
|
7533
7959
|
if (!(treeConfig && transform)) {
|
|
7534
7960
|
$xeTable.updateAfterDataIndex();
|
|
@@ -7545,7 +7971,7 @@ export default defineComponent({
|
|
|
7545
7971
|
oldRow: dragRow,
|
|
7546
7972
|
newRow: prevDragRow,
|
|
7547
7973
|
dragPos: prevDragPos,
|
|
7548
|
-
dragToChild:
|
|
7974
|
+
dragToChild: isDragToChildFlag,
|
|
7549
7975
|
offsetIndex: dragOffsetIndex,
|
|
7550
7976
|
_index: {
|
|
7551
7977
|
newIndex: nafIndex,
|
|
@@ -7566,20 +7992,18 @@ export default defineComponent({
|
|
|
7566
7992
|
const { lazy } = treeOpts;
|
|
7567
7993
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
7568
7994
|
const { prevDragRow, prevDragPos } = internalData;
|
|
7569
|
-
if (treeConfig && prevDragToChild) {
|
|
7995
|
+
if (treeConfig && lazy && prevDragToChild) {
|
|
7570
7996
|
// 懒加载
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
if (
|
|
7575
|
-
if (rowRest && rowRest.treeLoaded) {
|
|
7576
|
-
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
7577
|
-
}
|
|
7578
|
-
}
|
|
7579
|
-
else {
|
|
7997
|
+
const newRowid = getRowid($xeTable, prevDragRow);
|
|
7998
|
+
const rowRest = fullAllDataRowIdData[newRowid];
|
|
7999
|
+
if (prevDragRow[hasChildField]) {
|
|
8000
|
+
if (rowRest && rowRest.treeLoaded) {
|
|
7580
8001
|
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
7581
8002
|
}
|
|
7582
8003
|
}
|
|
8004
|
+
else {
|
|
8005
|
+
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
8006
|
+
}
|
|
7583
8007
|
}
|
|
7584
8008
|
else {
|
|
7585
8009
|
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
@@ -7682,7 +8106,7 @@ export default defineComponent({
|
|
|
7682
8106
|
handleColDragSwapEvent(evnt, isSyncColumn, dragCol, prevDragCol, prevDragPos, prevDragToChild) {
|
|
7683
8107
|
const { mouseConfig } = props;
|
|
7684
8108
|
const columnDragOpts = computeColumnDragOpts.value;
|
|
7685
|
-
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts;
|
|
8109
|
+
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts;
|
|
7686
8110
|
const { collectColumn } = internalData;
|
|
7687
8111
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
|
|
7688
8112
|
if (prevDragCol && dragCol) {
|
|
@@ -7690,15 +8114,15 @@ export default defineComponent({
|
|
|
7690
8114
|
if (prevDragCol !== dragCol) {
|
|
7691
8115
|
const oldColumn = dragCol;
|
|
7692
8116
|
const newColumn = prevDragCol;
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
8117
|
+
const dragParams = {
|
|
8118
|
+
oldColumn,
|
|
8119
|
+
newColumn,
|
|
8120
|
+
dragPos: prevDragPos,
|
|
8121
|
+
dragToChild: !!prevDragToChild,
|
|
8122
|
+
offsetIndex: dragOffsetIndex
|
|
8123
|
+
};
|
|
8124
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
8125
|
+
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
7702
8126
|
if (!status) {
|
|
7703
8127
|
return;
|
|
7704
8128
|
}
|
|
@@ -7788,7 +8212,7 @@ export default defineComponent({
|
|
|
7788
8212
|
if (newMatchRest) {
|
|
7789
8213
|
const { items: nCols, index: nIndex, parent: nParent } = newMatchRest;
|
|
7790
8214
|
// 转子级
|
|
7791
|
-
if ((isCrossDrag && isToChildDrag) &&
|
|
8215
|
+
if ((isCrossDrag && isToChildDrag) && isDragToChildFlag) {
|
|
7792
8216
|
oldColumn.parentId = newColumn.id;
|
|
7793
8217
|
newColumn.children = (newColumn.children || []).concat([oldColumn]);
|
|
7794
8218
|
}
|
|
@@ -7820,7 +8244,7 @@ export default defineComponent({
|
|
|
7820
8244
|
oldColumn,
|
|
7821
8245
|
newColumn,
|
|
7822
8246
|
dragPos: prevDragPos,
|
|
7823
|
-
dragToChild:
|
|
8247
|
+
dragToChild: isDragToChildFlag,
|
|
7824
8248
|
offsetIndex: dragOffsetIndex,
|
|
7825
8249
|
_index: {
|
|
7826
8250
|
newIndex: nafIndex,
|
|
@@ -8065,7 +8489,7 @@ export default defineComponent({
|
|
|
8065
8489
|
}
|
|
8066
8490
|
},
|
|
8067
8491
|
triggerBodyScrollEvent(evnt, fixedType) {
|
|
8068
|
-
const { elemStore, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData;
|
|
8492
|
+
const { elemStore, intoRunScroll, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData;
|
|
8069
8493
|
const xHandleEl = refScrollXHandleElem.value;
|
|
8070
8494
|
const yHandleEl = refScrollYHandleElem.value;
|
|
8071
8495
|
const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
|
|
@@ -8076,6 +8500,9 @@ export default defineComponent({
|
|
|
8076
8500
|
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
|
|
8077
8501
|
return;
|
|
8078
8502
|
}
|
|
8503
|
+
if (intoRunScroll) {
|
|
8504
|
+
return;
|
|
8505
|
+
}
|
|
8079
8506
|
if (!bodyScrollElem) {
|
|
8080
8507
|
return;
|
|
8081
8508
|
}
|
|
@@ -8134,22 +8561,16 @@ export default defineComponent({
|
|
|
8134
8561
|
});
|
|
8135
8562
|
},
|
|
8136
8563
|
triggerHeaderScrollEvent(evnt, fixedType) {
|
|
8137
|
-
const { elemStore, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
8564
|
+
const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
8138
8565
|
const yHandleEl = refScrollYHandleElem.value;
|
|
8139
8566
|
const xHandleEl = refScrollXHandleElem.value;
|
|
8140
8567
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
8141
8568
|
const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
|
|
8142
8569
|
const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
|
|
8143
|
-
if (inWheelScroll) {
|
|
8570
|
+
if (inWheelScroll || inVirtualScroll || inBodyScroll || inFooterScroll) {
|
|
8144
8571
|
return;
|
|
8145
8572
|
}
|
|
8146
|
-
if (
|
|
8147
|
-
return;
|
|
8148
|
-
}
|
|
8149
|
-
if (inBodyScroll) {
|
|
8150
|
-
return;
|
|
8151
|
-
}
|
|
8152
|
-
if (inFooterScroll) {
|
|
8573
|
+
if (intoRunScroll) {
|
|
8153
8574
|
return;
|
|
8154
8575
|
}
|
|
8155
8576
|
if (!headerScrollElem) {
|
|
@@ -8176,22 +8597,16 @@ export default defineComponent({
|
|
|
8176
8597
|
});
|
|
8177
8598
|
},
|
|
8178
8599
|
triggerFooterScrollEvent(evnt, fixedType) {
|
|
8179
|
-
const { elemStore, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData;
|
|
8600
|
+
const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData;
|
|
8180
8601
|
const yHandleEl = refScrollYHandleElem.value;
|
|
8181
8602
|
const xHandleEl = refScrollXHandleElem.value;
|
|
8182
8603
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
8183
8604
|
const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
|
|
8184
8605
|
const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
|
|
8185
|
-
if (inWheelScroll) {
|
|
8186
|
-
return;
|
|
8187
|
-
}
|
|
8188
|
-
if (inVirtualScroll) {
|
|
8189
|
-
return;
|
|
8190
|
-
}
|
|
8191
|
-
if (inHeaderScroll) {
|
|
8606
|
+
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inBodyScroll) {
|
|
8192
8607
|
return;
|
|
8193
8608
|
}
|
|
8194
|
-
if (
|
|
8609
|
+
if (intoRunScroll) {
|
|
8195
8610
|
return;
|
|
8196
8611
|
}
|
|
8197
8612
|
if (!footerScrollElem) {
|
|
@@ -8218,7 +8633,10 @@ export default defineComponent({
|
|
|
8218
8633
|
});
|
|
8219
8634
|
},
|
|
8220
8635
|
triggerBodyWheelEvent(evnt) {
|
|
8221
|
-
const { deltaY, deltaX } = evnt;
|
|
8636
|
+
const { target, deltaY, deltaX } = evnt;
|
|
8637
|
+
if (target && /^textarea$/i.test(target.tagName)) {
|
|
8638
|
+
return;
|
|
8639
|
+
}
|
|
8222
8640
|
const { highlightHoverRow } = tableProps;
|
|
8223
8641
|
const { elemStore, lastScrollTop, lastScrollLeft } = internalData;
|
|
8224
8642
|
const rowOpts = computeRowOpts.value;
|
|
@@ -8236,31 +8654,13 @@ export default defineComponent({
|
|
|
8236
8654
|
if (!bodyScrollElem) {
|
|
8237
8655
|
return;
|
|
8238
8656
|
}
|
|
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;
|
|
8657
|
+
const wheelSpeed = getWheelSpeed(reactData.lastScrollTime);
|
|
8658
|
+
const deltaTop = deltaY * wheelSpeed;
|
|
8659
|
+
const deltaLeft = deltaX * wheelSpeed;
|
|
8260
8660
|
const isTopWheel = deltaTop < 0;
|
|
8261
|
-
const currScrollTop =
|
|
8661
|
+
const currScrollTop = bodyScrollElem.scrollTop;
|
|
8262
8662
|
// 如果滚动位置已经是顶部或底部,则不需要触发
|
|
8263
|
-
if (isTopWheel ? currScrollTop <= 0 : currScrollTop >=
|
|
8663
|
+
if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= bodyScrollElem.scrollHeight - bodyScrollElem.clientHeight) {
|
|
8264
8664
|
return;
|
|
8265
8665
|
}
|
|
8266
8666
|
const scrollTop = bodyScrollElem.scrollTop + deltaTop;
|
|
@@ -8273,17 +8673,92 @@ export default defineComponent({
|
|
|
8273
8673
|
if (rowOpts.isHover || highlightHoverRow) {
|
|
8274
8674
|
$xeTable.clearHoverRow();
|
|
8275
8675
|
}
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8676
|
+
wheelScrollTo(scrollTop - bodyScrollElem.scrollTop, (offsetTop) => {
|
|
8677
|
+
const currTopNum = bodyScrollElem.scrollTop + offsetTop;
|
|
8678
|
+
internalData.inWheelScroll = true;
|
|
8679
|
+
setScrollTop(yHandleEl, currTopNum);
|
|
8680
|
+
setScrollTop(bodyScrollElem, currTopNum);
|
|
8681
|
+
setScrollTop(leftScrollElem, currTopNum);
|
|
8682
|
+
setScrollTop(rightScrollElem, currTopNum);
|
|
8683
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
8684
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, scrollLeft, {
|
|
8685
|
+
type: 'table',
|
|
8686
|
+
fixed: ''
|
|
8687
|
+
});
|
|
8285
8688
|
});
|
|
8689
|
+
// internalData.inWheelScroll = true
|
|
8690
|
+
// setScrollTop(yHandleEl, scrollTop)
|
|
8691
|
+
// setScrollTop(bodyScrollElem, scrollTop)
|
|
8692
|
+
// setScrollTop(leftScrollElem, scrollTop)
|
|
8693
|
+
// setScrollTop(rightScrollElem, scrollTop)
|
|
8694
|
+
// loadScrollYData(scrollTop)
|
|
8695
|
+
// $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8696
|
+
// type: 'footer',
|
|
8697
|
+
// fixed: ''
|
|
8698
|
+
// })
|
|
8699
|
+
}
|
|
8700
|
+
},
|
|
8701
|
+
triggerVirtualScrollXEvent(evnt) {
|
|
8702
|
+
const { elemStore, inWheelScroll, lastScrollTop, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
8703
|
+
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
8704
|
+
return;
|
|
8286
8705
|
}
|
|
8706
|
+
if (inWheelScroll) {
|
|
8707
|
+
return;
|
|
8708
|
+
}
|
|
8709
|
+
const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
|
|
8710
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
8711
|
+
const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
|
|
8712
|
+
const yHandleEl = refScrollYHandleElem.value;
|
|
8713
|
+
const wrapperEl = evnt.currentTarget;
|
|
8714
|
+
const { scrollLeft } = wrapperEl;
|
|
8715
|
+
const yBodyEl = yHandleEl || bodyScrollElem;
|
|
8716
|
+
let scrollTop = 0;
|
|
8717
|
+
if (yBodyEl) {
|
|
8718
|
+
scrollTop = yBodyEl.scrollTop;
|
|
8719
|
+
}
|
|
8720
|
+
const isRollX = true;
|
|
8721
|
+
const isRollY = scrollTop !== lastScrollTop;
|
|
8722
|
+
internalData.inVirtualScroll = true;
|
|
8723
|
+
setScrollLeft(bodyScrollElem, scrollLeft);
|
|
8724
|
+
setScrollLeft(headerScrollElem, scrollLeft);
|
|
8725
|
+
setScrollLeft(footerScrollElem, scrollLeft);
|
|
8726
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
8727
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8728
|
+
type: 'table',
|
|
8729
|
+
fixed: ''
|
|
8730
|
+
});
|
|
8731
|
+
},
|
|
8732
|
+
triggerVirtualScrollYEvent(evnt) {
|
|
8733
|
+
const { elemStore, inWheelScroll, lastScrollLeft, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
8734
|
+
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
8735
|
+
return;
|
|
8736
|
+
}
|
|
8737
|
+
if (inWheelScroll) {
|
|
8738
|
+
return;
|
|
8739
|
+
}
|
|
8740
|
+
const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
|
|
8741
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
8742
|
+
const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
|
|
8743
|
+
const xHandleEl = refScrollXHandleElem.value;
|
|
8744
|
+
const wrapperEl = evnt.currentTarget;
|
|
8745
|
+
const { scrollTop } = wrapperEl;
|
|
8746
|
+
const xBodyEl = xHandleEl || bodyScrollElem;
|
|
8747
|
+
let scrollLeft = 0;
|
|
8748
|
+
if (xBodyEl) {
|
|
8749
|
+
scrollLeft = xBodyEl.scrollLeft;
|
|
8750
|
+
}
|
|
8751
|
+
const isRollX = scrollLeft !== lastScrollLeft;
|
|
8752
|
+
const isRollY = true;
|
|
8753
|
+
internalData.inVirtualScroll = true;
|
|
8754
|
+
setScrollTop(bodyScrollElem, scrollTop);
|
|
8755
|
+
setScrollTop(leftScrollElem, scrollTop);
|
|
8756
|
+
setScrollTop(rightScrollElem, scrollTop);
|
|
8757
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
8758
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8759
|
+
type: 'table',
|
|
8760
|
+
fixed: ''
|
|
8761
|
+
});
|
|
8287
8762
|
},
|
|
8288
8763
|
/**
|
|
8289
8764
|
* 对于树形结构中,可以直接滚动到指定深层节点中
|
|
@@ -8357,35 +8832,34 @@ export default defineComponent({
|
|
|
8357
8832
|
},
|
|
8358
8833
|
// 更新纵向 Y 可视渲染上下剩余空间大小
|
|
8359
8834
|
updateScrollYSpace() {
|
|
8360
|
-
const {
|
|
8361
|
-
const {
|
|
8362
|
-
const { scrollYStore, elemStore, afterFullData, fullAllDataRowIdData } = internalData;
|
|
8835
|
+
const { isAllOverflow, scrollYLoad } = reactData;
|
|
8836
|
+
const { scrollYStore, elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData;
|
|
8363
8837
|
const { startIndex } = scrollYStore;
|
|
8838
|
+
const rowOpts = computeRowOpts.value;
|
|
8839
|
+
const cellOpts = computeCellOpts.value;
|
|
8840
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
8364
8841
|
const bodyTableElem = getRefElem(elemStore['main-body-table']);
|
|
8365
8842
|
const containerList = ['main', 'left', 'right'];
|
|
8366
8843
|
let topSpaceHeight = 0;
|
|
8367
8844
|
let ySpaceHeight = 0;
|
|
8368
8845
|
if (scrollYLoad) {
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8846
|
+
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
|
|
8847
|
+
if (!isCustomCellHeight && isAllOverflow) {
|
|
8848
|
+
ySpaceHeight = afterFullData.length * defaultRowHeight;
|
|
8849
|
+
topSpaceHeight = Math.max(0, startIndex * defaultRowHeight);
|
|
8372
8850
|
}
|
|
8373
8851
|
else {
|
|
8374
8852
|
for (let i = 0; i < afterFullData.length; i++) {
|
|
8375
8853
|
const row = afterFullData[i];
|
|
8376
8854
|
const rowid = getRowid($xeTable, row);
|
|
8377
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
8378
|
-
|
|
8379
|
-
ySpaceHeight += rowRest.height || rowHeight;
|
|
8380
|
-
}
|
|
8855
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
8856
|
+
ySpaceHeight += rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
8381
8857
|
}
|
|
8382
8858
|
for (let i = 0; i < startIndex; i++) {
|
|
8383
8859
|
const row = afterFullData[i];
|
|
8384
8860
|
const rowid = getRowid($xeTable, row);
|
|
8385
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
8386
|
-
|
|
8387
|
-
topSpaceHeight += rowRest.height || rowHeight;
|
|
8388
|
-
}
|
|
8861
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
8862
|
+
topSpaceHeight += rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
8389
8863
|
}
|
|
8390
8864
|
}
|
|
8391
8865
|
}
|
|
@@ -8411,28 +8885,24 @@ export default defineComponent({
|
|
|
8411
8885
|
if (scrollYSpaceEl) {
|
|
8412
8886
|
scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
|
|
8413
8887
|
}
|
|
8414
|
-
nextTick(() => {
|
|
8888
|
+
return nextTick().then(() => {
|
|
8415
8889
|
updateStyle();
|
|
8416
8890
|
});
|
|
8417
8891
|
},
|
|
8418
8892
|
updateScrollXData() {
|
|
8419
|
-
const {
|
|
8893
|
+
const { isAllOverflow } = reactData;
|
|
8420
8894
|
handleTableColumn();
|
|
8421
|
-
// calcCellHeight()
|
|
8422
8895
|
return nextTick().then(() => {
|
|
8423
|
-
// calcCellHeight()
|
|
8424
8896
|
handleTableColumn();
|
|
8425
8897
|
$xeTable.updateScrollXSpace();
|
|
8426
|
-
if (!
|
|
8898
|
+
if (!isAllOverflow) {
|
|
8427
8899
|
$xeTable.updateScrollYSpace();
|
|
8428
8900
|
}
|
|
8429
8901
|
});
|
|
8430
8902
|
},
|
|
8431
8903
|
updateScrollYData() {
|
|
8432
8904
|
$xeTable.handleTableData();
|
|
8433
|
-
// calcCellHeight()
|
|
8434
8905
|
return nextTick().then(() => {
|
|
8435
|
-
// calcCellHeight()
|
|
8436
8906
|
$xeTable.handleTableData();
|
|
8437
8907
|
$xeTable.updateScrollYSpace();
|
|
8438
8908
|
});
|
|
@@ -8657,18 +9127,137 @@ export default defineComponent({
|
|
|
8657
9127
|
}
|
|
8658
9128
|
return renderEmptyElement($xeTable);
|
|
8659
9129
|
};
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
9130
|
+
const renderScrollX = () => {
|
|
9131
|
+
return h('div', {
|
|
9132
|
+
key: 'vsx',
|
|
9133
|
+
ref: refScrollXVirtualElem,
|
|
9134
|
+
class: 'vxe-table--scroll-x-virtual'
|
|
9135
|
+
}, [
|
|
9136
|
+
h('div', {
|
|
9137
|
+
ref: refScrollXLeftCornerElem,
|
|
9138
|
+
class: 'vxe-table--scroll-x-left-corner'
|
|
9139
|
+
}),
|
|
9140
|
+
h('div', {
|
|
9141
|
+
ref: refScrollXWrapperElem,
|
|
9142
|
+
class: 'vxe-table--scroll-x-wrapper'
|
|
9143
|
+
}, [
|
|
9144
|
+
h('div', {
|
|
9145
|
+
ref: refScrollXHandleElem,
|
|
9146
|
+
class: 'vxe-table--scroll-x-handle',
|
|
9147
|
+
onScroll: $xeTable.triggerVirtualScrollXEvent
|
|
9148
|
+
}, [
|
|
9149
|
+
h('div', {
|
|
9150
|
+
ref: refScrollXSpaceElem,
|
|
9151
|
+
class: 'vxe-table--scroll-x-space'
|
|
9152
|
+
})
|
|
9153
|
+
])
|
|
9154
|
+
]),
|
|
9155
|
+
h('div', {
|
|
9156
|
+
ref: refScrollXRightCornerElem,
|
|
9157
|
+
class: 'vxe-table--scroll-x-right-corner'
|
|
9158
|
+
})
|
|
9159
|
+
]);
|
|
9160
|
+
};
|
|
9161
|
+
const renderScrollY = () => {
|
|
9162
|
+
return h('div', {
|
|
9163
|
+
ref: refScrollYVirtualElem,
|
|
9164
|
+
class: 'vxe-table--scroll-y-virtual'
|
|
9165
|
+
}, [
|
|
9166
|
+
h('div', {
|
|
9167
|
+
ref: refScrollYTopCornerElem,
|
|
9168
|
+
class: 'vxe-table--scroll-y-top-corner'
|
|
9169
|
+
}),
|
|
9170
|
+
h('div', {
|
|
9171
|
+
ref: refScrollYWrapperElem,
|
|
9172
|
+
class: 'vxe-table--scroll-y-wrapper'
|
|
9173
|
+
}, [
|
|
9174
|
+
h('div', {
|
|
9175
|
+
ref: refScrollYHandleElem,
|
|
9176
|
+
class: 'vxe-table--scroll-y-handle',
|
|
9177
|
+
onScroll: $xeTable.triggerVirtualScrollYEvent
|
|
9178
|
+
}, [
|
|
9179
|
+
h('div', {
|
|
9180
|
+
ref: refScrollYSpaceElem,
|
|
9181
|
+
class: 'vxe-table--scroll-y-space'
|
|
9182
|
+
})
|
|
9183
|
+
])
|
|
9184
|
+
]),
|
|
9185
|
+
h('div', {
|
|
9186
|
+
ref: refScrollYBottomCornerElem,
|
|
9187
|
+
class: 'vxe-table--scroll-y-bottom-corner'
|
|
9188
|
+
})
|
|
9189
|
+
]);
|
|
9190
|
+
};
|
|
9191
|
+
const renderViewport = () => {
|
|
9192
|
+
const { showHeader, showFooter } = props;
|
|
9193
|
+
const { overflowX, tableData, tableColumn, tableGroupColumn, footerTableData, columnStore } = reactData;
|
|
9194
|
+
const { leftList, rightList } = columnStore;
|
|
9195
|
+
return h('div', {
|
|
9196
|
+
ref: refTableViewportElem,
|
|
9197
|
+
class: 'vxe-table--viewport-wrapper'
|
|
9198
|
+
}, [
|
|
9199
|
+
h('div', {
|
|
9200
|
+
class: 'vxe-table--main-wrapper'
|
|
9201
|
+
}, [
|
|
9202
|
+
/**
|
|
9203
|
+
* 表头
|
|
9204
|
+
*/
|
|
9205
|
+
showHeader
|
|
9206
|
+
? h(TableHeaderComponent, {
|
|
9207
|
+
ref: refTableHeader,
|
|
9208
|
+
tableData,
|
|
9209
|
+
tableColumn,
|
|
9210
|
+
tableGroupColumn
|
|
9211
|
+
})
|
|
9212
|
+
: renderEmptyElement($xeTable),
|
|
9213
|
+
/**
|
|
9214
|
+
* 表体
|
|
9215
|
+
*/
|
|
9216
|
+
h(TableBodyComponent, {
|
|
9217
|
+
ref: refTableBody,
|
|
9218
|
+
tableData,
|
|
9219
|
+
tableColumn
|
|
9220
|
+
}),
|
|
9221
|
+
/**
|
|
9222
|
+
* 表尾
|
|
9223
|
+
*/
|
|
9224
|
+
showFooter
|
|
9225
|
+
? h(TableFooterComponent, {
|
|
9226
|
+
ref: refTableFooter,
|
|
9227
|
+
footerTableData,
|
|
9228
|
+
tableColumn
|
|
9229
|
+
})
|
|
9230
|
+
: renderEmptyElement($xeTable)
|
|
9231
|
+
]),
|
|
9232
|
+
h('div', {
|
|
9233
|
+
class: 'vxe-table--fixed-wrapper'
|
|
9234
|
+
}, [
|
|
9235
|
+
leftList && leftList.length && overflowX ? renderFixed('left') : renderEmptyElement($xeTable),
|
|
9236
|
+
rightList && rightList.length && overflowX ? renderFixed('right') : renderEmptyElement($xeTable)
|
|
9237
|
+
])
|
|
9238
|
+
]);
|
|
9239
|
+
};
|
|
9240
|
+
const renderBody = () => {
|
|
9241
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value;
|
|
9242
|
+
return h('div', {
|
|
9243
|
+
class: 'vxe-table--layout-wrapper'
|
|
9244
|
+
}, scrollbarYToLeft
|
|
9245
|
+
? [
|
|
9246
|
+
renderScrollY(),
|
|
9247
|
+
renderViewport()
|
|
9248
|
+
]
|
|
9249
|
+
: [
|
|
9250
|
+
renderViewport(),
|
|
9251
|
+
renderScrollY()
|
|
9252
|
+
]);
|
|
9253
|
+
};
|
|
8666
9254
|
const renderVN = () => {
|
|
8667
9255
|
const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules } = props;
|
|
8668
|
-
const {
|
|
9256
|
+
const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, columnStore, filterStore, customStore } = reactData;
|
|
8669
9257
|
const { leftList, rightList } = columnStore;
|
|
8670
9258
|
const loadingSlot = slots.loading;
|
|
8671
|
-
const
|
|
9259
|
+
const tableTipConfig = computeTableTipConfig.value;
|
|
9260
|
+
const validTipConfig = computeValidTipConfig.value;
|
|
8672
9261
|
const validOpts = computeValidOpts.value;
|
|
8673
9262
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
8674
9263
|
const treeOpts = computeTreeOpts.value;
|
|
@@ -8684,9 +9273,11 @@ export default defineComponent({
|
|
|
8684
9273
|
const resizableOpts = computeResizableOpts.value;
|
|
8685
9274
|
const isArea = mouseConfig && mouseOpts.area;
|
|
8686
9275
|
const columnDragOpts = computeColumnDragOpts.value;
|
|
9276
|
+
const scrollbarXToTop = computeScrollbarXToTop.value;
|
|
9277
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value;
|
|
8687
9278
|
return h('div', {
|
|
8688
9279
|
ref: refElem,
|
|
8689
|
-
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, {
|
|
9280
|
+
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
|
|
8690
9281
|
[`size--${vSize}`]: vSize,
|
|
8691
9282
|
[`valid-msg--${validOpts.msgMode}`]: !!editRules,
|
|
8692
9283
|
'vxe-editable': !!editConfig,
|
|
@@ -8699,7 +9290,6 @@ export default defineComponent({
|
|
|
8699
9290
|
'row--highlight': rowOpts.isHover || highlightHoverRow,
|
|
8700
9291
|
'column--highlight': columnOpts.isHover || highlightHoverColumn,
|
|
8701
9292
|
'checkbox--range': checkboxOpts.range,
|
|
8702
|
-
'column--calc': isCalcColumn,
|
|
8703
9293
|
'col--drag-cell': columnOpts.drag && columnDragOpts.trigger === 'cell',
|
|
8704
9294
|
'is--header': showHeader,
|
|
8705
9295
|
'is--footer': showFooter,
|
|
@@ -8708,7 +9298,6 @@ export default defineComponent({
|
|
|
8708
9298
|
'is--fixed-left': leftList.length,
|
|
8709
9299
|
'is--fixed-right': rightList.length,
|
|
8710
9300
|
'is--animat': !!props.animat,
|
|
8711
|
-
'is--padding': props.padding,
|
|
8712
9301
|
'is--round': props.round,
|
|
8713
9302
|
'is--stripe': !treeConfig && stripe,
|
|
8714
9303
|
'is--loading': currLoading,
|
|
@@ -8730,95 +9319,15 @@ export default defineComponent({
|
|
|
8730
9319
|
h('div', {
|
|
8731
9320
|
key: 'tw',
|
|
8732
9321
|
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
|
-
})
|
|
9322
|
+
}, scrollbarXToTop
|
|
9323
|
+
? [
|
|
9324
|
+
renderScrollX(),
|
|
9325
|
+
renderBody()
|
|
9326
|
+
]
|
|
9327
|
+
: [
|
|
9328
|
+
renderBody(),
|
|
9329
|
+
renderScrollX()
|
|
8816
9330
|
]),
|
|
8817
|
-
h('div', {
|
|
8818
|
-
ref: refScrollXRightCornerElem,
|
|
8819
|
-
class: 'vxe-table--scroll-x-right-corner'
|
|
8820
|
-
})
|
|
8821
|
-
]),
|
|
8822
9331
|
/**
|
|
8823
9332
|
* 空数据
|
|
8824
9333
|
*/
|
|
@@ -8842,18 +9351,26 @@ export default defineComponent({
|
|
|
8842
9351
|
* 列宽线
|
|
8843
9352
|
*/
|
|
8844
9353
|
h('div', {
|
|
8845
|
-
key: '
|
|
8846
|
-
ref:
|
|
8847
|
-
class: 'vxe-table--resizable-bar'
|
|
8848
|
-
|
|
8849
|
-
|
|
8850
|
-
|
|
8851
|
-
|
|
8852
|
-
|
|
9354
|
+
key: 'tcl',
|
|
9355
|
+
ref: refColResizeBar,
|
|
9356
|
+
class: 'vxe-table--resizable-col-bar'
|
|
9357
|
+
}, resizableOpts.showDragTip
|
|
9358
|
+
? [
|
|
9359
|
+
h('div', {
|
|
9360
|
+
class: 'vxe-table--resizable-number-tip'
|
|
9361
|
+
})
|
|
9362
|
+
]
|
|
9363
|
+
: []),
|
|
9364
|
+
/**
|
|
9365
|
+
* 行高线
|
|
9366
|
+
*/
|
|
9367
|
+
h('div', {
|
|
9368
|
+
key: 'trl',
|
|
9369
|
+
ref: refRowResizeBar,
|
|
9370
|
+
class: 'vxe-table--resizable-row-bar'
|
|
8853
9371
|
}, resizableOpts.showDragTip
|
|
8854
9372
|
? [
|
|
8855
9373
|
h('div', {
|
|
8856
|
-
ref: refCellResizeTip,
|
|
8857
9374
|
class: 'vxe-table--resizable-number-tip'
|
|
8858
9375
|
})
|
|
8859
9376
|
]
|
|
@@ -8950,17 +9467,29 @@ export default defineComponent({
|
|
|
8950
9467
|
/**
|
|
8951
9468
|
* 工具提示
|
|
8952
9469
|
*/
|
|
8953
|
-
h(VxeUITooltipComponent,
|
|
9470
|
+
h(VxeUITooltipComponent, {
|
|
8954
9471
|
key: 'btp',
|
|
8955
|
-
ref: refTooltip
|
|
8956
|
-
|
|
9472
|
+
ref: refTooltip,
|
|
9473
|
+
theme: tableTipConfig.theme,
|
|
9474
|
+
enterable: tableTipConfig.enterable,
|
|
9475
|
+
enterDelay: tableTipConfig.enterDelay,
|
|
9476
|
+
leaveDelay: tableTipConfig.leaveDelay
|
|
9477
|
+
}),
|
|
8957
9478
|
/**
|
|
8958
9479
|
* 校验提示
|
|
8959
9480
|
*/
|
|
8960
9481
|
props.editRules && validOpts.showMessage && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip')
|
|
8961
|
-
? h(VxeUITooltipComponent,
|
|
9482
|
+
? h(VxeUITooltipComponent, {
|
|
9483
|
+
key: 'vtp',
|
|
9484
|
+
ref: refValidTooltip,
|
|
9485
|
+
class: [{
|
|
8962
9486
|
'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete'
|
|
8963
|
-
}, 'vxe-table--valid-error']
|
|
9487
|
+
}, 'vxe-table--valid-error'],
|
|
9488
|
+
theme: validTipConfig.theme,
|
|
9489
|
+
enterable: validTipConfig.enterable,
|
|
9490
|
+
enterDelay: validTipConfig.enterDelay,
|
|
9491
|
+
leaveDelay: validTipConfig.leaveDelay
|
|
9492
|
+
})
|
|
8964
9493
|
: renderEmptyElement($xeTable)
|
|
8965
9494
|
])
|
|
8966
9495
|
: renderEmptyElement($xeTable)
|
|
@@ -8979,7 +9508,7 @@ export default defineComponent({
|
|
|
8979
9508
|
if (value && value.length >= 50000) {
|
|
8980
9509
|
warnLog('vxe.error.errLargeData', ['loadData(data), reloadData(data)']);
|
|
8981
9510
|
}
|
|
8982
|
-
loadTableData(value).then(() => {
|
|
9511
|
+
loadTableData(value, true).then(() => {
|
|
8983
9512
|
const { scrollXLoad, scrollYLoad, expandColumn } = reactData;
|
|
8984
9513
|
internalData.inited = true;
|
|
8985
9514
|
internalData.initStatus = true;
|
|
@@ -9027,16 +9556,37 @@ export default defineComponent({
|
|
|
9027
9556
|
tableMethods.refreshColumn();
|
|
9028
9557
|
});
|
|
9029
9558
|
});
|
|
9559
|
+
const reScrollFlag = ref(0);
|
|
9560
|
+
watch(computeSize, () => {
|
|
9561
|
+
reScrollFlag.value++;
|
|
9562
|
+
});
|
|
9030
9563
|
watch(() => props.showHeader, () => {
|
|
9031
|
-
|
|
9032
|
-
tableMethods.recalculate(true).then(() => tableMethods.refreshScroll());
|
|
9033
|
-
});
|
|
9564
|
+
reScrollFlag.value++;
|
|
9034
9565
|
});
|
|
9035
9566
|
watch(() => props.showFooter, () => {
|
|
9567
|
+
reScrollFlag.value++;
|
|
9568
|
+
});
|
|
9569
|
+
watch(reScrollFlag, () => {
|
|
9036
9570
|
nextTick(() => {
|
|
9037
9571
|
tableMethods.recalculate(true).then(() => tableMethods.refreshScroll());
|
|
9038
9572
|
});
|
|
9039
9573
|
});
|
|
9574
|
+
const reLayoutFlag = ref(0);
|
|
9575
|
+
watch(() => props.height, () => {
|
|
9576
|
+
reLayoutFlag.value++;
|
|
9577
|
+
});
|
|
9578
|
+
watch(() => props.maxHeight, () => {
|
|
9579
|
+
reLayoutFlag.value++;
|
|
9580
|
+
});
|
|
9581
|
+
watch(computeScrollbarXToTop, () => {
|
|
9582
|
+
reLayoutFlag.value++;
|
|
9583
|
+
});
|
|
9584
|
+
watch(computeScrollbarYToLeft, () => {
|
|
9585
|
+
reLayoutFlag.value++;
|
|
9586
|
+
});
|
|
9587
|
+
watch(reLayoutFlag, () => {
|
|
9588
|
+
nextTick(() => tableMethods.recalculate(true));
|
|
9589
|
+
});
|
|
9040
9590
|
const footFlag = ref(0);
|
|
9041
9591
|
watch(() => props.footerData ? props.footerData.length : -1, () => {
|
|
9042
9592
|
footFlag.value++;
|
|
@@ -9047,23 +9597,12 @@ export default defineComponent({
|
|
|
9047
9597
|
watch(footFlag, () => {
|
|
9048
9598
|
tableMethods.updateFooter();
|
|
9049
9599
|
});
|
|
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
9600
|
watch(() => props.syncResize, (value) => {
|
|
9062
9601
|
if (value) {
|
|
9063
|
-
|
|
9602
|
+
handleUpdateResize();
|
|
9064
9603
|
nextTick(() => {
|
|
9065
|
-
|
|
9066
|
-
setTimeout(() =>
|
|
9604
|
+
handleUpdateResize();
|
|
9605
|
+
setTimeout(() => handleUpdateResize());
|
|
9067
9606
|
});
|
|
9068
9607
|
}
|
|
9069
9608
|
});
|
|
@@ -9163,6 +9702,9 @@ export default defineComponent({
|
|
|
9163
9702
|
if (props.showFooter && !(props.footerMethod || props.footerData)) {
|
|
9164
9703
|
warnLog('vxe.error.reqProp', ['footer-data | footer-method']);
|
|
9165
9704
|
}
|
|
9705
|
+
if (rowOpts.height) {
|
|
9706
|
+
warnLog('vxe.error.delProp', ['row-config.height', 'cell-config.height']);
|
|
9707
|
+
}
|
|
9166
9708
|
// if (props.highlightCurrentRow) {
|
|
9167
9709
|
// warnLog('vxe.error.delProp', ['highlight-current-row', 'row-config.isCurrent'])
|
|
9168
9710
|
// }
|
|
@@ -9270,7 +9812,7 @@ export default defineComponent({
|
|
|
9270
9812
|
endIndex: 0,
|
|
9271
9813
|
visibleSize: 0
|
|
9272
9814
|
});
|
|
9273
|
-
loadTableData(data || []).then(() => {
|
|
9815
|
+
loadTableData(data || [], true).then(() => {
|
|
9274
9816
|
if (data && data.length) {
|
|
9275
9817
|
internalData.inited = true;
|
|
9276
9818
|
internalData.initStatus = true;
|