tomtaw-vxe-table 3.25.11 → 3.25.13
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/style.css +1 -1
- package/es/table/src/methods.js +400 -1
- package/es/table/src/table.js +17 -2
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +27 -6
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/methods.js +15 -3
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +10 -1
- package/lib/table/src/table.min.js +1 -1
- package/lib/ui/index.js +1 -1
- 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/package.json +2 -2
- package/packages/table/src/methods.ts +429 -1
- package/packages/table/src/table.ts +22 -8
- package/types/all.d.ts +9 -0
- /package/es/{iconfont.1792397764735.ttf → iconfont.1792648484860.ttf} +0 -0
- /package/es/{iconfont.1792397764735.woff → iconfont.1792648484860.woff} +0 -0
- /package/es/{iconfont.1792397764735.woff2 → iconfont.1792648484860.woff2} +0 -0
- /package/lib/{iconfont.1792397764735.ttf → iconfont.1792648484860.ttf} +0 -0
- /package/lib/{iconfont.1792397764735.woff → iconfont.1792648484860.woff} +0 -0
- /package/lib/{iconfont.1792397764735.woff2 → iconfont.1792648484860.woff2} +0 -0
|
@@ -1348,6 +1348,429 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
|
1348
1348
|
return $xeTable.$nextTick()
|
|
1349
1349
|
}
|
|
1350
1350
|
|
|
1351
|
+
/**
|
|
1352
|
+
* 显式开启才使用以下独立实现,默认路径保持原来的直接样式赋值。
|
|
1353
|
+
* 与 updateStyle / updateScrollXSpace 同步维护;仅将赋值替换为内联值去重,
|
|
1354
|
+
* 不改变几何读取、两轮校正、nextTick 以及展开层的更新顺序。
|
|
1355
|
+
*/
|
|
1356
|
+
type LayoutStyleProperty = 'width' | 'height' | 'minHeight' | 'maxHeight' | 'top' | 'left' | 'display' | 'visibility' | 'paddingRight' | 'marginLeft' | 'transform'
|
|
1357
|
+
|
|
1358
|
+
/** 仅供显式开启的独立路径使用;不缓存尺寸或延迟写入。 */
|
|
1359
|
+
function setLayoutStyle (element: HTMLElement, name: LayoutStyleProperty, value: string) {
|
|
1360
|
+
const style = element.style
|
|
1361
|
+
if (style[name] === value) {
|
|
1362
|
+
// 原 setter 会清除 !important;值相同但优先级不同时仍必须写入。
|
|
1363
|
+
const cssName = name.replace(/[A-Z]/g, word => `-${word.toLowerCase()}`)
|
|
1364
|
+
if (!style.getPropertyPriority(cssName)) return
|
|
1365
|
+
}
|
|
1366
|
+
style[name] = value
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
function updateStyleWithDedupe ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
1370
|
+
const props = $xeTable
|
|
1371
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
1372
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
1373
|
+
const $xeGantt = $xeTable.$xeGantt
|
|
1374
|
+
|
|
1375
|
+
const { mouseConfig } = props
|
|
1376
|
+
const { isGroup, tableColumn, overflowX, scrollbarWidth, overflowY, scrollbarHeight, scrollXWidth, columnStore, editStore, isColLoading } = reactData
|
|
1377
|
+
const { visibleColumn, tableHeight, elemStore, currentRow, customHeight, customMinHeight, customMaxHeight, tHeaderHeight, tFooterHeight } = internalData
|
|
1378
|
+
const $xeGanttView = internalData.xeGanttView
|
|
1379
|
+
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
1380
|
+
if (!el || (internalData.tBodyHeight && !el.clientHeight)) {
|
|
1381
|
+
return
|
|
1382
|
+
}
|
|
1383
|
+
const browseObj = XEUtils.browse()
|
|
1384
|
+
const containerList = ['main', 'left', 'right']
|
|
1385
|
+
const { leftList, rightList } = columnStore
|
|
1386
|
+
let osbWidth = overflowY ? scrollbarWidth : 0
|
|
1387
|
+
let osbHeight = overflowX ? scrollbarHeight : 0
|
|
1388
|
+
const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder as HTMLDivElement
|
|
1389
|
+
const isHeaderRenderOptimize = $xeTable.computeIsHeaderRenderOptimize
|
|
1390
|
+
const isBodyRenderOptimize = $xeTable.computeIsBodyRenderOptimize
|
|
1391
|
+
const isFooterRenderOptimize = $xeTable.computeIsFooterRenderOptimize
|
|
1392
|
+
const mouseOpts = $xeTable.computeMouseOpts
|
|
1393
|
+
const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper'])
|
|
1394
|
+
const bodyTableElem = getRefElem(elemStore['main-body-table'])
|
|
1395
|
+
if (emptyPlaceholderElem) {
|
|
1396
|
+
setLayoutStyle(emptyPlaceholderElem, 'top', `${tHeaderHeight}px`)
|
|
1397
|
+
setLayoutStyle(emptyPlaceholderElem, 'height', bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : '')
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
const scrollXVisible = $xeTable.computeScrollXVisible
|
|
1401
|
+
const scrollYVisible = $xeTable.computeScrollYVisible
|
|
1402
|
+
const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft
|
|
1403
|
+
|
|
1404
|
+
let xScrollbarVisible = overflowX ? 'visible' : 'hidden'
|
|
1405
|
+
const hideXScroll = scrollXVisible === false || scrollXVisible === 'hidden'
|
|
1406
|
+
if (scrollXVisible === 'visible' || $xeGanttView) {
|
|
1407
|
+
osbHeight = scrollbarHeight
|
|
1408
|
+
xScrollbarVisible = 'visible'
|
|
1409
|
+
} else if (hideXScroll) {
|
|
1410
|
+
osbHeight = 0
|
|
1411
|
+
xScrollbarVisible = 'hidden'
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
let yScrollbarVisible = overflowY ? 'visible' : 'hidden'
|
|
1415
|
+
const hideYScroll = scrollYVisible === false || scrollYVisible === 'hidden'
|
|
1416
|
+
if (hideYScroll || (($xeGantt && $xeGanttView && $xeGantt.reactData.showRightView) && !scrollbarYToLeft)) {
|
|
1417
|
+
osbWidth = 0
|
|
1418
|
+
yScrollbarVisible = 'hidden'
|
|
1419
|
+
} else if (scrollYVisible === 'visible') {
|
|
1420
|
+
osbWidth = scrollbarWidth
|
|
1421
|
+
yScrollbarVisible = 'visible'
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
let tbHeight = 0
|
|
1425
|
+
let bodyMaxHeight = 0
|
|
1426
|
+
const bodyMinHeight = customMinHeight - tHeaderHeight - tFooterHeight - osbHeight
|
|
1427
|
+
if (customMaxHeight) {
|
|
1428
|
+
bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - tHeaderHeight - tFooterHeight - osbHeight)
|
|
1429
|
+
}
|
|
1430
|
+
if (customHeight) {
|
|
1431
|
+
tbHeight = customHeight - tHeaderHeight - tFooterHeight - osbHeight
|
|
1432
|
+
}
|
|
1433
|
+
if (!tbHeight) {
|
|
1434
|
+
if (bodyTableElem) {
|
|
1435
|
+
tbHeight = bodyTableElem.clientHeight
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
if (tbHeight) {
|
|
1439
|
+
if (bodyMaxHeight) {
|
|
1440
|
+
tbHeight = Math.min(bodyMaxHeight, tbHeight)
|
|
1441
|
+
}
|
|
1442
|
+
tbHeight = Math.max(bodyMinHeight, tbHeight)
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
const xLeftCornerEl = $xeTable.$refs.refScrollXLeftCornerElem as HTMLDivElement
|
|
1446
|
+
const xRightCornerEl = $xeTable.$refs.refScrollXRightCornerElem as HTMLDivElement
|
|
1447
|
+
const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem as HTMLDivElement
|
|
1448
|
+
if (scrollXVirtualEl) {
|
|
1449
|
+
setLayoutStyle(scrollXVirtualEl, 'height', `${osbHeight}px`)
|
|
1450
|
+
setLayoutStyle(scrollXVirtualEl, 'visibility', xScrollbarVisible)
|
|
1451
|
+
}
|
|
1452
|
+
const xWrapperEl = $xeTable.$refs.refScrollXWrapperElem as HTMLDivElement
|
|
1453
|
+
if (xWrapperEl) {
|
|
1454
|
+
setLayoutStyle(xWrapperEl, 'width', `${el.clientWidth - osbWidth}px`)
|
|
1455
|
+
if (scrollbarYToLeft) {
|
|
1456
|
+
setLayoutStyle(xWrapperEl, 'left', `${osbWidth}px`)
|
|
1457
|
+
} else {
|
|
1458
|
+
setLayoutStyle(xWrapperEl, 'left', '')
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
if (xLeftCornerEl) {
|
|
1462
|
+
if (scrollbarYToLeft) {
|
|
1463
|
+
setLayoutStyle(xLeftCornerEl, 'width', `${osbWidth}px`)
|
|
1464
|
+
setLayoutStyle(xLeftCornerEl, 'display', overflowY && osbWidth ? 'block' : '')
|
|
1465
|
+
} else {
|
|
1466
|
+
setLayoutStyle(xLeftCornerEl, 'display', '')
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
if (xRightCornerEl) {
|
|
1470
|
+
if (scrollbarYToLeft) {
|
|
1471
|
+
setLayoutStyle(xRightCornerEl, 'display', '')
|
|
1472
|
+
} else {
|
|
1473
|
+
setLayoutStyle(xRightCornerEl, 'width', `${osbWidth}px`)
|
|
1474
|
+
setLayoutStyle(xRightCornerEl, 'display', xScrollbarVisible === 'visible' ? 'block' : '')
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem as HTMLDivElement
|
|
1479
|
+
if (scrollYVirtualEl) {
|
|
1480
|
+
setLayoutStyle(scrollYVirtualEl, 'width', `${osbWidth}px`)
|
|
1481
|
+
setLayoutStyle(scrollYVirtualEl, 'height', `${tbHeight + tHeaderHeight + tFooterHeight}px`)
|
|
1482
|
+
setLayoutStyle(scrollYVirtualEl, 'visibility', yScrollbarVisible)
|
|
1483
|
+
}
|
|
1484
|
+
const yTopCornerEl = $xeTable.$refs.refScrollYTopCornerElem as HTMLDivElement
|
|
1485
|
+
if (yTopCornerEl) {
|
|
1486
|
+
setLayoutStyle(yTopCornerEl, 'height', `${tHeaderHeight}px`)
|
|
1487
|
+
setLayoutStyle(yTopCornerEl, 'display', tHeaderHeight && yScrollbarVisible === 'visible' ? 'block' : '')
|
|
1488
|
+
}
|
|
1489
|
+
const yWrapperEl = $xeTable.$refs.refScrollYWrapperElem as HTMLDivElement
|
|
1490
|
+
if (yWrapperEl) {
|
|
1491
|
+
setLayoutStyle(yWrapperEl, 'height', `${tbHeight}px`)
|
|
1492
|
+
setLayoutStyle(yWrapperEl, 'top', `${tHeaderHeight}px`)
|
|
1493
|
+
}
|
|
1494
|
+
const yBottomCornerEl = $xeTable.$refs.refScrollYBottomCornerElem as HTMLDivElement
|
|
1495
|
+
if (yBottomCornerEl) {
|
|
1496
|
+
setLayoutStyle(yBottomCornerEl, 'height', `${tFooterHeight}px`)
|
|
1497
|
+
setLayoutStyle(yBottomCornerEl, 'top', `${tHeaderHeight + tbHeight}px`)
|
|
1498
|
+
setLayoutStyle(yBottomCornerEl, 'display', tFooterHeight && yScrollbarVisible === 'visible' ? 'block' : '')
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
const rowExpandEl = $xeTable.$refs.refRowExpandElem as HTMLDivElement
|
|
1502
|
+
if (rowExpandEl) {
|
|
1503
|
+
setLayoutStyle(rowExpandEl, 'height', `${tbHeight}px`)
|
|
1504
|
+
setLayoutStyle(rowExpandEl, 'top', `${tHeaderHeight}px`)
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
internalData.tBodyHeight = tbHeight
|
|
1508
|
+
|
|
1509
|
+
containerList.forEach((name, index) => {
|
|
1510
|
+
const fixedType = index > 0 ? name : ''
|
|
1511
|
+
const layoutList = ['header', 'body', 'footer']
|
|
1512
|
+
const isFixedLeft = fixedType === 'left'
|
|
1513
|
+
let fixedColumn: VxeTableDefines.ColumnInfo[] = []
|
|
1514
|
+
let fixedWrapperElem: HTMLDivElement
|
|
1515
|
+
if (fixedType) {
|
|
1516
|
+
fixedColumn = isFixedLeft ? leftList : rightList
|
|
1517
|
+
fixedWrapperElem = (isFixedLeft ? $xeTable.$refs.refLeftContainer : $xeTable.$refs.refRightContainer) as HTMLDivElement
|
|
1518
|
+
}
|
|
1519
|
+
layoutList.forEach(layout => {
|
|
1520
|
+
const wrapperElem = getRefElem(elemStore[`${name}-${layout}-wrapper`])
|
|
1521
|
+
const currScrollElem = getRefElem(elemStore[`${name}-${layout}-scroll`])
|
|
1522
|
+
const tableElem = getRefElem(elemStore[`${name}-${layout}-table`])
|
|
1523
|
+
if (layout === 'header') {
|
|
1524
|
+
// 表头体样式处理
|
|
1525
|
+
// 横向滚动渲染
|
|
1526
|
+
let renderColumnList = tableColumn
|
|
1527
|
+
const isOptimizeMode = isHeaderRenderOptimize
|
|
1528
|
+
|
|
1529
|
+
if (isGroup) {
|
|
1530
|
+
renderColumnList = visibleColumn
|
|
1531
|
+
} else {
|
|
1532
|
+
if (!isOptimizeMode || (!isColLoading && (fixedType || !overflowX))) {
|
|
1533
|
+
renderColumnList = visibleColumn
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
if (fixedType) {
|
|
1537
|
+
// 如果是使用优化模式
|
|
1538
|
+
if (isOptimizeMode) {
|
|
1539
|
+
renderColumnList = fixedColumn || []
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0)
|
|
1545
|
+
|
|
1546
|
+
if (fixedType) {
|
|
1547
|
+
if (isGroup) {
|
|
1548
|
+
if (wrapperElem) {
|
|
1549
|
+
setLayoutStyle(wrapperElem, 'width', scrollXWidth ? `${scrollXWidth}px` : '')
|
|
1550
|
+
}
|
|
1551
|
+
} else {
|
|
1552
|
+
if (isOptimizeMode) {
|
|
1553
|
+
if (wrapperElem) {
|
|
1554
|
+
setLayoutStyle(wrapperElem, 'width', tWidth ? `${tWidth}px` : '')
|
|
1555
|
+
}
|
|
1556
|
+
} else {
|
|
1557
|
+
if (wrapperElem) {
|
|
1558
|
+
setLayoutStyle(wrapperElem, 'width', scrollXWidth ? `${scrollXWidth}px` : '')
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
if (currScrollElem) {
|
|
1565
|
+
setLayoutStyle(currScrollElem, 'height', `${tHeaderHeight}px`)
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
if (tableElem) {
|
|
1569
|
+
setLayoutStyle(tableElem, 'width', tWidth ? `${tWidth}px` : '')
|
|
1570
|
+
}
|
|
1571
|
+
} else if (layout === 'body') {
|
|
1572
|
+
if (currScrollElem) {
|
|
1573
|
+
setLayoutStyle(currScrollElem, 'maxHeight', customMaxHeight ? `${bodyMaxHeight}px` : '')
|
|
1574
|
+
setLayoutStyle(currScrollElem, 'height', customHeight ? `${tbHeight}px` : '')
|
|
1575
|
+
setLayoutStyle(currScrollElem, 'minHeight', `${bodyMinHeight}px`)
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
// 如果是固定列
|
|
1579
|
+
if (fixedWrapperElem) {
|
|
1580
|
+
if (wrapperElem) {
|
|
1581
|
+
setLayoutStyle(wrapperElem, 'top', `${tHeaderHeight}px`)
|
|
1582
|
+
}
|
|
1583
|
+
setLayoutStyle(fixedWrapperElem, 'height', `${customHeight > 0 ? customHeight : (tableHeight + tHeaderHeight + tFooterHeight + osbHeight)}px`)
|
|
1584
|
+
setLayoutStyle(fixedWrapperElem, 'width', `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`)
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
let renderColumnList = tableColumn
|
|
1588
|
+
const isOptimizeMode = isBodyRenderOptimize
|
|
1589
|
+
|
|
1590
|
+
if (fixedType) {
|
|
1591
|
+
renderColumnList = visibleColumn
|
|
1592
|
+
if (isOptimizeMode) {
|
|
1593
|
+
renderColumnList = fixedColumn || []
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0)
|
|
1598
|
+
|
|
1599
|
+
if (fixedType) {
|
|
1600
|
+
if (isOptimizeMode) {
|
|
1601
|
+
if (wrapperElem) {
|
|
1602
|
+
setLayoutStyle(wrapperElem, 'width', tWidth ? `${tWidth}px` : '')
|
|
1603
|
+
}
|
|
1604
|
+
} else {
|
|
1605
|
+
if (wrapperElem) {
|
|
1606
|
+
setLayoutStyle(wrapperElem, 'width', scrollXWidth ? `${scrollXWidth}px` : '')
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
if (tableElem) {
|
|
1612
|
+
setLayoutStyle(tableElem, 'width', tWidth ? `${tWidth}px` : '')
|
|
1613
|
+
// 兼容性处理
|
|
1614
|
+
setLayoutStyle(tableElem, 'paddingRight', osbWidth && fixedType && (browseObj.firefox || browseObj.safari) ? `${osbWidth}px` : '')
|
|
1615
|
+
}
|
|
1616
|
+
const emptyBlockElem = getRefElem(elemStore[`${name}-${layout}-emptyBlock`])
|
|
1617
|
+
if (emptyBlockElem) {
|
|
1618
|
+
setLayoutStyle(emptyBlockElem, 'width', tWidth ? `${tWidth}px` : '')
|
|
1619
|
+
}
|
|
1620
|
+
} else if (layout === 'footer') {
|
|
1621
|
+
let renderColumnList = tableColumn
|
|
1622
|
+
const isOptimizeMode = isFooterRenderOptimize
|
|
1623
|
+
|
|
1624
|
+
if (!isOptimizeMode || (!isColLoading && (fixedType || !overflowX))) {
|
|
1625
|
+
renderColumnList = visibleColumn
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
if (fixedType) {
|
|
1629
|
+
if (isOptimizeMode) {
|
|
1630
|
+
renderColumnList = fixedColumn || []
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0)
|
|
1635
|
+
|
|
1636
|
+
if (fixedType) {
|
|
1637
|
+
if (isOptimizeMode) {
|
|
1638
|
+
if (wrapperElem) {
|
|
1639
|
+
setLayoutStyle(wrapperElem, 'width', tWidth ? `${tWidth}px` : '')
|
|
1640
|
+
}
|
|
1641
|
+
} else {
|
|
1642
|
+
if (wrapperElem) {
|
|
1643
|
+
setLayoutStyle(wrapperElem, 'width', scrollXWidth ? `${scrollXWidth}px` : '')
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
if (currScrollElem) {
|
|
1649
|
+
setLayoutStyle(currScrollElem, 'height', `${tFooterHeight}px`)
|
|
1650
|
+
// 如果是固定列
|
|
1651
|
+
if (fixedWrapperElem) {
|
|
1652
|
+
if (wrapperElem) {
|
|
1653
|
+
setLayoutStyle(wrapperElem, 'top', `${customHeight > 0 ? customHeight - tFooterHeight - osbHeight : tableHeight + tHeaderHeight}px`)
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
if (tableElem) {
|
|
1658
|
+
setLayoutStyle(tableElem, 'width', tWidth ? `${tWidth}px` : '')
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
})
|
|
1662
|
+
})
|
|
1663
|
+
if (currentRow) {
|
|
1664
|
+
$xeTable.setCurrentRow(currentRow)
|
|
1665
|
+
}
|
|
1666
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected && editStore.selected.row && editStore.selected.column) {
|
|
1667
|
+
$xeTable.addCellSelectedClass()
|
|
1668
|
+
}
|
|
1669
|
+
if ($xeGanttView && $xeGanttView.handleUpdateStyle) {
|
|
1670
|
+
$xeGanttView.handleUpdateStyle()
|
|
1671
|
+
}
|
|
1672
|
+
return $xeTable.$nextTick()
|
|
1673
|
+
}
|
|
1674
|
+
function updateScrollXSpaceWithDedupe ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
1675
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
1676
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
1677
|
+
|
|
1678
|
+
const { scrollXLoad, overflowX, scrollXWidth } = reactData
|
|
1679
|
+
const { visibleColumn, scrollXStore, elemStore, fullColumnIdData } = internalData
|
|
1680
|
+
const $xeGanttView = internalData.xeGanttView
|
|
1681
|
+
const mouseOpts = $xeTable.computeMouseOpts
|
|
1682
|
+
const tableBody = $xeTable.$refs.refTableBody
|
|
1683
|
+
const tableBodyElem = tableBody ? (tableBody as any).$el as HTMLDivElement : null
|
|
1684
|
+
if (tableBodyElem) {
|
|
1685
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
1686
|
+
const bodyTableElem = getRefElem(elemStore['main-body-table'])
|
|
1687
|
+
const headerTableElem = getRefElem(elemStore['main-header-table'])
|
|
1688
|
+
const footerTableElem = getRefElem(elemStore['main-footer-table'])
|
|
1689
|
+
|
|
1690
|
+
let xSpaceLeft = 0
|
|
1691
|
+
const firstColumn = visibleColumn[scrollXStore.startIndex]
|
|
1692
|
+
if (firstColumn) {
|
|
1693
|
+
const colRest = fullColumnIdData[firstColumn.id] || {}
|
|
1694
|
+
xSpaceLeft = colRest.oLeft
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
let clientWidth = 0
|
|
1698
|
+
if (bodyScrollElem) {
|
|
1699
|
+
clientWidth = bodyScrollElem.clientWidth
|
|
1700
|
+
}
|
|
1701
|
+
// 虚拟渲染
|
|
1702
|
+
let isScrollXBig = false
|
|
1703
|
+
let ySpaceWidth = scrollXWidth
|
|
1704
|
+
if (scrollXWidth > maxXWidth) {
|
|
1705
|
+
// 触右
|
|
1706
|
+
if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollLeft + clientWidth >= maxXWidth) {
|
|
1707
|
+
xSpaceLeft = maxXWidth - bodyTableElem.clientWidth
|
|
1708
|
+
} else {
|
|
1709
|
+
xSpaceLeft = (maxXWidth - clientWidth) * (xSpaceLeft / (scrollXWidth - clientWidth))
|
|
1710
|
+
}
|
|
1711
|
+
ySpaceWidth = maxXWidth
|
|
1712
|
+
isScrollXBig = true
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
if (!(scrollXLoad && overflowX)) {
|
|
1716
|
+
xSpaceLeft = 0
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
if (getConfig().scrollMarginStyle) {
|
|
1720
|
+
// 已废弃方式
|
|
1721
|
+
if (headerTableElem) {
|
|
1722
|
+
setLayoutStyle(headerTableElem, 'marginLeft', headerTableElem.getAttribute('xvm') ? `${xSpaceLeft}px` : '')
|
|
1723
|
+
}
|
|
1724
|
+
if (bodyTableElem) {
|
|
1725
|
+
setLayoutStyle(bodyTableElem, 'marginLeft', `${xSpaceLeft}px`)
|
|
1726
|
+
}
|
|
1727
|
+
if (footerTableElem) {
|
|
1728
|
+
setLayoutStyle(footerTableElem, 'marginLeft', footerTableElem.getAttribute('xvm') ? `${xSpaceLeft}px` : '')
|
|
1729
|
+
}
|
|
1730
|
+
} else {
|
|
1731
|
+
if (headerTableElem) {
|
|
1732
|
+
setLayoutStyle(headerTableElem, 'transform', headerTableElem.getAttribute('xvm') ? `translate(${xSpaceLeft}px, 0px)` : '')
|
|
1733
|
+
}
|
|
1734
|
+
if (bodyTableElem) {
|
|
1735
|
+
setLayoutStyle(bodyTableElem, 'transform', `translate(${xSpaceLeft}px, ${reactData.scrollYTop || 0}px)`)
|
|
1736
|
+
}
|
|
1737
|
+
if (footerTableElem) {
|
|
1738
|
+
setLayoutStyle(footerTableElem, 'transform', footerTableElem.getAttribute('xvm') ? `translate(${xSpaceLeft}px, 0px)` : '')
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
const containerList = ['main']
|
|
1743
|
+
containerList.forEach(name => {
|
|
1744
|
+
const layoutList = ['header', 'body', 'footer']
|
|
1745
|
+
layoutList.forEach(layout => {
|
|
1746
|
+
const xSpaceElem = getRefElem(elemStore[`${name}-${layout}-xSpace`])
|
|
1747
|
+
if (xSpaceElem) {
|
|
1748
|
+
setLayoutStyle(xSpaceElem, 'width', scrollXLoad ? `${ySpaceWidth}px` : '')
|
|
1749
|
+
}
|
|
1750
|
+
})
|
|
1751
|
+
})
|
|
1752
|
+
|
|
1753
|
+
reactData.scrollXLeft = xSpaceLeft
|
|
1754
|
+
reactData.scrollXWidth = ySpaceWidth
|
|
1755
|
+
reactData.isScrollXBig = isScrollXBig
|
|
1756
|
+
const scrollXSpaceEl = $xeTable.$refs.refScrollXSpaceElem as HTMLDivElement
|
|
1757
|
+
if (scrollXSpaceEl) {
|
|
1758
|
+
setLayoutStyle(scrollXSpaceEl, 'width', `${ySpaceWidth}px`)
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
calcScrollbar($xeTable)
|
|
1762
|
+
if (isScrollXBig && mouseOpts.area) {
|
|
1763
|
+
errLog('vxe.error.notProp', ['mouse-config.area'])
|
|
1764
|
+
}
|
|
1765
|
+
if ($xeGanttView && $xeGanttView.handleUpdateSXSpace) {
|
|
1766
|
+
$xeGanttView.handleUpdateSXSpace()
|
|
1767
|
+
}
|
|
1768
|
+
return $xeTable.$nextTick(() => {
|
|
1769
|
+
updateStyleWithDedupe($xeTable)
|
|
1770
|
+
})
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1351
1774
|
function checkValidate ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, type: any) {
|
|
1352
1775
|
if ($xeTable.triggerValidate) {
|
|
1353
1776
|
return $xeTable.triggerValidate(type)
|
|
@@ -4383,7 +4806,8 @@ function getScrollSyncState ($xeTable: VxeTableConstructor & VxeTablePrivateMeth
|
|
|
4383
4806
|
const { scrollXStore, scrollYStore, elemStore, fullAllDataRowIdData } = internalData
|
|
4384
4807
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
4385
4808
|
const state: unknown[] = [
|
|
4386
|
-
|
|
4809
|
+
// 同一窗口可能被重新 slice;下方逐行快照仍校验对象、顺序、主键及高度。
|
|
4810
|
+
reactData.tableData.length, reactData.tableColumn,
|
|
4387
4811
|
internalData.afterFullData, internalData.afterFullData.length,
|
|
4388
4812
|
fullAllDataRowIdData, internalData.fullCellHeightMaps,
|
|
4389
4813
|
$xeTable.computeRowOpts, $xeTable.computeCellOpts, $xeTable.computeExpandOpts,
|
|
@@ -13484,6 +13908,10 @@ const tableMethods: any = {
|
|
|
13484
13908
|
},
|
|
13485
13909
|
// 更新横向 X 可视渲染上下剩余空间大小
|
|
13486
13910
|
updateScrollXSpace () {
|
|
13911
|
+
// 入口只分流一次;关闭时不经过去重函数或逐项样式比较。
|
|
13912
|
+
if (this.computeVirtualXOpts.experimentalSkipUnchangedStyle === true) {
|
|
13913
|
+
return updateScrollXSpaceWithDedupe(this as VxeTableConstructor & VxeTablePrivateMethods)
|
|
13914
|
+
}
|
|
13487
13915
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
13488
13916
|
const reactData = $xeTable as unknown as TableReactData
|
|
13489
13917
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -42,6 +42,8 @@ function bindScrollbarResize ($xeTable: VxeTableConstructor & VxeTablePrivateMet
|
|
|
42
42
|
if (isVScrollbar) {
|
|
43
43
|
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
44
44
|
const viewInnerEl = getRefElem(elemStore['main-body-table'])
|
|
45
|
+
const viewXSpaceEl = getRefElem(elemStore['main-body-xSpace'])
|
|
46
|
+
const viewYSpaceEl = getRefElem(elemStore['main-body-ySpace'])
|
|
45
47
|
const scrollObserver = globalResize.create(() => {
|
|
46
48
|
($xeTable as any).reScrollFlag++
|
|
47
49
|
})
|
|
@@ -51,6 +53,12 @@ function bindScrollbarResize ($xeTable: VxeTableConstructor & VxeTablePrivateMet
|
|
|
51
53
|
if (viewInnerEl) {
|
|
52
54
|
scrollObserver.observe(viewInnerEl)
|
|
53
55
|
}
|
|
56
|
+
if (viewXSpaceEl) {
|
|
57
|
+
scrollObserver.observe(viewXSpaceEl)
|
|
58
|
+
}
|
|
59
|
+
if (viewYSpaceEl) {
|
|
60
|
+
scrollObserver.observe(viewYSpaceEl)
|
|
61
|
+
}
|
|
54
62
|
internalData.scrollObserver = scrollObserver
|
|
55
63
|
}
|
|
56
64
|
}
|
|
@@ -606,14 +614,18 @@ function renderVirtualBody (h: CreateElement, $xeTable: VxeTableConstructor & Vx
|
|
|
606
614
|
|
|
607
615
|
return h('div', {
|
|
608
616
|
key: 'lvb',
|
|
609
|
-
class: [
|
|
610
|
-
'
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
+
class: [
|
|
618
|
+
'vxe-table--layout-wrapper',
|
|
619
|
+
`sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`,
|
|
620
|
+
`sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`,
|
|
621
|
+
{
|
|
622
|
+
'is--virtual-scrollbar': isVScrollbar,
|
|
623
|
+
'ov-padding': isVScrollbar && scrollbarOpts.padding,
|
|
624
|
+
'ov-x--auto-hide': isVScrollbar && scrollXAutoHide,
|
|
625
|
+
'ov-y--auto-hide': isVScrollbar && scrollYAutoHide,
|
|
626
|
+
'overflow-y': yThumbHeight,
|
|
627
|
+
'overflow-x': xThumbWidth
|
|
628
|
+
}]
|
|
617
629
|
}, [
|
|
618
630
|
renderViewport(h, $xeTable),
|
|
619
631
|
h('div', {
|
|
@@ -912,12 +924,14 @@ export default {
|
|
|
912
924
|
const reactData = $xeTable as unknown as TableReactData
|
|
913
925
|
|
|
914
926
|
const { yThumbHeight, xThumbWidth } = reactData
|
|
927
|
+
const scrollbarOpts = $xeTable.computeScrollbarOpts
|
|
915
928
|
const scrollbarXToTop = $xeTable.computeScrollbarXToTop
|
|
916
929
|
const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft
|
|
917
930
|
const scrollXVisible = $xeTable.computeScrollXVisible
|
|
918
931
|
const scrollYVisible = $xeTable.computeScrollYVisible
|
|
919
932
|
return domUtils.buildClass([
|
|
920
933
|
'vxe-scrollbar is--virtual',
|
|
934
|
+
scrollbarOpts.fluentOverlay ? 'is--fluent-overlay' : 'is--default-mode',
|
|
921
935
|
`ov-x--${scrollXVisible === false ? 'hidden' : 'visible'}`,
|
|
922
936
|
`ov-y--${scrollYVisible === false ? 'hidden' : 'visible'}`,
|
|
923
937
|
`sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`,
|
package/types/all.d.ts
CHANGED
|
@@ -14,6 +14,15 @@ declare module 'vxe-pc-ui/types/components/table' {
|
|
|
14
14
|
refreshRowExpandHeight(): Promise<void>
|
|
15
15
|
}
|
|
16
16
|
namespace VxeTablePropTypes {
|
|
17
|
+
interface VirtualXConfig {
|
|
18
|
+
/**
|
|
19
|
+
* 实验性跳过横向空间同步中未变化的内联样式写入。默认 false。
|
|
20
|
+
* 关闭时使用原来的直接赋值路径,仅显式 true 时进入独立去重实现。
|
|
21
|
+
* 不跳过完整 updateStyle、尺寸读取或两轮列窗校正,不跨帧缓存高度。
|
|
22
|
+
* 换行、展开内容及容器尺寸变化仍走原有测量流程。
|
|
23
|
+
*/
|
|
24
|
+
experimentalSkipUnchangedStyle?: boolean
|
|
25
|
+
}
|
|
17
26
|
interface VirtualYConfig {
|
|
18
27
|
/**
|
|
19
28
|
* 实验性批量自动行高测量。默认 false,只有显式 true 才启用。
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|