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/lib/table/src/table.js
CHANGED
|
@@ -58,7 +58,6 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
58
58
|
computeSize
|
|
59
59
|
} = useFns.useSize(props);
|
|
60
60
|
const reactData = (0, _vue.reactive)({
|
|
61
|
-
isCalcColumn: false,
|
|
62
61
|
// 低性能的静态列
|
|
63
62
|
staticColumns: [],
|
|
64
63
|
// 渲染的列分组
|
|
@@ -271,14 +270,15 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
271
270
|
isFooter: false
|
|
272
271
|
},
|
|
273
272
|
scrollVMLoading: false,
|
|
274
|
-
|
|
273
|
+
calcCellHeightFlag: 0,
|
|
274
|
+
resizeHeightFlag: 0,
|
|
275
275
|
isCustomStatus: false,
|
|
276
276
|
isDragRowMove: false,
|
|
277
277
|
dragRow: null,
|
|
278
278
|
isDragColMove: false,
|
|
279
279
|
dragCol: null,
|
|
280
280
|
dragTipText: '',
|
|
281
|
-
|
|
281
|
+
isDragResize: false,
|
|
282
282
|
isLoading: false
|
|
283
283
|
});
|
|
284
284
|
const internalData = {
|
|
@@ -353,10 +353,6 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
353
353
|
fullDataRowIdData: {},
|
|
354
354
|
fullColumnIdData: {},
|
|
355
355
|
fullColumnFieldData: {},
|
|
356
|
-
// 列选取状态
|
|
357
|
-
columnStatusMaps: {},
|
|
358
|
-
// 行选取状态
|
|
359
|
-
rowStatusMaps: {},
|
|
360
356
|
// prevDragRow: null,
|
|
361
357
|
inited: false,
|
|
362
358
|
tooltipTimeout: null,
|
|
@@ -384,8 +380,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
384
380
|
const refTableRightFooter = (0, _vue.ref)();
|
|
385
381
|
const refLeftContainer = (0, _vue.ref)();
|
|
386
382
|
const refRightContainer = (0, _vue.ref)();
|
|
387
|
-
const
|
|
388
|
-
const
|
|
383
|
+
const refColResizeBar = (0, _vue.ref)();
|
|
384
|
+
const refRowResizeBar = (0, _vue.ref)();
|
|
389
385
|
const refEmptyPlaceholder = (0, _vue.ref)();
|
|
390
386
|
const refDragTipElem = (0, _vue.ref)();
|
|
391
387
|
const refDragRowLineElem = (0, _vue.ref)();
|
|
@@ -393,9 +389,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
393
389
|
const refScrollXVirtualElem = (0, _vue.ref)();
|
|
394
390
|
const refScrollYVirtualElem = (0, _vue.ref)();
|
|
395
391
|
const refScrollXHandleElem = (0, _vue.ref)();
|
|
392
|
+
const refScrollXLeftCornerElem = (0, _vue.ref)();
|
|
396
393
|
const refScrollXRightCornerElem = (0, _vue.ref)();
|
|
397
394
|
const refScrollYHandleElem = (0, _vue.ref)();
|
|
398
395
|
const refScrollYTopCornerElem = (0, _vue.ref)();
|
|
396
|
+
const refScrollXWrapperElem = (0, _vue.ref)();
|
|
397
|
+
const refScrollYWrapperElem = (0, _vue.ref)();
|
|
399
398
|
const refScrollYBottomCornerElem = (0, _vue.ref)();
|
|
400
399
|
const refScrollXSpaceElem = (0, _vue.ref)();
|
|
401
400
|
const refScrollYSpaceElem = (0, _vue.ref)();
|
|
@@ -452,6 +451,14 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
452
451
|
const computeScrollbarOpts = (0, _vue.computed)(() => {
|
|
453
452
|
return Object.assign({}, getConfig().table.scrollbarConfig, props.scrollbarConfig);
|
|
454
453
|
});
|
|
454
|
+
const computeScrollbarXToTop = (0, _vue.computed)(() => {
|
|
455
|
+
const scrollbarOpts = computeScrollbarOpts.value;
|
|
456
|
+
return !!(scrollbarOpts.x && scrollbarOpts.x.position === 'top');
|
|
457
|
+
});
|
|
458
|
+
const computeScrollbarYToLeft = (0, _vue.computed)(() => {
|
|
459
|
+
const scrollbarOpts = computeScrollbarOpts.value;
|
|
460
|
+
return !!(scrollbarOpts.y && scrollbarOpts.y.position === 'left');
|
|
461
|
+
});
|
|
455
462
|
const computeScrollYThreshold = (0, _vue.computed)(() => {
|
|
456
463
|
const sYOpts = computeSYOpts.value;
|
|
457
464
|
const {
|
|
@@ -473,7 +480,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
473
480
|
const computeDefaultRowHeight = (0, _vue.computed)(() => {
|
|
474
481
|
const vSize = computeSize.value;
|
|
475
482
|
const rowHeightMaps = computeRowHeightMaps.value;
|
|
476
|
-
return rowHeightMaps[vSize || 'default'];
|
|
483
|
+
return rowHeightMaps[vSize || 'default'] || 18;
|
|
477
484
|
});
|
|
478
485
|
const computeColumnOpts = (0, _vue.computed)(() => {
|
|
479
486
|
return Object.assign({}, getConfig().table.columnConfig, props.columnConfig);
|
|
@@ -481,6 +488,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
481
488
|
const computeCellOpts = (0, _vue.computed)(() => {
|
|
482
489
|
return Object.assign({}, getConfig().table.cellConfig, props.cellConfig);
|
|
483
490
|
});
|
|
491
|
+
const computeHeaderCellOpts = (0, _vue.computed)(() => {
|
|
492
|
+
return Object.assign({}, getConfig().table.headerCellConfig, props.headerCellConfig);
|
|
493
|
+
});
|
|
494
|
+
const computeFooterCellOpts = (0, _vue.computed)(() => {
|
|
495
|
+
return Object.assign({}, getConfig().table.footerCellConfig, props.footerCellConfig);
|
|
496
|
+
});
|
|
484
497
|
const computeRowOpts = (0, _vue.computed)(() => {
|
|
485
498
|
return Object.assign({}, getConfig().table.rowConfig, props.rowConfig);
|
|
486
499
|
});
|
|
@@ -510,6 +523,17 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
510
523
|
const computeTooltipOpts = (0, _vue.computed)(() => {
|
|
511
524
|
return Object.assign({}, getConfig().tooltip, getConfig().table.tooltipConfig, props.tooltipConfig);
|
|
512
525
|
});
|
|
526
|
+
const computeTableTipConfig = (0, _vue.computed)(() => {
|
|
527
|
+
const {
|
|
528
|
+
tooltipStore
|
|
529
|
+
} = reactData;
|
|
530
|
+
const tooltipOpts = computeTooltipOpts.value;
|
|
531
|
+
return Object.assign({}, tooltipOpts, tooltipStore.currOpts);
|
|
532
|
+
});
|
|
533
|
+
const computeValidTipConfig = (0, _vue.computed)(() => {
|
|
534
|
+
const tooltipOpts = computeTooltipOpts.value;
|
|
535
|
+
return Object.assign({}, tooltipOpts);
|
|
536
|
+
});
|
|
513
537
|
const computeEditOpts = (0, _vue.computed)(() => {
|
|
514
538
|
return Object.assign({}, getConfig().table.editConfig, props.editConfig);
|
|
515
539
|
});
|
|
@@ -740,8 +764,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
740
764
|
refTableRightFooter,
|
|
741
765
|
refLeftContainer,
|
|
742
766
|
refRightContainer,
|
|
743
|
-
|
|
744
|
-
|
|
767
|
+
refColResizeBar,
|
|
768
|
+
refRowResizeBar,
|
|
745
769
|
refScrollXVirtualElem,
|
|
746
770
|
refScrollYVirtualElem,
|
|
747
771
|
refScrollXHandleElem,
|
|
@@ -756,11 +780,15 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
756
780
|
computeVirtualXOpts,
|
|
757
781
|
computeVirtualYOpts,
|
|
758
782
|
computeScrollbarOpts,
|
|
783
|
+
computeScrollbarXToTop,
|
|
784
|
+
computeScrollbarYToLeft,
|
|
759
785
|
computeColumnOpts,
|
|
760
786
|
computeScrollXThreshold,
|
|
761
787
|
computeScrollYThreshold,
|
|
762
788
|
computeDefaultRowHeight,
|
|
763
789
|
computeCellOpts,
|
|
790
|
+
computeHeaderCellOpts,
|
|
791
|
+
computeFooterCellOpts,
|
|
764
792
|
computeRowOpts,
|
|
765
793
|
computeRowDragOpts,
|
|
766
794
|
computeColumnDragOpts,
|
|
@@ -911,59 +939,66 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
911
939
|
};
|
|
912
940
|
};
|
|
913
941
|
const computeRowHeight = () => {
|
|
942
|
+
const {
|
|
943
|
+
isAllOverflow
|
|
944
|
+
} = reactData;
|
|
914
945
|
const tableHeader = refTableHeader.value;
|
|
915
946
|
const tableBody = refTableBody.value;
|
|
916
947
|
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
917
948
|
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
918
949
|
let rowHeight = 0;
|
|
919
|
-
if (
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
firstTrElem
|
|
950
|
+
if (isAllOverflow) {
|
|
951
|
+
if (tableBodyElem) {
|
|
952
|
+
const tableHeaderElem = tableHeader ? tableHeader.$el : null;
|
|
953
|
+
let firstTrElem;
|
|
954
|
+
firstTrElem = tableBodyElem.querySelector('tr');
|
|
955
|
+
if (!firstTrElem && tableHeaderElem) {
|
|
956
|
+
firstTrElem = tableHeaderElem.querySelector('tr');
|
|
957
|
+
}
|
|
958
|
+
if (firstTrElem) {
|
|
959
|
+
rowHeight = firstTrElem.clientHeight;
|
|
960
|
+
}
|
|
925
961
|
}
|
|
926
|
-
if (
|
|
927
|
-
rowHeight =
|
|
962
|
+
if (!rowHeight) {
|
|
963
|
+
rowHeight = defaultRowHeight;
|
|
928
964
|
}
|
|
929
|
-
}
|
|
930
|
-
if (!rowHeight) {
|
|
965
|
+
} else {
|
|
931
966
|
rowHeight = defaultRowHeight;
|
|
932
967
|
}
|
|
933
968
|
// 最低支持 18px 行高
|
|
934
969
|
return Math.max(18, rowHeight);
|
|
935
970
|
};
|
|
936
|
-
const handleVirtualYVisible =
|
|
937
|
-
const {
|
|
938
|
-
showOverflow
|
|
939
|
-
} = props;
|
|
971
|
+
const handleVirtualYVisible = currScrollTop => {
|
|
940
972
|
const {
|
|
941
|
-
|
|
973
|
+
isAllOverflow
|
|
942
974
|
} = reactData;
|
|
943
975
|
const {
|
|
944
976
|
elemStore,
|
|
977
|
+
isResizeCellHeight,
|
|
945
978
|
afterFullData,
|
|
946
979
|
fullAllDataRowIdData
|
|
947
980
|
} = internalData;
|
|
981
|
+
const rowOpts = computeRowOpts.value;
|
|
982
|
+
const cellOpts = computeCellOpts.value;
|
|
983
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
948
984
|
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
949
985
|
if (bodyScrollElem) {
|
|
950
|
-
const
|
|
951
|
-
|
|
952
|
-
clientHeight
|
|
953
|
-
} = bodyScrollElem;
|
|
986
|
+
const clientHeight = bodyScrollElem.clientHeight;
|
|
987
|
+
const scrollTop = _xeUtils.default.isNumber(currScrollTop) ? currScrollTop : bodyScrollElem.scrollTop;
|
|
954
988
|
const endHeight = scrollTop + clientHeight;
|
|
955
989
|
let toVisibleIndex = -1;
|
|
956
990
|
let offsetTop = 0;
|
|
957
991
|
let visibleSize = 0;
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
992
|
+
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
|
|
993
|
+
if (!isCustomCellHeight && isAllOverflow) {
|
|
994
|
+
toVisibleIndex = Math.floor(scrollTop / defaultRowHeight);
|
|
995
|
+
visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
|
|
961
996
|
} else {
|
|
962
997
|
for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
963
998
|
const row = afterFullData[rIndex];
|
|
964
999
|
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
965
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
966
|
-
offsetTop += rowRest
|
|
1000
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
1001
|
+
offsetTop += rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
967
1002
|
if (toVisibleIndex === -1 && scrollTop < offsetTop) {
|
|
968
1003
|
toVisibleIndex = rIndex;
|
|
969
1004
|
}
|
|
@@ -1266,7 +1301,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1266
1301
|
}
|
|
1267
1302
|
fullColumnFieldData[field] = rest;
|
|
1268
1303
|
} else {
|
|
1269
|
-
if (storage || columnOpts.drag && (isCrossDrag || isSelfToChildDrag)) {
|
|
1304
|
+
if (storage && !type || columnOpts.drag && (isCrossDrag || isSelfToChildDrag)) {
|
|
1270
1305
|
(0, _log.errLog)('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field`]);
|
|
1271
1306
|
}
|
|
1272
1307
|
}
|
|
@@ -1354,56 +1389,40 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1354
1389
|
internalData.customMaxHeight = calcTableHeight('maxHeight');
|
|
1355
1390
|
};
|
|
1356
1391
|
const calcColumnAutoWidth = (column, wrapperEl) => {
|
|
1357
|
-
const
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
if (firstCellEl) {
|
|
1361
|
-
const cellStyle = getComputedStyle(firstCellEl);
|
|
1362
|
-
|
|
1363
|
-
}
|
|
1364
|
-
let colWidth = column.renderAutoWidth -
|
|
1365
|
-
|
|
1366
|
-
const
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
_xeUtils.default.arrayEach(cellEl.children, btnEl => {
|
|
1371
|
-
titleWidth += btnEl.offsetWidth + 1;
|
|
1372
|
-
});
|
|
1373
|
-
} else {
|
|
1374
|
-
const labelEl = cellEl.firstElementChild;
|
|
1375
|
-
if (labelEl) {
|
|
1376
|
-
titleWidth = labelEl.offsetWidth;
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
if (titleWidth) {
|
|
1380
|
-
colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4);
|
|
1381
|
-
}
|
|
1382
|
-
});
|
|
1383
|
-
return colWidth + paddingSize;
|
|
1392
|
+
const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[colid="${column.id}"]`);
|
|
1393
|
+
let leftRightPadding = 0;
|
|
1394
|
+
const firstCellEl = cellElemList[0];
|
|
1395
|
+
if (firstCellEl && firstCellEl.parentElement) {
|
|
1396
|
+
const cellStyle = getComputedStyle(firstCellEl.parentElement);
|
|
1397
|
+
leftRightPadding = Math.ceil(_xeUtils.default.toNumber(cellStyle.paddingLeft) + _xeUtils.default.toNumber(cellStyle.paddingRight));
|
|
1398
|
+
}
|
|
1399
|
+
let colWidth = column.renderAutoWidth - leftRightPadding;
|
|
1400
|
+
for (let i = 0; i < cellElemList.length; i++) {
|
|
1401
|
+
const celEl = cellElemList[i];
|
|
1402
|
+
colWidth = Math.max(colWidth, celEl ? Math.ceil(celEl.scrollWidth) + 4 : 0);
|
|
1403
|
+
}
|
|
1404
|
+
return colWidth + leftRightPadding;
|
|
1384
1405
|
};
|
|
1385
1406
|
const calcCellWidth = () => {
|
|
1386
1407
|
const autoWidthColumnList = computeAutoWidthColumnList.value;
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
reactData.isCalcColumn = false;
|
|
1406
|
-
});
|
|
1408
|
+
const {
|
|
1409
|
+
fullColumnIdData
|
|
1410
|
+
} = internalData;
|
|
1411
|
+
const el = refElem.value;
|
|
1412
|
+
if (el) {
|
|
1413
|
+
el.setAttribute('data-calc-col', 'Y');
|
|
1414
|
+
autoWidthColumnList.forEach(column => {
|
|
1415
|
+
const colid = column.id;
|
|
1416
|
+
const colRest = fullColumnIdData[colid];
|
|
1417
|
+
const colWidth = calcColumnAutoWidth(column, el);
|
|
1418
|
+
if (colRest) {
|
|
1419
|
+
colRest.width = Math.max(colWidth, colRest.width);
|
|
1420
|
+
}
|
|
1421
|
+
column.renderAutoWidth = colWidth;
|
|
1422
|
+
});
|
|
1423
|
+
$xeTable.analyColumnWidth();
|
|
1424
|
+
el.removeAttribute('data-calc-col');
|
|
1425
|
+
}
|
|
1407
1426
|
};
|
|
1408
1427
|
/**
|
|
1409
1428
|
* 列宽算法,计算单元格列宽,动态分配可用剩余空间
|
|
@@ -1459,39 +1478,39 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1459
1478
|
});
|
|
1460
1479
|
// 最小自适应
|
|
1461
1480
|
autoMinList.forEach(column => {
|
|
1462
|
-
const
|
|
1463
|
-
tableWidth +=
|
|
1464
|
-
column.renderWidth =
|
|
1481
|
+
const caWidth = Math.max(60, _xeUtils.default.toInteger(column.renderAutoWidth));
|
|
1482
|
+
tableWidth += caWidth;
|
|
1483
|
+
column.renderWidth = caWidth;
|
|
1465
1484
|
});
|
|
1466
1485
|
// 最小百分比
|
|
1467
1486
|
scaleMinList.forEach(column => {
|
|
1468
|
-
const
|
|
1469
|
-
tableWidth +=
|
|
1470
|
-
column.renderWidth =
|
|
1487
|
+
const smWidth = Math.floor(_xeUtils.default.toInteger(column.minWidth) * meanWidth);
|
|
1488
|
+
tableWidth += smWidth;
|
|
1489
|
+
column.renderWidth = smWidth;
|
|
1471
1490
|
});
|
|
1472
1491
|
// 固定百分比
|
|
1473
1492
|
scaleList.forEach(column => {
|
|
1474
|
-
const
|
|
1475
|
-
tableWidth +=
|
|
1476
|
-
column.renderWidth =
|
|
1493
|
+
const sfWidth = Math.floor(_xeUtils.default.toInteger(column.width) * meanWidth);
|
|
1494
|
+
tableWidth += sfWidth;
|
|
1495
|
+
column.renderWidth = sfWidth;
|
|
1477
1496
|
});
|
|
1478
1497
|
// 固定宽
|
|
1479
1498
|
pxList.forEach(column => {
|
|
1480
|
-
const
|
|
1481
|
-
tableWidth +=
|
|
1482
|
-
column.renderWidth =
|
|
1499
|
+
const pWidth = _xeUtils.default.toInteger(column.width);
|
|
1500
|
+
tableWidth += pWidth;
|
|
1501
|
+
column.renderWidth = pWidth;
|
|
1483
1502
|
});
|
|
1484
1503
|
// 自适应宽
|
|
1485
1504
|
autoList.forEach(column => {
|
|
1486
|
-
const
|
|
1487
|
-
tableWidth +=
|
|
1488
|
-
column.renderWidth =
|
|
1505
|
+
const aWidth = Math.max(60, _xeUtils.default.toInteger(column.renderAutoWidth));
|
|
1506
|
+
tableWidth += aWidth;
|
|
1507
|
+
column.renderWidth = aWidth;
|
|
1489
1508
|
});
|
|
1490
1509
|
// 调整了列宽
|
|
1491
1510
|
resizeList.forEach(column => {
|
|
1492
|
-
const
|
|
1493
|
-
tableWidth +=
|
|
1494
|
-
column.renderWidth =
|
|
1511
|
+
const reWidth = _xeUtils.default.toInteger(column.resizeWidth);
|
|
1512
|
+
tableWidth += reWidth;
|
|
1513
|
+
column.renderWidth = reWidth;
|
|
1495
1514
|
});
|
|
1496
1515
|
remainWidth -= tableWidth;
|
|
1497
1516
|
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoMinList.length + remainList.length)) : 0;
|
|
@@ -1531,7 +1550,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1531
1550
|
}
|
|
1532
1551
|
const tableHeight = bodyElem.offsetHeight;
|
|
1533
1552
|
const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight;
|
|
1534
|
-
reactData.scrollbarWidth =
|
|
1553
|
+
reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth);
|
|
1535
1554
|
reactData.overflowY = overflowY;
|
|
1536
1555
|
internalData.tableWidth = tableWidth;
|
|
1537
1556
|
internalData.tableHeight = tableHeight;
|
|
@@ -1540,7 +1559,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1540
1559
|
const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0;
|
|
1541
1560
|
const overflowX = tableWidth > bodyWidth;
|
|
1542
1561
|
const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0;
|
|
1543
|
-
reactData.scrollbarHeight =
|
|
1562
|
+
reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight);
|
|
1544
1563
|
internalData.headerHeight = headerHeight;
|
|
1545
1564
|
internalData.footerHeight = footerHeight;
|
|
1546
1565
|
reactData.overflowX = overflowX;
|
|
@@ -1550,64 +1569,43 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1550
1569
|
$xeTable.checkScrolling();
|
|
1551
1570
|
}
|
|
1552
1571
|
};
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
// }
|
|
1572
|
+
const calcCellAutoHeight = (rowRest, wrapperEl) => {
|
|
1573
|
+
const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);
|
|
1574
|
+
let colHeight = rowRest.height;
|
|
1575
|
+
for (let i = 0; i < cellElemList.length; i++) {
|
|
1576
|
+
const cellElem = cellElemList[i];
|
|
1577
|
+
const tdEl = cellElem.parentElement;
|
|
1578
|
+
const topBottomPadding = Math.ceil(_xeUtils.default.toNumber(tdEl.style.paddingTop) + _xeUtils.default.toNumber(tdEl.style.paddingBottom));
|
|
1579
|
+
const cellHeight = cellElem ? cellElem.clientHeight : 0;
|
|
1580
|
+
colHeight = Math.max(colHeight - topBottomPadding, Math.ceil(cellHeight));
|
|
1581
|
+
}
|
|
1582
|
+
return colHeight;
|
|
1583
|
+
};
|
|
1566
1584
|
const calcCellHeight = () => {
|
|
1567
|
-
const {
|
|
1568
|
-
showOverflow
|
|
1569
|
-
} = props;
|
|
1570
1585
|
const {
|
|
1571
1586
|
tableData,
|
|
1587
|
+
isAllOverflow,
|
|
1588
|
+
scrollYLoad,
|
|
1572
1589
|
scrollXLoad
|
|
1573
1590
|
} = reactData;
|
|
1574
1591
|
const {
|
|
1575
1592
|
fullAllDataRowIdData
|
|
1576
1593
|
} = internalData;
|
|
1594
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
1577
1595
|
const el = refElem.value;
|
|
1578
|
-
if (!
|
|
1579
|
-
|
|
1580
|
-
let paddingBottom = 0;
|
|
1581
|
-
let calcPadding = false;
|
|
1596
|
+
if (!isAllOverflow && scrollYLoad && el) {
|
|
1597
|
+
el.setAttribute('data-calc-row', 'Y');
|
|
1582
1598
|
tableData.forEach(row => {
|
|
1583
1599
|
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
1584
1600
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
for (let i = 0; i < cellList.length; i++) {
|
|
1589
|
-
const cellElem = cellList[i];
|
|
1590
|
-
const tdEl = cellElem.parentElement;
|
|
1591
|
-
if (!tdEl || !tdEl.clientWidth) {
|
|
1592
|
-
break;
|
|
1593
|
-
}
|
|
1594
|
-
if (!calcPadding) {
|
|
1595
|
-
paddingTop = _xeUtils.default.toNumber(getComputedStyle(tdEl).paddingTop);
|
|
1596
|
-
paddingBottom = _xeUtils.default.toNumber(getComputedStyle(tdEl).paddingBottom);
|
|
1597
|
-
calcPadding = true;
|
|
1598
|
-
}
|
|
1599
|
-
let cellHeight = paddingTop + paddingBottom;
|
|
1600
|
-
if (cellElem) {
|
|
1601
|
-
cellHeight += cellElem.clientHeight;
|
|
1602
|
-
}
|
|
1603
|
-
height = Math.max(height, cellHeight);
|
|
1604
|
-
}
|
|
1605
|
-
rowRest.height = scrollXLoad ? Math.max(rowRest.height, height) : height;
|
|
1601
|
+
if (rowRest) {
|
|
1602
|
+
const reHeight = calcCellAutoHeight(rowRest, el);
|
|
1603
|
+
rowRest.height = Math.max(defaultRowHeight, scrollXLoad ? Math.max(rowRest.height, reHeight) : reHeight);
|
|
1606
1604
|
}
|
|
1605
|
+
el.removeAttribute('data-calc-row');
|
|
1607
1606
|
});
|
|
1608
|
-
reactData.
|
|
1607
|
+
reactData.calcCellHeightFlag++;
|
|
1609
1608
|
}
|
|
1610
|
-
// updateCellOffset()
|
|
1611
1609
|
};
|
|
1612
1610
|
const getOrderField = column => {
|
|
1613
1611
|
const {
|
|
@@ -1634,6 +1632,43 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1634
1632
|
return cellValue;
|
|
1635
1633
|
};
|
|
1636
1634
|
};
|
|
1635
|
+
const updateAfterListIndex = () => {
|
|
1636
|
+
const {
|
|
1637
|
+
afterFullData,
|
|
1638
|
+
fullDataRowIdData,
|
|
1639
|
+
fullAllDataRowIdData
|
|
1640
|
+
} = internalData;
|
|
1641
|
+
const fullMaps = {};
|
|
1642
|
+
afterFullData.forEach((row, index) => {
|
|
1643
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
1644
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
1645
|
+
const seq = index + 1;
|
|
1646
|
+
if (rowRest) {
|
|
1647
|
+
rowRest.seq = seq;
|
|
1648
|
+
rowRest._index = index;
|
|
1649
|
+
} else {
|
|
1650
|
+
const rest = {
|
|
1651
|
+
row,
|
|
1652
|
+
rowid,
|
|
1653
|
+
seq,
|
|
1654
|
+
index: -1,
|
|
1655
|
+
$index: -1,
|
|
1656
|
+
_index: index,
|
|
1657
|
+
treeIndex: -1,
|
|
1658
|
+
items: [],
|
|
1659
|
+
parent: null,
|
|
1660
|
+
level: 0,
|
|
1661
|
+
height: 0,
|
|
1662
|
+
resizeHeight: 0,
|
|
1663
|
+
oTop: 0
|
|
1664
|
+
};
|
|
1665
|
+
fullAllDataRowIdData[rowid] = rest;
|
|
1666
|
+
fullDataRowIdData[rowid] = rest;
|
|
1667
|
+
}
|
|
1668
|
+
fullMaps[rowid] = row;
|
|
1669
|
+
});
|
|
1670
|
+
internalData.afterFullRowMaps = fullMaps;
|
|
1671
|
+
};
|
|
1637
1672
|
/**
|
|
1638
1673
|
* 预编译
|
|
1639
1674
|
* 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
|
|
@@ -1643,12 +1678,14 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1643
1678
|
treeConfig
|
|
1644
1679
|
} = props;
|
|
1645
1680
|
const {
|
|
1646
|
-
afterFullData,
|
|
1647
1681
|
fullDataRowIdData,
|
|
1648
1682
|
fullAllDataRowIdData,
|
|
1649
1683
|
afterTreeFullData
|
|
1650
1684
|
} = internalData;
|
|
1651
1685
|
const treeOpts = computeTreeOpts.value;
|
|
1686
|
+
const {
|
|
1687
|
+
transform
|
|
1688
|
+
} = treeOpts;
|
|
1652
1689
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
1653
1690
|
const fullMaps = {};
|
|
1654
1691
|
if (treeConfig) {
|
|
@@ -1658,7 +1695,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1658
1695
|
const seq = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
|
|
1659
1696
|
if (rowRest) {
|
|
1660
1697
|
rowRest.seq = seq;
|
|
1661
|
-
rowRest.
|
|
1698
|
+
rowRest.treeIndex = index;
|
|
1662
1699
|
} else {
|
|
1663
1700
|
const rest = {
|
|
1664
1701
|
row,
|
|
@@ -1667,10 +1704,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1667
1704
|
index: -1,
|
|
1668
1705
|
$index: -1,
|
|
1669
1706
|
_index: -1,
|
|
1707
|
+
treeIndex: -1,
|
|
1670
1708
|
items: [],
|
|
1671
1709
|
parent: null,
|
|
1672
1710
|
level: 0,
|
|
1673
1711
|
height: 0,
|
|
1712
|
+
resizeHeight: 0,
|
|
1674
1713
|
oTop: 0
|
|
1675
1714
|
};
|
|
1676
1715
|
fullAllDataRowIdData[rowid] = rest;
|
|
@@ -1678,37 +1717,13 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1678
1717
|
}
|
|
1679
1718
|
fullMaps[rowid] = row;
|
|
1680
1719
|
}, {
|
|
1681
|
-
children:
|
|
1720
|
+
children: transform ? treeOpts.mapChildrenField : childrenField
|
|
1682
1721
|
});
|
|
1722
|
+
internalData.afterFullRowMaps = fullMaps;
|
|
1723
|
+
updateAfterListIndex();
|
|
1683
1724
|
} else {
|
|
1684
|
-
|
|
1685
|
-
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
1686
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
1687
|
-
const seq = index + 1;
|
|
1688
|
-
if (rowRest) {
|
|
1689
|
-
rowRest.seq = seq;
|
|
1690
|
-
rowRest._index = index;
|
|
1691
|
-
} else {
|
|
1692
|
-
const rest = {
|
|
1693
|
-
row,
|
|
1694
|
-
rowid,
|
|
1695
|
-
seq,
|
|
1696
|
-
index: -1,
|
|
1697
|
-
$index: -1,
|
|
1698
|
-
_index: index,
|
|
1699
|
-
items: [],
|
|
1700
|
-
parent: null,
|
|
1701
|
-
level: 0,
|
|
1702
|
-
height: 0,
|
|
1703
|
-
oTop: 0
|
|
1704
|
-
};
|
|
1705
|
-
fullAllDataRowIdData[rowid] = rest;
|
|
1706
|
-
fullDataRowIdData[rowid] = rest;
|
|
1707
|
-
}
|
|
1708
|
-
fullMaps[rowid] = row;
|
|
1709
|
-
});
|
|
1725
|
+
updateAfterListIndex();
|
|
1710
1726
|
}
|
|
1711
|
-
internalData.afterFullRowMaps = fullMaps;
|
|
1712
1727
|
};
|
|
1713
1728
|
/**
|
|
1714
1729
|
* 如果为虚拟树,将树结构拍平
|
|
@@ -1964,7 +1979,6 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1964
1979
|
const updateStyle = () => {
|
|
1965
1980
|
const {
|
|
1966
1981
|
border,
|
|
1967
|
-
showOverflow: allColumnOverflow,
|
|
1968
1982
|
showHeaderOverflow: allColumnHeaderOverflow,
|
|
1969
1983
|
showFooterOverflow: allColumnFooterOverflow,
|
|
1970
1984
|
mouseConfig,
|
|
@@ -1977,7 +1991,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
1977
1991
|
tableColumn,
|
|
1978
1992
|
scrollXLoad,
|
|
1979
1993
|
scrollYLoad,
|
|
1994
|
+
overflowX,
|
|
1980
1995
|
scrollbarWidth,
|
|
1996
|
+
overflowY,
|
|
1981
1997
|
scrollbarHeight,
|
|
1982
1998
|
columnStore,
|
|
1983
1999
|
editStore,
|
|
@@ -2001,6 +2017,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
2001
2017
|
return;
|
|
2002
2018
|
}
|
|
2003
2019
|
const containerList = ['main', 'left', 'right'];
|
|
2020
|
+
const osbWidth = overflowY ? scrollbarWidth : 0;
|
|
2021
|
+
const osbHeight = overflowX ? scrollbarHeight : 0;
|
|
2004
2022
|
const emptyPlaceholderElem = refEmptyPlaceholder.value;
|
|
2005
2023
|
const cellOffsetWidth = computeCellOffsetWidth.value;
|
|
2006
2024
|
const mouseOpts = computeMouseOpts.value;
|
|
@@ -2008,16 +2026,16 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
2008
2026
|
const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
|
|
2009
2027
|
if (emptyPlaceholderElem) {
|
|
2010
2028
|
emptyPlaceholderElem.style.top = `${headerHeight}px`;
|
|
2011
|
-
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight -
|
|
2029
|
+
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : '';
|
|
2012
2030
|
}
|
|
2013
2031
|
let bodyHeight = 0;
|
|
2014
2032
|
let bodyMaxHeight = 0;
|
|
2015
|
-
const bodyMinHeight = customMinHeight - headerHeight - footerHeight -
|
|
2033
|
+
const bodyMinHeight = customMinHeight - headerHeight - footerHeight - osbHeight;
|
|
2016
2034
|
if (customMaxHeight) {
|
|
2017
|
-
bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight -
|
|
2035
|
+
bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - osbHeight);
|
|
2018
2036
|
}
|
|
2019
2037
|
if (customHeight) {
|
|
2020
|
-
bodyHeight = customHeight - headerHeight - footerHeight -
|
|
2038
|
+
bodyHeight = customHeight - headerHeight - footerHeight - osbHeight;
|
|
2021
2039
|
}
|
|
2022
2040
|
if (!bodyHeight) {
|
|
2023
2041
|
if (bodyTableElem) {
|
|
@@ -2030,35 +2048,42 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
2030
2048
|
}
|
|
2031
2049
|
bodyHeight = Math.max(bodyMinHeight, bodyHeight);
|
|
2032
2050
|
}
|
|
2051
|
+
const xLeftCornerEl = refScrollXLeftCornerElem.value;
|
|
2052
|
+
const xRightCornerEl = refScrollXRightCornerElem.value;
|
|
2053
|
+
const scrollbarXToTop = computeScrollbarXToTop.value;
|
|
2033
2054
|
const scrollXVirtualEl = refScrollXVirtualElem.value;
|
|
2034
2055
|
if (scrollXVirtualEl) {
|
|
2035
|
-
scrollXVirtualEl.style.height = `${
|
|
2036
|
-
scrollXVirtualEl.style.visibility =
|
|
2056
|
+
scrollXVirtualEl.style.height = `${osbHeight}px`;
|
|
2057
|
+
scrollXVirtualEl.style.visibility = overflowX ? 'visible' : 'hidden';
|
|
2037
2058
|
}
|
|
2038
|
-
const
|
|
2039
|
-
if (
|
|
2040
|
-
|
|
2059
|
+
const xWrapperEl = refScrollXWrapperElem.value;
|
|
2060
|
+
if (xWrapperEl) {
|
|
2061
|
+
xWrapperEl.style.left = scrollbarXToTop ? `${osbWidth}px` : '';
|
|
2062
|
+
xWrapperEl.style.width = `${el.clientWidth - osbWidth}px`;
|
|
2063
|
+
}
|
|
2064
|
+
if (xLeftCornerEl) {
|
|
2065
|
+
xLeftCornerEl.style.width = scrollbarXToTop ? `${osbWidth}px` : '';
|
|
2066
|
+
xLeftCornerEl.style.display = scrollbarXToTop ? osbWidth && osbHeight ? 'block' : '' : '';
|
|
2041
2067
|
}
|
|
2042
|
-
const xRightCornerEl = refScrollXRightCornerElem.value;
|
|
2043
2068
|
if (xRightCornerEl) {
|
|
2044
|
-
xRightCornerEl.style.width = `${
|
|
2045
|
-
xRightCornerEl.style.display =
|
|
2069
|
+
xRightCornerEl.style.width = scrollbarXToTop ? '' : `${osbWidth}px`;
|
|
2070
|
+
xRightCornerEl.style.display = scrollbarXToTop ? '' : osbWidth && osbHeight ? 'block' : '';
|
|
2046
2071
|
}
|
|
2047
2072
|
const scrollYVirtualEl = refScrollYVirtualElem.value;
|
|
2048
2073
|
if (scrollYVirtualEl) {
|
|
2049
|
-
scrollYVirtualEl.style.width = `${
|
|
2074
|
+
scrollYVirtualEl.style.width = `${osbWidth}px`;
|
|
2050
2075
|
scrollYVirtualEl.style.height = `${bodyHeight + headerHeight + footerHeight}px`;
|
|
2051
|
-
scrollYVirtualEl.style.visibility =
|
|
2076
|
+
scrollYVirtualEl.style.visibility = overflowY ? 'visible' : 'hidden';
|
|
2052
2077
|
}
|
|
2053
2078
|
const yTopCornerEl = refScrollYTopCornerElem.value;
|
|
2054
2079
|
if (yTopCornerEl) {
|
|
2055
2080
|
yTopCornerEl.style.height = `${headerHeight}px`;
|
|
2056
2081
|
yTopCornerEl.style.display = headerHeight ? 'block' : '';
|
|
2057
2082
|
}
|
|
2058
|
-
const
|
|
2059
|
-
if (
|
|
2060
|
-
|
|
2061
|
-
|
|
2083
|
+
const yWrapperEl = refScrollYWrapperElem.value;
|
|
2084
|
+
if (yWrapperEl) {
|
|
2085
|
+
yWrapperEl.style.height = `${bodyHeight}px`;
|
|
2086
|
+
yWrapperEl.style.top = `${headerHeight}px`;
|
|
2062
2087
|
}
|
|
2063
2088
|
const yBottomCornerEl = refScrollYBottomCornerElem.value;
|
|
2064
2089
|
if (yBottomCornerEl) {
|
|
@@ -2167,14 +2192,14 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
2167
2192
|
if (wrapperElem) {
|
|
2168
2193
|
wrapperElem.style.top = `${headerHeight}px`;
|
|
2169
2194
|
}
|
|
2170
|
-
fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : tableHeight + headerHeight + footerHeight +
|
|
2195
|
+
fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : tableHeight + headerHeight + footerHeight + osbHeight}px`;
|
|
2171
2196
|
fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`;
|
|
2172
2197
|
}
|
|
2173
2198
|
let tWidth = tableWidth;
|
|
2174
2199
|
let renderColumnList = tableColumn;
|
|
2175
2200
|
let isOptimizeMode = false;
|
|
2176
2201
|
// 如果是使用优化模式
|
|
2177
|
-
if (scrollXLoad || scrollYLoad ||
|
|
2202
|
+
if (scrollXLoad || scrollYLoad || isAllOverflow) {
|
|
2178
2203
|
if (expandColumn || spanMethod || footerSpanMethod) {
|
|
2179
2204
|
// 如果不支持优化模式
|
|
2180
2205
|
} else {
|
|
@@ -2196,7 +2221,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
2196
2221
|
if (tableElem) {
|
|
2197
2222
|
tableElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
2198
2223
|
// 兼容性处理
|
|
2199
|
-
tableElem.style.paddingRight =
|
|
2224
|
+
tableElem.style.paddingRight = osbWidth && fixedType && (_dom.browse['-moz'] || _dom.browse.safari) ? `${osbWidth}px` : '';
|
|
2200
2225
|
}
|
|
2201
2226
|
const emptyBlockElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-emptyBlock`]);
|
|
2202
2227
|
if (emptyBlockElem) {
|
|
@@ -2231,7 +2256,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
2231
2256
|
// 如果是固定列
|
|
2232
2257
|
if (fixedWrapperElem) {
|
|
2233
2258
|
if (wrapperElem) {
|
|
2234
|
-
wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight -
|
|
2259
|
+
wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight - osbHeight : tableHeight + headerHeight}px`;
|
|
2235
2260
|
}
|
|
2236
2261
|
}
|
|
2237
2262
|
}
|
|
@@ -2258,7 +2283,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
2258
2283
|
} else if (layout === 'footer') {
|
|
2259
2284
|
cellOverflow = _xeUtils.default.isUndefined(showFooterOverflow) || _xeUtils.default.isNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
|
|
2260
2285
|
} else {
|
|
2261
|
-
cellOverflow = _xeUtils.default.isUndefined(showOverflow) || _xeUtils.default.isNull(showOverflow) ?
|
|
2286
|
+
cellOverflow = _xeUtils.default.isUndefined(showOverflow) || _xeUtils.default.isNull(showOverflow) ? isAllOverflow : showOverflow;
|
|
2262
2287
|
}
|
|
2263
2288
|
const showEllipsis = cellOverflow === 'ellipsis';
|
|
2264
2289
|
const showTitle = cellOverflow === 'title';
|
|
@@ -2881,16 +2906,16 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
2881
2906
|
scrollXStore,
|
|
2882
2907
|
scrollYStore
|
|
2883
2908
|
} = internalData;
|
|
2884
|
-
const
|
|
2885
|
-
const
|
|
2909
|
+
const virtualYOpts = computeVirtualYOpts.value;
|
|
2910
|
+
const virtualXOpts = computeVirtualXOpts.value;
|
|
2886
2911
|
// 计算 X 逻辑
|
|
2887
2912
|
if (scrollXLoad) {
|
|
2888
2913
|
const {
|
|
2889
2914
|
toVisibleIndex: toXVisibleIndex,
|
|
2890
2915
|
visibleSize: visibleXSize
|
|
2891
2916
|
} = handleVirtualXVisible();
|
|
2892
|
-
const offsetXSize = Math.max(0,
|
|
2893
|
-
scrollXStore.preloadSize =
|
|
2917
|
+
const offsetXSize = Math.max(0, virtualXOpts.oSize ? _xeUtils.default.toNumber(virtualXOpts.oSize) : 0);
|
|
2918
|
+
scrollXStore.preloadSize = _xeUtils.default.toNumber(virtualXOpts.preSize);
|
|
2894
2919
|
scrollXStore.offsetSize = offsetXSize;
|
|
2895
2920
|
scrollXStore.visibleSize = visibleXSize;
|
|
2896
2921
|
scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
|
|
@@ -2902,7 +2927,6 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
2902
2927
|
} else {
|
|
2903
2928
|
$xeTable.updateScrollXSpace();
|
|
2904
2929
|
}
|
|
2905
|
-
calcCellHeight();
|
|
2906
2930
|
// 计算 Y 逻辑
|
|
2907
2931
|
const rowHeight = computeRowHeight();
|
|
2908
2932
|
scrollYStore.rowHeight = rowHeight;
|
|
@@ -2912,8 +2936,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
2912
2936
|
visibleSize: visibleYSize
|
|
2913
2937
|
} = handleVirtualYVisible();
|
|
2914
2938
|
if (scrollYLoad) {
|
|
2915
|
-
const offsetYSize = Math.max(0,
|
|
2916
|
-
scrollYStore.preloadSize =
|
|
2939
|
+
const offsetYSize = Math.max(0, virtualYOpts.oSize ? _xeUtils.default.toNumber(virtualYOpts.oSize) : 0);
|
|
2940
|
+
scrollYStore.preloadSize = _xeUtils.default.toNumber(virtualYOpts.preSize);
|
|
2917
2941
|
scrollYStore.offsetSize = offsetYSize;
|
|
2918
2942
|
scrollYStore.visibleSize = visibleYSize;
|
|
2919
2943
|
scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
|
|
@@ -2938,12 +2962,13 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
2938
2962
|
}
|
|
2939
2963
|
calcCellWidth();
|
|
2940
2964
|
autoCellWidth();
|
|
2965
|
+
updateStyle();
|
|
2941
2966
|
return computeScrollLoad().then(() => {
|
|
2942
2967
|
if (reFull === true) {
|
|
2943
2968
|
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
2944
|
-
calcCellHeight();
|
|
2945
2969
|
calcCellWidth();
|
|
2946
2970
|
autoCellWidth();
|
|
2971
|
+
updateStyle();
|
|
2947
2972
|
return computeScrollLoad();
|
|
2948
2973
|
}
|
|
2949
2974
|
});
|
|
@@ -2952,11 +2977,10 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
2952
2977
|
* 加载表格数据
|
|
2953
2978
|
* @param {Array} datas 数据
|
|
2954
2979
|
*/
|
|
2955
|
-
const loadTableData = datas => {
|
|
2980
|
+
const loadTableData = (datas, isReset) => {
|
|
2956
2981
|
const {
|
|
2957
2982
|
keepSource,
|
|
2958
|
-
treeConfig
|
|
2959
|
-
showOverflow
|
|
2983
|
+
treeConfig
|
|
2960
2984
|
} = props;
|
|
2961
2985
|
const {
|
|
2962
2986
|
editStore,
|
|
@@ -2969,7 +2993,6 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
2969
2993
|
lastScrollTop
|
|
2970
2994
|
} = internalData;
|
|
2971
2995
|
const treeOpts = computeTreeOpts.value;
|
|
2972
|
-
const rowOpts = computeRowOpts.value;
|
|
2973
2996
|
const {
|
|
2974
2997
|
transform
|
|
2975
2998
|
} = treeOpts;
|
|
@@ -3025,34 +3048,20 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3025
3048
|
internalData.tableFullData = fullData;
|
|
3026
3049
|
internalData.tableFullTreeData = treeData;
|
|
3027
3050
|
// 缓存数据
|
|
3028
|
-
tablePrivateMethods.cacheRowMap(true);
|
|
3051
|
+
tablePrivateMethods.cacheRowMap(true, isReset);
|
|
3029
3052
|
// 原始数据
|
|
3030
3053
|
internalData.tableSynchData = datas;
|
|
3054
|
+
if (isReset) {
|
|
3055
|
+
internalData.isResizeCellHeight = false;
|
|
3056
|
+
reactData.rowExpandedMaps = {};
|
|
3057
|
+
reactData.rowExpandLazyLoadedMaps = {};
|
|
3058
|
+
reactData.treeExpandedMaps = {};
|
|
3059
|
+
reactData.treeExpandLazyLoadedMaps = {};
|
|
3060
|
+
}
|
|
3031
3061
|
// 克隆原数据,用于显示编辑状态,与编辑值做对比
|
|
3032
3062
|
if (keepSource) {
|
|
3033
3063
|
tablePrivateMethods.cacheSourceMap(fullData);
|
|
3034
3064
|
}
|
|
3035
|
-
if (sYLoad) {
|
|
3036
|
-
if (showOverflow) {
|
|
3037
|
-
if (!rowOpts.height) {
|
|
3038
|
-
const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false);
|
|
3039
|
-
if (errColumn) {
|
|
3040
|
-
(0, _log.errLog)('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true']);
|
|
3041
|
-
}
|
|
3042
|
-
}
|
|
3043
|
-
}
|
|
3044
|
-
if (process.env.NODE_ENV === 'development') {
|
|
3045
|
-
if (!(props.height || props.maxHeight)) {
|
|
3046
|
-
(0, _log.errLog)('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
|
|
3047
|
-
}
|
|
3048
|
-
// if (!props.showOverflow) {
|
|
3049
|
-
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
3050
|
-
// }
|
|
3051
|
-
if (props.spanMethod) {
|
|
3052
|
-
(0, _log.warnLog)('vxe.error.scrollErrProp', ['table.span-method']);
|
|
3053
|
-
}
|
|
3054
|
-
}
|
|
3055
|
-
}
|
|
3056
3065
|
if ($xeTable.clearCellAreas && props.mouseConfig) {
|
|
3057
3066
|
$xeTable.clearCellAreas();
|
|
3058
3067
|
$xeTable.clearCopyCellArea();
|
|
@@ -3071,6 +3080,27 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3071
3080
|
if (sYLoad) {
|
|
3072
3081
|
scrollYStore.endIndex = scrollYStore.visibleSize;
|
|
3073
3082
|
}
|
|
3083
|
+
if (sYLoad) {
|
|
3084
|
+
// if (showOverflow) {
|
|
3085
|
+
// if (!rowOpts.height) {
|
|
3086
|
+
// const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
|
|
3087
|
+
// if (errColumn) {
|
|
3088
|
+
// errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
|
|
3089
|
+
// }
|
|
3090
|
+
// }
|
|
3091
|
+
// }
|
|
3092
|
+
if (process.env.NODE_ENV === 'development') {
|
|
3093
|
+
if (!(props.height || props.maxHeight)) {
|
|
3094
|
+
(0, _log.errLog)('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
|
|
3095
|
+
}
|
|
3096
|
+
// if (!props.showOverflow) {
|
|
3097
|
+
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
3098
|
+
// }
|
|
3099
|
+
if (props.spanMethod) {
|
|
3100
|
+
(0, _log.warnLog)('vxe.error.scrollErrProp', ['table.span-method']);
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
}
|
|
3074
3104
|
handleReserveStatus();
|
|
3075
3105
|
tablePrivateMethods.checkSelectionStatus();
|
|
3076
3106
|
return new Promise(resolve => {
|
|
@@ -3086,6 +3116,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3086
3116
|
if (sYOpts.scrollToTopOnChange) {
|
|
3087
3117
|
targetScrollTop = 0;
|
|
3088
3118
|
}
|
|
3119
|
+
calcCellHeight();
|
|
3089
3120
|
// 是否变更虚拟滚动
|
|
3090
3121
|
if (oldScrollYLoad === sYLoad) {
|
|
3091
3122
|
(0, _util.restoreScrollLocation)($xeTable, targetScrollLeft, targetScrollTop).then(() => {
|
|
@@ -3493,8 +3524,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3493
3524
|
handleVirtualTreeToList();
|
|
3494
3525
|
tablePrivateMethods.handleTableData();
|
|
3495
3526
|
updateAfterDataIndex();
|
|
3527
|
+
return (0, _vue.nextTick)();
|
|
3496
3528
|
}).then(() => {
|
|
3497
|
-
return tableMethods.recalculate();
|
|
3529
|
+
return tableMethods.recalculate(true);
|
|
3498
3530
|
}).then(() => {
|
|
3499
3531
|
setTimeout(() => {
|
|
3500
3532
|
tableMethods.updateCellAreas();
|
|
@@ -3515,12 +3547,10 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3515
3547
|
/**
|
|
3516
3548
|
* 纵向 Y 可视渲染处理
|
|
3517
3549
|
*/
|
|
3518
|
-
const loadScrollYData =
|
|
3519
|
-
const {
|
|
3520
|
-
showOverflow
|
|
3521
|
-
} = props;
|
|
3550
|
+
const loadScrollYData = scrollTop => {
|
|
3522
3551
|
const {
|
|
3523
|
-
mergeList
|
|
3552
|
+
mergeList,
|
|
3553
|
+
isAllOverflow
|
|
3524
3554
|
} = reactData;
|
|
3525
3555
|
const {
|
|
3526
3556
|
scrollYStore
|
|
@@ -3531,11 +3561,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3531
3561
|
endIndex,
|
|
3532
3562
|
offsetSize
|
|
3533
3563
|
} = scrollYStore;
|
|
3534
|
-
const autoOffsetYSize =
|
|
3564
|
+
const autoOffsetYSize = isAllOverflow ? offsetSize : offsetSize + 1;
|
|
3535
3565
|
const {
|
|
3536
3566
|
toVisibleIndex,
|
|
3537
3567
|
visibleSize
|
|
3538
|
-
} = handleVirtualYVisible();
|
|
3568
|
+
} = handleVirtualYVisible(scrollTop);
|
|
3539
3569
|
const offsetItem = {
|
|
3540
3570
|
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
3541
3571
|
endIndex: toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize
|
|
@@ -3593,7 +3623,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3593
3623
|
const {
|
|
3594
3624
|
visibleSize
|
|
3595
3625
|
} = scrollXStore;
|
|
3596
|
-
const fpsTime = Math.max(5, Math.min(
|
|
3626
|
+
const fpsTime = Math.max(5, Math.min(10, Math.floor(visibleSize / 3)));
|
|
3597
3627
|
if (lxTimeout) {
|
|
3598
3628
|
clearTimeout(lxTimeout);
|
|
3599
3629
|
}
|
|
@@ -3608,9 +3638,6 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3608
3638
|
}, fpsTime);
|
|
3609
3639
|
};
|
|
3610
3640
|
const lazyScrollYData = () => {
|
|
3611
|
-
const {
|
|
3612
|
-
showOverflow
|
|
3613
|
-
} = props;
|
|
3614
3641
|
const {
|
|
3615
3642
|
lyTimeout,
|
|
3616
3643
|
lyRunTime,
|
|
@@ -3619,7 +3646,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3619
3646
|
const {
|
|
3620
3647
|
visibleSize
|
|
3621
3648
|
} = scrollYStore;
|
|
3622
|
-
const fpsTime =
|
|
3649
|
+
const fpsTime = Math.floor(Math.max(4, Math.min(10, visibleSize / 3)));
|
|
3623
3650
|
if (lyTimeout) {
|
|
3624
3651
|
clearTimeout(lyTimeout);
|
|
3625
3652
|
}
|
|
@@ -3633,86 +3660,6 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3633
3660
|
loadScrollYData();
|
|
3634
3661
|
}, fpsTime);
|
|
3635
3662
|
};
|
|
3636
|
-
const scrollXEvent = evnt => {
|
|
3637
|
-
const {
|
|
3638
|
-
elemStore,
|
|
3639
|
-
inWheelScroll,
|
|
3640
|
-
lastScrollTop,
|
|
3641
|
-
inHeaderScroll,
|
|
3642
|
-
inBodyScroll,
|
|
3643
|
-
inFooterScroll
|
|
3644
|
-
} = internalData;
|
|
3645
|
-
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
3646
|
-
return;
|
|
3647
|
-
}
|
|
3648
|
-
if (inWheelScroll) {
|
|
3649
|
-
return;
|
|
3650
|
-
}
|
|
3651
|
-
const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
|
|
3652
|
-
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
3653
|
-
const footerScrollElem = (0, _util.getRefElem)(elemStore['main-footer-scroll']);
|
|
3654
|
-
const yHandleEl = refScrollYHandleElem.value;
|
|
3655
|
-
const wrapperEl = evnt.currentTarget;
|
|
3656
|
-
const {
|
|
3657
|
-
scrollLeft
|
|
3658
|
-
} = wrapperEl;
|
|
3659
|
-
const yBodyEl = yHandleEl || bodyScrollElem;
|
|
3660
|
-
let scrollTop = 0;
|
|
3661
|
-
if (yBodyEl) {
|
|
3662
|
-
scrollTop = yBodyEl.scrollTop;
|
|
3663
|
-
}
|
|
3664
|
-
const isRollX = true;
|
|
3665
|
-
const isRollY = scrollTop !== lastScrollTop;
|
|
3666
|
-
internalData.inVirtualScroll = true;
|
|
3667
|
-
(0, _dom.setScrollLeft)(bodyScrollElem, scrollLeft);
|
|
3668
|
-
(0, _dom.setScrollLeft)(headerScrollElem, scrollLeft);
|
|
3669
|
-
(0, _dom.setScrollLeft)(footerScrollElem, scrollLeft);
|
|
3670
|
-
$xeTable.triggerScrollXEvent(evnt);
|
|
3671
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
3672
|
-
type: 'table',
|
|
3673
|
-
fixed: ''
|
|
3674
|
-
});
|
|
3675
|
-
};
|
|
3676
|
-
const scrollYEvent = evnt => {
|
|
3677
|
-
const {
|
|
3678
|
-
elemStore,
|
|
3679
|
-
inWheelScroll,
|
|
3680
|
-
lastScrollLeft,
|
|
3681
|
-
inHeaderScroll,
|
|
3682
|
-
inBodyScroll,
|
|
3683
|
-
inFooterScroll
|
|
3684
|
-
} = internalData;
|
|
3685
|
-
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
3686
|
-
return;
|
|
3687
|
-
}
|
|
3688
|
-
if (inWheelScroll) {
|
|
3689
|
-
return;
|
|
3690
|
-
}
|
|
3691
|
-
const leftScrollElem = (0, _util.getRefElem)(elemStore['left-body-scroll']);
|
|
3692
|
-
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
3693
|
-
const rightScrollElem = (0, _util.getRefElem)(elemStore['right-body-scroll']);
|
|
3694
|
-
const xHandleEl = refScrollXHandleElem.value;
|
|
3695
|
-
const wrapperEl = evnt.currentTarget;
|
|
3696
|
-
const {
|
|
3697
|
-
scrollTop
|
|
3698
|
-
} = wrapperEl;
|
|
3699
|
-
const xBodyEl = xHandleEl || bodyScrollElem;
|
|
3700
|
-
let scrollLeft = 0;
|
|
3701
|
-
if (xBodyEl) {
|
|
3702
|
-
scrollLeft = xBodyEl.scrollLeft;
|
|
3703
|
-
}
|
|
3704
|
-
const isRollX = scrollLeft !== lastScrollLeft;
|
|
3705
|
-
const isRollY = true;
|
|
3706
|
-
internalData.inVirtualScroll = true;
|
|
3707
|
-
(0, _dom.setScrollTop)(bodyScrollElem, scrollTop);
|
|
3708
|
-
(0, _dom.setScrollTop)(leftScrollElem, scrollTop);
|
|
3709
|
-
(0, _dom.setScrollTop)(rightScrollElem, scrollTop);
|
|
3710
|
-
$xeTable.triggerScrollYEvent(evnt);
|
|
3711
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
3712
|
-
type: 'table',
|
|
3713
|
-
fixed: ''
|
|
3714
|
-
});
|
|
3715
|
-
};
|
|
3716
3663
|
const checkLastSyncScroll = (isRollX, isRollY) => {
|
|
3717
3664
|
const {
|
|
3718
3665
|
scrollXLoad,
|
|
@@ -3727,27 +3674,63 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3727
3674
|
internalData.lcsTimeout = setTimeout(() => {
|
|
3728
3675
|
internalData.lcsRunTime = Date.now();
|
|
3729
3676
|
internalData.lcsTimeout = undefined;
|
|
3677
|
+
internalData.intoRunScroll = false;
|
|
3730
3678
|
internalData.inVirtualScroll = false;
|
|
3731
3679
|
internalData.inWheelScroll = false;
|
|
3732
3680
|
internalData.inHeaderScroll = false;
|
|
3733
3681
|
internalData.inBodyScroll = false;
|
|
3734
3682
|
internalData.inFooterScroll = false;
|
|
3735
3683
|
internalData.scrollRenderType = '';
|
|
3684
|
+
calcCellHeight();
|
|
3736
3685
|
if (isRollX && scrollXLoad) {
|
|
3737
|
-
$xeTable.updateScrollXData()
|
|
3738
|
-
calcCellHeight();
|
|
3739
|
-
loadScrollXData();
|
|
3740
|
-
});
|
|
3686
|
+
$xeTable.updateScrollXData();
|
|
3741
3687
|
}
|
|
3742
3688
|
if (isRollY && scrollYLoad) {
|
|
3743
3689
|
$xeTable.updateScrollYData().then(() => {
|
|
3744
3690
|
calcCellHeight();
|
|
3745
|
-
|
|
3691
|
+
$xeTable.updateScrollYSpace();
|
|
3746
3692
|
});
|
|
3747
3693
|
}
|
|
3748
3694
|
$xeTable.updateCellAreas();
|
|
3749
3695
|
}, 200);
|
|
3750
3696
|
};
|
|
3697
|
+
const getWheelSpeed = lastScrollTime => {
|
|
3698
|
+
let multiple = 1;
|
|
3699
|
+
const currTime = Date.now();
|
|
3700
|
+
if (lastScrollTime + 25 > currTime) {
|
|
3701
|
+
multiple = 1.18;
|
|
3702
|
+
} else if (lastScrollTime + 30 > currTime) {
|
|
3703
|
+
multiple = 1.15;
|
|
3704
|
+
} else if (lastScrollTime + 40 > currTime) {
|
|
3705
|
+
multiple = 1.12;
|
|
3706
|
+
} else if (lastScrollTime + 55 > currTime) {
|
|
3707
|
+
multiple = 1.09;
|
|
3708
|
+
} else if (lastScrollTime + 75 > currTime) {
|
|
3709
|
+
multiple = 1.06;
|
|
3710
|
+
} else if (lastScrollTime + 100 > currTime) {
|
|
3711
|
+
multiple = 1.03;
|
|
3712
|
+
}
|
|
3713
|
+
return multiple;
|
|
3714
|
+
};
|
|
3715
|
+
const wheelScrollTo = (diffNum, cb) => {
|
|
3716
|
+
const duration = Math.abs(diffNum);
|
|
3717
|
+
const startTime = performance.now();
|
|
3718
|
+
let countTop = 0;
|
|
3719
|
+
const step = timestamp => {
|
|
3720
|
+
let progress = (timestamp - startTime) / duration;
|
|
3721
|
+
if (progress > 1) {
|
|
3722
|
+
progress = 1;
|
|
3723
|
+
}
|
|
3724
|
+
const easedProgress = Math.pow(progress, 2);
|
|
3725
|
+
const offsetTop = Math.floor(diffNum * easedProgress) - countTop;
|
|
3726
|
+
countTop += offsetTop;
|
|
3727
|
+
cb(offsetTop);
|
|
3728
|
+
if (progress < 1) {
|
|
3729
|
+
requestAnimationFrame(step);
|
|
3730
|
+
}
|
|
3731
|
+
};
|
|
3732
|
+
requestAnimationFrame(step);
|
|
3733
|
+
};
|
|
3751
3734
|
const dispatchEvent = (type, params, evnt) => {
|
|
3752
3735
|
emit(type, createEvent(evnt, {
|
|
3753
3736
|
$table: $xeTable,
|
|
@@ -3764,6 +3747,31 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3764
3747
|
}
|
|
3765
3748
|
return (0, _vue.nextTick)();
|
|
3766
3749
|
};
|
|
3750
|
+
const handleUpdateResize = () => {
|
|
3751
|
+
const el = refElem.value;
|
|
3752
|
+
if (el && el.clientWidth && el.clientHeight) {
|
|
3753
|
+
tableMethods.recalculate();
|
|
3754
|
+
}
|
|
3755
|
+
};
|
|
3756
|
+
const handleUpdateColResize = (evnt, params) => {
|
|
3757
|
+
$xeTable.analyColumnWidth();
|
|
3758
|
+
$xeTable.recalculate(true).then(() => {
|
|
3759
|
+
$xeTable.saveCustomStore('update:width');
|
|
3760
|
+
$xeTable.updateCellAreas();
|
|
3761
|
+
$xeTable.dispatchEvent('column-resizable-change', params, evnt);
|
|
3762
|
+
// 已废弃 resizable-change
|
|
3763
|
+
$xeTable.dispatchEvent('resizable-change', params, evnt);
|
|
3764
|
+
setTimeout(() => $xeTable.recalculate(true), 300);
|
|
3765
|
+
});
|
|
3766
|
+
};
|
|
3767
|
+
const handleUpdateRowResize = (evnt, params) => {
|
|
3768
|
+
reactData.resizeHeightFlag++;
|
|
3769
|
+
$xeTable.recalculate(true).then(() => {
|
|
3770
|
+
$xeTable.updateCellAreas();
|
|
3771
|
+
$xeTable.dispatchEvent('row-resizable-change', params, evnt);
|
|
3772
|
+
setTimeout(() => $xeTable.recalculate(true), 300);
|
|
3773
|
+
});
|
|
3774
|
+
};
|
|
3767
3775
|
tableMethods = {
|
|
3768
3776
|
dispatchEvent,
|
|
3769
3777
|
/**
|
|
@@ -3821,7 +3829,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3821
3829
|
const {
|
|
3822
3830
|
initStatus
|
|
3823
3831
|
} = internalData;
|
|
3824
|
-
return loadTableData(datas).then(() => {
|
|
3832
|
+
return loadTableData(datas, false).then(() => {
|
|
3825
3833
|
internalData.inited = true;
|
|
3826
3834
|
internalData.initStatus = true;
|
|
3827
3835
|
if (!initStatus) {
|
|
@@ -3838,7 +3846,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3838
3846
|
return tableMethods.clearAll().then(() => {
|
|
3839
3847
|
internalData.inited = true;
|
|
3840
3848
|
internalData.initStatus = true;
|
|
3841
|
-
return loadTableData(datas);
|
|
3849
|
+
return loadTableData(datas, true);
|
|
3842
3850
|
}).then(() => {
|
|
3843
3851
|
handleLoadDefaults();
|
|
3844
3852
|
return tableMethods.recalculate();
|
|
@@ -3952,10 +3960,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3952
3960
|
index,
|
|
3953
3961
|
_index: -1,
|
|
3954
3962
|
$index: -1,
|
|
3963
|
+
treeIndex: -1,
|
|
3955
3964
|
items,
|
|
3956
3965
|
parent: parentRow,
|
|
3957
3966
|
level: parentLevel + nodes.length,
|
|
3958
3967
|
height: 0,
|
|
3968
|
+
resizeHeight: 0,
|
|
3959
3969
|
oTop: 0
|
|
3960
3970
|
};
|
|
3961
3971
|
fullDataRowIdData[rowid] = rest;
|
|
@@ -4196,29 +4206,32 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
4196
4206
|
return (0, _vue.nextTick)();
|
|
4197
4207
|
},
|
|
4198
4208
|
getCellElement(row, fieldOrColumn) {
|
|
4209
|
+
const {
|
|
4210
|
+
elemStore
|
|
4211
|
+
} = internalData;
|
|
4199
4212
|
const column = (0, _util.handleFieldOrColumn)($xeTable, fieldOrColumn);
|
|
4200
4213
|
if (!column) {
|
|
4201
4214
|
return null;
|
|
4202
4215
|
}
|
|
4203
4216
|
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
4204
|
-
const
|
|
4205
|
-
const
|
|
4206
|
-
const
|
|
4217
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
4218
|
+
const leftScrollElem = (0, _util.getRefElem)(elemStore['left-body-scroll']);
|
|
4219
|
+
const rightScrollElem = (0, _util.getRefElem)(elemStore['right-body-scroll']);
|
|
4207
4220
|
let bodyElem;
|
|
4208
4221
|
if (column) {
|
|
4209
4222
|
if (column.fixed) {
|
|
4210
4223
|
if (column.fixed === 'left') {
|
|
4211
|
-
if (
|
|
4212
|
-
bodyElem =
|
|
4224
|
+
if (leftScrollElem) {
|
|
4225
|
+
bodyElem = leftScrollElem;
|
|
4213
4226
|
}
|
|
4214
4227
|
} else {
|
|
4215
|
-
if (
|
|
4216
|
-
bodyElem =
|
|
4228
|
+
if (rightScrollElem) {
|
|
4229
|
+
bodyElem = rightScrollElem;
|
|
4217
4230
|
}
|
|
4218
4231
|
}
|
|
4219
4232
|
}
|
|
4220
4233
|
if (!bodyElem) {
|
|
4221
|
-
bodyElem =
|
|
4234
|
+
bodyElem = bodyScrollElem;
|
|
4222
4235
|
}
|
|
4223
4236
|
if (bodyElem) {
|
|
4224
4237
|
return bodyElem.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`);
|
|
@@ -4691,29 +4704,40 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
4691
4704
|
return (0, _vue.nextTick)();
|
|
4692
4705
|
},
|
|
4693
4706
|
setColumnWidth(fieldOrColumn, width) {
|
|
4707
|
+
const {
|
|
4708
|
+
elemStore
|
|
4709
|
+
} = internalData;
|
|
4694
4710
|
let status = false;
|
|
4695
4711
|
const cols = _xeUtils.default.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4712
|
+
let cWidth = _xeUtils.default.toInteger(width);
|
|
4713
|
+
if ((0, _dom.isScale)(width)) {
|
|
4714
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
4715
|
+
const bodyWidth = bodyScrollElem ? bodyScrollElem.clientWidth - 1 : 0;
|
|
4716
|
+
cWidth = Math.floor(cWidth * bodyWidth);
|
|
4717
|
+
}
|
|
4718
|
+
if (cWidth) {
|
|
4719
|
+
cols.forEach(item => {
|
|
4720
|
+
const column = (0, _util.handleFieldOrColumn)($xeTable, item);
|
|
4721
|
+
if (column) {
|
|
4722
|
+
column.resizeWidth = cWidth;
|
|
4723
|
+
if (!status) {
|
|
4724
|
+
status = true;
|
|
4725
|
+
}
|
|
4710
4726
|
}
|
|
4727
|
+
});
|
|
4728
|
+
if (status) {
|
|
4729
|
+
return $xeTable.refreshColumn().then(() => {
|
|
4730
|
+
return {
|
|
4731
|
+
status
|
|
4732
|
+
};
|
|
4733
|
+
});
|
|
4711
4734
|
}
|
|
4712
|
-
});
|
|
4713
|
-
if (status) {
|
|
4714
|
-
return tableMethods.refreshColumn();
|
|
4715
4735
|
}
|
|
4716
|
-
return (0, _vue.nextTick)()
|
|
4736
|
+
return (0, _vue.nextTick)().then(() => {
|
|
4737
|
+
return {
|
|
4738
|
+
status
|
|
4739
|
+
};
|
|
4740
|
+
});
|
|
4717
4741
|
},
|
|
4718
4742
|
getColumnWidth(fieldOrColumn) {
|
|
4719
4743
|
const column = (0, _util.handleFieldOrColumn)($xeTable, fieldOrColumn);
|
|
@@ -4746,14 +4770,114 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
4746
4770
|
return tableMethods.recalculate();
|
|
4747
4771
|
});
|
|
4748
4772
|
},
|
|
4749
|
-
|
|
4750
|
-
* 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
|
|
4751
|
-
*/
|
|
4752
|
-
refreshScroll() {
|
|
4773
|
+
setRowHeightConf(heightConf) {
|
|
4753
4774
|
const {
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4775
|
+
fullAllDataRowIdData
|
|
4776
|
+
} = internalData;
|
|
4777
|
+
let status = false;
|
|
4778
|
+
if (heightConf) {
|
|
4779
|
+
_xeUtils.default.each(heightConf, (height, rowid) => {
|
|
4780
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
4781
|
+
if (rowRest) {
|
|
4782
|
+
const rHeight = _xeUtils.default.toInteger(height);
|
|
4783
|
+
if (rHeight) {
|
|
4784
|
+
rowRest.resizeHeight = rHeight;
|
|
4785
|
+
if (!status) {
|
|
4786
|
+
status = true;
|
|
4787
|
+
}
|
|
4788
|
+
}
|
|
4789
|
+
}
|
|
4790
|
+
});
|
|
4791
|
+
if (status) {
|
|
4792
|
+
internalData.isResizeCellHeight = true;
|
|
4793
|
+
reactData.resizeHeightFlag++;
|
|
4794
|
+
}
|
|
4795
|
+
}
|
|
4796
|
+
return (0, _vue.nextTick)().then(() => {
|
|
4797
|
+
return {
|
|
4798
|
+
status
|
|
4799
|
+
};
|
|
4800
|
+
});
|
|
4801
|
+
},
|
|
4802
|
+
getRowHeightConf(isFull) {
|
|
4803
|
+
const {
|
|
4804
|
+
fullAllDataRowIdData,
|
|
4805
|
+
afterFullData
|
|
4806
|
+
} = internalData;
|
|
4807
|
+
const rowOpts = computeRowOpts.value;
|
|
4808
|
+
const cellOpts = computeCellOpts.value;
|
|
4809
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
4810
|
+
const rest = {};
|
|
4811
|
+
afterFullData.forEach(row => {
|
|
4812
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
4813
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
4814
|
+
if (rowRest) {
|
|
4815
|
+
const resizeHeight = rowRest.resizeHeight;
|
|
4816
|
+
if (resizeHeight || isFull) {
|
|
4817
|
+
const currCellHeight = resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
4818
|
+
rest[rowid] = currCellHeight;
|
|
4819
|
+
}
|
|
4820
|
+
}
|
|
4821
|
+
});
|
|
4822
|
+
return rest;
|
|
4823
|
+
},
|
|
4824
|
+
setRowHeight(rowOrId, height) {
|
|
4825
|
+
const {
|
|
4826
|
+
fullAllDataRowIdData
|
|
4827
|
+
} = internalData;
|
|
4828
|
+
let status = false;
|
|
4829
|
+
const rows = _xeUtils.default.isArray(rowOrId) ? rowOrId : [rowOrId];
|
|
4830
|
+
let rHeight = _xeUtils.default.toInteger(height);
|
|
4831
|
+
if ((0, _dom.isScale)(height)) {
|
|
4832
|
+
const tableBody = refTableBody.value;
|
|
4833
|
+
const bodyElem = tableBody ? tableBody.$el : null;
|
|
4834
|
+
const bodyHeight = bodyElem ? bodyElem.clientHeight - 1 : 0;
|
|
4835
|
+
rHeight = Math.floor(rHeight * bodyHeight);
|
|
4836
|
+
}
|
|
4837
|
+
if (rHeight) {
|
|
4838
|
+
rows.forEach(row => {
|
|
4839
|
+
const rowid = _xeUtils.default.isString(row) || _xeUtils.default.isNumber(row) ? row : (0, _util.getRowid)($xeTable, row);
|
|
4840
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
4841
|
+
if (rowRest) {
|
|
4842
|
+
rowRest.resizeHeight = rHeight;
|
|
4843
|
+
if (!status) {
|
|
4844
|
+
status = true;
|
|
4845
|
+
}
|
|
4846
|
+
}
|
|
4847
|
+
});
|
|
4848
|
+
if (status) {
|
|
4849
|
+
internalData.isResizeCellHeight = true;
|
|
4850
|
+
reactData.resizeHeightFlag++;
|
|
4851
|
+
}
|
|
4852
|
+
}
|
|
4853
|
+
return (0, _vue.nextTick)().then(() => {
|
|
4854
|
+
return {
|
|
4855
|
+
status
|
|
4856
|
+
};
|
|
4857
|
+
});
|
|
4858
|
+
},
|
|
4859
|
+
getRowHeight(rowOrId) {
|
|
4860
|
+
const {
|
|
4861
|
+
fullAllDataRowIdData
|
|
4862
|
+
} = internalData;
|
|
4863
|
+
const rowOpts = computeRowOpts.value;
|
|
4864
|
+
const cellOpts = computeCellOpts.value;
|
|
4865
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
4866
|
+
const rowid = _xeUtils.default.isString(rowOrId) || _xeUtils.default.isNumber(rowOrId) ? rowOrId : (0, _util.getRowid)($xeTable, rowOrId);
|
|
4867
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
4868
|
+
if (rowRest) {
|
|
4869
|
+
return rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
4870
|
+
}
|
|
4871
|
+
return 0;
|
|
4872
|
+
},
|
|
4873
|
+
/**
|
|
4874
|
+
* 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
|
|
4875
|
+
*/
|
|
4876
|
+
refreshScroll() {
|
|
4877
|
+
const {
|
|
4878
|
+
elemStore,
|
|
4879
|
+
lastScrollLeft,
|
|
4880
|
+
lastScrollTop
|
|
4757
4881
|
} = internalData;
|
|
4758
4882
|
const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
|
|
4759
4883
|
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
@@ -5950,13 +6074,15 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
5950
6074
|
scrollXLoad,
|
|
5951
6075
|
scrollYLoad
|
|
5952
6076
|
} = reactData;
|
|
5953
|
-
const
|
|
5954
|
-
|
|
6077
|
+
const {
|
|
6078
|
+
elemStore
|
|
6079
|
+
} = internalData;
|
|
6080
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
5955
6081
|
return {
|
|
5956
6082
|
virtualX: scrollXLoad,
|
|
5957
6083
|
virtualY: scrollYLoad,
|
|
5958
|
-
scrollTop:
|
|
5959
|
-
scrollLeft:
|
|
6084
|
+
scrollTop: bodyScrollElem ? bodyScrollElem.scrollTop : 0,
|
|
6085
|
+
scrollLeft: bodyScrollElem ? bodyScrollElem.scrollLeft : 0
|
|
5960
6086
|
};
|
|
5961
6087
|
},
|
|
5962
6088
|
/**
|
|
@@ -6007,9 +6133,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
6007
6133
|
*/
|
|
6008
6134
|
scrollToRow(row, fieldOrColumn) {
|
|
6009
6135
|
const {
|
|
6010
|
-
|
|
6011
|
-
} = props;
|
|
6012
|
-
const {
|
|
6136
|
+
isAllOverflow,
|
|
6013
6137
|
scrollYLoad,
|
|
6014
6138
|
scrollXLoad
|
|
6015
6139
|
} = reactData;
|
|
@@ -6026,7 +6150,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
6026
6150
|
}
|
|
6027
6151
|
return Promise.all(rest).then(() => {
|
|
6028
6152
|
if (row) {
|
|
6029
|
-
if (!
|
|
6153
|
+
if (!isAllOverflow && (scrollYLoad || scrollXLoad)) {
|
|
6030
6154
|
calcCellHeight();
|
|
6031
6155
|
calcCellWidth();
|
|
6032
6156
|
}
|
|
@@ -7094,29 +7218,35 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7094
7218
|
return;
|
|
7095
7219
|
}
|
|
7096
7220
|
const {
|
|
7221
|
+
overflowX,
|
|
7097
7222
|
scrollbarWidth,
|
|
7223
|
+
overflowY,
|
|
7098
7224
|
scrollbarHeight
|
|
7099
7225
|
} = reactData;
|
|
7100
7226
|
const {
|
|
7101
7227
|
prevDragToChild
|
|
7102
7228
|
} = internalData;
|
|
7103
7229
|
const wrapperRect = el.getBoundingClientRect();
|
|
7230
|
+
const osbWidth = overflowY ? scrollbarWidth : 0;
|
|
7231
|
+
const osbHeight = overflowX ? scrollbarHeight : 0;
|
|
7104
7232
|
const tableWidth = el.clientWidth;
|
|
7105
7233
|
const tableHeight = el.clientHeight;
|
|
7106
7234
|
if (trEl) {
|
|
7107
7235
|
const rdLineEl = refDragRowLineElem.value;
|
|
7108
7236
|
if (rdLineEl) {
|
|
7109
7237
|
if (showLine) {
|
|
7238
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value;
|
|
7110
7239
|
const trRect = trEl.getBoundingClientRect();
|
|
7111
7240
|
let trHeight = trEl.clientHeight;
|
|
7112
7241
|
const offsetTop = Math.max(1, trRect.y - wrapperRect.y);
|
|
7113
|
-
if (offsetTop + trHeight > tableHeight -
|
|
7114
|
-
trHeight = tableHeight - offsetTop -
|
|
7242
|
+
if (offsetTop + trHeight > tableHeight - osbHeight) {
|
|
7243
|
+
trHeight = tableHeight - offsetTop - osbHeight;
|
|
7115
7244
|
}
|
|
7116
7245
|
rdLineEl.style.display = 'block';
|
|
7246
|
+
rdLineEl.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
|
|
7117
7247
|
rdLineEl.style.top = `${offsetTop}px`;
|
|
7118
7248
|
rdLineEl.style.height = `${trHeight}px`;
|
|
7119
|
-
rdLineEl.style.width = `${tableWidth -
|
|
7249
|
+
rdLineEl.style.width = `${tableWidth - osbWidth}px`;
|
|
7120
7250
|
rdLineEl.setAttribute('drag-pos', dragPos);
|
|
7121
7251
|
rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
|
|
7122
7252
|
} else {
|
|
@@ -7127,6 +7257,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7127
7257
|
const cdLineEl = refDragColLineElem.value;
|
|
7128
7258
|
if (cdLineEl) {
|
|
7129
7259
|
if (showLine) {
|
|
7260
|
+
const scrollbarXToTop = computeScrollbarXToTop.value;
|
|
7130
7261
|
const leftContainerElem = refLeftContainer.value;
|
|
7131
7262
|
const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
|
|
7132
7263
|
const rightContainerElem = refRightContainer.value;
|
|
@@ -7140,7 +7271,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7140
7271
|
thWidth -= startX - offsetLeft;
|
|
7141
7272
|
offsetLeft = startX;
|
|
7142
7273
|
}
|
|
7143
|
-
const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 :
|
|
7274
|
+
const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 : osbWidth);
|
|
7144
7275
|
if (offsetLeft + thWidth > endX) {
|
|
7145
7276
|
thWidth = endX - offsetLeft;
|
|
7146
7277
|
}
|
|
@@ -7151,7 +7282,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7151
7282
|
if (prevDragToChild) {
|
|
7152
7283
|
cdLineEl.style.height = `${thRect.height}px`;
|
|
7153
7284
|
} else {
|
|
7154
|
-
cdLineEl.style.height = `${tableHeight - offsetTop -
|
|
7285
|
+
cdLineEl.style.height = `${tableHeight - offsetTop - (scrollbarXToTop ? 0 : osbHeight)}px`;
|
|
7155
7286
|
}
|
|
7156
7287
|
cdLineEl.setAttribute('drag-pos', dragPos);
|
|
7157
7288
|
cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
|
|
@@ -7187,11 +7318,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7187
7318
|
* @param {Event} evnt 事件
|
|
7188
7319
|
* @param {Row} row 行对象
|
|
7189
7320
|
*/
|
|
7190
|
-
const handleTooltip = (evnt,
|
|
7321
|
+
const handleTooltip = (evnt, tdEl, overflowElem, tipElem, params) => {
|
|
7191
7322
|
if (!overflowElem) {
|
|
7192
7323
|
return (0, _vue.nextTick)();
|
|
7193
7324
|
}
|
|
7194
|
-
params.cell =
|
|
7325
|
+
params.cell = tdEl;
|
|
7195
7326
|
const {
|
|
7196
7327
|
tooltipStore
|
|
7197
7328
|
} = reactData;
|
|
@@ -7363,9 +7494,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7363
7494
|
},
|
|
7364
7495
|
/**
|
|
7365
7496
|
* 更新数据行的 Map
|
|
7366
|
-
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
7367
7497
|
*/
|
|
7368
|
-
cacheRowMap(isSource) {
|
|
7498
|
+
cacheRowMap(isReset, isSource) {
|
|
7369
7499
|
const {
|
|
7370
7500
|
treeConfig
|
|
7371
7501
|
} = props;
|
|
@@ -7393,7 +7523,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7393
7523
|
row[childrenField] = null;
|
|
7394
7524
|
}
|
|
7395
7525
|
let cacheItem = fullAllDataRowIdData[rowid];
|
|
7396
|
-
if (!cacheItem) {
|
|
7526
|
+
if (isReset || !cacheItem) {
|
|
7397
7527
|
cacheItem = {
|
|
7398
7528
|
row,
|
|
7399
7529
|
rowid,
|
|
@@ -7401,10 +7531,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7401
7531
|
index: -1,
|
|
7402
7532
|
_index: -1,
|
|
7403
7533
|
$index: -1,
|
|
7534
|
+
treeIndex: index,
|
|
7404
7535
|
items,
|
|
7405
7536
|
parent: parentRow,
|
|
7406
7537
|
level,
|
|
7407
7538
|
height: 0,
|
|
7539
|
+
resizeHeight: 0,
|
|
7408
7540
|
oTop: 0
|
|
7409
7541
|
};
|
|
7410
7542
|
}
|
|
@@ -7518,20 +7650,179 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7518
7650
|
remainList
|
|
7519
7651
|
});
|
|
7520
7652
|
},
|
|
7521
|
-
|
|
7653
|
+
handleColResizeMousedownEvent(evnt, fixedType, params) {
|
|
7654
|
+
evnt.stopPropagation();
|
|
7655
|
+
evnt.preventDefault();
|
|
7656
|
+
const {
|
|
7657
|
+
column
|
|
7658
|
+
} = params;
|
|
7659
|
+
const {
|
|
7660
|
+
overflowX,
|
|
7661
|
+
scrollbarHeight
|
|
7662
|
+
} = reactData;
|
|
7663
|
+
const {
|
|
7664
|
+
elemStore,
|
|
7665
|
+
visibleColumn
|
|
7666
|
+
} = internalData;
|
|
7667
|
+
const resizableOpts = computeResizableOpts.value;
|
|
7668
|
+
const osbHeight = overflowX ? scrollbarHeight : 0;
|
|
7669
|
+
const tableEl = refElem.value;
|
|
7670
|
+
const leftContainerElem = refLeftContainer.value;
|
|
7671
|
+
const rightContainerElem = refRightContainer.value;
|
|
7672
|
+
const resizeBarElem = refColResizeBar.value;
|
|
7673
|
+
if (!resizeBarElem) {
|
|
7674
|
+
return;
|
|
7675
|
+
}
|
|
7676
|
+
const resizeTipElem = resizeBarElem.firstElementChild;
|
|
7677
|
+
const scrollbarXToTop = computeScrollbarXToTop.value;
|
|
7678
|
+
const {
|
|
7679
|
+
clientX: dragClientX
|
|
7680
|
+
} = evnt;
|
|
7681
|
+
const wrapperElem = refElem.value;
|
|
7682
|
+
const dragBtnElem = evnt.target;
|
|
7683
|
+
let resizeColumn = column;
|
|
7684
|
+
if (column.children && column.children.length) {
|
|
7685
|
+
_xeUtils.default.eachTree(column.children, childColumn => {
|
|
7686
|
+
resizeColumn = childColumn;
|
|
7687
|
+
});
|
|
7688
|
+
}
|
|
7689
|
+
const cell = dragBtnElem.parentNode;
|
|
7690
|
+
const cellParams = Object.assign(params, {
|
|
7691
|
+
cell
|
|
7692
|
+
});
|
|
7693
|
+
let dragLeft = 0;
|
|
7694
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
7695
|
+
if (!bodyScrollElem) {
|
|
7696
|
+
return;
|
|
7697
|
+
}
|
|
7698
|
+
const pos = (0, _dom.getOffsetPos)(dragBtnElem, wrapperElem);
|
|
7699
|
+
const dragBtnWidth = dragBtnElem.clientWidth;
|
|
7700
|
+
const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2);
|
|
7701
|
+
const minInterval = (0, _util.getColReMinWidth)(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
|
|
7702
|
+
let dragMinLeft = pos.left - cell.clientWidth + dragBtnWidth + minInterval;
|
|
7703
|
+
let dragPosLeft = pos.left + dragBtnOffsetWidth;
|
|
7704
|
+
const isLeftFixed = fixedType === 'left';
|
|
7705
|
+
const isRightFixed = fixedType === 'right';
|
|
7706
|
+
// 计算左右侧固定列偏移量
|
|
7707
|
+
let fixedOffsetWidth = 0;
|
|
7708
|
+
if (isLeftFixed || isRightFixed) {
|
|
7709
|
+
const siblingProp = isLeftFixed ? 'nextElementSibling' : 'previousElementSibling';
|
|
7710
|
+
let tempCellElem = cell[siblingProp];
|
|
7711
|
+
while (tempCellElem) {
|
|
7712
|
+
if ((0, _dom.hasClass)(tempCellElem, 'fixed--hidden')) {
|
|
7713
|
+
break;
|
|
7714
|
+
} else if (!(0, _dom.hasClass)(tempCellElem, 'col--group')) {
|
|
7715
|
+
fixedOffsetWidth += tempCellElem.offsetWidth;
|
|
7716
|
+
}
|
|
7717
|
+
tempCellElem = tempCellElem[siblingProp];
|
|
7718
|
+
}
|
|
7719
|
+
if (isRightFixed && rightContainerElem) {
|
|
7720
|
+
dragPosLeft = rightContainerElem.offsetLeft + fixedOffsetWidth;
|
|
7721
|
+
}
|
|
7722
|
+
}
|
|
7723
|
+
// 处理拖动事件
|
|
7724
|
+
const updateEvent = evnt => {
|
|
7725
|
+
evnt.stopPropagation();
|
|
7726
|
+
evnt.preventDefault();
|
|
7727
|
+
const tableHeight = tableEl.clientHeight;
|
|
7728
|
+
const offsetX = evnt.clientX - dragClientX;
|
|
7729
|
+
let left = dragPosLeft + offsetX;
|
|
7730
|
+
const scrollLeft = fixedType ? 0 : bodyScrollElem.scrollLeft;
|
|
7731
|
+
if (isLeftFixed) {
|
|
7732
|
+
// 左固定列(不允许超过右侧固定列、不允许超过右边距)
|
|
7733
|
+
left = Math.min(left, (rightContainerElem ? rightContainerElem.offsetLeft : bodyScrollElem.clientWidth) - fixedOffsetWidth - minInterval);
|
|
7734
|
+
} else if (isRightFixed) {
|
|
7735
|
+
// 右侧固定列(不允许超过左侧固定列、不允许超过左边距)
|
|
7736
|
+
dragMinLeft = (leftContainerElem ? leftContainerElem.clientWidth : 0) + fixedOffsetWidth + minInterval;
|
|
7737
|
+
left = Math.min(left, dragPosLeft + cell.clientWidth - minInterval);
|
|
7738
|
+
} else {
|
|
7739
|
+
dragMinLeft = Math.max(bodyScrollElem.scrollLeft, dragMinLeft);
|
|
7740
|
+
// left = Math.min(left, bodyScrollElem.clientWidth + bodyScrollElem.scrollLeft - 40)
|
|
7741
|
+
}
|
|
7742
|
+
dragLeft = Math.max(left, dragMinLeft);
|
|
7743
|
+
const resizeBarLeft = Math.max(1, dragLeft - scrollLeft);
|
|
7744
|
+
resizeBarElem.style.left = `${resizeBarLeft}px`;
|
|
7745
|
+
resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`;
|
|
7746
|
+
resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - osbHeight : tableHeight}px`;
|
|
7747
|
+
if (resizableOpts.showDragTip && resizeTipElem) {
|
|
7748
|
+
resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
|
|
7749
|
+
const tableWidth = tableEl.clientWidth;
|
|
7750
|
+
const wrapperRect = wrapperElem.getBoundingClientRect();
|
|
7751
|
+
const resizeBarWidth = resizeBarElem.clientWidth;
|
|
7752
|
+
const resizeTipWidth = resizeTipElem.clientWidth;
|
|
7753
|
+
const resizeTipHeight = resizeTipElem.clientHeight;
|
|
7754
|
+
let resizeTipLeft = -resizeTipWidth;
|
|
7755
|
+
if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
|
|
7756
|
+
resizeTipLeft = 0;
|
|
7757
|
+
} else if (resizeBarLeft > tableWidth) {
|
|
7758
|
+
resizeTipLeft += tableWidth - resizeBarLeft;
|
|
7759
|
+
}
|
|
7760
|
+
resizeTipElem.style.left = `${resizeTipLeft}px`;
|
|
7761
|
+
resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
|
|
7762
|
+
}
|
|
7763
|
+
reactData.isDragResize = true;
|
|
7764
|
+
};
|
|
7765
|
+
reactData.isDragResize = true;
|
|
7766
|
+
(0, _dom.addClass)(tableEl, 'col-drag--resize');
|
|
7767
|
+
resizeBarElem.style.display = 'block';
|
|
7768
|
+
document.onmousemove = updateEvent;
|
|
7769
|
+
document.onmouseup = function (evnt) {
|
|
7770
|
+
document.onmousemove = null;
|
|
7771
|
+
document.onmouseup = null;
|
|
7772
|
+
resizeBarElem.style.display = 'none';
|
|
7773
|
+
internalData._lastResizeTime = Date.now();
|
|
7774
|
+
setTimeout(() => {
|
|
7775
|
+
reactData.isDragResize = false;
|
|
7776
|
+
}, 50);
|
|
7777
|
+
const resizeWidth = resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
|
|
7778
|
+
const resizeParams = Object.assign(Object.assign({}, params), {
|
|
7779
|
+
resizeWidth,
|
|
7780
|
+
resizeColumn
|
|
7781
|
+
});
|
|
7782
|
+
if (resizableOpts.dragMode === 'fixed') {
|
|
7783
|
+
visibleColumn.forEach(item => {
|
|
7784
|
+
if (item.id !== resizeColumn.id) {
|
|
7785
|
+
if (!item.resizeWidth) {
|
|
7786
|
+
item.resizeWidth = item.renderWidth;
|
|
7787
|
+
}
|
|
7788
|
+
}
|
|
7789
|
+
});
|
|
7790
|
+
}
|
|
7791
|
+
if ($xeTable.handleColResizeCellAreaEvent) {
|
|
7792
|
+
$xeTable.handleColResizeCellAreaEvent(evnt, resizeParams);
|
|
7793
|
+
} else {
|
|
7794
|
+
resizeColumn.resizeWidth = resizeWidth;
|
|
7795
|
+
handleUpdateColResize(evnt, resizeParams);
|
|
7796
|
+
}
|
|
7797
|
+
(0, _dom.removeClass)(tableEl, 'col-drag--resize');
|
|
7798
|
+
};
|
|
7799
|
+
updateEvent(evnt);
|
|
7800
|
+
if ($xeTable.closeMenu) {
|
|
7801
|
+
$xeTable.closeMenu();
|
|
7802
|
+
}
|
|
7803
|
+
},
|
|
7804
|
+
handleColResizeDblclickEvent(evnt, params) {
|
|
7522
7805
|
const resizableOpts = computeResizableOpts.value;
|
|
7523
7806
|
const {
|
|
7524
7807
|
isDblclickAutoWidth
|
|
7525
7808
|
} = resizableOpts;
|
|
7526
7809
|
const el = refElem.value;
|
|
7527
7810
|
if (isDblclickAutoWidth && el) {
|
|
7811
|
+
evnt.stopPropagation();
|
|
7812
|
+
evnt.preventDefault();
|
|
7528
7813
|
const {
|
|
7529
7814
|
fullColumnIdData
|
|
7530
7815
|
} = internalData;
|
|
7531
7816
|
const {
|
|
7532
7817
|
column
|
|
7533
7818
|
} = params;
|
|
7534
|
-
|
|
7819
|
+
let resizeColumn = column;
|
|
7820
|
+
if (column.children && column.children.length) {
|
|
7821
|
+
_xeUtils.default.eachTree(column.children, childColumn => {
|
|
7822
|
+
resizeColumn = childColumn;
|
|
7823
|
+
});
|
|
7824
|
+
}
|
|
7825
|
+
const colid = resizeColumn.id;
|
|
7535
7826
|
const colRest = fullColumnIdData[colid];
|
|
7536
7827
|
const dragBtnElem = evnt.target;
|
|
7537
7828
|
const cell = dragBtnElem.parentNode;
|
|
@@ -7539,22 +7830,192 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7539
7830
|
cell
|
|
7540
7831
|
});
|
|
7541
7832
|
const colMinWidth = (0, _util.getColReMinWidth)(cellParams);
|
|
7542
|
-
|
|
7833
|
+
el.setAttribute('data-calc-col', 'Y');
|
|
7834
|
+
let resizeWidth = calcColumnAutoWidth(resizeColumn, el);
|
|
7835
|
+
el.removeAttribute('data-calc-col');
|
|
7543
7836
|
if (colRest) {
|
|
7544
7837
|
resizeWidth = Math.max(resizeWidth, colRest.width);
|
|
7545
7838
|
}
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
$xeTable.recalculate(true).then(() => {
|
|
7551
|
-
$xeTable.saveCustomStore('update:visible');
|
|
7552
|
-
$xeTable.updateCellAreas();
|
|
7553
|
-
$xeTable.dispatchEvent('resizable-change', Object.assign(Object.assign({}, params), {
|
|
7554
|
-
resizeWidth
|
|
7555
|
-
}), evnt);
|
|
7556
|
-
setTimeout(() => $xeTable.recalculate(true), 300);
|
|
7839
|
+
resizeWidth = Math.max(colMinWidth, resizeWidth);
|
|
7840
|
+
const resizeParams = Object.assign(Object.assign({}, params), {
|
|
7841
|
+
resizeWidth,
|
|
7842
|
+
resizeColumn
|
|
7557
7843
|
});
|
|
7844
|
+
reactData.isDragResize = false;
|
|
7845
|
+
internalData._lastResizeTime = Date.now();
|
|
7846
|
+
if ($xeTable.handleColResizeDblclickCellAreaEvent) {
|
|
7847
|
+
$xeTable.handleColResizeDblclickCellAreaEvent(evnt, resizeParams);
|
|
7848
|
+
} else {
|
|
7849
|
+
resizeColumn.resizeWidth = resizeWidth;
|
|
7850
|
+
handleUpdateColResize(evnt, resizeParams);
|
|
7851
|
+
}
|
|
7852
|
+
}
|
|
7853
|
+
},
|
|
7854
|
+
handleRowResizeMousedownEvent(evnt, params) {
|
|
7855
|
+
evnt.stopPropagation();
|
|
7856
|
+
evnt.preventDefault();
|
|
7857
|
+
const {
|
|
7858
|
+
row
|
|
7859
|
+
} = params;
|
|
7860
|
+
const {
|
|
7861
|
+
overflowX,
|
|
7862
|
+
scrollbarWidth,
|
|
7863
|
+
overflowY,
|
|
7864
|
+
scrollbarHeight
|
|
7865
|
+
} = reactData;
|
|
7866
|
+
const {
|
|
7867
|
+
elemStore,
|
|
7868
|
+
fullAllDataRowIdData
|
|
7869
|
+
} = internalData;
|
|
7870
|
+
const osbWidth = overflowY ? scrollbarWidth : 0;
|
|
7871
|
+
const osbHeight = overflowX ? scrollbarHeight : 0;
|
|
7872
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value;
|
|
7873
|
+
const resizableOpts = computeResizableOpts.value;
|
|
7874
|
+
const rowOpts = computeRowOpts.value;
|
|
7875
|
+
const cellOpts = computeCellOpts.value;
|
|
7876
|
+
const tableEl = refElem.value;
|
|
7877
|
+
const resizeBarElem = refRowResizeBar.value;
|
|
7878
|
+
if (!resizeBarElem) {
|
|
7879
|
+
return;
|
|
7880
|
+
}
|
|
7881
|
+
const {
|
|
7882
|
+
clientY: dragClientY
|
|
7883
|
+
} = evnt;
|
|
7884
|
+
const resizeTipElem = resizeBarElem.firstElementChild;
|
|
7885
|
+
const dragBtnElem = evnt.currentTarget;
|
|
7886
|
+
const tdEl = dragBtnElem.parentNode;
|
|
7887
|
+
const trEl = tdEl.parentNode;
|
|
7888
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
7889
|
+
if (!bodyScrollElem) {
|
|
7890
|
+
return;
|
|
7891
|
+
}
|
|
7892
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
7893
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
7894
|
+
if (!rowRest) {
|
|
7895
|
+
return;
|
|
7896
|
+
}
|
|
7897
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
7898
|
+
const currCellHeight = rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
7899
|
+
const tableRect = tableEl.getBoundingClientRect();
|
|
7900
|
+
const trRect = trEl.getBoundingClientRect();
|
|
7901
|
+
const targetOffsetY = dragClientY - trRect.y - trEl.clientHeight;
|
|
7902
|
+
let resizeHeight = currCellHeight;
|
|
7903
|
+
const cellEl = tdEl.querySelector('.vxe-cell');
|
|
7904
|
+
let cellMinHeight = 0;
|
|
7905
|
+
if (cellEl) {
|
|
7906
|
+
const cellStyle = getComputedStyle(cellEl);
|
|
7907
|
+
cellMinHeight = Math.max(1, Math.ceil(_xeUtils.default.toNumber(cellStyle.paddingTop) + _xeUtils.default.toNumber(cellStyle.paddingBottom)));
|
|
7908
|
+
}
|
|
7909
|
+
const minTop = trRect.y - tableRect.y + cellMinHeight;
|
|
7910
|
+
// 处理拖动事件
|
|
7911
|
+
const updateEvent = evnt => {
|
|
7912
|
+
evnt.stopPropagation();
|
|
7913
|
+
evnt.preventDefault();
|
|
7914
|
+
const tableWidth = tableEl.clientWidth - osbWidth;
|
|
7915
|
+
const tableHeight = tableEl.clientHeight - osbHeight;
|
|
7916
|
+
let dragTop = evnt.clientY - tableRect.y - targetOffsetY;
|
|
7917
|
+
if (dragTop < minTop) {
|
|
7918
|
+
dragTop = minTop;
|
|
7919
|
+
} else {
|
|
7920
|
+
resizeHeight = Math.max(cellMinHeight, currCellHeight + evnt.clientY - dragClientY);
|
|
7921
|
+
}
|
|
7922
|
+
resizeBarElem.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
|
|
7923
|
+
resizeBarElem.style.top = `${dragTop}px`;
|
|
7924
|
+
resizeBarElem.style.width = `${tableWidth}px`;
|
|
7925
|
+
if (resizableOpts.showDragTip && resizeTipElem) {
|
|
7926
|
+
resizeTipElem.textContent = getI18n('vxe.table.resizeRowTip', [resizeHeight]);
|
|
7927
|
+
const resizeTipWidth = resizeTipElem.clientWidth;
|
|
7928
|
+
const resizeTipHeight = resizeTipElem.clientHeight;
|
|
7929
|
+
let resizeBarLeft = Math.max(2, evnt.clientX - tableRect.x);
|
|
7930
|
+
let resizeBarTop = 0;
|
|
7931
|
+
if (resizeBarLeft + resizeTipWidth >= tableWidth - 2) {
|
|
7932
|
+
resizeBarLeft = tableWidth - resizeTipWidth - 2;
|
|
7933
|
+
}
|
|
7934
|
+
if (dragTop + resizeTipHeight >= tableHeight) {
|
|
7935
|
+
resizeBarTop = tableHeight - (dragTop + resizeTipHeight);
|
|
7936
|
+
}
|
|
7937
|
+
resizeTipElem.style.left = `${resizeBarLeft}px`;
|
|
7938
|
+
resizeTipElem.style.top = `${resizeBarTop}px`;
|
|
7939
|
+
}
|
|
7940
|
+
reactData.isDragResize = true;
|
|
7941
|
+
};
|
|
7942
|
+
reactData.isDragResize = true;
|
|
7943
|
+
(0, _dom.addClass)(tableEl, 'row-drag--resize');
|
|
7944
|
+
resizeBarElem.style.display = 'block';
|
|
7945
|
+
document.onmousemove = updateEvent;
|
|
7946
|
+
document.onmouseup = function (evnt) {
|
|
7947
|
+
document.onmousemove = null;
|
|
7948
|
+
document.onmouseup = null;
|
|
7949
|
+
resizeBarElem.style.display = 'none';
|
|
7950
|
+
internalData._lastResizeTime = Date.now();
|
|
7951
|
+
setTimeout(() => {
|
|
7952
|
+
reactData.isDragResize = false;
|
|
7953
|
+
}, 50);
|
|
7954
|
+
if (resizeHeight !== currCellHeight) {
|
|
7955
|
+
const resizeParams = Object.assign(Object.assign({}, params), {
|
|
7956
|
+
resizeHeight,
|
|
7957
|
+
resizeRow: row
|
|
7958
|
+
});
|
|
7959
|
+
internalData.isResizeCellHeight = true;
|
|
7960
|
+
if ($xeTable.handleRowResizeCellAreaEvent) {
|
|
7961
|
+
$xeTable.handleRowResizeCellAreaEvent(evnt, resizeParams);
|
|
7962
|
+
} else {
|
|
7963
|
+
rowRest.resizeHeight = resizeHeight;
|
|
7964
|
+
handleUpdateRowResize(evnt, resizeParams);
|
|
7965
|
+
}
|
|
7966
|
+
}
|
|
7967
|
+
(0, _dom.removeClass)(tableEl, 'row-drag--resize');
|
|
7968
|
+
};
|
|
7969
|
+
updateEvent(evnt);
|
|
7970
|
+
},
|
|
7971
|
+
handleRowResizeDblclickEvent(evnt, params) {
|
|
7972
|
+
const resizableOpts = computeResizableOpts.value;
|
|
7973
|
+
const {
|
|
7974
|
+
isDblclickAutoHeight
|
|
7975
|
+
} = resizableOpts;
|
|
7976
|
+
const el = refElem.value;
|
|
7977
|
+
if (isDblclickAutoHeight && el) {
|
|
7978
|
+
evnt.stopPropagation();
|
|
7979
|
+
evnt.preventDefault();
|
|
7980
|
+
const {
|
|
7981
|
+
editStore
|
|
7982
|
+
} = reactData;
|
|
7983
|
+
const {
|
|
7984
|
+
fullAllDataRowIdData
|
|
7985
|
+
} = internalData;
|
|
7986
|
+
const {
|
|
7987
|
+
actived
|
|
7988
|
+
} = editStore;
|
|
7989
|
+
const {
|
|
7990
|
+
row
|
|
7991
|
+
} = params;
|
|
7992
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
7993
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
7994
|
+
if (!rowRest) {
|
|
7995
|
+
return;
|
|
7996
|
+
}
|
|
7997
|
+
const handleRsHeight = () => {
|
|
7998
|
+
el.setAttribute('data-calc-row', 'Y');
|
|
7999
|
+
const resizeHeight = calcCellAutoHeight(rowRest, el);
|
|
8000
|
+
el.removeAttribute('data-calc-row');
|
|
8001
|
+
const resizeParams = Object.assign(Object.assign({}, params), {
|
|
8002
|
+
resizeHeight,
|
|
8003
|
+
resizeRow: row
|
|
8004
|
+
});
|
|
8005
|
+
reactData.isDragResize = false;
|
|
8006
|
+
internalData._lastResizeTime = Date.now();
|
|
8007
|
+
if ($xeTable.handleRowResizeDblclickCellAreaEvent) {
|
|
8008
|
+
$xeTable.handleRowResizeDblclickCellAreaEvent(evnt, resizeParams);
|
|
8009
|
+
} else {
|
|
8010
|
+
rowRest.resizeHeight = resizeHeight;
|
|
8011
|
+
handleUpdateRowResize(evnt, resizeParams);
|
|
8012
|
+
}
|
|
8013
|
+
};
|
|
8014
|
+
if (actived.row || actived.column) {
|
|
8015
|
+
$xeTable.clearEdit().then(handleRsHeight);
|
|
8016
|
+
} else {
|
|
8017
|
+
handleRsHeight();
|
|
8018
|
+
}
|
|
7558
8019
|
}
|
|
7559
8020
|
},
|
|
7560
8021
|
saveCustomStore(type) {
|
|
@@ -7808,7 +8269,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7808
8269
|
}
|
|
7809
8270
|
vLen++;
|
|
7810
8271
|
});
|
|
7811
|
-
const isSelected =
|
|
8272
|
+
const isSelected = vLen > 0 ? sLen >= vLen : sLen >= rootList.length;
|
|
7812
8273
|
const halfSelect = !isSelected && (sLen >= 1 || hLen >= 1);
|
|
7813
8274
|
reactData.isAllSelected = isSelected;
|
|
7814
8275
|
reactData.isIndeterminate = halfSelect;
|
|
@@ -7960,10 +8421,21 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7960
8421
|
const {
|
|
7961
8422
|
column
|
|
7962
8423
|
} = params;
|
|
7963
|
-
const titleElem = evnt.currentTarget;
|
|
7964
8424
|
handleTargetEnterEvent(true);
|
|
8425
|
+
const titleElem = evnt.currentTarget;
|
|
8426
|
+
if (!titleElem) {
|
|
8427
|
+
return;
|
|
8428
|
+
}
|
|
8429
|
+
const cellEl = titleElem.parentElement;
|
|
8430
|
+
if (!cellEl) {
|
|
8431
|
+
return;
|
|
8432
|
+
}
|
|
8433
|
+
const thEl = cellEl.parentElement;
|
|
8434
|
+
if (!thEl) {
|
|
8435
|
+
return;
|
|
8436
|
+
}
|
|
7965
8437
|
if (tooltipStore.column !== column || !tooltipStore.visible) {
|
|
7966
|
-
handleTooltip(evnt,
|
|
8438
|
+
handleTooltip(evnt, thEl, cellEl, null, params);
|
|
7967
8439
|
}
|
|
7968
8440
|
},
|
|
7969
8441
|
/**
|
|
@@ -7987,7 +8459,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7987
8459
|
row,
|
|
7988
8460
|
column
|
|
7989
8461
|
} = params;
|
|
7990
|
-
const
|
|
8462
|
+
const tdEl = evnt.currentTarget;
|
|
7991
8463
|
handleTargetEnterEvent(tooltipStore.column !== column || tooltipStore.row !== row);
|
|
7992
8464
|
// 单元格处于编辑状态时不触发提示框
|
|
7993
8465
|
if (column.editRender && (0, _utils.isEnableConf)(editConfig)) {
|
|
@@ -8001,17 +8473,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8001
8473
|
}
|
|
8002
8474
|
}
|
|
8003
8475
|
if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
|
|
8004
|
-
|
|
8005
|
-
let tipElem;
|
|
8006
|
-
if (column.treeNode) {
|
|
8007
|
-
overflowElem = cell.querySelector('.vxe-tree-cell');
|
|
8008
|
-
if (column.type === 'html') {
|
|
8009
|
-
tipElem = cell.querySelector('.vxe-cell--html');
|
|
8010
|
-
}
|
|
8011
|
-
} else {
|
|
8012
|
-
tipElem = cell.querySelector(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label');
|
|
8013
|
-
}
|
|
8014
|
-
handleTooltip(evnt, cell, overflowElem || cell.children[0], tipElem, params);
|
|
8476
|
+
handleTooltip(evnt, tdEl, tdEl.querySelector('.vxe-cell--wrapper'), null, params);
|
|
8015
8477
|
}
|
|
8016
8478
|
},
|
|
8017
8479
|
/**
|
|
@@ -8027,7 +8489,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8027
8489
|
const cell = evnt.currentTarget;
|
|
8028
8490
|
handleTargetEnterEvent(tooltipStore.column !== column || !!tooltipStore.row);
|
|
8029
8491
|
if (tooltipStore.column !== column || !tooltipStore.visible) {
|
|
8030
|
-
handleTooltip(evnt, cell, cell.querySelector('.vxe-cell--
|
|
8492
|
+
handleTooltip(evnt, cell, cell.querySelector('.vxe-cell--wrapper') || cell.children[0], null, params);
|
|
8031
8493
|
}
|
|
8032
8494
|
},
|
|
8033
8495
|
handleTargetLeaveEvent() {
|
|
@@ -8040,11 +8502,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8040
8502
|
internalData.tooltipTimeout = setTimeout(() => {
|
|
8041
8503
|
$tooltip = refTooltip.value;
|
|
8042
8504
|
if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
|
|
8043
|
-
|
|
8505
|
+
$xeTable.closeTooltip();
|
|
8044
8506
|
}
|
|
8045
8507
|
}, tooltipOpts.leaveDelay);
|
|
8046
8508
|
} else {
|
|
8047
|
-
|
|
8509
|
+
$xeTable.closeTooltip();
|
|
8048
8510
|
}
|
|
8049
8511
|
},
|
|
8050
8512
|
triggerHeaderCellClickEvent(evnt, params) {
|
|
@@ -8089,8 +8551,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8089
8551
|
editConfig
|
|
8090
8552
|
} = props;
|
|
8091
8553
|
const {
|
|
8092
|
-
editStore
|
|
8554
|
+
editStore,
|
|
8555
|
+
isDragResize
|
|
8093
8556
|
} = reactData;
|
|
8557
|
+
if (isDragResize) {
|
|
8558
|
+
return;
|
|
8559
|
+
}
|
|
8094
8560
|
const expandOpts = computeExpandOpts.value;
|
|
8095
8561
|
const editOpts = computeEditOpts.value;
|
|
8096
8562
|
const treeOpts = computeTreeOpts.value;
|
|
@@ -8200,8 +8666,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8200
8666
|
editConfig
|
|
8201
8667
|
} = props;
|
|
8202
8668
|
const {
|
|
8203
|
-
editStore
|
|
8669
|
+
editStore,
|
|
8670
|
+
isDragResize
|
|
8204
8671
|
} = reactData;
|
|
8672
|
+
if (isDragResize) {
|
|
8673
|
+
return;
|
|
8674
|
+
}
|
|
8205
8675
|
const editOpts = computeEditOpts.value;
|
|
8206
8676
|
const {
|
|
8207
8677
|
actived
|
|
@@ -8623,7 +9093,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8623
9093
|
isPeerDrag,
|
|
8624
9094
|
isCrossDrag,
|
|
8625
9095
|
isSelfToChildDrag,
|
|
8626
|
-
dragEndMethod
|
|
9096
|
+
dragEndMethod,
|
|
9097
|
+
dragToChildMethod
|
|
8627
9098
|
} = rowDragOpts;
|
|
8628
9099
|
const treeOpts = computeTreeOpts.value;
|
|
8629
9100
|
const {
|
|
@@ -8642,13 +9113,15 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8642
9113
|
if (prevDragRow && dragRow) {
|
|
8643
9114
|
// 判断是否有拖动
|
|
8644
9115
|
if (prevDragRow !== dragRow) {
|
|
8645
|
-
|
|
9116
|
+
const dragParams = {
|
|
8646
9117
|
oldRow: dragRow,
|
|
8647
9118
|
newRow: prevDragRow,
|
|
8648
9119
|
dragPos: prevDragPos,
|
|
8649
9120
|
dragToChild: !!prevDragToChild,
|
|
8650
9121
|
offsetIndex: dragOffsetIndex
|
|
8651
|
-
}
|
|
9122
|
+
};
|
|
9123
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
9124
|
+
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then(status => {
|
|
8652
9125
|
if (!status) {
|
|
8653
9126
|
return;
|
|
8654
9127
|
}
|
|
@@ -8726,7 +9199,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8726
9199
|
// 根到根
|
|
8727
9200
|
}
|
|
8728
9201
|
const fullList = _xeUtils.default.toTreeArray(internalData.afterTreeFullData, {
|
|
8729
|
-
|
|
9202
|
+
key: rowField,
|
|
9203
|
+
parentKey: parentField,
|
|
9204
|
+
children: mapChildrenField
|
|
8730
9205
|
});
|
|
8731
9206
|
// 移出
|
|
8732
9207
|
const otfIndex = $xeTable.findRowIndexOf(fullList, dragRow);
|
|
@@ -8741,12 +9216,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8741
9216
|
childRow[parentField] = dragRow[parentField];
|
|
8742
9217
|
});
|
|
8743
9218
|
}
|
|
8744
|
-
dragRow[parentField] =
|
|
9219
|
+
dragRow[parentField] = isDragToChildFlag ? prevDragRow[rowField] : prevDragRow[parentField];
|
|
8745
9220
|
internalData.tableFullTreeData = _xeUtils.default.toArrayTree(fullList, {
|
|
8746
|
-
key:
|
|
8747
|
-
parentKey:
|
|
9221
|
+
key: rowField,
|
|
9222
|
+
parentKey: parentField,
|
|
8748
9223
|
children: childrenField,
|
|
8749
|
-
mapChildren:
|
|
9224
|
+
mapChildren: mapChildrenField
|
|
8750
9225
|
});
|
|
8751
9226
|
}
|
|
8752
9227
|
}
|
|
@@ -8766,7 +9241,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8766
9241
|
}
|
|
8767
9242
|
reactData.isDragRowMove = true;
|
|
8768
9243
|
$xeTable.handleTableData(treeConfig && transform);
|
|
8769
|
-
$xeTable.cacheRowMap();
|
|
9244
|
+
$xeTable.cacheRowMap(false);
|
|
8770
9245
|
updateScrollYStatus();
|
|
8771
9246
|
if (!(treeConfig && transform)) {
|
|
8772
9247
|
$xeTable.updateAfterDataIndex();
|
|
@@ -8783,7 +9258,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8783
9258
|
oldRow: dragRow,
|
|
8784
9259
|
newRow: prevDragRow,
|
|
8785
9260
|
dragPos: prevDragPos,
|
|
8786
|
-
dragToChild:
|
|
9261
|
+
dragToChild: isDragToChildFlag,
|
|
8787
9262
|
offsetIndex: dragOffsetIndex,
|
|
8788
9263
|
_index: {
|
|
8789
9264
|
newIndex: nafIndex,
|
|
@@ -8815,18 +9290,16 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8815
9290
|
prevDragRow,
|
|
8816
9291
|
prevDragPos
|
|
8817
9292
|
} = internalData;
|
|
8818
|
-
if (treeConfig && prevDragToChild) {
|
|
9293
|
+
if (treeConfig && lazy && prevDragToChild) {
|
|
8819
9294
|
// 懒加载
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
if (
|
|
8824
|
-
if (rowRest && rowRest.treeLoaded) {
|
|
8825
|
-
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
8826
|
-
}
|
|
8827
|
-
} else {
|
|
9295
|
+
const newRowid = (0, _util.getRowid)($xeTable, prevDragRow);
|
|
9296
|
+
const rowRest = fullAllDataRowIdData[newRowid];
|
|
9297
|
+
if (prevDragRow[hasChildField]) {
|
|
9298
|
+
if (rowRest && rowRest.treeLoaded) {
|
|
8828
9299
|
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
8829
9300
|
}
|
|
9301
|
+
} else {
|
|
9302
|
+
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
8830
9303
|
}
|
|
8831
9304
|
} else {
|
|
8832
9305
|
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
|
|
@@ -8957,7 +9430,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8957
9430
|
isCrossDrag,
|
|
8958
9431
|
isSelfToChildDrag,
|
|
8959
9432
|
isToChildDrag,
|
|
8960
|
-
dragEndMethod
|
|
9433
|
+
dragEndMethod,
|
|
9434
|
+
dragToChildMethod
|
|
8961
9435
|
} = columnDragOpts;
|
|
8962
9436
|
const {
|
|
8963
9437
|
collectColumn
|
|
@@ -8968,13 +9442,15 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
8968
9442
|
if (prevDragCol !== dragCol) {
|
|
8969
9443
|
const oldColumn = dragCol;
|
|
8970
9444
|
const newColumn = prevDragCol;
|
|
8971
|
-
|
|
9445
|
+
const dragParams = {
|
|
8972
9446
|
oldColumn,
|
|
8973
9447
|
newColumn,
|
|
8974
9448
|
dragPos: prevDragPos,
|
|
8975
9449
|
dragToChild: !!prevDragToChild,
|
|
8976
9450
|
offsetIndex: dragOffsetIndex
|
|
8977
|
-
}
|
|
9451
|
+
};
|
|
9452
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
9453
|
+
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then(status => {
|
|
8978
9454
|
if (!status) {
|
|
8979
9455
|
return;
|
|
8980
9456
|
}
|
|
@@ -9070,7 +9546,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
9070
9546
|
parent: nParent
|
|
9071
9547
|
} = newMatchRest;
|
|
9072
9548
|
// 转子级
|
|
9073
|
-
if (isCrossDrag && isToChildDrag &&
|
|
9549
|
+
if (isCrossDrag && isToChildDrag && isDragToChildFlag) {
|
|
9074
9550
|
oldColumn.parentId = newColumn.id;
|
|
9075
9551
|
newColumn.children = (newColumn.children || []).concat([oldColumn]);
|
|
9076
9552
|
} else {
|
|
@@ -9101,7 +9577,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
9101
9577
|
oldColumn,
|
|
9102
9578
|
newColumn,
|
|
9103
9579
|
dragPos: prevDragPos,
|
|
9104
|
-
dragToChild:
|
|
9580
|
+
dragToChild: isDragToChildFlag,
|
|
9105
9581
|
offsetIndex: dragOffsetIndex,
|
|
9106
9582
|
_index: {
|
|
9107
9583
|
newIndex: nafIndex,
|
|
@@ -9369,6 +9845,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
9369
9845
|
triggerBodyScrollEvent(evnt, fixedType) {
|
|
9370
9846
|
const {
|
|
9371
9847
|
elemStore,
|
|
9848
|
+
intoRunScroll,
|
|
9372
9849
|
lastScrollTop,
|
|
9373
9850
|
lastScrollLeft,
|
|
9374
9851
|
inWheelScroll,
|
|
@@ -9388,6 +9865,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
9388
9865
|
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
|
|
9389
9866
|
return;
|
|
9390
9867
|
}
|
|
9868
|
+
if (intoRunScroll) {
|
|
9869
|
+
return;
|
|
9870
|
+
}
|
|
9391
9871
|
if (!bodyScrollElem) {
|
|
9392
9872
|
return;
|
|
9393
9873
|
}
|
|
@@ -9444,6 +9924,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
9444
9924
|
triggerHeaderScrollEvent(evnt, fixedType) {
|
|
9445
9925
|
const {
|
|
9446
9926
|
elemStore,
|
|
9927
|
+
intoRunScroll,
|
|
9447
9928
|
inWheelScroll,
|
|
9448
9929
|
inVirtualScroll,
|
|
9449
9930
|
inBodyScroll,
|
|
@@ -9454,16 +9935,10 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
9454
9935
|
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
9455
9936
|
const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
|
|
9456
9937
|
const footerScrollElem = (0, _util.getRefElem)(elemStore['main-footer-scroll']);
|
|
9457
|
-
if (inWheelScroll) {
|
|
9938
|
+
if (inWheelScroll || inVirtualScroll || inBodyScroll || inFooterScroll) {
|
|
9458
9939
|
return;
|
|
9459
9940
|
}
|
|
9460
|
-
if (
|
|
9461
|
-
return;
|
|
9462
|
-
}
|
|
9463
|
-
if (inBodyScroll) {
|
|
9464
|
-
return;
|
|
9465
|
-
}
|
|
9466
|
-
if (inFooterScroll) {
|
|
9941
|
+
if (intoRunScroll) {
|
|
9467
9942
|
return;
|
|
9468
9943
|
}
|
|
9469
9944
|
if (!headerScrollElem) {
|
|
@@ -9492,6 +9967,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
9492
9967
|
triggerFooterScrollEvent(evnt, fixedType) {
|
|
9493
9968
|
const {
|
|
9494
9969
|
elemStore,
|
|
9970
|
+
intoRunScroll,
|
|
9495
9971
|
inWheelScroll,
|
|
9496
9972
|
inVirtualScroll,
|
|
9497
9973
|
inHeaderScroll,
|
|
@@ -9502,16 +9978,10 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
9502
9978
|
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
9503
9979
|
const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
|
|
9504
9980
|
const footerScrollElem = (0, _util.getRefElem)(elemStore['main-footer-scroll']);
|
|
9505
|
-
if (inWheelScroll) {
|
|
9506
|
-
return;
|
|
9507
|
-
}
|
|
9508
|
-
if (inVirtualScroll) {
|
|
9981
|
+
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inBodyScroll) {
|
|
9509
9982
|
return;
|
|
9510
9983
|
}
|
|
9511
|
-
if (
|
|
9512
|
-
return;
|
|
9513
|
-
}
|
|
9514
|
-
if (inBodyScroll) {
|
|
9984
|
+
if (intoRunScroll) {
|
|
9515
9985
|
return;
|
|
9516
9986
|
}
|
|
9517
9987
|
if (!footerScrollElem) {
|
|
@@ -9539,9 +10009,13 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
9539
10009
|
},
|
|
9540
10010
|
triggerBodyWheelEvent(evnt) {
|
|
9541
10011
|
const {
|
|
10012
|
+
target,
|
|
9542
10013
|
deltaY,
|
|
9543
10014
|
deltaX
|
|
9544
10015
|
} = evnt;
|
|
10016
|
+
if (target && /^textarea$/i.test(target.tagName)) {
|
|
10017
|
+
return;
|
|
10018
|
+
}
|
|
9545
10019
|
const {
|
|
9546
10020
|
highlightHoverRow
|
|
9547
10021
|
} = _props.default;
|
|
@@ -9565,26 +10039,13 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
9565
10039
|
if (!bodyScrollElem) {
|
|
9566
10040
|
return;
|
|
9567
10041
|
}
|
|
9568
|
-
|
|
9569
|
-
|
|
9570
|
-
|
|
9571
|
-
} else if (reactData.lastScrollTime + 30 > Date.now()) {
|
|
9572
|
-
multiple = 1.15;
|
|
9573
|
-
} else if (reactData.lastScrollTime + 40 > Date.now()) {
|
|
9574
|
-
multiple = 1.12;
|
|
9575
|
-
} else if (reactData.lastScrollTime + 55 > Date.now()) {
|
|
9576
|
-
multiple = 1.09;
|
|
9577
|
-
} else if (reactData.lastScrollTime + 75 > Date.now()) {
|
|
9578
|
-
multiple = 1.06;
|
|
9579
|
-
} else if (reactData.lastScrollTime + 100 > Date.now()) {
|
|
9580
|
-
multiple = 1.03;
|
|
9581
|
-
}
|
|
9582
|
-
const deltaTop = deltaY * multiple;
|
|
9583
|
-
const deltaLeft = deltaX * multiple;
|
|
10042
|
+
const wheelSpeed = getWheelSpeed(reactData.lastScrollTime);
|
|
10043
|
+
const deltaTop = deltaY * wheelSpeed;
|
|
10044
|
+
const deltaLeft = deltaX * wheelSpeed;
|
|
9584
10045
|
const isTopWheel = deltaTop < 0;
|
|
9585
|
-
const currScrollTop =
|
|
10046
|
+
const currScrollTop = bodyScrollElem.scrollTop;
|
|
9586
10047
|
// 如果滚动位置已经是顶部或底部,则不需要触发
|
|
9587
|
-
if (isTopWheel ? currScrollTop <= 0 : currScrollTop >=
|
|
10048
|
+
if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= bodyScrollElem.scrollHeight - bodyScrollElem.clientHeight) {
|
|
9588
10049
|
return;
|
|
9589
10050
|
}
|
|
9590
10051
|
const scrollTop = bodyScrollElem.scrollTop + deltaTop;
|
|
@@ -9597,17 +10058,110 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
9597
10058
|
if (rowOpts.isHover || highlightHoverRow) {
|
|
9598
10059
|
$xeTable.clearHoverRow();
|
|
9599
10060
|
}
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
10061
|
+
wheelScrollTo(scrollTop - bodyScrollElem.scrollTop, offsetTop => {
|
|
10062
|
+
const currTopNum = bodyScrollElem.scrollTop + offsetTop;
|
|
10063
|
+
internalData.inWheelScroll = true;
|
|
10064
|
+
(0, _dom.setScrollTop)(yHandleEl, currTopNum);
|
|
10065
|
+
(0, _dom.setScrollTop)(bodyScrollElem, currTopNum);
|
|
10066
|
+
(0, _dom.setScrollTop)(leftScrollElem, currTopNum);
|
|
10067
|
+
(0, _dom.setScrollTop)(rightScrollElem, currTopNum);
|
|
10068
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
10069
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, scrollLeft, {
|
|
10070
|
+
type: 'table',
|
|
10071
|
+
fixed: ''
|
|
10072
|
+
});
|
|
9609
10073
|
});
|
|
10074
|
+
// internalData.inWheelScroll = true
|
|
10075
|
+
// setScrollTop(yHandleEl, scrollTop)
|
|
10076
|
+
// setScrollTop(bodyScrollElem, scrollTop)
|
|
10077
|
+
// setScrollTop(leftScrollElem, scrollTop)
|
|
10078
|
+
// setScrollTop(rightScrollElem, scrollTop)
|
|
10079
|
+
// loadScrollYData(scrollTop)
|
|
10080
|
+
// $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
10081
|
+
// type: 'footer',
|
|
10082
|
+
// fixed: ''
|
|
10083
|
+
// })
|
|
10084
|
+
}
|
|
10085
|
+
},
|
|
10086
|
+
triggerVirtualScrollXEvent(evnt) {
|
|
10087
|
+
const {
|
|
10088
|
+
elemStore,
|
|
10089
|
+
inWheelScroll,
|
|
10090
|
+
lastScrollTop,
|
|
10091
|
+
inHeaderScroll,
|
|
10092
|
+
inBodyScroll,
|
|
10093
|
+
inFooterScroll
|
|
10094
|
+
} = internalData;
|
|
10095
|
+
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
10096
|
+
return;
|
|
10097
|
+
}
|
|
10098
|
+
if (inWheelScroll) {
|
|
10099
|
+
return;
|
|
10100
|
+
}
|
|
10101
|
+
const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
|
|
10102
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
10103
|
+
const footerScrollElem = (0, _util.getRefElem)(elemStore['main-footer-scroll']);
|
|
10104
|
+
const yHandleEl = refScrollYHandleElem.value;
|
|
10105
|
+
const wrapperEl = evnt.currentTarget;
|
|
10106
|
+
const {
|
|
10107
|
+
scrollLeft
|
|
10108
|
+
} = wrapperEl;
|
|
10109
|
+
const yBodyEl = yHandleEl || bodyScrollElem;
|
|
10110
|
+
let scrollTop = 0;
|
|
10111
|
+
if (yBodyEl) {
|
|
10112
|
+
scrollTop = yBodyEl.scrollTop;
|
|
10113
|
+
}
|
|
10114
|
+
const isRollX = true;
|
|
10115
|
+
const isRollY = scrollTop !== lastScrollTop;
|
|
10116
|
+
internalData.inVirtualScroll = true;
|
|
10117
|
+
(0, _dom.setScrollLeft)(bodyScrollElem, scrollLeft);
|
|
10118
|
+
(0, _dom.setScrollLeft)(headerScrollElem, scrollLeft);
|
|
10119
|
+
(0, _dom.setScrollLeft)(footerScrollElem, scrollLeft);
|
|
10120
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
10121
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
10122
|
+
type: 'table',
|
|
10123
|
+
fixed: ''
|
|
10124
|
+
});
|
|
10125
|
+
},
|
|
10126
|
+
triggerVirtualScrollYEvent(evnt) {
|
|
10127
|
+
const {
|
|
10128
|
+
elemStore,
|
|
10129
|
+
inWheelScroll,
|
|
10130
|
+
lastScrollLeft,
|
|
10131
|
+
inHeaderScroll,
|
|
10132
|
+
inBodyScroll,
|
|
10133
|
+
inFooterScroll
|
|
10134
|
+
} = internalData;
|
|
10135
|
+
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
10136
|
+
return;
|
|
10137
|
+
}
|
|
10138
|
+
if (inWheelScroll) {
|
|
10139
|
+
return;
|
|
10140
|
+
}
|
|
10141
|
+
const leftScrollElem = (0, _util.getRefElem)(elemStore['left-body-scroll']);
|
|
10142
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
10143
|
+
const rightScrollElem = (0, _util.getRefElem)(elemStore['right-body-scroll']);
|
|
10144
|
+
const xHandleEl = refScrollXHandleElem.value;
|
|
10145
|
+
const wrapperEl = evnt.currentTarget;
|
|
10146
|
+
const {
|
|
10147
|
+
scrollTop
|
|
10148
|
+
} = wrapperEl;
|
|
10149
|
+
const xBodyEl = xHandleEl || bodyScrollElem;
|
|
10150
|
+
let scrollLeft = 0;
|
|
10151
|
+
if (xBodyEl) {
|
|
10152
|
+
scrollLeft = xBodyEl.scrollLeft;
|
|
9610
10153
|
}
|
|
10154
|
+
const isRollX = scrollLeft !== lastScrollLeft;
|
|
10155
|
+
const isRollY = true;
|
|
10156
|
+
internalData.inVirtualScroll = true;
|
|
10157
|
+
(0, _dom.setScrollTop)(bodyScrollElem, scrollTop);
|
|
10158
|
+
(0, _dom.setScrollTop)(leftScrollElem, scrollTop);
|
|
10159
|
+
(0, _dom.setScrollTop)(rightScrollElem, scrollTop);
|
|
10160
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
10161
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
10162
|
+
type: 'table',
|
|
10163
|
+
fixed: ''
|
|
10164
|
+
});
|
|
9611
10165
|
},
|
|
9612
10166
|
/**
|
|
9613
10167
|
* 对于树形结构中,可以直接滚动到指定深层节点中
|
|
@@ -9696,45 +10250,43 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
9696
10250
|
// 更新纵向 Y 可视渲染上下剩余空间大小
|
|
9697
10251
|
updateScrollYSpace() {
|
|
9698
10252
|
const {
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
const {
|
|
9702
|
-
scrollYLoad,
|
|
9703
|
-
rowHeight
|
|
10253
|
+
isAllOverflow,
|
|
10254
|
+
scrollYLoad
|
|
9704
10255
|
} = reactData;
|
|
9705
10256
|
const {
|
|
9706
10257
|
scrollYStore,
|
|
9707
10258
|
elemStore,
|
|
10259
|
+
isResizeCellHeight,
|
|
9708
10260
|
afterFullData,
|
|
9709
10261
|
fullAllDataRowIdData
|
|
9710
10262
|
} = internalData;
|
|
9711
10263
|
const {
|
|
9712
10264
|
startIndex
|
|
9713
10265
|
} = scrollYStore;
|
|
10266
|
+
const rowOpts = computeRowOpts.value;
|
|
10267
|
+
const cellOpts = computeCellOpts.value;
|
|
10268
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
9714
10269
|
const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
|
|
9715
10270
|
const containerList = ['main', 'left', 'right'];
|
|
9716
10271
|
let topSpaceHeight = 0;
|
|
9717
10272
|
let ySpaceHeight = 0;
|
|
9718
10273
|
if (scrollYLoad) {
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
10274
|
+
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
|
|
10275
|
+
if (!isCustomCellHeight && isAllOverflow) {
|
|
10276
|
+
ySpaceHeight = afterFullData.length * defaultRowHeight;
|
|
10277
|
+
topSpaceHeight = Math.max(0, startIndex * defaultRowHeight);
|
|
9722
10278
|
} else {
|
|
9723
10279
|
for (let i = 0; i < afterFullData.length; i++) {
|
|
9724
10280
|
const row = afterFullData[i];
|
|
9725
10281
|
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
9726
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
9727
|
-
|
|
9728
|
-
ySpaceHeight += rowRest.height || rowHeight;
|
|
9729
|
-
}
|
|
10282
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
10283
|
+
ySpaceHeight += rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
9730
10284
|
}
|
|
9731
10285
|
for (let i = 0; i < startIndex; i++) {
|
|
9732
10286
|
const row = afterFullData[i];
|
|
9733
10287
|
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
9734
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
9735
|
-
|
|
9736
|
-
topSpaceHeight += rowRest.height || rowHeight;
|
|
9737
|
-
}
|
|
10288
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
10289
|
+
topSpaceHeight += rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight;
|
|
9738
10290
|
}
|
|
9739
10291
|
}
|
|
9740
10292
|
} else {
|
|
@@ -9759,30 +10311,26 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
9759
10311
|
if (scrollYSpaceEl) {
|
|
9760
10312
|
scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
|
|
9761
10313
|
}
|
|
9762
|
-
(0, _vue.nextTick)(() => {
|
|
10314
|
+
return (0, _vue.nextTick)().then(() => {
|
|
9763
10315
|
updateStyle();
|
|
9764
10316
|
});
|
|
9765
10317
|
},
|
|
9766
10318
|
updateScrollXData() {
|
|
9767
10319
|
const {
|
|
9768
|
-
|
|
9769
|
-
} =
|
|
10320
|
+
isAllOverflow
|
|
10321
|
+
} = reactData;
|
|
9770
10322
|
handleTableColumn();
|
|
9771
|
-
// calcCellHeight()
|
|
9772
10323
|
return (0, _vue.nextTick)().then(() => {
|
|
9773
|
-
// calcCellHeight()
|
|
9774
10324
|
handleTableColumn();
|
|
9775
10325
|
$xeTable.updateScrollXSpace();
|
|
9776
|
-
if (!
|
|
10326
|
+
if (!isAllOverflow) {
|
|
9777
10327
|
$xeTable.updateScrollYSpace();
|
|
9778
10328
|
}
|
|
9779
10329
|
});
|
|
9780
10330
|
},
|
|
9781
10331
|
updateScrollYData() {
|
|
9782
10332
|
$xeTable.handleTableData();
|
|
9783
|
-
// calcCellHeight()
|
|
9784
10333
|
return (0, _vue.nextTick)().then(() => {
|
|
9785
|
-
// calcCellHeight()
|
|
9786
10334
|
$xeTable.handleTableData();
|
|
9787
10335
|
$xeTable.updateScrollYSpace();
|
|
9788
10336
|
});
|
|
@@ -10009,12 +10557,108 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
10009
10557
|
}
|
|
10010
10558
|
return renderEmptyElement($xeTable);
|
|
10011
10559
|
};
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10560
|
+
const renderScrollX = () => {
|
|
10561
|
+
return (0, _vue.h)('div', {
|
|
10562
|
+
key: 'vsx',
|
|
10563
|
+
ref: refScrollXVirtualElem,
|
|
10564
|
+
class: 'vxe-table--scroll-x-virtual'
|
|
10565
|
+
}, [(0, _vue.h)('div', {
|
|
10566
|
+
ref: refScrollXLeftCornerElem,
|
|
10567
|
+
class: 'vxe-table--scroll-x-left-corner'
|
|
10568
|
+
}), (0, _vue.h)('div', {
|
|
10569
|
+
ref: refScrollXWrapperElem,
|
|
10570
|
+
class: 'vxe-table--scroll-x-wrapper'
|
|
10571
|
+
}, [(0, _vue.h)('div', {
|
|
10572
|
+
ref: refScrollXHandleElem,
|
|
10573
|
+
class: 'vxe-table--scroll-x-handle',
|
|
10574
|
+
onScroll: $xeTable.triggerVirtualScrollXEvent
|
|
10575
|
+
}, [(0, _vue.h)('div', {
|
|
10576
|
+
ref: refScrollXSpaceElem,
|
|
10577
|
+
class: 'vxe-table--scroll-x-space'
|
|
10578
|
+
})])]), (0, _vue.h)('div', {
|
|
10579
|
+
ref: refScrollXRightCornerElem,
|
|
10580
|
+
class: 'vxe-table--scroll-x-right-corner'
|
|
10581
|
+
})]);
|
|
10582
|
+
};
|
|
10583
|
+
const renderScrollY = () => {
|
|
10584
|
+
return (0, _vue.h)('div', {
|
|
10585
|
+
ref: refScrollYVirtualElem,
|
|
10586
|
+
class: 'vxe-table--scroll-y-virtual'
|
|
10587
|
+
}, [(0, _vue.h)('div', {
|
|
10588
|
+
ref: refScrollYTopCornerElem,
|
|
10589
|
+
class: 'vxe-table--scroll-y-top-corner'
|
|
10590
|
+
}), (0, _vue.h)('div', {
|
|
10591
|
+
ref: refScrollYWrapperElem,
|
|
10592
|
+
class: 'vxe-table--scroll-y-wrapper'
|
|
10593
|
+
}, [(0, _vue.h)('div', {
|
|
10594
|
+
ref: refScrollYHandleElem,
|
|
10595
|
+
class: 'vxe-table--scroll-y-handle',
|
|
10596
|
+
onScroll: $xeTable.triggerVirtualScrollYEvent
|
|
10597
|
+
}, [(0, _vue.h)('div', {
|
|
10598
|
+
ref: refScrollYSpaceElem,
|
|
10599
|
+
class: 'vxe-table--scroll-y-space'
|
|
10600
|
+
})])]), (0, _vue.h)('div', {
|
|
10601
|
+
ref: refScrollYBottomCornerElem,
|
|
10602
|
+
class: 'vxe-table--scroll-y-bottom-corner'
|
|
10603
|
+
})]);
|
|
10604
|
+
};
|
|
10605
|
+
const renderViewport = () => {
|
|
10606
|
+
const {
|
|
10607
|
+
showHeader,
|
|
10608
|
+
showFooter
|
|
10609
|
+
} = props;
|
|
10610
|
+
const {
|
|
10611
|
+
overflowX,
|
|
10612
|
+
tableData,
|
|
10613
|
+
tableColumn,
|
|
10614
|
+
tableGroupColumn,
|
|
10615
|
+
footerTableData,
|
|
10616
|
+
columnStore
|
|
10617
|
+
} = reactData;
|
|
10618
|
+
const {
|
|
10619
|
+
leftList,
|
|
10620
|
+
rightList
|
|
10621
|
+
} = columnStore;
|
|
10622
|
+
return (0, _vue.h)('div', {
|
|
10623
|
+
ref: refTableViewportElem,
|
|
10624
|
+
class: 'vxe-table--viewport-wrapper'
|
|
10625
|
+
}, [(0, _vue.h)('div', {
|
|
10626
|
+
class: 'vxe-table--main-wrapper'
|
|
10627
|
+
}, [
|
|
10628
|
+
/**
|
|
10629
|
+
* 表头
|
|
10630
|
+
*/
|
|
10631
|
+
showHeader ? (0, _vue.h)(_header.default, {
|
|
10632
|
+
ref: refTableHeader,
|
|
10633
|
+
tableData,
|
|
10634
|
+
tableColumn,
|
|
10635
|
+
tableGroupColumn
|
|
10636
|
+
}) : renderEmptyElement($xeTable),
|
|
10637
|
+
/**
|
|
10638
|
+
* 表体
|
|
10639
|
+
*/
|
|
10640
|
+
(0, _vue.h)(_body.default, {
|
|
10641
|
+
ref: refTableBody,
|
|
10642
|
+
tableData,
|
|
10643
|
+
tableColumn
|
|
10644
|
+
}),
|
|
10645
|
+
/**
|
|
10646
|
+
* 表尾
|
|
10647
|
+
*/
|
|
10648
|
+
showFooter ? (0, _vue.h)(_footer.default, {
|
|
10649
|
+
ref: refTableFooter,
|
|
10650
|
+
footerTableData,
|
|
10651
|
+
tableColumn
|
|
10652
|
+
}) : renderEmptyElement($xeTable)]), (0, _vue.h)('div', {
|
|
10653
|
+
class: 'vxe-table--fixed-wrapper'
|
|
10654
|
+
}, [leftList && leftList.length && overflowX ? renderFixed('left') : renderEmptyElement($xeTable), rightList && rightList.length && overflowX ? renderFixed('right') : renderEmptyElement($xeTable)])]);
|
|
10655
|
+
};
|
|
10656
|
+
const renderBody = () => {
|
|
10657
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value;
|
|
10658
|
+
return (0, _vue.h)('div', {
|
|
10659
|
+
class: 'vxe-table--layout-wrapper'
|
|
10660
|
+
}, scrollbarYToLeft ? [renderScrollY(), renderViewport()] : [renderViewport(), renderScrollY()]);
|
|
10661
|
+
};
|
|
10018
10662
|
const renderVN = () => {
|
|
10019
10663
|
const {
|
|
10020
10664
|
loading,
|
|
@@ -10031,29 +10675,24 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
10031
10675
|
editRules
|
|
10032
10676
|
} = props;
|
|
10033
10677
|
const {
|
|
10034
|
-
isCalcColumn,
|
|
10035
10678
|
isGroup,
|
|
10036
10679
|
overflowX,
|
|
10037
10680
|
overflowY,
|
|
10038
10681
|
scrollXLoad,
|
|
10039
10682
|
scrollYLoad,
|
|
10040
|
-
scrollbarHeight,
|
|
10041
10683
|
tableData,
|
|
10042
|
-
tableColumn,
|
|
10043
|
-
tableGroupColumn,
|
|
10044
|
-
footerTableData,
|
|
10045
10684
|
initStore,
|
|
10046
10685
|
columnStore,
|
|
10047
10686
|
filterStore,
|
|
10048
|
-
customStore
|
|
10049
|
-
tooltipStore
|
|
10687
|
+
customStore
|
|
10050
10688
|
} = reactData;
|
|
10051
10689
|
const {
|
|
10052
10690
|
leftList,
|
|
10053
10691
|
rightList
|
|
10054
10692
|
} = columnStore;
|
|
10055
10693
|
const loadingSlot = slots.loading;
|
|
10056
|
-
const
|
|
10694
|
+
const tableTipConfig = computeTableTipConfig.value;
|
|
10695
|
+
const validTipConfig = computeValidTipConfig.value;
|
|
10057
10696
|
const validOpts = computeValidOpts.value;
|
|
10058
10697
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
10059
10698
|
const treeOpts = computeTreeOpts.value;
|
|
@@ -10069,9 +10708,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
10069
10708
|
const resizableOpts = computeResizableOpts.value;
|
|
10070
10709
|
const isArea = mouseConfig && mouseOpts.area;
|
|
10071
10710
|
const columnDragOpts = computeColumnDragOpts.value;
|
|
10711
|
+
const scrollbarXToTop = computeScrollbarXToTop.value;
|
|
10712
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value;
|
|
10072
10713
|
return (0, _vue.h)('div', {
|
|
10073
10714
|
ref: refElem,
|
|
10074
|
-
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, {
|
|
10715
|
+
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
|
|
10075
10716
|
[`size--${vSize}`]: vSize,
|
|
10076
10717
|
[`valid-msg--${validOpts.msgMode}`]: !!editRules,
|
|
10077
10718
|
'vxe-editable': !!editConfig,
|
|
@@ -10084,7 +10725,6 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
10084
10725
|
'row--highlight': rowOpts.isHover || highlightHoverRow,
|
|
10085
10726
|
'column--highlight': columnOpts.isHover || highlightHoverColumn,
|
|
10086
10727
|
'checkbox--range': checkboxOpts.range,
|
|
10087
|
-
'column--calc': isCalcColumn,
|
|
10088
10728
|
'col--drag-cell': columnOpts.drag && columnDragOpts.trigger === 'cell',
|
|
10089
10729
|
'is--header': showHeader,
|
|
10090
10730
|
'is--footer': showFooter,
|
|
@@ -10093,7 +10733,6 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
10093
10733
|
'is--fixed-left': leftList.length,
|
|
10094
10734
|
'is--fixed-right': rightList.length,
|
|
10095
10735
|
'is--animat': !!props.animat,
|
|
10096
|
-
'is--padding': props.padding,
|
|
10097
10736
|
'is--round': props.round,
|
|
10098
10737
|
'is--stripe': !treeConfig && stripe,
|
|
10099
10738
|
'is--loading': currLoading,
|
|
@@ -10114,69 +10753,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
10114
10753
|
}, slots.default ? slots.default({}) : []), (0, _vue.h)('div', {
|
|
10115
10754
|
key: 'tw',
|
|
10116
10755
|
class: 'vxe-table--render-wrapper'
|
|
10117
|
-
}, [(
|
|
10118
|
-
ref: refTableViewportElem,
|
|
10119
|
-
class: 'vxe-table--viewport-wrapper'
|
|
10120
|
-
}, [(0, _vue.h)('div', {
|
|
10121
|
-
class: 'vxe-table--main-wrapper'
|
|
10122
|
-
}, [
|
|
10123
|
-
/**
|
|
10124
|
-
* 表头
|
|
10125
|
-
*/
|
|
10126
|
-
showHeader ? (0, _vue.h)(_header.default, {
|
|
10127
|
-
ref: refTableHeader,
|
|
10128
|
-
tableData,
|
|
10129
|
-
tableColumn,
|
|
10130
|
-
tableGroupColumn
|
|
10131
|
-
}) : renderEmptyElement($xeTable),
|
|
10132
|
-
/**
|
|
10133
|
-
* 表体
|
|
10134
|
-
*/
|
|
10135
|
-
(0, _vue.h)(_body.default, {
|
|
10136
|
-
ref: refTableBody,
|
|
10137
|
-
tableData,
|
|
10138
|
-
tableColumn
|
|
10139
|
-
}),
|
|
10140
|
-
/**
|
|
10141
|
-
* 表尾
|
|
10142
|
-
*/
|
|
10143
|
-
showFooter ? (0, _vue.h)(_footer.default, {
|
|
10144
|
-
ref: refTableFooter,
|
|
10145
|
-
footerTableData,
|
|
10146
|
-
tableColumn
|
|
10147
|
-
}) : renderEmptyElement($xeTable)]), (0, _vue.h)('div', {
|
|
10148
|
-
class: 'vxe-table--fixed-wrapper'
|
|
10149
|
-
}, [leftList && leftList.length && overflowX ? renderFixed('left') : renderEmptyElement($xeTable), rightList && rightList.length && overflowX ? renderFixed('right') : renderEmptyElement($xeTable)])]), (0, _vue.h)('div', {
|
|
10150
|
-
ref: refScrollYVirtualElem,
|
|
10151
|
-
class: 'vxe-table--scroll-y-virtual'
|
|
10152
|
-
}, [(0, _vue.h)('div', {
|
|
10153
|
-
ref: refScrollYTopCornerElem,
|
|
10154
|
-
class: 'vxe-table--scroll-y-top-corner'
|
|
10155
|
-
}), (0, _vue.h)('div', {
|
|
10156
|
-
ref: refScrollYHandleElem,
|
|
10157
|
-
class: 'vxe-table--scroll-y-handle',
|
|
10158
|
-
onScroll: scrollYEvent
|
|
10159
|
-
}, [(0, _vue.h)('div', {
|
|
10160
|
-
ref: refScrollYSpaceElem,
|
|
10161
|
-
class: 'vxe-table--scroll-y-space'
|
|
10162
|
-
})]), (0, _vue.h)('div', {
|
|
10163
|
-
ref: refScrollYBottomCornerElem,
|
|
10164
|
-
class: 'vxe-table--scroll-y-bottom-corner'
|
|
10165
|
-
})])]), (0, _vue.h)('div', {
|
|
10166
|
-
key: 'vx',
|
|
10167
|
-
ref: refScrollXVirtualElem,
|
|
10168
|
-
class: 'vxe-table--scroll-x-virtual'
|
|
10169
|
-
}, [(0, _vue.h)('div', {
|
|
10170
|
-
ref: refScrollXHandleElem,
|
|
10171
|
-
class: 'vxe-table--scroll-x-handle',
|
|
10172
|
-
onScroll: scrollXEvent
|
|
10173
|
-
}, [(0, _vue.h)('div', {
|
|
10174
|
-
ref: refScrollXSpaceElem,
|
|
10175
|
-
class: 'vxe-table--scroll-x-space'
|
|
10176
|
-
})]), (0, _vue.h)('div', {
|
|
10177
|
-
ref: refScrollXRightCornerElem,
|
|
10178
|
-
class: 'vxe-table--scroll-x-right-corner'
|
|
10179
|
-
})]),
|
|
10756
|
+
}, scrollbarXToTop ? [renderScrollX(), renderBody()] : [renderBody(), renderScrollX()]),
|
|
10180
10757
|
/**
|
|
10181
10758
|
* 空数据
|
|
10182
10759
|
*/
|
|
@@ -10198,14 +10775,20 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
10198
10775
|
* 列宽线
|
|
10199
10776
|
*/
|
|
10200
10777
|
(0, _vue.h)('div', {
|
|
10201
|
-
key: '
|
|
10202
|
-
ref:
|
|
10203
|
-
class: 'vxe-table--resizable-bar'
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10778
|
+
key: 'tcl',
|
|
10779
|
+
ref: refColResizeBar,
|
|
10780
|
+
class: 'vxe-table--resizable-col-bar'
|
|
10781
|
+
}, resizableOpts.showDragTip ? [(0, _vue.h)('div', {
|
|
10782
|
+
class: 'vxe-table--resizable-number-tip'
|
|
10783
|
+
})] : []),
|
|
10784
|
+
/**
|
|
10785
|
+
* 行高线
|
|
10786
|
+
*/
|
|
10787
|
+
(0, _vue.h)('div', {
|
|
10788
|
+
key: 'trl',
|
|
10789
|
+
ref: refRowResizeBar,
|
|
10790
|
+
class: 'vxe-table--resizable-row-bar'
|
|
10207
10791
|
}, resizableOpts.showDragTip ? [(0, _vue.h)('div', {
|
|
10208
|
-
ref: refCellResizeTip,
|
|
10209
10792
|
class: 'vxe-table--resizable-number-tip'
|
|
10210
10793
|
})] : []),
|
|
10211
10794
|
/**
|
|
@@ -10291,22 +10874,28 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
10291
10874
|
/**
|
|
10292
10875
|
* 工具提示
|
|
10293
10876
|
*/
|
|
10294
|
-
(0, _vue.h)(VxeUITooltipComponent,
|
|
10877
|
+
(0, _vue.h)(VxeUITooltipComponent, {
|
|
10295
10878
|
key: 'btp',
|
|
10296
|
-
ref: refTooltip
|
|
10297
|
-
|
|
10879
|
+
ref: refTooltip,
|
|
10880
|
+
theme: tableTipConfig.theme,
|
|
10881
|
+
enterable: tableTipConfig.enterable,
|
|
10882
|
+
enterDelay: tableTipConfig.enterDelay,
|
|
10883
|
+
leaveDelay: tableTipConfig.leaveDelay
|
|
10884
|
+
}),
|
|
10298
10885
|
/**
|
|
10299
10886
|
* 校验提示
|
|
10300
10887
|
*/
|
|
10301
|
-
props.editRules && validOpts.showMessage && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip') ? (0, _vue.h)(VxeUITooltipComponent,
|
|
10888
|
+
props.editRules && validOpts.showMessage && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip') ? (0, _vue.h)(VxeUITooltipComponent, {
|
|
10302
10889
|
key: 'vtp',
|
|
10303
10890
|
ref: refValidTooltip,
|
|
10304
10891
|
class: [{
|
|
10305
10892
|
'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete'
|
|
10306
|
-
}, 'vxe-table--valid-error']
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10893
|
+
}, 'vxe-table--valid-error'],
|
|
10894
|
+
theme: validTipConfig.theme,
|
|
10895
|
+
enterable: validTipConfig.enterable,
|
|
10896
|
+
enterDelay: validTipConfig.enterDelay,
|
|
10897
|
+
leaveDelay: validTipConfig.leaveDelay
|
|
10898
|
+
}) : renderEmptyElement($xeTable)]) : renderEmptyElement($xeTable)]);
|
|
10310
10899
|
};
|
|
10311
10900
|
const dataFlag = (0, _vue.ref)(0);
|
|
10312
10901
|
(0, _vue.watch)(() => props.data ? props.data.length : -1, () => {
|
|
@@ -10323,7 +10912,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
10323
10912
|
if (value && value.length >= 50000) {
|
|
10324
10913
|
(0, _log.warnLog)('vxe.error.errLargeData', ['loadData(data), reloadData(data)']);
|
|
10325
10914
|
}
|
|
10326
|
-
loadTableData(value).then(() => {
|
|
10915
|
+
loadTableData(value, true).then(() => {
|
|
10327
10916
|
const {
|
|
10328
10917
|
scrollXLoad,
|
|
10329
10918
|
scrollYLoad,
|
|
@@ -10375,16 +10964,37 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
10375
10964
|
tableMethods.refreshColumn();
|
|
10376
10965
|
});
|
|
10377
10966
|
});
|
|
10967
|
+
const reScrollFlag = (0, _vue.ref)(0);
|
|
10968
|
+
(0, _vue.watch)(computeSize, () => {
|
|
10969
|
+
reScrollFlag.value++;
|
|
10970
|
+
});
|
|
10378
10971
|
(0, _vue.watch)(() => props.showHeader, () => {
|
|
10379
|
-
|
|
10380
|
-
tableMethods.recalculate(true).then(() => tableMethods.refreshScroll());
|
|
10381
|
-
});
|
|
10972
|
+
reScrollFlag.value++;
|
|
10382
10973
|
});
|
|
10383
10974
|
(0, _vue.watch)(() => props.showFooter, () => {
|
|
10975
|
+
reScrollFlag.value++;
|
|
10976
|
+
});
|
|
10977
|
+
(0, _vue.watch)(reScrollFlag, () => {
|
|
10384
10978
|
(0, _vue.nextTick)(() => {
|
|
10385
10979
|
tableMethods.recalculate(true).then(() => tableMethods.refreshScroll());
|
|
10386
10980
|
});
|
|
10387
10981
|
});
|
|
10982
|
+
const reLayoutFlag = (0, _vue.ref)(0);
|
|
10983
|
+
(0, _vue.watch)(() => props.height, () => {
|
|
10984
|
+
reLayoutFlag.value++;
|
|
10985
|
+
});
|
|
10986
|
+
(0, _vue.watch)(() => props.maxHeight, () => {
|
|
10987
|
+
reLayoutFlag.value++;
|
|
10988
|
+
});
|
|
10989
|
+
(0, _vue.watch)(computeScrollbarXToTop, () => {
|
|
10990
|
+
reLayoutFlag.value++;
|
|
10991
|
+
});
|
|
10992
|
+
(0, _vue.watch)(computeScrollbarYToLeft, () => {
|
|
10993
|
+
reLayoutFlag.value++;
|
|
10994
|
+
});
|
|
10995
|
+
(0, _vue.watch)(reLayoutFlag, () => {
|
|
10996
|
+
(0, _vue.nextTick)(() => tableMethods.recalculate(true));
|
|
10997
|
+
});
|
|
10388
10998
|
const footFlag = (0, _vue.ref)(0);
|
|
10389
10999
|
(0, _vue.watch)(() => props.footerData ? props.footerData.length : -1, () => {
|
|
10390
11000
|
footFlag.value++;
|
|
@@ -10395,23 +11005,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
10395
11005
|
(0, _vue.watch)(footFlag, () => {
|
|
10396
11006
|
tableMethods.updateFooter();
|
|
10397
11007
|
});
|
|
10398
|
-
(0, _vue.watch)(() => props.height, () => {
|
|
10399
|
-
(0, _vue.nextTick)(() => tableMethods.recalculate(true));
|
|
10400
|
-
});
|
|
10401
|
-
(0, _vue.watch)(() => props.maxHeight, () => {
|
|
10402
|
-
(0, _vue.nextTick)(() => tableMethods.recalculate(true));
|
|
10403
|
-
});
|
|
10404
|
-
(0, _vue.watch)(computeSize, () => {
|
|
10405
|
-
(0, _vue.nextTick)(() => {
|
|
10406
|
-
tableMethods.recalculate(true).then(() => tableMethods.refreshScroll());
|
|
10407
|
-
});
|
|
10408
|
-
});
|
|
10409
11008
|
(0, _vue.watch)(() => props.syncResize, value => {
|
|
10410
11009
|
if (value) {
|
|
10411
|
-
|
|
11010
|
+
handleUpdateResize();
|
|
10412
11011
|
(0, _vue.nextTick)(() => {
|
|
10413
|
-
|
|
10414
|
-
setTimeout(() =>
|
|
11012
|
+
handleUpdateResize();
|
|
11013
|
+
setTimeout(() => handleUpdateResize());
|
|
10415
11014
|
});
|
|
10416
11015
|
}
|
|
10417
11016
|
});
|
|
@@ -10526,6 +11125,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
10526
11125
|
if (props.showFooter && !(props.footerMethod || props.footerData)) {
|
|
10527
11126
|
(0, _log.warnLog)('vxe.error.reqProp', ['footer-data | footer-method']);
|
|
10528
11127
|
}
|
|
11128
|
+
if (rowOpts.height) {
|
|
11129
|
+
(0, _log.warnLog)('vxe.error.delProp', ['row-config.height', 'cell-config.height']);
|
|
11130
|
+
}
|
|
10529
11131
|
// if (props.highlightCurrentRow) {
|
|
10530
11132
|
// warnLog('vxe.error.delProp', ['highlight-current-row', 'row-config.isCurrent'])
|
|
10531
11133
|
// }
|
|
@@ -10636,7 +11238,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
10636
11238
|
endIndex: 0,
|
|
10637
11239
|
visibleSize: 0
|
|
10638
11240
|
});
|
|
10639
|
-
loadTableData(data || []).then(() => {
|
|
11241
|
+
loadTableData(data || [], true).then(() => {
|
|
10640
11242
|
if (data && data.length) {
|
|
10641
11243
|
internalData.inited = true;
|
|
10642
11244
|
internalData.initStatus = true;
|