vxe-table 4.10.13 → 4.10.15-beta.0
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/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/edit/hook.js +138 -128
- package/es/table/src/body.js +57 -43
- package/es/table/src/table.js +236 -51
- package/es/table/style.css +26 -0
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +26 -0
- 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 +531 -265
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/edit/hook.js +169 -154
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/src/body.js +65 -58
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/table.js +293 -49
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +26 -0
- package/lib/table/style/style.min.css +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/lib/vxe-table/style/style.css +26 -0
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/table/module/edit/hook.ts +141 -129
- package/packages/table/src/body.ts +60 -50
- package/packages/table/src/table.ts +247 -51
- package/styles/components/table.scss +26 -0
- /package/es/{iconfont.1739257038865.ttf → iconfont.1739426300784.ttf} +0 -0
- /package/es/{iconfont.1739257038865.woff → iconfont.1739426300784.woff} +0 -0
- /package/es/{iconfont.1739257038865.woff2 → iconfont.1739426300784.woff2} +0 -0
- /package/lib/{iconfont.1739257038865.ttf → iconfont.1739426300784.ttf} +0 -0
- /package/lib/{iconfont.1739257038865.woff → iconfont.1739426300784.woff} +0 -0
- /package/lib/{iconfont.1739257038865.woff2 → iconfont.1739426300784.woff2} +0 -0
package/es/table/src/table.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, h, reactive, ref, provide, inject, nextTick, onActivated, onDeactivated, onBeforeUnmount, onUnmounted, watch, computed, onMounted } from 'vue';
|
|
2
2
|
import XEUtils from 'xe-utils';
|
|
3
|
-
import { browse, initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, getOffsetPos, setScrollTop, setScrollLeft } from '../../ui/src/dom';
|
|
3
|
+
import { browse, initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, getOffsetPos, setScrollTop, setScrollLeft, toCssUnit } from '../../ui/src/dom';
|
|
4
4
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
|
|
5
5
|
import { VxeUI } from '../../ui';
|
|
6
6
|
import Cell from './cell';
|
|
@@ -250,8 +250,9 @@ export default defineComponent({
|
|
|
250
250
|
mini: 36
|
|
251
251
|
},
|
|
252
252
|
scrollVMLoading: false,
|
|
253
|
+
rowExpandHeightFlag: 1,
|
|
253
254
|
calcCellHeightFlag: 1,
|
|
254
|
-
resizeHeightFlag:
|
|
255
|
+
resizeHeightFlag: 1,
|
|
255
256
|
isCustomStatus: false,
|
|
256
257
|
isDragRowMove: false,
|
|
257
258
|
dragRow: null,
|
|
@@ -368,6 +369,8 @@ export default defineComponent({
|
|
|
368
369
|
const refDragTipElem = ref();
|
|
369
370
|
const refDragRowLineElem = ref();
|
|
370
371
|
const refDragColLineElem = ref();
|
|
372
|
+
const refRowExpandElem = ref();
|
|
373
|
+
const refRowExpandYSpaceElem = ref();
|
|
371
374
|
const refScrollXVirtualElem = ref();
|
|
372
375
|
const refScrollYVirtualElem = ref();
|
|
373
376
|
const refScrollXHandleElem = ref();
|
|
@@ -604,6 +607,22 @@ export default defineComponent({
|
|
|
604
607
|
const computeCustomOpts = computed(() => {
|
|
605
608
|
return Object.assign({}, getConfig().table.customConfig, props.customConfig);
|
|
606
609
|
});
|
|
610
|
+
const computeTableRowExpandedList = computed(() => {
|
|
611
|
+
const { rowExpandedMaps, tableData, expandColumn } = reactData;
|
|
612
|
+
const expandList = [];
|
|
613
|
+
if (expandColumn) {
|
|
614
|
+
const rowKeys = {};
|
|
615
|
+
tableData.forEach(row => {
|
|
616
|
+
rowKeys[getRowid($xeTable, row)] = true;
|
|
617
|
+
});
|
|
618
|
+
XEUtils.each(rowExpandedMaps, (row, rowid) => {
|
|
619
|
+
if (rowKeys[rowid]) {
|
|
620
|
+
expandList.push(row);
|
|
621
|
+
}
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
return expandList;
|
|
625
|
+
});
|
|
607
626
|
const computeAutoWidthColumnList = computed(() => {
|
|
608
627
|
const { visibleColumn } = internalData;
|
|
609
628
|
const { tableColumn } = reactData;
|
|
@@ -842,6 +861,12 @@ export default defineComponent({
|
|
|
842
861
|
}
|
|
843
862
|
return { toVisibleIndex: 0, visibleSize: 6 };
|
|
844
863
|
};
|
|
864
|
+
const calcVarRowHeightConfig = (sizeKey, sizeEl) => {
|
|
865
|
+
const { rowHeightStore } = reactData;
|
|
866
|
+
if (sizeEl && sizeEl.clientHeight) {
|
|
867
|
+
rowHeightStore[sizeKey] = sizeEl.clientHeight;
|
|
868
|
+
}
|
|
869
|
+
};
|
|
845
870
|
const computeRowHeight = () => {
|
|
846
871
|
const { isAllOverflow } = reactData;
|
|
847
872
|
const tableHeader = refTableHeader.value;
|
|
@@ -872,8 +897,9 @@ export default defineComponent({
|
|
|
872
897
|
return Math.max(18, rowHeight);
|
|
873
898
|
};
|
|
874
899
|
const handleVirtualYVisible = (currScrollTop) => {
|
|
875
|
-
const { isAllOverflow } = reactData;
|
|
900
|
+
const { isAllOverflow, expandColumn, rowExpandedMaps } = reactData;
|
|
876
901
|
const { elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData;
|
|
902
|
+
const expandOpts = computeExpandOpts.value;
|
|
877
903
|
const rowOpts = computeRowOpts.value;
|
|
878
904
|
const cellOpts = computeCellOpts.value;
|
|
879
905
|
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
@@ -886,7 +912,7 @@ export default defineComponent({
|
|
|
886
912
|
let offsetTop = 0;
|
|
887
913
|
let visibleSize = 0;
|
|
888
914
|
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
|
|
889
|
-
if (!isCustomCellHeight && isAllOverflow) {
|
|
915
|
+
if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
|
|
890
916
|
toVisibleIndex = Math.floor(scrollTop / defaultRowHeight);
|
|
891
917
|
visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
|
|
892
918
|
}
|
|
@@ -905,6 +931,10 @@ export default defineComponent({
|
|
|
905
931
|
break;
|
|
906
932
|
}
|
|
907
933
|
}
|
|
934
|
+
// 是否展开行
|
|
935
|
+
if (expandColumn && rowExpandedMaps[rowid]) {
|
|
936
|
+
offsetTop += rowRest.expandHeight || expandOpts.height || 0;
|
|
937
|
+
}
|
|
908
938
|
}
|
|
909
939
|
}
|
|
910
940
|
return { toVisibleIndex: Math.max(0, toVisibleIndex), visibleSize: Math.max(6, visibleSize) };
|
|
@@ -1456,7 +1486,7 @@ export default defineComponent({
|
|
|
1456
1486
|
rowRest._index = index;
|
|
1457
1487
|
}
|
|
1458
1488
|
else {
|
|
1459
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 };
|
|
1489
|
+
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
1460
1490
|
fullAllDataRowIdData[rowid] = rest;
|
|
1461
1491
|
fullDataRowIdData[rowid] = rest;
|
|
1462
1492
|
}
|
|
@@ -1485,7 +1515,7 @@ export default defineComponent({
|
|
|
1485
1515
|
rowRest.treeIndex = index;
|
|
1486
1516
|
}
|
|
1487
1517
|
else {
|
|
1488
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 };
|
|
1518
|
+
const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
1489
1519
|
fullAllDataRowIdData[rowid] = rest;
|
|
1490
1520
|
fullDataRowIdData[rowid] = rest;
|
|
1491
1521
|
}
|
|
@@ -1695,6 +1725,7 @@ export default defineComponent({
|
|
|
1695
1725
|
const emptyPlaceholderElem = refEmptyPlaceholder.value;
|
|
1696
1726
|
const cellOffsetWidth = computeCellOffsetWidth.value;
|
|
1697
1727
|
const mouseOpts = computeMouseOpts.value;
|
|
1728
|
+
const expandOpts = computeExpandOpts.value;
|
|
1698
1729
|
const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper']);
|
|
1699
1730
|
const bodyTableElem = getRefElem(elemStore['main-body-table']);
|
|
1700
1731
|
if (emptyPlaceholderElem) {
|
|
@@ -1764,6 +1795,11 @@ export default defineComponent({
|
|
|
1764
1795
|
yBottomCornerEl.style.top = `${headerHeight + bodyHeight}px`;
|
|
1765
1796
|
yBottomCornerEl.style.display = footerHeight ? 'block' : '';
|
|
1766
1797
|
}
|
|
1798
|
+
const rowExpandEl = refRowExpandElem.value;
|
|
1799
|
+
if (rowExpandEl) {
|
|
1800
|
+
rowExpandEl.style.height = `${bodyHeight}px`;
|
|
1801
|
+
rowExpandEl.style.top = `${headerHeight}px`;
|
|
1802
|
+
}
|
|
1767
1803
|
containerList.forEach((name, index) => {
|
|
1768
1804
|
const fixedType = index > 0 ? name : '';
|
|
1769
1805
|
const layoutList = ['header', 'body', 'footer'];
|
|
@@ -1872,7 +1908,7 @@ export default defineComponent({
|
|
|
1872
1908
|
let isOptimizeMode = false;
|
|
1873
1909
|
// 如果是使用优化模式
|
|
1874
1910
|
if (scrollXLoad || scrollYLoad || isAllOverflow) {
|
|
1875
|
-
if (expandColumn || spanMethod || footerSpanMethod) {
|
|
1911
|
+
if ((expandColumn && expandOpts.mode !== 'fixed') || spanMethod || footerSpanMethod) {
|
|
1876
1912
|
// 如果不支持优化模式
|
|
1877
1913
|
}
|
|
1878
1914
|
else {
|
|
@@ -2524,15 +2560,25 @@ export default defineComponent({
|
|
|
2524
2560
|
if (!el || !el.clientWidth) {
|
|
2525
2561
|
return nextTick();
|
|
2526
2562
|
}
|
|
2563
|
+
const varEl = refVarElem.value;
|
|
2564
|
+
if (varEl) {
|
|
2565
|
+
const [defEl, mediumEl, smallEl, miniEl] = varEl.children;
|
|
2566
|
+
calcVarRowHeightConfig('default', defEl);
|
|
2567
|
+
calcVarRowHeightConfig('medium', mediumEl);
|
|
2568
|
+
calcVarRowHeightConfig('small', smallEl);
|
|
2569
|
+
calcVarRowHeightConfig('mini', miniEl);
|
|
2570
|
+
}
|
|
2527
2571
|
calcCellWidth();
|
|
2528
2572
|
autoCellWidth();
|
|
2529
2573
|
updateStyle();
|
|
2574
|
+
updateRowExpandStyle();
|
|
2530
2575
|
return computeScrollLoad().then(() => {
|
|
2531
2576
|
if (reFull === true) {
|
|
2532
2577
|
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
2533
2578
|
calcCellWidth();
|
|
2534
2579
|
autoCellWidth();
|
|
2535
2580
|
updateStyle();
|
|
2581
|
+
updateRowExpandStyle();
|
|
2536
2582
|
return computeScrollLoad();
|
|
2537
2583
|
}
|
|
2538
2584
|
});
|
|
@@ -3240,6 +3286,62 @@ export default defineComponent({
|
|
|
3240
3286
|
setTimeout(() => $xeTable.recalculate(true), 300);
|
|
3241
3287
|
});
|
|
3242
3288
|
};
|
|
3289
|
+
const updateRowExpandStyle = () => {
|
|
3290
|
+
const { expandColumn, scrollYLoad, rowExpandedMaps } = reactData;
|
|
3291
|
+
const expandOpts = computeExpandOpts.value;
|
|
3292
|
+
const rowOpts = computeRowOpts.value;
|
|
3293
|
+
const cellOpts = computeCellOpts.value;
|
|
3294
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
3295
|
+
const { mode } = expandOpts;
|
|
3296
|
+
if (expandColumn && mode === 'fixed') {
|
|
3297
|
+
const { elemStore, afterFullData, fullAllDataRowIdData } = internalData;
|
|
3298
|
+
const rowExpandEl = refRowExpandElem.value;
|
|
3299
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
3300
|
+
if (rowExpandEl && bodyScrollElem) {
|
|
3301
|
+
let isUpdateHeight = false;
|
|
3302
|
+
if (scrollYLoad) {
|
|
3303
|
+
let offsetTop = 0;
|
|
3304
|
+
for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
3305
|
+
const row = afterFullData[rIndex];
|
|
3306
|
+
const rowid = getRowid($xeTable, row);
|
|
3307
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
3308
|
+
rowRest.oTop = offsetTop;
|
|
3309
|
+
offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
3310
|
+
// 是否展开行
|
|
3311
|
+
if (expandColumn && rowExpandedMaps[rowid]) {
|
|
3312
|
+
offsetTop += rowRest.expandHeight || expandOpts.height || 0;
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
}
|
|
3316
|
+
XEUtils.arrayEach(rowExpandEl.children, reEl => {
|
|
3317
|
+
const expandEl = reEl;
|
|
3318
|
+
const rowid = expandEl.getAttribute('rowid') || '';
|
|
3319
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
3320
|
+
if (rowRest) {
|
|
3321
|
+
const expandHeight = expandEl.offsetHeight + 1;
|
|
3322
|
+
if (scrollYLoad) {
|
|
3323
|
+
expandEl.style.top = toCssUnit(rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight));
|
|
3324
|
+
}
|
|
3325
|
+
else {
|
|
3326
|
+
const trEl = bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);
|
|
3327
|
+
if (trEl) {
|
|
3328
|
+
expandEl.style.top = toCssUnit(trEl.offsetTop + trEl.offsetHeight);
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
if (!isUpdateHeight) {
|
|
3332
|
+
if (rowRest.expandHeight !== expandHeight) {
|
|
3333
|
+
isUpdateHeight = true;
|
|
3334
|
+
}
|
|
3335
|
+
}
|
|
3336
|
+
rowRest.expandHeight = expandHeight;
|
|
3337
|
+
}
|
|
3338
|
+
});
|
|
3339
|
+
if (isUpdateHeight) {
|
|
3340
|
+
reactData.rowExpandHeightFlag++;
|
|
3341
|
+
}
|
|
3342
|
+
}
|
|
3343
|
+
}
|
|
3344
|
+
};
|
|
3243
3345
|
tableMethods = {
|
|
3244
3346
|
dispatchEvent,
|
|
3245
3347
|
/**
|
|
@@ -3401,7 +3503,7 @@ export default defineComponent({
|
|
|
3401
3503
|
XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
|
|
3402
3504
|
const rowid = getRowid($xeTable, childRow);
|
|
3403
3505
|
const parentRow = parentItem || parentRest.row;
|
|
3404
|
-
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 };
|
|
3506
|
+
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, expandHeight: 0 };
|
|
3405
3507
|
fullDataRowIdData[rowid] = rest;
|
|
3406
3508
|
fullAllDataRowIdData[rowid] = rest;
|
|
3407
3509
|
}, { children: childrenField });
|
|
@@ -4259,6 +4361,7 @@ export default defineComponent({
|
|
|
4259
4361
|
const el = refElem.value;
|
|
4260
4362
|
if (el && el.clientWidth) {
|
|
4261
4363
|
autoCellWidth();
|
|
4364
|
+
updateRowExpandStyle();
|
|
4262
4365
|
}
|
|
4263
4366
|
if (rceTimeout) {
|
|
4264
4367
|
clearTimeout(rceTimeout);
|
|
@@ -6525,7 +6628,7 @@ export default defineComponent({
|
|
|
6525
6628
|
}
|
|
6526
6629
|
let cacheItem = fullAllDataRowIdData[rowid];
|
|
6527
6630
|
if (isReset || !cacheItem) {
|
|
6528
|
-
cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0 };
|
|
6631
|
+
cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
6529
6632
|
}
|
|
6530
6633
|
cacheItem.row = row;
|
|
6531
6634
|
cacheItem.items = items;
|
|
@@ -8468,6 +8571,7 @@ export default defineComponent({
|
|
|
8468
8571
|
isLeft,
|
|
8469
8572
|
isRight,
|
|
8470
8573
|
direction }, params);
|
|
8574
|
+
updateRowExpandStyle();
|
|
8471
8575
|
checkLastSyncScroll(isRollX, isRollY);
|
|
8472
8576
|
if (rowOpts.isHover || highlightHoverRow) {
|
|
8473
8577
|
$xeTable.clearHoverRow();
|
|
@@ -8508,6 +8612,7 @@ export default defineComponent({
|
|
|
8508
8612
|
}
|
|
8509
8613
|
},
|
|
8510
8614
|
triggerBodyScrollEvent(evnt, fixedType) {
|
|
8615
|
+
const { scrollYLoad, scrollXLoad } = reactData;
|
|
8511
8616
|
const { elemStore, intoRunScroll, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData;
|
|
8512
8617
|
const xHandleEl = refScrollXHandleElem.value;
|
|
8513
8618
|
const yHandleEl = refScrollYHandleElem.value;
|
|
@@ -8516,6 +8621,7 @@ export default defineComponent({
|
|
|
8516
8621
|
const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
|
|
8517
8622
|
const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
|
|
8518
8623
|
const footerScrollElem = getRefElem(elemStore['main-footer-scroll']);
|
|
8624
|
+
const rowExpandEl = refRowExpandElem.value;
|
|
8519
8625
|
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
|
|
8520
8626
|
return;
|
|
8521
8627
|
}
|
|
@@ -8566,13 +8672,18 @@ export default defineComponent({
|
|
|
8566
8672
|
setScrollTop(rightScrollElem, scrollTop);
|
|
8567
8673
|
}
|
|
8568
8674
|
setScrollTop(yHandleEl, scrollTop);
|
|
8569
|
-
|
|
8675
|
+
setScrollTop(rowExpandEl, scrollTop);
|
|
8676
|
+
if (scrollYLoad) {
|
|
8677
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
8678
|
+
}
|
|
8570
8679
|
}
|
|
8571
8680
|
if (isRollX) {
|
|
8572
8681
|
setScrollLeft(xHandleEl, scrollLeft);
|
|
8573
8682
|
setScrollLeft(headerScrollElem, scrollLeft);
|
|
8574
8683
|
setScrollLeft(footerScrollElem, scrollLeft);
|
|
8575
|
-
|
|
8684
|
+
if (scrollXLoad) {
|
|
8685
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
8686
|
+
}
|
|
8576
8687
|
}
|
|
8577
8688
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8578
8689
|
type: 'body',
|
|
@@ -8580,6 +8691,7 @@ export default defineComponent({
|
|
|
8580
8691
|
});
|
|
8581
8692
|
},
|
|
8582
8693
|
triggerHeaderScrollEvent(evnt, fixedType) {
|
|
8694
|
+
const { scrollXLoad } = reactData;
|
|
8583
8695
|
const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
8584
8696
|
const yHandleEl = refScrollYHandleElem.value;
|
|
8585
8697
|
const xHandleEl = refScrollXHandleElem.value;
|
|
@@ -8609,13 +8721,16 @@ export default defineComponent({
|
|
|
8609
8721
|
setScrollLeft(xHandleEl, scrollLeft);
|
|
8610
8722
|
setScrollLeft(footerScrollElem, scrollLeft);
|
|
8611
8723
|
setScrollLeft(bodyScrollElem, scrollLeft);
|
|
8612
|
-
|
|
8724
|
+
if (scrollXLoad) {
|
|
8725
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
8726
|
+
}
|
|
8613
8727
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8614
8728
|
type: 'header',
|
|
8615
8729
|
fixed: fixedType
|
|
8616
8730
|
});
|
|
8617
8731
|
},
|
|
8618
8732
|
triggerFooterScrollEvent(evnt, fixedType) {
|
|
8733
|
+
const { scrollXLoad } = reactData;
|
|
8619
8734
|
const { elemStore, intoRunScroll, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData;
|
|
8620
8735
|
const yHandleEl = refScrollYHandleElem.value;
|
|
8621
8736
|
const xHandleEl = refScrollXHandleElem.value;
|
|
@@ -8645,7 +8760,9 @@ export default defineComponent({
|
|
|
8645
8760
|
setScrollLeft(xHandleEl, scrollLeft);
|
|
8646
8761
|
setScrollLeft(headerScrollElem, scrollLeft);
|
|
8647
8762
|
setScrollLeft(bodyScrollElem, scrollLeft);
|
|
8648
|
-
|
|
8763
|
+
if (scrollXLoad) {
|
|
8764
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
8765
|
+
}
|
|
8649
8766
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8650
8767
|
type: 'footer',
|
|
8651
8768
|
fixed: fixedType
|
|
@@ -8657,6 +8774,7 @@ export default defineComponent({
|
|
|
8657
8774
|
return;
|
|
8658
8775
|
}
|
|
8659
8776
|
const { highlightHoverRow } = tableProps;
|
|
8777
|
+
const { scrollYLoad } = reactData;
|
|
8660
8778
|
const { elemStore, lastScrollTop, lastScrollLeft } = internalData;
|
|
8661
8779
|
const rowOpts = computeRowOpts.value;
|
|
8662
8780
|
const xHandleEl = refScrollXHandleElem.value;
|
|
@@ -8664,6 +8782,7 @@ export default defineComponent({
|
|
|
8664
8782
|
const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
|
|
8665
8783
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
8666
8784
|
const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
|
|
8785
|
+
const rowExpandEl = refRowExpandElem.value;
|
|
8667
8786
|
if (!xHandleEl) {
|
|
8668
8787
|
return;
|
|
8669
8788
|
}
|
|
@@ -8699,25 +8818,19 @@ export default defineComponent({
|
|
|
8699
8818
|
setScrollTop(bodyScrollElem, currTopNum);
|
|
8700
8819
|
setScrollTop(leftScrollElem, currTopNum);
|
|
8701
8820
|
setScrollTop(rightScrollElem, currTopNum);
|
|
8702
|
-
|
|
8821
|
+
setScrollTop(rowExpandEl, currTopNum);
|
|
8822
|
+
if (scrollYLoad) {
|
|
8823
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
8824
|
+
}
|
|
8703
8825
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, currTopNum, scrollLeft, {
|
|
8704
8826
|
type: 'table',
|
|
8705
8827
|
fixed: ''
|
|
8706
8828
|
});
|
|
8707
8829
|
});
|
|
8708
|
-
// internalData.inWheelScroll = true
|
|
8709
|
-
// setScrollTop(yHandleEl, scrollTop)
|
|
8710
|
-
// setScrollTop(bodyScrollElem, scrollTop)
|
|
8711
|
-
// setScrollTop(leftScrollElem, scrollTop)
|
|
8712
|
-
// setScrollTop(rightScrollElem, scrollTop)
|
|
8713
|
-
// loadScrollYData(scrollTop)
|
|
8714
|
-
// $xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8715
|
-
// type: 'footer',
|
|
8716
|
-
// fixed: ''
|
|
8717
|
-
// })
|
|
8718
8830
|
}
|
|
8719
8831
|
},
|
|
8720
8832
|
triggerVirtualScrollXEvent(evnt) {
|
|
8833
|
+
const { scrollXLoad } = reactData;
|
|
8721
8834
|
const { elemStore, inWheelScroll, lastScrollTop, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
8722
8835
|
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
8723
8836
|
return;
|
|
@@ -8742,13 +8855,16 @@ export default defineComponent({
|
|
|
8742
8855
|
setScrollLeft(bodyScrollElem, scrollLeft);
|
|
8743
8856
|
setScrollLeft(headerScrollElem, scrollLeft);
|
|
8744
8857
|
setScrollLeft(footerScrollElem, scrollLeft);
|
|
8745
|
-
|
|
8858
|
+
if (scrollXLoad) {
|
|
8859
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
8860
|
+
}
|
|
8746
8861
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8747
8862
|
type: 'table',
|
|
8748
8863
|
fixed: ''
|
|
8749
8864
|
});
|
|
8750
8865
|
},
|
|
8751
8866
|
triggerVirtualScrollYEvent(evnt) {
|
|
8867
|
+
const { scrollYLoad } = reactData;
|
|
8752
8868
|
const { elemStore, inWheelScroll, lastScrollLeft, inHeaderScroll, inBodyScroll, inFooterScroll } = internalData;
|
|
8753
8869
|
if (inHeaderScroll || inBodyScroll || inFooterScroll) {
|
|
8754
8870
|
return;
|
|
@@ -8759,6 +8875,7 @@ export default defineComponent({
|
|
|
8759
8875
|
const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
|
|
8760
8876
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
8761
8877
|
const rightScrollElem = getRefElem(elemStore['right-body-scroll']);
|
|
8878
|
+
const rowExpandEl = refRowExpandElem.value;
|
|
8762
8879
|
const xHandleEl = refScrollXHandleElem.value;
|
|
8763
8880
|
const wrapperEl = evnt.currentTarget;
|
|
8764
8881
|
const { scrollTop } = wrapperEl;
|
|
@@ -8773,7 +8890,10 @@ export default defineComponent({
|
|
|
8773
8890
|
setScrollTop(bodyScrollElem, scrollTop);
|
|
8774
8891
|
setScrollTop(leftScrollElem, scrollTop);
|
|
8775
8892
|
setScrollTop(rightScrollElem, scrollTop);
|
|
8776
|
-
|
|
8893
|
+
setScrollTop(rowExpandEl, scrollTop);
|
|
8894
|
+
if (scrollYLoad) {
|
|
8895
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
8896
|
+
}
|
|
8777
8897
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
8778
8898
|
type: 'table',
|
|
8779
8899
|
fixed: ''
|
|
@@ -8851,9 +8971,10 @@ export default defineComponent({
|
|
|
8851
8971
|
},
|
|
8852
8972
|
// 更新纵向 Y 可视渲染上下剩余空间大小
|
|
8853
8973
|
updateScrollYSpace() {
|
|
8854
|
-
const { isAllOverflow, scrollYLoad } = reactData;
|
|
8974
|
+
const { isAllOverflow, scrollYLoad, expandColumn, rowExpandedMaps } = reactData;
|
|
8855
8975
|
const { scrollYStore, elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData;
|
|
8856
8976
|
const { startIndex } = scrollYStore;
|
|
8977
|
+
const expandOpts = computeExpandOpts.value;
|
|
8857
8978
|
const rowOpts = computeRowOpts.value;
|
|
8858
8979
|
const cellOpts = computeCellOpts.value;
|
|
8859
8980
|
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
@@ -8863,7 +8984,7 @@ export default defineComponent({
|
|
|
8863
8984
|
let ySpaceHeight = 0;
|
|
8864
8985
|
if (scrollYLoad) {
|
|
8865
8986
|
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
|
|
8866
|
-
if (!isCustomCellHeight && isAllOverflow) {
|
|
8987
|
+
if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
|
|
8867
8988
|
ySpaceHeight = afterFullData.length * defaultRowHeight;
|
|
8868
8989
|
topSpaceHeight = Math.max(0, startIndex * defaultRowHeight);
|
|
8869
8990
|
}
|
|
@@ -8873,12 +8994,20 @@ export default defineComponent({
|
|
|
8873
8994
|
const rowid = getRowid($xeTable, row);
|
|
8874
8995
|
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
8875
8996
|
ySpaceHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
8997
|
+
// 是否展开行
|
|
8998
|
+
if (expandColumn && rowExpandedMaps[rowid]) {
|
|
8999
|
+
ySpaceHeight += rowRest.expandHeight || expandOpts.height || 0;
|
|
9000
|
+
}
|
|
8876
9001
|
}
|
|
8877
9002
|
for (let i = 0; i < startIndex; i++) {
|
|
8878
9003
|
const row = afterFullData[i];
|
|
8879
9004
|
const rowid = getRowid($xeTable, row);
|
|
8880
9005
|
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
8881
9006
|
topSpaceHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
9007
|
+
// 是否展开行
|
|
9008
|
+
if (expandColumn && rowExpandedMaps[rowid]) {
|
|
9009
|
+
topSpaceHeight += rowRest.expandHeight || expandOpts.height || 0;
|
|
9010
|
+
}
|
|
8882
9011
|
}
|
|
8883
9012
|
}
|
|
8884
9013
|
}
|
|
@@ -8904,6 +9033,10 @@ export default defineComponent({
|
|
|
8904
9033
|
if (scrollYSpaceEl) {
|
|
8905
9034
|
scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
|
|
8906
9035
|
}
|
|
9036
|
+
const rowExpandYSpaceEl = refRowExpandYSpaceElem.value;
|
|
9037
|
+
if (rowExpandYSpaceEl) {
|
|
9038
|
+
rowExpandYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
|
|
9039
|
+
}
|
|
8907
9040
|
return nextTick().then(() => {
|
|
8908
9041
|
updateStyle();
|
|
8909
9042
|
});
|
|
@@ -8911,6 +9044,7 @@ export default defineComponent({
|
|
|
8911
9044
|
updateScrollXData() {
|
|
8912
9045
|
const { isAllOverflow } = reactData;
|
|
8913
9046
|
handleTableColumn();
|
|
9047
|
+
$xeTable.updateScrollYSpace();
|
|
8914
9048
|
return nextTick().then(() => {
|
|
8915
9049
|
handleTableColumn();
|
|
8916
9050
|
$xeTable.updateScrollXSpace();
|
|
@@ -8921,6 +9055,7 @@ export default defineComponent({
|
|
|
8921
9055
|
},
|
|
8922
9056
|
updateScrollYData() {
|
|
8923
9057
|
$xeTable.handleTableData();
|
|
9058
|
+
$xeTable.updateScrollYSpace();
|
|
8924
9059
|
return nextTick().then(() => {
|
|
8925
9060
|
$xeTable.handleTableData();
|
|
8926
9061
|
$xeTable.updateScrollYSpace();
|
|
@@ -9148,6 +9283,69 @@ export default defineComponent({
|
|
|
9148
9283
|
}
|
|
9149
9284
|
return renderEmptyElement($xeTable);
|
|
9150
9285
|
};
|
|
9286
|
+
const renderRowExpandedVNs = () => {
|
|
9287
|
+
const { treeConfig } = props;
|
|
9288
|
+
const { expandColumn } = reactData;
|
|
9289
|
+
const tableRowExpandedList = computeTableRowExpandedList.value;
|
|
9290
|
+
const expandOpts = computeExpandOpts.value;
|
|
9291
|
+
const { mode } = expandOpts;
|
|
9292
|
+
if (mode !== 'fixed') {
|
|
9293
|
+
return renderEmptyElement($xeTable);
|
|
9294
|
+
}
|
|
9295
|
+
const expandVNs = [
|
|
9296
|
+
h('div', {
|
|
9297
|
+
key: 'repY',
|
|
9298
|
+
ref: refRowExpandYSpaceElem
|
|
9299
|
+
})
|
|
9300
|
+
];
|
|
9301
|
+
if (expandColumn) {
|
|
9302
|
+
tableRowExpandedList.forEach((row) => {
|
|
9303
|
+
const expandOpts = computeExpandOpts.value;
|
|
9304
|
+
const { height: expandHeight, padding } = expandOpts;
|
|
9305
|
+
const { fullAllDataRowIdData } = internalData;
|
|
9306
|
+
const treeOpts = computeTreeOpts.value;
|
|
9307
|
+
const { transform, seqMode } = treeOpts;
|
|
9308
|
+
const cellStyle = {};
|
|
9309
|
+
const rowid = getRowid($xeTable, row);
|
|
9310
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
9311
|
+
let rowLevel = 0;
|
|
9312
|
+
let seq = -1;
|
|
9313
|
+
let _rowIndex = 0;
|
|
9314
|
+
const rowIndex = $xeTable.getRowIndex(row);
|
|
9315
|
+
const $rowIndex = $xeTable.getVMRowIndex(row);
|
|
9316
|
+
if (rest) {
|
|
9317
|
+
rowLevel = rest.level;
|
|
9318
|
+
if (treeConfig && transform && seqMode === 'increasing') {
|
|
9319
|
+
seq = rest._index + 1;
|
|
9320
|
+
}
|
|
9321
|
+
else {
|
|
9322
|
+
seq = rest.seq;
|
|
9323
|
+
}
|
|
9324
|
+
_rowIndex = rest._index;
|
|
9325
|
+
}
|
|
9326
|
+
if (expandHeight) {
|
|
9327
|
+
cellStyle.height = `${expandHeight}px`;
|
|
9328
|
+
}
|
|
9329
|
+
if (treeConfig) {
|
|
9330
|
+
cellStyle.paddingLeft = `${(rowLevel * treeOpts.indent) + 30}px`;
|
|
9331
|
+
}
|
|
9332
|
+
const expandParams = { $table: $xeTable, seq, column: expandColumn, fixed: '', type: 'body', level: rowLevel, row, rowIndex, $rowIndex, _rowIndex };
|
|
9333
|
+
expandVNs.push(h('div', {
|
|
9334
|
+
key: rowid,
|
|
9335
|
+
class: ['vxe-body--row-expanded-cell', {
|
|
9336
|
+
'is--padding': padding,
|
|
9337
|
+
'is--ellipsis': expandHeight
|
|
9338
|
+
}],
|
|
9339
|
+
rowid,
|
|
9340
|
+
style: cellStyle
|
|
9341
|
+
}, expandColumn.renderData(expandParams)));
|
|
9342
|
+
});
|
|
9343
|
+
}
|
|
9344
|
+
return h('div', {
|
|
9345
|
+
ref: refRowExpandElem,
|
|
9346
|
+
class: 'vxe-table--row-expanded-wrapper'
|
|
9347
|
+
}, expandVNs);
|
|
9348
|
+
};
|
|
9151
9349
|
const renderScrollX = () => {
|
|
9152
9350
|
return h('div', {
|
|
9153
9351
|
key: 'vsx',
|
|
@@ -9211,12 +9409,15 @@ export default defineComponent({
|
|
|
9211
9409
|
};
|
|
9212
9410
|
const renderViewport = () => {
|
|
9213
9411
|
const { showHeader, showFooter } = props;
|
|
9214
|
-
const { overflowX, tableData, tableColumn, tableGroupColumn, footerTableData, columnStore } = reactData;
|
|
9412
|
+
const { overflowX, scrollYLoad, tableData, tableColumn, tableGroupColumn, footerTableData, columnStore } = reactData;
|
|
9215
9413
|
const { leftList, rightList } = columnStore;
|
|
9216
|
-
|
|
9217
|
-
|
|
9218
|
-
|
|
9219
|
-
|
|
9414
|
+
const leftFixedWidth = computeLeftFixedWidth.value;
|
|
9415
|
+
const rightFixedWidth = computeRightFixedWidth.value;
|
|
9416
|
+
const ons = {};
|
|
9417
|
+
if (scrollYLoad || leftFixedWidth || rightFixedWidth) {
|
|
9418
|
+
ons.onWheel = $xeTable.triggerBodyWheelEvent;
|
|
9419
|
+
}
|
|
9420
|
+
return h('div', Object.assign({ ref: refTableViewportElem, class: 'vxe-table--viewport-wrapper' }, ons), [
|
|
9220
9421
|
h('div', {
|
|
9221
9422
|
class: 'vxe-table--main-wrapper'
|
|
9222
9423
|
}, [
|
|
@@ -9255,7 +9456,8 @@ export default defineComponent({
|
|
|
9255
9456
|
}, [
|
|
9256
9457
|
leftList && leftList.length && overflowX ? renderFixed('left') : renderEmptyElement($xeTable),
|
|
9257
9458
|
rightList && rightList.length && overflowX ? renderFixed('right') : renderEmptyElement($xeTable)
|
|
9258
|
-
])
|
|
9459
|
+
]),
|
|
9460
|
+
renderRowExpandedVNs()
|
|
9259
9461
|
]);
|
|
9260
9462
|
};
|
|
9261
9463
|
const renderBody = () => {
|
|
@@ -9699,26 +9901,9 @@ export default defineComponent({
|
|
|
9699
9901
|
tablePrivateMethods.preventEvent(null, 'deactivated', { $table: $xeTable });
|
|
9700
9902
|
});
|
|
9701
9903
|
onMounted(() => {
|
|
9702
|
-
const { rowHeightStore } = reactData;
|
|
9703
|
-
const varEl = refVarElem.value;
|
|
9704
9904
|
const columnOpts = computeColumnOpts.value;
|
|
9705
9905
|
const rowOpts = computeRowOpts.value;
|
|
9706
9906
|
const customOpts = computeCustomOpts.value;
|
|
9707
|
-
if (varEl) {
|
|
9708
|
-
const [defEl, mediumEl, smallEl, miniEl] = varEl.children;
|
|
9709
|
-
if (defEl) {
|
|
9710
|
-
rowHeightStore.default = defEl.clientHeight;
|
|
9711
|
-
}
|
|
9712
|
-
if (mediumEl) {
|
|
9713
|
-
rowHeightStore.medium = mediumEl.clientHeight;
|
|
9714
|
-
}
|
|
9715
|
-
if (smallEl) {
|
|
9716
|
-
rowHeightStore.small = smallEl.clientHeight;
|
|
9717
|
-
}
|
|
9718
|
-
if (miniEl) {
|
|
9719
|
-
rowHeightStore.mini = miniEl.clientHeight;
|
|
9720
|
-
}
|
|
9721
|
-
}
|
|
9722
9907
|
if (columnOpts.drag || rowOpts.drag || customOpts.allowSort) {
|
|
9723
9908
|
initTpImg();
|
|
9724
9909
|
}
|
package/es/table/style.css
CHANGED
|
@@ -3042,6 +3042,32 @@
|
|
|
3042
3042
|
flex-direction: row;
|
|
3043
3043
|
align-items: center;
|
|
3044
3044
|
}
|
|
3045
|
+
.vxe-table--render-default .vxe-table--row-expanded-wrapper {
|
|
3046
|
+
position: absolute;
|
|
3047
|
+
top: 0;
|
|
3048
|
+
left: 0;
|
|
3049
|
+
width: 100%;
|
|
3050
|
+
height: 100%;
|
|
3051
|
+
overflow: hidden;
|
|
3052
|
+
pointer-events: none;
|
|
3053
|
+
}
|
|
3054
|
+
.vxe-table--render-default .vxe-body--row-expanded-cell {
|
|
3055
|
+
position: absolute;
|
|
3056
|
+
z-index: 5;
|
|
3057
|
+
top: 0;
|
|
3058
|
+
left: 0;
|
|
3059
|
+
width: 100%;
|
|
3060
|
+
overflow: auto;
|
|
3061
|
+
background-color: var(--vxe-ui-layout-background-color);
|
|
3062
|
+
pointer-events: all;
|
|
3063
|
+
}
|
|
3064
|
+
.vxe-table--render-default .vxe-body--row-expanded-cell.is--padding {
|
|
3065
|
+
padding: var(--vxe-ui-table-expand-padding-default);
|
|
3066
|
+
}
|
|
3067
|
+
.vxe-table--render-default .vxe-body--row-expanded-place-column {
|
|
3068
|
+
border-bottom: var(--vxe-ui-table-border-width) solid var(--vxe-ui-table-border-color);
|
|
3069
|
+
border-right: var(--vxe-ui-table-border-width) solid var(--vxe-ui-table-border-color);
|
|
3070
|
+
}
|
|
3045
3071
|
.vxe-table--render-default .vxe-table--expanded {
|
|
3046
3072
|
cursor: pointer;
|
|
3047
3073
|
}
|