tomtaw-vxe-table 3.25.12 → 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 +398 -0
- 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 +25 -5
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/methods.js +13 -2
- 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 +427 -0
- package/packages/table/src/table.ts +22 -8
- package/types/all.d.ts +9 -0
- /package/es/{iconfont.1792400948479.ttf → iconfont.1792648484860.ttf} +0 -0
- /package/es/{iconfont.1792400948479.woff → iconfont.1792648484860.woff} +0 -0
- /package/es/{iconfont.1792400948479.woff2 → iconfont.1792648484860.woff2} +0 -0
- /package/lib/{iconfont.1792400948479.ttf → iconfont.1792648484860.ttf} +0 -0
- /package/lib/{iconfont.1792400948479.woff → iconfont.1792648484860.woff} +0 -0
- /package/lib/{iconfont.1792400948479.woff2 → iconfont.1792648484860.woff2} +0 -0
package/es/table/src/methods.js
CHANGED
|
@@ -1277,6 +1277,400 @@ function updateStyle($xeTable) {
|
|
|
1277
1277
|
}
|
|
1278
1278
|
return $xeTable.$nextTick();
|
|
1279
1279
|
}
|
|
1280
|
+
/** 仅供显式开启的独立路径使用;不缓存尺寸或延迟写入。 */
|
|
1281
|
+
function setLayoutStyle(element, name, value) {
|
|
1282
|
+
const style = element.style;
|
|
1283
|
+
if (style[name] === value) {
|
|
1284
|
+
// 原 setter 会清除 !important;值相同但优先级不同时仍必须写入。
|
|
1285
|
+
const cssName = name.replace(/[A-Z]/g, word => `-${word.toLowerCase()}`);
|
|
1286
|
+
if (!style.getPropertyPriority(cssName))
|
|
1287
|
+
return;
|
|
1288
|
+
}
|
|
1289
|
+
style[name] = value;
|
|
1290
|
+
}
|
|
1291
|
+
function updateStyleWithDedupe($xeTable) {
|
|
1292
|
+
const props = $xeTable;
|
|
1293
|
+
const reactData = $xeTable;
|
|
1294
|
+
const internalData = $xeTable;
|
|
1295
|
+
const $xeGantt = $xeTable.$xeGantt;
|
|
1296
|
+
const { mouseConfig } = props;
|
|
1297
|
+
const { isGroup, tableColumn, overflowX, scrollbarWidth, overflowY, scrollbarHeight, scrollXWidth, columnStore, editStore, isColLoading } = reactData;
|
|
1298
|
+
const { visibleColumn, tableHeight, elemStore, currentRow, customHeight, customMinHeight, customMaxHeight, tHeaderHeight, tFooterHeight } = internalData;
|
|
1299
|
+
const $xeGanttView = internalData.xeGanttView;
|
|
1300
|
+
const el = $xeTable.$refs.refElem;
|
|
1301
|
+
if (!el || (internalData.tBodyHeight && !el.clientHeight)) {
|
|
1302
|
+
return;
|
|
1303
|
+
}
|
|
1304
|
+
const browseObj = XEUtils.browse();
|
|
1305
|
+
const containerList = ['main', 'left', 'right'];
|
|
1306
|
+
const { leftList, rightList } = columnStore;
|
|
1307
|
+
let osbWidth = overflowY ? scrollbarWidth : 0;
|
|
1308
|
+
let osbHeight = overflowX ? scrollbarHeight : 0;
|
|
1309
|
+
const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder;
|
|
1310
|
+
const isHeaderRenderOptimize = $xeTable.computeIsHeaderRenderOptimize;
|
|
1311
|
+
const isBodyRenderOptimize = $xeTable.computeIsBodyRenderOptimize;
|
|
1312
|
+
const isFooterRenderOptimize = $xeTable.computeIsFooterRenderOptimize;
|
|
1313
|
+
const mouseOpts = $xeTable.computeMouseOpts;
|
|
1314
|
+
const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper']);
|
|
1315
|
+
const bodyTableElem = getRefElem(elemStore['main-body-table']);
|
|
1316
|
+
if (emptyPlaceholderElem) {
|
|
1317
|
+
setLayoutStyle(emptyPlaceholderElem, 'top', `${tHeaderHeight}px`);
|
|
1318
|
+
setLayoutStyle(emptyPlaceholderElem, 'height', bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : '');
|
|
1319
|
+
}
|
|
1320
|
+
const scrollXVisible = $xeTable.computeScrollXVisible;
|
|
1321
|
+
const scrollYVisible = $xeTable.computeScrollYVisible;
|
|
1322
|
+
const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
|
|
1323
|
+
let xScrollbarVisible = overflowX ? 'visible' : 'hidden';
|
|
1324
|
+
const hideXScroll = scrollXVisible === false || scrollXVisible === 'hidden';
|
|
1325
|
+
if (scrollXVisible === 'visible' || $xeGanttView) {
|
|
1326
|
+
osbHeight = scrollbarHeight;
|
|
1327
|
+
xScrollbarVisible = 'visible';
|
|
1328
|
+
}
|
|
1329
|
+
else if (hideXScroll) {
|
|
1330
|
+
osbHeight = 0;
|
|
1331
|
+
xScrollbarVisible = 'hidden';
|
|
1332
|
+
}
|
|
1333
|
+
let yScrollbarVisible = overflowY ? 'visible' : 'hidden';
|
|
1334
|
+
const hideYScroll = scrollYVisible === false || scrollYVisible === 'hidden';
|
|
1335
|
+
if (hideYScroll || (($xeGantt && $xeGanttView && $xeGantt.reactData.showRightView) && !scrollbarYToLeft)) {
|
|
1336
|
+
osbWidth = 0;
|
|
1337
|
+
yScrollbarVisible = 'hidden';
|
|
1338
|
+
}
|
|
1339
|
+
else if (scrollYVisible === 'visible') {
|
|
1340
|
+
osbWidth = scrollbarWidth;
|
|
1341
|
+
yScrollbarVisible = 'visible';
|
|
1342
|
+
}
|
|
1343
|
+
let tbHeight = 0;
|
|
1344
|
+
let bodyMaxHeight = 0;
|
|
1345
|
+
const bodyMinHeight = customMinHeight - tHeaderHeight - tFooterHeight - osbHeight;
|
|
1346
|
+
if (customMaxHeight) {
|
|
1347
|
+
bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - tHeaderHeight - tFooterHeight - osbHeight);
|
|
1348
|
+
}
|
|
1349
|
+
if (customHeight) {
|
|
1350
|
+
tbHeight = customHeight - tHeaderHeight - tFooterHeight - osbHeight;
|
|
1351
|
+
}
|
|
1352
|
+
if (!tbHeight) {
|
|
1353
|
+
if (bodyTableElem) {
|
|
1354
|
+
tbHeight = bodyTableElem.clientHeight;
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
if (tbHeight) {
|
|
1358
|
+
if (bodyMaxHeight) {
|
|
1359
|
+
tbHeight = Math.min(bodyMaxHeight, tbHeight);
|
|
1360
|
+
}
|
|
1361
|
+
tbHeight = Math.max(bodyMinHeight, tbHeight);
|
|
1362
|
+
}
|
|
1363
|
+
const xLeftCornerEl = $xeTable.$refs.refScrollXLeftCornerElem;
|
|
1364
|
+
const xRightCornerEl = $xeTable.$refs.refScrollXRightCornerElem;
|
|
1365
|
+
const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem;
|
|
1366
|
+
if (scrollXVirtualEl) {
|
|
1367
|
+
setLayoutStyle(scrollXVirtualEl, 'height', `${osbHeight}px`);
|
|
1368
|
+
setLayoutStyle(scrollXVirtualEl, 'visibility', xScrollbarVisible);
|
|
1369
|
+
}
|
|
1370
|
+
const xWrapperEl = $xeTable.$refs.refScrollXWrapperElem;
|
|
1371
|
+
if (xWrapperEl) {
|
|
1372
|
+
setLayoutStyle(xWrapperEl, 'width', `${el.clientWidth - osbWidth}px`);
|
|
1373
|
+
if (scrollbarYToLeft) {
|
|
1374
|
+
setLayoutStyle(xWrapperEl, 'left', `${osbWidth}px`);
|
|
1375
|
+
}
|
|
1376
|
+
else {
|
|
1377
|
+
setLayoutStyle(xWrapperEl, 'left', '');
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
if (xLeftCornerEl) {
|
|
1381
|
+
if (scrollbarYToLeft) {
|
|
1382
|
+
setLayoutStyle(xLeftCornerEl, 'width', `${osbWidth}px`);
|
|
1383
|
+
setLayoutStyle(xLeftCornerEl, 'display', overflowY && osbWidth ? 'block' : '');
|
|
1384
|
+
}
|
|
1385
|
+
else {
|
|
1386
|
+
setLayoutStyle(xLeftCornerEl, 'display', '');
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
if (xRightCornerEl) {
|
|
1390
|
+
if (scrollbarYToLeft) {
|
|
1391
|
+
setLayoutStyle(xRightCornerEl, 'display', '');
|
|
1392
|
+
}
|
|
1393
|
+
else {
|
|
1394
|
+
setLayoutStyle(xRightCornerEl, 'width', `${osbWidth}px`);
|
|
1395
|
+
setLayoutStyle(xRightCornerEl, 'display', xScrollbarVisible === 'visible' ? 'block' : '');
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem;
|
|
1399
|
+
if (scrollYVirtualEl) {
|
|
1400
|
+
setLayoutStyle(scrollYVirtualEl, 'width', `${osbWidth}px`);
|
|
1401
|
+
setLayoutStyle(scrollYVirtualEl, 'height', `${tbHeight + tHeaderHeight + tFooterHeight}px`);
|
|
1402
|
+
setLayoutStyle(scrollYVirtualEl, 'visibility', yScrollbarVisible);
|
|
1403
|
+
}
|
|
1404
|
+
const yTopCornerEl = $xeTable.$refs.refScrollYTopCornerElem;
|
|
1405
|
+
if (yTopCornerEl) {
|
|
1406
|
+
setLayoutStyle(yTopCornerEl, 'height', `${tHeaderHeight}px`);
|
|
1407
|
+
setLayoutStyle(yTopCornerEl, 'display', tHeaderHeight && yScrollbarVisible === 'visible' ? 'block' : '');
|
|
1408
|
+
}
|
|
1409
|
+
const yWrapperEl = $xeTable.$refs.refScrollYWrapperElem;
|
|
1410
|
+
if (yWrapperEl) {
|
|
1411
|
+
setLayoutStyle(yWrapperEl, 'height', `${tbHeight}px`);
|
|
1412
|
+
setLayoutStyle(yWrapperEl, 'top', `${tHeaderHeight}px`);
|
|
1413
|
+
}
|
|
1414
|
+
const yBottomCornerEl = $xeTable.$refs.refScrollYBottomCornerElem;
|
|
1415
|
+
if (yBottomCornerEl) {
|
|
1416
|
+
setLayoutStyle(yBottomCornerEl, 'height', `${tFooterHeight}px`);
|
|
1417
|
+
setLayoutStyle(yBottomCornerEl, 'top', `${tHeaderHeight + tbHeight}px`);
|
|
1418
|
+
setLayoutStyle(yBottomCornerEl, 'display', tFooterHeight && yScrollbarVisible === 'visible' ? 'block' : '');
|
|
1419
|
+
}
|
|
1420
|
+
const rowExpandEl = $xeTable.$refs.refRowExpandElem;
|
|
1421
|
+
if (rowExpandEl) {
|
|
1422
|
+
setLayoutStyle(rowExpandEl, 'height', `${tbHeight}px`);
|
|
1423
|
+
setLayoutStyle(rowExpandEl, 'top', `${tHeaderHeight}px`);
|
|
1424
|
+
}
|
|
1425
|
+
internalData.tBodyHeight = tbHeight;
|
|
1426
|
+
containerList.forEach((name, index) => {
|
|
1427
|
+
const fixedType = index > 0 ? name : '';
|
|
1428
|
+
const layoutList = ['header', 'body', 'footer'];
|
|
1429
|
+
const isFixedLeft = fixedType === 'left';
|
|
1430
|
+
let fixedColumn = [];
|
|
1431
|
+
let fixedWrapperElem;
|
|
1432
|
+
if (fixedType) {
|
|
1433
|
+
fixedColumn = isFixedLeft ? leftList : rightList;
|
|
1434
|
+
fixedWrapperElem = (isFixedLeft ? $xeTable.$refs.refLeftContainer : $xeTable.$refs.refRightContainer);
|
|
1435
|
+
}
|
|
1436
|
+
layoutList.forEach(layout => {
|
|
1437
|
+
const wrapperElem = getRefElem(elemStore[`${name}-${layout}-wrapper`]);
|
|
1438
|
+
const currScrollElem = getRefElem(elemStore[`${name}-${layout}-scroll`]);
|
|
1439
|
+
const tableElem = getRefElem(elemStore[`${name}-${layout}-table`]);
|
|
1440
|
+
if (layout === 'header') {
|
|
1441
|
+
// 表头体样式处理
|
|
1442
|
+
// 横向滚动渲染
|
|
1443
|
+
let renderColumnList = tableColumn;
|
|
1444
|
+
const isOptimizeMode = isHeaderRenderOptimize;
|
|
1445
|
+
if (isGroup) {
|
|
1446
|
+
renderColumnList = visibleColumn;
|
|
1447
|
+
}
|
|
1448
|
+
else {
|
|
1449
|
+
if (!isOptimizeMode || (!isColLoading && (fixedType || !overflowX))) {
|
|
1450
|
+
renderColumnList = visibleColumn;
|
|
1451
|
+
}
|
|
1452
|
+
if (fixedType) {
|
|
1453
|
+
// 如果是使用优化模式
|
|
1454
|
+
if (isOptimizeMode) {
|
|
1455
|
+
renderColumnList = fixedColumn || [];
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
|
|
1460
|
+
if (fixedType) {
|
|
1461
|
+
if (isGroup) {
|
|
1462
|
+
if (wrapperElem) {
|
|
1463
|
+
setLayoutStyle(wrapperElem, 'width', scrollXWidth ? `${scrollXWidth}px` : '');
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
else {
|
|
1467
|
+
if (isOptimizeMode) {
|
|
1468
|
+
if (wrapperElem) {
|
|
1469
|
+
setLayoutStyle(wrapperElem, 'width', tWidth ? `${tWidth}px` : '');
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
else {
|
|
1473
|
+
if (wrapperElem) {
|
|
1474
|
+
setLayoutStyle(wrapperElem, 'width', scrollXWidth ? `${scrollXWidth}px` : '');
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
if (currScrollElem) {
|
|
1480
|
+
setLayoutStyle(currScrollElem, 'height', `${tHeaderHeight}px`);
|
|
1481
|
+
}
|
|
1482
|
+
if (tableElem) {
|
|
1483
|
+
setLayoutStyle(tableElem, 'width', tWidth ? `${tWidth}px` : '');
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
else if (layout === 'body') {
|
|
1487
|
+
if (currScrollElem) {
|
|
1488
|
+
setLayoutStyle(currScrollElem, 'maxHeight', customMaxHeight ? `${bodyMaxHeight}px` : '');
|
|
1489
|
+
setLayoutStyle(currScrollElem, 'height', customHeight ? `${tbHeight}px` : '');
|
|
1490
|
+
setLayoutStyle(currScrollElem, 'minHeight', `${bodyMinHeight}px`);
|
|
1491
|
+
}
|
|
1492
|
+
// 如果是固定列
|
|
1493
|
+
if (fixedWrapperElem) {
|
|
1494
|
+
if (wrapperElem) {
|
|
1495
|
+
setLayoutStyle(wrapperElem, 'top', `${tHeaderHeight}px`);
|
|
1496
|
+
}
|
|
1497
|
+
setLayoutStyle(fixedWrapperElem, 'height', `${customHeight > 0 ? customHeight : (tableHeight + tHeaderHeight + tFooterHeight + osbHeight)}px`);
|
|
1498
|
+
setLayoutStyle(fixedWrapperElem, 'width', `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`);
|
|
1499
|
+
}
|
|
1500
|
+
let renderColumnList = tableColumn;
|
|
1501
|
+
const isOptimizeMode = isBodyRenderOptimize;
|
|
1502
|
+
if (fixedType) {
|
|
1503
|
+
renderColumnList = visibleColumn;
|
|
1504
|
+
if (isOptimizeMode) {
|
|
1505
|
+
renderColumnList = fixedColumn || [];
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
|
|
1509
|
+
if (fixedType) {
|
|
1510
|
+
if (isOptimizeMode) {
|
|
1511
|
+
if (wrapperElem) {
|
|
1512
|
+
setLayoutStyle(wrapperElem, 'width', tWidth ? `${tWidth}px` : '');
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
else {
|
|
1516
|
+
if (wrapperElem) {
|
|
1517
|
+
setLayoutStyle(wrapperElem, 'width', scrollXWidth ? `${scrollXWidth}px` : '');
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
if (tableElem) {
|
|
1522
|
+
setLayoutStyle(tableElem, 'width', tWidth ? `${tWidth}px` : '');
|
|
1523
|
+
// 兼容性处理
|
|
1524
|
+
setLayoutStyle(tableElem, 'paddingRight', osbWidth && fixedType && (browseObj.firefox || browseObj.safari) ? `${osbWidth}px` : '');
|
|
1525
|
+
}
|
|
1526
|
+
const emptyBlockElem = getRefElem(elemStore[`${name}-${layout}-emptyBlock`]);
|
|
1527
|
+
if (emptyBlockElem) {
|
|
1528
|
+
setLayoutStyle(emptyBlockElem, 'width', tWidth ? `${tWidth}px` : '');
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
else if (layout === 'footer') {
|
|
1532
|
+
let renderColumnList = tableColumn;
|
|
1533
|
+
const isOptimizeMode = isFooterRenderOptimize;
|
|
1534
|
+
if (!isOptimizeMode || (!isColLoading && (fixedType || !overflowX))) {
|
|
1535
|
+
renderColumnList = visibleColumn;
|
|
1536
|
+
}
|
|
1537
|
+
if (fixedType) {
|
|
1538
|
+
if (isOptimizeMode) {
|
|
1539
|
+
renderColumnList = fixedColumn || [];
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
|
|
1543
|
+
if (fixedType) {
|
|
1544
|
+
if (isOptimizeMode) {
|
|
1545
|
+
if (wrapperElem) {
|
|
1546
|
+
setLayoutStyle(wrapperElem, 'width', tWidth ? `${tWidth}px` : '');
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
else {
|
|
1550
|
+
if (wrapperElem) {
|
|
1551
|
+
setLayoutStyle(wrapperElem, 'width', scrollXWidth ? `${scrollXWidth}px` : '');
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
if (currScrollElem) {
|
|
1556
|
+
setLayoutStyle(currScrollElem, 'height', `${tFooterHeight}px`);
|
|
1557
|
+
// 如果是固定列
|
|
1558
|
+
if (fixedWrapperElem) {
|
|
1559
|
+
if (wrapperElem) {
|
|
1560
|
+
setLayoutStyle(wrapperElem, 'top', `${customHeight > 0 ? customHeight - tFooterHeight - osbHeight : tableHeight + tHeaderHeight}px`);
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
if (tableElem) {
|
|
1565
|
+
setLayoutStyle(tableElem, 'width', tWidth ? `${tWidth}px` : '');
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
});
|
|
1569
|
+
});
|
|
1570
|
+
if (currentRow) {
|
|
1571
|
+
$xeTable.setCurrentRow(currentRow);
|
|
1572
|
+
}
|
|
1573
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected && editStore.selected.row && editStore.selected.column) {
|
|
1574
|
+
$xeTable.addCellSelectedClass();
|
|
1575
|
+
}
|
|
1576
|
+
if ($xeGanttView && $xeGanttView.handleUpdateStyle) {
|
|
1577
|
+
$xeGanttView.handleUpdateStyle();
|
|
1578
|
+
}
|
|
1579
|
+
return $xeTable.$nextTick();
|
|
1580
|
+
}
|
|
1581
|
+
function updateScrollXSpaceWithDedupe($xeTable) {
|
|
1582
|
+
const reactData = $xeTable;
|
|
1583
|
+
const internalData = $xeTable;
|
|
1584
|
+
const { scrollXLoad, overflowX, scrollXWidth } = reactData;
|
|
1585
|
+
const { visibleColumn, scrollXStore, elemStore, fullColumnIdData } = internalData;
|
|
1586
|
+
const $xeGanttView = internalData.xeGanttView;
|
|
1587
|
+
const mouseOpts = $xeTable.computeMouseOpts;
|
|
1588
|
+
const tableBody = $xeTable.$refs.refTableBody;
|
|
1589
|
+
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
1590
|
+
if (tableBodyElem) {
|
|
1591
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
1592
|
+
const bodyTableElem = getRefElem(elemStore['main-body-table']);
|
|
1593
|
+
const headerTableElem = getRefElem(elemStore['main-header-table']);
|
|
1594
|
+
const footerTableElem = getRefElem(elemStore['main-footer-table']);
|
|
1595
|
+
let xSpaceLeft = 0;
|
|
1596
|
+
const firstColumn = visibleColumn[scrollXStore.startIndex];
|
|
1597
|
+
if (firstColumn) {
|
|
1598
|
+
const colRest = fullColumnIdData[firstColumn.id] || {};
|
|
1599
|
+
xSpaceLeft = colRest.oLeft;
|
|
1600
|
+
}
|
|
1601
|
+
let clientWidth = 0;
|
|
1602
|
+
if (bodyScrollElem) {
|
|
1603
|
+
clientWidth = bodyScrollElem.clientWidth;
|
|
1604
|
+
}
|
|
1605
|
+
// 虚拟渲染
|
|
1606
|
+
let isScrollXBig = false;
|
|
1607
|
+
let ySpaceWidth = scrollXWidth;
|
|
1608
|
+
if (scrollXWidth > maxXWidth) {
|
|
1609
|
+
// 触右
|
|
1610
|
+
if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollLeft + clientWidth >= maxXWidth) {
|
|
1611
|
+
xSpaceLeft = maxXWidth - bodyTableElem.clientWidth;
|
|
1612
|
+
}
|
|
1613
|
+
else {
|
|
1614
|
+
xSpaceLeft = (maxXWidth - clientWidth) * (xSpaceLeft / (scrollXWidth - clientWidth));
|
|
1615
|
+
}
|
|
1616
|
+
ySpaceWidth = maxXWidth;
|
|
1617
|
+
isScrollXBig = true;
|
|
1618
|
+
}
|
|
1619
|
+
if (!(scrollXLoad && overflowX)) {
|
|
1620
|
+
xSpaceLeft = 0;
|
|
1621
|
+
}
|
|
1622
|
+
if (getConfig().scrollMarginStyle) {
|
|
1623
|
+
// 已废弃方式
|
|
1624
|
+
if (headerTableElem) {
|
|
1625
|
+
setLayoutStyle(headerTableElem, 'marginLeft', headerTableElem.getAttribute('xvm') ? `${xSpaceLeft}px` : '');
|
|
1626
|
+
}
|
|
1627
|
+
if (bodyTableElem) {
|
|
1628
|
+
setLayoutStyle(bodyTableElem, 'marginLeft', `${xSpaceLeft}px`);
|
|
1629
|
+
}
|
|
1630
|
+
if (footerTableElem) {
|
|
1631
|
+
setLayoutStyle(footerTableElem, 'marginLeft', footerTableElem.getAttribute('xvm') ? `${xSpaceLeft}px` : '');
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
else {
|
|
1635
|
+
if (headerTableElem) {
|
|
1636
|
+
setLayoutStyle(headerTableElem, 'transform', headerTableElem.getAttribute('xvm') ? `translate(${xSpaceLeft}px, 0px)` : '');
|
|
1637
|
+
}
|
|
1638
|
+
if (bodyTableElem) {
|
|
1639
|
+
setLayoutStyle(bodyTableElem, 'transform', `translate(${xSpaceLeft}px, ${reactData.scrollYTop || 0}px)`);
|
|
1640
|
+
}
|
|
1641
|
+
if (footerTableElem) {
|
|
1642
|
+
setLayoutStyle(footerTableElem, 'transform', footerTableElem.getAttribute('xvm') ? `translate(${xSpaceLeft}px, 0px)` : '');
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
const containerList = ['main'];
|
|
1646
|
+
containerList.forEach(name => {
|
|
1647
|
+
const layoutList = ['header', 'body', 'footer'];
|
|
1648
|
+
layoutList.forEach(layout => {
|
|
1649
|
+
const xSpaceElem = getRefElem(elemStore[`${name}-${layout}-xSpace`]);
|
|
1650
|
+
if (xSpaceElem) {
|
|
1651
|
+
setLayoutStyle(xSpaceElem, 'width', scrollXLoad ? `${ySpaceWidth}px` : '');
|
|
1652
|
+
}
|
|
1653
|
+
});
|
|
1654
|
+
});
|
|
1655
|
+
reactData.scrollXLeft = xSpaceLeft;
|
|
1656
|
+
reactData.scrollXWidth = ySpaceWidth;
|
|
1657
|
+
reactData.isScrollXBig = isScrollXBig;
|
|
1658
|
+
const scrollXSpaceEl = $xeTable.$refs.refScrollXSpaceElem;
|
|
1659
|
+
if (scrollXSpaceEl) {
|
|
1660
|
+
setLayoutStyle(scrollXSpaceEl, 'width', `${ySpaceWidth}px`);
|
|
1661
|
+
}
|
|
1662
|
+
calcScrollbar($xeTable);
|
|
1663
|
+
if (isScrollXBig && mouseOpts.area) {
|
|
1664
|
+
errLog('vxe.error.notProp', ['mouse-config.area']);
|
|
1665
|
+
}
|
|
1666
|
+
if ($xeGanttView && $xeGanttView.handleUpdateSXSpace) {
|
|
1667
|
+
$xeGanttView.handleUpdateSXSpace();
|
|
1668
|
+
}
|
|
1669
|
+
return $xeTable.$nextTick(() => {
|
|
1670
|
+
updateStyleWithDedupe($xeTable);
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1280
1674
|
function checkValidate($xeTable, type) {
|
|
1281
1675
|
if ($xeTable.triggerValidate) {
|
|
1282
1676
|
return $xeTable.triggerValidate(type);
|
|
@@ -13051,6 +13445,10 @@ const tableMethods = {
|
|
|
13051
13445
|
},
|
|
13052
13446
|
// 更新横向 X 可视渲染上下剩余空间大小
|
|
13053
13447
|
updateScrollXSpace() {
|
|
13448
|
+
// 入口只分流一次;关闭时不经过去重函数或逐项样式比较。
|
|
13449
|
+
if (this.computeVirtualXOpts.experimentalSkipUnchangedStyle === true) {
|
|
13450
|
+
return updateScrollXSpaceWithDedupe(this);
|
|
13451
|
+
}
|
|
13054
13452
|
const $xeTable = this;
|
|
13055
13453
|
const reactData = $xeTable;
|
|
13056
13454
|
const internalData = $xeTable;
|
package/es/table/src/table.js
CHANGED
|
@@ -33,6 +33,8 @@ function bindScrollbarResize($xeTable) {
|
|
|
33
33
|
if (isVScrollbar) {
|
|
34
34
|
const el = $xeTable.$refs.refElem;
|
|
35
35
|
const viewInnerEl = getRefElem(elemStore['main-body-table']);
|
|
36
|
+
const viewXSpaceEl = getRefElem(elemStore['main-body-xSpace']);
|
|
37
|
+
const viewYSpaceEl = getRefElem(elemStore['main-body-ySpace']);
|
|
36
38
|
const scrollObserver = globalResize.create(() => {
|
|
37
39
|
$xeTable.reScrollFlag++;
|
|
38
40
|
});
|
|
@@ -42,6 +44,12 @@ function bindScrollbarResize($xeTable) {
|
|
|
42
44
|
if (viewInnerEl) {
|
|
43
45
|
scrollObserver.observe(viewInnerEl);
|
|
44
46
|
}
|
|
47
|
+
if (viewXSpaceEl) {
|
|
48
|
+
scrollObserver.observe(viewXSpaceEl);
|
|
49
|
+
}
|
|
50
|
+
if (viewYSpaceEl) {
|
|
51
|
+
scrollObserver.observe(viewYSpaceEl);
|
|
52
|
+
}
|
|
45
53
|
internalData.scrollObserver = scrollObserver;
|
|
46
54
|
}
|
|
47
55
|
}
|
|
@@ -565,14 +573,19 @@ function renderVirtualBody(h, $xeTable) {
|
|
|
565
573
|
const hideYScroll = scrollYVisible === false || scrollYVisible === 'hidden';
|
|
566
574
|
return h('div', {
|
|
567
575
|
key: 'lvb',
|
|
568
|
-
class: [
|
|
576
|
+
class: [
|
|
577
|
+
'vxe-table--layout-wrapper',
|
|
578
|
+
`sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`,
|
|
579
|
+
`sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`,
|
|
580
|
+
{
|
|
569
581
|
'is--virtual-scrollbar': isVScrollbar,
|
|
570
582
|
'ov-padding': isVScrollbar && scrollbarOpts.padding,
|
|
571
583
|
'ov-x--auto-hide': isVScrollbar && scrollXAutoHide,
|
|
572
584
|
'ov-y--auto-hide': isVScrollbar && scrollYAutoHide,
|
|
573
585
|
'overflow-y': yThumbHeight,
|
|
574
586
|
'overflow-x': xThumbWidth
|
|
575
|
-
}
|
|
587
|
+
}
|
|
588
|
+
]
|
|
576
589
|
}, [
|
|
577
590
|
renderViewport(h, $xeTable),
|
|
578
591
|
h('div', {
|
|
@@ -834,12 +847,14 @@ export default {
|
|
|
834
847
|
const $xeTable = this;
|
|
835
848
|
const reactData = $xeTable;
|
|
836
849
|
const { yThumbHeight, xThumbWidth } = reactData;
|
|
850
|
+
const scrollbarOpts = $xeTable.computeScrollbarOpts;
|
|
837
851
|
const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
|
|
838
852
|
const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
|
|
839
853
|
const scrollXVisible = $xeTable.computeScrollXVisible;
|
|
840
854
|
const scrollYVisible = $xeTable.computeScrollYVisible;
|
|
841
855
|
return domUtils.buildClass([
|
|
842
856
|
'vxe-scrollbar is--virtual',
|
|
857
|
+
scrollbarOpts.fluentOverlay ? 'is--fluent-overlay' : 'is--default-mode',
|
|
843
858
|
`ov-x--${scrollXVisible === false ? 'hidden' : 'visible'}`,
|
|
844
859
|
`ov-y--${scrollYVisible === false ? 'hidden' : 'visible'}`,
|
|
845
860
|
`sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`,
|
package/es/ui/index.js
CHANGED
package/es/ui/src/log.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VxeUI } from '@vxe-ui/core';
|
|
2
2
|
const { log } = VxeUI;
|
|
3
|
-
const tableVersion = `table v${"3.25.
|
|
3
|
+
const tableVersion = `table v${"3.25.13"}`;
|
|
4
4
|
export function createComponentLog(name) {
|
|
5
5
|
const uiVersion = VxeUI.uiVersion ? `ui v${VxeUI.uiVersion}` : '';
|
|
6
6
|
const ganttVersion = VxeUI.ganttVersion ? `gantt v${VxeUI.ganttVersion}` : '';
|
package/lib/index.umd.js
CHANGED
|
@@ -3445,7 +3445,7 @@ function getDefaultConfig(val1, def1) {
|
|
|
3445
3445
|
/* unused harmony import specifier */ var VxeUI;
|
|
3446
3446
|
|
|
3447
3447
|
|
|
3448
|
-
const ui_version = "3.25.
|
|
3448
|
+
const ui_version = "3.25.13";
|
|
3449
3449
|
core_.VxeUI.version = ui_version;
|
|
3450
3450
|
core_.VxeUI.tableVersion = ui_version;
|
|
3451
3451
|
core_.VxeUI.setConfig({
|
|
@@ -4440,7 +4440,7 @@ function getPopupAppendElement(appendTo) {
|
|
|
4440
4440
|
const {
|
|
4441
4441
|
log: log_log
|
|
4442
4442
|
} = core_.VxeUI;
|
|
4443
|
-
const tableVersion = `table v${"3.25.
|
|
4443
|
+
const tableVersion = `table v${"3.25.13"}`;
|
|
4444
4444
|
function createComponentLog(name) {
|
|
4445
4445
|
const uiVersion = core_.VxeUI.uiVersion ? `ui v${core_.VxeUI.uiVersion}` : '';
|
|
4446
4446
|
const ganttVersion = core_.VxeUI.ganttVersion ? `gantt v${core_.VxeUI.ganttVersion}` : '';
|
|
@@ -8686,7 +8686,17 @@ let renderColumnList=tableColumn;const isOptimizeMode=isHeaderRenderOptimize;if(
|
|
|
8686
8686
|
if(isOptimizeMode){renderColumnList=fixedColumn||[];}}}const tWidth=renderColumnList.reduce((previous,column)=>previous+column.renderWidth,0);if(fixedType){if(isGroup){if(wrapperElem){wrapperElem.style.width=scrollXWidth?`${scrollXWidth}px`:'';}}else{if(isOptimizeMode){if(wrapperElem){wrapperElem.style.width=tWidth?`${tWidth}px`:'';}}else{if(wrapperElem){wrapperElem.style.width=scrollXWidth?`${scrollXWidth}px`:'';}}}}if(currScrollElem){currScrollElem.style.height=`${tHeaderHeight}px`;}if(tableElem){tableElem.style.width=tWidth?`${tWidth}px`:'';}}else if(layout==='body'){if(currScrollElem){currScrollElem.style.maxHeight=customMaxHeight?`${bodyMaxHeight}px`:'';currScrollElem.style.height=customHeight?`${tbHeight}px`:'';currScrollElem.style.minHeight=`${bodyMinHeight}px`;}// 如果是固定列
|
|
8687
8687
|
if(fixedWrapperElem){if(wrapperElem){wrapperElem.style.top=`${tHeaderHeight}px`;}fixedWrapperElem.style.height=`${customHeight>0?customHeight:tableHeight+tHeaderHeight+tFooterHeight+osbHeight}px`;fixedWrapperElem.style.width=`${fixedColumn.reduce((previous,column)=>previous+column.renderWidth,0)}px`;}let renderColumnList=tableColumn;const isOptimizeMode=isBodyRenderOptimize;if(fixedType){renderColumnList=visibleColumn;if(isOptimizeMode){renderColumnList=fixedColumn||[];}}const tWidth=renderColumnList.reduce((previous,column)=>previous+column.renderWidth,0);if(fixedType){if(isOptimizeMode){if(wrapperElem){wrapperElem.style.width=tWidth?`${tWidth}px`:'';}}else{if(wrapperElem){wrapperElem.style.width=scrollXWidth?`${scrollXWidth}px`:'';}}}if(tableElem){tableElem.style.width=tWidth?`${tWidth}px`:'';// 兼容性处理
|
|
8688
8688
|
tableElem.style.paddingRight=osbWidth&&fixedType&&(browseObj.firefox||browseObj.safari)?`${osbWidth}px`:'';}const emptyBlockElem=getRefElem(elemStore[`${name}-${layout}-emptyBlock`]);if(emptyBlockElem){emptyBlockElem.style.width=tWidth?`${tWidth}px`:'';}}else if(layout==='footer'){let renderColumnList=tableColumn;const isOptimizeMode=isFooterRenderOptimize;if(!isOptimizeMode||!isColLoading&&(fixedType||!overflowX)){renderColumnList=visibleColumn;}if(fixedType){if(isOptimizeMode){renderColumnList=fixedColumn||[];}}const tWidth=renderColumnList.reduce((previous,column)=>previous+column.renderWidth,0);if(fixedType){if(isOptimizeMode){if(wrapperElem){wrapperElem.style.width=tWidth?`${tWidth}px`:'';}}else{if(wrapperElem){wrapperElem.style.width=scrollXWidth?`${scrollXWidth}px`:'';}}}if(currScrollElem){currScrollElem.style.height=`${tFooterHeight}px`;// 如果是固定列
|
|
8689
|
-
if(fixedWrapperElem){if(wrapperElem){wrapperElem.style.top=`${customHeight>0?customHeight-tFooterHeight-osbHeight:tableHeight+tHeaderHeight}px`;}}}if(tableElem){tableElem.style.width=tWidth?`${tWidth}px`:'';}}});});if(currentRow){$xeTable.setCurrentRow(currentRow);}if(hasEnableConf(mouseConfig,mouseOpts)&&mouseOpts.selected&&editStore.selected.row&&editStore.selected.column){$xeTable.addCellSelectedClass();}if($xeGanttView&&$xeGanttView.handleUpdateStyle){$xeGanttView.handleUpdateStyle();}return $xeTable.$nextTick();}function
|
|
8689
|
+
if(fixedWrapperElem){if(wrapperElem){wrapperElem.style.top=`${customHeight>0?customHeight-tFooterHeight-osbHeight:tableHeight+tHeaderHeight}px`;}}}if(tableElem){tableElem.style.width=tWidth?`${tWidth}px`:'';}}});});if(currentRow){$xeTable.setCurrentRow(currentRow);}if(hasEnableConf(mouseConfig,mouseOpts)&&mouseOpts.selected&&editStore.selected.row&&editStore.selected.column){$xeTable.addCellSelectedClass();}if($xeGanttView&&$xeGanttView.handleUpdateStyle){$xeGanttView.handleUpdateStyle();}return $xeTable.$nextTick();}/** 仅供显式开启的独立路径使用;不缓存尺寸或延迟写入。 */function setLayoutStyle(element,name,value){const style=element.style;if(style[name]===value){// 原 setter 会清除 !important;值相同但优先级不同时仍必须写入。
|
|
8690
|
+
const cssName=name.replace(/[A-Z]/g,word=>`-${word.toLowerCase()}`);if(!style.getPropertyPriority(cssName))return;}style[name]=value;}function updateStyleWithDedupe($xeTable){const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const $xeGantt=$xeTable.$xeGantt;const{mouseConfig}=props;const{isGroup,tableColumn,overflowX,scrollbarWidth,overflowY,scrollbarHeight,scrollXWidth,columnStore,editStore,isColLoading}=reactData;const{visibleColumn,tableHeight,elemStore,currentRow,customHeight,customMinHeight,customMaxHeight,tHeaderHeight,tFooterHeight}=internalData;const $xeGanttView=internalData.xeGanttView;const el=$xeTable.$refs.refElem;if(!el||internalData.tBodyHeight&&!el.clientHeight){return;}const browseObj=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().browse();const containerList=['main','left','right'];const{leftList,rightList}=columnStore;let osbWidth=overflowY?scrollbarWidth:0;let osbHeight=overflowX?scrollbarHeight:0;const emptyPlaceholderElem=$xeTable.$refs.refEmptyPlaceholder;const isHeaderRenderOptimize=$xeTable.computeIsHeaderRenderOptimize;const isBodyRenderOptimize=$xeTable.computeIsBodyRenderOptimize;const isFooterRenderOptimize=$xeTable.computeIsFooterRenderOptimize;const mouseOpts=$xeTable.computeMouseOpts;const bodyWrapperElem=getRefElem(elemStore['main-body-wrapper']);const bodyTableElem=getRefElem(elemStore['main-body-table']);if(emptyPlaceholderElem){setLayoutStyle(emptyPlaceholderElem,'top',`${tHeaderHeight}px`);setLayoutStyle(emptyPlaceholderElem,'height',bodyWrapperElem?`${bodyWrapperElem.offsetHeight-osbHeight}px`:'');}const scrollXVisible=$xeTable.computeScrollXVisible;const scrollYVisible=$xeTable.computeScrollYVisible;const scrollbarYToLeft=$xeTable.computeScrollbarYToLeft;let xScrollbarVisible=overflowX?'visible':'hidden';const hideXScroll=scrollXVisible===false||scrollXVisible==='hidden';if(scrollXVisible==='visible'||$xeGanttView){osbHeight=scrollbarHeight;xScrollbarVisible='visible';}else if(hideXScroll){osbHeight=0;xScrollbarVisible='hidden';}let yScrollbarVisible=overflowY?'visible':'hidden';const hideYScroll=scrollYVisible===false||scrollYVisible==='hidden';if(hideYScroll||$xeGantt&&$xeGanttView&&$xeGantt.reactData.showRightView&&!scrollbarYToLeft){osbWidth=0;yScrollbarVisible='hidden';}else if(scrollYVisible==='visible'){osbWidth=scrollbarWidth;yScrollbarVisible='visible';}let tbHeight=0;let bodyMaxHeight=0;const bodyMinHeight=customMinHeight-tHeaderHeight-tFooterHeight-osbHeight;if(customMaxHeight){bodyMaxHeight=Math.max(bodyMinHeight,customMaxHeight-tHeaderHeight-tFooterHeight-osbHeight);}if(customHeight){tbHeight=customHeight-tHeaderHeight-tFooterHeight-osbHeight;}if(!tbHeight){if(bodyTableElem){tbHeight=bodyTableElem.clientHeight;}}if(tbHeight){if(bodyMaxHeight){tbHeight=Math.min(bodyMaxHeight,tbHeight);}tbHeight=Math.max(bodyMinHeight,tbHeight);}const xLeftCornerEl=$xeTable.$refs.refScrollXLeftCornerElem;const xRightCornerEl=$xeTable.$refs.refScrollXRightCornerElem;const scrollXVirtualEl=$xeTable.$refs.refScrollXVirtualElem;if(scrollXVirtualEl){setLayoutStyle(scrollXVirtualEl,'height',`${osbHeight}px`);setLayoutStyle(scrollXVirtualEl,'visibility',xScrollbarVisible);}const xWrapperEl=$xeTable.$refs.refScrollXWrapperElem;if(xWrapperEl){setLayoutStyle(xWrapperEl,'width',`${el.clientWidth-osbWidth}px`);if(scrollbarYToLeft){setLayoutStyle(xWrapperEl,'left',`${osbWidth}px`);}else{setLayoutStyle(xWrapperEl,'left','');}}if(xLeftCornerEl){if(scrollbarYToLeft){setLayoutStyle(xLeftCornerEl,'width',`${osbWidth}px`);setLayoutStyle(xLeftCornerEl,'display',overflowY&&osbWidth?'block':'');}else{setLayoutStyle(xLeftCornerEl,'display','');}}if(xRightCornerEl){if(scrollbarYToLeft){setLayoutStyle(xRightCornerEl,'display','');}else{setLayoutStyle(xRightCornerEl,'width',`${osbWidth}px`);setLayoutStyle(xRightCornerEl,'display',xScrollbarVisible==='visible'?'block':'');}}const scrollYVirtualEl=$xeTable.$refs.refScrollYVirtualElem;if(scrollYVirtualEl){setLayoutStyle(scrollYVirtualEl,'width',`${osbWidth}px`);setLayoutStyle(scrollYVirtualEl,'height',`${tbHeight+tHeaderHeight+tFooterHeight}px`);setLayoutStyle(scrollYVirtualEl,'visibility',yScrollbarVisible);}const yTopCornerEl=$xeTable.$refs.refScrollYTopCornerElem;if(yTopCornerEl){setLayoutStyle(yTopCornerEl,'height',`${tHeaderHeight}px`);setLayoutStyle(yTopCornerEl,'display',tHeaderHeight&&yScrollbarVisible==='visible'?'block':'');}const yWrapperEl=$xeTable.$refs.refScrollYWrapperElem;if(yWrapperEl){setLayoutStyle(yWrapperEl,'height',`${tbHeight}px`);setLayoutStyle(yWrapperEl,'top',`${tHeaderHeight}px`);}const yBottomCornerEl=$xeTable.$refs.refScrollYBottomCornerElem;if(yBottomCornerEl){setLayoutStyle(yBottomCornerEl,'height',`${tFooterHeight}px`);setLayoutStyle(yBottomCornerEl,'top',`${tHeaderHeight+tbHeight}px`);setLayoutStyle(yBottomCornerEl,'display',tFooterHeight&&yScrollbarVisible==='visible'?'block':'');}const rowExpandEl=$xeTable.$refs.refRowExpandElem;if(rowExpandEl){setLayoutStyle(rowExpandEl,'height',`${tbHeight}px`);setLayoutStyle(rowExpandEl,'top',`${tHeaderHeight}px`);}internalData.tBodyHeight=tbHeight;containerList.forEach((name,index)=>{const fixedType=index>0?name:'';const layoutList=['header','body','footer'];const isFixedLeft=fixedType==='left';let fixedColumn=[];let fixedWrapperElem;if(fixedType){fixedColumn=isFixedLeft?leftList:rightList;fixedWrapperElem=isFixedLeft?$xeTable.$refs.refLeftContainer:$xeTable.$refs.refRightContainer;}layoutList.forEach(layout=>{const wrapperElem=getRefElem(elemStore[`${name}-${layout}-wrapper`]);const currScrollElem=getRefElem(elemStore[`${name}-${layout}-scroll`]);const tableElem=getRefElem(elemStore[`${name}-${layout}-table`]);if(layout==='header'){// 表头体样式处理
|
|
8691
|
+
// 横向滚动渲染
|
|
8692
|
+
let renderColumnList=tableColumn;const isOptimizeMode=isHeaderRenderOptimize;if(isGroup){renderColumnList=visibleColumn;}else{if(!isOptimizeMode||!isColLoading&&(fixedType||!overflowX)){renderColumnList=visibleColumn;}if(fixedType){// 如果是使用优化模式
|
|
8693
|
+
if(isOptimizeMode){renderColumnList=fixedColumn||[];}}}const tWidth=renderColumnList.reduce((previous,column)=>previous+column.renderWidth,0);if(fixedType){if(isGroup){if(wrapperElem){setLayoutStyle(wrapperElem,'width',scrollXWidth?`${scrollXWidth}px`:'');}}else{if(isOptimizeMode){if(wrapperElem){setLayoutStyle(wrapperElem,'width',tWidth?`${tWidth}px`:'');}}else{if(wrapperElem){setLayoutStyle(wrapperElem,'width',scrollXWidth?`${scrollXWidth}px`:'');}}}}if(currScrollElem){setLayoutStyle(currScrollElem,'height',`${tHeaderHeight}px`);}if(tableElem){setLayoutStyle(tableElem,'width',tWidth?`${tWidth}px`:'');}}else if(layout==='body'){if(currScrollElem){setLayoutStyle(currScrollElem,'maxHeight',customMaxHeight?`${bodyMaxHeight}px`:'');setLayoutStyle(currScrollElem,'height',customHeight?`${tbHeight}px`:'');setLayoutStyle(currScrollElem,'minHeight',`${bodyMinHeight}px`);}// 如果是固定列
|
|
8694
|
+
if(fixedWrapperElem){if(wrapperElem){setLayoutStyle(wrapperElem,'top',`${tHeaderHeight}px`);}setLayoutStyle(fixedWrapperElem,'height',`${customHeight>0?customHeight:tableHeight+tHeaderHeight+tFooterHeight+osbHeight}px`);setLayoutStyle(fixedWrapperElem,'width',`${fixedColumn.reduce((previous,column)=>previous+column.renderWidth,0)}px`);}let renderColumnList=tableColumn;const isOptimizeMode=isBodyRenderOptimize;if(fixedType){renderColumnList=visibleColumn;if(isOptimizeMode){renderColumnList=fixedColumn||[];}}const tWidth=renderColumnList.reduce((previous,column)=>previous+column.renderWidth,0);if(fixedType){if(isOptimizeMode){if(wrapperElem){setLayoutStyle(wrapperElem,'width',tWidth?`${tWidth}px`:'');}}else{if(wrapperElem){setLayoutStyle(wrapperElem,'width',scrollXWidth?`${scrollXWidth}px`:'');}}}if(tableElem){setLayoutStyle(tableElem,'width',tWidth?`${tWidth}px`:'');// 兼容性处理
|
|
8695
|
+
setLayoutStyle(tableElem,'paddingRight',osbWidth&&fixedType&&(browseObj.firefox||browseObj.safari)?`${osbWidth}px`:'');}const emptyBlockElem=getRefElem(elemStore[`${name}-${layout}-emptyBlock`]);if(emptyBlockElem){setLayoutStyle(emptyBlockElem,'width',tWidth?`${tWidth}px`:'');}}else if(layout==='footer'){let renderColumnList=tableColumn;const isOptimizeMode=isFooterRenderOptimize;if(!isOptimizeMode||!isColLoading&&(fixedType||!overflowX)){renderColumnList=visibleColumn;}if(fixedType){if(isOptimizeMode){renderColumnList=fixedColumn||[];}}const tWidth=renderColumnList.reduce((previous,column)=>previous+column.renderWidth,0);if(fixedType){if(isOptimizeMode){if(wrapperElem){setLayoutStyle(wrapperElem,'width',tWidth?`${tWidth}px`:'');}}else{if(wrapperElem){setLayoutStyle(wrapperElem,'width',scrollXWidth?`${scrollXWidth}px`:'');}}}if(currScrollElem){setLayoutStyle(currScrollElem,'height',`${tFooterHeight}px`);// 如果是固定列
|
|
8696
|
+
if(fixedWrapperElem){if(wrapperElem){setLayoutStyle(wrapperElem,'top',`${customHeight>0?customHeight-tFooterHeight-osbHeight:tableHeight+tHeaderHeight}px`);}}}if(tableElem){setLayoutStyle(tableElem,'width',tWidth?`${tWidth}px`:'');}}});});if(currentRow){$xeTable.setCurrentRow(currentRow);}if(hasEnableConf(mouseConfig,mouseOpts)&&mouseOpts.selected&&editStore.selected.row&&editStore.selected.column){$xeTable.addCellSelectedClass();}if($xeGanttView&&$xeGanttView.handleUpdateStyle){$xeGanttView.handleUpdateStyle();}return $xeTable.$nextTick();}function updateScrollXSpaceWithDedupe($xeTable){const reactData=$xeTable;const internalData=$xeTable;const{scrollXLoad,overflowX,scrollXWidth}=reactData;const{visibleColumn,scrollXStore,elemStore,fullColumnIdData}=internalData;const $xeGanttView=internalData.xeGanttView;const mouseOpts=$xeTable.computeMouseOpts;const tableBody=$xeTable.$refs.refTableBody;const tableBodyElem=tableBody?tableBody.$el:null;if(tableBodyElem){const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const bodyTableElem=getRefElem(elemStore['main-body-table']);const headerTableElem=getRefElem(elemStore['main-header-table']);const footerTableElem=getRefElem(elemStore['main-footer-table']);let xSpaceLeft=0;const firstColumn=visibleColumn[scrollXStore.startIndex];if(firstColumn){const colRest=fullColumnIdData[firstColumn.id]||{};xSpaceLeft=colRest.oLeft;}let clientWidth=0;if(bodyScrollElem){clientWidth=bodyScrollElem.clientWidth;}// 虚拟渲染
|
|
8697
|
+
let isScrollXBig=false;let ySpaceWidth=scrollXWidth;if(scrollXWidth>maxXWidth){// 触右
|
|
8698
|
+
if(bodyScrollElem&&bodyTableElem&&bodyScrollElem.scrollLeft+clientWidth>=maxXWidth){xSpaceLeft=maxXWidth-bodyTableElem.clientWidth;}else{xSpaceLeft=(maxXWidth-clientWidth)*(xSpaceLeft/(scrollXWidth-clientWidth));}ySpaceWidth=maxXWidth;isScrollXBig=true;}if(!(scrollXLoad&&overflowX)){xSpaceLeft=0;}if(methods_getConfig().scrollMarginStyle){// 已废弃方式
|
|
8699
|
+
if(headerTableElem){setLayoutStyle(headerTableElem,'marginLeft',headerTableElem.getAttribute('xvm')?`${xSpaceLeft}px`:'');}if(bodyTableElem){setLayoutStyle(bodyTableElem,'marginLeft',`${xSpaceLeft}px`);}if(footerTableElem){setLayoutStyle(footerTableElem,'marginLeft',footerTableElem.getAttribute('xvm')?`${xSpaceLeft}px`:'');}}else{if(headerTableElem){setLayoutStyle(headerTableElem,'transform',headerTableElem.getAttribute('xvm')?`translate(${xSpaceLeft}px, 0px)`:'');}if(bodyTableElem){setLayoutStyle(bodyTableElem,'transform',`translate(${xSpaceLeft}px, ${reactData.scrollYTop||0}px)`);}if(footerTableElem){setLayoutStyle(footerTableElem,'transform',footerTableElem.getAttribute('xvm')?`translate(${xSpaceLeft}px, 0px)`:'');}}const containerList=['main'];containerList.forEach(name=>{const layoutList=['header','body','footer'];layoutList.forEach(layout=>{const xSpaceElem=getRefElem(elemStore[`${name}-${layout}-xSpace`]);if(xSpaceElem){setLayoutStyle(xSpaceElem,'width',scrollXLoad?`${ySpaceWidth}px`:'');}});});reactData.scrollXLeft=xSpaceLeft;reactData.scrollXWidth=ySpaceWidth;reactData.isScrollXBig=isScrollXBig;const scrollXSpaceEl=$xeTable.$refs.refScrollXSpaceElem;if(scrollXSpaceEl){setLayoutStyle(scrollXSpaceEl,'width',`${ySpaceWidth}px`);}calcScrollbar($xeTable);if(isScrollXBig&&mouseOpts.area){methods_errLog('vxe.error.notProp',['mouse-config.area']);}if($xeGanttView&&$xeGanttView.handleUpdateSXSpace){$xeGanttView.handleUpdateSXSpace();}return $xeTable.$nextTick(()=>{updateStyleWithDedupe($xeTable);});}}function checkValidate($xeTable,type){if($xeTable.triggerValidate){return $xeTable.triggerValidate(type);}return $xeTable.$nextTick();}/**
|
|
8690
8700
|
* 当单元格发生改变时
|
|
8691
8701
|
* 如果存在规则,则校验
|
|
8692
8702
|
*/function handleChangeCell($xeTable,evnt,params){checkValidate($xeTable,'blur').catch(e=>e).then(()=>{$xeTable.handleEdit(params,evnt).then(()=>checkValidate($xeTable,'change')).catch(e=>e);});}function handleDefaultSort($xeTable){const props=$xeTable;const{sortConfig}=props;if(sortConfig){const sortOpts=$xeTable.computeSortOpts;let{defaultSort}=sortOpts;if(defaultSort){if(!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(defaultSort)){defaultSort=[defaultSort];}if(defaultSort.length){(sortConfig.multiple?defaultSort:defaultSort.slice(0,1)).forEach((item,index)=>{const{field,order}=item;if(field&&order){const column=$xeTable.getColumnByField(field);if(column&&column.sortable){column.order=order;column.sortTime=Date.now()+index;}}});if(!sortOpts.remote){$xeTable.handleTableData(true).then(updateStyle);}}}}}/**
|
|
@@ -9461,7 +9471,8 @@ if(scrollYVisible===false||scrollYVisible==='hidden'){evnt.preventDefault();retu
|
|
|
9461
9471
|
if($xeParentTable){if(isRollY){if(checkTargetElement(evnt.target,[leftScrollElem,bodyScrollElem,rightScrollElem],evnt.currentTarget)){evnt.stopPropagation();return;}}if(isRollX){if(checkTargetElement(evnt.target,[headerScrollElem,bodyScrollElem,footerScrollElem],evnt.currentTarget)){evnt.stopPropagation();return;}}}if(!(isRollX||leftFixedWidth||rightFixedWidth||expandColumn)){return;}if(rowOpts.isHover||highlightHoverRow){$xeTable.clearHoverRow();}// 用于鼠标纵向滚轮处理
|
|
9462
9472
|
if(isRollX){evnt.preventDefault();internalData.inWheelScroll=true;wheelScrollLeftTo(scrollLeft,offsetLeft=>{setScrollLeft(bodyScrollElem,offsetLeft);// 等待动画帧期间范围可能变化,使用浏览器最终接受的位置同步。
|
|
9463
9473
|
const currLeftNum=bodyScrollElem.scrollLeft;setScrollLeft(xHandleEl,currLeftNum);setScrollLeft(headerScrollElem,currLeftNum);setScrollLeft(footerScrollElem,currLeftNum);if(scrollXLoad){$xeTable.triggerScrollXEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,bodyScrollElem.scrollTop,currLeftNum,{type:'table',fixed:''});},$xeTable);}if(isRollY){evnt.preventDefault();wheelScrollTopTo(scrollTop,offsetTop=>{internalData.inWheelScroll=true;setScrollTop(bodyScrollElem,offsetTop);const currTopNum=bodyScrollElem.scrollTop;setScrollTop(yHandleEl,currTopNum);setScrollTop(leftScrollElem,currTopNum);setScrollTop(rightScrollElem,currTopNum);setScrollTop(rowExpandEl,currTopNum);syncGanttScrollTop($xeTable,currTopNum);if(scrollYLoad){$xeTable.triggerScrollYEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,currTopNum,bodyScrollElem.scrollLeft,{type:'table',fixed:''});},$xeTable);}},triggerVirtualScrollXEvent(evnt){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{scrollXLoad}=reactData;const{elemStore,inWheelScroll,lastScrollTop,inHeaderScroll,inBodyScroll,inFooterScroll}=internalData;if(inHeaderScroll||inBodyScroll||inFooterScroll){return;}if(inWheelScroll){return;}const headerScrollElem=getRefElem(elemStore['main-header-scroll']);const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const footerScrollElem=getRefElem(elemStore['main-footer-scroll']);const yHandleEl=$xeTable.$refs.refScrollYHandleElem;const wrapperEl=evnt.currentTarget;const{scrollLeft}=wrapperEl;const yBodyEl=yHandleEl||bodyScrollElem;let scrollTop=0;if(yBodyEl){scrollTop=yBodyEl.scrollTop;}const isRollX=true;const isRollY=scrollTop!==lastScrollTop;internalData.inVirtualScroll=true;setScrollLeft(bodyScrollElem,scrollLeft);setScrollLeft(headerScrollElem,scrollLeft);setScrollLeft(footerScrollElem,scrollLeft);if(scrollXLoad){$xeTable.triggerScrollXEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,scrollTop,scrollLeft,{type:'table',fixed:''});},triggerVirtualScrollYEvent(evnt){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{scrollYLoad}=reactData;const{elemStore,inWheelScroll,lastScrollLeft,inHeaderScroll,inBodyScroll,inFooterScroll}=internalData;if(inHeaderScroll||inBodyScroll||inFooterScroll){return;}if(inWheelScroll){return;}const leftScrollElem=getRefElem(elemStore['left-body-scroll']);const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const rightScrollElem=getRefElem(elemStore['right-body-scroll']);const rowExpandEl=$xeTable.$refs.refRowExpandElem;const xHandleEl=$xeTable.$refs.refScrollXHandleElem;const wrapperEl=evnt.currentTarget;const{scrollTop}=wrapperEl;const xBodyEl=xHandleEl||bodyScrollElem;let scrollLeft=0;if(xBodyEl){scrollLeft=xBodyEl.scrollLeft;}const isRollX=scrollLeft!==lastScrollLeft;const isRollY=true;internalData.inVirtualScroll=true;setScrollTop(bodyScrollElem,scrollTop);setScrollTop(leftScrollElem,scrollTop);setScrollTop(rightScrollElem,scrollTop);setScrollTop(rowExpandEl,scrollTop);syncGanttScrollTop($xeTable,scrollTop);if(scrollYLoad){$xeTable.triggerScrollYEvent(evnt);}$xeTable.handleScrollEvent(evnt,isRollY,isRollX,scrollTop,scrollLeft,{type:'table',fixed:''});},updateScrollXData(){const $xeTable=this;const reactData=$xeTable;const{isAllOverflow}=reactData;handleTableColumn($xeTable);$xeTable.updateScrollXSpace();return $xeTable.$nextTick().then(()=>{handleTableColumn($xeTable,true);$xeTable.updateScrollXSpace();if(!isAllOverflow){$xeTable.updateScrollYSpace();}});},// 更新横向 X 可视渲染上下剩余空间大小
|
|
9464
|
-
updateScrollXSpace(){
|
|
9474
|
+
updateScrollXSpace(){// 入口只分流一次;关闭时不经过去重函数或逐项样式比较。
|
|
9475
|
+
if(this.computeVirtualXOpts.experimentalSkipUnchangedStyle===true){return updateScrollXSpaceWithDedupe(this);}const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{scrollXLoad,overflowX,scrollXWidth}=reactData;const{visibleColumn,scrollXStore,elemStore,fullColumnIdData}=internalData;const $xeGanttView=internalData.xeGanttView;const mouseOpts=$xeTable.computeMouseOpts;const tableBody=$xeTable.$refs.refTableBody;const tableBodyElem=tableBody?tableBody.$el:null;if(tableBodyElem){const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const bodyTableElem=getRefElem(elemStore['main-body-table']);const headerTableElem=getRefElem(elemStore['main-header-table']);const footerTableElem=getRefElem(elemStore['main-footer-table']);let xSpaceLeft=0;const firstColumn=visibleColumn[scrollXStore.startIndex];if(firstColumn){const colRest=fullColumnIdData[firstColumn.id]||{};xSpaceLeft=colRest.oLeft;}let clientWidth=0;if(bodyScrollElem){clientWidth=bodyScrollElem.clientWidth;}// 虚拟渲染
|
|
9465
9476
|
let isScrollXBig=false;let ySpaceWidth=scrollXWidth;if(scrollXWidth>maxXWidth){// 触右
|
|
9466
9477
|
if(bodyScrollElem&&bodyTableElem&&bodyScrollElem.scrollLeft+clientWidth>=maxXWidth){xSpaceLeft=maxXWidth-bodyTableElem.clientWidth;}else{xSpaceLeft=(maxXWidth-clientWidth)*(xSpaceLeft/(scrollXWidth-clientWidth));}ySpaceWidth=maxXWidth;isScrollXBig=true;}if(!(scrollXLoad&&overflowX)){xSpaceLeft=0;}if(methods_getConfig().scrollMarginStyle){// 已废弃方式
|
|
9467
9478
|
if(headerTableElem){headerTableElem.style.marginLeft=headerTableElem.getAttribute('xvm')?`${xSpaceLeft}px`:'';}if(bodyTableElem){bodyTableElem.style.marginLeft=`${xSpaceLeft}px`;}if(footerTableElem){footerTableElem.style.marginLeft=footerTableElem.getAttribute('xvm')?`${xSpaceLeft}px`:'';}}else{if(headerTableElem){headerTableElem.style.transform=headerTableElem.getAttribute('xvm')?`translate(${xSpaceLeft}px, 0px)`:'';}if(bodyTableElem){bodyTableElem.style.transform=`translate(${xSpaceLeft}px, ${reactData.scrollYTop||0}px)`;}if(footerTableElem){footerTableElem.style.transform=footerTableElem.getAttribute('xvm')?`translate(${xSpaceLeft}px, 0px)`:'';}}const containerList=['main'];containerList.forEach(name=>{const layoutList=['header','body','footer'];layoutList.forEach(layout=>{const xSpaceElem=getRefElem(elemStore[`${name}-${layout}-xSpace`]);if(xSpaceElem){xSpaceElem.style.width=scrollXLoad?`${ySpaceWidth}px`:'';}});});reactData.scrollXLeft=xSpaceLeft;reactData.scrollXWidth=ySpaceWidth;reactData.isScrollXBig=isScrollXBig;const scrollXSpaceEl=$xeTable.$refs.refScrollXSpaceElem;if(scrollXSpaceEl){scrollXSpaceEl.style.width=`${ySpaceWidth}px`;}calcScrollbar($xeTable);if(isScrollXBig&&mouseOpts.area){methods_errLog('vxe.error.notProp',['mouse-config.area']);}if($xeGanttView&&$xeGanttView.handleUpdateSXSpace){$xeGanttView.handleUpdateSXSpace();}return $xeTable.$nextTick(()=>{updateStyle($xeTable);});}},updateScrollYData(){const $xeTable=this;$xeTable.handleTableData();$xeTable.updateScrollYSpace();return $xeTable.$nextTick().then(()=>{$xeTable.handleTableData(false,true);$xeTable.updateScrollYSpace();});},handleSyncScrollTop(params){const $xeTable=this;const internalData=$xeTable;const{scrollTop}=params;const{elemStore}=internalData;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);if(bodyScrollElem){bodyScrollElem.scrollTop=scrollTop;}},// 更新纵向 Y 可视渲染上下剩余空间大小
|
|
@@ -21846,6 +21857,8 @@ function bindScrollbarResize($xeTable) {
|
|
|
21846
21857
|
if (isVScrollbar) {
|
|
21847
21858
|
const el = $xeTable.$refs.refElem;
|
|
21848
21859
|
const viewInnerEl = getRefElem(elemStore['main-body-table']);
|
|
21860
|
+
const viewXSpaceEl = getRefElem(elemStore['main-body-xSpace']);
|
|
21861
|
+
const viewYSpaceEl = getRefElem(elemStore['main-body-ySpace']);
|
|
21849
21862
|
const scrollObserver = table_globalResize.create(() => {
|
|
21850
21863
|
$xeTable.reScrollFlag++;
|
|
21851
21864
|
});
|
|
@@ -21855,6 +21868,12 @@ function bindScrollbarResize($xeTable) {
|
|
|
21855
21868
|
if (viewInnerEl) {
|
|
21856
21869
|
scrollObserver.observe(viewInnerEl);
|
|
21857
21870
|
}
|
|
21871
|
+
if (viewXSpaceEl) {
|
|
21872
|
+
scrollObserver.observe(viewXSpaceEl);
|
|
21873
|
+
}
|
|
21874
|
+
if (viewYSpaceEl) {
|
|
21875
|
+
scrollObserver.observe(viewYSpaceEl);
|
|
21876
|
+
}
|
|
21858
21877
|
internalData.scrollObserver = scrollObserver;
|
|
21859
21878
|
}
|
|
21860
21879
|
}
|
|
@@ -22651,11 +22670,12 @@ function renderVirtualBody(h, $xeTable) {
|
|
|
22651
22670
|
yThumbHeight,
|
|
22652
22671
|
xThumbWidth
|
|
22653
22672
|
} = reactData;
|
|
22673
|
+
const scrollbarOpts = $xeTable.computeScrollbarOpts;
|
|
22654
22674
|
const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
|
|
22655
22675
|
const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
|
|
22656
22676
|
const scrollXVisible = $xeTable.computeScrollXVisible;
|
|
22657
22677
|
const scrollYVisible = $xeTable.computeScrollYVisible;
|
|
22658
|
-
return domUtils.buildClass(['vxe-scrollbar is--virtual', `ov-x--${scrollXVisible === false ? 'hidden' : 'visible'}`, `ov-y--${scrollYVisible === false ? 'hidden' : 'visible'}`, `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`], {
|
|
22678
|
+
return domUtils.buildClass(['vxe-scrollbar is--virtual', scrollbarOpts.fluentOverlay ? 'is--fluent-overlay' : 'is--default-mode', `ov-x--${scrollXVisible === false ? 'hidden' : 'visible'}`, `ov-y--${scrollYVisible === false ? 'hidden' : 'visible'}`, `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`], {
|
|
22659
22679
|
'overflow-y': yThumbHeight,
|
|
22660
22680
|
'overflow-x': xThumbWidth
|
|
22661
22681
|
});
|