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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, h, ComponentPublicInstance, reactive, ref, Ref, provide, inject, nextTick, onActivated, onDeactivated, onBeforeUnmount, onUnmounted, watch, computed, onMounted } from 'vue'
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
|
-
import { browse, initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft } from '../../ui/src/dom'
|
|
3
|
+
import { browse, initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, getOffsetPos, setScrollTop, setScrollLeft } from '../../ui/src/dom'
|
|
4
4
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils'
|
|
5
5
|
import { VxeUI } from '../../ui'
|
|
6
6
|
import Cell from './cell'
|
|
@@ -43,7 +43,6 @@ export default defineComponent({
|
|
|
43
43
|
const { computeSize } = useFns.useSize(props)
|
|
44
44
|
|
|
45
45
|
const reactData = reactive<TableReactData>({
|
|
46
|
-
isCalcColumn: false,
|
|
47
46
|
// 低性能的静态列
|
|
48
47
|
staticColumns: [],
|
|
49
48
|
// 渲染的列分组
|
|
@@ -258,7 +257,8 @@ export default defineComponent({
|
|
|
258
257
|
|
|
259
258
|
scrollVMLoading: false,
|
|
260
259
|
|
|
261
|
-
|
|
260
|
+
calcCellHeightFlag: 0,
|
|
261
|
+
resizeHeightFlag: 0,
|
|
262
262
|
|
|
263
263
|
isCustomStatus: false,
|
|
264
264
|
|
|
@@ -268,7 +268,7 @@ export default defineComponent({
|
|
|
268
268
|
dragCol: null,
|
|
269
269
|
dragTipText: '',
|
|
270
270
|
|
|
271
|
-
|
|
271
|
+
isDragResize: false,
|
|
272
272
|
isLoading: false
|
|
273
273
|
})
|
|
274
274
|
|
|
@@ -344,10 +344,6 @@ export default defineComponent({
|
|
|
344
344
|
fullDataRowIdData: {},
|
|
345
345
|
fullColumnIdData: {},
|
|
346
346
|
fullColumnFieldData: {},
|
|
347
|
-
// 列选取状态
|
|
348
|
-
columnStatusMaps: {},
|
|
349
|
-
// 行选取状态
|
|
350
|
-
rowStatusMaps: {},
|
|
351
347
|
// prevDragRow: null,
|
|
352
348
|
|
|
353
349
|
inited: false,
|
|
@@ -380,8 +376,8 @@ export default defineComponent({
|
|
|
380
376
|
|
|
381
377
|
const refLeftContainer = ref() as Ref<HTMLDivElement>
|
|
382
378
|
const refRightContainer = ref() as Ref<HTMLDivElement>
|
|
383
|
-
const
|
|
384
|
-
const
|
|
379
|
+
const refColResizeBar = ref() as Ref<HTMLDivElement>
|
|
380
|
+
const refRowResizeBar = ref() as Ref<HTMLDivElement>
|
|
385
381
|
const refEmptyPlaceholder = ref() as Ref<HTMLDivElement>
|
|
386
382
|
|
|
387
383
|
const refDragTipElem = ref<HTMLDivElement>()
|
|
@@ -391,9 +387,12 @@ export default defineComponent({
|
|
|
391
387
|
const refScrollXVirtualElem = ref<HTMLDivElement>()
|
|
392
388
|
const refScrollYVirtualElem = ref<HTMLDivElement>()
|
|
393
389
|
const refScrollXHandleElem = ref<HTMLDivElement>()
|
|
390
|
+
const refScrollXLeftCornerElem = ref<HTMLDivElement>()
|
|
394
391
|
const refScrollXRightCornerElem = ref<HTMLDivElement>()
|
|
395
392
|
const refScrollYHandleElem = ref<HTMLDivElement>()
|
|
396
393
|
const refScrollYTopCornerElem = ref<HTMLDivElement>()
|
|
394
|
+
const refScrollXWrapperElem = ref<HTMLDivElement>()
|
|
395
|
+
const refScrollYWrapperElem = ref<HTMLDivElement>()
|
|
397
396
|
const refScrollYBottomCornerElem = ref<HTMLDivElement>()
|
|
398
397
|
const refScrollXSpaceElem = ref<HTMLDivElement>()
|
|
399
398
|
const refScrollYSpaceElem = ref<HTMLDivElement>()
|
|
@@ -442,17 +441,27 @@ export default defineComponent({
|
|
|
442
441
|
})
|
|
443
442
|
|
|
444
443
|
const computeVirtualXOpts = computed(() => {
|
|
445
|
-
return Object.assign({}, getConfig().table.scrollX, getConfig().table.virtualXConfig, props.scrollX, props.virtualXConfig)
|
|
444
|
+
return Object.assign({}, getConfig().table.scrollX, getConfig().table.virtualXConfig, props.scrollX, props.virtualXConfig) as VxeTablePropTypes.VirtualXConfig
|
|
446
445
|
})
|
|
447
446
|
|
|
448
447
|
const computeVirtualYOpts = computed(() => {
|
|
449
|
-
return Object.assign({}, getConfig().table.scrollY, getConfig().table.virtualYConfig, props.scrollY, props.virtualYConfig)
|
|
448
|
+
return Object.assign({}, getConfig().table.scrollY, getConfig().table.virtualYConfig, props.scrollY, props.virtualYConfig) as VxeTablePropTypes.VirtualYConfig
|
|
450
449
|
})
|
|
451
450
|
|
|
452
451
|
const computeScrollbarOpts = computed(() => {
|
|
453
452
|
return Object.assign({}, getConfig().table.scrollbarConfig, props.scrollbarConfig)
|
|
454
453
|
})
|
|
455
454
|
|
|
455
|
+
const computeScrollbarXToTop = computed(() => {
|
|
456
|
+
const scrollbarOpts = computeScrollbarOpts.value
|
|
457
|
+
return !!(scrollbarOpts.x && scrollbarOpts.x.position === 'top')
|
|
458
|
+
})
|
|
459
|
+
|
|
460
|
+
const computeScrollbarYToLeft = computed(() => {
|
|
461
|
+
const scrollbarOpts = computeScrollbarOpts.value
|
|
462
|
+
return !!(scrollbarOpts.y && scrollbarOpts.y.position === 'left')
|
|
463
|
+
})
|
|
464
|
+
|
|
456
465
|
const computeScrollYThreshold = computed(() => {
|
|
457
466
|
const sYOpts = computeSYOpts.value
|
|
458
467
|
const { threshold } = sYOpts
|
|
@@ -474,7 +483,7 @@ export default defineComponent({
|
|
|
474
483
|
const computeDefaultRowHeight = computed(() => {
|
|
475
484
|
const vSize = computeSize.value
|
|
476
485
|
const rowHeightMaps = computeRowHeightMaps.value
|
|
477
|
-
return rowHeightMaps[vSize || 'default']
|
|
486
|
+
return rowHeightMaps[vSize || 'default'] || 18
|
|
478
487
|
})
|
|
479
488
|
|
|
480
489
|
const computeColumnOpts = computed(() => {
|
|
@@ -482,7 +491,15 @@ export default defineComponent({
|
|
|
482
491
|
})
|
|
483
492
|
|
|
484
493
|
const computeCellOpts = computed(() => {
|
|
485
|
-
return Object.assign({}, getConfig().table.cellConfig, props.cellConfig)
|
|
494
|
+
return Object.assign({}, getConfig().table.cellConfig, props.cellConfig)
|
|
495
|
+
})
|
|
496
|
+
|
|
497
|
+
const computeHeaderCellOpts = computed(() => {
|
|
498
|
+
return Object.assign({}, getConfig().table.headerCellConfig, props.headerCellConfig)
|
|
499
|
+
})
|
|
500
|
+
|
|
501
|
+
const computeFooterCellOpts = computed(() => {
|
|
502
|
+
return Object.assign({}, getConfig().table.footerCellConfig, props.footerCellConfig)
|
|
486
503
|
})
|
|
487
504
|
|
|
488
505
|
const computeRowOpts = computed(() => {
|
|
@@ -521,6 +538,17 @@ export default defineComponent({
|
|
|
521
538
|
return Object.assign({}, getConfig().tooltip, getConfig().table.tooltipConfig, props.tooltipConfig)
|
|
522
539
|
})
|
|
523
540
|
|
|
541
|
+
const computeTableTipConfig = computed(() => {
|
|
542
|
+
const { tooltipStore } = reactData
|
|
543
|
+
const tooltipOpts = computeTooltipOpts.value
|
|
544
|
+
return Object.assign({}, tooltipOpts, tooltipStore.currOpts)
|
|
545
|
+
})
|
|
546
|
+
|
|
547
|
+
const computeValidTipConfig = computed(() => {
|
|
548
|
+
const tooltipOpts = computeTooltipOpts.value
|
|
549
|
+
return Object.assign({}, tooltipOpts)
|
|
550
|
+
})
|
|
551
|
+
|
|
524
552
|
const computeEditOpts = computed(() => {
|
|
525
553
|
return Object.assign({}, getConfig().table.editConfig, props.editConfig) as VxeTablePropTypes.EditOpts
|
|
526
554
|
})
|
|
@@ -742,8 +770,8 @@ export default defineComponent({
|
|
|
742
770
|
refTableRightFooter,
|
|
743
771
|
refLeftContainer,
|
|
744
772
|
refRightContainer,
|
|
745
|
-
|
|
746
|
-
|
|
773
|
+
refColResizeBar,
|
|
774
|
+
refRowResizeBar,
|
|
747
775
|
refScrollXVirtualElem,
|
|
748
776
|
refScrollYVirtualElem,
|
|
749
777
|
refScrollXHandleElem,
|
|
@@ -759,11 +787,15 @@ export default defineComponent({
|
|
|
759
787
|
computeVirtualXOpts,
|
|
760
788
|
computeVirtualYOpts,
|
|
761
789
|
computeScrollbarOpts,
|
|
790
|
+
computeScrollbarXToTop,
|
|
791
|
+
computeScrollbarYToLeft,
|
|
762
792
|
computeColumnOpts,
|
|
763
793
|
computeScrollXThreshold,
|
|
764
794
|
computeScrollYThreshold,
|
|
765
795
|
computeDefaultRowHeight,
|
|
766
796
|
computeCellOpts,
|
|
797
|
+
computeHeaderCellOpts,
|
|
798
|
+
computeFooterCellOpts,
|
|
767
799
|
computeRowOpts,
|
|
768
800
|
computeRowDragOpts,
|
|
769
801
|
computeColumnDragOpts,
|
|
@@ -905,49 +937,58 @@ export default defineComponent({
|
|
|
905
937
|
}
|
|
906
938
|
|
|
907
939
|
const computeRowHeight = () => {
|
|
940
|
+
const { isAllOverflow } = reactData
|
|
908
941
|
const tableHeader = refTableHeader.value
|
|
909
942
|
const tableBody = refTableBody.value
|
|
910
943
|
const tableBodyElem = tableBody ? tableBody.$el as HTMLDivElement : null
|
|
911
944
|
const defaultRowHeight = computeDefaultRowHeight.value
|
|
912
945
|
let rowHeight = 0
|
|
913
|
-
if (
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
firstTrElem
|
|
946
|
+
if (isAllOverflow) {
|
|
947
|
+
if (tableBodyElem) {
|
|
948
|
+
const tableHeaderElem = tableHeader ? tableHeader.$el as HTMLDivElement : null
|
|
949
|
+
let firstTrElem
|
|
950
|
+
firstTrElem = tableBodyElem.querySelector('tr')
|
|
951
|
+
if (!firstTrElem && tableHeaderElem) {
|
|
952
|
+
firstTrElem = tableHeaderElem.querySelector('tr')
|
|
953
|
+
}
|
|
954
|
+
if (firstTrElem) {
|
|
955
|
+
rowHeight = firstTrElem.clientHeight
|
|
956
|
+
}
|
|
919
957
|
}
|
|
920
|
-
if (
|
|
921
|
-
rowHeight =
|
|
958
|
+
if (!rowHeight) {
|
|
959
|
+
rowHeight = defaultRowHeight
|
|
922
960
|
}
|
|
923
|
-
}
|
|
924
|
-
if (!rowHeight) {
|
|
961
|
+
} else {
|
|
925
962
|
rowHeight = defaultRowHeight
|
|
926
963
|
}
|
|
927
964
|
// 最低支持 18px 行高
|
|
928
965
|
return Math.max(18, rowHeight)
|
|
929
966
|
}
|
|
930
967
|
|
|
931
|
-
const handleVirtualYVisible = () => {
|
|
932
|
-
const {
|
|
933
|
-
const {
|
|
934
|
-
const
|
|
968
|
+
const handleVirtualYVisible = (currScrollTop?: number) => {
|
|
969
|
+
const { isAllOverflow } = reactData
|
|
970
|
+
const { elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData
|
|
971
|
+
const rowOpts = computeRowOpts.value
|
|
972
|
+
const cellOpts = computeCellOpts.value
|
|
973
|
+
const defaultRowHeight = computeDefaultRowHeight.value
|
|
935
974
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
936
975
|
if (bodyScrollElem) {
|
|
937
|
-
const
|
|
976
|
+
const clientHeight = bodyScrollElem.clientHeight
|
|
977
|
+
const scrollTop = XEUtils.isNumber(currScrollTop) ? currScrollTop : bodyScrollElem.scrollTop
|
|
938
978
|
const endHeight = scrollTop + clientHeight
|
|
939
979
|
let toVisibleIndex = -1
|
|
940
980
|
let offsetTop = 0
|
|
941
981
|
let visibleSize = 0
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
982
|
+
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height
|
|
983
|
+
if (!isCustomCellHeight && isAllOverflow) {
|
|
984
|
+
toVisibleIndex = Math.floor(scrollTop / defaultRowHeight)
|
|
985
|
+
visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1
|
|
945
986
|
} else {
|
|
946
987
|
for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
947
988
|
const row = afterFullData[rIndex]
|
|
948
989
|
const rowid = getRowid($xeTable, row)
|
|
949
|
-
const rowRest = fullAllDataRowIdData[rowid]
|
|
950
|
-
offsetTop += rowRest
|
|
990
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
991
|
+
offsetTop += rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight
|
|
951
992
|
if (toVisibleIndex === -1 && scrollTop < offsetTop) {
|
|
952
993
|
toVisibleIndex = rIndex
|
|
953
994
|
}
|
|
@@ -1192,7 +1233,7 @@ export default defineComponent({
|
|
|
1192
1233
|
}
|
|
1193
1234
|
fullColumnFieldData[field] = rest
|
|
1194
1235
|
} else {
|
|
1195
|
-
if (storage || (columnOpts.drag && (isCrossDrag || isSelfToChildDrag))) {
|
|
1236
|
+
if ((storage && !type) || (columnOpts.drag && (isCrossDrag || isSelfToChildDrag))) {
|
|
1196
1237
|
errLog('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field`])
|
|
1197
1238
|
}
|
|
1198
1239
|
}
|
|
@@ -1285,55 +1326,39 @@ export default defineComponent({
|
|
|
1285
1326
|
}
|
|
1286
1327
|
|
|
1287
1328
|
const calcColumnAutoWidth = (column: VxeTableDefines.ColumnInfo, wrapperEl: HTMLDivElement) => {
|
|
1288
|
-
const
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
if (firstCellEl) {
|
|
1292
|
-
const cellStyle = getComputedStyle(firstCellEl)
|
|
1293
|
-
|
|
1294
|
-
}
|
|
1295
|
-
let colWidth = column.renderAutoWidth -
|
|
1296
|
-
|
|
1297
|
-
const
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
XEUtils.arrayEach(cellEl.children, (btnEl) => {
|
|
1302
|
-
titleWidth += (btnEl as HTMLElement).offsetWidth + 1
|
|
1303
|
-
})
|
|
1304
|
-
} else {
|
|
1305
|
-
const labelEl = cellEl.firstElementChild as HTMLElement
|
|
1306
|
-
if (labelEl) {
|
|
1307
|
-
titleWidth = labelEl.offsetWidth
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
if (titleWidth) {
|
|
1311
|
-
colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4)
|
|
1312
|
-
}
|
|
1313
|
-
})
|
|
1314
|
-
return colWidth + paddingSize
|
|
1329
|
+
const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[colid="${column.id}"]`)
|
|
1330
|
+
let leftRightPadding = 0
|
|
1331
|
+
const firstCellEl = cellElemList[0]
|
|
1332
|
+
if (firstCellEl && firstCellEl.parentElement) {
|
|
1333
|
+
const cellStyle = getComputedStyle(firstCellEl.parentElement)
|
|
1334
|
+
leftRightPadding = Math.ceil(XEUtils.toNumber(cellStyle.paddingLeft) + XEUtils.toNumber(cellStyle.paddingRight))
|
|
1335
|
+
}
|
|
1336
|
+
let colWidth = column.renderAutoWidth - leftRightPadding
|
|
1337
|
+
for (let i = 0; i < cellElemList.length; i++) {
|
|
1338
|
+
const celEl = cellElemList[i] as HTMLDivElement
|
|
1339
|
+
colWidth = Math.max(colWidth, celEl ? Math.ceil(celEl.scrollWidth) + 4 : 0)
|
|
1340
|
+
}
|
|
1341
|
+
return colWidth + leftRightPadding
|
|
1315
1342
|
}
|
|
1316
1343
|
|
|
1317
1344
|
const calcCellWidth = () => {
|
|
1318
1345
|
const autoWidthColumnList = computeAutoWidthColumnList.value
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
reactData.isCalcColumn = false
|
|
1336
|
-
})
|
|
1346
|
+
const { fullColumnIdData } = internalData
|
|
1347
|
+
const el = refElem.value
|
|
1348
|
+
if (el) {
|
|
1349
|
+
el.setAttribute('data-calc-col', 'Y')
|
|
1350
|
+
autoWidthColumnList.forEach(column => {
|
|
1351
|
+
const colid = column.id
|
|
1352
|
+
const colRest = fullColumnIdData[colid]
|
|
1353
|
+
const colWidth = calcColumnAutoWidth(column, el)
|
|
1354
|
+
if (colRest) {
|
|
1355
|
+
colRest.width = Math.max(colWidth, colRest.width)
|
|
1356
|
+
}
|
|
1357
|
+
column.renderAutoWidth = colWidth
|
|
1358
|
+
})
|
|
1359
|
+
$xeTable.analyColumnWidth()
|
|
1360
|
+
el.removeAttribute('data-calc-col')
|
|
1361
|
+
}
|
|
1337
1362
|
}
|
|
1338
1363
|
|
|
1339
1364
|
/**
|
|
@@ -1375,39 +1400,39 @@ export default defineComponent({
|
|
|
1375
1400
|
})
|
|
1376
1401
|
// 最小自适应
|
|
1377
1402
|
autoMinList.forEach((column) => {
|
|
1378
|
-
const
|
|
1379
|
-
tableWidth +=
|
|
1380
|
-
column.renderWidth =
|
|
1403
|
+
const caWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth))
|
|
1404
|
+
tableWidth += caWidth
|
|
1405
|
+
column.renderWidth = caWidth
|
|
1381
1406
|
})
|
|
1382
1407
|
// 最小百分比
|
|
1383
1408
|
scaleMinList.forEach((column) => {
|
|
1384
|
-
const
|
|
1385
|
-
tableWidth +=
|
|
1386
|
-
column.renderWidth =
|
|
1409
|
+
const smWidth = Math.floor(XEUtils.toInteger(column.minWidth) * meanWidth)
|
|
1410
|
+
tableWidth += smWidth
|
|
1411
|
+
column.renderWidth = smWidth
|
|
1387
1412
|
})
|
|
1388
1413
|
// 固定百分比
|
|
1389
1414
|
scaleList.forEach((column) => {
|
|
1390
|
-
const
|
|
1391
|
-
tableWidth +=
|
|
1392
|
-
column.renderWidth =
|
|
1415
|
+
const sfWidth = Math.floor(XEUtils.toInteger(column.width) * meanWidth)
|
|
1416
|
+
tableWidth += sfWidth
|
|
1417
|
+
column.renderWidth = sfWidth
|
|
1393
1418
|
})
|
|
1394
1419
|
// 固定宽
|
|
1395
1420
|
pxList.forEach((column) => {
|
|
1396
|
-
const
|
|
1397
|
-
tableWidth +=
|
|
1398
|
-
column.renderWidth =
|
|
1421
|
+
const pWidth = XEUtils.toInteger(column.width)
|
|
1422
|
+
tableWidth += pWidth
|
|
1423
|
+
column.renderWidth = pWidth
|
|
1399
1424
|
})
|
|
1400
1425
|
// 自适应宽
|
|
1401
1426
|
autoList.forEach((column) => {
|
|
1402
|
-
const
|
|
1403
|
-
tableWidth +=
|
|
1404
|
-
column.renderWidth =
|
|
1427
|
+
const aWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth))
|
|
1428
|
+
tableWidth += aWidth
|
|
1429
|
+
column.renderWidth = aWidth
|
|
1405
1430
|
})
|
|
1406
1431
|
// 调整了列宽
|
|
1407
1432
|
resizeList.forEach((column) => {
|
|
1408
|
-
const
|
|
1409
|
-
tableWidth +=
|
|
1410
|
-
column.renderWidth =
|
|
1433
|
+
const reWidth = XEUtils.toInteger(column.resizeWidth)
|
|
1434
|
+
tableWidth += reWidth
|
|
1435
|
+
column.renderWidth = reWidth
|
|
1411
1436
|
})
|
|
1412
1437
|
remainWidth -= tableWidth
|
|
1413
1438
|
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoMinList.length + remainList.length)) : 0
|
|
@@ -1447,7 +1472,7 @@ export default defineComponent({
|
|
|
1447
1472
|
}
|
|
1448
1473
|
const tableHeight = bodyElem.offsetHeight
|
|
1449
1474
|
const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight
|
|
1450
|
-
reactData.scrollbarWidth =
|
|
1475
|
+
reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth)
|
|
1451
1476
|
reactData.overflowY = overflowY
|
|
1452
1477
|
internalData.tableWidth = tableWidth
|
|
1453
1478
|
internalData.tableHeight = tableHeight
|
|
@@ -1457,7 +1482,7 @@ export default defineComponent({
|
|
|
1457
1482
|
const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0
|
|
1458
1483
|
const overflowX = tableWidth > bodyWidth
|
|
1459
1484
|
const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0
|
|
1460
|
-
reactData.scrollbarHeight =
|
|
1485
|
+
reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight)
|
|
1461
1486
|
internalData.headerHeight = headerHeight
|
|
1462
1487
|
internalData.footerHeight = footerHeight
|
|
1463
1488
|
reactData.overflowX = overflowX
|
|
@@ -1468,58 +1493,37 @@ export default defineComponent({
|
|
|
1468
1493
|
}
|
|
1469
1494
|
}
|
|
1470
1495
|
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
// }
|
|
1496
|
+
const calcCellAutoHeight = (rowRest: VxeTableDefines.RowCacheItem, wrapperEl: HTMLDivElement) => {
|
|
1497
|
+
const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`)
|
|
1498
|
+
let colHeight = rowRest.height
|
|
1499
|
+
for (let i = 0; i < cellElemList.length; i++) {
|
|
1500
|
+
const cellElem = cellElemList[i] as HTMLElement
|
|
1501
|
+
const tdEl = cellElem.parentElement as HTMLTableCellElement
|
|
1502
|
+
const topBottomPadding = Math.ceil(XEUtils.toNumber(tdEl.style.paddingTop) + XEUtils.toNumber(tdEl.style.paddingBottom))
|
|
1503
|
+
const cellHeight = cellElem ? cellElem.clientHeight : 0
|
|
1504
|
+
colHeight = Math.max(colHeight - topBottomPadding, Math.ceil(cellHeight))
|
|
1505
|
+
}
|
|
1506
|
+
return colHeight
|
|
1507
|
+
}
|
|
1484
1508
|
|
|
1485
1509
|
const calcCellHeight = () => {
|
|
1486
|
-
const {
|
|
1487
|
-
const { tableData, scrollXLoad } = reactData
|
|
1510
|
+
const { tableData, isAllOverflow, scrollYLoad, scrollXLoad } = reactData
|
|
1488
1511
|
const { fullAllDataRowIdData } = internalData
|
|
1512
|
+
const defaultRowHeight = computeDefaultRowHeight.value
|
|
1489
1513
|
const el = refElem.value
|
|
1490
|
-
if (!
|
|
1491
|
-
|
|
1492
|
-
let paddingBottom = 0
|
|
1493
|
-
let calcPadding = false
|
|
1514
|
+
if (!isAllOverflow && scrollYLoad && el) {
|
|
1515
|
+
el.setAttribute('data-calc-row', 'Y')
|
|
1494
1516
|
tableData.forEach(row => {
|
|
1495
1517
|
const rowid = getRowid($xeTable, row)
|
|
1496
1518
|
const rowRest = fullAllDataRowIdData[rowid]
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
for (let i = 0; i < cellList.length; i++) {
|
|
1501
|
-
const cellElem = cellList[i] as HTMLElement
|
|
1502
|
-
const tdEl = cellElem.parentElement as HTMLTableCellElement
|
|
1503
|
-
if (!tdEl || !tdEl.clientWidth) {
|
|
1504
|
-
break
|
|
1505
|
-
}
|
|
1506
|
-
if (!calcPadding) {
|
|
1507
|
-
paddingTop = XEUtils.toNumber(getComputedStyle(tdEl).paddingTop)
|
|
1508
|
-
paddingBottom = XEUtils.toNumber(getComputedStyle(tdEl).paddingBottom)
|
|
1509
|
-
calcPadding = true
|
|
1510
|
-
}
|
|
1511
|
-
let cellHeight = paddingTop + paddingBottom
|
|
1512
|
-
if (cellElem) {
|
|
1513
|
-
cellHeight += cellElem.clientHeight
|
|
1514
|
-
}
|
|
1515
|
-
height = Math.max(height, cellHeight)
|
|
1516
|
-
}
|
|
1517
|
-
rowRest.height = scrollXLoad ? Math.max(rowRest.height, height) : height
|
|
1519
|
+
if (rowRest) {
|
|
1520
|
+
const reHeight = calcCellAutoHeight(rowRest, el)
|
|
1521
|
+
rowRest.height = Math.max(defaultRowHeight, scrollXLoad ? Math.max(rowRest.height, reHeight) : reHeight)
|
|
1518
1522
|
}
|
|
1523
|
+
el.removeAttribute('data-calc-row')
|
|
1519
1524
|
})
|
|
1520
|
-
reactData.
|
|
1525
|
+
reactData.calcCellHeightFlag++
|
|
1521
1526
|
}
|
|
1522
|
-
// updateCellOffset()
|
|
1523
1527
|
}
|
|
1524
1528
|
|
|
1525
1529
|
const getOrderField = (column: VxeTableDefines.ColumnInfo) => {
|
|
@@ -1542,14 +1546,35 @@ export default defineComponent({
|
|
|
1542
1546
|
}
|
|
1543
1547
|
}
|
|
1544
1548
|
|
|
1549
|
+
const updateAfterListIndex = () => {
|
|
1550
|
+
const { afterFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData
|
|
1551
|
+
const fullMaps: Record<string, any> = {}
|
|
1552
|
+
afterFullData.forEach((row, index) => {
|
|
1553
|
+
const rowid = getRowid($xeTable, row)
|
|
1554
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
1555
|
+
const seq = index + 1
|
|
1556
|
+
if (rowRest) {
|
|
1557
|
+
rowRest.seq = seq
|
|
1558
|
+
rowRest._index = index
|
|
1559
|
+
} else {
|
|
1560
|
+
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 }
|
|
1561
|
+
fullAllDataRowIdData[rowid] = rest
|
|
1562
|
+
fullDataRowIdData[rowid] = rest
|
|
1563
|
+
}
|
|
1564
|
+
fullMaps[rowid] = row
|
|
1565
|
+
})
|
|
1566
|
+
internalData.afterFullRowMaps = fullMaps
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1545
1569
|
/**
|
|
1546
1570
|
* 预编译
|
|
1547
1571
|
* 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
|
|
1548
1572
|
*/
|
|
1549
1573
|
const updateAfterDataIndex = () => {
|
|
1550
1574
|
const { treeConfig } = props
|
|
1551
|
-
const {
|
|
1575
|
+
const { fullDataRowIdData, fullAllDataRowIdData, afterTreeFullData } = internalData
|
|
1552
1576
|
const treeOpts = computeTreeOpts.value
|
|
1577
|
+
const { transform } = treeOpts
|
|
1553
1578
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
1554
1579
|
const fullMaps: Record<string, any> = {}
|
|
1555
1580
|
if (treeConfig) {
|
|
@@ -1559,31 +1584,19 @@ export default defineComponent({
|
|
|
1559
1584
|
const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
|
|
1560
1585
|
if (rowRest) {
|
|
1561
1586
|
rowRest.seq = seq
|
|
1562
|
-
rowRest.
|
|
1587
|
+
rowRest.treeIndex = index
|
|
1563
1588
|
} else {
|
|
1564
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, items: [], parent: null, level: 0, height: 0, oTop: 0 }
|
|
1589
|
+
const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 }
|
|
1565
1590
|
fullAllDataRowIdData[rowid] = rest
|
|
1566
1591
|
fullDataRowIdData[rowid] = rest
|
|
1567
1592
|
}
|
|
1568
1593
|
fullMaps[rowid] = row
|
|
1569
|
-
}, { children:
|
|
1594
|
+
}, { children: transform ? treeOpts.mapChildrenField : childrenField })
|
|
1595
|
+
internalData.afterFullRowMaps = fullMaps
|
|
1596
|
+
updateAfterListIndex()
|
|
1570
1597
|
} else {
|
|
1571
|
-
|
|
1572
|
-
const rowid = getRowid($xeTable, row)
|
|
1573
|
-
const rowRest = fullAllDataRowIdData[rowid]
|
|
1574
|
-
const seq = index + 1
|
|
1575
|
-
if (rowRest) {
|
|
1576
|
-
rowRest.seq = seq
|
|
1577
|
-
rowRest._index = index
|
|
1578
|
-
} else {
|
|
1579
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0, height: 0, oTop: 0 }
|
|
1580
|
-
fullAllDataRowIdData[rowid] = rest
|
|
1581
|
-
fullDataRowIdData[rowid] = rest
|
|
1582
|
-
}
|
|
1583
|
-
fullMaps[rowid] = row
|
|
1584
|
-
})
|
|
1598
|
+
updateAfterListIndex()
|
|
1585
1599
|
}
|
|
1586
|
-
internalData.afterFullRowMaps = fullMaps
|
|
1587
1600
|
}
|
|
1588
1601
|
|
|
1589
1602
|
/**
|
|
@@ -1762,14 +1775,16 @@ export default defineComponent({
|
|
|
1762
1775
|
}
|
|
1763
1776
|
|
|
1764
1777
|
const updateStyle = () => {
|
|
1765
|
-
const { border,
|
|
1766
|
-
const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, scrollbarWidth, scrollbarHeight, columnStore, editStore, isAllOverflow, expandColumn } = reactData
|
|
1778
|
+
const { border, showHeaderOverflow: allColumnHeaderOverflow, showFooterOverflow: allColumnFooterOverflow, mouseConfig, spanMethod, footerSpanMethod } = props
|
|
1779
|
+
const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, overflowX, scrollbarWidth, overflowY, scrollbarHeight, columnStore, editStore, isAllOverflow, expandColumn } = reactData
|
|
1767
1780
|
const { visibleColumn, fullColumnIdData, tableHeight, tableWidth, headerHeight, footerHeight, elemStore, customHeight, customMinHeight, customMaxHeight } = internalData
|
|
1768
1781
|
const el = refElem.value
|
|
1769
1782
|
if (!el) {
|
|
1770
1783
|
return
|
|
1771
1784
|
}
|
|
1772
1785
|
const containerList = ['main', 'left', 'right']
|
|
1786
|
+
const osbWidth = overflowY ? scrollbarWidth : 0
|
|
1787
|
+
const osbHeight = overflowX ? scrollbarHeight : 0
|
|
1773
1788
|
const emptyPlaceholderElem = refEmptyPlaceholder.value
|
|
1774
1789
|
const cellOffsetWidth = computeCellOffsetWidth.value
|
|
1775
1790
|
const mouseOpts = computeMouseOpts.value
|
|
@@ -1777,17 +1792,17 @@ export default defineComponent({
|
|
|
1777
1792
|
const bodyTableElem = getRefElem(elemStore['main-body-table'])
|
|
1778
1793
|
if (emptyPlaceholderElem) {
|
|
1779
1794
|
emptyPlaceholderElem.style.top = `${headerHeight}px`
|
|
1780
|
-
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight -
|
|
1795
|
+
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : ''
|
|
1781
1796
|
}
|
|
1782
1797
|
|
|
1783
1798
|
let bodyHeight = 0
|
|
1784
1799
|
let bodyMaxHeight = 0
|
|
1785
|
-
const bodyMinHeight = customMinHeight - headerHeight - footerHeight -
|
|
1800
|
+
const bodyMinHeight = customMinHeight - headerHeight - footerHeight - osbHeight
|
|
1786
1801
|
if (customMaxHeight) {
|
|
1787
|
-
bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight -
|
|
1802
|
+
bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - osbHeight)
|
|
1788
1803
|
}
|
|
1789
1804
|
if (customHeight) {
|
|
1790
|
-
bodyHeight = customHeight - headerHeight - footerHeight -
|
|
1805
|
+
bodyHeight = customHeight - headerHeight - footerHeight - osbHeight
|
|
1791
1806
|
}
|
|
1792
1807
|
if (!bodyHeight) {
|
|
1793
1808
|
if (bodyTableElem) {
|
|
@@ -1801,36 +1816,43 @@ export default defineComponent({
|
|
|
1801
1816
|
bodyHeight = Math.max(bodyMinHeight, bodyHeight)
|
|
1802
1817
|
}
|
|
1803
1818
|
|
|
1819
|
+
const xLeftCornerEl = refScrollXLeftCornerElem.value
|
|
1820
|
+
const xRightCornerEl = refScrollXRightCornerElem.value
|
|
1821
|
+
const scrollbarXToTop = computeScrollbarXToTop.value
|
|
1804
1822
|
const scrollXVirtualEl = refScrollXVirtualElem.value
|
|
1805
1823
|
if (scrollXVirtualEl) {
|
|
1806
|
-
scrollXVirtualEl.style.height = `${
|
|
1807
|
-
scrollXVirtualEl.style.visibility =
|
|
1824
|
+
scrollXVirtualEl.style.height = `${osbHeight}px`
|
|
1825
|
+
scrollXVirtualEl.style.visibility = overflowX ? 'visible' : 'hidden'
|
|
1808
1826
|
}
|
|
1809
|
-
const
|
|
1810
|
-
if (
|
|
1811
|
-
|
|
1827
|
+
const xWrapperEl = refScrollXWrapperElem.value
|
|
1828
|
+
if (xWrapperEl) {
|
|
1829
|
+
xWrapperEl.style.left = scrollbarXToTop ? `${osbWidth}px` : ''
|
|
1830
|
+
xWrapperEl.style.width = `${el.clientWidth - osbWidth}px`
|
|
1831
|
+
}
|
|
1832
|
+
if (xLeftCornerEl) {
|
|
1833
|
+
xLeftCornerEl.style.width = scrollbarXToTop ? `${osbWidth}px` : ''
|
|
1834
|
+
xLeftCornerEl.style.display = scrollbarXToTop ? (osbWidth && osbHeight ? 'block' : '') : ''
|
|
1812
1835
|
}
|
|
1813
|
-
const xRightCornerEl = refScrollXRightCornerElem.value
|
|
1814
1836
|
if (xRightCornerEl) {
|
|
1815
|
-
xRightCornerEl.style.width = `${
|
|
1816
|
-
xRightCornerEl.style.display =
|
|
1837
|
+
xRightCornerEl.style.width = scrollbarXToTop ? '' : `${osbWidth}px`
|
|
1838
|
+
xRightCornerEl.style.display = scrollbarXToTop ? '' : (osbWidth && osbHeight ? 'block' : '')
|
|
1817
1839
|
}
|
|
1818
1840
|
|
|
1819
1841
|
const scrollYVirtualEl = refScrollYVirtualElem.value
|
|
1820
1842
|
if (scrollYVirtualEl) {
|
|
1821
|
-
scrollYVirtualEl.style.width = `${
|
|
1843
|
+
scrollYVirtualEl.style.width = `${osbWidth}px`
|
|
1822
1844
|
scrollYVirtualEl.style.height = `${bodyHeight + headerHeight + footerHeight}px`
|
|
1823
|
-
scrollYVirtualEl.style.visibility =
|
|
1845
|
+
scrollYVirtualEl.style.visibility = overflowY ? 'visible' : 'hidden'
|
|
1824
1846
|
}
|
|
1825
1847
|
const yTopCornerEl = refScrollYTopCornerElem.value
|
|
1826
1848
|
if (yTopCornerEl) {
|
|
1827
1849
|
yTopCornerEl.style.height = `${headerHeight}px`
|
|
1828
1850
|
yTopCornerEl.style.display = headerHeight ? 'block' : ''
|
|
1829
1851
|
}
|
|
1830
|
-
const
|
|
1831
|
-
if (
|
|
1832
|
-
|
|
1833
|
-
|
|
1852
|
+
const yWrapperEl = refScrollYWrapperElem.value
|
|
1853
|
+
if (yWrapperEl) {
|
|
1854
|
+
yWrapperEl.style.height = `${bodyHeight}px`
|
|
1855
|
+
yWrapperEl.style.top = `${headerHeight}px`
|
|
1834
1856
|
}
|
|
1835
1857
|
const yBottomCornerEl = refScrollYBottomCornerElem.value
|
|
1836
1858
|
if (yBottomCornerEl) {
|
|
@@ -1946,7 +1968,7 @@ export default defineComponent({
|
|
|
1946
1968
|
if (wrapperElem) {
|
|
1947
1969
|
wrapperElem.style.top = `${headerHeight}px`
|
|
1948
1970
|
}
|
|
1949
|
-
fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + headerHeight + footerHeight +
|
|
1971
|
+
fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + headerHeight + footerHeight + osbHeight)}px`
|
|
1950
1972
|
fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`
|
|
1951
1973
|
}
|
|
1952
1974
|
|
|
@@ -1955,7 +1977,7 @@ export default defineComponent({
|
|
|
1955
1977
|
|
|
1956
1978
|
let isOptimizeMode = false
|
|
1957
1979
|
// 如果是使用优化模式
|
|
1958
|
-
if (scrollXLoad || scrollYLoad ||
|
|
1980
|
+
if (scrollXLoad || scrollYLoad || isAllOverflow) {
|
|
1959
1981
|
if (expandColumn || spanMethod || footerSpanMethod) {
|
|
1960
1982
|
// 如果不支持优化模式
|
|
1961
1983
|
} else {
|
|
@@ -1981,7 +2003,7 @@ export default defineComponent({
|
|
|
1981
2003
|
if (tableElem) {
|
|
1982
2004
|
tableElem.style.width = tWidth ? `${tWidth}px` : ''
|
|
1983
2005
|
// 兼容性处理
|
|
1984
|
-
tableElem.style.paddingRight =
|
|
2006
|
+
tableElem.style.paddingRight = osbWidth && fixedType && (browse['-moz'] || browse.safari) ? `${osbWidth}px` : ''
|
|
1985
2007
|
}
|
|
1986
2008
|
const emptyBlockElem = getRefElem(elemStore[`${name}-${layout}-emptyBlock`])
|
|
1987
2009
|
if (emptyBlockElem) {
|
|
@@ -2021,7 +2043,7 @@ export default defineComponent({
|
|
|
2021
2043
|
// 如果是固定列
|
|
2022
2044
|
if (fixedWrapperElem) {
|
|
2023
2045
|
if (wrapperElem) {
|
|
2024
|
-
wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight -
|
|
2046
|
+
wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight - osbHeight : tableHeight + headerHeight}px`
|
|
2025
2047
|
}
|
|
2026
2048
|
}
|
|
2027
2049
|
}
|
|
@@ -2044,7 +2066,7 @@ export default defineComponent({
|
|
|
2044
2066
|
} else if (layout === 'footer') {
|
|
2045
2067
|
cellOverflow = XEUtils.isUndefined(showFooterOverflow) || XEUtils.isNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow
|
|
2046
2068
|
} else {
|
|
2047
|
-
cellOverflow = XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow) ?
|
|
2069
|
+
cellOverflow = XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow) ? isAllOverflow : showOverflow
|
|
2048
2070
|
}
|
|
2049
2071
|
const showEllipsis = cellOverflow === 'ellipsis'
|
|
2050
2072
|
const showTitle = cellOverflow === 'title'
|
|
@@ -2570,13 +2592,13 @@ export default defineComponent({
|
|
|
2570
2592
|
return nextTick().then(() => {
|
|
2571
2593
|
const { scrollXLoad, scrollYLoad } = reactData
|
|
2572
2594
|
const { scrollXStore, scrollYStore } = internalData
|
|
2573
|
-
const
|
|
2574
|
-
const
|
|
2595
|
+
const virtualYOpts = computeVirtualYOpts.value
|
|
2596
|
+
const virtualXOpts = computeVirtualXOpts.value
|
|
2575
2597
|
// 计算 X 逻辑
|
|
2576
2598
|
if (scrollXLoad) {
|
|
2577
2599
|
const { toVisibleIndex: toXVisibleIndex, visibleSize: visibleXSize } = handleVirtualXVisible()
|
|
2578
|
-
const offsetXSize = Math.max(0,
|
|
2579
|
-
scrollXStore.preloadSize =
|
|
2600
|
+
const offsetXSize = Math.max(0, virtualXOpts.oSize ? XEUtils.toNumber(virtualXOpts.oSize) : 0)
|
|
2601
|
+
scrollXStore.preloadSize = XEUtils.toNumber(virtualXOpts.preSize)
|
|
2580
2602
|
scrollXStore.offsetSize = offsetXSize
|
|
2581
2603
|
scrollXStore.visibleSize = visibleXSize
|
|
2582
2604
|
scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex)
|
|
@@ -2588,15 +2610,14 @@ export default defineComponent({
|
|
|
2588
2610
|
} else {
|
|
2589
2611
|
$xeTable.updateScrollXSpace()
|
|
2590
2612
|
}
|
|
2591
|
-
calcCellHeight()
|
|
2592
2613
|
// 计算 Y 逻辑
|
|
2593
2614
|
const rowHeight = computeRowHeight()
|
|
2594
2615
|
;(scrollYStore as any).rowHeight = rowHeight
|
|
2595
2616
|
reactData.rowHeight = rowHeight
|
|
2596
2617
|
const { toVisibleIndex: toYVisibleIndex, visibleSize: visibleYSize } = handleVirtualYVisible()
|
|
2597
2618
|
if (scrollYLoad) {
|
|
2598
|
-
const offsetYSize = Math.max(0,
|
|
2599
|
-
scrollYStore.preloadSize =
|
|
2619
|
+
const offsetYSize = Math.max(0, virtualYOpts.oSize ? XEUtils.toNumber(virtualYOpts.oSize) : 0)
|
|
2620
|
+
scrollYStore.preloadSize = XEUtils.toNumber(virtualYOpts.preSize)
|
|
2600
2621
|
scrollYStore.offsetSize = offsetYSize
|
|
2601
2622
|
scrollYStore.visibleSize = visibleYSize
|
|
2602
2623
|
scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex)
|
|
@@ -2622,12 +2643,13 @@ export default defineComponent({
|
|
|
2622
2643
|
}
|
|
2623
2644
|
calcCellWidth()
|
|
2624
2645
|
autoCellWidth()
|
|
2646
|
+
updateStyle()
|
|
2625
2647
|
return computeScrollLoad().then(() => {
|
|
2626
2648
|
if (reFull === true) {
|
|
2627
2649
|
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
2628
|
-
calcCellHeight()
|
|
2629
2650
|
calcCellWidth()
|
|
2630
2651
|
autoCellWidth()
|
|
2652
|
+
updateStyle()
|
|
2631
2653
|
return computeScrollLoad()
|
|
2632
2654
|
}
|
|
2633
2655
|
})
|
|
@@ -2637,12 +2659,11 @@ export default defineComponent({
|
|
|
2637
2659
|
* 加载表格数据
|
|
2638
2660
|
* @param {Array} datas 数据
|
|
2639
2661
|
*/
|
|
2640
|
-
const loadTableData = (datas: any[]) => {
|
|
2641
|
-
const { keepSource, treeConfig
|
|
2662
|
+
const loadTableData = (datas: any[], isReset: boolean) => {
|
|
2663
|
+
const { keepSource, treeConfig } = props
|
|
2642
2664
|
const { editStore, scrollYLoad: oldScrollYLoad } = reactData
|
|
2643
2665
|
const { scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop } = internalData
|
|
2644
2666
|
const treeOpts = computeTreeOpts.value
|
|
2645
|
-
const rowOpts = computeRowOpts.value
|
|
2646
2667
|
const { transform } = treeOpts
|
|
2647
2668
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
2648
2669
|
let treeData = []
|
|
@@ -2696,35 +2717,20 @@ export default defineComponent({
|
|
|
2696
2717
|
internalData.tableFullData = fullData
|
|
2697
2718
|
internalData.tableFullTreeData = treeData
|
|
2698
2719
|
// 缓存数据
|
|
2699
|
-
tablePrivateMethods.cacheRowMap(true)
|
|
2720
|
+
tablePrivateMethods.cacheRowMap(true, isReset)
|
|
2700
2721
|
// 原始数据
|
|
2701
2722
|
internalData.tableSynchData = datas
|
|
2723
|
+
if (isReset) {
|
|
2724
|
+
internalData.isResizeCellHeight = false
|
|
2725
|
+
reactData.rowExpandedMaps = {}
|
|
2726
|
+
reactData.rowExpandLazyLoadedMaps = {}
|
|
2727
|
+
reactData.treeExpandedMaps = {}
|
|
2728
|
+
reactData.treeExpandLazyLoadedMaps = {}
|
|
2729
|
+
}
|
|
2702
2730
|
// 克隆原数据,用于显示编辑状态,与编辑值做对比
|
|
2703
2731
|
if (keepSource) {
|
|
2704
2732
|
tablePrivateMethods.cacheSourceMap(fullData)
|
|
2705
2733
|
}
|
|
2706
|
-
if (sYLoad) {
|
|
2707
|
-
if (showOverflow) {
|
|
2708
|
-
if (!rowOpts.height) {
|
|
2709
|
-
const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
|
|
2710
|
-
if (errColumn) {
|
|
2711
|
-
errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
|
|
2712
|
-
}
|
|
2713
|
-
}
|
|
2714
|
-
}
|
|
2715
|
-
|
|
2716
|
-
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
2717
|
-
if (!(props.height || props.maxHeight)) {
|
|
2718
|
-
errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}'])
|
|
2719
|
-
}
|
|
2720
|
-
// if (!props.showOverflow) {
|
|
2721
|
-
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2722
|
-
// }
|
|
2723
|
-
if (props.spanMethod) {
|
|
2724
|
-
warnLog('vxe.error.scrollErrProp', ['table.span-method'])
|
|
2725
|
-
}
|
|
2726
|
-
}
|
|
2727
|
-
}
|
|
2728
2734
|
if ($xeTable.clearCellAreas && props.mouseConfig) {
|
|
2729
2735
|
$xeTable.clearCellAreas()
|
|
2730
2736
|
$xeTable.clearCopyCellArea()
|
|
@@ -2743,6 +2749,30 @@ export default defineComponent({
|
|
|
2743
2749
|
if (sYLoad) {
|
|
2744
2750
|
scrollYStore.endIndex = scrollYStore.visibleSize
|
|
2745
2751
|
}
|
|
2752
|
+
|
|
2753
|
+
if (sYLoad) {
|
|
2754
|
+
// if (showOverflow) {
|
|
2755
|
+
// if (!rowOpts.height) {
|
|
2756
|
+
// const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
|
|
2757
|
+
// if (errColumn) {
|
|
2758
|
+
// errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
|
|
2759
|
+
// }
|
|
2760
|
+
// }
|
|
2761
|
+
// }
|
|
2762
|
+
|
|
2763
|
+
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
2764
|
+
if (!(props.height || props.maxHeight)) {
|
|
2765
|
+
errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}'])
|
|
2766
|
+
}
|
|
2767
|
+
// if (!props.showOverflow) {
|
|
2768
|
+
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2769
|
+
// }
|
|
2770
|
+
if (props.spanMethod) {
|
|
2771
|
+
warnLog('vxe.error.scrollErrProp', ['table.span-method'])
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2746
2776
|
handleReserveStatus()
|
|
2747
2777
|
tablePrivateMethods.checkSelectionStatus()
|
|
2748
2778
|
return new Promise<void>(resolve => {
|
|
@@ -2760,6 +2790,7 @@ export default defineComponent({
|
|
|
2760
2790
|
if (sYOpts.scrollToTopOnChange) {
|
|
2761
2791
|
targetScrollTop = 0
|
|
2762
2792
|
}
|
|
2793
|
+
calcCellHeight()
|
|
2763
2794
|
// 是否变更虚拟滚动
|
|
2764
2795
|
if (oldScrollYLoad === sYLoad) {
|
|
2765
2796
|
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
@@ -3118,8 +3149,9 @@ export default defineComponent({
|
|
|
3118
3149
|
handleVirtualTreeToList()
|
|
3119
3150
|
tablePrivateMethods.handleTableData()
|
|
3120
3151
|
updateAfterDataIndex()
|
|
3152
|
+
return nextTick()
|
|
3121
3153
|
}).then(() => {
|
|
3122
|
-
return tableMethods.recalculate()
|
|
3154
|
+
return tableMethods.recalculate(true)
|
|
3123
3155
|
}).then(() => {
|
|
3124
3156
|
setTimeout(() => {
|
|
3125
3157
|
tableMethods.updateCellAreas()
|
|
@@ -3142,13 +3174,12 @@ export default defineComponent({
|
|
|
3142
3174
|
/**
|
|
3143
3175
|
* 纵向 Y 可视渲染处理
|
|
3144
3176
|
*/
|
|
3145
|
-
const loadScrollYData = () => {
|
|
3146
|
-
const {
|
|
3147
|
-
const { mergeList } = reactData
|
|
3177
|
+
const loadScrollYData = (scrollTop?: number) => {
|
|
3178
|
+
const { mergeList, isAllOverflow } = reactData
|
|
3148
3179
|
const { scrollYStore } = internalData
|
|
3149
3180
|
const { preloadSize, startIndex, endIndex, offsetSize } = scrollYStore
|
|
3150
|
-
const autoOffsetYSize =
|
|
3151
|
-
const { toVisibleIndex, visibleSize } = handleVirtualYVisible()
|
|
3181
|
+
const autoOffsetYSize = isAllOverflow ? offsetSize : offsetSize + 1
|
|
3182
|
+
const { toVisibleIndex, visibleSize } = handleVirtualYVisible(scrollTop)
|
|
3152
3183
|
const offsetItem = {
|
|
3153
3184
|
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
3154
3185
|
endIndex: toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize
|
|
@@ -3196,7 +3227,7 @@ export default defineComponent({
|
|
|
3196
3227
|
const lazyScrollXData = () => {
|
|
3197
3228
|
const { lxTimeout, lxRunTime, scrollXStore } = internalData
|
|
3198
3229
|
const { visibleSize } = scrollXStore
|
|
3199
|
-
const fpsTime = Math.max(5, Math.min(
|
|
3230
|
+
const fpsTime = Math.max(5, Math.min(10, Math.floor(visibleSize / 3)))
|
|
3200
3231
|
if (lxTimeout) {
|
|
3201
3232
|
clearTimeout(lxTimeout)
|
|
3202
3233
|
}
|
|
@@ -3212,10 +3243,9 @@ export default defineComponent({
|
|
|
3212
3243
|
}
|
|
3213
3244
|
|
|
3214
3245
|
const lazyScrollYData = () => {
|
|
3215
|
-
const { showOverflow } = props
|
|
3216
3246
|
const { lyTimeout, lyRunTime, scrollYStore } = internalData
|
|
3217
3247
|
const { visibleSize } = scrollYStore
|
|
3218
|
-
const fpsTime =
|
|
3248
|
+
const fpsTime = Math.floor(Math.max(4, Math.min(10, visibleSize / 3)))
|
|
3219
3249
|
if (lyTimeout) {
|
|
3220
3250
|
clearTimeout(lyTimeout)
|
|
3221
3251
|
}
|
|
@@ -3230,72 +3260,6 @@ export default defineComponent({
|
|
|
3230
3260
|
}, fpsTime)
|
|
3231
3261
|
}
|
|
3232
3262
|
|
|
3233
|
-
const scrollXEvent = (evnt: Event) => {
|
|
3234
|
-
const { elemStore, inWheelScroll, lastScrollTop, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData
|
|
3235
|
-
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
3236
|
-
return
|
|
3237
|
-
}
|
|
3238
|
-
if (inWheelScroll) {
|
|
3239
|
-
return
|
|
3240
|
-
}
|
|
3241
|
-
const headerScrollElem = getRefElem(elemStore['main-header-scroll'])
|
|
3242
|
-
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
3243
|
-
const footerScrollElem = getRefElem(elemStore['main-footer-scroll'])
|
|
3244
|
-
const yHandleEl = refScrollYHandleElem.value
|
|
3245
|
-
const wrapperEl = evnt.currentTarget as HTMLDivElement
|
|
3246
|
-
const { scrollLeft } = wrapperEl
|
|
3247
|
-
const yBodyEl = yHandleEl || bodyScrollElem
|
|
3248
|
-
let scrollTop = 0
|
|
3249
|
-
if (yBodyEl) {
|
|
3250
|
-
scrollTop = yBodyEl.scrollTop
|
|
3251
|
-
}
|
|
3252
|
-
const isRollX = true
|
|
3253
|
-
const isRollY = scrollTop !== lastScrollTop
|
|
3254
|
-
|
|
3255
|
-
internalData.inVirtualScroll = true
|
|
3256
|
-
setScrollLeft(bodyScrollElem, scrollLeft)
|
|
3257
|
-
setScrollLeft(headerScrollElem, scrollLeft)
|
|
3258
|
-
setScrollLeft(footerScrollElem, scrollLeft)
|
|
3259
|
-
$xeTable.triggerScrollXEvent(evnt)
|
|
3260
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
3261
|
-
type: 'table',
|
|
3262
|
-
fixed: ''
|
|
3263
|
-
})
|
|
3264
|
-
}
|
|
3265
|
-
|
|
3266
|
-
const scrollYEvent = (evnt: Event) => {
|
|
3267
|
-
const { elemStore, inWheelScroll, lastScrollLeft, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData
|
|
3268
|
-
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
3269
|
-
return
|
|
3270
|
-
}
|
|
3271
|
-
if (inWheelScroll) {
|
|
3272
|
-
return
|
|
3273
|
-
}
|
|
3274
|
-
const leftScrollElem = getRefElem(elemStore['left-body-scroll'])
|
|
3275
|
-
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
3276
|
-
const rightScrollElem = getRefElem(elemStore['right-body-scroll'])
|
|
3277
|
-
const xHandleEl = refScrollXHandleElem.value
|
|
3278
|
-
const wrapperEl = evnt.currentTarget as HTMLDivElement
|
|
3279
|
-
const { scrollTop } = wrapperEl
|
|
3280
|
-
const xBodyEl = xHandleEl || bodyScrollElem
|
|
3281
|
-
let scrollLeft = 0
|
|
3282
|
-
if (xBodyEl) {
|
|
3283
|
-
scrollLeft = xBodyEl.scrollLeft
|
|
3284
|
-
}
|
|
3285
|
-
const isRollX = scrollLeft !== lastScrollLeft
|
|
3286
|
-
const isRollY = true
|
|
3287
|
-
|
|
3288
|
-
internalData.inVirtualScroll = true
|
|
3289
|
-
setScrollTop(bodyScrollElem, scrollTop)
|
|
3290
|
-
setScrollTop(leftScrollElem, scrollTop)
|
|
3291
|
-
setScrollTop(rightScrollElem, scrollTop)
|
|
3292
|
-
$xeTable.triggerScrollYEvent(evnt)
|
|
3293
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
3294
|
-
type: 'table',
|
|
3295
|
-
fixed: ''
|
|
3296
|
-
})
|
|
3297
|
-
}
|
|
3298
|
-
|
|
3299
3263
|
const checkLastSyncScroll = (isRollX: boolean, isRollY: boolean) => {
|
|
3300
3264
|
const { scrollXLoad, scrollYLoad } = reactData
|
|
3301
3265
|
const { lcsTimeout } = internalData
|
|
@@ -3305,28 +3269,67 @@ export default defineComponent({
|
|
|
3305
3269
|
internalData.lcsTimeout = setTimeout(() => {
|
|
3306
3270
|
internalData.lcsRunTime = Date.now()
|
|
3307
3271
|
internalData.lcsTimeout = undefined
|
|
3272
|
+
internalData.intoRunScroll = false
|
|
3308
3273
|
internalData.inVirtualScroll = false
|
|
3309
3274
|
internalData.inWheelScroll = false
|
|
3310
3275
|
internalData.inHeaderScroll = false
|
|
3311
3276
|
internalData.inBodyScroll = false
|
|
3312
3277
|
internalData.inFooterScroll = false
|
|
3313
3278
|
internalData.scrollRenderType = ''
|
|
3279
|
+
|
|
3280
|
+
calcCellHeight()
|
|
3314
3281
|
if (isRollX && scrollXLoad) {
|
|
3315
|
-
$xeTable.updateScrollXData()
|
|
3316
|
-
calcCellHeight()
|
|
3317
|
-
loadScrollXData()
|
|
3318
|
-
})
|
|
3282
|
+
$xeTable.updateScrollXData()
|
|
3319
3283
|
}
|
|
3320
3284
|
if (isRollY && scrollYLoad) {
|
|
3321
3285
|
$xeTable.updateScrollYData().then(() => {
|
|
3322
3286
|
calcCellHeight()
|
|
3323
|
-
|
|
3287
|
+
$xeTable.updateScrollYSpace()
|
|
3324
3288
|
})
|
|
3325
3289
|
}
|
|
3326
3290
|
$xeTable.updateCellAreas()
|
|
3327
3291
|
}, 200)
|
|
3328
3292
|
}
|
|
3329
3293
|
|
|
3294
|
+
const getWheelSpeed = (lastScrollTime: number) => {
|
|
3295
|
+
let multiple = 1
|
|
3296
|
+
const currTime = Date.now()
|
|
3297
|
+
if (lastScrollTime + 25 > currTime) {
|
|
3298
|
+
multiple = 1.18
|
|
3299
|
+
} else if (lastScrollTime + 30 > currTime) {
|
|
3300
|
+
multiple = 1.15
|
|
3301
|
+
} else if (lastScrollTime + 40 > currTime) {
|
|
3302
|
+
multiple = 1.12
|
|
3303
|
+
} else if (lastScrollTime + 55 > currTime) {
|
|
3304
|
+
multiple = 1.09
|
|
3305
|
+
} else if (lastScrollTime + 75 > currTime) {
|
|
3306
|
+
multiple = 1.06
|
|
3307
|
+
} else if (lastScrollTime + 100 > currTime) {
|
|
3308
|
+
multiple = 1.03
|
|
3309
|
+
}
|
|
3310
|
+
return multiple
|
|
3311
|
+
}
|
|
3312
|
+
|
|
3313
|
+
const wheelScrollTo = (diffNum: number, cb: (progress: number) => void) => {
|
|
3314
|
+
const duration = Math.abs(diffNum)
|
|
3315
|
+
const startTime = performance.now()
|
|
3316
|
+
let countTop = 0
|
|
3317
|
+
const step = (timestamp: number) => {
|
|
3318
|
+
let progress = (timestamp - startTime) / duration
|
|
3319
|
+
if (progress > 1) {
|
|
3320
|
+
progress = 1
|
|
3321
|
+
}
|
|
3322
|
+
const easedProgress = Math.pow(progress, 2)
|
|
3323
|
+
const offsetTop = Math.floor((diffNum * easedProgress)) - countTop
|
|
3324
|
+
countTop += offsetTop
|
|
3325
|
+
cb(offsetTop)
|
|
3326
|
+
if (progress < 1) {
|
|
3327
|
+
requestAnimationFrame(step)
|
|
3328
|
+
}
|
|
3329
|
+
}
|
|
3330
|
+
requestAnimationFrame(step)
|
|
3331
|
+
}
|
|
3332
|
+
|
|
3330
3333
|
const dispatchEvent = (type: ValueOf<VxeTableEmits>, params: Record<string, any>, evnt: Event | null) => {
|
|
3331
3334
|
emit(type, createEvent(evnt, { $table: $xeTable, $grid: $xeGrid }, params))
|
|
3332
3335
|
}
|
|
@@ -3340,6 +3343,34 @@ export default defineComponent({
|
|
|
3340
3343
|
return nextTick()
|
|
3341
3344
|
}
|
|
3342
3345
|
|
|
3346
|
+
const handleUpdateResize = () => {
|
|
3347
|
+
const el = refElem.value
|
|
3348
|
+
if (el && el.clientWidth && el.clientHeight) {
|
|
3349
|
+
tableMethods.recalculate()
|
|
3350
|
+
}
|
|
3351
|
+
}
|
|
3352
|
+
|
|
3353
|
+
const handleUpdateColResize = (evnt: MouseEvent, params: any) => {
|
|
3354
|
+
$xeTable.analyColumnWidth()
|
|
3355
|
+
$xeTable.recalculate(true).then(() => {
|
|
3356
|
+
$xeTable.saveCustomStore('update:width')
|
|
3357
|
+
$xeTable.updateCellAreas()
|
|
3358
|
+
$xeTable.dispatchEvent('column-resizable-change', params, evnt)
|
|
3359
|
+
// 已废弃 resizable-change
|
|
3360
|
+
$xeTable.dispatchEvent('resizable-change', params, evnt)
|
|
3361
|
+
setTimeout(() => $xeTable.recalculate(true), 300)
|
|
3362
|
+
})
|
|
3363
|
+
}
|
|
3364
|
+
|
|
3365
|
+
const handleUpdateRowResize = (evnt: MouseEvent, params: any) => {
|
|
3366
|
+
reactData.resizeHeightFlag++
|
|
3367
|
+
$xeTable.recalculate(true).then(() => {
|
|
3368
|
+
$xeTable.updateCellAreas()
|
|
3369
|
+
$xeTable.dispatchEvent('row-resizable-change', params, evnt)
|
|
3370
|
+
setTimeout(() => $xeTable.recalculate(true), 300)
|
|
3371
|
+
})
|
|
3372
|
+
}
|
|
3373
|
+
|
|
3343
3374
|
tableMethods = {
|
|
3344
3375
|
dispatchEvent,
|
|
3345
3376
|
/**
|
|
@@ -3392,7 +3423,7 @@ export default defineComponent({
|
|
|
3392
3423
|
*/
|
|
3393
3424
|
loadData (datas) {
|
|
3394
3425
|
const { initStatus } = internalData
|
|
3395
|
-
return loadTableData(datas).then(() => {
|
|
3426
|
+
return loadTableData(datas, false).then(() => {
|
|
3396
3427
|
internalData.inited = true
|
|
3397
3428
|
internalData.initStatus = true
|
|
3398
3429
|
if (!initStatus) {
|
|
@@ -3410,7 +3441,7 @@ export default defineComponent({
|
|
|
3410
3441
|
.then(() => {
|
|
3411
3442
|
internalData.inited = true
|
|
3412
3443
|
internalData.initStatus = true
|
|
3413
|
-
return loadTableData(datas)
|
|
3444
|
+
return loadTableData(datas, true)
|
|
3414
3445
|
}).then(() => {
|
|
3415
3446
|
handleLoadDefaults()
|
|
3416
3447
|
return tableMethods.recalculate()
|
|
@@ -3499,7 +3530,7 @@ export default defineComponent({
|
|
|
3499
3530
|
XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
|
|
3500
3531
|
const rowid = getRowid($xeTable, childRow)
|
|
3501
3532
|
const parentRow = parentItem || parentRest.row
|
|
3502
|
-
const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, oTop: 0 }
|
|
3533
|
+
const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, treeIndex: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, resizeHeight: 0, oTop: 0 }
|
|
3503
3534
|
fullDataRowIdData[rowid] = rest
|
|
3504
3535
|
fullAllDataRowIdData[rowid] = rest
|
|
3505
3536
|
}, { children: childrenField })
|
|
@@ -3724,29 +3755,30 @@ export default defineComponent({
|
|
|
3724
3755
|
return nextTick()
|
|
3725
3756
|
},
|
|
3726
3757
|
getCellElement (row, fieldOrColumn) {
|
|
3758
|
+
const { elemStore } = internalData
|
|
3727
3759
|
const column = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
3728
3760
|
if (!column) {
|
|
3729
3761
|
return null
|
|
3730
3762
|
}
|
|
3731
3763
|
const rowid = getRowid($xeTable, row)
|
|
3732
|
-
const
|
|
3733
|
-
const
|
|
3734
|
-
const
|
|
3764
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
3765
|
+
const leftScrollElem = getRefElem(elemStore['left-body-scroll'])
|
|
3766
|
+
const rightScrollElem = getRefElem(elemStore['right-body-scroll'])
|
|
3735
3767
|
let bodyElem
|
|
3736
3768
|
if (column) {
|
|
3737
3769
|
if (column.fixed) {
|
|
3738
3770
|
if (column.fixed === 'left') {
|
|
3739
|
-
if (
|
|
3740
|
-
bodyElem =
|
|
3771
|
+
if (leftScrollElem) {
|
|
3772
|
+
bodyElem = leftScrollElem
|
|
3741
3773
|
}
|
|
3742
3774
|
} else {
|
|
3743
|
-
if (
|
|
3744
|
-
bodyElem =
|
|
3775
|
+
if (rightScrollElem) {
|
|
3776
|
+
bodyElem = rightScrollElem
|
|
3745
3777
|
}
|
|
3746
3778
|
}
|
|
3747
3779
|
}
|
|
3748
3780
|
if (!bodyElem) {
|
|
3749
|
-
bodyElem =
|
|
3781
|
+
bodyElem = bodyScrollElem
|
|
3750
3782
|
}
|
|
3751
3783
|
if (bodyElem) {
|
|
3752
3784
|
return bodyElem.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`)
|
|
@@ -4151,29 +4183,34 @@ export default defineComponent({
|
|
|
4151
4183
|
return nextTick()
|
|
4152
4184
|
},
|
|
4153
4185
|
setColumnWidth (fieldOrColumn, width) {
|
|
4186
|
+
const { elemStore } = internalData
|
|
4154
4187
|
let status = false
|
|
4155
4188
|
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn]
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4189
|
+
let cWidth = XEUtils.toInteger(width)
|
|
4190
|
+
if (isScale(width)) {
|
|
4191
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
4192
|
+
const bodyWidth = bodyScrollElem ? bodyScrollElem.clientWidth - 1 : 0
|
|
4193
|
+
cWidth = Math.floor(cWidth * bodyWidth)
|
|
4194
|
+
}
|
|
4195
|
+
if (cWidth) {
|
|
4196
|
+
cols.forEach(item => {
|
|
4197
|
+
const column = handleFieldOrColumn($xeTable, item)
|
|
4198
|
+
if (column) {
|
|
4199
|
+
column.resizeWidth = cWidth
|
|
4200
|
+
if (!status) {
|
|
4201
|
+
status = true
|
|
4202
|
+
}
|
|
4170
4203
|
}
|
|
4204
|
+
})
|
|
4205
|
+
if (status) {
|
|
4206
|
+
return $xeTable.refreshColumn().then(() => {
|
|
4207
|
+
return { status }
|
|
4208
|
+
})
|
|
4171
4209
|
}
|
|
4172
|
-
})
|
|
4173
|
-
if (status) {
|
|
4174
|
-
return tableMethods.refreshColumn()
|
|
4175
4210
|
}
|
|
4176
|
-
return nextTick()
|
|
4211
|
+
return nextTick().then(() => {
|
|
4212
|
+
return { status }
|
|
4213
|
+
})
|
|
4177
4214
|
},
|
|
4178
4215
|
getColumnWidth (fieldOrColumn) {
|
|
4179
4216
|
const column = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
@@ -4206,6 +4243,93 @@ export default defineComponent({
|
|
|
4206
4243
|
return tableMethods.recalculate()
|
|
4207
4244
|
})
|
|
4208
4245
|
},
|
|
4246
|
+
setRowHeightConf (heightConf) {
|
|
4247
|
+
const { fullAllDataRowIdData } = internalData
|
|
4248
|
+
let status = false
|
|
4249
|
+
if (heightConf) {
|
|
4250
|
+
XEUtils.each(heightConf, (height, rowid) => {
|
|
4251
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
4252
|
+
if (rowRest) {
|
|
4253
|
+
const rHeight = XEUtils.toInteger(height)
|
|
4254
|
+
if (rHeight) {
|
|
4255
|
+
rowRest.resizeHeight = rHeight
|
|
4256
|
+
if (!status) {
|
|
4257
|
+
status = true
|
|
4258
|
+
}
|
|
4259
|
+
}
|
|
4260
|
+
}
|
|
4261
|
+
})
|
|
4262
|
+
if (status) {
|
|
4263
|
+
internalData.isResizeCellHeight = true
|
|
4264
|
+
reactData.resizeHeightFlag++
|
|
4265
|
+
}
|
|
4266
|
+
}
|
|
4267
|
+
return nextTick().then(() => {
|
|
4268
|
+
return { status }
|
|
4269
|
+
})
|
|
4270
|
+
},
|
|
4271
|
+
getRowHeightConf (isFull) {
|
|
4272
|
+
const { fullAllDataRowIdData, afterFullData } = internalData
|
|
4273
|
+
const rowOpts = computeRowOpts.value
|
|
4274
|
+
const cellOpts = computeCellOpts.value
|
|
4275
|
+
const defaultRowHeight = computeDefaultRowHeight.value
|
|
4276
|
+
const rest: Record<string, number> = {}
|
|
4277
|
+
afterFullData.forEach(row => {
|
|
4278
|
+
const rowid = getRowid($xeTable, row)
|
|
4279
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
4280
|
+
if (rowRest) {
|
|
4281
|
+
const resizeHeight = rowRest.resizeHeight
|
|
4282
|
+
if (resizeHeight || isFull) {
|
|
4283
|
+
const currCellHeight = resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight
|
|
4284
|
+
rest[rowid] = currCellHeight
|
|
4285
|
+
}
|
|
4286
|
+
}
|
|
4287
|
+
})
|
|
4288
|
+
return rest
|
|
4289
|
+
},
|
|
4290
|
+
setRowHeight (rowOrId, height) {
|
|
4291
|
+
const { fullAllDataRowIdData } = internalData
|
|
4292
|
+
let status = false
|
|
4293
|
+
const rows = XEUtils.isArray(rowOrId) ? rowOrId : [rowOrId]
|
|
4294
|
+
let rHeight = XEUtils.toInteger(height)
|
|
4295
|
+
if (isScale(height)) {
|
|
4296
|
+
const tableBody = refTableBody.value
|
|
4297
|
+
const bodyElem = tableBody ? tableBody.$el as HTMLDivElement : null
|
|
4298
|
+
const bodyHeight = bodyElem ? bodyElem.clientHeight - 1 : 0
|
|
4299
|
+
rHeight = Math.floor(rHeight * bodyHeight)
|
|
4300
|
+
}
|
|
4301
|
+
if (rHeight) {
|
|
4302
|
+
rows.forEach(row => {
|
|
4303
|
+
const rowid = XEUtils.isString(row) || XEUtils.isNumber(row) ? row : getRowid($xeTable, row)
|
|
4304
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
4305
|
+
if (rowRest) {
|
|
4306
|
+
rowRest.resizeHeight = rHeight
|
|
4307
|
+
if (!status) {
|
|
4308
|
+
status = true
|
|
4309
|
+
}
|
|
4310
|
+
}
|
|
4311
|
+
})
|
|
4312
|
+
if (status) {
|
|
4313
|
+
internalData.isResizeCellHeight = true
|
|
4314
|
+
reactData.resizeHeightFlag++
|
|
4315
|
+
}
|
|
4316
|
+
}
|
|
4317
|
+
return nextTick().then(() => {
|
|
4318
|
+
return { status }
|
|
4319
|
+
})
|
|
4320
|
+
},
|
|
4321
|
+
getRowHeight (rowOrId) {
|
|
4322
|
+
const { fullAllDataRowIdData } = internalData
|
|
4323
|
+
const rowOpts = computeRowOpts.value
|
|
4324
|
+
const cellOpts = computeCellOpts.value
|
|
4325
|
+
const defaultRowHeight = computeDefaultRowHeight.value
|
|
4326
|
+
const rowid = XEUtils.isString(rowOrId) || XEUtils.isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId)
|
|
4327
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
4328
|
+
if (rowRest) {
|
|
4329
|
+
return rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight
|
|
4330
|
+
}
|
|
4331
|
+
return 0
|
|
4332
|
+
},
|
|
4209
4333
|
/**
|
|
4210
4334
|
* 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
|
|
4211
4335
|
*/
|
|
@@ -5226,13 +5350,13 @@ export default defineComponent({
|
|
|
5226
5350
|
*/
|
|
5227
5351
|
getScroll () {
|
|
5228
5352
|
const { scrollXLoad, scrollYLoad } = reactData
|
|
5229
|
-
const
|
|
5230
|
-
const
|
|
5353
|
+
const { elemStore } = internalData
|
|
5354
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
5231
5355
|
return {
|
|
5232
5356
|
virtualX: scrollXLoad,
|
|
5233
5357
|
virtualY: scrollYLoad,
|
|
5234
|
-
scrollTop:
|
|
5235
|
-
scrollLeft:
|
|
5358
|
+
scrollTop: bodyScrollElem ? bodyScrollElem.scrollTop : 0,
|
|
5359
|
+
scrollLeft: bodyScrollElem ? bodyScrollElem.scrollLeft : 0
|
|
5236
5360
|
}
|
|
5237
5361
|
},
|
|
5238
5362
|
/**
|
|
@@ -5282,8 +5406,7 @@ export default defineComponent({
|
|
|
5282
5406
|
* @param {ColumnInfo} fieldOrColumn 列配置
|
|
5283
5407
|
*/
|
|
5284
5408
|
scrollToRow (row, fieldOrColumn) {
|
|
5285
|
-
const {
|
|
5286
|
-
const { scrollYLoad, scrollXLoad } = reactData
|
|
5409
|
+
const { isAllOverflow, scrollYLoad, scrollXLoad } = reactData
|
|
5287
5410
|
const rest = []
|
|
5288
5411
|
if (row) {
|
|
5289
5412
|
if (props.treeConfig) {
|
|
@@ -5297,7 +5420,7 @@ export default defineComponent({
|
|
|
5297
5420
|
}
|
|
5298
5421
|
return Promise.all(rest).then(() => {
|
|
5299
5422
|
if (row) {
|
|
5300
|
-
if (!
|
|
5423
|
+
if (!isAllOverflow && (scrollYLoad || scrollXLoad)) {
|
|
5301
5424
|
calcCellHeight()
|
|
5302
5425
|
calcCellWidth()
|
|
5303
5426
|
}
|
|
@@ -6249,25 +6372,29 @@ export default defineComponent({
|
|
|
6249
6372
|
if (!el) {
|
|
6250
6373
|
return
|
|
6251
6374
|
}
|
|
6252
|
-
const { scrollbarWidth, scrollbarHeight } = reactData
|
|
6375
|
+
const { overflowX, scrollbarWidth, overflowY, scrollbarHeight } = reactData
|
|
6253
6376
|
const { prevDragToChild } = internalData
|
|
6254
6377
|
const wrapperRect = el.getBoundingClientRect()
|
|
6378
|
+
const osbWidth = overflowY ? scrollbarWidth : 0
|
|
6379
|
+
const osbHeight = overflowX ? scrollbarHeight : 0
|
|
6255
6380
|
const tableWidth = el.clientWidth
|
|
6256
6381
|
const tableHeight = el.clientHeight
|
|
6257
6382
|
if (trEl) {
|
|
6258
6383
|
const rdLineEl = refDragRowLineElem.value
|
|
6259
6384
|
if (rdLineEl) {
|
|
6260
6385
|
if (showLine) {
|
|
6386
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value
|
|
6261
6387
|
const trRect = trEl.getBoundingClientRect()
|
|
6262
6388
|
let trHeight = trEl.clientHeight
|
|
6263
6389
|
const offsetTop = Math.max(1, trRect.y - wrapperRect.y)
|
|
6264
|
-
if (offsetTop + trHeight > tableHeight -
|
|
6265
|
-
trHeight = tableHeight - offsetTop -
|
|
6390
|
+
if (offsetTop + trHeight > tableHeight - osbHeight) {
|
|
6391
|
+
trHeight = tableHeight - offsetTop - osbHeight
|
|
6266
6392
|
}
|
|
6267
6393
|
rdLineEl.style.display = 'block'
|
|
6394
|
+
rdLineEl.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`
|
|
6268
6395
|
rdLineEl.style.top = `${offsetTop}px`
|
|
6269
6396
|
rdLineEl.style.height = `${trHeight}px`
|
|
6270
|
-
rdLineEl.style.width = `${tableWidth -
|
|
6397
|
+
rdLineEl.style.width = `${tableWidth - osbWidth}px`
|
|
6271
6398
|
rdLineEl.setAttribute('drag-pos', dragPos)
|
|
6272
6399
|
rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n')
|
|
6273
6400
|
} else {
|
|
@@ -6278,6 +6405,7 @@ export default defineComponent({
|
|
|
6278
6405
|
const cdLineEl = refDragColLineElem.value
|
|
6279
6406
|
if (cdLineEl) {
|
|
6280
6407
|
if (showLine) {
|
|
6408
|
+
const scrollbarXToTop = computeScrollbarXToTop.value
|
|
6281
6409
|
const leftContainerElem = refLeftContainer.value
|
|
6282
6410
|
const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0
|
|
6283
6411
|
const rightContainerElem = refRightContainer.value
|
|
@@ -6291,7 +6419,7 @@ export default defineComponent({
|
|
|
6291
6419
|
thWidth -= startX - offsetLeft
|
|
6292
6420
|
offsetLeft = startX
|
|
6293
6421
|
}
|
|
6294
|
-
const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 :
|
|
6422
|
+
const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 : osbWidth)
|
|
6295
6423
|
if (offsetLeft + thWidth > endX) {
|
|
6296
6424
|
thWidth = endX - offsetLeft
|
|
6297
6425
|
}
|
|
@@ -6302,7 +6430,7 @@ export default defineComponent({
|
|
|
6302
6430
|
if (prevDragToChild) {
|
|
6303
6431
|
cdLineEl.style.height = `${thRect.height}px`
|
|
6304
6432
|
} else {
|
|
6305
|
-
cdLineEl.style.height = `${tableHeight - offsetTop -
|
|
6433
|
+
cdLineEl.style.height = `${tableHeight - offsetTop - (scrollbarXToTop ? 0 : osbHeight)}px`
|
|
6306
6434
|
}
|
|
6307
6435
|
cdLineEl.setAttribute('drag-pos', dragPos)
|
|
6308
6436
|
cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n')
|
|
@@ -6340,11 +6468,11 @@ export default defineComponent({
|
|
|
6340
6468
|
* @param {Event} evnt 事件
|
|
6341
6469
|
* @param {Row} row 行对象
|
|
6342
6470
|
*/
|
|
6343
|
-
const handleTooltip = (evnt: MouseEvent,
|
|
6471
|
+
const handleTooltip = (evnt: MouseEvent, tdEl: HTMLTableCellElement, overflowElem: HTMLElement, tipElem: HTMLElement | null, params: any) => {
|
|
6344
6472
|
if (!overflowElem) {
|
|
6345
6473
|
return nextTick()
|
|
6346
6474
|
}
|
|
6347
|
-
params.cell =
|
|
6475
|
+
params.cell = tdEl
|
|
6348
6476
|
const { tooltipStore } = reactData
|
|
6349
6477
|
const tooltipOpts = computeTooltipOpts.value
|
|
6350
6478
|
const { column, row } = params
|
|
@@ -6494,9 +6622,8 @@ export default defineComponent({
|
|
|
6494
6622
|
},
|
|
6495
6623
|
/**
|
|
6496
6624
|
* 更新数据行的 Map
|
|
6497
|
-
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
6498
6625
|
*/
|
|
6499
|
-
cacheRowMap (isSource) {
|
|
6626
|
+
cacheRowMap (isReset, isSource) {
|
|
6500
6627
|
const { treeConfig } = props
|
|
6501
6628
|
const treeOpts = computeTreeOpts.value
|
|
6502
6629
|
const { fullAllDataRowIdData, tableFullData, tableFullTreeData } = internalData
|
|
@@ -6518,8 +6645,8 @@ export default defineComponent({
|
|
|
6518
6645
|
row[childrenField] = null
|
|
6519
6646
|
}
|
|
6520
6647
|
let cacheItem = fullAllDataRowIdData[rowid]
|
|
6521
|
-
if (!cacheItem) {
|
|
6522
|
-
cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, items, parent: parentRow, level, height: 0, oTop: 0 }
|
|
6648
|
+
if (isReset || !cacheItem) {
|
|
6649
|
+
cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0 }
|
|
6523
6650
|
}
|
|
6524
6651
|
cacheItem.row = row
|
|
6525
6652
|
cacheItem.items = items
|
|
@@ -6609,33 +6736,329 @@ export default defineComponent({
|
|
|
6609
6736
|
})
|
|
6610
6737
|
Object.assign(reactData.columnStore, { resizeList, pxList, pxMinList, autoMinList, scaleList, scaleMinList, autoList, remainList })
|
|
6611
6738
|
},
|
|
6612
|
-
|
|
6739
|
+
handleColResizeMousedownEvent (evnt, fixedType, params) {
|
|
6740
|
+
evnt.stopPropagation()
|
|
6741
|
+
evnt.preventDefault()
|
|
6742
|
+
const { column } = params
|
|
6743
|
+
const { overflowX, scrollbarHeight } = reactData
|
|
6744
|
+
const { elemStore, visibleColumn } = internalData
|
|
6613
6745
|
const resizableOpts = computeResizableOpts.value
|
|
6614
|
-
const
|
|
6615
|
-
const
|
|
6746
|
+
const osbHeight = overflowX ? scrollbarHeight : 0
|
|
6747
|
+
const tableEl = refElem.value
|
|
6748
|
+
const leftContainerElem = refLeftContainer.value
|
|
6749
|
+
const rightContainerElem = refRightContainer.value
|
|
6750
|
+
const resizeBarElem = refColResizeBar.value
|
|
6751
|
+
if (!resizeBarElem) {
|
|
6752
|
+
return
|
|
6753
|
+
}
|
|
6754
|
+
const resizeTipElem = resizeBarElem.firstElementChild as HTMLDivElement
|
|
6755
|
+
const scrollbarXToTop = computeScrollbarXToTop.value
|
|
6756
|
+
const { clientX: dragClientX } = evnt
|
|
6757
|
+
const wrapperElem = refElem.value
|
|
6758
|
+
const dragBtnElem = evnt.target as HTMLDivElement
|
|
6759
|
+
let resizeColumn = column
|
|
6760
|
+
if (column.children && column.children.length) {
|
|
6761
|
+
XEUtils.eachTree(column.children, childColumn => {
|
|
6762
|
+
resizeColumn = childColumn
|
|
6763
|
+
})
|
|
6764
|
+
}
|
|
6765
|
+
const cell = dragBtnElem.parentNode as HTMLTableCellElement
|
|
6766
|
+
const cellParams = Object.assign(params, { cell })
|
|
6767
|
+
let dragLeft = 0
|
|
6768
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
6769
|
+
if (!bodyScrollElem) {
|
|
6770
|
+
return
|
|
6771
|
+
}
|
|
6772
|
+
const pos = getOffsetPos(dragBtnElem, wrapperElem)
|
|
6773
|
+
const dragBtnWidth = dragBtnElem.clientWidth
|
|
6774
|
+
const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2)
|
|
6775
|
+
const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth // 列之间的最小间距
|
|
6776
|
+
let dragMinLeft = pos.left - cell.clientWidth + dragBtnWidth + minInterval
|
|
6777
|
+
let dragPosLeft = pos.left + dragBtnOffsetWidth
|
|
6778
|
+
const isLeftFixed = fixedType === 'left'
|
|
6779
|
+
const isRightFixed = fixedType === 'right'
|
|
6780
|
+
|
|
6781
|
+
// 计算左右侧固定列偏移量
|
|
6782
|
+
let fixedOffsetWidth = 0
|
|
6783
|
+
if (isLeftFixed || isRightFixed) {
|
|
6784
|
+
const siblingProp = isLeftFixed ? 'nextElementSibling' : 'previousElementSibling'
|
|
6785
|
+
let tempCellElem = cell[siblingProp] as HTMLTableCellElement
|
|
6786
|
+
while (tempCellElem) {
|
|
6787
|
+
if (hasClass(tempCellElem, 'fixed--hidden')) {
|
|
6788
|
+
break
|
|
6789
|
+
} else if (!hasClass(tempCellElem, 'col--group')) {
|
|
6790
|
+
fixedOffsetWidth += tempCellElem.offsetWidth
|
|
6791
|
+
}
|
|
6792
|
+
tempCellElem = tempCellElem[siblingProp] as HTMLTableCellElement
|
|
6793
|
+
}
|
|
6794
|
+
if (isRightFixed && rightContainerElem) {
|
|
6795
|
+
dragPosLeft = rightContainerElem.offsetLeft + fixedOffsetWidth
|
|
6796
|
+
}
|
|
6797
|
+
}
|
|
6798
|
+
|
|
6799
|
+
// 处理拖动事件
|
|
6800
|
+
const updateEvent = (evnt: MouseEvent) => {
|
|
6801
|
+
evnt.stopPropagation()
|
|
6802
|
+
evnt.preventDefault()
|
|
6803
|
+
const tableHeight = tableEl.clientHeight
|
|
6804
|
+
const offsetX = evnt.clientX - dragClientX
|
|
6805
|
+
let left = dragPosLeft + offsetX
|
|
6806
|
+
const scrollLeft = fixedType ? 0 : bodyScrollElem.scrollLeft
|
|
6807
|
+
if (isLeftFixed) {
|
|
6808
|
+
// 左固定列(不允许超过右侧固定列、不允许超过右边距)
|
|
6809
|
+
left = Math.min(left, (rightContainerElem ? rightContainerElem.offsetLeft : bodyScrollElem.clientWidth) - fixedOffsetWidth - minInterval)
|
|
6810
|
+
} else if (isRightFixed) {
|
|
6811
|
+
// 右侧固定列(不允许超过左侧固定列、不允许超过左边距)
|
|
6812
|
+
dragMinLeft = (leftContainerElem ? leftContainerElem.clientWidth : 0) + fixedOffsetWidth + minInterval
|
|
6813
|
+
left = Math.min(left, dragPosLeft + cell.clientWidth - minInterval)
|
|
6814
|
+
} else {
|
|
6815
|
+
dragMinLeft = Math.max(bodyScrollElem.scrollLeft, dragMinLeft)
|
|
6816
|
+
// left = Math.min(left, bodyScrollElem.clientWidth + bodyScrollElem.scrollLeft - 40)
|
|
6817
|
+
}
|
|
6818
|
+
dragLeft = Math.max(left, dragMinLeft)
|
|
6819
|
+
const resizeBarLeft = Math.max(1, dragLeft - scrollLeft)
|
|
6820
|
+
resizeBarElem.style.left = `${resizeBarLeft}px`
|
|
6821
|
+
resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`
|
|
6822
|
+
resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - osbHeight : tableHeight}px`
|
|
6823
|
+
if (resizableOpts.showDragTip && resizeTipElem) {
|
|
6824
|
+
resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)])
|
|
6825
|
+
const tableWidth = tableEl.clientWidth
|
|
6826
|
+
const wrapperRect = wrapperElem.getBoundingClientRect()
|
|
6827
|
+
const resizeBarWidth = resizeBarElem.clientWidth
|
|
6828
|
+
const resizeTipWidth = resizeTipElem.clientWidth
|
|
6829
|
+
const resizeTipHeight = resizeTipElem.clientHeight
|
|
6830
|
+
let resizeTipLeft = -resizeTipWidth
|
|
6831
|
+
if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
|
|
6832
|
+
resizeTipLeft = 0
|
|
6833
|
+
} else if (resizeBarLeft > tableWidth) {
|
|
6834
|
+
resizeTipLeft += tableWidth - resizeBarLeft
|
|
6835
|
+
}
|
|
6836
|
+
resizeTipElem.style.left = `${resizeTipLeft}px`
|
|
6837
|
+
resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`
|
|
6838
|
+
}
|
|
6839
|
+
reactData.isDragResize = true
|
|
6840
|
+
}
|
|
6841
|
+
|
|
6842
|
+
reactData.isDragResize = true
|
|
6843
|
+
addClass(tableEl, 'col-drag--resize')
|
|
6844
|
+
resizeBarElem.style.display = 'block'
|
|
6845
|
+
document.onmousemove = updateEvent
|
|
6846
|
+
document.onmouseup = function (evnt) {
|
|
6847
|
+
document.onmousemove = null
|
|
6848
|
+
document.onmouseup = null
|
|
6849
|
+
resizeBarElem.style.display = 'none'
|
|
6850
|
+
internalData._lastResizeTime = Date.now()
|
|
6851
|
+
|
|
6852
|
+
setTimeout(() => {
|
|
6853
|
+
reactData.isDragResize = false
|
|
6854
|
+
}, 50)
|
|
6855
|
+
|
|
6856
|
+
const resizeWidth = resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)
|
|
6857
|
+
const resizeParams = { ...params, resizeWidth, resizeColumn }
|
|
6858
|
+
if (resizableOpts.dragMode === 'fixed') {
|
|
6859
|
+
visibleColumn.forEach(item => {
|
|
6860
|
+
if (item.id !== resizeColumn.id) {
|
|
6861
|
+
if (!item.resizeWidth) {
|
|
6862
|
+
item.resizeWidth = item.renderWidth
|
|
6863
|
+
}
|
|
6864
|
+
}
|
|
6865
|
+
})
|
|
6866
|
+
}
|
|
6867
|
+
|
|
6868
|
+
if ($xeTable.handleColResizeCellAreaEvent) {
|
|
6869
|
+
$xeTable.handleColResizeCellAreaEvent(evnt, resizeParams)
|
|
6870
|
+
} else {
|
|
6871
|
+
resizeColumn.resizeWidth = resizeWidth
|
|
6872
|
+
handleUpdateColResize(evnt, resizeParams)
|
|
6873
|
+
}
|
|
6874
|
+
removeClass(tableEl, 'col-drag--resize')
|
|
6875
|
+
}
|
|
6876
|
+
updateEvent(evnt)
|
|
6877
|
+
if ($xeTable.closeMenu) {
|
|
6878
|
+
$xeTable.closeMenu()
|
|
6879
|
+
}
|
|
6880
|
+
},
|
|
6881
|
+
handleColResizeDblclickEvent (evnt, params) {
|
|
6882
|
+
const resizableOpts = computeResizableOpts.value
|
|
6883
|
+
const { isDblclickAutoWidth } = resizableOpts
|
|
6884
|
+
const el = refElem.value
|
|
6616
6885
|
if (isDblclickAutoWidth && el) {
|
|
6886
|
+
evnt.stopPropagation()
|
|
6887
|
+
evnt.preventDefault()
|
|
6617
6888
|
const { fullColumnIdData } = internalData
|
|
6618
6889
|
const { column } = params
|
|
6619
|
-
|
|
6890
|
+
let resizeColumn = column
|
|
6891
|
+
if (column.children && column.children.length) {
|
|
6892
|
+
XEUtils.eachTree(column.children, childColumn => {
|
|
6893
|
+
resizeColumn = childColumn
|
|
6894
|
+
})
|
|
6895
|
+
}
|
|
6896
|
+
const colid = resizeColumn.id
|
|
6620
6897
|
const colRest = fullColumnIdData[colid]
|
|
6621
6898
|
const dragBtnElem = evnt.target as HTMLDivElement
|
|
6622
6899
|
const cell = dragBtnElem.parentNode as HTMLTableCellElement
|
|
6623
6900
|
const cellParams = Object.assign(params, { cell })
|
|
6624
6901
|
const colMinWidth = getColReMinWidth(cellParams)
|
|
6625
|
-
|
|
6902
|
+
|
|
6903
|
+
el.setAttribute('data-calc-col', 'Y')
|
|
6904
|
+
let resizeWidth = calcColumnAutoWidth(resizeColumn, el)
|
|
6905
|
+
el.removeAttribute('data-calc-col')
|
|
6626
6906
|
if (colRest) {
|
|
6627
6907
|
resizeWidth = Math.max(resizeWidth, colRest.width)
|
|
6628
6908
|
}
|
|
6629
|
-
|
|
6630
|
-
|
|
6909
|
+
resizeWidth = Math.max(colMinWidth, resizeWidth)
|
|
6910
|
+
const resizeParams = { ...params, resizeWidth, resizeColumn }
|
|
6911
|
+
reactData.isDragResize = false
|
|
6631
6912
|
internalData._lastResizeTime = Date.now()
|
|
6632
|
-
|
|
6633
|
-
$xeTable.
|
|
6634
|
-
$xeTable.
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
}
|
|
6913
|
+
|
|
6914
|
+
if ($xeTable.handleColResizeDblclickCellAreaEvent) {
|
|
6915
|
+
$xeTable.handleColResizeDblclickCellAreaEvent(evnt, resizeParams)
|
|
6916
|
+
} else {
|
|
6917
|
+
resizeColumn.resizeWidth = resizeWidth
|
|
6918
|
+
handleUpdateColResize(evnt, resizeParams)
|
|
6919
|
+
}
|
|
6920
|
+
}
|
|
6921
|
+
},
|
|
6922
|
+
handleRowResizeMousedownEvent (evnt, params) {
|
|
6923
|
+
evnt.stopPropagation()
|
|
6924
|
+
evnt.preventDefault()
|
|
6925
|
+
const { row } = params
|
|
6926
|
+
const { overflowX, scrollbarWidth, overflowY, scrollbarHeight } = reactData
|
|
6927
|
+
const { elemStore, fullAllDataRowIdData } = internalData
|
|
6928
|
+
const osbWidth = overflowY ? scrollbarWidth : 0
|
|
6929
|
+
const osbHeight = overflowX ? scrollbarHeight : 0
|
|
6930
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value
|
|
6931
|
+
const resizableOpts = computeResizableOpts.value
|
|
6932
|
+
const rowOpts = computeRowOpts.value
|
|
6933
|
+
const cellOpts = computeCellOpts.value
|
|
6934
|
+
const tableEl = refElem.value
|
|
6935
|
+
const resizeBarElem = refRowResizeBar.value
|
|
6936
|
+
if (!resizeBarElem) {
|
|
6937
|
+
return
|
|
6938
|
+
}
|
|
6939
|
+
const { clientY: dragClientY } = evnt
|
|
6940
|
+
const resizeTipElem = resizeBarElem.firstElementChild as HTMLDivElement
|
|
6941
|
+
const dragBtnElem = evnt.currentTarget as HTMLDivElement
|
|
6942
|
+
const tdEl = dragBtnElem.parentNode as HTMLTableCellElement
|
|
6943
|
+
const trEl = tdEl.parentNode as HTMLTableCellElement
|
|
6944
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
6945
|
+
if (!bodyScrollElem) {
|
|
6946
|
+
return
|
|
6947
|
+
}
|
|
6948
|
+
const rowid = getRowid($xeTable, row)
|
|
6949
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
6950
|
+
if (!rowRest) {
|
|
6951
|
+
return
|
|
6952
|
+
}
|
|
6953
|
+
const defaultRowHeight = computeDefaultRowHeight.value
|
|
6954
|
+
const currCellHeight = rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight
|
|
6955
|
+
const tableRect = tableEl.getBoundingClientRect()
|
|
6956
|
+
const trRect = trEl.getBoundingClientRect()
|
|
6957
|
+
const targetOffsetY = dragClientY - trRect.y - trEl.clientHeight
|
|
6958
|
+
let resizeHeight = currCellHeight
|
|
6959
|
+
const cellEl = tdEl.querySelector('.vxe-cell')
|
|
6960
|
+
let cellMinHeight = 0
|
|
6961
|
+
if (cellEl) {
|
|
6962
|
+
const cellStyle = getComputedStyle(cellEl)
|
|
6963
|
+
cellMinHeight = Math.max(1, Math.ceil(XEUtils.toNumber(cellStyle.paddingTop) + XEUtils.toNumber(cellStyle.paddingBottom)))
|
|
6964
|
+
}
|
|
6965
|
+
const minTop = trRect.y - tableRect.y + cellMinHeight
|
|
6966
|
+
// 处理拖动事件
|
|
6967
|
+
const updateEvent = (evnt: MouseEvent) => {
|
|
6968
|
+
evnt.stopPropagation()
|
|
6969
|
+
evnt.preventDefault()
|
|
6970
|
+
const tableWidth = tableEl.clientWidth - osbWidth
|
|
6971
|
+
const tableHeight = tableEl.clientHeight - osbHeight
|
|
6972
|
+
let dragTop = evnt.clientY - tableRect.y - targetOffsetY
|
|
6973
|
+
if (dragTop < minTop) {
|
|
6974
|
+
dragTop = minTop
|
|
6975
|
+
} else {
|
|
6976
|
+
resizeHeight = Math.max(cellMinHeight, currCellHeight + evnt.clientY - dragClientY)
|
|
6977
|
+
}
|
|
6978
|
+
resizeBarElem.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`
|
|
6979
|
+
resizeBarElem.style.top = `${dragTop}px`
|
|
6980
|
+
resizeBarElem.style.width = `${tableWidth}px`
|
|
6981
|
+
if (resizableOpts.showDragTip && resizeTipElem) {
|
|
6982
|
+
resizeTipElem.textContent = getI18n('vxe.table.resizeRowTip', [resizeHeight])
|
|
6983
|
+
const resizeTipWidth = resizeTipElem.clientWidth
|
|
6984
|
+
const resizeTipHeight = resizeTipElem.clientHeight
|
|
6985
|
+
let resizeBarLeft = Math.max(2, evnt.clientX - tableRect.x)
|
|
6986
|
+
let resizeBarTop = 0
|
|
6987
|
+
if (resizeBarLeft + resizeTipWidth >= tableWidth - 2) {
|
|
6988
|
+
resizeBarLeft = tableWidth - resizeTipWidth - 2
|
|
6989
|
+
}
|
|
6990
|
+
if (dragTop + resizeTipHeight >= tableHeight) {
|
|
6991
|
+
resizeBarTop = tableHeight - (dragTop + resizeTipHeight)
|
|
6992
|
+
}
|
|
6993
|
+
resizeTipElem.style.left = `${resizeBarLeft}px`
|
|
6994
|
+
resizeTipElem.style.top = `${resizeBarTop}px`
|
|
6995
|
+
}
|
|
6996
|
+
reactData.isDragResize = true
|
|
6997
|
+
}
|
|
6998
|
+
|
|
6999
|
+
reactData.isDragResize = true
|
|
7000
|
+
addClass(tableEl, 'row-drag--resize')
|
|
7001
|
+
resizeBarElem.style.display = 'block'
|
|
7002
|
+
document.onmousemove = updateEvent
|
|
7003
|
+
document.onmouseup = function (evnt) {
|
|
7004
|
+
document.onmousemove = null
|
|
7005
|
+
document.onmouseup = null
|
|
7006
|
+
resizeBarElem.style.display = 'none'
|
|
7007
|
+
internalData._lastResizeTime = Date.now()
|
|
7008
|
+
|
|
7009
|
+
setTimeout(() => {
|
|
7010
|
+
reactData.isDragResize = false
|
|
7011
|
+
}, 50)
|
|
7012
|
+
|
|
7013
|
+
if (resizeHeight !== currCellHeight) {
|
|
7014
|
+
const resizeParams = { ...params, resizeHeight, resizeRow: row }
|
|
7015
|
+
internalData.isResizeCellHeight = true
|
|
7016
|
+
if ($xeTable.handleRowResizeCellAreaEvent) {
|
|
7017
|
+
$xeTable.handleRowResizeCellAreaEvent(evnt, resizeParams)
|
|
7018
|
+
} else {
|
|
7019
|
+
rowRest.resizeHeight = resizeHeight
|
|
7020
|
+
handleUpdateRowResize(evnt, resizeParams)
|
|
7021
|
+
}
|
|
7022
|
+
}
|
|
7023
|
+
removeClass(tableEl, 'row-drag--resize')
|
|
7024
|
+
}
|
|
7025
|
+
updateEvent(evnt)
|
|
7026
|
+
},
|
|
7027
|
+
handleRowResizeDblclickEvent (evnt, params) {
|
|
7028
|
+
const resizableOpts = computeResizableOpts.value
|
|
7029
|
+
const { isDblclickAutoHeight } = resizableOpts
|
|
7030
|
+
const el = refElem.value
|
|
7031
|
+
if (isDblclickAutoHeight && el) {
|
|
7032
|
+
evnt.stopPropagation()
|
|
7033
|
+
evnt.preventDefault()
|
|
7034
|
+
const { editStore } = reactData
|
|
7035
|
+
const { fullAllDataRowIdData } = internalData
|
|
7036
|
+
const { actived } = editStore
|
|
7037
|
+
const { row } = params
|
|
7038
|
+
const rowid = getRowid($xeTable, row)
|
|
7039
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
7040
|
+
if (!rowRest) {
|
|
7041
|
+
return
|
|
7042
|
+
}
|
|
7043
|
+
const handleRsHeight = () => {
|
|
7044
|
+
el.setAttribute('data-calc-row', 'Y')
|
|
7045
|
+
const resizeHeight = calcCellAutoHeight(rowRest, el)
|
|
7046
|
+
el.removeAttribute('data-calc-row')
|
|
7047
|
+
const resizeParams = { ...params, resizeHeight, resizeRow: row }
|
|
7048
|
+
reactData.isDragResize = false
|
|
7049
|
+
internalData._lastResizeTime = Date.now()
|
|
7050
|
+
if ($xeTable.handleRowResizeDblclickCellAreaEvent) {
|
|
7051
|
+
$xeTable.handleRowResizeDblclickCellAreaEvent(evnt, resizeParams)
|
|
7052
|
+
} else {
|
|
7053
|
+
rowRest.resizeHeight = resizeHeight
|
|
7054
|
+
handleUpdateRowResize(evnt, resizeParams)
|
|
7055
|
+
}
|
|
7056
|
+
}
|
|
7057
|
+
if (actived.row || actived.column) {
|
|
7058
|
+
$xeTable.clearEdit().then(handleRsHeight)
|
|
7059
|
+
} else {
|
|
7060
|
+
handleRsHeight()
|
|
7061
|
+
}
|
|
6639
7062
|
}
|
|
6640
7063
|
},
|
|
6641
7064
|
saveCustomStore (type) {
|
|
@@ -6860,7 +7283,7 @@ export default defineComponent({
|
|
|
6860
7283
|
vLen++
|
|
6861
7284
|
})
|
|
6862
7285
|
|
|
6863
|
-
const isSelected =
|
|
7286
|
+
const isSelected = vLen > 0 ? sLen >= vLen : sLen >= rootList.length
|
|
6864
7287
|
const halfSelect = !isSelected && (sLen >= 1 || hLen >= 1)
|
|
6865
7288
|
|
|
6866
7289
|
reactData.isAllSelected = isSelected
|
|
@@ -6982,10 +7405,21 @@ export default defineComponent({
|
|
|
6982
7405
|
triggerHeaderTooltipEvent (evnt, params) {
|
|
6983
7406
|
const { tooltipStore } = reactData
|
|
6984
7407
|
const { column } = params
|
|
6985
|
-
const titleElem = evnt.currentTarget as HTMLTableCellElement
|
|
6986
7408
|
handleTargetEnterEvent(true)
|
|
7409
|
+
const titleElem = evnt.currentTarget as HTMLDivElement
|
|
7410
|
+
if (!titleElem) {
|
|
7411
|
+
return
|
|
7412
|
+
}
|
|
7413
|
+
const cellEl = titleElem.parentElement as HTMLDivElement
|
|
7414
|
+
if (!cellEl) {
|
|
7415
|
+
return
|
|
7416
|
+
}
|
|
7417
|
+
const thEl = cellEl.parentElement as HTMLTableCellElement
|
|
7418
|
+
if (!thEl) {
|
|
7419
|
+
return
|
|
7420
|
+
}
|
|
6987
7421
|
if (tooltipStore.column !== column || !tooltipStore.visible) {
|
|
6988
|
-
handleTooltip(evnt,
|
|
7422
|
+
handleTooltip(evnt, thEl, cellEl, null, params)
|
|
6989
7423
|
}
|
|
6990
7424
|
},
|
|
6991
7425
|
/**
|
|
@@ -6998,7 +7432,7 @@ export default defineComponent({
|
|
|
6998
7432
|
const editOpts = computeEditOpts.value
|
|
6999
7433
|
const { actived } = editStore
|
|
7000
7434
|
const { row, column } = params
|
|
7001
|
-
const
|
|
7435
|
+
const tdEl = evnt.currentTarget as HTMLTableCellElement
|
|
7002
7436
|
handleTargetEnterEvent(tooltipStore.column !== column || tooltipStore.row !== row)
|
|
7003
7437
|
// 单元格处于编辑状态时不触发提示框
|
|
7004
7438
|
if (column.editRender && isEnableConf(editConfig)) {
|
|
@@ -7012,17 +7446,7 @@ export default defineComponent({
|
|
|
7012
7446
|
}
|
|
7013
7447
|
}
|
|
7014
7448
|
if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
|
|
7015
|
-
|
|
7016
|
-
let tipElem
|
|
7017
|
-
if (column.treeNode) {
|
|
7018
|
-
overflowElem = cell.querySelector('.vxe-tree-cell')
|
|
7019
|
-
if (column.type === 'html') {
|
|
7020
|
-
tipElem = cell.querySelector('.vxe-cell--html')
|
|
7021
|
-
}
|
|
7022
|
-
} else {
|
|
7023
|
-
tipElem = cell.querySelector(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label') as HTMLElement
|
|
7024
|
-
}
|
|
7025
|
-
handleTooltip(evnt, cell, (overflowElem || cell.children[0]) as HTMLElement, tipElem as HTMLElement, params)
|
|
7449
|
+
handleTooltip(evnt, tdEl, tdEl.querySelector('.vxe-cell--wrapper') as HTMLElement, null, params)
|
|
7026
7450
|
}
|
|
7027
7451
|
},
|
|
7028
7452
|
/**
|
|
@@ -7034,7 +7458,7 @@ export default defineComponent({
|
|
|
7034
7458
|
const cell = evnt.currentTarget as HTMLTableCellElement
|
|
7035
7459
|
handleTargetEnterEvent(tooltipStore.column !== column || !!tooltipStore.row)
|
|
7036
7460
|
if (tooltipStore.column !== column || !tooltipStore.visible) {
|
|
7037
|
-
handleTooltip(evnt, cell, cell.querySelector('.vxe-cell--
|
|
7461
|
+
handleTooltip(evnt, cell, cell.querySelector('.vxe-cell--wrapper') as HTMLElement || cell.children[0], null, params)
|
|
7038
7462
|
}
|
|
7039
7463
|
},
|
|
7040
7464
|
handleTargetLeaveEvent () {
|
|
@@ -7047,11 +7471,11 @@ export default defineComponent({
|
|
|
7047
7471
|
internalData.tooltipTimeout = setTimeout(() => {
|
|
7048
7472
|
$tooltip = refTooltip.value
|
|
7049
7473
|
if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
|
|
7050
|
-
|
|
7474
|
+
$xeTable.closeTooltip()
|
|
7051
7475
|
}
|
|
7052
7476
|
}, tooltipOpts.leaveDelay)
|
|
7053
7477
|
} else {
|
|
7054
|
-
|
|
7478
|
+
$xeTable.closeTooltip()
|
|
7055
7479
|
}
|
|
7056
7480
|
},
|
|
7057
7481
|
triggerHeaderCellClickEvent (evnt, params) {
|
|
@@ -7081,7 +7505,10 @@ export default defineComponent({
|
|
|
7081
7505
|
*/
|
|
7082
7506
|
triggerCellClickEvent (evnt, params) {
|
|
7083
7507
|
const { highlightCurrentRow, editConfig } = props
|
|
7084
|
-
const { editStore } = reactData
|
|
7508
|
+
const { editStore, isDragResize } = reactData
|
|
7509
|
+
if (isDragResize) {
|
|
7510
|
+
return
|
|
7511
|
+
}
|
|
7085
7512
|
const expandOpts = computeExpandOpts.value
|
|
7086
7513
|
const editOpts = computeEditOpts.value
|
|
7087
7514
|
const treeOpts = computeTreeOpts.value
|
|
@@ -7173,7 +7600,10 @@ export default defineComponent({
|
|
|
7173
7600
|
*/
|
|
7174
7601
|
triggerCellDblclickEvent (evnt, params) {
|
|
7175
7602
|
const { editConfig } = props
|
|
7176
|
-
const { editStore } = reactData
|
|
7603
|
+
const { editStore, isDragResize } = reactData
|
|
7604
|
+
if (isDragResize) {
|
|
7605
|
+
return
|
|
7606
|
+
}
|
|
7177
7607
|
const editOpts = computeEditOpts.value
|
|
7178
7608
|
const { actived } = editStore
|
|
7179
7609
|
const cell = evnt.currentTarget as HTMLDivElement
|
|
@@ -7477,7 +7907,7 @@ export default defineComponent({
|
|
|
7477
7907
|
const { treeConfig, dragConfig } = props
|
|
7478
7908
|
const rowDragOpts = computeRowDragOpts.value
|
|
7479
7909
|
const { fullAllDataRowIdData } = internalData
|
|
7480
|
-
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod } = rowDragOpts
|
|
7910
|
+
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod, dragToChildMethod } = rowDragOpts
|
|
7481
7911
|
const treeOpts = computeTreeOpts.value
|
|
7482
7912
|
const { transform, rowField, mapChildrenField, parentField } = treeOpts
|
|
7483
7913
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
@@ -7487,17 +7917,15 @@ export default defineComponent({
|
|
|
7487
7917
|
if (prevDragRow && dragRow) {
|
|
7488
7918
|
// 判断是否有拖动
|
|
7489
7919
|
if (prevDragRow !== dragRow) {
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
: true
|
|
7500
|
-
).then((status) => {
|
|
7920
|
+
const dragParams = {
|
|
7921
|
+
oldRow: dragRow,
|
|
7922
|
+
newRow: prevDragRow,
|
|
7923
|
+
dragPos: prevDragPos as 'top' | 'bottom',
|
|
7924
|
+
dragToChild: !!prevDragToChild,
|
|
7925
|
+
offsetIndex: dragOffsetIndex as 0 | 1
|
|
7926
|
+
}
|
|
7927
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
7928
|
+
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
7501
7929
|
if (!status) {
|
|
7502
7930
|
return
|
|
7503
7931
|
}
|
|
@@ -7577,7 +8005,11 @@ export default defineComponent({
|
|
|
7577
8005
|
// 根到根
|
|
7578
8006
|
}
|
|
7579
8007
|
|
|
7580
|
-
const fullList = XEUtils.toTreeArray(internalData.afterTreeFullData, {
|
|
8008
|
+
const fullList = XEUtils.toTreeArray(internalData.afterTreeFullData, {
|
|
8009
|
+
key: rowField,
|
|
8010
|
+
parentKey: parentField,
|
|
8011
|
+
children: mapChildrenField
|
|
8012
|
+
})
|
|
7581
8013
|
|
|
7582
8014
|
// 移出
|
|
7583
8015
|
const otfIndex = $xeTable.findRowIndexOf(fullList, dragRow)
|
|
@@ -7594,13 +8026,13 @@ export default defineComponent({
|
|
|
7594
8026
|
childRow[parentField] = dragRow[parentField]
|
|
7595
8027
|
})
|
|
7596
8028
|
}
|
|
7597
|
-
dragRow[parentField] =
|
|
8029
|
+
dragRow[parentField] = isDragToChildFlag ? prevDragRow[rowField] : prevDragRow[parentField]
|
|
7598
8030
|
|
|
7599
8031
|
internalData.tableFullTreeData = XEUtils.toArrayTree(fullList, {
|
|
7600
|
-
key:
|
|
7601
|
-
parentKey:
|
|
8032
|
+
key: rowField,
|
|
8033
|
+
parentKey: parentField,
|
|
7602
8034
|
children: childrenField,
|
|
7603
|
-
mapChildren:
|
|
8035
|
+
mapChildren: mapChildrenField
|
|
7604
8036
|
})
|
|
7605
8037
|
}
|
|
7606
8038
|
}
|
|
@@ -7621,7 +8053,7 @@ export default defineComponent({
|
|
|
7621
8053
|
|
|
7622
8054
|
reactData.isDragRowMove = true
|
|
7623
8055
|
$xeTable.handleTableData(treeConfig && transform)
|
|
7624
|
-
$xeTable.cacheRowMap()
|
|
8056
|
+
$xeTable.cacheRowMap(false)
|
|
7625
8057
|
updateScrollYStatus()
|
|
7626
8058
|
if (!(treeConfig && transform)) {
|
|
7627
8059
|
$xeTable.updateAfterDataIndex()
|
|
@@ -7639,7 +8071,7 @@ export default defineComponent({
|
|
|
7639
8071
|
oldRow: dragRow,
|
|
7640
8072
|
newRow: prevDragRow,
|
|
7641
8073
|
dragPos: prevDragPos as any,
|
|
7642
|
-
dragToChild:
|
|
8074
|
+
dragToChild: isDragToChildFlag,
|
|
7643
8075
|
offsetIndex: dragOffsetIndex,
|
|
7644
8076
|
_index: {
|
|
7645
8077
|
newIndex: nafIndex,
|
|
@@ -7660,18 +8092,16 @@ export default defineComponent({
|
|
|
7660
8092
|
const { lazy } = treeOpts
|
|
7661
8093
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
|
|
7662
8094
|
const { prevDragRow, prevDragPos } = internalData
|
|
7663
|
-
if (treeConfig && prevDragToChild) {
|
|
8095
|
+
if (treeConfig && lazy && prevDragToChild) {
|
|
7664
8096
|
// 懒加载
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
if (
|
|
7669
|
-
if (rowRest && rowRest.treeLoaded) {
|
|
7670
|
-
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild)
|
|
7671
|
-
}
|
|
7672
|
-
} else {
|
|
8097
|
+
const newRowid = getRowid($xeTable, prevDragRow)
|
|
8098
|
+
const rowRest = fullAllDataRowIdData[newRowid]
|
|
8099
|
+
if (prevDragRow[hasChildField]) {
|
|
8100
|
+
if (rowRest && rowRest.treeLoaded) {
|
|
7673
8101
|
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild)
|
|
7674
8102
|
}
|
|
8103
|
+
} else {
|
|
8104
|
+
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild)
|
|
7675
8105
|
}
|
|
7676
8106
|
} else {
|
|
7677
8107
|
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild)
|
|
@@ -7774,7 +8204,7 @@ export default defineComponent({
|
|
|
7774
8204
|
handleColDragSwapEvent (evnt, isSyncColumn, dragCol, prevDragCol, prevDragPos, prevDragToChild) {
|
|
7775
8205
|
const { mouseConfig } = props
|
|
7776
8206
|
const columnDragOpts = computeColumnDragOpts.value
|
|
7777
|
-
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts
|
|
8207
|
+
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts
|
|
7778
8208
|
const { collectColumn } = internalData
|
|
7779
8209
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0
|
|
7780
8210
|
if (prevDragCol && dragCol) {
|
|
@@ -7782,17 +8212,15 @@ export default defineComponent({
|
|
|
7782
8212
|
if (prevDragCol !== dragCol) {
|
|
7783
8213
|
const oldColumn = dragCol
|
|
7784
8214
|
const newColumn = prevDragCol
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
: true
|
|
7795
|
-
).then((status) => {
|
|
8215
|
+
const dragParams = {
|
|
8216
|
+
oldColumn,
|
|
8217
|
+
newColumn,
|
|
8218
|
+
dragPos: prevDragPos as 'left' | 'right',
|
|
8219
|
+
dragToChild: !!prevDragToChild,
|
|
8220
|
+
offsetIndex: dragOffsetIndex as 0 | 1
|
|
8221
|
+
}
|
|
8222
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
8223
|
+
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
7796
8224
|
if (!status) {
|
|
7797
8225
|
return
|
|
7798
8226
|
}
|
|
@@ -7888,7 +8316,7 @@ export default defineComponent({
|
|
|
7888
8316
|
if (newMatchRest) {
|
|
7889
8317
|
const { items: nCols, index: nIndex, parent: nParent } = newMatchRest
|
|
7890
8318
|
// 转子级
|
|
7891
|
-
if ((isCrossDrag && isToChildDrag) &&
|
|
8319
|
+
if ((isCrossDrag && isToChildDrag) && isDragToChildFlag) {
|
|
7892
8320
|
oldColumn.parentId = newColumn.id
|
|
7893
8321
|
newColumn.children = (newColumn.children || []).concat([oldColumn])
|
|
7894
8322
|
} else {
|
|
@@ -7922,7 +8350,7 @@ export default defineComponent({
|
|
|
7922
8350
|
oldColumn,
|
|
7923
8351
|
newColumn,
|
|
7924
8352
|
dragPos: prevDragPos,
|
|
7925
|
-
dragToChild:
|
|
8353
|
+
dragToChild: isDragToChildFlag,
|
|
7926
8354
|
offsetIndex: dragOffsetIndex,
|
|
7927
8355
|
_index: {
|
|
7928
8356
|
newIndex: nafIndex,
|
|
@@ -8170,7 +8598,7 @@ export default defineComponent({
|
|
|
8170
8598
|
}
|
|
8171
8599
|
},
|
|
8172
8600
|
triggerBodyScrollEvent (evnt, fixedType) {
|
|
8173
|
-
const { elemStore, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData
|
|
8601
|
+
const { elemStore, intoRunScroll, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData
|
|
8174
8602
|
const xHandleEl = refScrollXHandleElem.value
|
|
8175
8603
|
const yHandleEl = refScrollYHandleElem.value
|
|
8176
8604
|
const leftScrollElem = getRefElem(elemStore['left-body-scroll'])
|
|
@@ -8181,6 +8609,9 @@ export default defineComponent({
|
|
|
8181
8609
|
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
|
|
8182
8610
|
return
|
|
8183
8611
|
}
|
|
8612
|
+
if (intoRunScroll) {
|
|
8613
|
+
return
|
|
8614
|
+
}
|
|
8184
8615
|
if (!bodyScrollElem) {
|
|
8185
8616
|
return
|
|
8186
8617
|
}
|
|
@@ -8235,22 +8666,16 @@ export default defineComponent({
|
|
|
8235
8666
|
})
|
|
8236
8667
|
},
|
|
8237
8668
|
triggerHeaderScrollEvent (evnt, fixedType) {
|
|
8238
|
-
const { elemStore, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData
|
|
8669
|
+
const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData
|
|
8239
8670
|
const yHandleEl = refScrollYHandleElem.value
|
|
8240
8671
|
const xHandleEl = refScrollXHandleElem.value
|
|
8241
8672
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
8242
8673
|
const headerScrollElem = getRefElem(elemStore['main-header-scroll'])
|
|
8243
8674
|
const footerScrollElem = getRefElem(elemStore['main-footer-scroll'])
|
|
8244
|
-
if (inWheelScroll) {
|
|
8675
|
+
if (inWheelScroll || inVirtualScroll || inBodyScroll || inFooterScroll) {
|
|
8245
8676
|
return
|
|
8246
8677
|
}
|
|
8247
|
-
if (
|
|
8248
|
-
return
|
|
8249
|
-
}
|
|
8250
|
-
if (inBodyScroll) {
|
|
8251
|
-
return
|
|
8252
|
-
}
|
|
8253
|
-
if (inFooterScroll) {
|
|
8678
|
+
if (intoRunScroll) {
|
|
8254
8679
|
return
|
|
8255
8680
|
}
|
|
8256
8681
|
if (!headerScrollElem) {
|
|
@@ -8277,22 +8702,16 @@ export default defineComponent({
|
|
|
8277
8702
|
})
|
|
8278
8703
|
},
|
|
8279
8704
|
triggerFooterScrollEvent (evnt, fixedType) {
|
|
8280
|
-
const { elemStore, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData
|
|
8705
|
+
const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData
|
|
8281
8706
|
const yHandleEl = refScrollYHandleElem.value
|
|
8282
8707
|
const xHandleEl = refScrollXHandleElem.value
|
|
8283
8708
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
8284
8709
|
const headerScrollElem = getRefElem(elemStore['main-header-scroll'])
|
|
8285
8710
|
const footerScrollElem = getRefElem(elemStore['main-footer-scroll'])
|
|
8286
|
-
if (inWheelScroll) {
|
|
8287
|
-
return
|
|
8288
|
-
}
|
|
8289
|
-
if (inVirtualScroll) {
|
|
8711
|
+
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inBodyScroll) {
|
|
8290
8712
|
return
|
|
8291
8713
|
}
|
|
8292
|
-
if (
|
|
8293
|
-
return
|
|
8294
|
-
}
|
|
8295
|
-
if (inBodyScroll) {
|
|
8714
|
+
if (intoRunScroll) {
|
|
8296
8715
|
return
|
|
8297
8716
|
}
|
|
8298
8717
|
if (!footerScrollElem) {
|
|
@@ -8319,7 +8738,10 @@ export default defineComponent({
|
|
|
8319
8738
|
})
|
|
8320
8739
|
},
|
|
8321
8740
|
triggerBodyWheelEvent (evnt) {
|
|
8322
|
-
const { deltaY, deltaX } = evnt
|
|
8741
|
+
const { target, deltaY, deltaX } = evnt
|
|
8742
|
+
if (target && /^textarea$/i.test((target as HTMLElement).tagName)) {
|
|
8743
|
+
return
|
|
8744
|
+
}
|
|
8323
8745
|
const { highlightHoverRow } = tableProps
|
|
8324
8746
|
const { elemStore, lastScrollTop, lastScrollLeft } = internalData
|
|
8325
8747
|
const rowOpts = computeRowOpts.value
|
|
@@ -8338,30 +8760,14 @@ export default defineComponent({
|
|
|
8338
8760
|
if (!bodyScrollElem) {
|
|
8339
8761
|
return
|
|
8340
8762
|
}
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
if (reactData.lastScrollTime + 25 > Date.now()) {
|
|
8345
|
-
multiple = 1.18
|
|
8346
|
-
} else if (reactData.lastScrollTime + 30 > Date.now()) {
|
|
8347
|
-
multiple = 1.15
|
|
8348
|
-
} else if (reactData.lastScrollTime + 40 > Date.now()) {
|
|
8349
|
-
multiple = 1.12
|
|
8350
|
-
} else if (reactData.lastScrollTime + 55 > Date.now()) {
|
|
8351
|
-
multiple = 1.09
|
|
8352
|
-
} else if (reactData.lastScrollTime + 75 > Date.now()) {
|
|
8353
|
-
multiple = 1.06
|
|
8354
|
-
} else if (reactData.lastScrollTime + 100 > Date.now()) {
|
|
8355
|
-
multiple = 1.03
|
|
8356
|
-
}
|
|
8357
|
-
|
|
8358
|
-
const deltaTop = deltaY * multiple
|
|
8359
|
-
const deltaLeft = deltaX * multiple
|
|
8763
|
+
const wheelSpeed = getWheelSpeed(reactData.lastScrollTime)
|
|
8764
|
+
const deltaTop = deltaY * wheelSpeed
|
|
8765
|
+
const deltaLeft = deltaX * wheelSpeed
|
|
8360
8766
|
|
|
8361
8767
|
const isTopWheel = deltaTop < 0
|
|
8362
|
-
const currScrollTop =
|
|
8768
|
+
const currScrollTop = bodyScrollElem.scrollTop
|
|
8363
8769
|
// 如果滚动位置已经是顶部或底部,则不需要触发
|
|
8364
|
-
if (isTopWheel ? currScrollTop <= 0 : currScrollTop >=
|
|
8770
|
+
if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= bodyScrollElem.scrollHeight - bodyScrollElem.clientHeight) {
|
|
8365
8771
|
return
|
|
8366
8772
|
}
|
|
8367
8773
|
|
|
@@ -8377,17 +8783,96 @@ export default defineComponent({
|
|
|
8377
8783
|
$xeTable.clearHoverRow()
|
|
8378
8784
|
}
|
|
8379
8785
|
|
|
8380
|
-
|
|
8381
|
-
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
8786
|
+
wheelScrollTo(scrollTop - bodyScrollElem.scrollTop, (offsetTop: number) => {
|
|
8787
|
+
const currTopNum = bodyScrollElem.scrollTop + offsetTop
|
|
8788
|
+
internalData.inWheelScroll = true
|
|
8789
|
+
setScrollTop(yHandleEl, currTopNum)
|
|
8790
|
+
setScrollTop(bodyScrollElem, currTopNum)
|
|
8791
|
+
setScrollTop(leftScrollElem, currTopNum)
|
|
8792
|
+
setScrollTop(rightScrollElem, currTopNum)
|
|
8793
|
+
$xeTable.triggerScrollYEvent(evnt)
|
|
8794
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, scrollLeft, {
|
|
8795
|
+
type: 'table',
|
|
8796
|
+
fixed: ''
|
|
8797
|
+
})
|
|
8389
8798
|
})
|
|
8799
|
+
|
|
8800
|
+
// internalData.inWheelScroll = true
|
|
8801
|
+
// setScrollTop(yHandleEl, scrollTop)
|
|
8802
|
+
// setScrollTop(bodyScrollElem, scrollTop)
|
|
8803
|
+
// setScrollTop(leftScrollElem, scrollTop)
|
|
8804
|
+
// setScrollTop(rightScrollElem, scrollTop)
|
|
8805
|
+
|
|
8806
|
+
// loadScrollYData(scrollTop)
|
|
8807
|
+
// $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8808
|
+
// type: 'footer',
|
|
8809
|
+
// fixed: ''
|
|
8810
|
+
// })
|
|
8811
|
+
}
|
|
8812
|
+
},
|
|
8813
|
+
triggerVirtualScrollXEvent (evnt) {
|
|
8814
|
+
const { elemStore, inWheelScroll, lastScrollTop, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData
|
|
8815
|
+
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
8816
|
+
return
|
|
8817
|
+
}
|
|
8818
|
+
if (inWheelScroll) {
|
|
8819
|
+
return
|
|
8820
|
+
}
|
|
8821
|
+
const headerScrollElem = getRefElem(elemStore['main-header-scroll'])
|
|
8822
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
8823
|
+
const footerScrollElem = getRefElem(elemStore['main-footer-scroll'])
|
|
8824
|
+
const yHandleEl = refScrollYHandleElem.value
|
|
8825
|
+
const wrapperEl = evnt.currentTarget as HTMLDivElement
|
|
8826
|
+
const { scrollLeft } = wrapperEl
|
|
8827
|
+
const yBodyEl = yHandleEl || bodyScrollElem
|
|
8828
|
+
let scrollTop = 0
|
|
8829
|
+
if (yBodyEl) {
|
|
8830
|
+
scrollTop = yBodyEl.scrollTop
|
|
8831
|
+
}
|
|
8832
|
+
const isRollX = true
|
|
8833
|
+
const isRollY = scrollTop !== lastScrollTop
|
|
8834
|
+
|
|
8835
|
+
internalData.inVirtualScroll = true
|
|
8836
|
+
setScrollLeft(bodyScrollElem, scrollLeft)
|
|
8837
|
+
setScrollLeft(headerScrollElem, scrollLeft)
|
|
8838
|
+
setScrollLeft(footerScrollElem, scrollLeft)
|
|
8839
|
+
$xeTable.triggerScrollXEvent(evnt)
|
|
8840
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8841
|
+
type: 'table',
|
|
8842
|
+
fixed: ''
|
|
8843
|
+
})
|
|
8844
|
+
},
|
|
8845
|
+
triggerVirtualScrollYEvent (evnt) {
|
|
8846
|
+
const { elemStore, inWheelScroll, lastScrollLeft, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData
|
|
8847
|
+
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
8848
|
+
return
|
|
8849
|
+
}
|
|
8850
|
+
if (inWheelScroll) {
|
|
8851
|
+
return
|
|
8852
|
+
}
|
|
8853
|
+
const leftScrollElem = getRefElem(elemStore['left-body-scroll'])
|
|
8854
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
8855
|
+
const rightScrollElem = getRefElem(elemStore['right-body-scroll'])
|
|
8856
|
+
const xHandleEl = refScrollXHandleElem.value
|
|
8857
|
+
const wrapperEl = evnt.currentTarget as HTMLDivElement
|
|
8858
|
+
const { scrollTop } = wrapperEl
|
|
8859
|
+
const xBodyEl = xHandleEl || bodyScrollElem
|
|
8860
|
+
let scrollLeft = 0
|
|
8861
|
+
if (xBodyEl) {
|
|
8862
|
+
scrollLeft = xBodyEl.scrollLeft
|
|
8390
8863
|
}
|
|
8864
|
+
const isRollX = scrollLeft !== lastScrollLeft
|
|
8865
|
+
const isRollY = true
|
|
8866
|
+
|
|
8867
|
+
internalData.inVirtualScroll = true
|
|
8868
|
+
setScrollTop(bodyScrollElem, scrollTop)
|
|
8869
|
+
setScrollTop(leftScrollElem, scrollTop)
|
|
8870
|
+
setScrollTop(rightScrollElem, scrollTop)
|
|
8871
|
+
$xeTable.triggerScrollYEvent(evnt)
|
|
8872
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8873
|
+
type: 'table',
|
|
8874
|
+
fixed: ''
|
|
8875
|
+
})
|
|
8391
8876
|
},
|
|
8392
8877
|
/**
|
|
8393
8878
|
* 对于树形结构中,可以直接滚动到指定深层节点中
|
|
@@ -8461,34 +8946,34 @@ export default defineComponent({
|
|
|
8461
8946
|
},
|
|
8462
8947
|
// 更新纵向 Y 可视渲染上下剩余空间大小
|
|
8463
8948
|
updateScrollYSpace () {
|
|
8464
|
-
const {
|
|
8465
|
-
const {
|
|
8466
|
-
const { scrollYStore, elemStore, afterFullData, fullAllDataRowIdData } = internalData
|
|
8949
|
+
const { isAllOverflow, scrollYLoad } = reactData
|
|
8950
|
+
const { scrollYStore, elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData
|
|
8467
8951
|
const { startIndex } = scrollYStore
|
|
8952
|
+
const rowOpts = computeRowOpts.value
|
|
8953
|
+
const cellOpts = computeCellOpts.value
|
|
8954
|
+
const defaultRowHeight = computeDefaultRowHeight.value
|
|
8468
8955
|
const bodyTableElem = getRefElem(elemStore['main-body-table'])
|
|
8469
8956
|
const containerList = ['main', 'left', 'right']
|
|
8470
8957
|
let topSpaceHeight = 0
|
|
8471
8958
|
let ySpaceHeight = 0
|
|
8959
|
+
|
|
8472
8960
|
if (scrollYLoad) {
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8961
|
+
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height
|
|
8962
|
+
if (!isCustomCellHeight && isAllOverflow) {
|
|
8963
|
+
ySpaceHeight = afterFullData.length * defaultRowHeight
|
|
8964
|
+
topSpaceHeight = Math.max(0, startIndex * defaultRowHeight)
|
|
8476
8965
|
} else {
|
|
8477
8966
|
for (let i = 0; i < afterFullData.length; i++) {
|
|
8478
8967
|
const row = afterFullData[i]
|
|
8479
8968
|
const rowid = getRowid($xeTable, row)
|
|
8480
|
-
const rowRest = fullAllDataRowIdData[rowid]
|
|
8481
|
-
|
|
8482
|
-
ySpaceHeight += rowRest.height || rowHeight
|
|
8483
|
-
}
|
|
8969
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
8970
|
+
ySpaceHeight += rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight
|
|
8484
8971
|
}
|
|
8485
8972
|
for (let i = 0; i < startIndex; i++) {
|
|
8486
8973
|
const row = afterFullData[i]
|
|
8487
8974
|
const rowid = getRowid($xeTable, row)
|
|
8488
|
-
const rowRest = fullAllDataRowIdData[rowid]
|
|
8489
|
-
|
|
8490
|
-
topSpaceHeight += rowRest.height || rowHeight
|
|
8491
|
-
}
|
|
8975
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
8976
|
+
topSpaceHeight += rowRest.resizeHeight || rowRest.height || cellOpts.height || rowOpts.height || defaultRowHeight
|
|
8492
8977
|
}
|
|
8493
8978
|
}
|
|
8494
8979
|
} else {
|
|
@@ -8513,28 +8998,24 @@ export default defineComponent({
|
|
|
8513
8998
|
if (scrollYSpaceEl) {
|
|
8514
8999
|
scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : ''
|
|
8515
9000
|
}
|
|
8516
|
-
nextTick(() => {
|
|
9001
|
+
return nextTick().then(() => {
|
|
8517
9002
|
updateStyle()
|
|
8518
9003
|
})
|
|
8519
9004
|
},
|
|
8520
9005
|
updateScrollXData () {
|
|
8521
|
-
const {
|
|
9006
|
+
const { isAllOverflow } = reactData
|
|
8522
9007
|
handleTableColumn()
|
|
8523
|
-
// calcCellHeight()
|
|
8524
9008
|
return nextTick().then(() => {
|
|
8525
|
-
// calcCellHeight()
|
|
8526
9009
|
handleTableColumn()
|
|
8527
9010
|
$xeTable.updateScrollXSpace()
|
|
8528
|
-
if (!
|
|
9011
|
+
if (!isAllOverflow) {
|
|
8529
9012
|
$xeTable.updateScrollYSpace()
|
|
8530
9013
|
}
|
|
8531
9014
|
})
|
|
8532
9015
|
},
|
|
8533
9016
|
updateScrollYData () {
|
|
8534
9017
|
$xeTable.handleTableData()
|
|
8535
|
-
// calcCellHeight()
|
|
8536
9018
|
return nextTick().then(() => {
|
|
8537
|
-
// calcCellHeight()
|
|
8538
9019
|
$xeTable.handleTableData()
|
|
8539
9020
|
$xeTable.updateScrollYSpace()
|
|
8540
9021
|
})
|
|
@@ -8764,19 +9245,141 @@ export default defineComponent({
|
|
|
8764
9245
|
return renderEmptyElement($xeTable)
|
|
8765
9246
|
}
|
|
8766
9247
|
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
|
|
8770
|
-
|
|
8771
|
-
|
|
9248
|
+
const renderScrollX = () => {
|
|
9249
|
+
return h('div', {
|
|
9250
|
+
key: 'vsx',
|
|
9251
|
+
ref: refScrollXVirtualElem,
|
|
9252
|
+
class: 'vxe-table--scroll-x-virtual'
|
|
9253
|
+
}, [
|
|
9254
|
+
h('div', {
|
|
9255
|
+
ref: refScrollXLeftCornerElem,
|
|
9256
|
+
class: 'vxe-table--scroll-x-left-corner'
|
|
9257
|
+
}),
|
|
9258
|
+
h('div', {
|
|
9259
|
+
ref: refScrollXWrapperElem,
|
|
9260
|
+
class: 'vxe-table--scroll-x-wrapper'
|
|
9261
|
+
}, [
|
|
9262
|
+
h('div', {
|
|
9263
|
+
ref: refScrollXHandleElem,
|
|
9264
|
+
class: 'vxe-table--scroll-x-handle',
|
|
9265
|
+
onScroll: $xeTable.triggerVirtualScrollXEvent
|
|
9266
|
+
}, [
|
|
9267
|
+
h('div', {
|
|
9268
|
+
ref: refScrollXSpaceElem,
|
|
9269
|
+
class: 'vxe-table--scroll-x-space'
|
|
9270
|
+
})
|
|
9271
|
+
])
|
|
9272
|
+
]),
|
|
9273
|
+
h('div', {
|
|
9274
|
+
ref: refScrollXRightCornerElem,
|
|
9275
|
+
class: 'vxe-table--scroll-x-right-corner'
|
|
9276
|
+
})
|
|
9277
|
+
])
|
|
9278
|
+
}
|
|
9279
|
+
|
|
9280
|
+
const renderScrollY = () => {
|
|
9281
|
+
return h('div', {
|
|
9282
|
+
ref: refScrollYVirtualElem,
|
|
9283
|
+
class: 'vxe-table--scroll-y-virtual'
|
|
9284
|
+
}, [
|
|
9285
|
+
h('div', {
|
|
9286
|
+
ref: refScrollYTopCornerElem,
|
|
9287
|
+
class: 'vxe-table--scroll-y-top-corner'
|
|
9288
|
+
}),
|
|
9289
|
+
h('div', {
|
|
9290
|
+
ref: refScrollYWrapperElem,
|
|
9291
|
+
class: 'vxe-table--scroll-y-wrapper'
|
|
9292
|
+
}, [
|
|
9293
|
+
h('div', {
|
|
9294
|
+
ref: refScrollYHandleElem,
|
|
9295
|
+
class: 'vxe-table--scroll-y-handle',
|
|
9296
|
+
onScroll: $xeTable.triggerVirtualScrollYEvent
|
|
9297
|
+
}, [
|
|
9298
|
+
h('div', {
|
|
9299
|
+
ref: refScrollYSpaceElem,
|
|
9300
|
+
class: 'vxe-table--scroll-y-space'
|
|
9301
|
+
})
|
|
9302
|
+
])
|
|
9303
|
+
]),
|
|
9304
|
+
h('div', {
|
|
9305
|
+
ref: refScrollYBottomCornerElem,
|
|
9306
|
+
class: 'vxe-table--scroll-y-bottom-corner'
|
|
9307
|
+
})
|
|
9308
|
+
])
|
|
9309
|
+
}
|
|
9310
|
+
|
|
9311
|
+
const renderViewport = () => {
|
|
9312
|
+
const { showHeader, showFooter } = props
|
|
9313
|
+
const { overflowX, tableData, tableColumn, tableGroupColumn, footerTableData, columnStore } = reactData
|
|
9314
|
+
const { leftList, rightList } = columnStore
|
|
9315
|
+
return h('div', {
|
|
9316
|
+
ref: refTableViewportElem,
|
|
9317
|
+
class: 'vxe-table--viewport-wrapper'
|
|
9318
|
+
}, [
|
|
9319
|
+
h('div', {
|
|
9320
|
+
class: 'vxe-table--main-wrapper'
|
|
9321
|
+
}, [
|
|
9322
|
+
/**
|
|
9323
|
+
* 表头
|
|
9324
|
+
*/
|
|
9325
|
+
showHeader
|
|
9326
|
+
? h(TableHeaderComponent, {
|
|
9327
|
+
ref: refTableHeader,
|
|
9328
|
+
tableData,
|
|
9329
|
+
tableColumn,
|
|
9330
|
+
tableGroupColumn
|
|
9331
|
+
})
|
|
9332
|
+
: renderEmptyElement($xeTable),
|
|
9333
|
+
/**
|
|
9334
|
+
* 表体
|
|
9335
|
+
*/
|
|
9336
|
+
h(TableBodyComponent, {
|
|
9337
|
+
ref: refTableBody,
|
|
9338
|
+
tableData,
|
|
9339
|
+
tableColumn
|
|
9340
|
+
}),
|
|
9341
|
+
/**
|
|
9342
|
+
* 表尾
|
|
9343
|
+
*/
|
|
9344
|
+
showFooter
|
|
9345
|
+
? h(TableFooterComponent, {
|
|
9346
|
+
ref: refTableFooter,
|
|
9347
|
+
footerTableData,
|
|
9348
|
+
tableColumn
|
|
9349
|
+
})
|
|
9350
|
+
: renderEmptyElement($xeTable)
|
|
9351
|
+
]),
|
|
9352
|
+
h('div', {
|
|
9353
|
+
class: 'vxe-table--fixed-wrapper'
|
|
9354
|
+
}, [
|
|
9355
|
+
leftList && leftList.length && overflowX ? renderFixed('left') : renderEmptyElement($xeTable),
|
|
9356
|
+
rightList && rightList.length && overflowX ? renderFixed('right') : renderEmptyElement($xeTable)
|
|
9357
|
+
])
|
|
9358
|
+
])
|
|
9359
|
+
}
|
|
9360
|
+
|
|
9361
|
+
const renderBody = () => {
|
|
9362
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value
|
|
9363
|
+
return h('div', {
|
|
9364
|
+
class: 'vxe-table--layout-wrapper'
|
|
9365
|
+
}, scrollbarYToLeft
|
|
9366
|
+
? [
|
|
9367
|
+
renderScrollY(),
|
|
9368
|
+
renderViewport()
|
|
9369
|
+
]
|
|
9370
|
+
: [
|
|
9371
|
+
renderViewport(),
|
|
9372
|
+
renderScrollY()
|
|
9373
|
+
])
|
|
8772
9374
|
}
|
|
8773
9375
|
|
|
8774
9376
|
const renderVN = () => {
|
|
8775
9377
|
const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules } = props
|
|
8776
|
-
const {
|
|
9378
|
+
const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, columnStore, filterStore, customStore } = reactData
|
|
8777
9379
|
const { leftList, rightList } = columnStore
|
|
8778
9380
|
const loadingSlot = slots.loading
|
|
8779
|
-
const
|
|
9381
|
+
const tableTipConfig = computeTableTipConfig.value
|
|
9382
|
+
const validTipConfig = computeValidTipConfig.value
|
|
8780
9383
|
const validOpts = computeValidOpts.value
|
|
8781
9384
|
const checkboxOpts = computeCheckboxOpts.value
|
|
8782
9385
|
const treeOpts = computeTreeOpts.value
|
|
@@ -8792,9 +9395,11 @@ export default defineComponent({
|
|
|
8792
9395
|
const resizableOpts = computeResizableOpts.value
|
|
8793
9396
|
const isArea = mouseConfig && mouseOpts.area
|
|
8794
9397
|
const columnDragOpts = computeColumnDragOpts.value
|
|
9398
|
+
const scrollbarXToTop = computeScrollbarXToTop.value
|
|
9399
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value
|
|
8795
9400
|
return h('div', {
|
|
8796
9401
|
ref: refElem,
|
|
8797
|
-
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, {
|
|
9402
|
+
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
|
|
8798
9403
|
[`size--${vSize}`]: vSize,
|
|
8799
9404
|
[`valid-msg--${validOpts.msgMode}`]: !!editRules,
|
|
8800
9405
|
'vxe-editable': !!editConfig,
|
|
@@ -8807,7 +9412,6 @@ export default defineComponent({
|
|
|
8807
9412
|
'row--highlight': rowOpts.isHover || highlightHoverRow,
|
|
8808
9413
|
'column--highlight': columnOpts.isHover || highlightHoverColumn,
|
|
8809
9414
|
'checkbox--range': checkboxOpts.range,
|
|
8810
|
-
'column--calc': isCalcColumn,
|
|
8811
9415
|
'col--drag-cell': columnOpts.drag && columnDragOpts.trigger === 'cell',
|
|
8812
9416
|
'is--header': showHeader,
|
|
8813
9417
|
'is--footer': showFooter,
|
|
@@ -8816,7 +9420,6 @@ export default defineComponent({
|
|
|
8816
9420
|
'is--fixed-left': leftList.length,
|
|
8817
9421
|
'is--fixed-right': rightList.length,
|
|
8818
9422
|
'is--animat': !!props.animat,
|
|
8819
|
-
'is--padding': props.padding,
|
|
8820
9423
|
'is--round': props.round,
|
|
8821
9424
|
'is--stripe': !treeConfig && stripe,
|
|
8822
9425
|
'is--loading': currLoading,
|
|
@@ -8838,95 +9441,15 @@ export default defineComponent({
|
|
|
8838
9441
|
h('div', {
|
|
8839
9442
|
key: 'tw',
|
|
8840
9443
|
class: 'vxe-table--render-wrapper'
|
|
8841
|
-
},
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
/**
|
|
8850
|
-
* 表头
|
|
8851
|
-
*/
|
|
8852
|
-
showHeader
|
|
8853
|
-
? h(TableHeaderComponent, {
|
|
8854
|
-
ref: refTableHeader,
|
|
8855
|
-
tableData,
|
|
8856
|
-
tableColumn,
|
|
8857
|
-
tableGroupColumn
|
|
8858
|
-
})
|
|
8859
|
-
: renderEmptyElement($xeTable),
|
|
8860
|
-
/**
|
|
8861
|
-
* 表体
|
|
8862
|
-
*/
|
|
8863
|
-
h(TableBodyComponent, {
|
|
8864
|
-
ref: refTableBody,
|
|
8865
|
-
tableData,
|
|
8866
|
-
tableColumn
|
|
8867
|
-
}),
|
|
8868
|
-
/**
|
|
8869
|
-
* 表尾
|
|
8870
|
-
*/
|
|
8871
|
-
showFooter
|
|
8872
|
-
? h(TableFooterComponent, {
|
|
8873
|
-
ref: refTableFooter,
|
|
8874
|
-
footerTableData,
|
|
8875
|
-
tableColumn
|
|
8876
|
-
})
|
|
8877
|
-
: renderEmptyElement($xeTable)
|
|
8878
|
-
]),
|
|
8879
|
-
h('div', {
|
|
8880
|
-
class: 'vxe-table--fixed-wrapper'
|
|
8881
|
-
}, [
|
|
8882
|
-
leftList && leftList.length && overflowX ? renderFixed('left') : renderEmptyElement($xeTable),
|
|
8883
|
-
rightList && rightList.length && overflowX ? renderFixed('right') : renderEmptyElement($xeTable)
|
|
8884
|
-
])
|
|
8885
|
-
]),
|
|
8886
|
-
h('div', {
|
|
8887
|
-
ref: refScrollYVirtualElem,
|
|
8888
|
-
class: 'vxe-table--scroll-y-virtual'
|
|
8889
|
-
}, [
|
|
8890
|
-
h('div', {
|
|
8891
|
-
ref: refScrollYTopCornerElem,
|
|
8892
|
-
class: 'vxe-table--scroll-y-top-corner'
|
|
8893
|
-
}),
|
|
8894
|
-
h('div', {
|
|
8895
|
-
ref: refScrollYHandleElem,
|
|
8896
|
-
class: 'vxe-table--scroll-y-handle',
|
|
8897
|
-
onScroll: scrollYEvent
|
|
8898
|
-
}, [
|
|
8899
|
-
h('div', {
|
|
8900
|
-
ref: refScrollYSpaceElem,
|
|
8901
|
-
class: 'vxe-table--scroll-y-space'
|
|
8902
|
-
})
|
|
9444
|
+
}, scrollbarXToTop
|
|
9445
|
+
? [
|
|
9446
|
+
renderScrollX(),
|
|
9447
|
+
renderBody()
|
|
9448
|
+
]
|
|
9449
|
+
: [
|
|
9450
|
+
renderBody(),
|
|
9451
|
+
renderScrollX()
|
|
8903
9452
|
]),
|
|
8904
|
-
h('div', {
|
|
8905
|
-
ref: refScrollYBottomCornerElem,
|
|
8906
|
-
class: 'vxe-table--scroll-y-bottom-corner'
|
|
8907
|
-
})
|
|
8908
|
-
])
|
|
8909
|
-
]),
|
|
8910
|
-
h('div', {
|
|
8911
|
-
key: 'vx',
|
|
8912
|
-
ref: refScrollXVirtualElem,
|
|
8913
|
-
class: 'vxe-table--scroll-x-virtual'
|
|
8914
|
-
}, [
|
|
8915
|
-
h('div', {
|
|
8916
|
-
ref: refScrollXHandleElem,
|
|
8917
|
-
class: 'vxe-table--scroll-x-handle',
|
|
8918
|
-
onScroll: scrollXEvent
|
|
8919
|
-
}, [
|
|
8920
|
-
h('div', {
|
|
8921
|
-
ref: refScrollXSpaceElem,
|
|
8922
|
-
class: 'vxe-table--scroll-x-space'
|
|
8923
|
-
})
|
|
8924
|
-
]),
|
|
8925
|
-
h('div', {
|
|
8926
|
-
ref: refScrollXRightCornerElem,
|
|
8927
|
-
class: 'vxe-table--scroll-x-right-corner'
|
|
8928
|
-
})
|
|
8929
|
-
]),
|
|
8930
9453
|
/**
|
|
8931
9454
|
* 空数据
|
|
8932
9455
|
*/
|
|
@@ -8950,18 +9473,26 @@ export default defineComponent({
|
|
|
8950
9473
|
* 列宽线
|
|
8951
9474
|
*/
|
|
8952
9475
|
h('div', {
|
|
8953
|
-
key: '
|
|
8954
|
-
ref:
|
|
8955
|
-
class: 'vxe-table--resizable-bar'
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
9476
|
+
key: 'tcl',
|
|
9477
|
+
ref: refColResizeBar,
|
|
9478
|
+
class: 'vxe-table--resizable-col-bar'
|
|
9479
|
+
}, resizableOpts.showDragTip
|
|
9480
|
+
? [
|
|
9481
|
+
h('div', {
|
|
9482
|
+
class: 'vxe-table--resizable-number-tip'
|
|
9483
|
+
})
|
|
9484
|
+
]
|
|
9485
|
+
: []),
|
|
9486
|
+
/**
|
|
9487
|
+
* 行高线
|
|
9488
|
+
*/
|
|
9489
|
+
h('div', {
|
|
9490
|
+
key: 'trl',
|
|
9491
|
+
ref: refRowResizeBar,
|
|
9492
|
+
class: 'vxe-table--resizable-row-bar'
|
|
8961
9493
|
}, resizableOpts.showDragTip
|
|
8962
9494
|
? [
|
|
8963
9495
|
h('div', {
|
|
8964
|
-
ref: refCellResizeTip,
|
|
8965
9496
|
class: 'vxe-table--resizable-number-tip'
|
|
8966
9497
|
})
|
|
8967
9498
|
]
|
|
@@ -9058,10 +9589,14 @@ export default defineComponent({
|
|
|
9058
9589
|
/**
|
|
9059
9590
|
* 工具提示
|
|
9060
9591
|
*/
|
|
9061
|
-
h(VxeUITooltipComponent,
|
|
9592
|
+
h(VxeUITooltipComponent, {
|
|
9062
9593
|
key: 'btp',
|
|
9063
|
-
ref: refTooltip
|
|
9064
|
-
|
|
9594
|
+
ref: refTooltip,
|
|
9595
|
+
theme: tableTipConfig.theme,
|
|
9596
|
+
enterable: tableTipConfig.enterable,
|
|
9597
|
+
enterDelay: tableTipConfig.enterDelay,
|
|
9598
|
+
leaveDelay: tableTipConfig.leaveDelay
|
|
9599
|
+
}),
|
|
9065
9600
|
/**
|
|
9066
9601
|
* 校验提示
|
|
9067
9602
|
*/
|
|
@@ -9072,7 +9607,10 @@ export default defineComponent({
|
|
|
9072
9607
|
class: [{
|
|
9073
9608
|
'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete'
|
|
9074
9609
|
}, 'vxe-table--valid-error'],
|
|
9075
|
-
|
|
9610
|
+
theme: validTipConfig.theme,
|
|
9611
|
+
enterable: validTipConfig.enterable,
|
|
9612
|
+
enterDelay: validTipConfig.enterDelay,
|
|
9613
|
+
leaveDelay: validTipConfig.leaveDelay
|
|
9076
9614
|
})
|
|
9077
9615
|
: renderEmptyElement($xeTable)
|
|
9078
9616
|
])
|
|
@@ -9093,7 +9631,7 @@ export default defineComponent({
|
|
|
9093
9631
|
if (value && value.length >= 50000) {
|
|
9094
9632
|
warnLog('vxe.error.errLargeData', ['loadData(data), reloadData(data)'])
|
|
9095
9633
|
}
|
|
9096
|
-
loadTableData(value).then(() => {
|
|
9634
|
+
loadTableData(value, true).then(() => {
|
|
9097
9635
|
const { scrollXLoad, scrollYLoad, expandColumn } = reactData
|
|
9098
9636
|
internalData.inited = true
|
|
9099
9637
|
internalData.initStatus = true
|
|
@@ -9146,18 +9684,39 @@ export default defineComponent({
|
|
|
9146
9684
|
})
|
|
9147
9685
|
})
|
|
9148
9686
|
|
|
9687
|
+
const reScrollFlag = ref(0)
|
|
9688
|
+
watch(computeSize, () => {
|
|
9689
|
+
reScrollFlag.value++
|
|
9690
|
+
})
|
|
9149
9691
|
watch(() => props.showHeader, () => {
|
|
9150
|
-
|
|
9151
|
-
tableMethods.recalculate(true).then(() => tableMethods.refreshScroll())
|
|
9152
|
-
})
|
|
9692
|
+
reScrollFlag.value++
|
|
9153
9693
|
})
|
|
9154
|
-
|
|
9155
9694
|
watch(() => props.showFooter, () => {
|
|
9695
|
+
reScrollFlag.value++
|
|
9696
|
+
})
|
|
9697
|
+
watch(reScrollFlag, () => {
|
|
9156
9698
|
nextTick(() => {
|
|
9157
9699
|
tableMethods.recalculate(true).then(() => tableMethods.refreshScroll())
|
|
9158
9700
|
})
|
|
9159
9701
|
})
|
|
9160
9702
|
|
|
9703
|
+
const reLayoutFlag = ref(0)
|
|
9704
|
+
watch(() => props.height, () => {
|
|
9705
|
+
reLayoutFlag.value++
|
|
9706
|
+
})
|
|
9707
|
+
watch(() => props.maxHeight, () => {
|
|
9708
|
+
reLayoutFlag.value++
|
|
9709
|
+
})
|
|
9710
|
+
watch(computeScrollbarXToTop, () => {
|
|
9711
|
+
reLayoutFlag.value++
|
|
9712
|
+
})
|
|
9713
|
+
watch(computeScrollbarYToLeft, () => {
|
|
9714
|
+
reLayoutFlag.value++
|
|
9715
|
+
})
|
|
9716
|
+
watch(reLayoutFlag, () => {
|
|
9717
|
+
nextTick(() => tableMethods.recalculate(true))
|
|
9718
|
+
})
|
|
9719
|
+
|
|
9161
9720
|
const footFlag = ref(0)
|
|
9162
9721
|
watch(() => props.footerData ? props.footerData.length : -1, () => {
|
|
9163
9722
|
footFlag.value++
|
|
@@ -9169,26 +9728,12 @@ export default defineComponent({
|
|
|
9169
9728
|
tableMethods.updateFooter()
|
|
9170
9729
|
})
|
|
9171
9730
|
|
|
9172
|
-
watch(() => props.height, () => {
|
|
9173
|
-
nextTick(() => tableMethods.recalculate(true))
|
|
9174
|
-
})
|
|
9175
|
-
|
|
9176
|
-
watch(() => props.maxHeight, () => {
|
|
9177
|
-
nextTick(() => tableMethods.recalculate(true))
|
|
9178
|
-
})
|
|
9179
|
-
|
|
9180
|
-
watch(computeSize, () => {
|
|
9181
|
-
nextTick(() => {
|
|
9182
|
-
tableMethods.recalculate(true).then(() => tableMethods.refreshScroll())
|
|
9183
|
-
})
|
|
9184
|
-
})
|
|
9185
|
-
|
|
9186
9731
|
watch(() => props.syncResize, (value) => {
|
|
9187
9732
|
if (value) {
|
|
9188
|
-
|
|
9733
|
+
handleUpdateResize()
|
|
9189
9734
|
nextTick(() => {
|
|
9190
|
-
|
|
9191
|
-
setTimeout(() =>
|
|
9735
|
+
handleUpdateResize()
|
|
9736
|
+
setTimeout(() => handleUpdateResize())
|
|
9192
9737
|
})
|
|
9193
9738
|
}
|
|
9194
9739
|
})
|
|
@@ -9300,6 +9845,9 @@ export default defineComponent({
|
|
|
9300
9845
|
if (props.showFooter && !(props.footerMethod || props.footerData)) {
|
|
9301
9846
|
warnLog('vxe.error.reqProp', ['footer-data | footer-method'])
|
|
9302
9847
|
}
|
|
9848
|
+
if (rowOpts.height) {
|
|
9849
|
+
warnLog('vxe.error.delProp', ['row-config.height', 'cell-config.height'])
|
|
9850
|
+
}
|
|
9303
9851
|
// if (props.highlightCurrentRow) {
|
|
9304
9852
|
// warnLog('vxe.error.delProp', ['highlight-current-row', 'row-config.isCurrent'])
|
|
9305
9853
|
// }
|
|
@@ -9411,7 +9959,7 @@ export default defineComponent({
|
|
|
9411
9959
|
visibleSize: 0
|
|
9412
9960
|
})
|
|
9413
9961
|
|
|
9414
|
-
loadTableData(data || []).then(() => {
|
|
9962
|
+
loadTableData(data || [], true).then(() => {
|
|
9415
9963
|
if (data && data.length) {
|
|
9416
9964
|
internalData.inited = true
|
|
9417
9965
|
internalData.initStatus = true
|