vxe-table 3.12.10-beta.2 → 3.12.10-beta.21
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/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 +2 -1
- 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/mixin.js +7 -7
- package/es/table/module/export/mixin.js +55 -32
- package/es/table/module/keyboard/mixin.js +68 -25
- package/es/table/module/menu/mixin.js +3 -1
- package/es/table/src/body.js +96 -64
- package/es/table/src/cell.js +3 -7
- package/es/table/src/column.js +2 -0
- package/es/table/src/columnInfo.js +1 -0
- package/es/table/src/footer.js +31 -6
- package/es/table/src/header.js +45 -141
- package/es/table/src/methods.js +918 -456
- package/es/table/src/props.js +6 -2
- package/es/table/src/table.js +299 -149
- package/es/table/src/util.js +67 -57
- package/es/table/style.css +299 -191
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +20 -10
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +299 -191
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +1735 -1025
- 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 +2 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +2 -1
- 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-CHT.umd.js +2 -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/mixin.js +12 -2
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/export/mixin.js +52 -27
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/module/keyboard/mixin.js +73 -27
- package/lib/table/module/keyboard/mixin.min.js +1 -1
- package/lib/table/module/menu/mixin.js +3 -1
- package/lib/table/src/body.js +89 -60
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +3 -5
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +2 -0
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +1 -0
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/footer.js +26 -6
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +38 -153
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +1076 -551
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +6 -2
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +269 -129
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +80 -70
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +299 -191
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +20 -10
- 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 +299 -191
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- 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 +2 -1
- 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/mixin.ts +7 -7
- package/packages/table/module/export/mixin.ts +50 -27
- package/packages/table/module/keyboard/mixin.ts +65 -24
- package/packages/table/module/menu/mixin.ts +4 -1
- package/packages/table/src/body.ts +102 -61
- package/packages/table/src/cell.ts +3 -7
- package/packages/table/src/column.ts +7 -2
- package/packages/table/src/columnInfo.ts +1 -0
- package/packages/table/src/footer.ts +31 -6
- package/packages/table/src/header.ts +45 -141
- package/packages/table/src/methods.ts +957 -461
- package/packages/table/src/props.ts +6 -2
- package/packages/table/src/table.ts +325 -149
- package/packages/table/src/util.ts +75 -62
- package/packages/ui/index.ts +21 -9
- package/styles/components/table.scss +352 -260
- 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 -0
- /package/es/{iconfont.1736736807414.ttf → iconfont.1737182271148.ttf} +0 -0
- /package/es/{iconfont.1736736807414.woff → iconfont.1737182271148.woff} +0 -0
- /package/es/{iconfont.1736736807414.woff2 → iconfont.1737182271148.woff2} +0 -0
- /package/lib/{iconfont.1736736807414.ttf → iconfont.1737182271148.ttf} +0 -0
- /package/lib/{iconfont.1736736807414.woff → iconfont.1737182271148.woff} +0 -0
- /package/lib/{iconfont.1736736807414.woff2 → iconfont.1737182271148.woff2} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils'
|
|
2
|
-
import { browse, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft } from '../../ui/src/dom'
|
|
2
|
+
import { browse, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, getOffsetPos, setScrollTop, setScrollLeft } from '../../ui/src/dom'
|
|
3
3
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils'
|
|
4
4
|
import { VxeUI } from '../../ui'
|
|
5
5
|
import Cell from './cell'
|
|
@@ -213,7 +213,7 @@ function cacheColumnMap ($xeTable: VxeTableConstructor) {
|
|
|
213
213
|
}
|
|
214
214
|
fullColumnFieldData[field] = rest
|
|
215
215
|
} else {
|
|
216
|
-
if (storage || (columnOpts.drag && (isCrossDrag || isSelfToChildDrag))) {
|
|
216
|
+
if ((storage && !type) || (columnOpts.drag && (isCrossDrag || isSelfToChildDrag))) {
|
|
217
217
|
errLog('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field`])
|
|
218
218
|
}
|
|
219
219
|
}
|
|
@@ -316,6 +316,64 @@ const updateScrollYStatus = ($xeTable: VxeTableConstructor, fullData?: any[]) =>
|
|
|
316
316
|
return scrollYLoad
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
+
function updateAfterListIndex ($xeTable: VxeTableConstructor) {
|
|
320
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
321
|
+
|
|
322
|
+
const { afterFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData
|
|
323
|
+
const fullMaps: Record<string, any> = {}
|
|
324
|
+
afterFullData.forEach((row, index) => {
|
|
325
|
+
const rowid = getRowid($xeTable, row)
|
|
326
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
327
|
+
const seq = index + 1
|
|
328
|
+
if (rowRest) {
|
|
329
|
+
rowRest.seq = seq
|
|
330
|
+
rowRest._index = index
|
|
331
|
+
} else {
|
|
332
|
+
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 }
|
|
333
|
+
fullAllDataRowIdData[rowid] = rest
|
|
334
|
+
fullDataRowIdData[rowid] = rest
|
|
335
|
+
}
|
|
336
|
+
fullMaps[rowid] = row
|
|
337
|
+
})
|
|
338
|
+
internalData.afterFullRowMaps = fullMaps
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* 预编译
|
|
343
|
+
* 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
|
|
344
|
+
*/
|
|
345
|
+
function updateAfterDataIndex ($xeTable: VxeTableConstructor) {
|
|
346
|
+
const props = $xeTable
|
|
347
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
348
|
+
|
|
349
|
+
const { treeConfig } = props
|
|
350
|
+
const { fullDataRowIdData, fullAllDataRowIdData, afterTreeFullData } = internalData
|
|
351
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
352
|
+
const { transform } = treeOpts
|
|
353
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
354
|
+
const fullMaps: Record<string, any> = {}
|
|
355
|
+
if (treeConfig) {
|
|
356
|
+
XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
|
|
357
|
+
const rowid = getRowid($xeTable, row)
|
|
358
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
359
|
+
const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
|
|
360
|
+
if (rowRest) {
|
|
361
|
+
rowRest.seq = seq
|
|
362
|
+
rowRest.treeIndex = index
|
|
363
|
+
} else {
|
|
364
|
+
const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 }
|
|
365
|
+
fullAllDataRowIdData[rowid] = rest
|
|
366
|
+
fullDataRowIdData[rowid] = rest
|
|
367
|
+
}
|
|
368
|
+
fullMaps[rowid] = row
|
|
369
|
+
}, { children: transform ? treeOpts.mapChildrenField : childrenField })
|
|
370
|
+
internalData.afterFullRowMaps = fullMaps
|
|
371
|
+
updateAfterListIndex($xeTable)
|
|
372
|
+
} else {
|
|
373
|
+
updateAfterListIndex($xeTable)
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
319
377
|
/**
|
|
320
378
|
* 如果为虚拟树,将树结构拍平
|
|
321
379
|
* @returns
|
|
@@ -360,13 +418,15 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
|
360
418
|
const internalData = $xeTable as unknown as TableInternalData
|
|
361
419
|
|
|
362
420
|
const { border, showOverflow: allColumnOverflow, showHeaderOverflow: allColumnHeaderOverflow, showFooterOverflow: allColumnFooterOverflow, mouseConfig, spanMethod, footerSpanMethod } = props
|
|
363
|
-
const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, scrollbarWidth, scrollbarHeight, columnStore, editStore, isAllOverflow, expandColumn } = reactData
|
|
421
|
+
const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, overflowX, scrollbarWidth, overflowY, scrollbarHeight, columnStore, editStore, isAllOverflow, expandColumn } = reactData
|
|
364
422
|
const { visibleColumn, fullColumnIdData, tableHeight, tableWidth, headerHeight, footerHeight, elemStore, customHeight, customMinHeight, customMaxHeight } = internalData
|
|
365
423
|
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
366
424
|
if (!el) {
|
|
367
425
|
return
|
|
368
426
|
}
|
|
369
427
|
const containerList = ['main', 'left', 'right']
|
|
428
|
+
const osbWidth = overflowY ? scrollbarWidth : 0
|
|
429
|
+
const osbHeight = overflowX ? scrollbarHeight : 0
|
|
370
430
|
const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder as HTMLDivElement
|
|
371
431
|
const cellOffsetWidth = $xeTable.computeCellOffsetWidth
|
|
372
432
|
const mouseOpts = $xeTable.computeMouseOpts
|
|
@@ -374,17 +434,17 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
|
374
434
|
const bodyTableElem = getRefElem(elemStore['main-body-table'])
|
|
375
435
|
if (emptyPlaceholderElem) {
|
|
376
436
|
emptyPlaceholderElem.style.top = `${headerHeight}px`
|
|
377
|
-
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight -
|
|
437
|
+
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : ''
|
|
378
438
|
}
|
|
379
439
|
|
|
380
440
|
let bodyHeight = 0
|
|
381
441
|
let bodyMaxHeight = 0
|
|
382
|
-
const bodyMinHeight = customMinHeight - headerHeight - footerHeight -
|
|
442
|
+
const bodyMinHeight = customMinHeight - headerHeight - footerHeight - osbHeight
|
|
383
443
|
if (customMaxHeight) {
|
|
384
|
-
bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight -
|
|
444
|
+
bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - osbHeight)
|
|
385
445
|
}
|
|
386
446
|
if (customHeight) {
|
|
387
|
-
bodyHeight = customHeight - headerHeight - footerHeight -
|
|
447
|
+
bodyHeight = customHeight - headerHeight - footerHeight - osbHeight
|
|
388
448
|
}
|
|
389
449
|
if (!bodyHeight) {
|
|
390
450
|
if (bodyTableElem) {
|
|
@@ -398,36 +458,43 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
|
398
458
|
bodyHeight = Math.max(bodyMinHeight, bodyHeight)
|
|
399
459
|
}
|
|
400
460
|
|
|
461
|
+
const xLeftCornerEl = $xeTable.$refs.refScrollXLeftCornerElem as HTMLDivElement
|
|
462
|
+
const xRightCornerEl = $xeTable.$refs.refScrollXRightCornerElem as HTMLDivElement
|
|
463
|
+
const scrollbarXToTop = $xeTable.computeScrollbarXToTop
|
|
401
464
|
const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem as HTMLDivElement
|
|
402
465
|
if (scrollXVirtualEl) {
|
|
403
|
-
scrollXVirtualEl.style.height = `${
|
|
404
|
-
scrollXVirtualEl.style.visibility =
|
|
466
|
+
scrollXVirtualEl.style.height = `${osbHeight}px`
|
|
467
|
+
scrollXVirtualEl.style.visibility = overflowX ? 'visible' : 'hidden'
|
|
405
468
|
}
|
|
406
|
-
const
|
|
407
|
-
if (
|
|
408
|
-
|
|
469
|
+
const xWrapperEl = $xeTable.$refs.refScrollXWrapperElem as HTMLDivElement
|
|
470
|
+
if (xWrapperEl) {
|
|
471
|
+
xWrapperEl.style.left = scrollbarXToTop ? `${osbWidth}px` : ''
|
|
472
|
+
xWrapperEl.style.width = `${el.clientWidth - osbWidth}px`
|
|
473
|
+
}
|
|
474
|
+
if (xLeftCornerEl) {
|
|
475
|
+
xLeftCornerEl.style.width = scrollbarXToTop ? `${osbWidth}px` : ''
|
|
476
|
+
xLeftCornerEl.style.display = scrollbarXToTop ? (osbWidth && osbHeight ? 'block' : '') : ''
|
|
409
477
|
}
|
|
410
|
-
const xRightCornerEl = $xeTable.$refs.refScrollXRightCornerElem as HTMLDivElement
|
|
411
478
|
if (xRightCornerEl) {
|
|
412
|
-
xRightCornerEl.style.width = `${
|
|
413
|
-
xRightCornerEl.style.display =
|
|
479
|
+
xRightCornerEl.style.width = scrollbarXToTop ? '' : `${osbWidth}px`
|
|
480
|
+
xRightCornerEl.style.display = scrollbarXToTop ? '' : (osbWidth && osbHeight ? 'block' : '')
|
|
414
481
|
}
|
|
415
482
|
|
|
416
483
|
const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem as HTMLDivElement
|
|
417
484
|
if (scrollYVirtualEl) {
|
|
418
|
-
scrollYVirtualEl.style.width = `${
|
|
485
|
+
scrollYVirtualEl.style.width = `${osbWidth}px`
|
|
419
486
|
scrollYVirtualEl.style.height = `${bodyHeight + headerHeight + footerHeight}px`
|
|
420
|
-
scrollYVirtualEl.style.visibility =
|
|
487
|
+
scrollYVirtualEl.style.visibility = overflowY ? 'visible' : 'hidden'
|
|
421
488
|
}
|
|
422
489
|
const yTopCornerEl = $xeTable.$refs.refScrollYTopCornerElem as HTMLDivElement
|
|
423
490
|
if (yTopCornerEl) {
|
|
424
491
|
yTopCornerEl.style.height = `${headerHeight}px`
|
|
425
492
|
yTopCornerEl.style.display = headerHeight ? 'block' : ''
|
|
426
493
|
}
|
|
427
|
-
const
|
|
428
|
-
if (
|
|
429
|
-
|
|
430
|
-
|
|
494
|
+
const yWrapperEl = $xeTable.$refs.refScrollYWrapperElem as HTMLDivElement
|
|
495
|
+
if (yWrapperEl) {
|
|
496
|
+
yWrapperEl.style.height = `${bodyHeight}px`
|
|
497
|
+
yWrapperEl.style.top = `${headerHeight}px`
|
|
431
498
|
}
|
|
432
499
|
const yBottomCornerEl = $xeTable.$refs.refScrollYBottomCornerElem as HTMLDivElement
|
|
433
500
|
if (yBottomCornerEl) {
|
|
@@ -543,7 +610,7 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
|
543
610
|
if (wrapperElem) {
|
|
544
611
|
wrapperElem.style.top = `${headerHeight}px`
|
|
545
612
|
}
|
|
546
|
-
fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + headerHeight + footerHeight +
|
|
613
|
+
fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + headerHeight + footerHeight + osbHeight)}px`
|
|
547
614
|
fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`
|
|
548
615
|
}
|
|
549
616
|
|
|
@@ -578,7 +645,7 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
|
578
645
|
if (tableElem) {
|
|
579
646
|
tableElem.style.width = tWidth ? `${tWidth}px` : ''
|
|
580
647
|
// 兼容性处理
|
|
581
|
-
tableElem.style.paddingRight =
|
|
648
|
+
tableElem.style.paddingRight = osbWidth && fixedType && (browse['-moz'] || browse.safari) ? `${osbWidth}px` : ''
|
|
582
649
|
}
|
|
583
650
|
const emptyBlockElem = getRefElem(elemStore[`${name}-${layout}-emptyBlock`])
|
|
584
651
|
if (emptyBlockElem) {
|
|
@@ -618,7 +685,7 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
|
618
685
|
// 如果是固定列
|
|
619
686
|
if (fixedWrapperElem) {
|
|
620
687
|
if (wrapperElem) {
|
|
621
|
-
wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight -
|
|
688
|
+
wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight - osbHeight : tableHeight + headerHeight}px`
|
|
622
689
|
}
|
|
623
690
|
}
|
|
624
691
|
}
|
|
@@ -686,53 +753,63 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
|
686
753
|
}
|
|
687
754
|
|
|
688
755
|
function computeRowHeight ($xeTable: VxeTableConstructor) {
|
|
756
|
+
const props = $xeTable
|
|
757
|
+
|
|
758
|
+
const { showOverflow } = props
|
|
689
759
|
const tableHeader = $xeTable.$refs.refTableHeader
|
|
690
760
|
const tableBody = $xeTable.$refs.refTableBody
|
|
691
761
|
const tableBodyElem = tableBody ? (tableBody as any).$el as HTMLDivElement : null
|
|
692
762
|
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
693
763
|
let rowHeight = 0
|
|
694
|
-
if (
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
firstTrElem
|
|
764
|
+
if (showOverflow) {
|
|
765
|
+
if (tableBodyElem) {
|
|
766
|
+
const tableHeaderElem = tableHeader ? (tableHeader as any).$el as HTMLDivElement : null
|
|
767
|
+
let firstTrElem
|
|
768
|
+
firstTrElem = tableBodyElem.querySelector('tr')
|
|
769
|
+
if (!firstTrElem && tableHeaderElem) {
|
|
770
|
+
firstTrElem = tableHeaderElem.querySelector('tr')
|
|
771
|
+
}
|
|
772
|
+
if (firstTrElem) {
|
|
773
|
+
rowHeight = firstTrElem.clientHeight
|
|
774
|
+
}
|
|
700
775
|
}
|
|
701
|
-
if (
|
|
702
|
-
rowHeight =
|
|
776
|
+
if (!rowHeight) {
|
|
777
|
+
rowHeight = defaultRowHeight
|
|
703
778
|
}
|
|
704
|
-
}
|
|
705
|
-
if (!rowHeight) {
|
|
779
|
+
} else {
|
|
706
780
|
rowHeight = defaultRowHeight
|
|
707
781
|
}
|
|
708
782
|
// 最低支持 18px 行高
|
|
709
783
|
return Math.max(18, rowHeight)
|
|
710
784
|
}
|
|
711
785
|
|
|
712
|
-
function handleVirtualYVisible ($xeTable: VxeTableConstructor) {
|
|
786
|
+
function handleVirtualYVisible ($xeTable: VxeTableConstructor, currScrollTop?: number) {
|
|
713
787
|
const props = $xeTable
|
|
714
|
-
const reactData = $xeTable as unknown as TableReactData
|
|
715
788
|
const internalData = $xeTable as unknown as TableInternalData
|
|
716
789
|
|
|
717
790
|
const { showOverflow } = props
|
|
718
|
-
const {
|
|
719
|
-
const
|
|
791
|
+
const { elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData
|
|
792
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
793
|
+
const cellOpts = $xeTable.computeCellOpts
|
|
794
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
720
795
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
721
796
|
if (bodyScrollElem) {
|
|
722
|
-
const
|
|
797
|
+
const clientHeight = bodyScrollElem.clientHeight
|
|
798
|
+
const scrollTop = XEUtils.isNumber(currScrollTop) ? currScrollTop : bodyScrollElem.scrollTop
|
|
723
799
|
const endHeight = scrollTop + clientHeight
|
|
724
800
|
let toVisibleIndex = -1
|
|
725
801
|
let offsetTop = 0
|
|
726
802
|
let visibleSize = 0
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
803
|
+
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height
|
|
804
|
+
if (!isCustomCellHeight && showOverflow) {
|
|
805
|
+
toVisibleIndex = Math.floor(scrollTop / defaultRowHeight)
|
|
806
|
+
visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1
|
|
730
807
|
} else {
|
|
731
808
|
for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
732
809
|
const row = afterFullData[rIndex]
|
|
733
810
|
const rowid = getRowid($xeTable, row)
|
|
734
811
|
const rowRest = fullAllDataRowIdData[rowid]
|
|
735
|
-
offsetTop += rowRest ? (rowRest.height ||
|
|
812
|
+
offsetTop += rowRest ? (rowRest.resizeHeight || cellOpts.height || rowOpts.height || defaultRowHeight) : defaultRowHeight
|
|
736
813
|
if (toVisibleIndex === -1 && scrollTop < offsetTop) {
|
|
737
814
|
toVisibleIndex = rIndex
|
|
738
815
|
}
|
|
@@ -988,7 +1065,7 @@ function autoCellWidth ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
|
|
|
988
1065
|
}
|
|
989
1066
|
const tableHeight = bodyElem.offsetHeight
|
|
990
1067
|
const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight
|
|
991
|
-
reactData.scrollbarWidth =
|
|
1068
|
+
reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth)
|
|
992
1069
|
reactData.overflowY = overflowY
|
|
993
1070
|
internalData.tableWidth = tableWidth
|
|
994
1071
|
internalData.tableHeight = tableHeight
|
|
@@ -998,7 +1075,7 @@ function autoCellWidth ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
|
|
|
998
1075
|
const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0
|
|
999
1076
|
const overflowX = tableWidth > bodyWidth
|
|
1000
1077
|
const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0
|
|
1001
|
-
reactData.scrollbarHeight =
|
|
1078
|
+
reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight)
|
|
1002
1079
|
internalData.headerHeight = headerHeight
|
|
1003
1080
|
internalData.footerHeight = footerHeight
|
|
1004
1081
|
reactData.overflowX = overflowX
|
|
@@ -1009,21 +1086,22 @@ function autoCellWidth ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
|
|
|
1009
1086
|
}
|
|
1010
1087
|
}
|
|
1011
1088
|
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1089
|
+
const calcCellAutoHeight = (rowRest: VxeTableDefines.RowCacheItem, wrapperEl: HTMLDivElement) => {
|
|
1090
|
+
const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`)
|
|
1091
|
+
let topBottomPadding = 0
|
|
1092
|
+
const firstCellEl = cellElemList[0]
|
|
1093
|
+
if (firstCellEl && firstCellEl.parentElement) {
|
|
1094
|
+
const cellStyle = getComputedStyle(firstCellEl.parentElement)
|
|
1095
|
+
topBottomPadding = Math.ceil(XEUtils.toNumber(cellStyle.paddingTop) + XEUtils.toNumber(cellStyle.paddingBottom))
|
|
1096
|
+
}
|
|
1097
|
+
let colHeight = rowRest.height - topBottomPadding
|
|
1098
|
+
for (let i = 0; i < cellElemList.length; i++) {
|
|
1099
|
+
const cellElem = cellElemList[i] as HTMLElement
|
|
1100
|
+
const cellHeight = cellElem ? cellElem.clientHeight : 0
|
|
1101
|
+
colHeight = Math.max(colHeight, Math.ceil(cellHeight))
|
|
1102
|
+
}
|
|
1103
|
+
return colHeight + topBottomPadding
|
|
1104
|
+
}
|
|
1027
1105
|
|
|
1028
1106
|
const calcCellHeight = ($xeTable: VxeTableConstructor) => {
|
|
1029
1107
|
const props = $xeTable
|
|
@@ -1031,42 +1109,21 @@ const calcCellHeight = ($xeTable: VxeTableConstructor) => {
|
|
|
1031
1109
|
const internalData = $xeTable as unknown as TableInternalData
|
|
1032
1110
|
|
|
1033
1111
|
const { showOverflow } = props
|
|
1034
|
-
const { tableData, scrollXLoad } = reactData
|
|
1112
|
+
const { tableData, scrollYLoad, scrollXLoad } = reactData
|
|
1035
1113
|
const { fullAllDataRowIdData } = internalData
|
|
1114
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
1036
1115
|
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
1037
|
-
if (!showOverflow && el) {
|
|
1038
|
-
let paddingTop = 0
|
|
1039
|
-
let paddingBottom = 0
|
|
1040
|
-
let calcPadding = false
|
|
1116
|
+
if (!showOverflow && scrollYLoad && el) {
|
|
1041
1117
|
tableData.forEach(row => {
|
|
1042
1118
|
const rowid = getRowid($xeTable, row)
|
|
1043
1119
|
const rowRest = fullAllDataRowIdData[rowid]
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
for (let i = 0; i < cellList.length; i++) {
|
|
1048
|
-
const cellElem = cellList[i] as HTMLElement
|
|
1049
|
-
const tdEl = cellElem.parentElement as HTMLTableCellElement
|
|
1050
|
-
if (!tdEl || !tdEl.clientWidth) {
|
|
1051
|
-
break
|
|
1052
|
-
}
|
|
1053
|
-
if (!calcPadding) {
|
|
1054
|
-
paddingTop = XEUtils.toNumber(getComputedStyle(tdEl).paddingTop)
|
|
1055
|
-
paddingBottom = XEUtils.toNumber(getComputedStyle(tdEl).paddingBottom)
|
|
1056
|
-
calcPadding = true
|
|
1057
|
-
}
|
|
1058
|
-
let cellHeight = paddingTop + paddingBottom
|
|
1059
|
-
if (cellElem) {
|
|
1060
|
-
cellHeight += cellElem.clientHeight
|
|
1061
|
-
}
|
|
1062
|
-
height = Math.max(height, cellHeight)
|
|
1063
|
-
}
|
|
1064
|
-
rowRest.height = scrollXLoad ? Math.max(rowRest.height, height) : height
|
|
1120
|
+
if (rowRest) {
|
|
1121
|
+
const height = calcCellAutoHeight(rowRest, el)
|
|
1122
|
+
rowRest.height = Math.max(defaultRowHeight, scrollXLoad ? Math.max(rowRest.height, height) : height)
|
|
1065
1123
|
}
|
|
1066
1124
|
})
|
|
1067
|
-
reactData.
|
|
1125
|
+
reactData.calcCellHeightFlag++
|
|
1068
1126
|
}
|
|
1069
|
-
// updateCellOffset()
|
|
1070
1127
|
}
|
|
1071
1128
|
|
|
1072
1129
|
function getOrderField (_vm: any, column: any) {
|
|
@@ -1089,6 +1146,20 @@ function getOrderField (_vm: any, column: any) {
|
|
|
1089
1146
|
}
|
|
1090
1147
|
}
|
|
1091
1148
|
|
|
1149
|
+
function handleTargetEnterEvent ($xeTable: VxeTableConstructor, isClear: boolean) {
|
|
1150
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
1151
|
+
|
|
1152
|
+
const $tooltip = $xeTable.$refs.refTooltip as VxeTooltipInstance
|
|
1153
|
+
clearTimeout(internalData.tooltipTimeout)
|
|
1154
|
+
if (isClear) {
|
|
1155
|
+
$xeTable.closeTooltip()
|
|
1156
|
+
} else {
|
|
1157
|
+
if ($tooltip && $tooltip.setActived) {
|
|
1158
|
+
$tooltip.setActived(true)
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1092
1163
|
function clearDragStatus ($xeTable: any) {
|
|
1093
1164
|
const reactData = $xeTable
|
|
1094
1165
|
|
|
@@ -1188,33 +1259,37 @@ function updateColDropTipContent ($xeTable: any, tdEl: HTMLElement) {
|
|
|
1188
1259
|
reactData.dragTipText = tipContent
|
|
1189
1260
|
}
|
|
1190
1261
|
|
|
1191
|
-
function showDropTip ($xeTable:
|
|
1192
|
-
const reactData = $xeTable
|
|
1193
|
-
const internalData = $xeTable
|
|
1262
|
+
function showDropTip ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, evnt: DragEvent | MouseEvent, trEl: HTMLElement | null, thEl: HTMLElement | null, showLine: boolean, dragPos: string) {
|
|
1263
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
1264
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
1194
1265
|
|
|
1195
1266
|
const el = $xeTable.$refs.refElem as HTMLElement
|
|
1196
1267
|
if (!el) {
|
|
1197
1268
|
return
|
|
1198
1269
|
}
|
|
1199
|
-
const { scrollbarWidth, scrollbarHeight } = reactData
|
|
1270
|
+
const { overflowX, scrollbarWidth, overflowY, scrollbarHeight } = reactData
|
|
1200
1271
|
const { prevDragToChild } = internalData
|
|
1201
1272
|
const wrapperRect = el.getBoundingClientRect()
|
|
1273
|
+
const osbWidth = overflowY ? scrollbarWidth : 0
|
|
1274
|
+
const osbHeight = overflowX ? scrollbarHeight : 0
|
|
1202
1275
|
const tableWidth = el.clientWidth
|
|
1203
1276
|
const tableHeight = el.clientHeight
|
|
1204
1277
|
if (trEl) {
|
|
1205
1278
|
const rdLineEl = $xeTable.$refs.refDragRowLineElem as HTMLElement
|
|
1206
1279
|
if (rdLineEl) {
|
|
1207
1280
|
if (showLine) {
|
|
1281
|
+
const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft
|
|
1208
1282
|
const trRect = trEl.getBoundingClientRect()
|
|
1209
1283
|
let trHeight = trEl.clientHeight
|
|
1210
1284
|
const offsetTop = Math.max(1, trRect.y - wrapperRect.y)
|
|
1211
|
-
if (offsetTop + trHeight > tableHeight -
|
|
1212
|
-
trHeight = tableHeight - offsetTop -
|
|
1285
|
+
if (offsetTop + trHeight > tableHeight - osbHeight) {
|
|
1286
|
+
trHeight = tableHeight - offsetTop - osbHeight
|
|
1213
1287
|
}
|
|
1214
1288
|
rdLineEl.style.display = 'block'
|
|
1289
|
+
rdLineEl.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`
|
|
1215
1290
|
rdLineEl.style.top = `${offsetTop}px`
|
|
1216
1291
|
rdLineEl.style.height = `${trHeight}px`
|
|
1217
|
-
rdLineEl.style.width = `${tableWidth -
|
|
1292
|
+
rdLineEl.style.width = `${tableWidth - osbWidth}px`
|
|
1218
1293
|
rdLineEl.setAttribute('drag-pos', dragPos)
|
|
1219
1294
|
rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n')
|
|
1220
1295
|
} else {
|
|
@@ -1225,6 +1300,7 @@ function showDropTip ($xeTable: any, evnt: DragEvent | MouseEvent, trEl: HTMLEle
|
|
|
1225
1300
|
const cdLineEl = $xeTable.$refs.refDragColLineElem as HTMLElement
|
|
1226
1301
|
if (cdLineEl) {
|
|
1227
1302
|
if (showLine) {
|
|
1303
|
+
const scrollbarXToTop = $xeTable.computeScrollbarXToTop
|
|
1228
1304
|
const leftContainerElem = $xeTable.$refs.refLeftContainer as HTMLDivElement
|
|
1229
1305
|
const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0
|
|
1230
1306
|
const rightContainerElem = $xeTable.$refs.refRightContainer as HTMLDivElement
|
|
@@ -1238,7 +1314,7 @@ function showDropTip ($xeTable: any, evnt: DragEvent | MouseEvent, trEl: HTMLEle
|
|
|
1238
1314
|
thWidth -= startX - offsetLeft
|
|
1239
1315
|
offsetLeft = startX
|
|
1240
1316
|
}
|
|
1241
|
-
const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 :
|
|
1317
|
+
const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 : osbWidth)
|
|
1242
1318
|
if (offsetLeft + thWidth > endX) {
|
|
1243
1319
|
thWidth = endX - offsetLeft
|
|
1244
1320
|
}
|
|
@@ -1249,7 +1325,7 @@ function showDropTip ($xeTable: any, evnt: DragEvent | MouseEvent, trEl: HTMLEle
|
|
|
1249
1325
|
if (prevDragToChild) {
|
|
1250
1326
|
cdLineEl.style.height = `${thRect.height}px`
|
|
1251
1327
|
} else {
|
|
1252
|
-
cdLineEl.style.height = `${tableHeight - offsetTop -
|
|
1328
|
+
cdLineEl.style.height = `${tableHeight - offsetTop - (scrollbarXToTop ? 0 : osbHeight)}px`
|
|
1253
1329
|
}
|
|
1254
1330
|
cdLineEl.setAttribute('drag-pos', dragPos)
|
|
1255
1331
|
cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n')
|
|
@@ -1267,7 +1343,7 @@ function showDropTip ($xeTable: any, evnt: DragEvent | MouseEvent, trEl: HTMLEle
|
|
|
1267
1343
|
}
|
|
1268
1344
|
}
|
|
1269
1345
|
|
|
1270
|
-
function hideDropTip ($xeTable:
|
|
1346
|
+
function hideDropTip ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
1271
1347
|
const rdTipEl = $xeTable.$refs.refDragTipElem as HTMLDivElement
|
|
1272
1348
|
const rdLineEl = $xeTable.$refs.refDragRowLineElem as HTMLDivElement
|
|
1273
1349
|
const cdLineEl = $xeTable.$refs.refDragColLineElem as HTMLDivElement
|
|
@@ -1282,7 +1358,44 @@ function hideDropTip ($xeTable: any) {
|
|
|
1282
1358
|
}
|
|
1283
1359
|
}
|
|
1284
1360
|
|
|
1285
|
-
|
|
1361
|
+
/**
|
|
1362
|
+
* 处理显示 tooltip
|
|
1363
|
+
* @param {Event} evnt 事件
|
|
1364
|
+
* @param {Row} row 行对象
|
|
1365
|
+
*/
|
|
1366
|
+
function handleTooltip ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, evnt: MouseEvent, tdEl: HTMLTableCellElement, overflowElem: HTMLElement, tipElem: HTMLElement | null, params: any) {
|
|
1367
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
1368
|
+
|
|
1369
|
+
if (!overflowElem) {
|
|
1370
|
+
return $xeTable.$nextTick()
|
|
1371
|
+
}
|
|
1372
|
+
params.cell = tdEl
|
|
1373
|
+
const { tooltipStore } = reactData
|
|
1374
|
+
const tooltipOpts = $xeTable.computeTooltipOpts
|
|
1375
|
+
const { column, row } = params
|
|
1376
|
+
const { showAll, contentMethod } = tooltipOpts
|
|
1377
|
+
const customContent = contentMethod ? contentMethod(params) : null
|
|
1378
|
+
const useCustom = contentMethod && !XEUtils.eqNull(customContent)
|
|
1379
|
+
const content = useCustom ? customContent : XEUtils.toString(column.type === 'html' ? overflowElem.innerText : overflowElem.textContent).trim()
|
|
1380
|
+
const isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth
|
|
1381
|
+
if (content && (showAll || useCustom || isCellOverflow)) {
|
|
1382
|
+
Object.assign(tooltipStore, {
|
|
1383
|
+
row,
|
|
1384
|
+
column,
|
|
1385
|
+
visible: true,
|
|
1386
|
+
currOpts: {}
|
|
1387
|
+
})
|
|
1388
|
+
$xeTable.$nextTick(() => {
|
|
1389
|
+
const $tooltip = $xeTable.$refs.refTooltip as VxeTooltipInstance
|
|
1390
|
+
if ($tooltip && $tooltip.open) {
|
|
1391
|
+
$tooltip.open(isCellOverflow ? overflowElem : (tipElem || overflowElem), formatText(content))
|
|
1392
|
+
}
|
|
1393
|
+
})
|
|
1394
|
+
}
|
|
1395
|
+
return $xeTable.$nextTick()
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
function handleScrollToRowColumn ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, fieldOrColumn: string | VxeTableDefines.ColumnInfo | null, row?: any) {
|
|
1286
1399
|
const internalData = $xeTable as unknown as TableInternalData
|
|
1287
1400
|
|
|
1288
1401
|
const { fullColumnIdData } = internalData
|
|
@@ -1301,13 +1414,13 @@ function computeScrollLoad ($xeTable: VxeTableConstructor & VxeTablePrivateMetho
|
|
|
1301
1414
|
return $xeTable.$nextTick().then(() => {
|
|
1302
1415
|
const { scrollXLoad, scrollYLoad } = reactData
|
|
1303
1416
|
const { scrollXStore, scrollYStore } = internalData
|
|
1304
|
-
const
|
|
1305
|
-
const
|
|
1417
|
+
const virtualYOpts = $xeTable.computeVirtualYOpts
|
|
1418
|
+
const virtualXOpts = $xeTable.computeVirtualXOpts
|
|
1306
1419
|
// 计算 X 逻辑
|
|
1307
1420
|
if (scrollXLoad) {
|
|
1308
1421
|
const { toVisibleIndex: toXVisibleIndex, visibleSize: visibleXSize } = handleVirtualXVisible($xeTable)
|
|
1309
|
-
const offsetXSize = Math.max(0,
|
|
1310
|
-
scrollXStore.preloadSize =
|
|
1422
|
+
const offsetXSize = Math.max(0, virtualXOpts.oSize ? XEUtils.toNumber(virtualXOpts.oSize) : 0)
|
|
1423
|
+
scrollXStore.preloadSize = XEUtils.toNumber(virtualXOpts.preSize)
|
|
1311
1424
|
scrollXStore.offsetSize = offsetXSize
|
|
1312
1425
|
scrollXStore.visibleSize = visibleXSize
|
|
1313
1426
|
scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex)
|
|
@@ -1319,15 +1432,14 @@ function computeScrollLoad ($xeTable: VxeTableConstructor & VxeTablePrivateMetho
|
|
|
1319
1432
|
} else {
|
|
1320
1433
|
$xeTable.updateScrollXSpace()
|
|
1321
1434
|
}
|
|
1322
|
-
calcCellHeight($xeTable)
|
|
1323
1435
|
// 计算 Y 逻辑
|
|
1324
1436
|
const rowHeight = computeRowHeight($xeTable)
|
|
1325
1437
|
;(scrollYStore as any).rowHeight = rowHeight
|
|
1326
1438
|
reactData.rowHeight = rowHeight
|
|
1327
1439
|
const { toVisibleIndex: toYVisibleIndex, visibleSize: visibleYSize } = handleVirtualYVisible($xeTable)
|
|
1328
1440
|
if (scrollYLoad) {
|
|
1329
|
-
const offsetYSize = Math.max(0,
|
|
1330
|
-
scrollYStore.preloadSize =
|
|
1441
|
+
const offsetYSize = Math.max(0, virtualYOpts.oSize ? XEUtils.toNumber(virtualYOpts.oSize) : 0)
|
|
1442
|
+
scrollYStore.preloadSize = XEUtils.toNumber(virtualYOpts.preSize)
|
|
1331
1443
|
scrollYStore.offsetSize = offsetYSize
|
|
1332
1444
|
scrollYStore.visibleSize = visibleYSize
|
|
1333
1445
|
scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex)
|
|
@@ -1355,12 +1467,14 @@ function handleRecalculateLayout ($xeTable: VxeTableConstructor & VxeTablePrivat
|
|
|
1355
1467
|
}
|
|
1356
1468
|
calcCellWidth($xeTable)
|
|
1357
1469
|
autoCellWidth($xeTable)
|
|
1470
|
+
updateStyle($xeTable)
|
|
1358
1471
|
return computeScrollLoad($xeTable).then(() => {
|
|
1359
1472
|
if (reFull === true) {
|
|
1360
1473
|
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
1361
1474
|
calcCellHeight($xeTable)
|
|
1362
1475
|
calcCellWidth($xeTable)
|
|
1363
1476
|
autoCellWidth($xeTable)
|
|
1477
|
+
updateStyle($xeTable)
|
|
1364
1478
|
return computeScrollLoad($xeTable)
|
|
1365
1479
|
}
|
|
1366
1480
|
})
|
|
@@ -1615,7 +1729,7 @@ function handleColumn ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, c
|
|
|
1615
1729
|
/**
|
|
1616
1730
|
* 纵向 Y 可视渲染处理
|
|
1617
1731
|
*/
|
|
1618
|
-
function loadScrollYData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
1732
|
+
function loadScrollYData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, scrollTop?: number) {
|
|
1619
1733
|
const props = $xeTable
|
|
1620
1734
|
const reactData = $xeTable as unknown as TableReactData
|
|
1621
1735
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -1625,7 +1739,7 @@ function loadScrollYData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
1625
1739
|
const { scrollYStore } = internalData
|
|
1626
1740
|
const { preloadSize, startIndex, endIndex, offsetSize } = scrollYStore
|
|
1627
1741
|
const autoOffsetYSize = showOverflow ? offsetSize : offsetSize + 1
|
|
1628
|
-
const { toVisibleIndex, visibleSize } = handleVirtualYVisible($xeTable)
|
|
1742
|
+
const { toVisibleIndex, visibleSize } = handleVirtualYVisible($xeTable, scrollTop)
|
|
1629
1743
|
const offsetItem = {
|
|
1630
1744
|
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
1631
1745
|
endIndex: toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize
|
|
@@ -1643,6 +1757,46 @@ function loadScrollYData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
1643
1757
|
}
|
|
1644
1758
|
}
|
|
1645
1759
|
|
|
1760
|
+
function lazyScrollXData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
1761
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
1762
|
+
|
|
1763
|
+
const { lxTimeout, lxRunTime, scrollXStore } = internalData
|
|
1764
|
+
const { visibleSize } = scrollXStore
|
|
1765
|
+
const fpsTime = Math.max(5, Math.min(10, Math.floor(visibleSize / 3)))
|
|
1766
|
+
if (lxTimeout) {
|
|
1767
|
+
clearTimeout(lxTimeout)
|
|
1768
|
+
}
|
|
1769
|
+
if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
|
|
1770
|
+
internalData.lxRunTime = Date.now()
|
|
1771
|
+
loadScrollXData($xeTable)
|
|
1772
|
+
}
|
|
1773
|
+
internalData.lxTimeout = setTimeout(() => {
|
|
1774
|
+
internalData.lxTimeout = undefined
|
|
1775
|
+
internalData.lxRunTime = undefined
|
|
1776
|
+
loadScrollXData($xeTable)
|
|
1777
|
+
}, fpsTime)
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
function lazyScrollYData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
1781
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
1782
|
+
|
|
1783
|
+
const { lyTimeout, lyRunTime, scrollYStore } = internalData
|
|
1784
|
+
const { visibleSize } = scrollYStore
|
|
1785
|
+
const fpsTime = Math.floor(Math.max(4, Math.min(10, visibleSize / 3)))
|
|
1786
|
+
if (lyTimeout) {
|
|
1787
|
+
clearTimeout(lyTimeout)
|
|
1788
|
+
}
|
|
1789
|
+
if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
|
|
1790
|
+
internalData.lyRunTime = Date.now()
|
|
1791
|
+
loadScrollYData($xeTable)
|
|
1792
|
+
}
|
|
1793
|
+
internalData.lyTimeout = setTimeout(() => {
|
|
1794
|
+
internalData.lyTimeout = undefined
|
|
1795
|
+
internalData.lyRunTime = undefined
|
|
1796
|
+
loadScrollYData($xeTable)
|
|
1797
|
+
}, fpsTime)
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1646
1800
|
function checkLastSyncScroll ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, isRollX: boolean, isRollY: boolean) {
|
|
1647
1801
|
const reactData = $xeTable as unknown as TableReactData
|
|
1648
1802
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -1655,28 +1809,66 @@ function checkLastSyncScroll ($xeTable: VxeTableConstructor & VxeTablePrivateMet
|
|
|
1655
1809
|
internalData.lcsTimeout = setTimeout(() => {
|
|
1656
1810
|
internalData.lcsRunTime = Date.now()
|
|
1657
1811
|
internalData.lcsTimeout = undefined
|
|
1812
|
+
internalData.intoRunScroll = false
|
|
1658
1813
|
internalData.inVirtualScroll = false
|
|
1659
1814
|
internalData.inWheelScroll = false
|
|
1660
1815
|
internalData.inHeaderScroll = false
|
|
1661
1816
|
internalData.inBodyScroll = false
|
|
1662
1817
|
internalData.inFooterScroll = false
|
|
1663
1818
|
internalData.scrollRenderType = ''
|
|
1819
|
+
calcCellHeight($xeTable)
|
|
1664
1820
|
if (isRollX && scrollXLoad) {
|
|
1665
|
-
$xeTable.updateScrollXData()
|
|
1666
|
-
calcCellHeight($xeTable)
|
|
1667
|
-
loadScrollXData($xeTable)
|
|
1668
|
-
})
|
|
1821
|
+
$xeTable.updateScrollXData()
|
|
1669
1822
|
}
|
|
1670
1823
|
if (isRollY && scrollYLoad) {
|
|
1671
1824
|
$xeTable.updateScrollYData().then(() => {
|
|
1672
1825
|
calcCellHeight($xeTable)
|
|
1673
|
-
|
|
1826
|
+
$xeTable.updateScrollYSpace()
|
|
1674
1827
|
})
|
|
1675
1828
|
}
|
|
1676
1829
|
$xeTable.updateCellAreas()
|
|
1677
1830
|
}, 200)
|
|
1678
1831
|
}
|
|
1679
1832
|
|
|
1833
|
+
const getWheelSpeed = (lastScrollTime: number) => {
|
|
1834
|
+
let multiple = 1
|
|
1835
|
+
const currTime = Date.now()
|
|
1836
|
+
if (lastScrollTime + 25 > currTime) {
|
|
1837
|
+
multiple = 1.18
|
|
1838
|
+
} else if (lastScrollTime + 30 > currTime) {
|
|
1839
|
+
multiple = 1.15
|
|
1840
|
+
} else if (lastScrollTime + 40 > currTime) {
|
|
1841
|
+
multiple = 1.12
|
|
1842
|
+
} else if (lastScrollTime + 55 > currTime) {
|
|
1843
|
+
multiple = 1.09
|
|
1844
|
+
} else if (lastScrollTime + 75 > currTime) {
|
|
1845
|
+
multiple = 1.06
|
|
1846
|
+
} else if (lastScrollTime + 100 > currTime) {
|
|
1847
|
+
multiple = 1.03
|
|
1848
|
+
}
|
|
1849
|
+
return multiple
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
const wheelScrollTo = (diffNum: number, cb: (progress: number) => void) => {
|
|
1853
|
+
const duration = Math.abs(diffNum)
|
|
1854
|
+
const startTime = performance.now()
|
|
1855
|
+
let countTop = 0
|
|
1856
|
+
const step = (timestamp: number) => {
|
|
1857
|
+
let progress = (timestamp - startTime) / duration
|
|
1858
|
+
if (progress > 1) {
|
|
1859
|
+
progress = 1
|
|
1860
|
+
}
|
|
1861
|
+
const easedProgress = Math.pow(progress, 2)
|
|
1862
|
+
const offsetTop = Math.floor((diffNum * easedProgress)) - countTop
|
|
1863
|
+
countTop += offsetTop
|
|
1864
|
+
cb(offsetTop)
|
|
1865
|
+
if (progress < 1) {
|
|
1866
|
+
requestAnimationFrame(step)
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
requestAnimationFrame(step)
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1680
1872
|
function updateHeight ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
1681
1873
|
const internalData = $xeTable as unknown as TableInternalData
|
|
1682
1874
|
|
|
@@ -1686,57 +1878,63 @@ function updateHeight ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
|
1686
1878
|
}
|
|
1687
1879
|
|
|
1688
1880
|
function calcColumnAutoWidth (column: VxeTableDefines.ColumnInfo, wrapperEl: HTMLDivElement) {
|
|
1689
|
-
const
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
if (firstCellEl) {
|
|
1693
|
-
const cellStyle = getComputedStyle(firstCellEl)
|
|
1694
|
-
|
|
1881
|
+
const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[colid="${column.id}"]`)
|
|
1882
|
+
let leftRightPadding = 0
|
|
1883
|
+
const firstCellEl = cellElemList[0]
|
|
1884
|
+
if (firstCellEl && firstCellEl.parentElement) {
|
|
1885
|
+
const cellStyle = getComputedStyle(firstCellEl.parentElement)
|
|
1886
|
+
leftRightPadding = Math.ceil(XEUtils.toNumber(cellStyle.paddingLeft) + XEUtils.toNumber(cellStyle.paddingRight))
|
|
1695
1887
|
}
|
|
1696
|
-
let colWidth = column.renderAutoWidth -
|
|
1697
|
-
|
|
1698
|
-
const
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
XEUtils.arrayEach(cellEl.children, (btnEl) => {
|
|
1703
|
-
titleWidth += (btnEl as HTMLElement).offsetWidth + 1
|
|
1704
|
-
})
|
|
1705
|
-
} else {
|
|
1706
|
-
const labelEl = cellEl.firstElementChild as HTMLElement
|
|
1707
|
-
if (labelEl) {
|
|
1708
|
-
titleWidth = labelEl.offsetWidth
|
|
1709
|
-
}
|
|
1710
|
-
}
|
|
1711
|
-
if (titleWidth) {
|
|
1712
|
-
colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4)
|
|
1713
|
-
}
|
|
1714
|
-
})
|
|
1715
|
-
return colWidth + paddingSize
|
|
1888
|
+
let colWidth = column.renderAutoWidth - leftRightPadding
|
|
1889
|
+
for (let i = 0; i < cellElemList.length; i++) {
|
|
1890
|
+
const celEl = cellElemList[i] as HTMLDivElement
|
|
1891
|
+
colWidth = Math.max(colWidth, celEl ? Math.ceil(celEl.scrollWidth) + 4 : 0)
|
|
1892
|
+
}
|
|
1893
|
+
return colWidth + leftRightPadding
|
|
1716
1894
|
}
|
|
1717
1895
|
|
|
1718
1896
|
function calcCellWidth ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
1719
|
-
const reactData = $xeTable as unknown as TableReactData
|
|
1720
1897
|
const internalData = $xeTable as unknown as TableInternalData
|
|
1721
1898
|
|
|
1722
1899
|
const autoWidthColumnList = $xeTable.computeAutoWidthColumnList
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1900
|
+
const { fullColumnIdData } = internalData
|
|
1901
|
+
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
1902
|
+
if (el) {
|
|
1903
|
+
el.setAttribute('data-calc-col', 'Y')
|
|
1904
|
+
autoWidthColumnList.forEach(column => {
|
|
1905
|
+
const colid = column.id
|
|
1906
|
+
const colRest = fullColumnIdData[colid]
|
|
1907
|
+
const colWidth = calcColumnAutoWidth(column, el)
|
|
1908
|
+
if (colRest) {
|
|
1909
|
+
colRest.width = Math.max(colWidth, colRest.width)
|
|
1910
|
+
}
|
|
1911
|
+
column.renderAutoWidth = colWidth
|
|
1912
|
+
})
|
|
1913
|
+
$xeTable.analyColumnWidth()
|
|
1914
|
+
el.removeAttribute('data-calc-col')
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
const handleUpdateColResize = ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, evnt: MouseEvent, params: any) => {
|
|
1919
|
+
$xeTable.analyColumnWidth()
|
|
1920
|
+
$xeTable.recalculate(true).then(() => {
|
|
1921
|
+
$xeTable.saveCustomStore('update:width')
|
|
1922
|
+
$xeTable.updateCellAreas()
|
|
1923
|
+
$xeTable.dispatchEvent('column-resizable-change', params, evnt)
|
|
1924
|
+
// 已废弃 resizable-change
|
|
1925
|
+
$xeTable.dispatchEvent('resizable-change', params, evnt)
|
|
1926
|
+
setTimeout(() => $xeTable.recalculate(true), 300)
|
|
1927
|
+
})
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
const handleUpdateRowResize = ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, evnt: MouseEvent, params: any) => {
|
|
1931
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
1932
|
+
|
|
1933
|
+
reactData.resizeHeightFlag++
|
|
1934
|
+
$xeTable.recalculate(true).then(() => {
|
|
1935
|
+
$xeTable.updateCellAreas()
|
|
1936
|
+
$xeTable.dispatchEvent('row-resizable-change', params, evnt)
|
|
1937
|
+
setTimeout(() => $xeTable.recalculate(true), 300)
|
|
1740
1938
|
})
|
|
1741
1939
|
}
|
|
1742
1940
|
|
|
@@ -1793,7 +1991,7 @@ const Methods = {
|
|
|
1793
1991
|
warnLog('vxe.error.delFunc', ['syncData', 'getData'])
|
|
1794
1992
|
return this.$nextTick().then(() => {
|
|
1795
1993
|
this.tableData = []
|
|
1796
|
-
return this.$nextTick().then(() => this.loadTableData(this.tableFullData))
|
|
1994
|
+
return this.$nextTick().then(() => this.loadTableData(this.tableFullData, true))
|
|
1797
1995
|
})
|
|
1798
1996
|
},
|
|
1799
1997
|
/**
|
|
@@ -1848,8 +2046,9 @@ const Methods = {
|
|
|
1848
2046
|
* 加载表格数据
|
|
1849
2047
|
* @param {Array} datas 数据
|
|
1850
2048
|
*/
|
|
1851
|
-
loadTableData (datas: any) {
|
|
1852
|
-
const $xeTable = this
|
|
2049
|
+
loadTableData (datas: any[], isReset: boolean) {
|
|
2050
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
2051
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
1853
2052
|
|
|
1854
2053
|
const { keepSource, showOverflow, treeConfig, treeOpts, editStore, scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop, scrollYLoad: oldScrollYLoad, sXOpts, sYOpts } = this
|
|
1855
2054
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
@@ -1905,9 +2104,12 @@ const Methods = {
|
|
|
1905
2104
|
this.tableFullData = fullData
|
|
1906
2105
|
this.tableFullTreeData = treeData
|
|
1907
2106
|
// 缓存数据
|
|
1908
|
-
this.cacheRowMap(true)
|
|
2107
|
+
this.cacheRowMap(isReset, true)
|
|
1909
2108
|
// 原始数据
|
|
1910
2109
|
this.tableSynchData = datas
|
|
2110
|
+
if (isReset) {
|
|
2111
|
+
internalData.isResizeCellHeight = false
|
|
2112
|
+
}
|
|
1911
2113
|
// 克隆原数据,用于显示编辑状态,与编辑值做对比
|
|
1912
2114
|
if (keepSource) {
|
|
1913
2115
|
this.cacheSourceMap(fullData)
|
|
@@ -1967,6 +2169,7 @@ const Methods = {
|
|
|
1967
2169
|
if (sYOpts.scrollToTopOnChange) {
|
|
1968
2170
|
targetScrollTop = 0
|
|
1969
2171
|
}
|
|
2172
|
+
calcCellHeight($xeTable)
|
|
1970
2173
|
// 是否变更虚拟滚动
|
|
1971
2174
|
if (oldScrollYLoad === sYLoad) {
|
|
1972
2175
|
restoreScrollLocation(this, targetScrollLeft, targetScrollTop)
|
|
@@ -1991,7 +2194,7 @@ const Methods = {
|
|
|
1991
2194
|
*/
|
|
1992
2195
|
loadData (datas: any) {
|
|
1993
2196
|
const { initStatus } = this
|
|
1994
|
-
return this.loadTableData(datas).then(() => {
|
|
2197
|
+
return this.loadTableData(datas, false).then(() => {
|
|
1995
2198
|
this.inited = true
|
|
1996
2199
|
this.initStatus = true
|
|
1997
2200
|
if (!initStatus) {
|
|
@@ -2009,7 +2212,7 @@ const Methods = {
|
|
|
2009
2212
|
.then(() => {
|
|
2010
2213
|
this.inited = true
|
|
2011
2214
|
this.initStatus = true
|
|
2012
|
-
return this.loadTableData(datas)
|
|
2215
|
+
return this.loadTableData(datas, true)
|
|
2013
2216
|
})
|
|
2014
2217
|
.then(() => {
|
|
2015
2218
|
this.handleLoadDefaults()
|
|
@@ -2087,9 +2290,8 @@ const Methods = {
|
|
|
2087
2290
|
},
|
|
2088
2291
|
/**
|
|
2089
2292
|
* 更新数据行的 Map
|
|
2090
|
-
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
2091
2293
|
*/
|
|
2092
|
-
cacheRowMap (isSource?: boolean) {
|
|
2294
|
+
cacheRowMap (isReset: boolean, isSource?: boolean) {
|
|
2093
2295
|
const { treeConfig, treeOpts, tableFullData, fullAllDataRowIdData, tableFullTreeData } = this
|
|
2094
2296
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
2095
2297
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
|
|
@@ -2109,8 +2311,8 @@ const Methods = {
|
|
|
2109
2311
|
row[childrenField] = null
|
|
2110
2312
|
}
|
|
2111
2313
|
let cacheItem = fullAllDataRowIdData[rowid]
|
|
2112
|
-
if (!cacheItem) {
|
|
2113
|
-
cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, items, parent: parentRow, level, height: 0, oTop: 0 }
|
|
2314
|
+
if (isReset || !cacheItem) {
|
|
2315
|
+
cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0 }
|
|
2114
2316
|
}
|
|
2115
2317
|
cacheItem.row = row
|
|
2116
2318
|
cacheItem.items = items
|
|
@@ -2183,7 +2385,7 @@ const Methods = {
|
|
|
2183
2385
|
XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
|
|
2184
2386
|
const rowid = getRowid($xeTable, childRow)
|
|
2185
2387
|
const parentRow = parentItem || parentRest.row
|
|
2186
|
-
const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, oTop: 0 }
|
|
2388
|
+
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 }
|
|
2187
2389
|
fullDataRowIdData[rowid] = rest
|
|
2188
2390
|
fullAllDataRowIdData[rowid] = rest
|
|
2189
2391
|
}, { children: childrenField })
|
|
@@ -2191,7 +2393,7 @@ const Methods = {
|
|
|
2191
2393
|
if (transform) {
|
|
2192
2394
|
row[mapChildrenField] = XEUtils.clone(rows, false)
|
|
2193
2395
|
}
|
|
2194
|
-
|
|
2396
|
+
updateAfterDataIndex($xeTable)
|
|
2195
2397
|
return rows
|
|
2196
2398
|
})
|
|
2197
2399
|
},
|
|
@@ -2534,18 +2736,37 @@ const Methods = {
|
|
|
2534
2736
|
return this.$nextTick()
|
|
2535
2737
|
},
|
|
2536
2738
|
getCellElement (row: any, fieldOrColumn: any) {
|
|
2537
|
-
const
|
|
2739
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
2740
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
2741
|
+
|
|
2742
|
+
const { elemStore } = internalData
|
|
2743
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
2538
2744
|
if (!column) {
|
|
2539
2745
|
return null
|
|
2540
2746
|
}
|
|
2541
|
-
const
|
|
2542
|
-
const
|
|
2543
|
-
|
|
2747
|
+
const rowid = getRowid($xeTable, row)
|
|
2748
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
2749
|
+
const leftScrollElem = getRefElem(elemStore['left-body-scroll'])
|
|
2750
|
+
const rightScrollElem = getRefElem(elemStore['right-body-scroll'])
|
|
2751
|
+
let bodyElem
|
|
2544
2752
|
if (column) {
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2753
|
+
if (column.fixed) {
|
|
2754
|
+
if (column.fixed === 'left') {
|
|
2755
|
+
if (leftScrollElem) {
|
|
2756
|
+
bodyElem = leftScrollElem
|
|
2757
|
+
}
|
|
2758
|
+
} else {
|
|
2759
|
+
if (rightScrollElem) {
|
|
2760
|
+
bodyElem = rightScrollElem
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
if (!bodyElem) {
|
|
2765
|
+
bodyElem = bodyScrollElem
|
|
2766
|
+
}
|
|
2767
|
+
if (bodyElem) {
|
|
2768
|
+
return bodyElem.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`)
|
|
2769
|
+
}
|
|
2549
2770
|
}
|
|
2550
2771
|
return null
|
|
2551
2772
|
},
|
|
@@ -2746,6 +2967,8 @@ const Methods = {
|
|
|
2746
2967
|
* 如果存在筛选条件,继续处理
|
|
2747
2968
|
*/
|
|
2748
2969
|
updateAfterFullData () {
|
|
2970
|
+
const $xeTable = this
|
|
2971
|
+
|
|
2749
2972
|
const { tableFullColumn, tableFullData, filterOpts, sortOpts, treeConfig, treeOpts, tableFullTreeData } = this
|
|
2750
2973
|
const { remote: allRemoteFilter, filterMethod: allFilterMethod } = filterOpts
|
|
2751
2974
|
const { remote: allRemoteSort, sortMethod: allSortMethod, multiple: sortMultiple, chronological } = sortOpts
|
|
@@ -2861,7 +3084,7 @@ const Methods = {
|
|
|
2861
3084
|
}
|
|
2862
3085
|
this.afterFullData = tableData
|
|
2863
3086
|
this.afterTreeFullData = tableTree
|
|
2864
|
-
|
|
3087
|
+
updateAfterDataIndex($xeTable)
|
|
2865
3088
|
},
|
|
2866
3089
|
/**
|
|
2867
3090
|
* 预编译
|
|
@@ -2869,46 +3092,8 @@ const Methods = {
|
|
|
2869
3092
|
*/
|
|
2870
3093
|
updateAfterDataIndex () {
|
|
2871
3094
|
const $xeTable = this
|
|
2872
|
-
const props = $xeTable
|
|
2873
|
-
const internalData = $xeTable
|
|
2874
3095
|
|
|
2875
|
-
|
|
2876
|
-
const { afterFullData, fullDataRowIdData, fullAllDataRowIdData, afterTreeFullData } = internalData
|
|
2877
|
-
const treeOpts = $xeTable.computeTreeOpts
|
|
2878
|
-
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
2879
|
-
const fullMaps: any = {}
|
|
2880
|
-
if (treeConfig) {
|
|
2881
|
-
XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
|
|
2882
|
-
const rowid = getRowid($xeTable, row)
|
|
2883
|
-
const rowRest = fullAllDataRowIdData[rowid]
|
|
2884
|
-
const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
|
|
2885
|
-
if (rowRest) {
|
|
2886
|
-
rowRest.seq = seq
|
|
2887
|
-
rowRest._index = index
|
|
2888
|
-
} else {
|
|
2889
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0, height: 0, oTop: 0 }
|
|
2890
|
-
fullAllDataRowIdData[rowid] = rest
|
|
2891
|
-
fullDataRowIdData[rowid] = rest
|
|
2892
|
-
}
|
|
2893
|
-
fullMaps[rowid] = row
|
|
2894
|
-
}, { children: treeOpts.transform ? treeOpts.mapChildrenField : childrenField })
|
|
2895
|
-
} else {
|
|
2896
|
-
afterFullData.forEach((row: any, index: number) => {
|
|
2897
|
-
const rowid = getRowid($xeTable, row)
|
|
2898
|
-
const rowRest = fullAllDataRowIdData[rowid]
|
|
2899
|
-
const seq = index + 1
|
|
2900
|
-
if (rowRest) {
|
|
2901
|
-
rowRest.seq = seq
|
|
2902
|
-
rowRest._index = index
|
|
2903
|
-
} else {
|
|
2904
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0, height: 0, oTop: 0 }
|
|
2905
|
-
fullAllDataRowIdData[rowid] = rest
|
|
2906
|
-
fullDataRowIdData[rowid] = rest
|
|
2907
|
-
}
|
|
2908
|
-
fullMaps[rowid] = row
|
|
2909
|
-
})
|
|
2910
|
-
}
|
|
2911
|
-
this.afterFullRowMaps = fullMaps
|
|
3096
|
+
updateAfterDataIndex($xeTable)
|
|
2912
3097
|
},
|
|
2913
3098
|
/**
|
|
2914
3099
|
* 只对 tree-config 有效,获取行的子级
|
|
@@ -2975,7 +3160,10 @@ const Methods = {
|
|
|
2975
3160
|
* @param {String/Number} rowid 行主键
|
|
2976
3161
|
*/
|
|
2977
3162
|
getRowById (cellValue: any) {
|
|
2978
|
-
const
|
|
3163
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3164
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3165
|
+
|
|
3166
|
+
const { fullDataRowIdData } = internalData
|
|
2979
3167
|
const rowid = XEUtils.eqNull(cellValue) ? '' : encodeURIComponent(cellValue)
|
|
2980
3168
|
return fullDataRowIdData[rowid] ? fullDataRowIdData[rowid].row : null
|
|
2981
3169
|
},
|
|
@@ -2983,13 +3171,10 @@ const Methods = {
|
|
|
2983
3171
|
* 根据行获取行的唯一主键
|
|
2984
3172
|
* @param {Row} row 行对象
|
|
2985
3173
|
*/
|
|
2986
|
-
getRowid (
|
|
3174
|
+
getRowid (row: any) {
|
|
2987
3175
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
2988
|
-
const internalData = $xeTable as unknown as TableInternalData
|
|
2989
3176
|
|
|
2990
|
-
|
|
2991
|
-
const rowid = XEUtils.eqNull(cellValue) ? '' : encodeURIComponent(cellValue || '')
|
|
2992
|
-
return fullDataRowIdData[rowid] ? fullDataRowIdData[rowid].row : null
|
|
3177
|
+
return getRowid($xeTable, row)
|
|
2993
3178
|
},
|
|
2994
3179
|
/**
|
|
2995
3180
|
* 获取处理后的表格数据
|
|
@@ -3180,34 +3365,40 @@ const Methods = {
|
|
|
3180
3365
|
}
|
|
3181
3366
|
return $xeTable.$nextTick()
|
|
3182
3367
|
},
|
|
3183
|
-
setColumnWidth (fieldOrColumn:
|
|
3184
|
-
const $xeTable = this
|
|
3368
|
+
setColumnWidth (fieldOrColumn: VxeColumnPropTypes.Field | VxeTableDefines.ColumnInfo | VxeColumnPropTypes.Field[] | VxeTableDefines.ColumnInfo[], width: number | string) {
|
|
3369
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3370
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3185
3371
|
|
|
3372
|
+
const { elemStore } = internalData
|
|
3186
3373
|
let status = false
|
|
3187
3374
|
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn]
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3375
|
+
let cWidth = XEUtils.toInteger(width)
|
|
3376
|
+
if (isScale(width)) {
|
|
3377
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
3378
|
+
const bodyWidth = bodyScrollElem ? bodyScrollElem.clientWidth - 1 : 0
|
|
3379
|
+
cWidth = Math.floor(cWidth * bodyWidth)
|
|
3380
|
+
}
|
|
3381
|
+
if (cWidth) {
|
|
3382
|
+
cols.forEach(item => {
|
|
3383
|
+
const column = handleFieldOrColumn($xeTable, item)
|
|
3384
|
+
if (column) {
|
|
3385
|
+
column.resizeWidth = cWidth
|
|
3386
|
+
if (!status) {
|
|
3387
|
+
status = true
|
|
3388
|
+
}
|
|
3202
3389
|
}
|
|
3390
|
+
})
|
|
3391
|
+
if (status) {
|
|
3392
|
+
return $xeTable.refreshColumn().then(() => {
|
|
3393
|
+
return { status }
|
|
3394
|
+
})
|
|
3203
3395
|
}
|
|
3204
|
-
})
|
|
3205
|
-
if (status) {
|
|
3206
|
-
return $xeTable.refreshColumn()
|
|
3207
3396
|
}
|
|
3208
|
-
return $xeTable.$nextTick()
|
|
3397
|
+
return $xeTable.$nextTick().then(() => {
|
|
3398
|
+
return { status }
|
|
3399
|
+
})
|
|
3209
3400
|
},
|
|
3210
|
-
getColumnWidth (fieldOrColumn:
|
|
3401
|
+
getColumnWidth (fieldOrColumn: VxeColumnPropTypes.Field | VxeTableDefines.ColumnInfo) {
|
|
3211
3402
|
const column = handleFieldOrColumn(this, fieldOrColumn)
|
|
3212
3403
|
if (column) {
|
|
3213
3404
|
return column.renderWidth
|
|
@@ -3219,7 +3410,12 @@ const Methods = {
|
|
|
3219
3410
|
* 如果为 true 则重置所有状态
|
|
3220
3411
|
* 如果已关联工具栏,则会同步更新
|
|
3221
3412
|
*/
|
|
3222
|
-
resetColumn (options
|
|
3413
|
+
resetColumn (options?: boolean | {
|
|
3414
|
+
visible?: boolean
|
|
3415
|
+
resizable?: boolean
|
|
3416
|
+
fixed?: boolean
|
|
3417
|
+
order?: boolean
|
|
3418
|
+
}) {
|
|
3223
3419
|
warnLog('vxe.error.delFunc', ['resetColumn', 'resetCustom'])
|
|
3224
3420
|
return this.resetCustom(options)
|
|
3225
3421
|
},
|
|
@@ -3492,7 +3688,149 @@ const Methods = {
|
|
|
3492
3688
|
})
|
|
3493
3689
|
Object.assign(this.columnStore, { resizeList, pxList, pxMinList, autoMinList, scaleList, scaleMinList, autoList, remainList })
|
|
3494
3690
|
},
|
|
3495
|
-
|
|
3691
|
+
handleColResizeMousedownEvent (evnt: MouseEvent, fixedType: 'left' | 'right' | '', params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
3692
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3693
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
3694
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3695
|
+
|
|
3696
|
+
evnt.stopPropagation()
|
|
3697
|
+
evnt.preventDefault()
|
|
3698
|
+
const { column } = params
|
|
3699
|
+
const { overflowX, scrollbarHeight } = reactData
|
|
3700
|
+
const { elemStore, visibleColumn } = internalData
|
|
3701
|
+
const resizableOpts = $xeTable.computeResizableOpts
|
|
3702
|
+
const osbHeight = overflowX ? scrollbarHeight : 0
|
|
3703
|
+
const tableEl = $xeTable.$refs.refElem as HTMLDivElement
|
|
3704
|
+
const leftContainerElem = $xeTable.$refs.refLeftContainer as HTMLDivElement
|
|
3705
|
+
const rightContainerElem = $xeTable.$refs.refRightContainer as HTMLDivElement
|
|
3706
|
+
const resizeBarElem = $xeTable.$refs.refColResizeBar as HTMLDivElement
|
|
3707
|
+
if (!resizeBarElem) {
|
|
3708
|
+
return
|
|
3709
|
+
}
|
|
3710
|
+
const resizeTipElem = resizeBarElem.firstElementChild as HTMLDivElement
|
|
3711
|
+
const scrollbarXToTop = $xeTable.computeScrollbarXToTop
|
|
3712
|
+
const { clientX: dragClientX } = evnt
|
|
3713
|
+
const wrapperElem = $xeTable.$refs.refElem as HTMLDivElement
|
|
3714
|
+
const dragBtnElem = evnt.target as HTMLDivElement
|
|
3715
|
+
let resizeColumn = column
|
|
3716
|
+
if (column.children && column.children.length) {
|
|
3717
|
+
XEUtils.eachTree(column.children, childColumn => {
|
|
3718
|
+
resizeColumn = childColumn
|
|
3719
|
+
})
|
|
3720
|
+
}
|
|
3721
|
+
const cell = dragBtnElem.parentNode as HTMLTableCellElement
|
|
3722
|
+
const cellParams = Object.assign(params, { cell })
|
|
3723
|
+
let dragLeft = 0
|
|
3724
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
3725
|
+
if (!bodyScrollElem) {
|
|
3726
|
+
return
|
|
3727
|
+
}
|
|
3728
|
+
const pos = getOffsetPos(dragBtnElem, wrapperElem)
|
|
3729
|
+
const dragBtnWidth = dragBtnElem.clientWidth
|
|
3730
|
+
const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2)
|
|
3731
|
+
const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth // 列之间的最小间距
|
|
3732
|
+
let dragMinLeft = pos.left - cell.clientWidth + dragBtnWidth + minInterval
|
|
3733
|
+
let dragPosLeft = pos.left + dragBtnOffsetWidth
|
|
3734
|
+
const isLeftFixed = fixedType === 'left'
|
|
3735
|
+
const isRightFixed = fixedType === 'right'
|
|
3736
|
+
|
|
3737
|
+
// 计算左右侧固定列偏移量
|
|
3738
|
+
let fixedOffsetWidth = 0
|
|
3739
|
+
if (isLeftFixed || isRightFixed) {
|
|
3740
|
+
const siblingProp = isLeftFixed ? 'nextElementSibling' : 'previousElementSibling'
|
|
3741
|
+
let tempCellElem = cell[siblingProp] as HTMLTableCellElement
|
|
3742
|
+
while (tempCellElem) {
|
|
3743
|
+
if (hasClass(tempCellElem, 'fixed--hidden')) {
|
|
3744
|
+
break
|
|
3745
|
+
} else if (!hasClass(tempCellElem, 'col--group')) {
|
|
3746
|
+
fixedOffsetWidth += tempCellElem.offsetWidth
|
|
3747
|
+
}
|
|
3748
|
+
tempCellElem = tempCellElem[siblingProp] as HTMLTableCellElement
|
|
3749
|
+
}
|
|
3750
|
+
if (isRightFixed && rightContainerElem) {
|
|
3751
|
+
dragPosLeft = rightContainerElem.offsetLeft + fixedOffsetWidth
|
|
3752
|
+
}
|
|
3753
|
+
}
|
|
3754
|
+
|
|
3755
|
+
// 处理拖动事件
|
|
3756
|
+
const updateEvent = (evnt: MouseEvent) => {
|
|
3757
|
+
evnt.stopPropagation()
|
|
3758
|
+
evnt.preventDefault()
|
|
3759
|
+
const tableHeight = tableEl.clientHeight
|
|
3760
|
+
const offsetX = evnt.clientX - dragClientX
|
|
3761
|
+
let left = dragPosLeft + offsetX
|
|
3762
|
+
const scrollLeft = fixedType ? 0 : bodyScrollElem.scrollLeft
|
|
3763
|
+
if (isLeftFixed) {
|
|
3764
|
+
// 左固定列(不允许超过右侧固定列、不允许超过右边距)
|
|
3765
|
+
left = Math.min(left, (rightContainerElem ? rightContainerElem.offsetLeft : bodyScrollElem.clientWidth) - fixedOffsetWidth - minInterval)
|
|
3766
|
+
} else if (isRightFixed) {
|
|
3767
|
+
// 右侧固定列(不允许超过左侧固定列、不允许超过左边距)
|
|
3768
|
+
dragMinLeft = (leftContainerElem ? leftContainerElem.clientWidth : 0) + fixedOffsetWidth + minInterval
|
|
3769
|
+
left = Math.min(left, dragPosLeft + cell.clientWidth - minInterval)
|
|
3770
|
+
} else {
|
|
3771
|
+
dragMinLeft = Math.max(bodyScrollElem.scrollLeft, dragMinLeft)
|
|
3772
|
+
// left = Math.min(left, bodyScrollElem.clientWidth + bodyScrollElem.scrollLeft - 40)
|
|
3773
|
+
}
|
|
3774
|
+
dragLeft = Math.max(left, dragMinLeft)
|
|
3775
|
+
const resizeBarLeft = Math.max(1, dragLeft - scrollLeft)
|
|
3776
|
+
resizeBarElem.style.left = `${resizeBarLeft}px`
|
|
3777
|
+
resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`
|
|
3778
|
+
resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - osbHeight : tableHeight}px`
|
|
3779
|
+
if (resizableOpts.showDragTip && resizeTipElem) {
|
|
3780
|
+
resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)])
|
|
3781
|
+
const tableWidth = tableEl.clientWidth
|
|
3782
|
+
const wrapperRect = wrapperElem.getBoundingClientRect()
|
|
3783
|
+
const resizeBarWidth = resizeBarElem.clientWidth
|
|
3784
|
+
const resizeTipWidth = resizeTipElem.clientWidth
|
|
3785
|
+
const resizeTipHeight = resizeTipElem.clientHeight
|
|
3786
|
+
let resizeTipLeft = -resizeTipWidth
|
|
3787
|
+
if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
|
|
3788
|
+
resizeTipLeft = 0
|
|
3789
|
+
} else if (resizeBarLeft > tableWidth) {
|
|
3790
|
+
resizeTipLeft += tableWidth - resizeBarLeft
|
|
3791
|
+
}
|
|
3792
|
+
resizeTipElem.style.left = `${resizeTipLeft}px`
|
|
3793
|
+
resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`
|
|
3794
|
+
}
|
|
3795
|
+
}
|
|
3796
|
+
|
|
3797
|
+
reactData.isDragResize = true
|
|
3798
|
+
addClass(tableEl, 'col-drag--resize')
|
|
3799
|
+
resizeBarElem.style.display = 'block'
|
|
3800
|
+
document.onmousemove = updateEvent
|
|
3801
|
+
document.onmouseup = function (evnt) {
|
|
3802
|
+
document.onmousemove = null
|
|
3803
|
+
document.onmouseup = null
|
|
3804
|
+
resizeBarElem.style.display = 'none'
|
|
3805
|
+
reactData.isDragResize = false
|
|
3806
|
+
internalData._lastResizeTime = Date.now()
|
|
3807
|
+
|
|
3808
|
+
const resizeWidth = resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)
|
|
3809
|
+
const resizeParams = { ...params, resizeWidth, resizeColumn }
|
|
3810
|
+
if (resizableOpts.dragMode === 'fixed') {
|
|
3811
|
+
visibleColumn.forEach(item => {
|
|
3812
|
+
if (item.id !== resizeColumn.id) {
|
|
3813
|
+
if (!item.resizeWidth) {
|
|
3814
|
+
item.resizeWidth = item.renderWidth
|
|
3815
|
+
}
|
|
3816
|
+
}
|
|
3817
|
+
})
|
|
3818
|
+
}
|
|
3819
|
+
|
|
3820
|
+
if ($xeTable.handleColResizeCellAreaEvent) {
|
|
3821
|
+
$xeTable.handleColResizeCellAreaEvent(evnt, resizeParams)
|
|
3822
|
+
} else {
|
|
3823
|
+
resizeColumn.resizeWidth = resizeWidth
|
|
3824
|
+
handleUpdateColResize($xeTable, evnt, resizeParams)
|
|
3825
|
+
}
|
|
3826
|
+
removeClass(tableEl, 'col-drag--resize')
|
|
3827
|
+
}
|
|
3828
|
+
updateEvent(evnt)
|
|
3829
|
+
if ($xeTable.closeMenu) {
|
|
3830
|
+
$xeTable.closeMenu()
|
|
3831
|
+
}
|
|
3832
|
+
},
|
|
3833
|
+
handleColResizeDblclickEvent (evnt: MouseEvent, params: VxeTableDefines.CellRenderHeaderParams) {
|
|
3496
3834
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3497
3835
|
const reactData = $xeTable as unknown as TableReactData
|
|
3498
3836
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -3503,27 +3841,266 @@ const Methods = {
|
|
|
3503
3841
|
if (isDblclickAutoWidth && el) {
|
|
3504
3842
|
const { fullColumnIdData } = internalData
|
|
3505
3843
|
const { column } = params
|
|
3506
|
-
|
|
3844
|
+
let resizeColumn = column
|
|
3845
|
+
if (column.children && column.children.length) {
|
|
3846
|
+
XEUtils.eachTree(column.children, childColumn => {
|
|
3847
|
+
resizeColumn = childColumn
|
|
3848
|
+
})
|
|
3849
|
+
}
|
|
3850
|
+
const colid = resizeColumn.id
|
|
3507
3851
|
const colRest = fullColumnIdData[colid]
|
|
3508
3852
|
const dragBtnElem = evnt.target as HTMLDivElement
|
|
3509
3853
|
const cell = dragBtnElem.parentNode as HTMLTableCellElement
|
|
3510
3854
|
const cellParams = Object.assign(params, { cell })
|
|
3511
3855
|
const colMinWidth = getColReMinWidth(cellParams)
|
|
3512
|
-
|
|
3856
|
+
|
|
3857
|
+
el.setAttribute('data-calc-col', 'Y')
|
|
3858
|
+
let resizeWidth = calcColumnAutoWidth(resizeColumn, el)
|
|
3859
|
+
el.removeAttribute('data-calc-col')
|
|
3513
3860
|
if (colRest) {
|
|
3514
3861
|
resizeWidth = Math.max(resizeWidth, colRest.width)
|
|
3515
3862
|
}
|
|
3516
|
-
|
|
3517
|
-
|
|
3863
|
+
resizeWidth = Math.max(colMinWidth, resizeWidth)
|
|
3864
|
+
const resizeParams = { ...params, resizeWidth, resizeColumn }
|
|
3865
|
+
reactData.isDragResize = false
|
|
3518
3866
|
internalData._lastResizeTime = Date.now()
|
|
3519
|
-
|
|
3520
|
-
$xeTable.
|
|
3521
|
-
$xeTable.
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3867
|
+
|
|
3868
|
+
if ($xeTable.handleColResizeDblclickCellAreaEvent) {
|
|
3869
|
+
$xeTable.handleColResizeDblclickCellAreaEvent(evnt, resizeParams)
|
|
3870
|
+
} else {
|
|
3871
|
+
resizeColumn.resizeWidth = resizeWidth
|
|
3872
|
+
handleUpdateColResize($xeTable, evnt, resizeParams)
|
|
3873
|
+
}
|
|
3874
|
+
}
|
|
3875
|
+
},
|
|
3876
|
+
handleRowResizeMousedownEvent (evnt: MouseEvent, params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
3877
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3878
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
3879
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3880
|
+
|
|
3881
|
+
evnt.stopPropagation()
|
|
3882
|
+
evnt.preventDefault()
|
|
3883
|
+
const { row } = params
|
|
3884
|
+
const { overflowX, scrollbarWidth, overflowY, scrollbarHeight } = reactData
|
|
3885
|
+
const { elemStore, fullAllDataRowIdData } = internalData
|
|
3886
|
+
const osbWidth = overflowY ? scrollbarWidth : 0
|
|
3887
|
+
const osbHeight = overflowX ? scrollbarHeight : 0
|
|
3888
|
+
const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft
|
|
3889
|
+
const resizableOpts = $xeTable.computeResizableOpts
|
|
3890
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
3891
|
+
const cellOpts = $xeTable.computeCellOpts
|
|
3892
|
+
const tableEl = $xeTable.$refs.refElem as HTMLDivElement
|
|
3893
|
+
const resizeBarElem = $xeTable.$refs.refRowResizeBar as HTMLDivElement
|
|
3894
|
+
if (!resizeBarElem) {
|
|
3895
|
+
return
|
|
3896
|
+
}
|
|
3897
|
+
const { clientY: dragClientY } = evnt
|
|
3898
|
+
const resizeTipElem = resizeBarElem.firstElementChild as HTMLDivElement
|
|
3899
|
+
const dragBtnElem = evnt.currentTarget as HTMLDivElement
|
|
3900
|
+
const tdEl = dragBtnElem.parentNode as HTMLTableCellElement
|
|
3901
|
+
const trEl = tdEl.parentNode as HTMLTableCellElement
|
|
3902
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
3903
|
+
if (!bodyScrollElem) {
|
|
3904
|
+
return
|
|
3905
|
+
}
|
|
3906
|
+
const rowid = getRowid($xeTable, row)
|
|
3907
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
3908
|
+
if (!rowRest) {
|
|
3909
|
+
return
|
|
3910
|
+
}
|
|
3911
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
3912
|
+
const currCellHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || defaultRowHeight
|
|
3913
|
+
const tableRect = tableEl.getBoundingClientRect()
|
|
3914
|
+
const trRect = trEl.getBoundingClientRect()
|
|
3915
|
+
const targetOffsetY = dragClientY - trRect.y - trEl.clientHeight
|
|
3916
|
+
let resizeHeight = currCellHeight
|
|
3917
|
+
const cellEl = tdEl.querySelector('.vxe-cell')
|
|
3918
|
+
let cellMinHeight = 0
|
|
3919
|
+
if (cellEl) {
|
|
3920
|
+
const cellStyle = getComputedStyle(cellEl)
|
|
3921
|
+
cellMinHeight = Math.max(1, Math.ceil(XEUtils.toNumber(cellStyle.paddingTop) + XEUtils.toNumber(cellStyle.paddingBottom)))
|
|
3922
|
+
}
|
|
3923
|
+
const minTop = trRect.y - tableRect.y + cellMinHeight
|
|
3924
|
+
// 处理拖动事件
|
|
3925
|
+
const updateEvent = (evnt: MouseEvent) => {
|
|
3926
|
+
evnt.stopPropagation()
|
|
3927
|
+
evnt.preventDefault()
|
|
3928
|
+
const tableWidth = tableEl.clientWidth - osbWidth
|
|
3929
|
+
const tableHeight = tableEl.clientHeight - osbHeight
|
|
3930
|
+
let dragTop = evnt.clientY - tableRect.y - targetOffsetY
|
|
3931
|
+
if (dragTop < minTop) {
|
|
3932
|
+
dragTop = minTop
|
|
3933
|
+
} else {
|
|
3934
|
+
resizeHeight = Math.max(cellMinHeight, currCellHeight + evnt.clientY - dragClientY)
|
|
3935
|
+
}
|
|
3936
|
+
resizeBarElem.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`
|
|
3937
|
+
resizeBarElem.style.top = `${dragTop}px`
|
|
3938
|
+
resizeBarElem.style.width = `${tableWidth}px`
|
|
3939
|
+
if (resizableOpts.showDragTip && resizeTipElem) {
|
|
3940
|
+
resizeTipElem.textContent = getI18n('vxe.table.resizeRowTip', [resizeHeight])
|
|
3941
|
+
const resizeTipWidth = resizeTipElem.clientWidth
|
|
3942
|
+
const resizeTipHeight = resizeTipElem.clientHeight
|
|
3943
|
+
let resizeBarLeft = Math.max(2, evnt.clientX - tableRect.x)
|
|
3944
|
+
let resizeBarTop = 0
|
|
3945
|
+
if (resizeBarLeft + resizeTipWidth >= tableWidth - 2) {
|
|
3946
|
+
resizeBarLeft = tableWidth - resizeTipWidth - 2
|
|
3947
|
+
}
|
|
3948
|
+
if (dragTop + resizeTipHeight >= tableHeight) {
|
|
3949
|
+
resizeBarTop = tableHeight - (dragTop + resizeTipHeight)
|
|
3950
|
+
}
|
|
3951
|
+
resizeTipElem.style.left = `${resizeBarLeft}px`
|
|
3952
|
+
resizeTipElem.style.top = `${resizeBarTop}px`
|
|
3953
|
+
}
|
|
3954
|
+
}
|
|
3955
|
+
|
|
3956
|
+
reactData.isDragResize = true
|
|
3957
|
+
addClass(tableEl, 'row-drag--resize')
|
|
3958
|
+
resizeBarElem.style.display = 'block'
|
|
3959
|
+
document.onmousemove = updateEvent
|
|
3960
|
+
document.onmouseup = function (evnt) {
|
|
3961
|
+
document.onmousemove = null
|
|
3962
|
+
document.onmouseup = null
|
|
3963
|
+
resizeBarElem.style.display = 'none'
|
|
3964
|
+
reactData.isDragResize = false
|
|
3965
|
+
internalData._lastResizeTime = Date.now()
|
|
3966
|
+
if (resizeHeight !== currCellHeight) {
|
|
3967
|
+
const resizeParams = { ...params, resizeHeight, resizeRow: row }
|
|
3968
|
+
internalData.isResizeCellHeight = true
|
|
3969
|
+
if ($xeTable.handleRowResizeCellAreaEvent) {
|
|
3970
|
+
$xeTable.handleRowResizeCellAreaEvent(evnt, resizeParams)
|
|
3971
|
+
} else {
|
|
3972
|
+
rowRest.resizeHeight = resizeHeight
|
|
3973
|
+
handleUpdateRowResize($xeTable, evnt, resizeParams)
|
|
3974
|
+
}
|
|
3975
|
+
}
|
|
3976
|
+
removeClass(tableEl, 'row-drag--resize')
|
|
3977
|
+
}
|
|
3978
|
+
updateEvent(evnt)
|
|
3979
|
+
},
|
|
3980
|
+
handleRowResizeDblclickEvent (evnt: MouseEvent, params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
3981
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3982
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
3983
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3984
|
+
|
|
3985
|
+
const resizableOpts = $xeTable.computeResizableOpts
|
|
3986
|
+
const { isDblclickAutoHeight } = resizableOpts
|
|
3987
|
+
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
3988
|
+
if (isDblclickAutoHeight && el) {
|
|
3989
|
+
const { fullAllDataRowIdData } = internalData
|
|
3990
|
+
const { row } = params
|
|
3991
|
+
const rowid = getRowid($xeTable, row)
|
|
3992
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
3993
|
+
if (!rowRest) {
|
|
3994
|
+
return
|
|
3995
|
+
}
|
|
3996
|
+
const resizeHeight = calcCellAutoHeight(rowRest, el)
|
|
3997
|
+
const resizeParams = { ...params, resizeHeight, resizeRow: row }
|
|
3998
|
+
reactData.isDragResize = false
|
|
3999
|
+
internalData._lastResizeTime = Date.now()
|
|
4000
|
+
if ($xeTable.handleRowResizeDblclickCellAreaEvent) {
|
|
4001
|
+
$xeTable.handleRowResizeDblclickCellAreaEvent(evnt, resizeParams)
|
|
4002
|
+
} else {
|
|
4003
|
+
rowRest.resizeHeight = resizeHeight
|
|
4004
|
+
handleUpdateRowResize($xeTable, evnt, resizeParams)
|
|
4005
|
+
}
|
|
4006
|
+
}
|
|
4007
|
+
},
|
|
4008
|
+
setRowHeightConf (heightConf: Record<string, number>) {
|
|
4009
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
4010
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
4011
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
4012
|
+
|
|
4013
|
+
const { fullAllDataRowIdData } = internalData
|
|
4014
|
+
let status = false
|
|
4015
|
+
if (heightConf) {
|
|
4016
|
+
XEUtils.each(heightConf, (height, rowid) => {
|
|
4017
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
4018
|
+
if (rowRest) {
|
|
4019
|
+
const rHeight = XEUtils.toInteger(height)
|
|
4020
|
+
if (rHeight) {
|
|
4021
|
+
rowRest.resizeHeight = rHeight
|
|
4022
|
+
if (!status) {
|
|
4023
|
+
status = true
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
4026
|
+
}
|
|
3525
4027
|
})
|
|
4028
|
+
if (status) {
|
|
4029
|
+
internalData.isResizeCellHeight = true
|
|
4030
|
+
reactData.resizeHeightFlag++
|
|
4031
|
+
}
|
|
3526
4032
|
}
|
|
4033
|
+
return $xeTable.$nextTick().then(() => {
|
|
4034
|
+
return { status }
|
|
4035
|
+
})
|
|
4036
|
+
},
|
|
4037
|
+
getRowHeightConf (isFull?: boolean) {
|
|
4038
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
4039
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
4040
|
+
|
|
4041
|
+
const { fullAllDataRowIdData, afterFullData } = internalData
|
|
4042
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
4043
|
+
const cellOpts = $xeTable.computeCellOpts
|
|
4044
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
4045
|
+
const rest: Record<string, number> = {}
|
|
4046
|
+
afterFullData.forEach(row => {
|
|
4047
|
+
const rowid = getRowid($xeTable, row)
|
|
4048
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
4049
|
+
if (rowRest) {
|
|
4050
|
+
const resizeHeight = rowRest.resizeHeight
|
|
4051
|
+
if (resizeHeight || isFull) {
|
|
4052
|
+
const currCellHeight = resizeHeight || cellOpts.height || rowOpts.height || defaultRowHeight
|
|
4053
|
+
rest[rowid] = currCellHeight
|
|
4054
|
+
}
|
|
4055
|
+
}
|
|
4056
|
+
})
|
|
4057
|
+
return rest
|
|
4058
|
+
},
|
|
4059
|
+
setRowHeight (rowOrId: any | any[], height: number) {
|
|
4060
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
4061
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
4062
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
4063
|
+
|
|
4064
|
+
const { fullAllDataRowIdData } = internalData
|
|
4065
|
+
let status = false
|
|
4066
|
+
const rows = XEUtils.isArray(rowOrId) ? rowOrId : [rowOrId]
|
|
4067
|
+
let rHeight = XEUtils.toInteger(height)
|
|
4068
|
+
if (isScale(height)) {
|
|
4069
|
+
const tableBody = $xeTable.$refs.refTableBody
|
|
4070
|
+
const bodyElem = tableBody ? (tableBody as any).$el as HTMLDivElement : null
|
|
4071
|
+
const bodyHeight = bodyElem ? bodyElem.clientHeight - 1 : 0
|
|
4072
|
+
rHeight = Math.floor(rHeight * bodyHeight)
|
|
4073
|
+
}
|
|
4074
|
+
if (rHeight) {
|
|
4075
|
+
rows.forEach(row => {
|
|
4076
|
+
const rowid = XEUtils.isString(row) || XEUtils.isNumber(row) ? row : getRowid($xeTable, row)
|
|
4077
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
4078
|
+
if (rowRest) {
|
|
4079
|
+
rowRest.resizeHeight = rHeight
|
|
4080
|
+
if (!status) {
|
|
4081
|
+
status = true
|
|
4082
|
+
}
|
|
4083
|
+
}
|
|
4084
|
+
})
|
|
4085
|
+
if (status) {
|
|
4086
|
+
internalData.isResizeCellHeight = true
|
|
4087
|
+
reactData.resizeHeightFlag++
|
|
4088
|
+
}
|
|
4089
|
+
}
|
|
4090
|
+
return $xeTable.$nextTick()
|
|
4091
|
+
},
|
|
4092
|
+
getRowHeight (rowOrId: any) {
|
|
4093
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
4094
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
4095
|
+
|
|
4096
|
+
const { fullAllDataRowIdData } = internalData
|
|
4097
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
4098
|
+
const cellOpts = $xeTable.computeCellOpts
|
|
4099
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
4100
|
+
const rowid = XEUtils.isString(rowOrId) || XEUtils.isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId)
|
|
4101
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
4102
|
+
const currCellHeight = rowRest ? rowRest.resizeHeight : (cellOpts.height || rowOpts.height || defaultRowHeight)
|
|
4103
|
+
return currCellHeight
|
|
3527
4104
|
},
|
|
3528
4105
|
/**
|
|
3529
4106
|
* 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
|
|
@@ -3901,10 +4478,10 @@ const Methods = {
|
|
|
3901
4478
|
}
|
|
3902
4479
|
} else if (isContextMenu) {
|
|
3903
4480
|
// 如果按下上下文键
|
|
3904
|
-
|
|
4481
|
+
internalData._keyCtx = selected.row && selected.column && bodyCtxMenu.length
|
|
3905
4482
|
clearTimeout(internalData.keyCtxTimeout)
|
|
3906
4483
|
internalData.keyCtxTimeout = setTimeout(() => {
|
|
3907
|
-
|
|
4484
|
+
internalData._keyCtx = false
|
|
3908
4485
|
}, 1000)
|
|
3909
4486
|
} else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow))) {
|
|
3910
4487
|
const { isLastEnterAppendRow, beforeEnterMethod, enterMethod } = keyboardOpts
|
|
@@ -4136,17 +4713,6 @@ const Methods = {
|
|
|
4136
4713
|
this.updateCellAreas()
|
|
4137
4714
|
this.recalculate(true)
|
|
4138
4715
|
},
|
|
4139
|
-
handleTargetEnterEvent (isClear: any) {
|
|
4140
|
-
const $tooltip = this.$refs.tooltip
|
|
4141
|
-
clearTimeout(this.tooltipTimeout)
|
|
4142
|
-
if (isClear) {
|
|
4143
|
-
this.closeTooltip()
|
|
4144
|
-
} else {
|
|
4145
|
-
if ($tooltip) {
|
|
4146
|
-
$tooltip.setActived(true)
|
|
4147
|
-
}
|
|
4148
|
-
}
|
|
4149
|
-
},
|
|
4150
4716
|
handleTargetLeaveEvent () {
|
|
4151
4717
|
const tooltipOpts = this.tooltipOpts
|
|
4152
4718
|
let $tooltip = this.$refs.tooltip
|
|
@@ -4165,19 +4731,22 @@ const Methods = {
|
|
|
4165
4731
|
}
|
|
4166
4732
|
},
|
|
4167
4733
|
triggerHeaderTitleEvent (evnt: any, iconParams: any, params: any) {
|
|
4168
|
-
const
|
|
4734
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
4735
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
4736
|
+
|
|
4737
|
+
const tipContent = iconParams.content || (iconParams as any).message
|
|
4169
4738
|
if (tipContent) {
|
|
4170
|
-
const {
|
|
4739
|
+
const { tooltipStore } = reactData
|
|
4171
4740
|
const { column } = params
|
|
4172
4741
|
const content = getFuncText(tipContent)
|
|
4173
|
-
|
|
4742
|
+
handleTargetEnterEvent($xeTable, true)
|
|
4174
4743
|
tooltipStore.row = null
|
|
4175
4744
|
tooltipStore.column = column
|
|
4176
4745
|
tooltipStore.visible = true
|
|
4177
4746
|
tooltipStore.currOpts = iconParams
|
|
4178
|
-
|
|
4179
|
-
const $tooltip = $refs.
|
|
4180
|
-
if ($tooltip) {
|
|
4747
|
+
$xeTable.$nextTick(() => {
|
|
4748
|
+
const $tooltip = $xeTable.$refs.refTooltip as VxeTooltipInstance
|
|
4749
|
+
if ($tooltip && $tooltip.open) {
|
|
4181
4750
|
$tooltip.open(evnt.currentTarget, content)
|
|
4182
4751
|
}
|
|
4183
4752
|
})
|
|
@@ -4187,23 +4756,44 @@ const Methods = {
|
|
|
4187
4756
|
* 触发表头 tooltip 事件
|
|
4188
4757
|
*/
|
|
4189
4758
|
triggerHeaderTooltipEvent (evnt: any, params: any) {
|
|
4190
|
-
const
|
|
4759
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
4760
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
4761
|
+
|
|
4762
|
+
const { tooltipStore } = reactData
|
|
4191
4763
|
const { column } = params
|
|
4192
|
-
|
|
4193
|
-
|
|
4764
|
+
handleTargetEnterEvent($xeTable, true)
|
|
4765
|
+
const titleElem = evnt.currentTarget as HTMLDivElement
|
|
4766
|
+
if (!titleElem) {
|
|
4767
|
+
return
|
|
4768
|
+
}
|
|
4769
|
+
const cellEl = titleElem.parentElement as HTMLDivElement
|
|
4770
|
+
if (!cellEl) {
|
|
4771
|
+
return
|
|
4772
|
+
}
|
|
4773
|
+
const thEl = cellEl.parentElement as HTMLTableCellElement
|
|
4774
|
+
if (!thEl) {
|
|
4775
|
+
return
|
|
4776
|
+
}
|
|
4194
4777
|
if (tooltipStore.column !== column || !tooltipStore.visible) {
|
|
4195
|
-
|
|
4778
|
+
handleTooltip($xeTable, evnt, thEl, cellEl, null, params)
|
|
4196
4779
|
}
|
|
4197
4780
|
},
|
|
4198
4781
|
/**
|
|
4199
4782
|
* 触发单元格 tooltip 事件
|
|
4200
4783
|
*/
|
|
4201
4784
|
triggerBodyTooltipEvent (evnt: any, params: any) {
|
|
4202
|
-
const
|
|
4785
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
4786
|
+
const props = $xeTable
|
|
4787
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
4788
|
+
|
|
4789
|
+
const { editConfig } = props
|
|
4790
|
+
const { editStore } = reactData
|
|
4791
|
+
const { tooltipStore } = reactData
|
|
4792
|
+
const editOpts = $xeTable.computeEditOpts
|
|
4203
4793
|
const { actived } = editStore
|
|
4204
4794
|
const { row, column } = params
|
|
4205
|
-
const
|
|
4206
|
-
|
|
4795
|
+
const tdEl = evnt.currentTarget as HTMLTableCellElement
|
|
4796
|
+
handleTargetEnterEvent($xeTable, tooltipStore.column !== column || tooltipStore.row !== row)
|
|
4207
4797
|
// 单元格处于编辑状态时不触发提示框
|
|
4208
4798
|
if (column.editRender && isEnableConf(editConfig)) {
|
|
4209
4799
|
// 如果是行编辑模式
|
|
@@ -4216,67 +4806,24 @@ const Methods = {
|
|
|
4216
4806
|
}
|
|
4217
4807
|
}
|
|
4218
4808
|
if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
|
|
4219
|
-
|
|
4220
|
-
let tipElem
|
|
4221
|
-
if (column.treeNode) {
|
|
4222
|
-
overflowElem = cell.querySelector('.vxe-tree-cell')
|
|
4223
|
-
if (column.type === 'html') {
|
|
4224
|
-
tipElem = cell.querySelector('.vxe-cell--html')
|
|
4225
|
-
}
|
|
4226
|
-
} else {
|
|
4227
|
-
tipElem = cell.querySelector(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label')
|
|
4228
|
-
}
|
|
4229
|
-
this.handleTooltip(evnt, cell, overflowElem || cell.children[0], tipElem, params)
|
|
4809
|
+
handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--wrapper') as HTMLElement, null, params)
|
|
4230
4810
|
}
|
|
4231
4811
|
},
|
|
4232
4812
|
/**
|
|
4233
4813
|
* 触发表尾 tooltip 事件
|
|
4234
4814
|
*/
|
|
4235
4815
|
triggerFooterTooltipEvent (evnt: any, params: any) {
|
|
4816
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
4817
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
4818
|
+
|
|
4236
4819
|
const { column } = params
|
|
4237
|
-
const { tooltipStore } =
|
|
4238
|
-
const cell = evnt.currentTarget
|
|
4239
|
-
|
|
4820
|
+
const { tooltipStore } = reactData
|
|
4821
|
+
const cell = evnt.currentTarget as HTMLTableCellElement
|
|
4822
|
+
handleTargetEnterEvent($xeTable, tooltipStore.column !== column || !!tooltipStore.row)
|
|
4240
4823
|
if (tooltipStore.column !== column || !tooltipStore.visible) {
|
|
4241
|
-
|
|
4824
|
+
handleTooltip($xeTable, evnt, cell, cell.querySelector('.vxe-cell--wrapper') as HTMLElement || cell.children[0], null, params)
|
|
4242
4825
|
}
|
|
4243
4826
|
},
|
|
4244
|
-
/**
|
|
4245
|
-
* 处理显示 tooltip
|
|
4246
|
-
* @param {Event} evnt 事件
|
|
4247
|
-
* @param {ColumnInfo} column 列配置
|
|
4248
|
-
* @param {Row} row 行对象
|
|
4249
|
-
*/
|
|
4250
|
-
handleTooltip (evnt: any, cell: any, overflowElem: any, tipElem: any, params: any) {
|
|
4251
|
-
const $xeTable = this
|
|
4252
|
-
|
|
4253
|
-
if (!overflowElem) {
|
|
4254
|
-
return $xeTable.$nextTick()
|
|
4255
|
-
}
|
|
4256
|
-
params.cell = cell
|
|
4257
|
-
const { $refs, tooltipOpts, tooltipStore } = this
|
|
4258
|
-
const { column, row } = params
|
|
4259
|
-
const { showAll, enabled, contentMethod } = tooltipOpts
|
|
4260
|
-
const customContent = contentMethod ? contentMethod(params) : null
|
|
4261
|
-
const useCustom = contentMethod && !XEUtils.eqNull(customContent)
|
|
4262
|
-
const content = useCustom ? customContent : (column.type === 'html' ? overflowElem.innerText : overflowElem.textContent).trim()
|
|
4263
|
-
const isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth
|
|
4264
|
-
if (content && (showAll || enabled || useCustom || isCellOverflow)) {
|
|
4265
|
-
Object.assign(tooltipStore, {
|
|
4266
|
-
row,
|
|
4267
|
-
column,
|
|
4268
|
-
visible: true,
|
|
4269
|
-
currOpts: {}
|
|
4270
|
-
})
|
|
4271
|
-
this.$nextTick(() => {
|
|
4272
|
-
const $tooltip = $refs.tooltip
|
|
4273
|
-
if ($tooltip) {
|
|
4274
|
-
$tooltip.open(isCellOverflow ? overflowElem : (tipElem || overflowElem), formatText(content))
|
|
4275
|
-
}
|
|
4276
|
-
})
|
|
4277
|
-
}
|
|
4278
|
-
return this.$nextTick()
|
|
4279
|
-
},
|
|
4280
4827
|
openTooltip (target: any, content: any) {
|
|
4281
4828
|
const { $refs } = this
|
|
4282
4829
|
const commTip = $refs.refCommTooltip
|
|
@@ -4895,7 +5442,7 @@ const Methods = {
|
|
|
4895
5442
|
vLen++
|
|
4896
5443
|
})
|
|
4897
5444
|
|
|
4898
|
-
const isSelected =
|
|
5445
|
+
const isSelected = vLen > 0 ? sLen >= vLen : sLen >= rootList.length
|
|
4899
5446
|
const halfSelect = !isSelected && (sLen >= 1 || hLen >= 1)
|
|
4900
5447
|
|
|
4901
5448
|
reactData.isAllSelected = isSelected
|
|
@@ -5771,10 +6318,10 @@ const Methods = {
|
|
|
5771
6318
|
|
|
5772
6319
|
reactData.isDragRowMove = true
|
|
5773
6320
|
$xeTable.handleTableData(treeConfig && transform)
|
|
5774
|
-
$xeTable.cacheRowMap()
|
|
6321
|
+
$xeTable.cacheRowMap(false)
|
|
5775
6322
|
updateScrollYStatus($xeTable)
|
|
5776
6323
|
if (!(treeConfig && transform)) {
|
|
5777
|
-
$xeTable
|
|
6324
|
+
updateAfterDataIndex($xeTable)
|
|
5778
6325
|
}
|
|
5779
6326
|
$xeTable.checkSelectionStatus()
|
|
5780
6327
|
if (reactData.scrollYLoad) {
|
|
@@ -5816,18 +6363,16 @@ const Methods = {
|
|
|
5816
6363
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
|
|
5817
6364
|
const { prevDragRow, prevDragPos } = internalData
|
|
5818
6365
|
|
|
5819
|
-
if (treeConfig && prevDragToChild) {
|
|
6366
|
+
if (treeConfig && lazy && prevDragToChild) {
|
|
5820
6367
|
// 懒加载
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
if (
|
|
5825
|
-
if (rowRest && rowRest.treeLoaded) {
|
|
5826
|
-
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild)
|
|
5827
|
-
}
|
|
5828
|
-
} else {
|
|
6368
|
+
const newRowid = getRowid($xeTable, prevDragRow)
|
|
6369
|
+
const rowRest = fullAllDataRowIdData[newRowid]
|
|
6370
|
+
if (prevDragRow[hasChildField]) {
|
|
6371
|
+
if (rowRest && rowRest.treeLoaded) {
|
|
5829
6372
|
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild)
|
|
5830
6373
|
}
|
|
6374
|
+
} else {
|
|
6375
|
+
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild)
|
|
5831
6376
|
}
|
|
5832
6377
|
} else {
|
|
5833
6378
|
$xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild)
|
|
@@ -6929,7 +7474,7 @@ const Methods = {
|
|
|
6929
7474
|
return this.$nextTick().then(() => {
|
|
6930
7475
|
if (transform) {
|
|
6931
7476
|
this.handleTableData()
|
|
6932
|
-
|
|
7477
|
+
updateAfterDataIndex($xeTable)
|
|
6933
7478
|
return this.$nextTick()
|
|
6934
7479
|
}
|
|
6935
7480
|
})
|
|
@@ -7043,7 +7588,7 @@ const Methods = {
|
|
|
7043
7588
|
return this.handleBaseTreeExpand(rows, expanded).then(() => {
|
|
7044
7589
|
handleVirtualTreeToList($xeTable)
|
|
7045
7590
|
this.handleTableData()
|
|
7046
|
-
|
|
7591
|
+
updateAfterDataIndex($xeTable)
|
|
7047
7592
|
}).then(() => {
|
|
7048
7593
|
return this.recalculate()
|
|
7049
7594
|
}).then(() => {
|
|
@@ -7129,13 +7674,18 @@ const Methods = {
|
|
|
7129
7674
|
* 获取表格的滚动状态
|
|
7130
7675
|
*/
|
|
7131
7676
|
getScroll () {
|
|
7132
|
-
const
|
|
7133
|
-
const
|
|
7677
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
7678
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
7679
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
7680
|
+
|
|
7681
|
+
const { scrollXLoad, scrollYLoad } = reactData
|
|
7682
|
+
const { elemStore } = internalData
|
|
7683
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
7134
7684
|
return {
|
|
7135
7685
|
virtualX: scrollXLoad,
|
|
7136
7686
|
virtualY: scrollYLoad,
|
|
7137
|
-
scrollTop:
|
|
7138
|
-
scrollLeft:
|
|
7687
|
+
scrollTop: bodyScrollElem ? bodyScrollElem.scrollTop : 0,
|
|
7688
|
+
scrollLeft: bodyScrollElem ? bodyScrollElem.scrollLeft : 0
|
|
7139
7689
|
}
|
|
7140
7690
|
},
|
|
7141
7691
|
handleScrollEvent (evnt: Event, isRollY: boolean, isRollX: boolean, scrollTop: number, scrollLeft: number, params: any) {
|
|
@@ -7240,48 +7790,6 @@ const Methods = {
|
|
|
7240
7790
|
}
|
|
7241
7791
|
$xeTable.dispatchEvent('scroll', evntParams, evnt)
|
|
7242
7792
|
},
|
|
7243
|
-
lazyScrollXData () {
|
|
7244
|
-
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
7245
|
-
const internalData = $xeTable as unknown as TableInternalData
|
|
7246
|
-
|
|
7247
|
-
const { lxTimeout, lxRunTime, scrollXStore } = internalData
|
|
7248
|
-
const { visibleSize } = scrollXStore
|
|
7249
|
-
const fpsTime = Math.max(5, Math.min(80, Math.floor(visibleSize * 3)))
|
|
7250
|
-
if (lxTimeout) {
|
|
7251
|
-
clearTimeout(lxTimeout)
|
|
7252
|
-
}
|
|
7253
|
-
if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
|
|
7254
|
-
internalData.lxRunTime = Date.now()
|
|
7255
|
-
loadScrollXData($xeTable)
|
|
7256
|
-
}
|
|
7257
|
-
internalData.lxTimeout = setTimeout(() => {
|
|
7258
|
-
internalData.lxTimeout = undefined
|
|
7259
|
-
internalData.lxRunTime = undefined
|
|
7260
|
-
loadScrollXData($xeTable)
|
|
7261
|
-
}, fpsTime)
|
|
7262
|
-
},
|
|
7263
|
-
lazyScrollYData () {
|
|
7264
|
-
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
7265
|
-
const props = $xeTable
|
|
7266
|
-
const internalData = $xeTable as unknown as TableInternalData
|
|
7267
|
-
|
|
7268
|
-
const { showOverflow } = props
|
|
7269
|
-
const { lyTimeout, lyRunTime, scrollYStore } = internalData
|
|
7270
|
-
const { visibleSize } = scrollYStore
|
|
7271
|
-
const fpsTime = showOverflow ? 5 : Math.max(5, Math.min(80, Math.floor(visibleSize / 2)))
|
|
7272
|
-
if (lyTimeout) {
|
|
7273
|
-
clearTimeout(lyTimeout)
|
|
7274
|
-
}
|
|
7275
|
-
if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
|
|
7276
|
-
internalData.lyRunTime = Date.now()
|
|
7277
|
-
loadScrollYData($xeTable)
|
|
7278
|
-
}
|
|
7279
|
-
internalData.lyTimeout = setTimeout(() => {
|
|
7280
|
-
internalData.lyTimeout = undefined
|
|
7281
|
-
internalData.lyRunTime = undefined
|
|
7282
|
-
loadScrollYData($xeTable)
|
|
7283
|
-
}, fpsTime)
|
|
7284
|
-
},
|
|
7285
7793
|
/**
|
|
7286
7794
|
* 横向 X 可视渲染事件处理
|
|
7287
7795
|
*/
|
|
@@ -7292,7 +7800,7 @@ const Methods = {
|
|
|
7292
7800
|
if (sXOpts.immediate) {
|
|
7293
7801
|
loadScrollXData($xeTable)
|
|
7294
7802
|
} else {
|
|
7295
|
-
$xeTable
|
|
7803
|
+
lazyScrollXData($xeTable)
|
|
7296
7804
|
}
|
|
7297
7805
|
},
|
|
7298
7806
|
/**
|
|
@@ -7305,14 +7813,14 @@ const Methods = {
|
|
|
7305
7813
|
if (sYOpts.immediate) {
|
|
7306
7814
|
loadScrollYData($xeTable)
|
|
7307
7815
|
} else {
|
|
7308
|
-
$xeTable
|
|
7816
|
+
lazyScrollYData($xeTable)
|
|
7309
7817
|
}
|
|
7310
7818
|
},
|
|
7311
7819
|
triggerBodyScrollEvent (evnt: Event, fixedType: '' | 'left' | 'right') {
|
|
7312
7820
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
7313
7821
|
const internalData = $xeTable as unknown as TableInternalData
|
|
7314
7822
|
|
|
7315
|
-
const { elemStore, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData
|
|
7823
|
+
const { elemStore, intoRunScroll, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData
|
|
7316
7824
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem as HTMLDivElement
|
|
7317
7825
|
const yHandleEl = $xeTable.$refs.refScrollYHandleElem as HTMLDivElement
|
|
7318
7826
|
const leftScrollElem = getRefElem(elemStore['left-body-scroll'])
|
|
@@ -7323,6 +7831,9 @@ const Methods = {
|
|
|
7323
7831
|
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
|
|
7324
7832
|
return
|
|
7325
7833
|
}
|
|
7834
|
+
if (intoRunScroll) {
|
|
7835
|
+
return
|
|
7836
|
+
}
|
|
7326
7837
|
if (!bodyScrollElem) {
|
|
7327
7838
|
return
|
|
7328
7839
|
}
|
|
@@ -7380,22 +7891,16 @@ const Methods = {
|
|
|
7380
7891
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
7381
7892
|
const internalData = $xeTable as unknown as TableInternalData
|
|
7382
7893
|
|
|
7383
|
-
const { elemStore, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData
|
|
7894
|
+
const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData
|
|
7384
7895
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem as HTMLDivElement
|
|
7385
7896
|
const yHandleEl = $xeTable.$refs.refScrollYHandleElem as HTMLDivElement
|
|
7386
7897
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
7387
7898
|
const headerScrollElem = getRefElem(elemStore['main-header-scroll'])
|
|
7388
7899
|
const footerScrollElem = getRefElem(elemStore['main-footer-scroll'])
|
|
7389
|
-
if (inWheelScroll) {
|
|
7390
|
-
return
|
|
7391
|
-
}
|
|
7392
|
-
if (inVirtualScroll) {
|
|
7393
|
-
return
|
|
7394
|
-
}
|
|
7395
|
-
if (inBodyScroll) {
|
|
7900
|
+
if (inWheelScroll || inVirtualScroll || inBodyScroll || inFooterScroll) {
|
|
7396
7901
|
return
|
|
7397
7902
|
}
|
|
7398
|
-
if (
|
|
7903
|
+
if (intoRunScroll) {
|
|
7399
7904
|
return
|
|
7400
7905
|
}
|
|
7401
7906
|
if (!headerScrollElem) {
|
|
@@ -7425,22 +7930,16 @@ const Methods = {
|
|
|
7425
7930
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
7426
7931
|
const internalData = $xeTable as unknown as TableInternalData
|
|
7427
7932
|
|
|
7428
|
-
const { elemStore, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData
|
|
7933
|
+
const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData
|
|
7429
7934
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem as HTMLDivElement
|
|
7430
7935
|
const yHandleEl = $xeTable.$refs.refScrollYHandleElem as HTMLDivElement
|
|
7431
7936
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
7432
7937
|
const headerScrollElem = getRefElem(elemStore['main-header-scroll'])
|
|
7433
7938
|
const footerScrollElem = getRefElem(elemStore['main-footer-scroll'])
|
|
7434
|
-
if (inWheelScroll) {
|
|
7939
|
+
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inBodyScroll) {
|
|
7435
7940
|
return
|
|
7436
7941
|
}
|
|
7437
|
-
if (
|
|
7438
|
-
return
|
|
7439
|
-
}
|
|
7440
|
-
if (inHeaderScroll) {
|
|
7441
|
-
return
|
|
7442
|
-
}
|
|
7443
|
-
if (inBodyScroll) {
|
|
7942
|
+
if (intoRunScroll) {
|
|
7444
7943
|
return
|
|
7445
7944
|
}
|
|
7446
7945
|
if (!footerScrollElem) {
|
|
@@ -7492,29 +7991,14 @@ const Methods = {
|
|
|
7492
7991
|
return
|
|
7493
7992
|
}
|
|
7494
7993
|
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
multiple = 1.18
|
|
7499
|
-
} else if (reactData.lastScrollTime + 30 > Date.now()) {
|
|
7500
|
-
multiple = 1.15
|
|
7501
|
-
} else if (reactData.lastScrollTime + 40 > Date.now()) {
|
|
7502
|
-
multiple = 1.12
|
|
7503
|
-
} else if (reactData.lastScrollTime + 55 > Date.now()) {
|
|
7504
|
-
multiple = 1.09
|
|
7505
|
-
} else if (reactData.lastScrollTime + 75 > Date.now()) {
|
|
7506
|
-
multiple = 1.06
|
|
7507
|
-
} else if (reactData.lastScrollTime + 100 > Date.now()) {
|
|
7508
|
-
multiple = 1.03
|
|
7509
|
-
}
|
|
7510
|
-
|
|
7511
|
-
const deltaTop = deltaY * multiple
|
|
7512
|
-
const deltaLeft = deltaX * multiple
|
|
7994
|
+
const wheelSpeed = getWheelSpeed(reactData.lastScrollTime)
|
|
7995
|
+
const deltaTop = deltaY * wheelSpeed
|
|
7996
|
+
const deltaLeft = deltaX * wheelSpeed
|
|
7513
7997
|
|
|
7514
7998
|
const isTopWheel = deltaTop < 0
|
|
7515
|
-
const currScrollTop =
|
|
7999
|
+
const currScrollTop = bodyScrollElem.scrollTop
|
|
7516
8000
|
// 如果滚动位置已经是顶部或底部,则不需要触发
|
|
7517
|
-
if (isTopWheel ? currScrollTop <= 0 : currScrollTop >=
|
|
8001
|
+
if (isTopWheel ? currScrollTop <= 0 : currScrollTop >= bodyScrollElem.scrollHeight - bodyScrollElem.clientHeight) {
|
|
7518
8002
|
return
|
|
7519
8003
|
}
|
|
7520
8004
|
|
|
@@ -7530,19 +8014,34 @@ const Methods = {
|
|
|
7530
8014
|
$xeTable.clearHoverRow()
|
|
7531
8015
|
}
|
|
7532
8016
|
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
8017
|
+
wheelScrollTo(scrollTop - bodyScrollElem.scrollTop, (offsetTop: number) => {
|
|
8018
|
+
const currTopNum = bodyScrollElem.scrollTop + offsetTop
|
|
8019
|
+
internalData.inWheelScroll = true
|
|
8020
|
+
setScrollTop(yHandleEl, currTopNum)
|
|
8021
|
+
setScrollTop(bodyScrollElem, currTopNum)
|
|
8022
|
+
setScrollTop(leftScrollElem, currTopNum)
|
|
8023
|
+
setScrollTop(rightScrollElem, currTopNum)
|
|
8024
|
+
$xeTable.triggerScrollYEvent(evnt)
|
|
8025
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, scrollLeft, {
|
|
8026
|
+
type: 'table',
|
|
8027
|
+
fixed: ''
|
|
8028
|
+
})
|
|
7542
8029
|
})
|
|
8030
|
+
|
|
8031
|
+
// internalData.inWheelScroll = true
|
|
8032
|
+
// setScrollTop(yHandleEl, scrollTop)
|
|
8033
|
+
// setScrollTop(bodyScrollElem, scrollTop)
|
|
8034
|
+
// setScrollTop(leftScrollElem, scrollTop)
|
|
8035
|
+
// setScrollTop(rightScrollElem, scrollTop)
|
|
8036
|
+
|
|
8037
|
+
// loadScrollYData($xeTable, scrollTop)
|
|
8038
|
+
// $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8039
|
+
// type: 'footer',
|
|
8040
|
+
// fixed: ''
|
|
8041
|
+
// })
|
|
7543
8042
|
}
|
|
7544
8043
|
},
|
|
7545
|
-
|
|
8044
|
+
triggerVirtualScrollXEvent (evnt: Event) {
|
|
7546
8045
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
7547
8046
|
const internalData = $xeTable as unknown as TableInternalData
|
|
7548
8047
|
|
|
@@ -7577,7 +8076,7 @@ const Methods = {
|
|
|
7577
8076
|
fixed: ''
|
|
7578
8077
|
})
|
|
7579
8078
|
},
|
|
7580
|
-
|
|
8079
|
+
triggerVirtualScrollYEvent (evnt: Event) {
|
|
7581
8080
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
7582
8081
|
const internalData = $xeTable as unknown as TableInternalData
|
|
7583
8082
|
|
|
@@ -7618,9 +8117,7 @@ const Methods = {
|
|
|
7618
8117
|
|
|
7619
8118
|
const { showOverflow } = props
|
|
7620
8119
|
handleTableColumn($xeTable)
|
|
7621
|
-
// calcCellHeight()
|
|
7622
8120
|
return $xeTable.$nextTick().then(() => {
|
|
7623
|
-
// calcCellHeight()
|
|
7624
8121
|
handleTableColumn($xeTable)
|
|
7625
8122
|
$xeTable.updateScrollXSpace()
|
|
7626
8123
|
if (!showOverflow) {
|
|
@@ -7681,9 +8178,7 @@ const Methods = {
|
|
|
7681
8178
|
const $xeTable = this
|
|
7682
8179
|
|
|
7683
8180
|
$xeTable.handleTableData()
|
|
7684
|
-
// calcCellHeight()
|
|
7685
8181
|
return $xeTable.$nextTick().then(() => {
|
|
7686
|
-
// calcCellHeight()
|
|
7687
8182
|
$xeTable.handleTableData()
|
|
7688
8183
|
$xeTable.updateScrollYSpace()
|
|
7689
8184
|
})
|
|
@@ -7696,33 +8191,34 @@ const Methods = {
|
|
|
7696
8191
|
const internalData = $xeTable as unknown as TableInternalData
|
|
7697
8192
|
|
|
7698
8193
|
const { showOverflow } = props
|
|
7699
|
-
const { scrollYLoad
|
|
7700
|
-
const { scrollYStore, elemStore, afterFullData, fullAllDataRowIdData } = internalData
|
|
8194
|
+
const { scrollYLoad } = reactData
|
|
8195
|
+
const { scrollYStore, elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData
|
|
7701
8196
|
const { startIndex } = scrollYStore
|
|
8197
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
8198
|
+
const cellOpts = $xeTable.computeCellOpts
|
|
8199
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
7702
8200
|
const bodyTableElem = getRefElem(elemStore['main-body-table'])
|
|
7703
8201
|
const containerList = ['main', 'left', 'right']
|
|
7704
8202
|
let topSpaceHeight = 0
|
|
7705
8203
|
let ySpaceHeight = 0
|
|
8204
|
+
|
|
7706
8205
|
if (scrollYLoad) {
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
8206
|
+
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height
|
|
8207
|
+
if (!isCustomCellHeight && showOverflow) {
|
|
8208
|
+
ySpaceHeight = afterFullData.length * defaultRowHeight
|
|
8209
|
+
topSpaceHeight = Math.max(0, startIndex * defaultRowHeight)
|
|
7710
8210
|
} else {
|
|
7711
8211
|
for (let i = 0; i < afterFullData.length; i++) {
|
|
7712
8212
|
const row = afterFullData[i]
|
|
7713
8213
|
const rowid = getRowid($xeTable, row)
|
|
7714
8214
|
const rowRest = fullAllDataRowIdData[rowid]
|
|
7715
|
-
|
|
7716
|
-
ySpaceHeight += rowRest.height || rowHeight
|
|
7717
|
-
}
|
|
8215
|
+
ySpaceHeight += rowRest ? (rowRest.resizeHeight || cellOpts.height || rowOpts.height || defaultRowHeight) : defaultRowHeight
|
|
7718
8216
|
}
|
|
7719
8217
|
for (let i = 0; i < startIndex; i++) {
|
|
7720
8218
|
const row = afterFullData[i]
|
|
7721
8219
|
const rowid = getRowid($xeTable, row)
|
|
7722
8220
|
const rowRest = fullAllDataRowIdData[rowid]
|
|
7723
|
-
|
|
7724
|
-
topSpaceHeight += rowRest.height || rowHeight
|
|
7725
|
-
}
|
|
8221
|
+
topSpaceHeight += rowRest ? (rowRest.resizeHeight || cellOpts.height || rowOpts.height || defaultRowHeight) : defaultRowHeight
|
|
7726
8222
|
}
|
|
7727
8223
|
}
|
|
7728
8224
|
} else {
|
|
@@ -7747,7 +8243,7 @@ const Methods = {
|
|
|
7747
8243
|
if (scrollYSpaceEl) {
|
|
7748
8244
|
scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : ''
|
|
7749
8245
|
}
|
|
7750
|
-
$xeTable.$nextTick(() => {
|
|
8246
|
+
return $xeTable.$nextTick().then(() => {
|
|
7751
8247
|
updateStyle($xeTable)
|
|
7752
8248
|
})
|
|
7753
8249
|
},
|