vxe-table 4.10.6-beta.9 → 4.10.7
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 +107 -85
- package/es/table/src/cell.js +41 -55
- package/es/table/src/column.js +13 -1
- package/es/table/src/columnInfo.js +3 -0
- package/es/table/src/emits.js +2 -0
- package/es/table/src/footer.js +45 -7
- package/es/table/src/header.js +67 -165
- package/es/table/src/props.js +14 -4
- package/es/table/src/table.js +858 -398
- package/es/table/src/util.js +77 -62
- package/es/table/style.css +246 -191
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +20 -7
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +246 -191
- package/es/vxe-table/style.min.css +1 -1
- package/lib/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 +1479 -875
- 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 +7 -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 +111 -81
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +32 -42
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +13 -1
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +3 -0
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/emits.js +1 -1
- package/lib/table/src/emits.min.js +1 -1
- package/lib/table/src/footer.js +45 -5
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +51 -178
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/props.js +14 -4
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +911 -384
- 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 +246 -191
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +20 -7
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-table/style/style.css +246 -191
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/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 +126 -95
- package/packages/table/src/cell.ts +41 -63
- package/packages/table/src/column.ts +13 -1
- package/packages/table/src/columnInfo.ts +3 -0
- package/packages/table/src/emits.ts +5 -1
- package/packages/table/src/footer.ts +48 -8
- package/packages/table/src/header.ts +67 -165
- package/packages/table/src/props.ts +14 -5
- package/packages/table/src/table.ts +862 -398
- package/packages/table/src/util.ts +81 -62
- package/packages/ui/index.ts +19 -6
- package/styles/components/table.scss +313 -274
- package/styles/theme/base.scss +4 -6
- package/styles/theme/dark.scss +1 -0
- package/styles/theme/light.scss +1 -0
- package/styles/variable.scss +1 -1
- /package/es/{iconfont.1736854674495.ttf → iconfont.1739008158505.ttf} +0 -0
- /package/es/{iconfont.1736854674495.woff → iconfont.1739008158505.woff} +0 -0
- /package/es/{iconfont.1736854674495.woff2 → iconfont.1739008158505.woff2} +0 -0
- /package/lib/{iconfont.1736854674495.ttf → iconfont.1739008158505.ttf} +0 -0
- /package/lib/{iconfont.1736854674495.woff → iconfont.1739008158505.woff} +0 -0
- /package/lib/{iconfont.1736854674495.woff2 → iconfont.1739008158505.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,8 +268,9 @@ export default defineComponent({
|
|
|
268
268
|
dragCol: null,
|
|
269
269
|
dragTipText: '',
|
|
270
270
|
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
isDragResize: false,
|
|
272
|
+
isRowLoading: false,
|
|
273
|
+
isColLoading: false
|
|
273
274
|
})
|
|
274
275
|
|
|
275
276
|
const internalData: TableInternalData = {
|
|
@@ -344,10 +345,6 @@ export default defineComponent({
|
|
|
344
345
|
fullDataRowIdData: {},
|
|
345
346
|
fullColumnIdData: {},
|
|
346
347
|
fullColumnFieldData: {},
|
|
347
|
-
// 列选取状态
|
|
348
|
-
columnStatusMaps: {},
|
|
349
|
-
// 行选取状态
|
|
350
|
-
rowStatusMaps: {},
|
|
351
348
|
// prevDragRow: null,
|
|
352
349
|
|
|
353
350
|
inited: false,
|
|
@@ -380,8 +377,8 @@ export default defineComponent({
|
|
|
380
377
|
|
|
381
378
|
const refLeftContainer = ref() as Ref<HTMLDivElement>
|
|
382
379
|
const refRightContainer = ref() as Ref<HTMLDivElement>
|
|
383
|
-
const
|
|
384
|
-
const
|
|
380
|
+
const refColResizeBar = ref() as Ref<HTMLDivElement>
|
|
381
|
+
const refRowResizeBar = ref() as Ref<HTMLDivElement>
|
|
385
382
|
const refEmptyPlaceholder = ref() as Ref<HTMLDivElement>
|
|
386
383
|
|
|
387
384
|
const refDragTipElem = ref<HTMLDivElement>()
|
|
@@ -487,7 +484,7 @@ export default defineComponent({
|
|
|
487
484
|
const computeDefaultRowHeight = computed(() => {
|
|
488
485
|
const vSize = computeSize.value
|
|
489
486
|
const rowHeightMaps = computeRowHeightMaps.value
|
|
490
|
-
return rowHeightMaps[vSize || 'default']
|
|
487
|
+
return rowHeightMaps[vSize || 'default'] || 18
|
|
491
488
|
})
|
|
492
489
|
|
|
493
490
|
const computeColumnOpts = computed(() => {
|
|
@@ -495,7 +492,15 @@ export default defineComponent({
|
|
|
495
492
|
})
|
|
496
493
|
|
|
497
494
|
const computeCellOpts = computed(() => {
|
|
498
|
-
return Object.assign({}, getConfig().table.cellConfig, props.cellConfig)
|
|
495
|
+
return Object.assign({}, getConfig().table.cellConfig, props.cellConfig)
|
|
496
|
+
})
|
|
497
|
+
|
|
498
|
+
const computeHeaderCellOpts = computed(() => {
|
|
499
|
+
return Object.assign({}, getConfig().table.headerCellConfig, props.headerCellConfig)
|
|
500
|
+
})
|
|
501
|
+
|
|
502
|
+
const computeFooterCellOpts = computed(() => {
|
|
503
|
+
return Object.assign({}, getConfig().table.footerCellConfig, props.footerCellConfig)
|
|
499
504
|
})
|
|
500
505
|
|
|
501
506
|
const computeRowOpts = computed(() => {
|
|
@@ -534,6 +539,17 @@ export default defineComponent({
|
|
|
534
539
|
return Object.assign({}, getConfig().tooltip, getConfig().table.tooltipConfig, props.tooltipConfig)
|
|
535
540
|
})
|
|
536
541
|
|
|
542
|
+
const computeTableTipConfig = computed(() => {
|
|
543
|
+
const { tooltipStore } = reactData
|
|
544
|
+
const tooltipOpts = computeTooltipOpts.value
|
|
545
|
+
return Object.assign({}, tooltipOpts, tooltipStore.currOpts)
|
|
546
|
+
})
|
|
547
|
+
|
|
548
|
+
const computeValidTipConfig = computed(() => {
|
|
549
|
+
const tooltipOpts = computeTooltipOpts.value
|
|
550
|
+
return Object.assign({}, tooltipOpts)
|
|
551
|
+
})
|
|
552
|
+
|
|
537
553
|
const computeEditOpts = computed(() => {
|
|
538
554
|
return Object.assign({}, getConfig().table.editConfig, props.editConfig) as VxeTablePropTypes.EditOpts
|
|
539
555
|
})
|
|
@@ -755,8 +771,8 @@ export default defineComponent({
|
|
|
755
771
|
refTableRightFooter,
|
|
756
772
|
refLeftContainer,
|
|
757
773
|
refRightContainer,
|
|
758
|
-
|
|
759
|
-
|
|
774
|
+
refColResizeBar,
|
|
775
|
+
refRowResizeBar,
|
|
760
776
|
refScrollXVirtualElem,
|
|
761
777
|
refScrollYVirtualElem,
|
|
762
778
|
refScrollXHandleElem,
|
|
@@ -779,6 +795,8 @@ export default defineComponent({
|
|
|
779
795
|
computeScrollYThreshold,
|
|
780
796
|
computeDefaultRowHeight,
|
|
781
797
|
computeCellOpts,
|
|
798
|
+
computeHeaderCellOpts,
|
|
799
|
+
computeFooterCellOpts,
|
|
782
800
|
computeRowOpts,
|
|
783
801
|
computeRowDragOpts,
|
|
784
802
|
computeColumnDragOpts,
|
|
@@ -920,13 +938,13 @@ export default defineComponent({
|
|
|
920
938
|
}
|
|
921
939
|
|
|
922
940
|
const computeRowHeight = () => {
|
|
923
|
-
const {
|
|
941
|
+
const { isAllOverflow } = reactData
|
|
924
942
|
const tableHeader = refTableHeader.value
|
|
925
943
|
const tableBody = refTableBody.value
|
|
926
944
|
const tableBodyElem = tableBody ? tableBody.$el as HTMLDivElement : null
|
|
927
945
|
const defaultRowHeight = computeDefaultRowHeight.value
|
|
928
946
|
let rowHeight = 0
|
|
929
|
-
if (
|
|
947
|
+
if (isAllOverflow) {
|
|
930
948
|
if (tableBodyElem) {
|
|
931
949
|
const tableHeaderElem = tableHeader ? tableHeader.$el as HTMLDivElement : null
|
|
932
950
|
let firstTrElem
|
|
@@ -949,9 +967,11 @@ export default defineComponent({
|
|
|
949
967
|
}
|
|
950
968
|
|
|
951
969
|
const handleVirtualYVisible = (currScrollTop?: number) => {
|
|
952
|
-
const {
|
|
953
|
-
const {
|
|
954
|
-
const
|
|
970
|
+
const { isAllOverflow } = reactData
|
|
971
|
+
const { elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData
|
|
972
|
+
const rowOpts = computeRowOpts.value
|
|
973
|
+
const cellOpts = computeCellOpts.value
|
|
974
|
+
const defaultRowHeight = computeDefaultRowHeight.value
|
|
955
975
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
956
976
|
if (bodyScrollElem) {
|
|
957
977
|
const clientHeight = bodyScrollElem.clientHeight
|
|
@@ -960,15 +980,16 @@ export default defineComponent({
|
|
|
960
980
|
let toVisibleIndex = -1
|
|
961
981
|
let offsetTop = 0
|
|
962
982
|
let visibleSize = 0
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
983
|
+
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height
|
|
984
|
+
if (!isCustomCellHeight && isAllOverflow) {
|
|
985
|
+
toVisibleIndex = Math.floor(scrollTop / defaultRowHeight)
|
|
986
|
+
visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1
|
|
966
987
|
} else {
|
|
967
988
|
for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
968
989
|
const row = afterFullData[rIndex]
|
|
969
990
|
const rowid = getRowid($xeTable, row)
|
|
970
|
-
const rowRest = fullAllDataRowIdData[rowid]
|
|
971
|
-
offsetTop += rowRest
|
|
991
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
992
|
+
offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight
|
|
972
993
|
if (toVisibleIndex === -1 && scrollTop < offsetTop) {
|
|
973
994
|
toVisibleIndex = rIndex
|
|
974
995
|
}
|
|
@@ -1306,55 +1327,39 @@ export default defineComponent({
|
|
|
1306
1327
|
}
|
|
1307
1328
|
|
|
1308
1329
|
const calcColumnAutoWidth = (column: VxeTableDefines.ColumnInfo, wrapperEl: HTMLDivElement) => {
|
|
1309
|
-
const
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
if (firstCellEl) {
|
|
1313
|
-
const cellStyle = getComputedStyle(firstCellEl)
|
|
1314
|
-
|
|
1315
|
-
}
|
|
1316
|
-
let colWidth = column.renderAutoWidth -
|
|
1317
|
-
|
|
1318
|
-
const
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
XEUtils.arrayEach(cellEl.children, (btnEl) => {
|
|
1323
|
-
titleWidth += (btnEl as HTMLElement).offsetWidth + 1
|
|
1324
|
-
})
|
|
1325
|
-
} else {
|
|
1326
|
-
const labelEl = cellEl.firstElementChild as HTMLElement
|
|
1327
|
-
if (labelEl) {
|
|
1328
|
-
titleWidth = labelEl.offsetWidth
|
|
1329
|
-
}
|
|
1330
|
-
}
|
|
1331
|
-
if (titleWidth) {
|
|
1332
|
-
colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4)
|
|
1333
|
-
}
|
|
1334
|
-
})
|
|
1335
|
-
return colWidth + paddingSize
|
|
1330
|
+
const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[colid="${column.id}"]`)
|
|
1331
|
+
let leftRightPadding = 0
|
|
1332
|
+
const firstCellEl = cellElemList[0]
|
|
1333
|
+
if (firstCellEl && firstCellEl.parentElement) {
|
|
1334
|
+
const cellStyle = getComputedStyle(firstCellEl.parentElement)
|
|
1335
|
+
leftRightPadding = Math.ceil(XEUtils.toNumber(cellStyle.paddingLeft) + XEUtils.toNumber(cellStyle.paddingRight))
|
|
1336
|
+
}
|
|
1337
|
+
let colWidth = column.renderAutoWidth - leftRightPadding
|
|
1338
|
+
for (let i = 0; i < cellElemList.length; i++) {
|
|
1339
|
+
const celEl = cellElemList[i] as HTMLDivElement
|
|
1340
|
+
colWidth = Math.max(colWidth, celEl ? Math.ceil(celEl.scrollWidth) + 4 : 0)
|
|
1341
|
+
}
|
|
1342
|
+
return colWidth + leftRightPadding
|
|
1336
1343
|
}
|
|
1337
1344
|
|
|
1338
1345
|
const calcCellWidth = () => {
|
|
1339
1346
|
const autoWidthColumnList = computeAutoWidthColumnList.value
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
reactData.isCalcColumn = false
|
|
1357
|
-
})
|
|
1347
|
+
const { fullColumnIdData } = internalData
|
|
1348
|
+
const el = refElem.value
|
|
1349
|
+
if (el) {
|
|
1350
|
+
el.setAttribute('data-calc-col', 'Y')
|
|
1351
|
+
autoWidthColumnList.forEach(column => {
|
|
1352
|
+
const colid = column.id
|
|
1353
|
+
const colRest = fullColumnIdData[colid]
|
|
1354
|
+
const colWidth = calcColumnAutoWidth(column, el)
|
|
1355
|
+
if (colRest) {
|
|
1356
|
+
colRest.width = Math.max(colWidth, colRest.width)
|
|
1357
|
+
}
|
|
1358
|
+
column.renderAutoWidth = colWidth
|
|
1359
|
+
})
|
|
1360
|
+
$xeTable.analyColumnWidth()
|
|
1361
|
+
el.removeAttribute('data-calc-col')
|
|
1362
|
+
}
|
|
1358
1363
|
}
|
|
1359
1364
|
|
|
1360
1365
|
/**
|
|
@@ -1396,39 +1401,39 @@ export default defineComponent({
|
|
|
1396
1401
|
})
|
|
1397
1402
|
// 最小自适应
|
|
1398
1403
|
autoMinList.forEach((column) => {
|
|
1399
|
-
const
|
|
1400
|
-
tableWidth +=
|
|
1401
|
-
column.renderWidth =
|
|
1404
|
+
const caWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth))
|
|
1405
|
+
tableWidth += caWidth
|
|
1406
|
+
column.renderWidth = caWidth
|
|
1402
1407
|
})
|
|
1403
1408
|
// 最小百分比
|
|
1404
1409
|
scaleMinList.forEach((column) => {
|
|
1405
|
-
const
|
|
1406
|
-
tableWidth +=
|
|
1407
|
-
column.renderWidth =
|
|
1410
|
+
const smWidth = Math.floor(XEUtils.toInteger(column.minWidth) * meanWidth)
|
|
1411
|
+
tableWidth += smWidth
|
|
1412
|
+
column.renderWidth = smWidth
|
|
1408
1413
|
})
|
|
1409
1414
|
// 固定百分比
|
|
1410
1415
|
scaleList.forEach((column) => {
|
|
1411
|
-
const
|
|
1412
|
-
tableWidth +=
|
|
1413
|
-
column.renderWidth =
|
|
1416
|
+
const sfWidth = Math.floor(XEUtils.toInteger(column.width) * meanWidth)
|
|
1417
|
+
tableWidth += sfWidth
|
|
1418
|
+
column.renderWidth = sfWidth
|
|
1414
1419
|
})
|
|
1415
1420
|
// 固定宽
|
|
1416
1421
|
pxList.forEach((column) => {
|
|
1417
|
-
const
|
|
1418
|
-
tableWidth +=
|
|
1419
|
-
column.renderWidth =
|
|
1422
|
+
const pWidth = XEUtils.toInteger(column.width)
|
|
1423
|
+
tableWidth += pWidth
|
|
1424
|
+
column.renderWidth = pWidth
|
|
1420
1425
|
})
|
|
1421
1426
|
// 自适应宽
|
|
1422
1427
|
autoList.forEach((column) => {
|
|
1423
|
-
const
|
|
1424
|
-
tableWidth +=
|
|
1425
|
-
column.renderWidth =
|
|
1428
|
+
const aWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth))
|
|
1429
|
+
tableWidth += aWidth
|
|
1430
|
+
column.renderWidth = aWidth
|
|
1426
1431
|
})
|
|
1427
1432
|
// 调整了列宽
|
|
1428
1433
|
resizeList.forEach((column) => {
|
|
1429
|
-
const
|
|
1430
|
-
tableWidth +=
|
|
1431
|
-
column.renderWidth =
|
|
1434
|
+
const reWidth = XEUtils.toInteger(column.resizeWidth)
|
|
1435
|
+
tableWidth += reWidth
|
|
1436
|
+
column.renderWidth = reWidth
|
|
1432
1437
|
})
|
|
1433
1438
|
remainWidth -= tableWidth
|
|
1434
1439
|
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoMinList.length + remainList.length)) : 0
|
|
@@ -1468,7 +1473,7 @@ export default defineComponent({
|
|
|
1468
1473
|
}
|
|
1469
1474
|
const tableHeight = bodyElem.offsetHeight
|
|
1470
1475
|
const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight
|
|
1471
|
-
reactData.scrollbarWidth =
|
|
1476
|
+
reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth)
|
|
1472
1477
|
reactData.overflowY = overflowY
|
|
1473
1478
|
internalData.tableWidth = tableWidth
|
|
1474
1479
|
internalData.tableHeight = tableHeight
|
|
@@ -1478,7 +1483,7 @@ export default defineComponent({
|
|
|
1478
1483
|
const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0
|
|
1479
1484
|
const overflowX = tableWidth > bodyWidth
|
|
1480
1485
|
const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0
|
|
1481
|
-
reactData.scrollbarHeight =
|
|
1486
|
+
reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight)
|
|
1482
1487
|
internalData.headerHeight = headerHeight
|
|
1483
1488
|
internalData.footerHeight = footerHeight
|
|
1484
1489
|
reactData.overflowX = overflowX
|
|
@@ -1489,58 +1494,37 @@ export default defineComponent({
|
|
|
1489
1494
|
}
|
|
1490
1495
|
}
|
|
1491
1496
|
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
// }
|
|
1497
|
+
const calcCellAutoHeight = (rowRest: VxeTableDefines.RowCacheItem, wrapperEl: HTMLDivElement) => {
|
|
1498
|
+
const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`)
|
|
1499
|
+
let colHeight = rowRest.height
|
|
1500
|
+
for (let i = 0; i < cellElemList.length; i++) {
|
|
1501
|
+
const cellElem = cellElemList[i] as HTMLElement
|
|
1502
|
+
const tdEl = cellElem.parentElement as HTMLTableCellElement
|
|
1503
|
+
const topBottomPadding = Math.ceil(XEUtils.toNumber(tdEl.style.paddingTop) + XEUtils.toNumber(tdEl.style.paddingBottom))
|
|
1504
|
+
const cellHeight = cellElem ? cellElem.clientHeight : 0
|
|
1505
|
+
colHeight = Math.max(colHeight - topBottomPadding, Math.ceil(cellHeight))
|
|
1506
|
+
}
|
|
1507
|
+
return colHeight
|
|
1508
|
+
}
|
|
1505
1509
|
|
|
1506
1510
|
const calcCellHeight = () => {
|
|
1507
|
-
const {
|
|
1508
|
-
const { tableData, scrollXLoad } = reactData
|
|
1511
|
+
const { tableData, isAllOverflow, scrollYLoad, scrollXLoad } = reactData
|
|
1509
1512
|
const { fullAllDataRowIdData } = internalData
|
|
1513
|
+
const defaultRowHeight = computeDefaultRowHeight.value
|
|
1510
1514
|
const el = refElem.value
|
|
1511
|
-
if (!
|
|
1512
|
-
|
|
1513
|
-
let paddingBottom = 0
|
|
1514
|
-
let calcPadding = false
|
|
1515
|
+
if (!isAllOverflow && scrollYLoad && el) {
|
|
1516
|
+
el.setAttribute('data-calc-row', 'Y')
|
|
1515
1517
|
tableData.forEach(row => {
|
|
1516
1518
|
const rowid = getRowid($xeTable, row)
|
|
1517
1519
|
const rowRest = fullAllDataRowIdData[rowid]
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
for (let i = 0; i < cellList.length; i++) {
|
|
1522
|
-
const cellElem = cellList[i] as HTMLElement
|
|
1523
|
-
const tdEl = cellElem.parentElement as HTMLTableCellElement
|
|
1524
|
-
if (!tdEl || !tdEl.clientWidth) {
|
|
1525
|
-
break
|
|
1526
|
-
}
|
|
1527
|
-
if (!calcPadding) {
|
|
1528
|
-
paddingTop = XEUtils.toNumber(getComputedStyle(tdEl).paddingTop)
|
|
1529
|
-
paddingBottom = XEUtils.toNumber(getComputedStyle(tdEl).paddingBottom)
|
|
1530
|
-
calcPadding = true
|
|
1531
|
-
}
|
|
1532
|
-
let cellHeight = paddingTop + paddingBottom
|
|
1533
|
-
if (cellElem) {
|
|
1534
|
-
cellHeight += cellElem.clientHeight
|
|
1535
|
-
}
|
|
1536
|
-
height = Math.max(height, cellHeight)
|
|
1537
|
-
}
|
|
1538
|
-
rowRest.height = scrollXLoad ? Math.max(rowRest.height, height) : height
|
|
1520
|
+
if (rowRest) {
|
|
1521
|
+
const reHeight = calcCellAutoHeight(rowRest, el)
|
|
1522
|
+
rowRest.height = Math.max(defaultRowHeight, scrollXLoad ? Math.max(rowRest.height, reHeight) : reHeight)
|
|
1539
1523
|
}
|
|
1524
|
+
el.removeAttribute('data-calc-row')
|
|
1540
1525
|
})
|
|
1541
|
-
reactData.
|
|
1526
|
+
reactData.calcCellHeightFlag++
|
|
1542
1527
|
}
|
|
1543
|
-
// updateCellOffset()
|
|
1544
1528
|
}
|
|
1545
1529
|
|
|
1546
1530
|
const getOrderField = (column: VxeTableDefines.ColumnInfo) => {
|
|
@@ -1574,7 +1558,7 @@ export default defineComponent({
|
|
|
1574
1558
|
rowRest.seq = seq
|
|
1575
1559
|
rowRest._index = index
|
|
1576
1560
|
} else {
|
|
1577
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, treeIndex: -1, items: [], parent: null, level: 0, height: 0, oTop: 0 }
|
|
1561
|
+
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 }
|
|
1578
1562
|
fullAllDataRowIdData[rowid] = rest
|
|
1579
1563
|
fullDataRowIdData[rowid] = rest
|
|
1580
1564
|
}
|
|
@@ -1603,7 +1587,7 @@ export default defineComponent({
|
|
|
1603
1587
|
rowRest.seq = seq
|
|
1604
1588
|
rowRest.treeIndex = index
|
|
1605
1589
|
} else {
|
|
1606
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, items: [], parent: null, level: 0, height: 0, oTop: 0 }
|
|
1590
|
+
const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 }
|
|
1607
1591
|
fullAllDataRowIdData[rowid] = rest
|
|
1608
1592
|
fullDataRowIdData[rowid] = rest
|
|
1609
1593
|
}
|
|
@@ -1792,14 +1776,16 @@ export default defineComponent({
|
|
|
1792
1776
|
}
|
|
1793
1777
|
|
|
1794
1778
|
const updateStyle = () => {
|
|
1795
|
-
const { border,
|
|
1796
|
-
const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, scrollbarWidth, scrollbarHeight, columnStore, editStore, isAllOverflow, expandColumn } = reactData
|
|
1779
|
+
const { border, showHeaderOverflow: allColumnHeaderOverflow, showFooterOverflow: allColumnFooterOverflow, mouseConfig, spanMethod, footerSpanMethod } = props
|
|
1780
|
+
const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, overflowX, scrollbarWidth, overflowY, scrollbarHeight, columnStore, editStore, isAllOverflow, expandColumn } = reactData
|
|
1797
1781
|
const { visibleColumn, fullColumnIdData, tableHeight, tableWidth, headerHeight, footerHeight, elemStore, customHeight, customMinHeight, customMaxHeight } = internalData
|
|
1798
1782
|
const el = refElem.value
|
|
1799
1783
|
if (!el) {
|
|
1800
1784
|
return
|
|
1801
1785
|
}
|
|
1802
1786
|
const containerList = ['main', 'left', 'right']
|
|
1787
|
+
const osbWidth = overflowY ? scrollbarWidth : 0
|
|
1788
|
+
const osbHeight = overflowX ? scrollbarHeight : 0
|
|
1803
1789
|
const emptyPlaceholderElem = refEmptyPlaceholder.value
|
|
1804
1790
|
const cellOffsetWidth = computeCellOffsetWidth.value
|
|
1805
1791
|
const mouseOpts = computeMouseOpts.value
|
|
@@ -1807,17 +1793,17 @@ export default defineComponent({
|
|
|
1807
1793
|
const bodyTableElem = getRefElem(elemStore['main-body-table'])
|
|
1808
1794
|
if (emptyPlaceholderElem) {
|
|
1809
1795
|
emptyPlaceholderElem.style.top = `${headerHeight}px`
|
|
1810
|
-
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight -
|
|
1796
|
+
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : ''
|
|
1811
1797
|
}
|
|
1812
1798
|
|
|
1813
1799
|
let bodyHeight = 0
|
|
1814
1800
|
let bodyMaxHeight = 0
|
|
1815
|
-
const bodyMinHeight = customMinHeight - headerHeight - footerHeight -
|
|
1801
|
+
const bodyMinHeight = customMinHeight - headerHeight - footerHeight - osbHeight
|
|
1816
1802
|
if (customMaxHeight) {
|
|
1817
|
-
bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight -
|
|
1803
|
+
bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - osbHeight)
|
|
1818
1804
|
}
|
|
1819
1805
|
if (customHeight) {
|
|
1820
|
-
bodyHeight = customHeight - headerHeight - footerHeight -
|
|
1806
|
+
bodyHeight = customHeight - headerHeight - footerHeight - osbHeight
|
|
1821
1807
|
}
|
|
1822
1808
|
if (!bodyHeight) {
|
|
1823
1809
|
if (bodyTableElem) {
|
|
@@ -1836,28 +1822,28 @@ export default defineComponent({
|
|
|
1836
1822
|
const scrollbarXToTop = computeScrollbarXToTop.value
|
|
1837
1823
|
const scrollXVirtualEl = refScrollXVirtualElem.value
|
|
1838
1824
|
if (scrollXVirtualEl) {
|
|
1839
|
-
scrollXVirtualEl.style.height = `${
|
|
1840
|
-
scrollXVirtualEl.style.visibility =
|
|
1825
|
+
scrollXVirtualEl.style.height = `${osbHeight}px`
|
|
1826
|
+
scrollXVirtualEl.style.visibility = overflowX ? 'visible' : 'hidden'
|
|
1841
1827
|
}
|
|
1842
1828
|
const xWrapperEl = refScrollXWrapperElem.value
|
|
1843
1829
|
if (xWrapperEl) {
|
|
1844
|
-
xWrapperEl.style.left = scrollbarXToTop ? `${
|
|
1845
|
-
xWrapperEl.style.width = `${el.clientWidth -
|
|
1830
|
+
xWrapperEl.style.left = scrollbarXToTop ? `${osbWidth}px` : ''
|
|
1831
|
+
xWrapperEl.style.width = `${el.clientWidth - osbWidth}px`
|
|
1846
1832
|
}
|
|
1847
1833
|
if (xLeftCornerEl) {
|
|
1848
|
-
xLeftCornerEl.style.width = scrollbarXToTop ? `${
|
|
1849
|
-
xLeftCornerEl.style.display = scrollbarXToTop ? (
|
|
1834
|
+
xLeftCornerEl.style.width = scrollbarXToTop ? `${osbWidth}px` : ''
|
|
1835
|
+
xLeftCornerEl.style.display = scrollbarXToTop ? (osbWidth && osbHeight ? 'block' : '') : ''
|
|
1850
1836
|
}
|
|
1851
1837
|
if (xRightCornerEl) {
|
|
1852
|
-
xRightCornerEl.style.width = scrollbarXToTop ? '' : `${
|
|
1853
|
-
xRightCornerEl.style.display = scrollbarXToTop ? '' : (
|
|
1838
|
+
xRightCornerEl.style.width = scrollbarXToTop ? '' : `${osbWidth}px`
|
|
1839
|
+
xRightCornerEl.style.display = scrollbarXToTop ? '' : (osbWidth && osbHeight ? 'block' : '')
|
|
1854
1840
|
}
|
|
1855
1841
|
|
|
1856
1842
|
const scrollYVirtualEl = refScrollYVirtualElem.value
|
|
1857
1843
|
if (scrollYVirtualEl) {
|
|
1858
|
-
scrollYVirtualEl.style.width = `${
|
|
1844
|
+
scrollYVirtualEl.style.width = `${osbWidth}px`
|
|
1859
1845
|
scrollYVirtualEl.style.height = `${bodyHeight + headerHeight + footerHeight}px`
|
|
1860
|
-
scrollYVirtualEl.style.visibility =
|
|
1846
|
+
scrollYVirtualEl.style.visibility = overflowY ? 'visible' : 'hidden'
|
|
1861
1847
|
}
|
|
1862
1848
|
const yTopCornerEl = refScrollYTopCornerElem.value
|
|
1863
1849
|
if (yTopCornerEl) {
|
|
@@ -1983,7 +1969,7 @@ export default defineComponent({
|
|
|
1983
1969
|
if (wrapperElem) {
|
|
1984
1970
|
wrapperElem.style.top = `${headerHeight}px`
|
|
1985
1971
|
}
|
|
1986
|
-
fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + headerHeight + footerHeight +
|
|
1972
|
+
fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + headerHeight + footerHeight + osbHeight)}px`
|
|
1987
1973
|
fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`
|
|
1988
1974
|
}
|
|
1989
1975
|
|
|
@@ -1992,7 +1978,7 @@ export default defineComponent({
|
|
|
1992
1978
|
|
|
1993
1979
|
let isOptimizeMode = false
|
|
1994
1980
|
// 如果是使用优化模式
|
|
1995
|
-
if (scrollXLoad || scrollYLoad ||
|
|
1981
|
+
if (scrollXLoad || scrollYLoad || isAllOverflow) {
|
|
1996
1982
|
if (expandColumn || spanMethod || footerSpanMethod) {
|
|
1997
1983
|
// 如果不支持优化模式
|
|
1998
1984
|
} else {
|
|
@@ -2018,7 +2004,7 @@ export default defineComponent({
|
|
|
2018
2004
|
if (tableElem) {
|
|
2019
2005
|
tableElem.style.width = tWidth ? `${tWidth}px` : ''
|
|
2020
2006
|
// 兼容性处理
|
|
2021
|
-
tableElem.style.paddingRight =
|
|
2007
|
+
tableElem.style.paddingRight = osbWidth && fixedType && (browse['-moz'] || browse.safari) ? `${osbWidth}px` : ''
|
|
2022
2008
|
}
|
|
2023
2009
|
const emptyBlockElem = getRefElem(elemStore[`${name}-${layout}-emptyBlock`])
|
|
2024
2010
|
if (emptyBlockElem) {
|
|
@@ -2058,7 +2044,7 @@ export default defineComponent({
|
|
|
2058
2044
|
// 如果是固定列
|
|
2059
2045
|
if (fixedWrapperElem) {
|
|
2060
2046
|
if (wrapperElem) {
|
|
2061
|
-
wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight -
|
|
2047
|
+
wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight - osbHeight : tableHeight + headerHeight}px`
|
|
2062
2048
|
}
|
|
2063
2049
|
}
|
|
2064
2050
|
}
|
|
@@ -2081,7 +2067,7 @@ export default defineComponent({
|
|
|
2081
2067
|
} else if (layout === 'footer') {
|
|
2082
2068
|
cellOverflow = XEUtils.isUndefined(showFooterOverflow) || XEUtils.isNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow
|
|
2083
2069
|
} else {
|
|
2084
|
-
cellOverflow = XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow) ?
|
|
2070
|
+
cellOverflow = XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow) ? isAllOverflow : showOverflow
|
|
2085
2071
|
}
|
|
2086
2072
|
const showEllipsis = cellOverflow === 'ellipsis'
|
|
2087
2073
|
const showTitle = cellOverflow === 'title'
|
|
@@ -2674,12 +2660,11 @@ export default defineComponent({
|
|
|
2674
2660
|
* 加载表格数据
|
|
2675
2661
|
* @param {Array} datas 数据
|
|
2676
2662
|
*/
|
|
2677
|
-
const loadTableData = (datas: any[]) => {
|
|
2678
|
-
const { keepSource, treeConfig
|
|
2663
|
+
const loadTableData = (datas: any[], isReset: boolean) => {
|
|
2664
|
+
const { keepSource, treeConfig } = props
|
|
2679
2665
|
const { editStore, scrollYLoad: oldScrollYLoad } = reactData
|
|
2680
2666
|
const { scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop } = internalData
|
|
2681
2667
|
const treeOpts = computeTreeOpts.value
|
|
2682
|
-
const rowOpts = computeRowOpts.value
|
|
2683
2668
|
const { transform } = treeOpts
|
|
2684
2669
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
2685
2670
|
let treeData = []
|
|
@@ -2724,43 +2709,30 @@ export default defineComponent({
|
|
|
2724
2709
|
scrollYStore.endIndex = 1
|
|
2725
2710
|
scrollXStore.startIndex = 0
|
|
2726
2711
|
scrollXStore.endIndex = 1
|
|
2712
|
+
reactData.isRowLoading = true
|
|
2727
2713
|
reactData.scrollVMLoading = false
|
|
2728
2714
|
editStore.insertMaps = {}
|
|
2729
2715
|
editStore.removeMaps = {}
|
|
2730
2716
|
const sYLoad = updateScrollYStatus(fullData)
|
|
2717
|
+
reactData.isDragColMove = false
|
|
2731
2718
|
reactData.isDragRowMove = false
|
|
2732
2719
|
// 全量数据
|
|
2733
2720
|
internalData.tableFullData = fullData
|
|
2734
2721
|
internalData.tableFullTreeData = treeData
|
|
2735
2722
|
// 缓存数据
|
|
2736
|
-
|
|
2723
|
+
$xeTable.cacheRowMap(true, isReset)
|
|
2737
2724
|
// 原始数据
|
|
2738
2725
|
internalData.tableSynchData = datas
|
|
2726
|
+
if (isReset) {
|
|
2727
|
+
internalData.isResizeCellHeight = false
|
|
2728
|
+
reactData.rowExpandedMaps = {}
|
|
2729
|
+
reactData.rowExpandLazyLoadedMaps = {}
|
|
2730
|
+
reactData.treeExpandedMaps = {}
|
|
2731
|
+
reactData.treeExpandLazyLoadedMaps = {}
|
|
2732
|
+
}
|
|
2739
2733
|
// 克隆原数据,用于显示编辑状态,与编辑值做对比
|
|
2740
2734
|
if (keepSource) {
|
|
2741
|
-
|
|
2742
|
-
}
|
|
2743
|
-
if (sYLoad) {
|
|
2744
|
-
if (showOverflow) {
|
|
2745
|
-
if (!rowOpts.height) {
|
|
2746
|
-
const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
|
|
2747
|
-
if (errColumn) {
|
|
2748
|
-
errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
|
|
2749
|
-
}
|
|
2750
|
-
}
|
|
2751
|
-
}
|
|
2752
|
-
|
|
2753
|
-
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
2754
|
-
if (!(props.height || props.maxHeight)) {
|
|
2755
|
-
errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}'])
|
|
2756
|
-
}
|
|
2757
|
-
// if (!props.showOverflow) {
|
|
2758
|
-
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2759
|
-
// }
|
|
2760
|
-
if (props.spanMethod) {
|
|
2761
|
-
warnLog('vxe.error.scrollErrProp', ['table.span-method'])
|
|
2762
|
-
}
|
|
2763
|
-
}
|
|
2735
|
+
$xeTable.cacheSourceMap(fullData)
|
|
2764
2736
|
}
|
|
2765
2737
|
if ($xeTable.clearCellAreas && props.mouseConfig) {
|
|
2766
2738
|
$xeTable.clearCellAreas()
|
|
@@ -2780,6 +2752,30 @@ export default defineComponent({
|
|
|
2780
2752
|
if (sYLoad) {
|
|
2781
2753
|
scrollYStore.endIndex = scrollYStore.visibleSize
|
|
2782
2754
|
}
|
|
2755
|
+
|
|
2756
|
+
if (sYLoad) {
|
|
2757
|
+
// if (showOverflow) {
|
|
2758
|
+
// if (!rowOpts.height) {
|
|
2759
|
+
// const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
|
|
2760
|
+
// if (errColumn) {
|
|
2761
|
+
// errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
|
|
2762
|
+
// }
|
|
2763
|
+
// }
|
|
2764
|
+
// }
|
|
2765
|
+
|
|
2766
|
+
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
2767
|
+
if (!(props.height || props.maxHeight)) {
|
|
2768
|
+
errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}'])
|
|
2769
|
+
}
|
|
2770
|
+
// if (!props.showOverflow) {
|
|
2771
|
+
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2772
|
+
// }
|
|
2773
|
+
if (props.spanMethod) {
|
|
2774
|
+
warnLog('vxe.error.scrollErrProp', ['table.span-method'])
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2783
2779
|
handleReserveStatus()
|
|
2784
2780
|
tablePrivateMethods.checkSelectionStatus()
|
|
2785
2781
|
return new Promise<void>(resolve => {
|
|
@@ -2797,6 +2793,7 @@ export default defineComponent({
|
|
|
2797
2793
|
if (sYOpts.scrollToTopOnChange) {
|
|
2798
2794
|
targetScrollTop = 0
|
|
2799
2795
|
}
|
|
2796
|
+
reactData.isRowLoading = false
|
|
2800
2797
|
calcCellHeight()
|
|
2801
2798
|
// 是否变更虚拟滚动
|
|
2802
2799
|
if (oldScrollYLoad === sYLoad) {
|
|
@@ -3031,13 +3028,12 @@ export default defineComponent({
|
|
|
3031
3028
|
internalData.collectColumn = collectColumn
|
|
3032
3029
|
const tableFullColumn = getColumnList(collectColumn)
|
|
3033
3030
|
internalData.tableFullColumn = tableFullColumn
|
|
3034
|
-
reactData.
|
|
3031
|
+
reactData.isColLoading = true
|
|
3035
3032
|
reactData.isDragColMove = false
|
|
3036
3033
|
initColumnSort()
|
|
3037
3034
|
return Promise.resolve(
|
|
3038
3035
|
restoreCustomStorage()
|
|
3039
3036
|
).then(() => {
|
|
3040
|
-
reactData.isLoading = false
|
|
3041
3037
|
cacheColumnMap()
|
|
3042
3038
|
parseColumns(true).then(() => {
|
|
3043
3039
|
if (reactData.scrollXLoad) {
|
|
@@ -3062,6 +3058,7 @@ export default defineComponent({
|
|
|
3062
3058
|
if ($xeTable.handleUpdateCustomColumn) {
|
|
3063
3059
|
$xeTable.handleUpdateCustomColumn()
|
|
3064
3060
|
}
|
|
3061
|
+
reactData.isColLoading = false
|
|
3065
3062
|
return $xeTable.recalculate()
|
|
3066
3063
|
})
|
|
3067
3064
|
})
|
|
@@ -3182,11 +3179,10 @@ export default defineComponent({
|
|
|
3182
3179
|
* 纵向 Y 可视渲染处理
|
|
3183
3180
|
*/
|
|
3184
3181
|
const loadScrollYData = (scrollTop?: number) => {
|
|
3185
|
-
const {
|
|
3186
|
-
const { mergeList } = reactData
|
|
3182
|
+
const { mergeList, isAllOverflow } = reactData
|
|
3187
3183
|
const { scrollYStore } = internalData
|
|
3188
3184
|
const { preloadSize, startIndex, endIndex, offsetSize } = scrollYStore
|
|
3189
|
-
const autoOffsetYSize =
|
|
3185
|
+
const autoOffsetYSize = isAllOverflow ? offsetSize : offsetSize + 1
|
|
3190
3186
|
const { toVisibleIndex, visibleSize } = handleVirtualYVisible(scrollTop)
|
|
3191
3187
|
const offsetItem = {
|
|
3192
3188
|
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
@@ -3235,7 +3231,7 @@ export default defineComponent({
|
|
|
3235
3231
|
const lazyScrollXData = () => {
|
|
3236
3232
|
const { lxTimeout, lxRunTime, scrollXStore } = internalData
|
|
3237
3233
|
const { visibleSize } = scrollXStore
|
|
3238
|
-
const fpsTime = Math.max(5, Math.min(
|
|
3234
|
+
const fpsTime = Math.max(5, Math.min(10, Math.floor(visibleSize / 3)))
|
|
3239
3235
|
if (lxTimeout) {
|
|
3240
3236
|
clearTimeout(lxTimeout)
|
|
3241
3237
|
}
|
|
@@ -3251,8 +3247,9 @@ export default defineComponent({
|
|
|
3251
3247
|
}
|
|
3252
3248
|
|
|
3253
3249
|
const lazyScrollYData = () => {
|
|
3254
|
-
const { lyTimeout, lyRunTime } = internalData
|
|
3255
|
-
const
|
|
3250
|
+
const { lyTimeout, lyRunTime, scrollYStore } = internalData
|
|
3251
|
+
const { visibleSize } = scrollYStore
|
|
3252
|
+
const fpsTime = Math.floor(Math.max(4, Math.min(10, visibleSize / 3)))
|
|
3256
3253
|
if (lyTimeout) {
|
|
3257
3254
|
clearTimeout(lyTimeout)
|
|
3258
3255
|
}
|
|
@@ -3276,12 +3273,14 @@ export default defineComponent({
|
|
|
3276
3273
|
internalData.lcsTimeout = setTimeout(() => {
|
|
3277
3274
|
internalData.lcsRunTime = Date.now()
|
|
3278
3275
|
internalData.lcsTimeout = undefined
|
|
3276
|
+
internalData.intoRunScroll = false
|
|
3279
3277
|
internalData.inVirtualScroll = false
|
|
3280
3278
|
internalData.inWheelScroll = false
|
|
3281
3279
|
internalData.inHeaderScroll = false
|
|
3282
3280
|
internalData.inBodyScroll = false
|
|
3283
3281
|
internalData.inFooterScroll = false
|
|
3284
3282
|
internalData.scrollRenderType = ''
|
|
3283
|
+
|
|
3285
3284
|
calcCellHeight()
|
|
3286
3285
|
if (isRollX && scrollXLoad) {
|
|
3287
3286
|
$xeTable.updateScrollXData()
|
|
@@ -3296,6 +3295,45 @@ export default defineComponent({
|
|
|
3296
3295
|
}, 200)
|
|
3297
3296
|
}
|
|
3298
3297
|
|
|
3298
|
+
const getWheelSpeed = (lastScrollTime: number) => {
|
|
3299
|
+
let multiple = 1
|
|
3300
|
+
const currTime = Date.now()
|
|
3301
|
+
if (lastScrollTime + 25 > currTime) {
|
|
3302
|
+
multiple = 1.18
|
|
3303
|
+
} else if (lastScrollTime + 30 > currTime) {
|
|
3304
|
+
multiple = 1.15
|
|
3305
|
+
} else if (lastScrollTime + 40 > currTime) {
|
|
3306
|
+
multiple = 1.12
|
|
3307
|
+
} else if (lastScrollTime + 55 > currTime) {
|
|
3308
|
+
multiple = 1.09
|
|
3309
|
+
} else if (lastScrollTime + 75 > currTime) {
|
|
3310
|
+
multiple = 1.06
|
|
3311
|
+
} else if (lastScrollTime + 100 > currTime) {
|
|
3312
|
+
multiple = 1.03
|
|
3313
|
+
}
|
|
3314
|
+
return multiple
|
|
3315
|
+
}
|
|
3316
|
+
|
|
3317
|
+
const wheelScrollTo = (diffNum: number, cb: (progress: number) => void) => {
|
|
3318
|
+
const duration = Math.abs(diffNum)
|
|
3319
|
+
const startTime = performance.now()
|
|
3320
|
+
let countTop = 0
|
|
3321
|
+
const step = (timestamp: number) => {
|
|
3322
|
+
let progress = (timestamp - startTime) / duration
|
|
3323
|
+
if (progress > 1) {
|
|
3324
|
+
progress = 1
|
|
3325
|
+
}
|
|
3326
|
+
const easedProgress = Math.pow(progress, 2)
|
|
3327
|
+
const offsetTop = Math.floor((diffNum * easedProgress)) - countTop
|
|
3328
|
+
countTop += offsetTop
|
|
3329
|
+
cb(offsetTop)
|
|
3330
|
+
if (progress < 1) {
|
|
3331
|
+
requestAnimationFrame(step)
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3334
|
+
requestAnimationFrame(step)
|
|
3335
|
+
}
|
|
3336
|
+
|
|
3299
3337
|
const dispatchEvent = (type: ValueOf<VxeTableEmits>, params: Record<string, any>, evnt: Event | null) => {
|
|
3300
3338
|
emit(type, createEvent(evnt, { $table: $xeTable, $grid: $xeGrid }, params))
|
|
3301
3339
|
}
|
|
@@ -3309,13 +3347,34 @@ export default defineComponent({
|
|
|
3309
3347
|
return nextTick()
|
|
3310
3348
|
}
|
|
3311
3349
|
|
|
3312
|
-
|
|
3350
|
+
const handleUpdateResize = () => {
|
|
3313
3351
|
const el = refElem.value
|
|
3314
3352
|
if (el && el.clientWidth && el.clientHeight) {
|
|
3315
3353
|
tableMethods.recalculate()
|
|
3316
3354
|
}
|
|
3317
3355
|
}
|
|
3318
3356
|
|
|
3357
|
+
const handleUpdateColResize = (evnt: MouseEvent, params: any) => {
|
|
3358
|
+
$xeTable.analyColumnWidth()
|
|
3359
|
+
$xeTable.recalculate(true).then(() => {
|
|
3360
|
+
$xeTable.saveCustomStore('update:width')
|
|
3361
|
+
$xeTable.updateCellAreas()
|
|
3362
|
+
$xeTable.dispatchEvent('column-resizable-change', params, evnt)
|
|
3363
|
+
// 已废弃 resizable-change
|
|
3364
|
+
$xeTable.dispatchEvent('resizable-change', params, evnt)
|
|
3365
|
+
setTimeout(() => $xeTable.recalculate(true), 300)
|
|
3366
|
+
})
|
|
3367
|
+
}
|
|
3368
|
+
|
|
3369
|
+
const handleUpdateRowResize = (evnt: MouseEvent, params: any) => {
|
|
3370
|
+
reactData.resizeHeightFlag++
|
|
3371
|
+
$xeTable.recalculate(true).then(() => {
|
|
3372
|
+
$xeTable.updateCellAreas()
|
|
3373
|
+
$xeTable.dispatchEvent('row-resizable-change', params, evnt)
|
|
3374
|
+
setTimeout(() => $xeTable.recalculate(true), 300)
|
|
3375
|
+
})
|
|
3376
|
+
}
|
|
3377
|
+
|
|
3319
3378
|
tableMethods = {
|
|
3320
3379
|
dispatchEvent,
|
|
3321
3380
|
/**
|
|
@@ -3368,7 +3427,7 @@ export default defineComponent({
|
|
|
3368
3427
|
*/
|
|
3369
3428
|
loadData (datas) {
|
|
3370
3429
|
const { initStatus } = internalData
|
|
3371
|
-
return loadTableData(datas).then(() => {
|
|
3430
|
+
return loadTableData(datas, false).then(() => {
|
|
3372
3431
|
internalData.inited = true
|
|
3373
3432
|
internalData.initStatus = true
|
|
3374
3433
|
if (!initStatus) {
|
|
@@ -3386,7 +3445,7 @@ export default defineComponent({
|
|
|
3386
3445
|
.then(() => {
|
|
3387
3446
|
internalData.inited = true
|
|
3388
3447
|
internalData.initStatus = true
|
|
3389
|
-
return loadTableData(datas)
|
|
3448
|
+
return loadTableData(datas, true)
|
|
3390
3449
|
}).then(() => {
|
|
3391
3450
|
handleLoadDefaults()
|
|
3392
3451
|
return tableMethods.recalculate()
|
|
@@ -3475,7 +3534,7 @@ export default defineComponent({
|
|
|
3475
3534
|
XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
|
|
3476
3535
|
const rowid = getRowid($xeTable, childRow)
|
|
3477
3536
|
const parentRow = parentItem || parentRest.row
|
|
3478
|
-
const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, treeIndex: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, oTop: 0 }
|
|
3537
|
+
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 }
|
|
3479
3538
|
fullDataRowIdData[rowid] = rest
|
|
3480
3539
|
fullAllDataRowIdData[rowid] = rest
|
|
3481
3540
|
}, { children: childrenField })
|
|
@@ -3700,29 +3759,30 @@ export default defineComponent({
|
|
|
3700
3759
|
return nextTick()
|
|
3701
3760
|
},
|
|
3702
3761
|
getCellElement (row, fieldOrColumn) {
|
|
3762
|
+
const { elemStore } = internalData
|
|
3703
3763
|
const column = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
3704
3764
|
if (!column) {
|
|
3705
3765
|
return null
|
|
3706
3766
|
}
|
|
3707
3767
|
const rowid = getRowid($xeTable, row)
|
|
3708
|
-
const
|
|
3709
|
-
const
|
|
3710
|
-
const
|
|
3768
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
3769
|
+
const leftScrollElem = getRefElem(elemStore['left-body-scroll'])
|
|
3770
|
+
const rightScrollElem = getRefElem(elemStore['right-body-scroll'])
|
|
3711
3771
|
let bodyElem
|
|
3712
3772
|
if (column) {
|
|
3713
3773
|
if (column.fixed) {
|
|
3714
3774
|
if (column.fixed === 'left') {
|
|
3715
|
-
if (
|
|
3716
|
-
bodyElem =
|
|
3775
|
+
if (leftScrollElem) {
|
|
3776
|
+
bodyElem = leftScrollElem
|
|
3717
3777
|
}
|
|
3718
3778
|
} else {
|
|
3719
|
-
if (
|
|
3720
|
-
bodyElem =
|
|
3779
|
+
if (rightScrollElem) {
|
|
3780
|
+
bodyElem = rightScrollElem
|
|
3721
3781
|
}
|
|
3722
3782
|
}
|
|
3723
3783
|
}
|
|
3724
3784
|
if (!bodyElem) {
|
|
3725
|
-
bodyElem =
|
|
3785
|
+
bodyElem = bodyScrollElem
|
|
3726
3786
|
}
|
|
3727
3787
|
if (bodyElem) {
|
|
3728
3788
|
return bodyElem.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`)
|
|
@@ -4127,29 +4187,34 @@ export default defineComponent({
|
|
|
4127
4187
|
return nextTick()
|
|
4128
4188
|
},
|
|
4129
4189
|
setColumnWidth (fieldOrColumn, width) {
|
|
4190
|
+
const { elemStore } = internalData
|
|
4130
4191
|
let status = false
|
|
4131
4192
|
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn]
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4193
|
+
let cWidth = XEUtils.toInteger(width)
|
|
4194
|
+
if (isScale(width)) {
|
|
4195
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
4196
|
+
const bodyWidth = bodyScrollElem ? bodyScrollElem.clientWidth - 1 : 0
|
|
4197
|
+
cWidth = Math.floor(cWidth * bodyWidth)
|
|
4198
|
+
}
|
|
4199
|
+
if (cWidth) {
|
|
4200
|
+
cols.forEach(item => {
|
|
4201
|
+
const column = handleFieldOrColumn($xeTable, item)
|
|
4202
|
+
if (column) {
|
|
4203
|
+
column.resizeWidth = cWidth
|
|
4204
|
+
if (!status) {
|
|
4205
|
+
status = true
|
|
4206
|
+
}
|
|
4146
4207
|
}
|
|
4208
|
+
})
|
|
4209
|
+
if (status) {
|
|
4210
|
+
return $xeTable.refreshColumn().then(() => {
|
|
4211
|
+
return { status }
|
|
4212
|
+
})
|
|
4147
4213
|
}
|
|
4148
|
-
})
|
|
4149
|
-
if (status) {
|
|
4150
|
-
return tableMethods.refreshColumn()
|
|
4151
4214
|
}
|
|
4152
|
-
return nextTick()
|
|
4215
|
+
return nextTick().then(() => {
|
|
4216
|
+
return { status }
|
|
4217
|
+
})
|
|
4153
4218
|
},
|
|
4154
4219
|
getColumnWidth (fieldOrColumn) {
|
|
4155
4220
|
const column = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
@@ -4182,6 +4247,93 @@ export default defineComponent({
|
|
|
4182
4247
|
return tableMethods.recalculate()
|
|
4183
4248
|
})
|
|
4184
4249
|
},
|
|
4250
|
+
setRowHeightConf (heightConf) {
|
|
4251
|
+
const { fullAllDataRowIdData } = internalData
|
|
4252
|
+
let status = false
|
|
4253
|
+
if (heightConf) {
|
|
4254
|
+
XEUtils.each(heightConf, (height, rowid) => {
|
|
4255
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
4256
|
+
if (rowRest) {
|
|
4257
|
+
const rHeight = XEUtils.toInteger(height)
|
|
4258
|
+
if (rHeight) {
|
|
4259
|
+
rowRest.resizeHeight = rHeight
|
|
4260
|
+
if (!status) {
|
|
4261
|
+
status = true
|
|
4262
|
+
}
|
|
4263
|
+
}
|
|
4264
|
+
}
|
|
4265
|
+
})
|
|
4266
|
+
if (status) {
|
|
4267
|
+
internalData.isResizeCellHeight = true
|
|
4268
|
+
reactData.resizeHeightFlag++
|
|
4269
|
+
}
|
|
4270
|
+
}
|
|
4271
|
+
return nextTick().then(() => {
|
|
4272
|
+
return { status }
|
|
4273
|
+
})
|
|
4274
|
+
},
|
|
4275
|
+
getRowHeightConf (isFull) {
|
|
4276
|
+
const { fullAllDataRowIdData, afterFullData } = internalData
|
|
4277
|
+
const rowOpts = computeRowOpts.value
|
|
4278
|
+
const cellOpts = computeCellOpts.value
|
|
4279
|
+
const defaultRowHeight = computeDefaultRowHeight.value
|
|
4280
|
+
const rest: Record<string, number> = {}
|
|
4281
|
+
afterFullData.forEach(row => {
|
|
4282
|
+
const rowid = getRowid($xeTable, row)
|
|
4283
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
4284
|
+
if (rowRest) {
|
|
4285
|
+
const resizeHeight = rowRest.resizeHeight
|
|
4286
|
+
if (resizeHeight || isFull) {
|
|
4287
|
+
const currCellHeight = resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight
|
|
4288
|
+
rest[rowid] = currCellHeight
|
|
4289
|
+
}
|
|
4290
|
+
}
|
|
4291
|
+
})
|
|
4292
|
+
return rest
|
|
4293
|
+
},
|
|
4294
|
+
setRowHeight (rowOrId, height) {
|
|
4295
|
+
const { fullAllDataRowIdData } = internalData
|
|
4296
|
+
let status = false
|
|
4297
|
+
const rows = XEUtils.isArray(rowOrId) ? rowOrId : [rowOrId]
|
|
4298
|
+
let rHeight = XEUtils.toInteger(height)
|
|
4299
|
+
if (isScale(height)) {
|
|
4300
|
+
const tableBody = refTableBody.value
|
|
4301
|
+
const bodyElem = tableBody ? tableBody.$el as HTMLDivElement : null
|
|
4302
|
+
const bodyHeight = bodyElem ? bodyElem.clientHeight - 1 : 0
|
|
4303
|
+
rHeight = Math.floor(rHeight * bodyHeight)
|
|
4304
|
+
}
|
|
4305
|
+
if (rHeight) {
|
|
4306
|
+
rows.forEach(row => {
|
|
4307
|
+
const rowid = XEUtils.isString(row) || XEUtils.isNumber(row) ? row : getRowid($xeTable, row)
|
|
4308
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
4309
|
+
if (rowRest) {
|
|
4310
|
+
rowRest.resizeHeight = rHeight
|
|
4311
|
+
if (!status) {
|
|
4312
|
+
status = true
|
|
4313
|
+
}
|
|
4314
|
+
}
|
|
4315
|
+
})
|
|
4316
|
+
if (status) {
|
|
4317
|
+
internalData.isResizeCellHeight = true
|
|
4318
|
+
reactData.resizeHeightFlag++
|
|
4319
|
+
}
|
|
4320
|
+
}
|
|
4321
|
+
return nextTick().then(() => {
|
|
4322
|
+
return { status }
|
|
4323
|
+
})
|
|
4324
|
+
},
|
|
4325
|
+
getRowHeight (rowOrId) {
|
|
4326
|
+
const { fullAllDataRowIdData } = internalData
|
|
4327
|
+
const rowOpts = computeRowOpts.value
|
|
4328
|
+
const cellOpts = computeCellOpts.value
|
|
4329
|
+
const defaultRowHeight = computeDefaultRowHeight.value
|
|
4330
|
+
const rowid = XEUtils.isString(rowOrId) || XEUtils.isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId)
|
|
4331
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
4332
|
+
if (rowRest) {
|
|
4333
|
+
return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight
|
|
4334
|
+
}
|
|
4335
|
+
return 0
|
|
4336
|
+
},
|
|
4185
4337
|
/**
|
|
4186
4338
|
* 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
|
|
4187
4339
|
*/
|
|
@@ -5202,13 +5354,13 @@ export default defineComponent({
|
|
|
5202
5354
|
*/
|
|
5203
5355
|
getScroll () {
|
|
5204
5356
|
const { scrollXLoad, scrollYLoad } = reactData
|
|
5205
|
-
const
|
|
5206
|
-
const
|
|
5357
|
+
const { elemStore } = internalData
|
|
5358
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
5207
5359
|
return {
|
|
5208
5360
|
virtualX: scrollXLoad,
|
|
5209
5361
|
virtualY: scrollYLoad,
|
|
5210
|
-
scrollTop:
|
|
5211
|
-
scrollLeft:
|
|
5362
|
+
scrollTop: bodyScrollElem ? bodyScrollElem.scrollTop : 0,
|
|
5363
|
+
scrollLeft: bodyScrollElem ? bodyScrollElem.scrollLeft : 0
|
|
5212
5364
|
}
|
|
5213
5365
|
},
|
|
5214
5366
|
/**
|
|
@@ -5258,8 +5410,7 @@ export default defineComponent({
|
|
|
5258
5410
|
* @param {ColumnInfo} fieldOrColumn 列配置
|
|
5259
5411
|
*/
|
|
5260
5412
|
scrollToRow (row, fieldOrColumn) {
|
|
5261
|
-
const {
|
|
5262
|
-
const { scrollYLoad, scrollXLoad } = reactData
|
|
5413
|
+
const { isAllOverflow, scrollYLoad, scrollXLoad } = reactData
|
|
5263
5414
|
const rest = []
|
|
5264
5415
|
if (row) {
|
|
5265
5416
|
if (props.treeConfig) {
|
|
@@ -5273,7 +5424,7 @@ export default defineComponent({
|
|
|
5273
5424
|
}
|
|
5274
5425
|
return Promise.all(rest).then(() => {
|
|
5275
5426
|
if (row) {
|
|
5276
|
-
if (!
|
|
5427
|
+
if (!isAllOverflow && (scrollYLoad || scrollXLoad)) {
|
|
5277
5428
|
calcCellHeight()
|
|
5278
5429
|
calcCellWidth()
|
|
5279
5430
|
}
|
|
@@ -6225,9 +6376,11 @@ export default defineComponent({
|
|
|
6225
6376
|
if (!el) {
|
|
6226
6377
|
return
|
|
6227
6378
|
}
|
|
6228
|
-
const { scrollbarWidth, scrollbarHeight } = reactData
|
|
6379
|
+
const { overflowX, scrollbarWidth, overflowY, scrollbarHeight } = reactData
|
|
6229
6380
|
const { prevDragToChild } = internalData
|
|
6230
6381
|
const wrapperRect = el.getBoundingClientRect()
|
|
6382
|
+
const osbWidth = overflowY ? scrollbarWidth : 0
|
|
6383
|
+
const osbHeight = overflowX ? scrollbarHeight : 0
|
|
6231
6384
|
const tableWidth = el.clientWidth
|
|
6232
6385
|
const tableHeight = el.clientHeight
|
|
6233
6386
|
if (trEl) {
|
|
@@ -6238,14 +6391,14 @@ export default defineComponent({
|
|
|
6238
6391
|
const trRect = trEl.getBoundingClientRect()
|
|
6239
6392
|
let trHeight = trEl.clientHeight
|
|
6240
6393
|
const offsetTop = Math.max(1, trRect.y - wrapperRect.y)
|
|
6241
|
-
if (offsetTop + trHeight > tableHeight -
|
|
6242
|
-
trHeight = tableHeight - offsetTop -
|
|
6394
|
+
if (offsetTop + trHeight > tableHeight - osbHeight) {
|
|
6395
|
+
trHeight = tableHeight - offsetTop - osbHeight
|
|
6243
6396
|
}
|
|
6244
6397
|
rdLineEl.style.display = 'block'
|
|
6245
|
-
rdLineEl.style.left = `${scrollbarYToLeft ?
|
|
6398
|
+
rdLineEl.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`
|
|
6246
6399
|
rdLineEl.style.top = `${offsetTop}px`
|
|
6247
6400
|
rdLineEl.style.height = `${trHeight}px`
|
|
6248
|
-
rdLineEl.style.width = `${tableWidth -
|
|
6401
|
+
rdLineEl.style.width = `${tableWidth - osbWidth}px`
|
|
6249
6402
|
rdLineEl.setAttribute('drag-pos', dragPos)
|
|
6250
6403
|
rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n')
|
|
6251
6404
|
} else {
|
|
@@ -6270,7 +6423,7 @@ export default defineComponent({
|
|
|
6270
6423
|
thWidth -= startX - offsetLeft
|
|
6271
6424
|
offsetLeft = startX
|
|
6272
6425
|
}
|
|
6273
|
-
const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 :
|
|
6426
|
+
const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 : osbWidth)
|
|
6274
6427
|
if (offsetLeft + thWidth > endX) {
|
|
6275
6428
|
thWidth = endX - offsetLeft
|
|
6276
6429
|
}
|
|
@@ -6281,7 +6434,7 @@ export default defineComponent({
|
|
|
6281
6434
|
if (prevDragToChild) {
|
|
6282
6435
|
cdLineEl.style.height = `${thRect.height}px`
|
|
6283
6436
|
} else {
|
|
6284
|
-
cdLineEl.style.height = `${tableHeight - offsetTop - (scrollbarXToTop ? 0 :
|
|
6437
|
+
cdLineEl.style.height = `${tableHeight - offsetTop - (scrollbarXToTop ? 0 : osbHeight)}px`
|
|
6285
6438
|
}
|
|
6286
6439
|
cdLineEl.setAttribute('drag-pos', dragPos)
|
|
6287
6440
|
cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n')
|
|
@@ -6319,11 +6472,11 @@ export default defineComponent({
|
|
|
6319
6472
|
* @param {Event} evnt 事件
|
|
6320
6473
|
* @param {Row} row 行对象
|
|
6321
6474
|
*/
|
|
6322
|
-
const handleTooltip = (evnt: MouseEvent,
|
|
6475
|
+
const handleTooltip = (evnt: MouseEvent, tdEl: HTMLTableCellElement, overflowElem: HTMLElement, tipElem: HTMLElement | null, params: any) => {
|
|
6323
6476
|
if (!overflowElem) {
|
|
6324
6477
|
return nextTick()
|
|
6325
6478
|
}
|
|
6326
|
-
params.cell =
|
|
6479
|
+
params.cell = tdEl
|
|
6327
6480
|
const { tooltipStore } = reactData
|
|
6328
6481
|
const tooltipOpts = computeTooltipOpts.value
|
|
6329
6482
|
const { column, row } = params
|
|
@@ -6473,9 +6626,8 @@ export default defineComponent({
|
|
|
6473
6626
|
},
|
|
6474
6627
|
/**
|
|
6475
6628
|
* 更新数据行的 Map
|
|
6476
|
-
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
6477
6629
|
*/
|
|
6478
|
-
cacheRowMap (isSource) {
|
|
6630
|
+
cacheRowMap (isReset, isSource) {
|
|
6479
6631
|
const { treeConfig } = props
|
|
6480
6632
|
const treeOpts = computeTreeOpts.value
|
|
6481
6633
|
const { fullAllDataRowIdData, tableFullData, tableFullTreeData } = internalData
|
|
@@ -6497,8 +6649,8 @@ export default defineComponent({
|
|
|
6497
6649
|
row[childrenField] = null
|
|
6498
6650
|
}
|
|
6499
6651
|
let cacheItem = fullAllDataRowIdData[rowid]
|
|
6500
|
-
if (!cacheItem) {
|
|
6501
|
-
cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, oTop: 0 }
|
|
6652
|
+
if (isReset || !cacheItem) {
|
|
6653
|
+
cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0 }
|
|
6502
6654
|
}
|
|
6503
6655
|
cacheItem.row = row
|
|
6504
6656
|
cacheItem.items = items
|
|
@@ -6588,11 +6740,155 @@ export default defineComponent({
|
|
|
6588
6740
|
})
|
|
6589
6741
|
Object.assign(reactData.columnStore, { resizeList, pxList, pxMinList, autoMinList, scaleList, scaleMinList, autoList, remainList })
|
|
6590
6742
|
},
|
|
6591
|
-
|
|
6743
|
+
handleColResizeMousedownEvent (evnt, fixedType, params) {
|
|
6744
|
+
evnt.stopPropagation()
|
|
6745
|
+
evnt.preventDefault()
|
|
6746
|
+
const { column } = params
|
|
6747
|
+
const { overflowX, scrollbarHeight } = reactData
|
|
6748
|
+
const { elemStore, visibleColumn } = internalData
|
|
6749
|
+
const resizableOpts = computeResizableOpts.value
|
|
6750
|
+
const osbHeight = overflowX ? scrollbarHeight : 0
|
|
6751
|
+
const tableEl = refElem.value
|
|
6752
|
+
const leftContainerElem = refLeftContainer.value
|
|
6753
|
+
const rightContainerElem = refRightContainer.value
|
|
6754
|
+
const resizeBarElem = refColResizeBar.value
|
|
6755
|
+
if (!resizeBarElem) {
|
|
6756
|
+
return
|
|
6757
|
+
}
|
|
6758
|
+
const resizeTipElem = resizeBarElem.firstElementChild as HTMLDivElement
|
|
6759
|
+
const scrollbarXToTop = computeScrollbarXToTop.value
|
|
6760
|
+
const { clientX: dragClientX } = evnt
|
|
6761
|
+
const wrapperElem = refElem.value
|
|
6762
|
+
const dragBtnElem = evnt.target as HTMLDivElement
|
|
6763
|
+
let resizeColumn = column
|
|
6764
|
+
if (column.children && column.children.length) {
|
|
6765
|
+
XEUtils.eachTree(column.children, childColumn => {
|
|
6766
|
+
resizeColumn = childColumn
|
|
6767
|
+
})
|
|
6768
|
+
}
|
|
6769
|
+
const cell = dragBtnElem.parentNode as HTMLTableCellElement
|
|
6770
|
+
const cellParams = Object.assign(params, { cell })
|
|
6771
|
+
let dragLeft = 0
|
|
6772
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
6773
|
+
if (!bodyScrollElem) {
|
|
6774
|
+
return
|
|
6775
|
+
}
|
|
6776
|
+
const pos = getOffsetPos(dragBtnElem, wrapperElem)
|
|
6777
|
+
const dragBtnWidth = dragBtnElem.clientWidth
|
|
6778
|
+
const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2)
|
|
6779
|
+
const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth // 列之间的最小间距
|
|
6780
|
+
let dragMinLeft = pos.left - cell.clientWidth + dragBtnWidth + minInterval
|
|
6781
|
+
let dragPosLeft = pos.left + dragBtnOffsetWidth
|
|
6782
|
+
const isLeftFixed = fixedType === 'left'
|
|
6783
|
+
const isRightFixed = fixedType === 'right'
|
|
6784
|
+
|
|
6785
|
+
// 计算左右侧固定列偏移量
|
|
6786
|
+
let fixedOffsetWidth = 0
|
|
6787
|
+
if (isLeftFixed || isRightFixed) {
|
|
6788
|
+
const siblingProp = isLeftFixed ? 'nextElementSibling' : 'previousElementSibling'
|
|
6789
|
+
let tempCellElem = cell[siblingProp] as HTMLTableCellElement
|
|
6790
|
+
while (tempCellElem) {
|
|
6791
|
+
if (hasClass(tempCellElem, 'fixed--hidden')) {
|
|
6792
|
+
break
|
|
6793
|
+
} else if (!hasClass(tempCellElem, 'col--group')) {
|
|
6794
|
+
fixedOffsetWidth += tempCellElem.offsetWidth
|
|
6795
|
+
}
|
|
6796
|
+
tempCellElem = tempCellElem[siblingProp] as HTMLTableCellElement
|
|
6797
|
+
}
|
|
6798
|
+
if (isRightFixed && rightContainerElem) {
|
|
6799
|
+
dragPosLeft = rightContainerElem.offsetLeft + fixedOffsetWidth
|
|
6800
|
+
}
|
|
6801
|
+
}
|
|
6802
|
+
|
|
6803
|
+
// 处理拖动事件
|
|
6804
|
+
const updateEvent = (evnt: MouseEvent) => {
|
|
6805
|
+
evnt.stopPropagation()
|
|
6806
|
+
evnt.preventDefault()
|
|
6807
|
+
const tableHeight = tableEl.clientHeight
|
|
6808
|
+
const offsetX = evnt.clientX - dragClientX
|
|
6809
|
+
let left = dragPosLeft + offsetX
|
|
6810
|
+
const scrollLeft = fixedType ? 0 : bodyScrollElem.scrollLeft
|
|
6811
|
+
if (isLeftFixed) {
|
|
6812
|
+
// 左固定列(不允许超过右侧固定列、不允许超过右边距)
|
|
6813
|
+
left = Math.min(left, (rightContainerElem ? rightContainerElem.offsetLeft : bodyScrollElem.clientWidth) - fixedOffsetWidth - minInterval)
|
|
6814
|
+
} else if (isRightFixed) {
|
|
6815
|
+
// 右侧固定列(不允许超过左侧固定列、不允许超过左边距)
|
|
6816
|
+
dragMinLeft = (leftContainerElem ? leftContainerElem.clientWidth : 0) + fixedOffsetWidth + minInterval
|
|
6817
|
+
left = Math.min(left, dragPosLeft + cell.clientWidth - minInterval)
|
|
6818
|
+
} else {
|
|
6819
|
+
dragMinLeft = Math.max(bodyScrollElem.scrollLeft, dragMinLeft)
|
|
6820
|
+
// left = Math.min(left, bodyScrollElem.clientWidth + bodyScrollElem.scrollLeft - 40)
|
|
6821
|
+
}
|
|
6822
|
+
dragLeft = Math.max(left, dragMinLeft)
|
|
6823
|
+
const resizeBarLeft = Math.max(1, dragLeft - scrollLeft)
|
|
6824
|
+
resizeBarElem.style.left = `${resizeBarLeft}px`
|
|
6825
|
+
resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`
|
|
6826
|
+
resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - osbHeight : tableHeight}px`
|
|
6827
|
+
if (resizableOpts.showDragTip && resizeTipElem) {
|
|
6828
|
+
resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)])
|
|
6829
|
+
const tableWidth = tableEl.clientWidth
|
|
6830
|
+
const wrapperRect = wrapperElem.getBoundingClientRect()
|
|
6831
|
+
const resizeBarWidth = resizeBarElem.clientWidth
|
|
6832
|
+
const resizeTipWidth = resizeTipElem.clientWidth
|
|
6833
|
+
const resizeTipHeight = resizeTipElem.clientHeight
|
|
6834
|
+
let resizeTipLeft = -resizeTipWidth
|
|
6835
|
+
if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
|
|
6836
|
+
resizeTipLeft = 0
|
|
6837
|
+
} else if (resizeBarLeft > tableWidth) {
|
|
6838
|
+
resizeTipLeft += tableWidth - resizeBarLeft
|
|
6839
|
+
}
|
|
6840
|
+
resizeTipElem.style.left = `${resizeTipLeft}px`
|
|
6841
|
+
resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`
|
|
6842
|
+
}
|
|
6843
|
+
reactData.isDragResize = true
|
|
6844
|
+
}
|
|
6845
|
+
|
|
6846
|
+
reactData.isDragResize = true
|
|
6847
|
+
addClass(tableEl, 'col-drag--resize')
|
|
6848
|
+
resizeBarElem.style.display = 'block'
|
|
6849
|
+
document.onmousemove = updateEvent
|
|
6850
|
+
document.onmouseup = function (evnt) {
|
|
6851
|
+
document.onmousemove = null
|
|
6852
|
+
document.onmouseup = null
|
|
6853
|
+
resizeBarElem.style.display = 'none'
|
|
6854
|
+
internalData._lastResizeTime = Date.now()
|
|
6855
|
+
|
|
6856
|
+
setTimeout(() => {
|
|
6857
|
+
reactData.isDragResize = false
|
|
6858
|
+
}, 50)
|
|
6859
|
+
|
|
6860
|
+
const resizeWidth = resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)
|
|
6861
|
+
const resizeParams = { ...params, resizeWidth, resizeColumn }
|
|
6862
|
+
if (resizableOpts.dragMode === 'fixed') {
|
|
6863
|
+
visibleColumn.forEach(item => {
|
|
6864
|
+
if (item.id !== resizeColumn.id) {
|
|
6865
|
+
if (!item.resizeWidth) {
|
|
6866
|
+
item.resizeWidth = item.renderWidth
|
|
6867
|
+
}
|
|
6868
|
+
}
|
|
6869
|
+
})
|
|
6870
|
+
}
|
|
6871
|
+
|
|
6872
|
+
if ($xeTable.handleColResizeCellAreaEvent) {
|
|
6873
|
+
$xeTable.handleColResizeCellAreaEvent(evnt, resizeParams)
|
|
6874
|
+
} else {
|
|
6875
|
+
resizeColumn.resizeWidth = resizeWidth
|
|
6876
|
+
handleUpdateColResize(evnt, resizeParams)
|
|
6877
|
+
}
|
|
6878
|
+
removeClass(tableEl, 'col-drag--resize')
|
|
6879
|
+
}
|
|
6880
|
+
updateEvent(evnt)
|
|
6881
|
+
if ($xeTable.closeMenu) {
|
|
6882
|
+
$xeTable.closeMenu()
|
|
6883
|
+
}
|
|
6884
|
+
},
|
|
6885
|
+
handleColResizeDblclickEvent (evnt, params) {
|
|
6592
6886
|
const resizableOpts = computeResizableOpts.value
|
|
6593
6887
|
const { isDblclickAutoWidth } = resizableOpts
|
|
6594
6888
|
const el = refElem.value
|
|
6595
6889
|
if (isDblclickAutoWidth && el) {
|
|
6890
|
+
evnt.stopPropagation()
|
|
6891
|
+
evnt.preventDefault()
|
|
6596
6892
|
const { fullColumnIdData } = internalData
|
|
6597
6893
|
const { column } = params
|
|
6598
6894
|
let resizeColumn = column
|
|
@@ -6607,20 +6903,166 @@ export default defineComponent({
|
|
|
6607
6903
|
const cell = dragBtnElem.parentNode as HTMLTableCellElement
|
|
6608
6904
|
const cellParams = Object.assign(params, { cell })
|
|
6609
6905
|
const colMinWidth = getColReMinWidth(cellParams)
|
|
6906
|
+
|
|
6907
|
+
el.setAttribute('data-calc-col', 'Y')
|
|
6610
6908
|
let resizeWidth = calcColumnAutoWidth(resizeColumn, el)
|
|
6909
|
+
el.removeAttribute('data-calc-col')
|
|
6611
6910
|
if (colRest) {
|
|
6612
6911
|
resizeWidth = Math.max(resizeWidth, colRest.width)
|
|
6613
6912
|
}
|
|
6614
|
-
|
|
6615
|
-
|
|
6913
|
+
resizeWidth = Math.max(colMinWidth, resizeWidth)
|
|
6914
|
+
const resizeParams = { ...params, resizeWidth, resizeColumn }
|
|
6915
|
+
reactData.isDragResize = false
|
|
6616
6916
|
internalData._lastResizeTime = Date.now()
|
|
6617
|
-
|
|
6618
|
-
$xeTable.
|
|
6619
|
-
$xeTable.
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
}
|
|
6917
|
+
|
|
6918
|
+
if ($xeTable.handleColResizeDblclickCellAreaEvent) {
|
|
6919
|
+
$xeTable.handleColResizeDblclickCellAreaEvent(evnt, resizeParams)
|
|
6920
|
+
} else {
|
|
6921
|
+
resizeColumn.resizeWidth = resizeWidth
|
|
6922
|
+
handleUpdateColResize(evnt, resizeParams)
|
|
6923
|
+
}
|
|
6924
|
+
}
|
|
6925
|
+
},
|
|
6926
|
+
handleRowResizeMousedownEvent (evnt, params) {
|
|
6927
|
+
evnt.stopPropagation()
|
|
6928
|
+
evnt.preventDefault()
|
|
6929
|
+
const { row } = params
|
|
6930
|
+
const { overflowX, scrollbarWidth, overflowY, scrollbarHeight } = reactData
|
|
6931
|
+
const { elemStore, fullAllDataRowIdData } = internalData
|
|
6932
|
+
const osbWidth = overflowY ? scrollbarWidth : 0
|
|
6933
|
+
const osbHeight = overflowX ? scrollbarHeight : 0
|
|
6934
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value
|
|
6935
|
+
const resizableOpts = computeResizableOpts.value
|
|
6936
|
+
const rowOpts = computeRowOpts.value
|
|
6937
|
+
const cellOpts = computeCellOpts.value
|
|
6938
|
+
const tableEl = refElem.value
|
|
6939
|
+
const resizeBarElem = refRowResizeBar.value
|
|
6940
|
+
if (!resizeBarElem) {
|
|
6941
|
+
return
|
|
6942
|
+
}
|
|
6943
|
+
const { clientY: dragClientY } = evnt
|
|
6944
|
+
const resizeTipElem = resizeBarElem.firstElementChild as HTMLDivElement
|
|
6945
|
+
const dragBtnElem = evnt.currentTarget as HTMLDivElement
|
|
6946
|
+
const tdEl = dragBtnElem.parentNode as HTMLTableCellElement
|
|
6947
|
+
const trEl = tdEl.parentNode as HTMLTableCellElement
|
|
6948
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
6949
|
+
if (!bodyScrollElem) {
|
|
6950
|
+
return
|
|
6951
|
+
}
|
|
6952
|
+
const rowid = getRowid($xeTable, row)
|
|
6953
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
6954
|
+
if (!rowRest) {
|
|
6955
|
+
return
|
|
6956
|
+
}
|
|
6957
|
+
const defaultRowHeight = computeDefaultRowHeight.value
|
|
6958
|
+
const currCellHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight
|
|
6959
|
+
const tableRect = tableEl.getBoundingClientRect()
|
|
6960
|
+
const trRect = trEl.getBoundingClientRect()
|
|
6961
|
+
const targetOffsetY = dragClientY - trRect.y - trEl.clientHeight
|
|
6962
|
+
let resizeHeight = currCellHeight
|
|
6963
|
+
const cellEl = tdEl.querySelector('.vxe-cell')
|
|
6964
|
+
let cellMinHeight = 0
|
|
6965
|
+
if (cellEl) {
|
|
6966
|
+
const cellStyle = getComputedStyle(cellEl)
|
|
6967
|
+
cellMinHeight = Math.max(1, Math.ceil(XEUtils.toNumber(cellStyle.paddingTop) + XEUtils.toNumber(cellStyle.paddingBottom)))
|
|
6968
|
+
}
|
|
6969
|
+
const minTop = trRect.y - tableRect.y + cellMinHeight
|
|
6970
|
+
// 处理拖动事件
|
|
6971
|
+
const updateEvent = (evnt: MouseEvent) => {
|
|
6972
|
+
evnt.stopPropagation()
|
|
6973
|
+
evnt.preventDefault()
|
|
6974
|
+
const tableWidth = tableEl.clientWidth - osbWidth
|
|
6975
|
+
const tableHeight = tableEl.clientHeight - osbHeight
|
|
6976
|
+
let dragTop = evnt.clientY - tableRect.y - targetOffsetY
|
|
6977
|
+
if (dragTop < minTop) {
|
|
6978
|
+
dragTop = minTop
|
|
6979
|
+
} else {
|
|
6980
|
+
resizeHeight = Math.max(cellMinHeight, currCellHeight + evnt.clientY - dragClientY)
|
|
6981
|
+
}
|
|
6982
|
+
resizeBarElem.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`
|
|
6983
|
+
resizeBarElem.style.top = `${dragTop}px`
|
|
6984
|
+
resizeBarElem.style.width = `${tableWidth}px`
|
|
6985
|
+
if (resizableOpts.showDragTip && resizeTipElem) {
|
|
6986
|
+
resizeTipElem.textContent = getI18n('vxe.table.resizeRowTip', [resizeHeight])
|
|
6987
|
+
const resizeTipWidth = resizeTipElem.clientWidth
|
|
6988
|
+
const resizeTipHeight = resizeTipElem.clientHeight
|
|
6989
|
+
let resizeBarLeft = Math.max(2, evnt.clientX - tableRect.x)
|
|
6990
|
+
let resizeBarTop = 0
|
|
6991
|
+
if (resizeBarLeft + resizeTipWidth >= tableWidth - 2) {
|
|
6992
|
+
resizeBarLeft = tableWidth - resizeTipWidth - 2
|
|
6993
|
+
}
|
|
6994
|
+
if (dragTop + resizeTipHeight >= tableHeight) {
|
|
6995
|
+
resizeBarTop = tableHeight - (dragTop + resizeTipHeight)
|
|
6996
|
+
}
|
|
6997
|
+
resizeTipElem.style.left = `${resizeBarLeft}px`
|
|
6998
|
+
resizeTipElem.style.top = `${resizeBarTop}px`
|
|
6999
|
+
}
|
|
7000
|
+
reactData.isDragResize = true
|
|
7001
|
+
}
|
|
7002
|
+
|
|
7003
|
+
reactData.isDragResize = true
|
|
7004
|
+
addClass(tableEl, 'row-drag--resize')
|
|
7005
|
+
resizeBarElem.style.display = 'block'
|
|
7006
|
+
document.onmousemove = updateEvent
|
|
7007
|
+
document.onmouseup = function (evnt) {
|
|
7008
|
+
document.onmousemove = null
|
|
7009
|
+
document.onmouseup = null
|
|
7010
|
+
resizeBarElem.style.display = 'none'
|
|
7011
|
+
internalData._lastResizeTime = Date.now()
|
|
7012
|
+
|
|
7013
|
+
setTimeout(() => {
|
|
7014
|
+
reactData.isDragResize = false
|
|
7015
|
+
}, 50)
|
|
7016
|
+
|
|
7017
|
+
if (resizeHeight !== currCellHeight) {
|
|
7018
|
+
const resizeParams = { ...params, resizeHeight, resizeRow: row }
|
|
7019
|
+
internalData.isResizeCellHeight = true
|
|
7020
|
+
if ($xeTable.handleRowResizeCellAreaEvent) {
|
|
7021
|
+
$xeTable.handleRowResizeCellAreaEvent(evnt, resizeParams)
|
|
7022
|
+
} else {
|
|
7023
|
+
rowRest.resizeHeight = resizeHeight
|
|
7024
|
+
handleUpdateRowResize(evnt, resizeParams)
|
|
7025
|
+
}
|
|
7026
|
+
}
|
|
7027
|
+
removeClass(tableEl, 'row-drag--resize')
|
|
7028
|
+
}
|
|
7029
|
+
updateEvent(evnt)
|
|
7030
|
+
},
|
|
7031
|
+
handleRowResizeDblclickEvent (evnt, params) {
|
|
7032
|
+
const resizableOpts = computeResizableOpts.value
|
|
7033
|
+
const { isDblclickAutoHeight } = resizableOpts
|
|
7034
|
+
const el = refElem.value
|
|
7035
|
+
if (isDblclickAutoHeight && el) {
|
|
7036
|
+
evnt.stopPropagation()
|
|
7037
|
+
evnt.preventDefault()
|
|
7038
|
+
const { editStore } = reactData
|
|
7039
|
+
const { fullAllDataRowIdData } = internalData
|
|
7040
|
+
const { actived } = editStore
|
|
7041
|
+
const { row } = params
|
|
7042
|
+
const rowid = getRowid($xeTable, row)
|
|
7043
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
7044
|
+
if (!rowRest) {
|
|
7045
|
+
return
|
|
7046
|
+
}
|
|
7047
|
+
const handleRsHeight = () => {
|
|
7048
|
+
el.setAttribute('data-calc-row', 'Y')
|
|
7049
|
+
const resizeHeight = calcCellAutoHeight(rowRest, el)
|
|
7050
|
+
el.removeAttribute('data-calc-row')
|
|
7051
|
+
const resizeParams = { ...params, resizeHeight, resizeRow: row }
|
|
7052
|
+
reactData.isDragResize = false
|
|
7053
|
+
internalData._lastResizeTime = Date.now()
|
|
7054
|
+
if ($xeTable.handleRowResizeDblclickCellAreaEvent) {
|
|
7055
|
+
$xeTable.handleRowResizeDblclickCellAreaEvent(evnt, resizeParams)
|
|
7056
|
+
} else {
|
|
7057
|
+
rowRest.resizeHeight = resizeHeight
|
|
7058
|
+
handleUpdateRowResize(evnt, resizeParams)
|
|
7059
|
+
}
|
|
7060
|
+
}
|
|
7061
|
+
if (actived.row || actived.column) {
|
|
7062
|
+
$xeTable.clearEdit().then(handleRsHeight)
|
|
7063
|
+
} else {
|
|
7064
|
+
handleRsHeight()
|
|
7065
|
+
}
|
|
6624
7066
|
}
|
|
6625
7067
|
},
|
|
6626
7068
|
saveCustomStore (type) {
|
|
@@ -6967,10 +7409,21 @@ export default defineComponent({
|
|
|
6967
7409
|
triggerHeaderTooltipEvent (evnt, params) {
|
|
6968
7410
|
const { tooltipStore } = reactData
|
|
6969
7411
|
const { column } = params
|
|
6970
|
-
const titleElem = evnt.currentTarget as HTMLTableCellElement
|
|
6971
7412
|
handleTargetEnterEvent(true)
|
|
7413
|
+
const titleElem = evnt.currentTarget as HTMLDivElement
|
|
7414
|
+
if (!titleElem) {
|
|
7415
|
+
return
|
|
7416
|
+
}
|
|
7417
|
+
const cellEl = titleElem.parentElement as HTMLDivElement
|
|
7418
|
+
if (!cellEl) {
|
|
7419
|
+
return
|
|
7420
|
+
}
|
|
7421
|
+
const thEl = cellEl.parentElement as HTMLTableCellElement
|
|
7422
|
+
if (!thEl) {
|
|
7423
|
+
return
|
|
7424
|
+
}
|
|
6972
7425
|
if (tooltipStore.column !== column || !tooltipStore.visible) {
|
|
6973
|
-
handleTooltip(evnt,
|
|
7426
|
+
handleTooltip(evnt, thEl, cellEl, null, params)
|
|
6974
7427
|
}
|
|
6975
7428
|
},
|
|
6976
7429
|
/**
|
|
@@ -6983,7 +7436,7 @@ export default defineComponent({
|
|
|
6983
7436
|
const editOpts = computeEditOpts.value
|
|
6984
7437
|
const { actived } = editStore
|
|
6985
7438
|
const { row, column } = params
|
|
6986
|
-
const
|
|
7439
|
+
const tdEl = evnt.currentTarget as HTMLTableCellElement
|
|
6987
7440
|
handleTargetEnterEvent(tooltipStore.column !== column || tooltipStore.row !== row)
|
|
6988
7441
|
// 单元格处于编辑状态时不触发提示框
|
|
6989
7442
|
if (column.editRender && isEnableConf(editConfig)) {
|
|
@@ -6997,17 +7450,7 @@ export default defineComponent({
|
|
|
6997
7450
|
}
|
|
6998
7451
|
}
|
|
6999
7452
|
if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
|
|
7000
|
-
|
|
7001
|
-
let tipElem
|
|
7002
|
-
if (column.treeNode) {
|
|
7003
|
-
overflowElem = cell.querySelector('.vxe-tree-cell')
|
|
7004
|
-
if (column.type === 'html') {
|
|
7005
|
-
tipElem = cell.querySelector('.vxe-cell--html')
|
|
7006
|
-
}
|
|
7007
|
-
} else {
|
|
7008
|
-
tipElem = cell.querySelector(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label') as HTMLElement
|
|
7009
|
-
}
|
|
7010
|
-
handleTooltip(evnt, cell, (overflowElem || cell.children[0]) as HTMLElement, tipElem as HTMLElement, params)
|
|
7453
|
+
handleTooltip(evnt, tdEl, tdEl.querySelector('.vxe-cell--wrapper') as HTMLElement, null, params)
|
|
7011
7454
|
}
|
|
7012
7455
|
},
|
|
7013
7456
|
/**
|
|
@@ -7019,7 +7462,7 @@ export default defineComponent({
|
|
|
7019
7462
|
const cell = evnt.currentTarget as HTMLTableCellElement
|
|
7020
7463
|
handleTargetEnterEvent(tooltipStore.column !== column || !!tooltipStore.row)
|
|
7021
7464
|
if (tooltipStore.column !== column || !tooltipStore.visible) {
|
|
7022
|
-
handleTooltip(evnt, cell, cell.querySelector('.vxe-cell--
|
|
7465
|
+
handleTooltip(evnt, cell, cell.querySelector('.vxe-cell--wrapper') as HTMLElement || cell.children[0], null, params)
|
|
7023
7466
|
}
|
|
7024
7467
|
},
|
|
7025
7468
|
handleTargetLeaveEvent () {
|
|
@@ -7032,11 +7475,11 @@ export default defineComponent({
|
|
|
7032
7475
|
internalData.tooltipTimeout = setTimeout(() => {
|
|
7033
7476
|
$tooltip = refTooltip.value
|
|
7034
7477
|
if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
|
|
7035
|
-
|
|
7478
|
+
$xeTable.closeTooltip()
|
|
7036
7479
|
}
|
|
7037
7480
|
}, tooltipOpts.leaveDelay)
|
|
7038
7481
|
} else {
|
|
7039
|
-
|
|
7482
|
+
$xeTable.closeTooltip()
|
|
7040
7483
|
}
|
|
7041
7484
|
},
|
|
7042
7485
|
triggerHeaderCellClickEvent (evnt, params) {
|
|
@@ -7066,7 +7509,10 @@ export default defineComponent({
|
|
|
7066
7509
|
*/
|
|
7067
7510
|
triggerCellClickEvent (evnt, params) {
|
|
7068
7511
|
const { highlightCurrentRow, editConfig } = props
|
|
7069
|
-
const { editStore } = reactData
|
|
7512
|
+
const { editStore, isDragResize } = reactData
|
|
7513
|
+
if (isDragResize) {
|
|
7514
|
+
return
|
|
7515
|
+
}
|
|
7070
7516
|
const expandOpts = computeExpandOpts.value
|
|
7071
7517
|
const editOpts = computeEditOpts.value
|
|
7072
7518
|
const treeOpts = computeTreeOpts.value
|
|
@@ -7158,7 +7604,10 @@ export default defineComponent({
|
|
|
7158
7604
|
*/
|
|
7159
7605
|
triggerCellDblclickEvent (evnt, params) {
|
|
7160
7606
|
const { editConfig } = props
|
|
7161
|
-
const { editStore } = reactData
|
|
7607
|
+
const { editStore, isDragResize } = reactData
|
|
7608
|
+
if (isDragResize) {
|
|
7609
|
+
return
|
|
7610
|
+
}
|
|
7162
7611
|
const editOpts = computeEditOpts.value
|
|
7163
7612
|
const { actived } = editStore
|
|
7164
7613
|
const cell = evnt.currentTarget as HTMLDivElement
|
|
@@ -7367,10 +7816,13 @@ export default defineComponent({
|
|
|
7367
7816
|
*/
|
|
7368
7817
|
triggerSortEvent (evnt, column, order) {
|
|
7369
7818
|
const sortOpts = computeSortOpts.value
|
|
7819
|
+
const { multiple, allowClear } = sortOpts
|
|
7370
7820
|
const { field, sortable } = column
|
|
7371
7821
|
if (sortable) {
|
|
7372
7822
|
if (!order || column.order === order) {
|
|
7373
|
-
|
|
7823
|
+
if (allowClear) {
|
|
7824
|
+
tableMethods.clearSort(multiple ? column : null)
|
|
7825
|
+
}
|
|
7374
7826
|
} else {
|
|
7375
7827
|
tableMethods.sort({ field, order })
|
|
7376
7828
|
}
|
|
@@ -7462,7 +7914,7 @@ export default defineComponent({
|
|
|
7462
7914
|
const { treeConfig, dragConfig } = props
|
|
7463
7915
|
const rowDragOpts = computeRowDragOpts.value
|
|
7464
7916
|
const { fullAllDataRowIdData } = internalData
|
|
7465
|
-
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod } = rowDragOpts
|
|
7917
|
+
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod, dragToChildMethod } = rowDragOpts
|
|
7466
7918
|
const treeOpts = computeTreeOpts.value
|
|
7467
7919
|
const { transform, rowField, mapChildrenField, parentField } = treeOpts
|
|
7468
7920
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
@@ -7472,17 +7924,15 @@ export default defineComponent({
|
|
|
7472
7924
|
if (prevDragRow && dragRow) {
|
|
7473
7925
|
// 判断是否有拖动
|
|
7474
7926
|
if (prevDragRow !== dragRow) {
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
: true
|
|
7485
|
-
).then((status) => {
|
|
7927
|
+
const dragParams = {
|
|
7928
|
+
oldRow: dragRow,
|
|
7929
|
+
newRow: prevDragRow,
|
|
7930
|
+
dragPos: prevDragPos as 'top' | 'bottom',
|
|
7931
|
+
dragToChild: !!prevDragToChild,
|
|
7932
|
+
offsetIndex: dragOffsetIndex as 0 | 1
|
|
7933
|
+
}
|
|
7934
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
7935
|
+
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
7486
7936
|
if (!status) {
|
|
7487
7937
|
return
|
|
7488
7938
|
}
|
|
@@ -7562,7 +8012,11 @@ export default defineComponent({
|
|
|
7562
8012
|
// 根到根
|
|
7563
8013
|
}
|
|
7564
8014
|
|
|
7565
|
-
const fullList = XEUtils.toTreeArray(internalData.afterTreeFullData, {
|
|
8015
|
+
const fullList = XEUtils.toTreeArray(internalData.afterTreeFullData, {
|
|
8016
|
+
key: rowField,
|
|
8017
|
+
parentKey: parentField,
|
|
8018
|
+
children: mapChildrenField
|
|
8019
|
+
})
|
|
7566
8020
|
|
|
7567
8021
|
// 移出
|
|
7568
8022
|
const otfIndex = $xeTable.findRowIndexOf(fullList, dragRow)
|
|
@@ -7579,13 +8033,13 @@ export default defineComponent({
|
|
|
7579
8033
|
childRow[parentField] = dragRow[parentField]
|
|
7580
8034
|
})
|
|
7581
8035
|
}
|
|
7582
|
-
dragRow[parentField] =
|
|
8036
|
+
dragRow[parentField] = isDragToChildFlag ? prevDragRow[rowField] : prevDragRow[parentField]
|
|
7583
8037
|
|
|
7584
8038
|
internalData.tableFullTreeData = XEUtils.toArrayTree(fullList, {
|
|
7585
|
-
key:
|
|
7586
|
-
parentKey:
|
|
8039
|
+
key: rowField,
|
|
8040
|
+
parentKey: parentField,
|
|
7587
8041
|
children: childrenField,
|
|
7588
|
-
mapChildren:
|
|
8042
|
+
mapChildren: mapChildrenField
|
|
7589
8043
|
})
|
|
7590
8044
|
}
|
|
7591
8045
|
}
|
|
@@ -7606,7 +8060,7 @@ export default defineComponent({
|
|
|
7606
8060
|
|
|
7607
8061
|
reactData.isDragRowMove = true
|
|
7608
8062
|
$xeTable.handleTableData(treeConfig && transform)
|
|
7609
|
-
$xeTable.cacheRowMap()
|
|
8063
|
+
$xeTable.cacheRowMap(false)
|
|
7610
8064
|
updateScrollYStatus()
|
|
7611
8065
|
if (!(treeConfig && transform)) {
|
|
7612
8066
|
$xeTable.updateAfterDataIndex()
|
|
@@ -7624,7 +8078,7 @@ export default defineComponent({
|
|
|
7624
8078
|
oldRow: dragRow,
|
|
7625
8079
|
newRow: prevDragRow,
|
|
7626
8080
|
dragPos: prevDragPos as any,
|
|
7627
|
-
dragToChild:
|
|
8081
|
+
dragToChild: isDragToChildFlag,
|
|
7628
8082
|
offsetIndex: dragOffsetIndex,
|
|
7629
8083
|
_index: {
|
|
7630
8084
|
newIndex: nafIndex,
|
|
@@ -7645,18 +8099,16 @@ export default defineComponent({
|
|
|
7645
8099
|
const { lazy } = treeOpts
|
|
7646
8100
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
|
|
7647
8101
|
const { prevDragRow, prevDragPos } = internalData
|
|
7648
|
-
if (treeConfig && prevDragToChild) {
|
|
8102
|
+
if (treeConfig && lazy && prevDragToChild) {
|
|
7649
8103
|
// 懒加载
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
if (
|
|
7654
|
-
if (rowRest && rowRest.treeLoaded) {
|
|
7655
|
-
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild)
|
|
7656
|
-
}
|
|
7657
|
-
} else {
|
|
8104
|
+
const newRowid = getRowid($xeTable, prevDragRow)
|
|
8105
|
+
const rowRest = fullAllDataRowIdData[newRowid]
|
|
8106
|
+
if (prevDragRow[hasChildField]) {
|
|
8107
|
+
if (rowRest && rowRest.treeLoaded) {
|
|
7658
8108
|
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild)
|
|
7659
8109
|
}
|
|
8110
|
+
} else {
|
|
8111
|
+
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild)
|
|
7660
8112
|
}
|
|
7661
8113
|
} else {
|
|
7662
8114
|
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild)
|
|
@@ -7759,7 +8211,7 @@ export default defineComponent({
|
|
|
7759
8211
|
handleColDragSwapEvent (evnt, isSyncColumn, dragCol, prevDragCol, prevDragPos, prevDragToChild) {
|
|
7760
8212
|
const { mouseConfig } = props
|
|
7761
8213
|
const columnDragOpts = computeColumnDragOpts.value
|
|
7762
|
-
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts
|
|
8214
|
+
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts
|
|
7763
8215
|
const { collectColumn } = internalData
|
|
7764
8216
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0
|
|
7765
8217
|
if (prevDragCol && dragCol) {
|
|
@@ -7767,17 +8219,15 @@ export default defineComponent({
|
|
|
7767
8219
|
if (prevDragCol !== dragCol) {
|
|
7768
8220
|
const oldColumn = dragCol
|
|
7769
8221
|
const newColumn = prevDragCol
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
: true
|
|
7780
|
-
).then((status) => {
|
|
8222
|
+
const dragParams = {
|
|
8223
|
+
oldColumn,
|
|
8224
|
+
newColumn,
|
|
8225
|
+
dragPos: prevDragPos as 'left' | 'right',
|
|
8226
|
+
dragToChild: !!prevDragToChild,
|
|
8227
|
+
offsetIndex: dragOffsetIndex as 0 | 1
|
|
8228
|
+
}
|
|
8229
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
8230
|
+
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
7781
8231
|
if (!status) {
|
|
7782
8232
|
return
|
|
7783
8233
|
}
|
|
@@ -7873,7 +8323,7 @@ export default defineComponent({
|
|
|
7873
8323
|
if (newMatchRest) {
|
|
7874
8324
|
const { items: nCols, index: nIndex, parent: nParent } = newMatchRest
|
|
7875
8325
|
// 转子级
|
|
7876
|
-
if ((isCrossDrag && isToChildDrag) &&
|
|
8326
|
+
if ((isCrossDrag && isToChildDrag) && isDragToChildFlag) {
|
|
7877
8327
|
oldColumn.parentId = newColumn.id
|
|
7878
8328
|
newColumn.children = (newColumn.children || []).concat([oldColumn])
|
|
7879
8329
|
} else {
|
|
@@ -7907,7 +8357,7 @@ export default defineComponent({
|
|
|
7907
8357
|
oldColumn,
|
|
7908
8358
|
newColumn,
|
|
7909
8359
|
dragPos: prevDragPos,
|
|
7910
|
-
dragToChild:
|
|
8360
|
+
dragToChild: isDragToChildFlag,
|
|
7911
8361
|
offsetIndex: dragOffsetIndex,
|
|
7912
8362
|
_index: {
|
|
7913
8363
|
newIndex: nafIndex,
|
|
@@ -8155,7 +8605,7 @@ export default defineComponent({
|
|
|
8155
8605
|
}
|
|
8156
8606
|
},
|
|
8157
8607
|
triggerBodyScrollEvent (evnt, fixedType) {
|
|
8158
|
-
const { elemStore, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData
|
|
8608
|
+
const { elemStore, intoRunScroll, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData
|
|
8159
8609
|
const xHandleEl = refScrollXHandleElem.value
|
|
8160
8610
|
const yHandleEl = refScrollYHandleElem.value
|
|
8161
8611
|
const leftScrollElem = getRefElem(elemStore['left-body-scroll'])
|
|
@@ -8166,6 +8616,9 @@ export default defineComponent({
|
|
|
8166
8616
|
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
|
|
8167
8617
|
return
|
|
8168
8618
|
}
|
|
8619
|
+
if (intoRunScroll) {
|
|
8620
|
+
return
|
|
8621
|
+
}
|
|
8169
8622
|
if (!bodyScrollElem) {
|
|
8170
8623
|
return
|
|
8171
8624
|
}
|
|
@@ -8220,22 +8673,16 @@ export default defineComponent({
|
|
|
8220
8673
|
})
|
|
8221
8674
|
},
|
|
8222
8675
|
triggerHeaderScrollEvent (evnt, fixedType) {
|
|
8223
|
-
const { elemStore, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData
|
|
8676
|
+
const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData
|
|
8224
8677
|
const yHandleEl = refScrollYHandleElem.value
|
|
8225
8678
|
const xHandleEl = refScrollXHandleElem.value
|
|
8226
8679
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
8227
8680
|
const headerScrollElem = getRefElem(elemStore['main-header-scroll'])
|
|
8228
8681
|
const footerScrollElem = getRefElem(elemStore['main-footer-scroll'])
|
|
8229
|
-
if (inWheelScroll) {
|
|
8230
|
-
return
|
|
8231
|
-
}
|
|
8232
|
-
if (inVirtualScroll) {
|
|
8233
|
-
return
|
|
8234
|
-
}
|
|
8235
|
-
if (inBodyScroll) {
|
|
8682
|
+
if (inWheelScroll || inVirtualScroll || inBodyScroll || inFooterScroll) {
|
|
8236
8683
|
return
|
|
8237
8684
|
}
|
|
8238
|
-
if (
|
|
8685
|
+
if (intoRunScroll) {
|
|
8239
8686
|
return
|
|
8240
8687
|
}
|
|
8241
8688
|
if (!headerScrollElem) {
|
|
@@ -8262,22 +8709,16 @@ export default defineComponent({
|
|
|
8262
8709
|
})
|
|
8263
8710
|
},
|
|
8264
8711
|
triggerFooterScrollEvent (evnt, fixedType) {
|
|
8265
|
-
const { elemStore, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData
|
|
8712
|
+
const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData
|
|
8266
8713
|
const yHandleEl = refScrollYHandleElem.value
|
|
8267
8714
|
const xHandleEl = refScrollXHandleElem.value
|
|
8268
8715
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
8269
8716
|
const headerScrollElem = getRefElem(elemStore['main-header-scroll'])
|
|
8270
8717
|
const footerScrollElem = getRefElem(elemStore['main-footer-scroll'])
|
|
8271
|
-
if (inWheelScroll) {
|
|
8272
|
-
return
|
|
8273
|
-
}
|
|
8274
|
-
if (inVirtualScroll) {
|
|
8718
|
+
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inBodyScroll) {
|
|
8275
8719
|
return
|
|
8276
8720
|
}
|
|
8277
|
-
if (
|
|
8278
|
-
return
|
|
8279
|
-
}
|
|
8280
|
-
if (inBodyScroll) {
|
|
8721
|
+
if (intoRunScroll) {
|
|
8281
8722
|
return
|
|
8282
8723
|
}
|
|
8283
8724
|
if (!footerScrollElem) {
|
|
@@ -8304,7 +8745,10 @@ export default defineComponent({
|
|
|
8304
8745
|
})
|
|
8305
8746
|
},
|
|
8306
8747
|
triggerBodyWheelEvent (evnt) {
|
|
8307
|
-
const { deltaY, deltaX } = evnt
|
|
8748
|
+
const { target, deltaY, deltaX } = evnt
|
|
8749
|
+
if (target && /^textarea$/i.test((target as HTMLElement).tagName)) {
|
|
8750
|
+
return
|
|
8751
|
+
}
|
|
8308
8752
|
const { highlightHoverRow } = tableProps
|
|
8309
8753
|
const { elemStore, lastScrollTop, lastScrollLeft } = internalData
|
|
8310
8754
|
const rowOpts = computeRowOpts.value
|
|
@@ -8323,30 +8767,14 @@ export default defineComponent({
|
|
|
8323
8767
|
if (!bodyScrollElem) {
|
|
8324
8768
|
return
|
|
8325
8769
|
}
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
|
|
8329
|
-
if (reactData.lastScrollTime + 25 > Date.now()) {
|
|
8330
|
-
multiple = 1.18
|
|
8331
|
-
} else if (reactData.lastScrollTime + 30 > Date.now()) {
|
|
8332
|
-
multiple = 1.15
|
|
8333
|
-
} else if (reactData.lastScrollTime + 40 > Date.now()) {
|
|
8334
|
-
multiple = 1.12
|
|
8335
|
-
} else if (reactData.lastScrollTime + 55 > Date.now()) {
|
|
8336
|
-
multiple = 1.09
|
|
8337
|
-
} else if (reactData.lastScrollTime + 75 > Date.now()) {
|
|
8338
|
-
multiple = 1.06
|
|
8339
|
-
} else if (reactData.lastScrollTime + 100 > Date.now()) {
|
|
8340
|
-
multiple = 1.03
|
|
8341
|
-
}
|
|
8342
|
-
|
|
8343
|
-
const deltaTop = deltaY * multiple
|
|
8344
|
-
const deltaLeft = deltaX * multiple
|
|
8770
|
+
const wheelSpeed = getWheelSpeed(reactData.lastScrollTime)
|
|
8771
|
+
const deltaTop = deltaY * wheelSpeed
|
|
8772
|
+
const deltaLeft = deltaX * wheelSpeed
|
|
8345
8773
|
|
|
8346
8774
|
const isTopWheel = deltaTop < 0
|
|
8347
|
-
const currScrollTop =
|
|
8775
|
+
const currScrollTop = bodyScrollElem.scrollTop
|
|
8348
8776
|
// 如果滚动位置已经是顶部或底部,则不需要触发
|
|
8349
|
-
if (isTopWheel ? currScrollTop <= 0 : currScrollTop >=
|
|
8777
|
+
if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= bodyScrollElem.scrollHeight - bodyScrollElem.clientHeight) {
|
|
8350
8778
|
return
|
|
8351
8779
|
}
|
|
8352
8780
|
|
|
@@ -8362,17 +8790,31 @@ export default defineComponent({
|
|
|
8362
8790
|
$xeTable.clearHoverRow()
|
|
8363
8791
|
}
|
|
8364
8792
|
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
|
|
8374
|
-
|
|
8793
|
+
wheelScrollTo(scrollTop - bodyScrollElem.scrollTop, (offsetTop: number) => {
|
|
8794
|
+
const currTopNum = bodyScrollElem.scrollTop + offsetTop
|
|
8795
|
+
internalData.inWheelScroll = true
|
|
8796
|
+
setScrollTop(yHandleEl, currTopNum)
|
|
8797
|
+
setScrollTop(bodyScrollElem, currTopNum)
|
|
8798
|
+
setScrollTop(leftScrollElem, currTopNum)
|
|
8799
|
+
setScrollTop(rightScrollElem, currTopNum)
|
|
8800
|
+
$xeTable.triggerScrollYEvent(evnt)
|
|
8801
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, scrollLeft, {
|
|
8802
|
+
type: 'table',
|
|
8803
|
+
fixed: ''
|
|
8804
|
+
})
|
|
8375
8805
|
})
|
|
8806
|
+
|
|
8807
|
+
// internalData.inWheelScroll = true
|
|
8808
|
+
// setScrollTop(yHandleEl, scrollTop)
|
|
8809
|
+
// setScrollTop(bodyScrollElem, scrollTop)
|
|
8810
|
+
// setScrollTop(leftScrollElem, scrollTop)
|
|
8811
|
+
// setScrollTop(rightScrollElem, scrollTop)
|
|
8812
|
+
|
|
8813
|
+
// loadScrollYData(scrollTop)
|
|
8814
|
+
// $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8815
|
+
// type: 'footer',
|
|
8816
|
+
// fixed: ''
|
|
8817
|
+
// })
|
|
8376
8818
|
}
|
|
8377
8819
|
},
|
|
8378
8820
|
triggerVirtualScrollXEvent (evnt) {
|
|
@@ -8511,34 +8953,34 @@ export default defineComponent({
|
|
|
8511
8953
|
},
|
|
8512
8954
|
// 更新纵向 Y 可视渲染上下剩余空间大小
|
|
8513
8955
|
updateScrollYSpace () {
|
|
8514
|
-
const {
|
|
8515
|
-
const {
|
|
8516
|
-
const { scrollYStore, elemStore, afterFullData, fullAllDataRowIdData } = internalData
|
|
8956
|
+
const { isAllOverflow, scrollYLoad } = reactData
|
|
8957
|
+
const { scrollYStore, elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData
|
|
8517
8958
|
const { startIndex } = scrollYStore
|
|
8959
|
+
const rowOpts = computeRowOpts.value
|
|
8960
|
+
const cellOpts = computeCellOpts.value
|
|
8961
|
+
const defaultRowHeight = computeDefaultRowHeight.value
|
|
8518
8962
|
const bodyTableElem = getRefElem(elemStore['main-body-table'])
|
|
8519
8963
|
const containerList = ['main', 'left', 'right']
|
|
8520
8964
|
let topSpaceHeight = 0
|
|
8521
8965
|
let ySpaceHeight = 0
|
|
8966
|
+
|
|
8522
8967
|
if (scrollYLoad) {
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8968
|
+
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height
|
|
8969
|
+
if (!isCustomCellHeight && isAllOverflow) {
|
|
8970
|
+
ySpaceHeight = afterFullData.length * defaultRowHeight
|
|
8971
|
+
topSpaceHeight = Math.max(0, startIndex * defaultRowHeight)
|
|
8526
8972
|
} else {
|
|
8527
8973
|
for (let i = 0; i < afterFullData.length; i++) {
|
|
8528
8974
|
const row = afterFullData[i]
|
|
8529
8975
|
const rowid = getRowid($xeTable, row)
|
|
8530
|
-
const rowRest = fullAllDataRowIdData[rowid]
|
|
8531
|
-
|
|
8532
|
-
ySpaceHeight += rowRest.height || rowHeight
|
|
8533
|
-
}
|
|
8976
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
8977
|
+
ySpaceHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight
|
|
8534
8978
|
}
|
|
8535
8979
|
for (let i = 0; i < startIndex; i++) {
|
|
8536
8980
|
const row = afterFullData[i]
|
|
8537
8981
|
const rowid = getRowid($xeTable, row)
|
|
8538
|
-
const rowRest = fullAllDataRowIdData[rowid]
|
|
8539
|
-
|
|
8540
|
-
topSpaceHeight += rowRest.height || rowHeight
|
|
8541
|
-
}
|
|
8982
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
8983
|
+
topSpaceHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight
|
|
8542
8984
|
}
|
|
8543
8985
|
}
|
|
8544
8986
|
} else {
|
|
@@ -8563,17 +9005,17 @@ export default defineComponent({
|
|
|
8563
9005
|
if (scrollYSpaceEl) {
|
|
8564
9006
|
scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : ''
|
|
8565
9007
|
}
|
|
8566
|
-
nextTick(() => {
|
|
9008
|
+
return nextTick().then(() => {
|
|
8567
9009
|
updateStyle()
|
|
8568
9010
|
})
|
|
8569
9011
|
},
|
|
8570
9012
|
updateScrollXData () {
|
|
8571
|
-
const {
|
|
9013
|
+
const { isAllOverflow } = reactData
|
|
8572
9014
|
handleTableColumn()
|
|
8573
9015
|
return nextTick().then(() => {
|
|
8574
9016
|
handleTableColumn()
|
|
8575
9017
|
$xeTable.updateScrollXSpace()
|
|
8576
|
-
if (!
|
|
9018
|
+
if (!isAllOverflow) {
|
|
8577
9019
|
$xeTable.updateScrollYSpace()
|
|
8578
9020
|
}
|
|
8579
9021
|
})
|
|
@@ -8940,10 +9382,11 @@ export default defineComponent({
|
|
|
8940
9382
|
|
|
8941
9383
|
const renderVN = () => {
|
|
8942
9384
|
const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules } = props
|
|
8943
|
-
const {
|
|
9385
|
+
const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, columnStore, filterStore, customStore } = reactData
|
|
8944
9386
|
const { leftList, rightList } = columnStore
|
|
8945
9387
|
const loadingSlot = slots.loading
|
|
8946
|
-
const
|
|
9388
|
+
const tableTipConfig = computeTableTipConfig.value
|
|
9389
|
+
const validTipConfig = computeValidTipConfig.value
|
|
8947
9390
|
const validOpts = computeValidOpts.value
|
|
8948
9391
|
const checkboxOpts = computeCheckboxOpts.value
|
|
8949
9392
|
const treeOpts = computeTreeOpts.value
|
|
@@ -8955,7 +9398,7 @@ export default defineComponent({
|
|
|
8955
9398
|
const areaOpts = computeAreaOpts.value
|
|
8956
9399
|
const loadingOpts = computeLoadingOpts.value
|
|
8957
9400
|
const isMenu = computeIsMenu.value
|
|
8958
|
-
const currLoading = reactData.
|
|
9401
|
+
const currLoading = reactData.isColLoading || reactData.isRowLoading || loading
|
|
8959
9402
|
const resizableOpts = computeResizableOpts.value
|
|
8960
9403
|
const isArea = mouseConfig && mouseOpts.area
|
|
8961
9404
|
const columnDragOpts = computeColumnDragOpts.value
|
|
@@ -8976,7 +9419,6 @@ export default defineComponent({
|
|
|
8976
9419
|
'row--highlight': rowOpts.isHover || highlightHoverRow,
|
|
8977
9420
|
'column--highlight': columnOpts.isHover || highlightHoverColumn,
|
|
8978
9421
|
'checkbox--range': checkboxOpts.range,
|
|
8979
|
-
'column--calc': isCalcColumn,
|
|
8980
9422
|
'col--drag-cell': columnOpts.drag && columnDragOpts.trigger === 'cell',
|
|
8981
9423
|
'is--header': showHeader,
|
|
8982
9424
|
'is--footer': showFooter,
|
|
@@ -8985,7 +9427,6 @@ export default defineComponent({
|
|
|
8985
9427
|
'is--fixed-left': leftList.length,
|
|
8986
9428
|
'is--fixed-right': rightList.length,
|
|
8987
9429
|
'is--animat': !!props.animat,
|
|
8988
|
-
'is--padding': props.padding,
|
|
8989
9430
|
'is--round': props.round,
|
|
8990
9431
|
'is--stripe': !treeConfig && stripe,
|
|
8991
9432
|
'is--loading': currLoading,
|
|
@@ -9039,13 +9480,26 @@ export default defineComponent({
|
|
|
9039
9480
|
* 列宽线
|
|
9040
9481
|
*/
|
|
9041
9482
|
h('div', {
|
|
9042
|
-
key: '
|
|
9043
|
-
ref:
|
|
9044
|
-
class: 'vxe-table--resizable-bar'
|
|
9483
|
+
key: 'tcl',
|
|
9484
|
+
ref: refColResizeBar,
|
|
9485
|
+
class: 'vxe-table--resizable-col-bar'
|
|
9486
|
+
}, resizableOpts.showDragTip
|
|
9487
|
+
? [
|
|
9488
|
+
h('div', {
|
|
9489
|
+
class: 'vxe-table--resizable-number-tip'
|
|
9490
|
+
})
|
|
9491
|
+
]
|
|
9492
|
+
: []),
|
|
9493
|
+
/**
|
|
9494
|
+
* 行高线
|
|
9495
|
+
*/
|
|
9496
|
+
h('div', {
|
|
9497
|
+
key: 'trl',
|
|
9498
|
+
ref: refRowResizeBar,
|
|
9499
|
+
class: 'vxe-table--resizable-row-bar'
|
|
9045
9500
|
}, resizableOpts.showDragTip
|
|
9046
9501
|
? [
|
|
9047
9502
|
h('div', {
|
|
9048
|
-
ref: refCellResizeTip,
|
|
9049
9503
|
class: 'vxe-table--resizable-number-tip'
|
|
9050
9504
|
})
|
|
9051
9505
|
]
|
|
@@ -9142,10 +9596,14 @@ export default defineComponent({
|
|
|
9142
9596
|
/**
|
|
9143
9597
|
* 工具提示
|
|
9144
9598
|
*/
|
|
9145
|
-
h(VxeUITooltipComponent,
|
|
9599
|
+
h(VxeUITooltipComponent, {
|
|
9146
9600
|
key: 'btp',
|
|
9147
|
-
ref: refTooltip
|
|
9148
|
-
|
|
9601
|
+
ref: refTooltip,
|
|
9602
|
+
theme: tableTipConfig.theme,
|
|
9603
|
+
enterable: tableTipConfig.enterable,
|
|
9604
|
+
enterDelay: tableTipConfig.enterDelay,
|
|
9605
|
+
leaveDelay: tableTipConfig.leaveDelay
|
|
9606
|
+
}),
|
|
9149
9607
|
/**
|
|
9150
9608
|
* 校验提示
|
|
9151
9609
|
*/
|
|
@@ -9156,7 +9614,10 @@ export default defineComponent({
|
|
|
9156
9614
|
class: [{
|
|
9157
9615
|
'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete'
|
|
9158
9616
|
}, 'vxe-table--valid-error'],
|
|
9159
|
-
|
|
9617
|
+
theme: validTipConfig.theme,
|
|
9618
|
+
enterable: validTipConfig.enterable,
|
|
9619
|
+
enterDelay: validTipConfig.enterDelay,
|
|
9620
|
+
leaveDelay: validTipConfig.leaveDelay
|
|
9160
9621
|
})
|
|
9161
9622
|
: renderEmptyElement($xeTable)
|
|
9162
9623
|
])
|
|
@@ -9177,7 +9638,7 @@ export default defineComponent({
|
|
|
9177
9638
|
if (value && value.length >= 50000) {
|
|
9178
9639
|
warnLog('vxe.error.errLargeData', ['loadData(data), reloadData(data)'])
|
|
9179
9640
|
}
|
|
9180
|
-
loadTableData(value).then(() => {
|
|
9641
|
+
loadTableData(value, true).then(() => {
|
|
9181
9642
|
const { scrollXLoad, scrollYLoad, expandColumn } = reactData
|
|
9182
9643
|
internalData.inited = true
|
|
9183
9644
|
internalData.initStatus = true
|
|
@@ -9276,10 +9737,10 @@ export default defineComponent({
|
|
|
9276
9737
|
|
|
9277
9738
|
watch(() => props.syncResize, (value) => {
|
|
9278
9739
|
if (value) {
|
|
9279
|
-
|
|
9740
|
+
handleUpdateResize()
|
|
9280
9741
|
nextTick(() => {
|
|
9281
|
-
|
|
9282
|
-
setTimeout(() =>
|
|
9742
|
+
handleUpdateResize()
|
|
9743
|
+
setTimeout(() => handleUpdateResize())
|
|
9283
9744
|
})
|
|
9284
9745
|
}
|
|
9285
9746
|
})
|
|
@@ -9391,6 +9852,9 @@ export default defineComponent({
|
|
|
9391
9852
|
if (props.showFooter && !(props.footerMethod || props.footerData)) {
|
|
9392
9853
|
warnLog('vxe.error.reqProp', ['footer-data | footer-method'])
|
|
9393
9854
|
}
|
|
9855
|
+
if (rowOpts.height) {
|
|
9856
|
+
warnLog('vxe.error.delProp', ['row-config.height', 'cell-config.height'])
|
|
9857
|
+
}
|
|
9394
9858
|
// if (props.highlightCurrentRow) {
|
|
9395
9859
|
// warnLog('vxe.error.delProp', ['highlight-current-row', 'row-config.isCurrent'])
|
|
9396
9860
|
// }
|
|
@@ -9502,7 +9966,7 @@ export default defineComponent({
|
|
|
9502
9966
|
visibleSize: 0
|
|
9503
9967
|
})
|
|
9504
9968
|
|
|
9505
|
-
loadTableData(data || []).then(() => {
|
|
9969
|
+
loadTableData(data || [], true).then(() => {
|
|
9506
9970
|
if (data && data.length) {
|
|
9507
9971
|
internalData.inited = true
|
|
9508
9972
|
internalData.initStatus = true
|