vxe-table 3.14.0 → 3.14.1
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/module/edit/mixin.js +92 -63
- package/es/table/module/validator/mixin.js +2 -5
- package/es/table/src/body.js +6 -7
- package/es/table/src/methods.js +291 -278
- package/es/table/src/table.js +15 -15
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +478 -484
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/edit/mixin.js +106 -98
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/validator/mixin.js +3 -9
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/src/body.js +6 -7
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/methods.js +343 -348
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +15 -15
- 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/module/edit/mixin.ts +125 -87
- package/packages/table/module/validator/mixin.ts +3 -6
- package/packages/table/src/body.ts +6 -7
- package/packages/table/src/methods.ts +334 -293
- package/packages/table/src/table.ts +18 -18
- package/packages/table/src/util.ts +2 -2
- /package/es/{iconfont.1742955973002.ttf → iconfont.1743045564244.ttf} +0 -0
- /package/es/{iconfont.1742955973002.woff → iconfont.1743045564244.woff} +0 -0
- /package/es/{iconfont.1742955973002.woff2 → iconfont.1743045564244.woff2} +0 -0
- /package/lib/{iconfont.1742955973002.ttf → iconfont.1743045564244.ttf} +0 -0
- /package/lib/{iconfont.1742955973002.woff → iconfont.1743045564244.woff} +0 -0
- /package/lib/{iconfont.1742955973002.woff2 → iconfont.1743045564244.woff2} +0 -0
package/es/table/src/methods.js
CHANGED
|
@@ -304,12 +304,12 @@ const updateScrollYStatus = ($xeTable, fullData) => {
|
|
|
304
304
|
const reactData = $xeTable;
|
|
305
305
|
const internalData = $xeTable;
|
|
306
306
|
const { treeConfig } = props;
|
|
307
|
-
const
|
|
307
|
+
const virtualYOpts = $xeTable.computeVirtualYOpts;
|
|
308
308
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
309
309
|
const { transform } = treeOpts;
|
|
310
310
|
const allList = fullData || internalData.tableFullData;
|
|
311
311
|
// 如果gt为0,则总是启用
|
|
312
|
-
const scrollYLoad = (transform || !treeConfig) && !!
|
|
312
|
+
const scrollYLoad = (transform || !treeConfig) && !!virtualYOpts.enabled && virtualYOpts.gt > -1 && (virtualYOpts.gt === 0 || virtualYOpts.gt < allList.length);
|
|
313
313
|
reactData.scrollYLoad = scrollYLoad;
|
|
314
314
|
return scrollYLoad;
|
|
315
315
|
};
|
|
@@ -413,7 +413,7 @@ function updateStyle($xeTable) {
|
|
|
413
413
|
const props = $xeTable;
|
|
414
414
|
const reactData = $xeTable;
|
|
415
415
|
const internalData = $xeTable;
|
|
416
|
-
const {
|
|
416
|
+
const { showHeaderOverflow: allColumnHeaderOverflow, showFooterOverflow: allColumnFooterOverflow, mouseConfig, spanMethod, footerSpanMethod } = props;
|
|
417
417
|
const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, overflowX, scrollbarWidth, overflowY, scrollbarHeight, scrollXWidth, columnStore, editStore, isAllOverflow, expandColumn } = reactData;
|
|
418
418
|
const { visibleColumn, tableHeight, headerHeight, footerHeight, elemStore, customHeight, customMinHeight, customMaxHeight } = internalData;
|
|
419
419
|
const el = $xeTable.$refs.refElem;
|
|
@@ -566,32 +566,6 @@ function updateStyle($xeTable) {
|
|
|
566
566
|
if (tableElem) {
|
|
567
567
|
tableElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
568
568
|
}
|
|
569
|
-
const listElem = getRefElem(elemStore[`${name}-${layout}-list`]);
|
|
570
|
-
if (isGroup && listElem) {
|
|
571
|
-
XEUtils.arrayEach(listElem.querySelectorAll('.col--group'), (thElem) => {
|
|
572
|
-
const colNode = $xeTable.getColumnNode(thElem);
|
|
573
|
-
if (colNode) {
|
|
574
|
-
const column = colNode.item;
|
|
575
|
-
const { showHeaderOverflow } = column;
|
|
576
|
-
const cellOverflow = XEUtils.isBoolean(showHeaderOverflow) ? showHeaderOverflow : allColumnHeaderOverflow;
|
|
577
|
-
const showEllipsis = cellOverflow === 'ellipsis';
|
|
578
|
-
const showTitle = cellOverflow === 'title';
|
|
579
|
-
const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
|
|
580
|
-
const hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
581
|
-
let childWidth = 0;
|
|
582
|
-
let countChild = 0;
|
|
583
|
-
if (hasEllipsis) {
|
|
584
|
-
XEUtils.eachTree(column.children, (item) => {
|
|
585
|
-
if (!item.children || !column.children.length) {
|
|
586
|
-
countChild++;
|
|
587
|
-
}
|
|
588
|
-
childWidth += item.renderWidth;
|
|
589
|
-
}, { children: 'children' });
|
|
590
|
-
}
|
|
591
|
-
thElem.style.width = hasEllipsis ? `${childWidth - countChild - (border ? 2 : 0)}px` : '';
|
|
592
|
-
}
|
|
593
|
-
});
|
|
594
|
-
}
|
|
595
569
|
}
|
|
596
570
|
else if (layout === 'body') {
|
|
597
571
|
if (currScrollElem) {
|
|
@@ -720,6 +694,106 @@ function handleChangeCell($xeTable, evnt, params) {
|
|
|
720
694
|
.catch((e) => e);
|
|
721
695
|
});
|
|
722
696
|
}
|
|
697
|
+
function handleDefaultSort($xeTable) {
|
|
698
|
+
const props = $xeTable;
|
|
699
|
+
const { sortConfig } = props;
|
|
700
|
+
if (sortConfig) {
|
|
701
|
+
const sortOpts = $xeTable.computeSortOpts;
|
|
702
|
+
let { defaultSort } = sortOpts;
|
|
703
|
+
if (defaultSort) {
|
|
704
|
+
if (!XEUtils.isArray(defaultSort)) {
|
|
705
|
+
defaultSort = [defaultSort];
|
|
706
|
+
}
|
|
707
|
+
if (defaultSort.length) {
|
|
708
|
+
(sortConfig.multiple ? defaultSort : defaultSort.slice(0, 1)).forEach((item, index) => {
|
|
709
|
+
const { field, order } = item;
|
|
710
|
+
if (field && order) {
|
|
711
|
+
const column = $xeTable.getColumnByField(field);
|
|
712
|
+
if (column && column.sortable) {
|
|
713
|
+
column.order = order;
|
|
714
|
+
column.sortTime = Date.now() + index;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
if (!sortOpts.remote) {
|
|
719
|
+
$xeTable.handleTableData(true).then(updateStyle);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* 处理默认勾选
|
|
727
|
+
*/
|
|
728
|
+
function handleDefaultSelectionChecked($xeTable) {
|
|
729
|
+
const props = $xeTable;
|
|
730
|
+
const internalData = $xeTable;
|
|
731
|
+
const { checkboxConfig } = props;
|
|
732
|
+
if (checkboxConfig) {
|
|
733
|
+
const { fullDataRowIdData } = internalData;
|
|
734
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
735
|
+
const { checkAll, checkRowKeys } = checkboxOpts;
|
|
736
|
+
if (checkAll) {
|
|
737
|
+
handleCheckedAllCheckboxRow($xeTable, true, true);
|
|
738
|
+
}
|
|
739
|
+
else if (checkRowKeys) {
|
|
740
|
+
const defSelection = [];
|
|
741
|
+
checkRowKeys.forEach((rowid) => {
|
|
742
|
+
if (fullDataRowIdData[rowid]) {
|
|
743
|
+
defSelection.push(fullDataRowIdData[rowid].row);
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
handleCheckedCheckboxRow($xeTable, defSelection, true, true);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* 处理单选框默认勾选
|
|
752
|
+
*/
|
|
753
|
+
function handleDefaultRadioChecked($xeTable) {
|
|
754
|
+
const props = $xeTable;
|
|
755
|
+
const internalData = $xeTable;
|
|
756
|
+
const { radioConfig } = props;
|
|
757
|
+
if (radioConfig) {
|
|
758
|
+
const { fullDataRowIdData } = internalData;
|
|
759
|
+
const radioOpts = $xeTable.computeRadioOpts;
|
|
760
|
+
const { checkRowKey: rowid, reserve } = radioOpts;
|
|
761
|
+
if (rowid) {
|
|
762
|
+
if (fullDataRowIdData[rowid]) {
|
|
763
|
+
handleCheckedRadioRow(fullDataRowIdData[rowid].row, true);
|
|
764
|
+
}
|
|
765
|
+
if (reserve) {
|
|
766
|
+
const rowkey = getRowkey($xeTable);
|
|
767
|
+
internalData.radioReserveRow = { [rowkey]: rowid };
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* 处理默认展开行
|
|
774
|
+
*/
|
|
775
|
+
function handleDefaultRowExpand($xeTable) {
|
|
776
|
+
const props = $xeTable;
|
|
777
|
+
const internalData = $xeTable;
|
|
778
|
+
const { expandConfig } = props;
|
|
779
|
+
if (expandConfig) {
|
|
780
|
+
const { fullDataRowIdData } = internalData;
|
|
781
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
782
|
+
const { expandAll, expandRowKeys } = expandOpts;
|
|
783
|
+
if (expandAll) {
|
|
784
|
+
$xeTable.setAllRowExpand(true);
|
|
785
|
+
}
|
|
786
|
+
else if (expandRowKeys) {
|
|
787
|
+
const defExpandeds = [];
|
|
788
|
+
expandRowKeys.forEach((rowid) => {
|
|
789
|
+
if (fullDataRowIdData[rowid]) {
|
|
790
|
+
defExpandeds.push(fullDataRowIdData[rowid].row);
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
$xeTable.setRowExpand(defExpandeds, true);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
723
797
|
function handleRadioReserveRow($xeTable, row) {
|
|
724
798
|
const internalData = $xeTable;
|
|
725
799
|
const radioOpts = $xeTable.computeRadioOpts;
|
|
@@ -1188,17 +1262,17 @@ function calculateMergerOffsetIndex(list, offsetItem, type) {
|
|
|
1188
1262
|
}
|
|
1189
1263
|
}
|
|
1190
1264
|
function setMerges($xeTable, merges, mList, rowList) {
|
|
1191
|
-
const props = $xeTable
|
|
1265
|
+
// const props = $xeTable
|
|
1192
1266
|
const internalData = $xeTable;
|
|
1193
1267
|
if (merges) {
|
|
1194
|
-
const { treeConfig } = props
|
|
1268
|
+
// const { treeConfig } = props
|
|
1195
1269
|
const { visibleColumn } = internalData;
|
|
1196
1270
|
if (!XEUtils.isArray(merges)) {
|
|
1197
1271
|
merges = [merges];
|
|
1198
1272
|
}
|
|
1199
|
-
if (treeConfig && merges.length) {
|
|
1200
|
-
|
|
1201
|
-
}
|
|
1273
|
+
// if (treeConfig && merges.length) {
|
|
1274
|
+
// errLog('vxe.error.noTree', ['merge-cells | merge-footer-items'])
|
|
1275
|
+
// }
|
|
1202
1276
|
merges.forEach((item) => {
|
|
1203
1277
|
let { row, col, rowspan, colspan } = item;
|
|
1204
1278
|
if (rowList && XEUtils.isNumber(row)) {
|
|
@@ -1239,18 +1313,18 @@ function setMerges($xeTable, merges, mList, rowList) {
|
|
|
1239
1313
|
}
|
|
1240
1314
|
}
|
|
1241
1315
|
function removeMerges($xeTable, merges, mList, rowList) {
|
|
1242
|
-
const props = $xeTable
|
|
1316
|
+
// const props = $xeTable
|
|
1243
1317
|
const internalData = $xeTable;
|
|
1244
1318
|
const rest = [];
|
|
1245
1319
|
if (merges) {
|
|
1246
|
-
const { treeConfig } = props
|
|
1320
|
+
// const { treeConfig } = props
|
|
1247
1321
|
const { visibleColumn } = internalData;
|
|
1248
1322
|
if (!XEUtils.isArray(merges)) {
|
|
1249
1323
|
merges = [merges];
|
|
1250
1324
|
}
|
|
1251
|
-
if (treeConfig && merges.length) {
|
|
1252
|
-
|
|
1253
|
-
}
|
|
1325
|
+
// if (treeConfig && merges.length) {
|
|
1326
|
+
// errLog('vxe.error.noTree', ['merge-cells | merge-footer-items'])
|
|
1327
|
+
// }
|
|
1254
1328
|
merges.forEach((item) => {
|
|
1255
1329
|
let { row, col } = item;
|
|
1256
1330
|
if (rowList && XEUtils.isNumber(row)) {
|
|
@@ -1734,7 +1808,7 @@ function handleScrollToRowColumn($xeTable, fieldOrColumn, row) {
|
|
|
1734
1808
|
}
|
|
1735
1809
|
return $xeTable.$nextTick();
|
|
1736
1810
|
}
|
|
1737
|
-
|
|
1811
|
+
function handleRowExpandReserve($xeTable, row, expanded) {
|
|
1738
1812
|
const internalData = $xeTable;
|
|
1739
1813
|
const { rowExpandedReserveRowMap } = internalData;
|
|
1740
1814
|
const expandOpts = $xeTable.computeExpandOpts;
|
|
@@ -1747,7 +1821,21 @@ const handleRowExpandReserve = ($xeTable, row, expanded) => {
|
|
|
1747
1821
|
delete rowExpandedReserveRowMap[rowid];
|
|
1748
1822
|
}
|
|
1749
1823
|
}
|
|
1750
|
-
}
|
|
1824
|
+
}
|
|
1825
|
+
function handleDefaultMergeCells($xeTable) {
|
|
1826
|
+
const props = $xeTable;
|
|
1827
|
+
const { mergeCells } = props;
|
|
1828
|
+
if (mergeCells) {
|
|
1829
|
+
$xeTable.setMergeCells(mergeCells);
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
function handleDefaultMergeFooterItems($xeTable) {
|
|
1833
|
+
const props = $xeTable;
|
|
1834
|
+
const { mergeFooterItems } = props;
|
|
1835
|
+
if (mergeFooterItems) {
|
|
1836
|
+
$xeTable.setMergeFooterItems(mergeFooterItems);
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1751
1839
|
// 计算可视渲染相关数据
|
|
1752
1840
|
function computeScrollLoad($xeTable) {
|
|
1753
1841
|
const reactData = $xeTable;
|
|
@@ -1835,6 +1923,26 @@ function handleRecalculateLayout($xeTable, reFull) {
|
|
|
1835
1923
|
}
|
|
1836
1924
|
});
|
|
1837
1925
|
}
|
|
1926
|
+
/**
|
|
1927
|
+
* 处理数据加载默认行为
|
|
1928
|
+
* 默认执行一次,除非被重置
|
|
1929
|
+
*/
|
|
1930
|
+
function handleLoadDefaults($xeTable) {
|
|
1931
|
+
handleDefaultSelectionChecked($xeTable);
|
|
1932
|
+
handleDefaultRadioChecked($xeTable);
|
|
1933
|
+
handleDefaultRowExpand($xeTable);
|
|
1934
|
+
handleDefaultTreeExpand($xeTable);
|
|
1935
|
+
handleDefaultMergeCells($xeTable);
|
|
1936
|
+
handleDefaultMergeFooterItems($xeTable);
|
|
1937
|
+
$xeTable.$nextTick(() => setTimeout(() => $xeTable.recalculate()));
|
|
1938
|
+
}
|
|
1939
|
+
/**
|
|
1940
|
+
* 处理初始化的默认行为
|
|
1941
|
+
* 只会执行一次
|
|
1942
|
+
*/
|
|
1943
|
+
function handleInitDefaults($xeTable) {
|
|
1944
|
+
handleDefaultSort($xeTable);
|
|
1945
|
+
}
|
|
1838
1946
|
function handleTableColumn($xeTable) {
|
|
1839
1947
|
const reactData = $xeTable;
|
|
1840
1948
|
const internalData = $xeTable;
|
|
@@ -1900,7 +2008,7 @@ function parseColumns($xeTable, isReset) {
|
|
|
1900
2008
|
const centerList = [];
|
|
1901
2009
|
const rightList = [];
|
|
1902
2010
|
const { isGroup, columnStore } = reactData;
|
|
1903
|
-
const
|
|
2011
|
+
const virtualXOpts = $xeTable.computeVirtualXOpts;
|
|
1904
2012
|
const { collectColumn, tableFullColumn, scrollXStore, fullColumnIdData } = internalData;
|
|
1905
2013
|
// 如果是分组表头,如果子列全部被隐藏,则根列也隐藏
|
|
1906
2014
|
if (isGroup) {
|
|
@@ -1964,7 +2072,7 @@ function parseColumns($xeTable, isReset) {
|
|
|
1964
2072
|
}
|
|
1965
2073
|
const visibleColumn = leftList.concat(centerList).concat(rightList);
|
|
1966
2074
|
// 如果gt为0,则总是启用
|
|
1967
|
-
const scrollXLoad = !!
|
|
2075
|
+
const scrollXLoad = !!virtualXOpts.enabled && virtualXOpts.gt > -1 && (virtualXOpts.gt === 0 || virtualXOpts.gt < tableFullColumn.length);
|
|
1968
2076
|
reactData.hasFixedColumn = leftList.length > 0 || rightList.length > 0;
|
|
1969
2077
|
Object.assign(columnStore, { leftList, centerList, rightList });
|
|
1970
2078
|
if (scrollXLoad) {
|
|
@@ -2539,9 +2647,14 @@ const Methods = {
|
|
|
2539
2647
|
*/
|
|
2540
2648
|
loadTableData(datas, isReset) {
|
|
2541
2649
|
const $xeTable = this;
|
|
2650
|
+
const props = $xeTable;
|
|
2542
2651
|
const reactData = $xeTable;
|
|
2543
2652
|
const internalData = $xeTable;
|
|
2544
|
-
const { keepSource, treeConfig
|
|
2653
|
+
const { keepSource, treeConfig } = props;
|
|
2654
|
+
const { scrollYLoad: oldScrollYLoad } = reactData;
|
|
2655
|
+
const { scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop } = internalData;
|
|
2656
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
2657
|
+
const { transform } = treeOpts;
|
|
2545
2658
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2546
2659
|
let treeData = [];
|
|
2547
2660
|
let fullData = datas ? datas.slice(0) : [];
|
|
@@ -2550,7 +2663,7 @@ const Methods = {
|
|
|
2550
2663
|
}
|
|
2551
2664
|
if (treeConfig) {
|
|
2552
2665
|
// 树结构自动转换
|
|
2553
|
-
if (
|
|
2666
|
+
if (transform) {
|
|
2554
2667
|
if (!treeOpts.rowField) {
|
|
2555
2668
|
errLog('vxe.error.reqProp', ['table.tree-config.rowField']);
|
|
2556
2669
|
}
|
|
@@ -2589,8 +2702,8 @@ const Methods = {
|
|
|
2589
2702
|
scrollXStore.endIndex = 1;
|
|
2590
2703
|
reactData.isRowLoading = true;
|
|
2591
2704
|
reactData.scrollVMLoading = false;
|
|
2592
|
-
|
|
2593
|
-
|
|
2705
|
+
internalData.insertRowMaps = {};
|
|
2706
|
+
internalData.removeRowMaps = {};
|
|
2594
2707
|
const sYLoad = updateScrollYStatus($xeTable, fullData);
|
|
2595
2708
|
reactData.isDragColMove = false;
|
|
2596
2709
|
reactData.isDragRowMove = false;
|
|
@@ -2608,15 +2721,15 @@ const Methods = {
|
|
|
2608
2721
|
if (keepSource) {
|
|
2609
2722
|
$xeTable.cacheSourceMap(fullData);
|
|
2610
2723
|
}
|
|
2611
|
-
if (
|
|
2612
|
-
|
|
2613
|
-
|
|
2724
|
+
if ($xeTable.clearCellAreas && props.mouseConfig) {
|
|
2725
|
+
$xeTable.clearCellAreas();
|
|
2726
|
+
$xeTable.clearCopyCellArea();
|
|
2614
2727
|
}
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
return
|
|
2728
|
+
$xeTable.clearMergeCells();
|
|
2729
|
+
$xeTable.clearMergeFooterItems();
|
|
2730
|
+
$xeTable.handleTableData(true);
|
|
2731
|
+
$xeTable.updateFooter();
|
|
2732
|
+
return $xeTable.$nextTick().then(() => {
|
|
2620
2733
|
updateHeight($xeTable);
|
|
2621
2734
|
updateStyle($xeTable);
|
|
2622
2735
|
}).then(() => {
|
|
@@ -2629,49 +2742,51 @@ const Methods = {
|
|
|
2629
2742
|
if (sYLoad) {
|
|
2630
2743
|
// if (showOverflow) {
|
|
2631
2744
|
// if (!rowOpts.height) {
|
|
2632
|
-
// const errColumn =
|
|
2745
|
+
// const errColumn = internalData.tableFullColumn.find((column: any) => column.showOverflow === false)
|
|
2633
2746
|
// if (errColumn) {
|
|
2634
2747
|
// errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
|
|
2635
2748
|
// }
|
|
2636
2749
|
// }
|
|
2637
2750
|
// }
|
|
2638
|
-
if (!(
|
|
2751
|
+
if (!(props.height || props.maxHeight)) {
|
|
2639
2752
|
errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
|
|
2640
2753
|
}
|
|
2641
|
-
// if (!
|
|
2754
|
+
// if (!props.showOverflow) {
|
|
2642
2755
|
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2643
2756
|
// }
|
|
2644
|
-
if (
|
|
2757
|
+
if (props.spanMethod) {
|
|
2645
2758
|
errLog('vxe.error.scrollErrProp', ['table.span-method']);
|
|
2646
2759
|
}
|
|
2647
2760
|
}
|
|
2648
2761
|
handleReserveStatus($xeTable);
|
|
2649
|
-
|
|
2762
|
+
$xeTable.checkSelectionStatus();
|
|
2650
2763
|
return new Promise(resolve => {
|
|
2651
2764
|
this.$nextTick()
|
|
2652
|
-
.then(() =>
|
|
2765
|
+
.then(() => $xeTable.recalculate())
|
|
2653
2766
|
.then(() => {
|
|
2654
2767
|
let targetScrollLeft = lastScrollLeft;
|
|
2655
2768
|
let targetScrollTop = lastScrollTop;
|
|
2769
|
+
const virtualXOpts = $xeTable.computeVirtualXOpts;
|
|
2770
|
+
const virtualYOpts = $xeTable.computeVirtualYOpts;
|
|
2656
2771
|
// 是否在更新数据之后自动滚动重置滚动条
|
|
2657
|
-
if (
|
|
2772
|
+
if (virtualXOpts.scrollToLeftOnChange) {
|
|
2658
2773
|
targetScrollLeft = 0;
|
|
2659
2774
|
}
|
|
2660
|
-
if (
|
|
2775
|
+
if (virtualYOpts.scrollToTopOnChange) {
|
|
2661
2776
|
targetScrollTop = 0;
|
|
2662
2777
|
}
|
|
2663
2778
|
reactData.isRowLoading = false;
|
|
2664
2779
|
calcCellHeight($xeTable);
|
|
2665
2780
|
// 是否变更虚拟滚动
|
|
2666
2781
|
if (oldScrollYLoad === sYLoad) {
|
|
2667
|
-
restoreScrollLocation(
|
|
2782
|
+
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
2668
2783
|
.then(() => {
|
|
2669
2784
|
resolve();
|
|
2670
2785
|
});
|
|
2671
2786
|
}
|
|
2672
2787
|
else {
|
|
2673
2788
|
setTimeout(() => {
|
|
2674
|
-
restoreScrollLocation(
|
|
2789
|
+
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
2675
2790
|
.then(() => {
|
|
2676
2791
|
resolve();
|
|
2677
2792
|
});
|
|
@@ -2686,12 +2801,13 @@ const Methods = {
|
|
|
2686
2801
|
* @param {Array} datas 数据
|
|
2687
2802
|
*/
|
|
2688
2803
|
loadData(datas) {
|
|
2804
|
+
const $xeTable = this;
|
|
2689
2805
|
const { initStatus } = this;
|
|
2690
2806
|
return this.loadTableData(datas, false).then(() => {
|
|
2691
2807
|
this.inited = true;
|
|
2692
2808
|
this.initStatus = true;
|
|
2693
2809
|
if (!initStatus) {
|
|
2694
|
-
|
|
2810
|
+
handleLoadDefaults($xeTable);
|
|
2695
2811
|
}
|
|
2696
2812
|
return this.recalculate();
|
|
2697
2813
|
});
|
|
@@ -2701,6 +2817,7 @@ const Methods = {
|
|
|
2701
2817
|
* @param {Array} datas 数据
|
|
2702
2818
|
*/
|
|
2703
2819
|
reloadData(datas) {
|
|
2820
|
+
const $xeTable = this;
|
|
2704
2821
|
return this.clearAll()
|
|
2705
2822
|
.then(() => {
|
|
2706
2823
|
this.inited = true;
|
|
@@ -2708,7 +2825,7 @@ const Methods = {
|
|
|
2708
2825
|
return this.loadTableData(datas, true);
|
|
2709
2826
|
})
|
|
2710
2827
|
.then(() => {
|
|
2711
|
-
|
|
2828
|
+
handleLoadDefaults($xeTable);
|
|
2712
2829
|
return this.recalculate();
|
|
2713
2830
|
});
|
|
2714
2831
|
},
|
|
@@ -2864,11 +2981,17 @@ const Methods = {
|
|
|
2864
2981
|
internalData.tableSourceData = sourceData;
|
|
2865
2982
|
},
|
|
2866
2983
|
getParams() {
|
|
2867
|
-
|
|
2984
|
+
const $xeTable = this;
|
|
2985
|
+
const props = $xeTable;
|
|
2986
|
+
return props.params;
|
|
2868
2987
|
},
|
|
2869
2988
|
loadTreeChildren(row, childRecords) {
|
|
2870
2989
|
const $xeTable = this;
|
|
2871
|
-
const
|
|
2990
|
+
const props = $xeTable;
|
|
2991
|
+
const internalData = $xeTable;
|
|
2992
|
+
const { keepSource } = props;
|
|
2993
|
+
const { tableSourceData, fullDataRowIdData, fullAllDataRowIdData, sourceDataRowIdData } = internalData;
|
|
2994
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
2872
2995
|
const { transform, mapChildrenField } = treeOpts;
|
|
2873
2996
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2874
2997
|
const parentRest = fullAllDataRowIdData[getRowid($xeTable, row)];
|
|
@@ -2905,18 +3028,22 @@ const Methods = {
|
|
|
2905
3028
|
* @param {Element} tr 元素
|
|
2906
3029
|
*/
|
|
2907
3030
|
getRowNode(tr) {
|
|
3031
|
+
const $xeTable = this;
|
|
3032
|
+
const internalData = $xeTable;
|
|
2908
3033
|
if (tr) {
|
|
2909
|
-
const { fullAllDataRowIdData } =
|
|
3034
|
+
const { fullAllDataRowIdData } = internalData;
|
|
2910
3035
|
const rowid = tr.getAttribute('rowid');
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
3036
|
+
if (rowid) {
|
|
3037
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
3038
|
+
if (rowRest) {
|
|
3039
|
+
return {
|
|
3040
|
+
rowid: rowRest.rowid,
|
|
3041
|
+
item: rowRest.row,
|
|
3042
|
+
index: rowRest.index,
|
|
3043
|
+
items: rowRest.items,
|
|
3044
|
+
parent: rowRest.parent
|
|
3045
|
+
};
|
|
3046
|
+
}
|
|
2920
3047
|
}
|
|
2921
3048
|
}
|
|
2922
3049
|
return null;
|
|
@@ -2926,8 +3053,10 @@ const Methods = {
|
|
|
2926
3053
|
* @param {Element} cell 元素
|
|
2927
3054
|
*/
|
|
2928
3055
|
getColumnNode(cell) {
|
|
3056
|
+
const $xeTable = this;
|
|
3057
|
+
const internalData = $xeTable;
|
|
2929
3058
|
if (cell) {
|
|
2930
|
-
const { fullColumnIdData } =
|
|
3059
|
+
const { fullColumnIdData } = internalData;
|
|
2931
3060
|
const colid = cell.getAttribute('colid');
|
|
2932
3061
|
if (colid) {
|
|
2933
3062
|
const colRest = fullColumnIdData[colid];
|
|
@@ -3019,14 +3148,21 @@ const Methods = {
|
|
|
3019
3148
|
* @param {Row} records 行数据
|
|
3020
3149
|
*/
|
|
3021
3150
|
defineField(records) {
|
|
3022
|
-
const
|
|
3151
|
+
const $xeTable = this;
|
|
3152
|
+
const props = $xeTable;
|
|
3153
|
+
const internalData = $xeTable;
|
|
3154
|
+
const { treeConfig } = props;
|
|
3155
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
3156
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
3157
|
+
const radioOpts = $xeTable.computeRadioOpts;
|
|
3158
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
3023
3159
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
3024
|
-
const rowkey = getRowkey(
|
|
3160
|
+
const rowkey = getRowkey($xeTable);
|
|
3025
3161
|
if (!XEUtils.isArray(records)) {
|
|
3026
3162
|
records = [records || {}];
|
|
3027
3163
|
}
|
|
3028
3164
|
return records.map((record) => {
|
|
3029
|
-
|
|
3165
|
+
internalData.tableFullColumn.forEach(column => {
|
|
3030
3166
|
const { field, editRender } = column;
|
|
3031
3167
|
if (field && !XEUtils.has(record, field)) {
|
|
3032
3168
|
let cellValue = null;
|
|
@@ -3064,8 +3200,9 @@ const Methods = {
|
|
|
3064
3200
|
* @param {Array} records 新数据
|
|
3065
3201
|
*/
|
|
3066
3202
|
createData(records) {
|
|
3067
|
-
|
|
3068
|
-
|
|
3203
|
+
const $xeTable = this;
|
|
3204
|
+
return $xeTable.$nextTick().then(() => {
|
|
3205
|
+
return $xeTable.defineField(records);
|
|
3069
3206
|
});
|
|
3070
3207
|
},
|
|
3071
3208
|
/**
|
|
@@ -3074,11 +3211,12 @@ const Methods = {
|
|
|
3074
3211
|
* @param {Array/Object} records 新数据
|
|
3075
3212
|
*/
|
|
3076
3213
|
createRow(records) {
|
|
3214
|
+
const $xeTable = this;
|
|
3077
3215
|
const isArr = XEUtils.isArray(records);
|
|
3078
3216
|
if (!isArr) {
|
|
3079
3217
|
records = [records];
|
|
3080
3218
|
}
|
|
3081
|
-
return
|
|
3219
|
+
return $xeTable.createData(records).then((rows) => isArr ? rows : rows[0]);
|
|
3082
3220
|
},
|
|
3083
3221
|
/**
|
|
3084
3222
|
* 还原数据
|
|
@@ -3093,9 +3231,7 @@ const Methods = {
|
|
|
3093
3231
|
const reactData = $xeTable;
|
|
3094
3232
|
const internalData = $xeTable;
|
|
3095
3233
|
const { keepSource, treeConfig } = props;
|
|
3096
|
-
const {
|
|
3097
|
-
const { fullAllDataRowIdData, fullDataRowIdData, tableSourceData, sourceDataRowIdData, tableFullData, afterFullData } = internalData;
|
|
3098
|
-
const removeTempMaps = Object.assign({}, editStore.removeMaps);
|
|
3234
|
+
const { fullAllDataRowIdData, fullDataRowIdData, tableSourceData, sourceDataRowIdData, tableFullData, afterFullData, removeRowMaps } = internalData;
|
|
3099
3235
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
3100
3236
|
const { transform } = treeOpts;
|
|
3101
3237
|
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
@@ -3131,7 +3267,9 @@ const Methods = {
|
|
|
3131
3267
|
XEUtils.destructuring(row, XEUtils.clone(oRow, true));
|
|
3132
3268
|
}
|
|
3133
3269
|
if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
|
|
3134
|
-
|
|
3270
|
+
if (removeRowMaps[rowid]) {
|
|
3271
|
+
delete removeRowMaps[rowid];
|
|
3272
|
+
}
|
|
3135
3273
|
tableFullData.unshift(row);
|
|
3136
3274
|
afterFullData.unshift(row);
|
|
3137
3275
|
reDelFlag = true;
|
|
@@ -3143,7 +3281,7 @@ const Methods = {
|
|
|
3143
3281
|
}
|
|
3144
3282
|
if (rows) {
|
|
3145
3283
|
if (reDelFlag) {
|
|
3146
|
-
|
|
3284
|
+
reactData.removeRowFlag++;
|
|
3147
3285
|
$xeTable.updateFooter();
|
|
3148
3286
|
$xeTable.cacheRowMap(false);
|
|
3149
3287
|
$xeTable.handleTableData(treeConfig && transform);
|
|
@@ -3172,7 +3310,9 @@ const Methods = {
|
|
|
3172
3310
|
* @param {String} field 字段名
|
|
3173
3311
|
*/
|
|
3174
3312
|
clearData(rows, field) {
|
|
3175
|
-
const
|
|
3313
|
+
const $xeTable = this;
|
|
3314
|
+
const internalData = $xeTable;
|
|
3315
|
+
const { tableFullData, visibleColumn } = internalData;
|
|
3176
3316
|
if (!arguments.length) {
|
|
3177
3317
|
rows = tableFullData;
|
|
3178
3318
|
}
|
|
@@ -3191,7 +3331,7 @@ const Methods = {
|
|
|
3191
3331
|
});
|
|
3192
3332
|
});
|
|
3193
3333
|
}
|
|
3194
|
-
return
|
|
3334
|
+
return $xeTable.$nextTick();
|
|
3195
3335
|
},
|
|
3196
3336
|
getCellElement(row, fieldOrColumn) {
|
|
3197
3337
|
const $xeTable = this;
|
|
@@ -3282,16 +3422,16 @@ const Methods = {
|
|
|
3282
3422
|
isInsertByRow(row) {
|
|
3283
3423
|
const $xeTable = this;
|
|
3284
3424
|
const reactData = $xeTable;
|
|
3285
|
-
const
|
|
3425
|
+
const internalData = $xeTable;
|
|
3286
3426
|
const rowid = getRowid($xeTable, row);
|
|
3287
|
-
return !!
|
|
3427
|
+
return !!reactData.insertRowFlag && !!internalData.insertRowMaps[rowid];
|
|
3288
3428
|
},
|
|
3289
3429
|
isRemoveByRow(row) {
|
|
3290
3430
|
const $xeTable = this;
|
|
3291
3431
|
const reactData = $xeTable;
|
|
3292
|
-
const
|
|
3432
|
+
const internalData = $xeTable;
|
|
3293
3433
|
const rowid = getRowid($xeTable, row);
|
|
3294
|
-
return !!
|
|
3434
|
+
return !!reactData.removeRowFlag && !!internalData.removeRowMaps[rowid];
|
|
3295
3435
|
},
|
|
3296
3436
|
/**
|
|
3297
3437
|
* 删除所有新增的临时数据
|
|
@@ -3299,9 +3439,8 @@ const Methods = {
|
|
|
3299
3439
|
*/
|
|
3300
3440
|
removeInsertRow() {
|
|
3301
3441
|
const $xeTable = this;
|
|
3302
|
-
const
|
|
3303
|
-
|
|
3304
|
-
editStore.insertMaps = {};
|
|
3442
|
+
const internalData = $xeTable;
|
|
3443
|
+
internalData.insertRowMaps = {};
|
|
3305
3444
|
return $xeTable.remove($xeTable.getInsertRecords());
|
|
3306
3445
|
},
|
|
3307
3446
|
/**
|
|
@@ -3343,14 +3482,17 @@ const Methods = {
|
|
|
3343
3482
|
* @param {Number} columnIndex 索引
|
|
3344
3483
|
*/
|
|
3345
3484
|
getColumns(columnIndex) {
|
|
3346
|
-
const
|
|
3347
|
-
|
|
3485
|
+
const $xeTable = this;
|
|
3486
|
+
const internalData = $xeTable;
|
|
3487
|
+
const { visibleColumn } = internalData;
|
|
3488
|
+
return XEUtils.isUndefined(columnIndex) ? visibleColumn.slice(0) : visibleColumn[columnIndex];
|
|
3348
3489
|
},
|
|
3349
3490
|
/**
|
|
3350
3491
|
* 根据列获取列的唯一主键
|
|
3351
3492
|
*/
|
|
3352
3493
|
getColid(fieldOrColumn) {
|
|
3353
|
-
const
|
|
3494
|
+
const $xeTable = this;
|
|
3495
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
3354
3496
|
return column ? column.id : null;
|
|
3355
3497
|
},
|
|
3356
3498
|
/**
|
|
@@ -3358,7 +3500,9 @@ const Methods = {
|
|
|
3358
3500
|
* @param {String} colid 列主键
|
|
3359
3501
|
*/
|
|
3360
3502
|
getColumnById(colid) {
|
|
3361
|
-
const
|
|
3503
|
+
const $xeTable = this;
|
|
3504
|
+
const internalData = $xeTable;
|
|
3505
|
+
const { fullColumnIdData } = internalData;
|
|
3362
3506
|
return fullColumnIdData[colid] ? fullColumnIdData[colid].column : null;
|
|
3363
3507
|
},
|
|
3364
3508
|
/**
|
|
@@ -3366,7 +3510,9 @@ const Methods = {
|
|
|
3366
3510
|
* @param {String} field 字段名
|
|
3367
3511
|
*/
|
|
3368
3512
|
getColumnByField(field) {
|
|
3369
|
-
const
|
|
3513
|
+
const $xeTable = this;
|
|
3514
|
+
const internalData = $xeTable;
|
|
3515
|
+
const { fullColumnFieldData } = internalData;
|
|
3370
3516
|
return fullColumnFieldData[field] ? fullColumnFieldData[field].column : null;
|
|
3371
3517
|
},
|
|
3372
3518
|
getParentColumn(fieldOrColumn) {
|
|
@@ -3379,11 +3525,14 @@ const Methods = {
|
|
|
3379
3525
|
* 收集到的全量列、全量表头列、处理条件之后的全量表头列、当前渲染中的表头列
|
|
3380
3526
|
*/
|
|
3381
3527
|
getTableColumn() {
|
|
3528
|
+
const $xeTable = this;
|
|
3529
|
+
const reactData = $xeTable;
|
|
3530
|
+
const internalData = $xeTable;
|
|
3382
3531
|
return {
|
|
3383
|
-
collectColumn:
|
|
3384
|
-
fullColumn:
|
|
3385
|
-
visibleColumn:
|
|
3386
|
-
tableColumn:
|
|
3532
|
+
collectColumn: internalData.collectColumn.slice(0),
|
|
3533
|
+
fullColumn: internalData.tableFullColumn.slice(0),
|
|
3534
|
+
visibleColumn: internalData.visibleColumn.slice(0),
|
|
3535
|
+
tableColumn: reactData.tableColumn.slice(0)
|
|
3387
3536
|
};
|
|
3388
3537
|
},
|
|
3389
3538
|
/**
|
|
@@ -3796,9 +3945,14 @@ const Methods = {
|
|
|
3796
3945
|
* 如果存在排序,继续处理
|
|
3797
3946
|
*/
|
|
3798
3947
|
getTableData() {
|
|
3799
|
-
const
|
|
3948
|
+
const $xeTable = this;
|
|
3949
|
+
const props = $xeTable;
|
|
3950
|
+
const reactData = $xeTable;
|
|
3951
|
+
const internalData = $xeTable;
|
|
3952
|
+
const { tableData, footerTableData } = reactData;
|
|
3953
|
+
const { tableFullData, afterFullData, tableFullTreeData } = internalData;
|
|
3800
3954
|
return {
|
|
3801
|
-
fullData: treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0),
|
|
3955
|
+
fullData: props.treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0),
|
|
3802
3956
|
visibleData: afterFullData.slice(0),
|
|
3803
3957
|
tableData: tableData.slice(0),
|
|
3804
3958
|
footerData: footerTableData.slice(0)
|
|
@@ -3837,35 +3991,15 @@ const Methods = {
|
|
|
3837
3991
|
*/
|
|
3838
3992
|
handleLoadDefaults() {
|
|
3839
3993
|
const $xeTable = this;
|
|
3840
|
-
|
|
3841
|
-
this.handleDefaultSelectionChecked();
|
|
3842
|
-
}
|
|
3843
|
-
if (this.radioConfig) {
|
|
3844
|
-
this.handleDefaultRadioChecked();
|
|
3845
|
-
}
|
|
3846
|
-
if (this.expandConfig) {
|
|
3847
|
-
this.handleDefaultRowExpand();
|
|
3848
|
-
}
|
|
3849
|
-
if (this.treeConfig) {
|
|
3850
|
-
handleDefaultTreeExpand($xeTable);
|
|
3851
|
-
}
|
|
3852
|
-
if (this.mergeCells) {
|
|
3853
|
-
this.handleDefaultMergeCells();
|
|
3854
|
-
}
|
|
3855
|
-
if (this.mergeFooterItems) {
|
|
3856
|
-
this.handleDefaultMergeFooterItems();
|
|
3857
|
-
}
|
|
3858
|
-
this.$nextTick(() => setTimeout(this.recalculate));
|
|
3994
|
+
handleLoadDefaults($xeTable);
|
|
3859
3995
|
},
|
|
3860
3996
|
/**
|
|
3861
3997
|
* 处理初始化的默认行为
|
|
3862
3998
|
* 只会执行一次
|
|
3863
3999
|
*/
|
|
3864
4000
|
handleInitDefaults() {
|
|
3865
|
-
const
|
|
3866
|
-
|
|
3867
|
-
this.handleDefaultSort();
|
|
3868
|
-
}
|
|
4001
|
+
const $xeTable = this;
|
|
4002
|
+
handleInitDefaults($xeTable);
|
|
3869
4003
|
},
|
|
3870
4004
|
/**
|
|
3871
4005
|
* 设置为固定列
|
|
@@ -4021,64 +4155,30 @@ const Methods = {
|
|
|
4021
4155
|
return this.resetCustom(options);
|
|
4022
4156
|
},
|
|
4023
4157
|
handleCustom() {
|
|
4024
|
-
const
|
|
4158
|
+
const $xeTable = this;
|
|
4159
|
+
const props = $xeTable;
|
|
4160
|
+
const { mouseConfig } = props;
|
|
4025
4161
|
if (mouseConfig) {
|
|
4026
|
-
if (
|
|
4027
|
-
|
|
4162
|
+
if ($xeTable.clearSelected) {
|
|
4163
|
+
$xeTable.clearSelected();
|
|
4028
4164
|
}
|
|
4029
|
-
if (
|
|
4030
|
-
|
|
4031
|
-
|
|
4165
|
+
if ($xeTable.clearCellAreas) {
|
|
4166
|
+
$xeTable.clearCellAreas();
|
|
4167
|
+
$xeTable.clearCopyCellArea();
|
|
4032
4168
|
}
|
|
4033
4169
|
}
|
|
4034
|
-
|
|
4035
|
-
return
|
|
4036
|
-
},
|
|
4037
|
-
handleCustomRestore(storeData) {
|
|
4038
|
-
const $xeTable = this;
|
|
4039
|
-
const reactData = $xeTable;
|
|
4040
|
-
const internalData = $xeTable;
|
|
4041
|
-
let { collectColumn } = internalData;
|
|
4042
|
-
const { resizableData, sortData, visibleData, fixedData } = storeData;
|
|
4043
|
-
let hasCustomSort = false;
|
|
4044
|
-
// 处理还原
|
|
4045
|
-
if (resizableData || sortData || visibleData || fixedData) {
|
|
4046
|
-
XEUtils.eachTree(collectColumn, (column, index, items, path, parentRow) => {
|
|
4047
|
-
const colKey = column.getKey();
|
|
4048
|
-
// 支持一级
|
|
4049
|
-
if (!parentRow) {
|
|
4050
|
-
if (fixedData && fixedData[colKey] !== undefined) {
|
|
4051
|
-
column.fixed = fixedData[colKey];
|
|
4052
|
-
}
|
|
4053
|
-
if (sortData && XEUtils.isNumber(sortData[colKey])) {
|
|
4054
|
-
hasCustomSort = true;
|
|
4055
|
-
column.renderSortNumber = sortData[colKey];
|
|
4056
|
-
}
|
|
4057
|
-
}
|
|
4058
|
-
if (resizableData && XEUtils.isNumber(resizableData[colKey])) {
|
|
4059
|
-
column.resizeWidth = resizableData[colKey];
|
|
4060
|
-
}
|
|
4061
|
-
if (visibleData && XEUtils.isBoolean(visibleData[colKey])) {
|
|
4062
|
-
column.visible = visibleData[colKey];
|
|
4063
|
-
}
|
|
4064
|
-
});
|
|
4065
|
-
// 如果自定义了顺序
|
|
4066
|
-
if (hasCustomSort) {
|
|
4067
|
-
collectColumn = XEUtils.orderBy(collectColumn, 'renderSortNumber');
|
|
4068
|
-
internalData.collectColumn = collectColumn;
|
|
4069
|
-
internalData.tableFullColumn = getColumnList(collectColumn);
|
|
4070
|
-
}
|
|
4071
|
-
reactData.isCustomStatus = true;
|
|
4072
|
-
}
|
|
4073
|
-
else {
|
|
4074
|
-
reactData.isCustomStatus = false;
|
|
4075
|
-
}
|
|
4170
|
+
$xeTable.analyColumnWidth();
|
|
4171
|
+
return $xeTable.refreshColumn(true);
|
|
4076
4172
|
},
|
|
4077
4173
|
/**
|
|
4078
4174
|
* 还原自定义列操作状态
|
|
4079
4175
|
*/
|
|
4080
4176
|
restoreCustomStorage() {
|
|
4081
|
-
const
|
|
4177
|
+
const $xeTable = this;
|
|
4178
|
+
const props = $xeTable;
|
|
4179
|
+
const { customConfig } = props;
|
|
4180
|
+
const tableId = $xeTable.computeTableId;
|
|
4181
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
4082
4182
|
const { storage, restoreStore } = customOpts;
|
|
4083
4183
|
const isAllCustom = storage === true;
|
|
4084
4184
|
const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {});
|
|
@@ -4097,11 +4197,11 @@ const Methods = {
|
|
|
4097
4197
|
if (!storeData) {
|
|
4098
4198
|
return;
|
|
4099
4199
|
}
|
|
4100
|
-
return
|
|
4200
|
+
return handleCustomRestore($xeTable, storeData);
|
|
4101
4201
|
}).catch(e => e);
|
|
4102
4202
|
}
|
|
4103
4203
|
else {
|
|
4104
|
-
return
|
|
4204
|
+
return handleCustomRestore($xeTable, storeData);
|
|
4105
4205
|
}
|
|
4106
4206
|
}
|
|
4107
4207
|
},
|
|
@@ -5564,26 +5664,6 @@ const Methods = {
|
|
|
5564
5664
|
}
|
|
5565
5665
|
return [];
|
|
5566
5666
|
},
|
|
5567
|
-
/**
|
|
5568
|
-
* 处理默认勾选
|
|
5569
|
-
*/
|
|
5570
|
-
handleDefaultSelectionChecked() {
|
|
5571
|
-
const $xeTable = this;
|
|
5572
|
-
const { fullDataRowIdData, checkboxOpts } = this;
|
|
5573
|
-
const { checkAll, checkRowKeys } = checkboxOpts;
|
|
5574
|
-
if (checkAll) {
|
|
5575
|
-
handleCheckedAllCheckboxRow($xeTable, true, true);
|
|
5576
|
-
}
|
|
5577
|
-
else if (checkRowKeys) {
|
|
5578
|
-
const defSelection = [];
|
|
5579
|
-
checkRowKeys.forEach((rowid) => {
|
|
5580
|
-
if (fullDataRowIdData[rowid]) {
|
|
5581
|
-
defSelection.push(fullDataRowIdData[rowid].row);
|
|
5582
|
-
}
|
|
5583
|
-
});
|
|
5584
|
-
handleCheckedCheckboxRow($xeTable, defSelection, true, true);
|
|
5585
|
-
}
|
|
5586
|
-
},
|
|
5587
5667
|
handleCheckedCheckboxRow(rows, value, isForce) {
|
|
5588
5668
|
const $xeTable = this;
|
|
5589
5669
|
return handleCheckedCheckboxRow($xeTable, rows, value, isForce);
|
|
@@ -6167,23 +6247,6 @@ const Methods = {
|
|
|
6167
6247
|
reactData.updateCheckboxFlag++;
|
|
6168
6248
|
return this.$nextTick();
|
|
6169
6249
|
},
|
|
6170
|
-
/**
|
|
6171
|
-
* 处理单选框默认勾选
|
|
6172
|
-
*/
|
|
6173
|
-
handleDefaultRadioChecked() {
|
|
6174
|
-
const $xeTable = this;
|
|
6175
|
-
const { radioOpts, fullDataRowIdData } = this;
|
|
6176
|
-
const { checkRowKey: rowid, reserve } = radioOpts;
|
|
6177
|
-
if (rowid) {
|
|
6178
|
-
if (fullDataRowIdData[rowid]) {
|
|
6179
|
-
handleCheckedRadioRow($xeTable, fullDataRowIdData[rowid].row, true);
|
|
6180
|
-
}
|
|
6181
|
-
if (reserve) {
|
|
6182
|
-
const rowkey = getRowkey(this);
|
|
6183
|
-
this.radioReserveRow = { [rowkey]: rowid };
|
|
6184
|
-
}
|
|
6185
|
-
}
|
|
6186
|
-
},
|
|
6187
6250
|
/**
|
|
6188
6251
|
* 单选,行选中事件
|
|
6189
6252
|
*/
|
|
@@ -6564,31 +6627,6 @@ const Methods = {
|
|
|
6564
6627
|
}
|
|
6565
6628
|
this.emitEvent('cell-dblclick', params, evnt);
|
|
6566
6629
|
},
|
|
6567
|
-
handleDefaultSort() {
|
|
6568
|
-
const $xeTable = this;
|
|
6569
|
-
const { sortConfig, sortOpts } = this;
|
|
6570
|
-
let { defaultSort } = sortOpts;
|
|
6571
|
-
if (defaultSort) {
|
|
6572
|
-
if (!XEUtils.isArray(defaultSort)) {
|
|
6573
|
-
defaultSort = [defaultSort];
|
|
6574
|
-
}
|
|
6575
|
-
if (defaultSort.length) {
|
|
6576
|
-
(sortConfig.multiple ? defaultSort : defaultSort.slice(0, 1)).forEach((item, index) => {
|
|
6577
|
-
const { field, order } = item;
|
|
6578
|
-
if (field && order) {
|
|
6579
|
-
const column = this.getColumnByField(field);
|
|
6580
|
-
if (column && column.sortable) {
|
|
6581
|
-
column.order = order;
|
|
6582
|
-
column.sortTime = Date.now() + index;
|
|
6583
|
-
}
|
|
6584
|
-
}
|
|
6585
|
-
});
|
|
6586
|
-
if (!sortOpts.remote) {
|
|
6587
|
-
this.handleTableData(true).then(() => updateStyle($xeTable));
|
|
6588
|
-
}
|
|
6589
|
-
}
|
|
6590
|
-
}
|
|
6591
|
-
},
|
|
6592
6630
|
handleColumnSortEvent(evnt, column) {
|
|
6593
6631
|
const $xeTable = this;
|
|
6594
6632
|
const props = $xeTable;
|
|
@@ -7704,25 +7742,6 @@ const Methods = {
|
|
|
7704
7742
|
toggleRowExpand(row) {
|
|
7705
7743
|
return this.setRowExpand(row, !this.isRowExpandByRow(row));
|
|
7706
7744
|
},
|
|
7707
|
-
/**
|
|
7708
|
-
* 处理默认展开行
|
|
7709
|
-
*/
|
|
7710
|
-
handleDefaultRowExpand() {
|
|
7711
|
-
const { expandOpts, fullDataRowIdData } = this;
|
|
7712
|
-
const { expandAll, expandRowKeys } = expandOpts;
|
|
7713
|
-
if (expandAll) {
|
|
7714
|
-
this.setAllRowExpand(true);
|
|
7715
|
-
}
|
|
7716
|
-
else if (expandRowKeys) {
|
|
7717
|
-
const defExpandeds = [];
|
|
7718
|
-
expandRowKeys.forEach((rowid) => {
|
|
7719
|
-
if (fullDataRowIdData[rowid]) {
|
|
7720
|
-
defExpandeds.push(fullDataRowIdData[rowid].row);
|
|
7721
|
-
}
|
|
7722
|
-
});
|
|
7723
|
-
this.setRowExpand(defExpandeds, true);
|
|
7724
|
-
}
|
|
7725
|
-
},
|
|
7726
7745
|
/**
|
|
7727
7746
|
* 设置所有行的展开与否
|
|
7728
7747
|
* @param {Boolean} expanded 是否展开
|
|
@@ -8299,8 +8318,8 @@ const Methods = {
|
|
|
8299
8318
|
*/
|
|
8300
8319
|
triggerScrollXEvent() {
|
|
8301
8320
|
const $xeTable = this;
|
|
8302
|
-
const
|
|
8303
|
-
if (
|
|
8321
|
+
const virtualXOpts = $xeTable.computeVirtualXOpts;
|
|
8322
|
+
if (virtualXOpts.immediate) {
|
|
8304
8323
|
loadScrollXData($xeTable);
|
|
8305
8324
|
}
|
|
8306
8325
|
else {
|
|
@@ -8312,8 +8331,8 @@ const Methods = {
|
|
|
8312
8331
|
*/
|
|
8313
8332
|
triggerScrollYEvent() {
|
|
8314
8333
|
const $xeTable = this;
|
|
8315
|
-
const
|
|
8316
|
-
if (
|
|
8334
|
+
const virtualYOpts = $xeTable.computeVirtualYOpts;
|
|
8335
|
+
if (virtualYOpts.immediate) {
|
|
8317
8336
|
loadScrollYData($xeTable);
|
|
8318
8337
|
}
|
|
8319
8338
|
else {
|
|
@@ -8522,8 +8541,8 @@ const Methods = {
|
|
|
8522
8541
|
return;
|
|
8523
8542
|
}
|
|
8524
8543
|
const wheelSpeed = getWheelSpeed(reactData.lastScrollTime);
|
|
8525
|
-
const deltaTop =
|
|
8526
|
-
const deltaLeft = Math.ceil((shiftKey ? deltaY : deltaX) * wheelSpeed);
|
|
8544
|
+
const deltaTop = shiftKey ? 0 : Math.ceil(deltaY * wheelSpeed);
|
|
8545
|
+
const deltaLeft = Math.ceil((shiftKey ? (deltaY || deltaX) : deltaX) * wheelSpeed);
|
|
8527
8546
|
const isTopWheel = deltaTop < 0;
|
|
8528
8547
|
const currScrollTop = bodyScrollElem.scrollTop;
|
|
8529
8548
|
// 如果滚动位置已经是顶部或底部,则不需要触发
|
|
@@ -9023,9 +9042,6 @@ const Methods = {
|
|
|
9023
9042
|
}
|
|
9024
9043
|
});
|
|
9025
9044
|
},
|
|
9026
|
-
handleDefaultMergeCells() {
|
|
9027
|
-
this.setMergeCells(this.mergeCells);
|
|
9028
|
-
},
|
|
9029
9045
|
/**
|
|
9030
9046
|
* 设置合并单元格
|
|
9031
9047
|
* @param {TableMergeConfig[]} merges { row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }
|
|
@@ -9073,9 +9089,6 @@ const Methods = {
|
|
|
9073
9089
|
return updateStyle($xeTable);
|
|
9074
9090
|
});
|
|
9075
9091
|
},
|
|
9076
|
-
handleDefaultMergeFooterItems() {
|
|
9077
|
-
this.setMergeFooterItems(this.mergeFooterItems);
|
|
9078
|
-
},
|
|
9079
9092
|
setMergeFooterItems(merges) {
|
|
9080
9093
|
const $xeTable = this;
|
|
9081
9094
|
if (this.footerSpanMethod) {
|