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/lib/table/src/methods.js
CHANGED
|
@@ -372,14 +372,14 @@ const updateScrollYStatus = ($xeTable, fullData) => {
|
|
|
372
372
|
const {
|
|
373
373
|
treeConfig
|
|
374
374
|
} = props;
|
|
375
|
-
const
|
|
375
|
+
const virtualYOpts = $xeTable.computeVirtualYOpts;
|
|
376
376
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
377
377
|
const {
|
|
378
378
|
transform
|
|
379
379
|
} = treeOpts;
|
|
380
380
|
const allList = fullData || internalData.tableFullData;
|
|
381
381
|
// 如果gt为0,则总是启用
|
|
382
|
-
const scrollYLoad = (transform || !treeConfig) && !!
|
|
382
|
+
const scrollYLoad = (transform || !treeConfig) && !!virtualYOpts.enabled && virtualYOpts.gt > -1 && (virtualYOpts.gt === 0 || virtualYOpts.gt < allList.length);
|
|
383
383
|
reactData.scrollYLoad = scrollYLoad;
|
|
384
384
|
return scrollYLoad;
|
|
385
385
|
};
|
|
@@ -540,7 +540,6 @@ function updateStyle($xeTable) {
|
|
|
540
540
|
const reactData = $xeTable;
|
|
541
541
|
const internalData = $xeTable;
|
|
542
542
|
const {
|
|
543
|
-
border,
|
|
544
543
|
showHeaderOverflow: allColumnHeaderOverflow,
|
|
545
544
|
showFooterOverflow: allColumnFooterOverflow,
|
|
546
545
|
mouseConfig,
|
|
@@ -719,36 +718,6 @@ function updateStyle($xeTable) {
|
|
|
719
718
|
if (tableElem) {
|
|
720
719
|
tableElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
721
720
|
}
|
|
722
|
-
const listElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-list`]);
|
|
723
|
-
if (isGroup && listElem) {
|
|
724
|
-
_xeUtils.default.arrayEach(listElem.querySelectorAll('.col--group'), thElem => {
|
|
725
|
-
const colNode = $xeTable.getColumnNode(thElem);
|
|
726
|
-
if (colNode) {
|
|
727
|
-
const column = colNode.item;
|
|
728
|
-
const {
|
|
729
|
-
showHeaderOverflow
|
|
730
|
-
} = column;
|
|
731
|
-
const cellOverflow = _xeUtils.default.isBoolean(showHeaderOverflow) ? showHeaderOverflow : allColumnHeaderOverflow;
|
|
732
|
-
const showEllipsis = cellOverflow === 'ellipsis';
|
|
733
|
-
const showTitle = cellOverflow === 'title';
|
|
734
|
-
const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
|
|
735
|
-
const hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
736
|
-
let childWidth = 0;
|
|
737
|
-
let countChild = 0;
|
|
738
|
-
if (hasEllipsis) {
|
|
739
|
-
_xeUtils.default.eachTree(column.children, item => {
|
|
740
|
-
if (!item.children || !column.children.length) {
|
|
741
|
-
countChild++;
|
|
742
|
-
}
|
|
743
|
-
childWidth += item.renderWidth;
|
|
744
|
-
}, {
|
|
745
|
-
children: 'children'
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
thElem.style.width = hasEllipsis ? `${childWidth - countChild - (border ? 2 : 0)}px` : '';
|
|
749
|
-
}
|
|
750
|
-
});
|
|
751
|
-
}
|
|
752
721
|
} else if (layout === 'body') {
|
|
753
722
|
if (currScrollElem) {
|
|
754
723
|
currScrollElem.style.maxHeight = customMaxHeight ? `${bodyMaxHeight}px` : '';
|
|
@@ -867,6 +836,134 @@ function handleChangeCell($xeTable, evnt, params) {
|
|
|
867
836
|
$xeTable.handleEdit(params, evnt).then(() => checkValidate($xeTable, 'change')).catch(e => e);
|
|
868
837
|
});
|
|
869
838
|
}
|
|
839
|
+
function handleDefaultSort($xeTable) {
|
|
840
|
+
const props = $xeTable;
|
|
841
|
+
const {
|
|
842
|
+
sortConfig
|
|
843
|
+
} = props;
|
|
844
|
+
if (sortConfig) {
|
|
845
|
+
const sortOpts = $xeTable.computeSortOpts;
|
|
846
|
+
let {
|
|
847
|
+
defaultSort
|
|
848
|
+
} = sortOpts;
|
|
849
|
+
if (defaultSort) {
|
|
850
|
+
if (!_xeUtils.default.isArray(defaultSort)) {
|
|
851
|
+
defaultSort = [defaultSort];
|
|
852
|
+
}
|
|
853
|
+
if (defaultSort.length) {
|
|
854
|
+
(sortConfig.multiple ? defaultSort : defaultSort.slice(0, 1)).forEach((item, index) => {
|
|
855
|
+
const {
|
|
856
|
+
field,
|
|
857
|
+
order
|
|
858
|
+
} = item;
|
|
859
|
+
if (field && order) {
|
|
860
|
+
const column = $xeTable.getColumnByField(field);
|
|
861
|
+
if (column && column.sortable) {
|
|
862
|
+
column.order = order;
|
|
863
|
+
column.sortTime = Date.now() + index;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
});
|
|
867
|
+
if (!sortOpts.remote) {
|
|
868
|
+
$xeTable.handleTableData(true).then(updateStyle);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* 处理默认勾选
|
|
876
|
+
*/
|
|
877
|
+
function handleDefaultSelectionChecked($xeTable) {
|
|
878
|
+
const props = $xeTable;
|
|
879
|
+
const internalData = $xeTable;
|
|
880
|
+
const {
|
|
881
|
+
checkboxConfig
|
|
882
|
+
} = props;
|
|
883
|
+
if (checkboxConfig) {
|
|
884
|
+
const {
|
|
885
|
+
fullDataRowIdData
|
|
886
|
+
} = internalData;
|
|
887
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
888
|
+
const {
|
|
889
|
+
checkAll,
|
|
890
|
+
checkRowKeys
|
|
891
|
+
} = checkboxOpts;
|
|
892
|
+
if (checkAll) {
|
|
893
|
+
handleCheckedAllCheckboxRow($xeTable, true, true);
|
|
894
|
+
} else if (checkRowKeys) {
|
|
895
|
+
const defSelection = [];
|
|
896
|
+
checkRowKeys.forEach(rowid => {
|
|
897
|
+
if (fullDataRowIdData[rowid]) {
|
|
898
|
+
defSelection.push(fullDataRowIdData[rowid].row);
|
|
899
|
+
}
|
|
900
|
+
});
|
|
901
|
+
handleCheckedCheckboxRow($xeTable, defSelection, true, true);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* 处理单选框默认勾选
|
|
907
|
+
*/
|
|
908
|
+
function handleDefaultRadioChecked($xeTable) {
|
|
909
|
+
const props = $xeTable;
|
|
910
|
+
const internalData = $xeTable;
|
|
911
|
+
const {
|
|
912
|
+
radioConfig
|
|
913
|
+
} = props;
|
|
914
|
+
if (radioConfig) {
|
|
915
|
+
const {
|
|
916
|
+
fullDataRowIdData
|
|
917
|
+
} = internalData;
|
|
918
|
+
const radioOpts = $xeTable.computeRadioOpts;
|
|
919
|
+
const {
|
|
920
|
+
checkRowKey: rowid,
|
|
921
|
+
reserve
|
|
922
|
+
} = radioOpts;
|
|
923
|
+
if (rowid) {
|
|
924
|
+
if (fullDataRowIdData[rowid]) {
|
|
925
|
+
handleCheckedRadioRow(fullDataRowIdData[rowid].row, true);
|
|
926
|
+
}
|
|
927
|
+
if (reserve) {
|
|
928
|
+
const rowkey = (0, _util.getRowkey)($xeTable);
|
|
929
|
+
internalData.radioReserveRow = {
|
|
930
|
+
[rowkey]: rowid
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* 处理默认展开行
|
|
938
|
+
*/
|
|
939
|
+
function handleDefaultRowExpand($xeTable) {
|
|
940
|
+
const props = $xeTable;
|
|
941
|
+
const internalData = $xeTable;
|
|
942
|
+
const {
|
|
943
|
+
expandConfig
|
|
944
|
+
} = props;
|
|
945
|
+
if (expandConfig) {
|
|
946
|
+
const {
|
|
947
|
+
fullDataRowIdData
|
|
948
|
+
} = internalData;
|
|
949
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
950
|
+
const {
|
|
951
|
+
expandAll,
|
|
952
|
+
expandRowKeys
|
|
953
|
+
} = expandOpts;
|
|
954
|
+
if (expandAll) {
|
|
955
|
+
$xeTable.setAllRowExpand(true);
|
|
956
|
+
} else if (expandRowKeys) {
|
|
957
|
+
const defExpandeds = [];
|
|
958
|
+
expandRowKeys.forEach(rowid => {
|
|
959
|
+
if (fullDataRowIdData[rowid]) {
|
|
960
|
+
defExpandeds.push(fullDataRowIdData[rowid].row);
|
|
961
|
+
}
|
|
962
|
+
});
|
|
963
|
+
$xeTable.setRowExpand(defExpandeds, true);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
}
|
|
870
967
|
function handleRadioReserveRow($xeTable, row) {
|
|
871
968
|
const internalData = $xeTable;
|
|
872
969
|
const radioOpts = $xeTable.computeRadioOpts;
|
|
@@ -1429,21 +1526,19 @@ function calculateMergerOffsetIndex(list, offsetItem, type) {
|
|
|
1429
1526
|
}
|
|
1430
1527
|
}
|
|
1431
1528
|
function setMerges($xeTable, merges, mList, rowList) {
|
|
1432
|
-
const props = $xeTable
|
|
1529
|
+
// const props = $xeTable
|
|
1433
1530
|
const internalData = $xeTable;
|
|
1434
1531
|
if (merges) {
|
|
1435
|
-
const {
|
|
1436
|
-
treeConfig
|
|
1437
|
-
} = props;
|
|
1532
|
+
// const { treeConfig } = props
|
|
1438
1533
|
const {
|
|
1439
1534
|
visibleColumn
|
|
1440
1535
|
} = internalData;
|
|
1441
1536
|
if (!_xeUtils.default.isArray(merges)) {
|
|
1442
1537
|
merges = [merges];
|
|
1443
1538
|
}
|
|
1444
|
-
if (treeConfig && merges.length) {
|
|
1445
|
-
|
|
1446
|
-
}
|
|
1539
|
+
// if (treeConfig && merges.length) {
|
|
1540
|
+
// errLog('vxe.error.noTree', ['merge-cells | merge-footer-items'])
|
|
1541
|
+
// }
|
|
1447
1542
|
merges.forEach(item => {
|
|
1448
1543
|
let {
|
|
1449
1544
|
row,
|
|
@@ -1488,22 +1583,20 @@ function setMerges($xeTable, merges, mList, rowList) {
|
|
|
1488
1583
|
}
|
|
1489
1584
|
}
|
|
1490
1585
|
function removeMerges($xeTable, merges, mList, rowList) {
|
|
1491
|
-
const props = $xeTable
|
|
1586
|
+
// const props = $xeTable
|
|
1492
1587
|
const internalData = $xeTable;
|
|
1493
1588
|
const rest = [];
|
|
1494
1589
|
if (merges) {
|
|
1495
|
-
const {
|
|
1496
|
-
treeConfig
|
|
1497
|
-
} = props;
|
|
1590
|
+
// const { treeConfig } = props
|
|
1498
1591
|
const {
|
|
1499
1592
|
visibleColumn
|
|
1500
1593
|
} = internalData;
|
|
1501
1594
|
if (!_xeUtils.default.isArray(merges)) {
|
|
1502
1595
|
merges = [merges];
|
|
1503
1596
|
}
|
|
1504
|
-
if (treeConfig && merges.length) {
|
|
1505
|
-
|
|
1506
|
-
}
|
|
1597
|
+
// if (treeConfig && merges.length) {
|
|
1598
|
+
// errLog('vxe.error.noTree', ['merge-cells | merge-footer-items'])
|
|
1599
|
+
// }
|
|
1507
1600
|
merges.forEach(item => {
|
|
1508
1601
|
let {
|
|
1509
1602
|
row,
|
|
@@ -2039,7 +2132,7 @@ function handleScrollToRowColumn($xeTable, fieldOrColumn, row) {
|
|
|
2039
2132
|
}
|
|
2040
2133
|
return $xeTable.$nextTick();
|
|
2041
2134
|
}
|
|
2042
|
-
|
|
2135
|
+
function handleRowExpandReserve($xeTable, row, expanded) {
|
|
2043
2136
|
const internalData = $xeTable;
|
|
2044
2137
|
const {
|
|
2045
2138
|
rowExpandedReserveRowMap
|
|
@@ -2053,7 +2146,25 @@ const handleRowExpandReserve = ($xeTable, row, expanded) => {
|
|
|
2053
2146
|
delete rowExpandedReserveRowMap[rowid];
|
|
2054
2147
|
}
|
|
2055
2148
|
}
|
|
2056
|
-
}
|
|
2149
|
+
}
|
|
2150
|
+
function handleDefaultMergeCells($xeTable) {
|
|
2151
|
+
const props = $xeTable;
|
|
2152
|
+
const {
|
|
2153
|
+
mergeCells
|
|
2154
|
+
} = props;
|
|
2155
|
+
if (mergeCells) {
|
|
2156
|
+
$xeTable.setMergeCells(mergeCells);
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
function handleDefaultMergeFooterItems($xeTable) {
|
|
2160
|
+
const props = $xeTable;
|
|
2161
|
+
const {
|
|
2162
|
+
mergeFooterItems
|
|
2163
|
+
} = props;
|
|
2164
|
+
if (mergeFooterItems) {
|
|
2165
|
+
$xeTable.setMergeFooterItems(mergeFooterItems);
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2057
2168
|
// 计算可视渲染相关数据
|
|
2058
2169
|
function computeScrollLoad($xeTable) {
|
|
2059
2170
|
const reactData = $xeTable;
|
|
@@ -2151,6 +2262,26 @@ function handleRecalculateLayout($xeTable, reFull) {
|
|
|
2151
2262
|
}
|
|
2152
2263
|
});
|
|
2153
2264
|
}
|
|
2265
|
+
/**
|
|
2266
|
+
* 处理数据加载默认行为
|
|
2267
|
+
* 默认执行一次,除非被重置
|
|
2268
|
+
*/
|
|
2269
|
+
function handleLoadDefaults($xeTable) {
|
|
2270
|
+
handleDefaultSelectionChecked($xeTable);
|
|
2271
|
+
handleDefaultRadioChecked($xeTable);
|
|
2272
|
+
handleDefaultRowExpand($xeTable);
|
|
2273
|
+
handleDefaultTreeExpand($xeTable);
|
|
2274
|
+
handleDefaultMergeCells($xeTable);
|
|
2275
|
+
handleDefaultMergeFooterItems($xeTable);
|
|
2276
|
+
$xeTable.$nextTick(() => setTimeout(() => $xeTable.recalculate()));
|
|
2277
|
+
}
|
|
2278
|
+
/**
|
|
2279
|
+
* 处理初始化的默认行为
|
|
2280
|
+
* 只会执行一次
|
|
2281
|
+
*/
|
|
2282
|
+
function handleInitDefaults($xeTable) {
|
|
2283
|
+
handleDefaultSort($xeTable);
|
|
2284
|
+
}
|
|
2154
2285
|
function handleTableColumn($xeTable) {
|
|
2155
2286
|
const reactData = $xeTable;
|
|
2156
2287
|
const internalData = $xeTable;
|
|
@@ -2242,7 +2373,7 @@ function parseColumns($xeTable, isReset) {
|
|
|
2242
2373
|
isGroup,
|
|
2243
2374
|
columnStore
|
|
2244
2375
|
} = reactData;
|
|
2245
|
-
const
|
|
2376
|
+
const virtualXOpts = $xeTable.computeVirtualXOpts;
|
|
2246
2377
|
const {
|
|
2247
2378
|
collectColumn,
|
|
2248
2379
|
tableFullColumn,
|
|
@@ -2303,7 +2434,7 @@ function parseColumns($xeTable, isReset) {
|
|
|
2303
2434
|
}
|
|
2304
2435
|
const visibleColumn = leftList.concat(centerList).concat(rightList);
|
|
2305
2436
|
// 如果gt为0,则总是启用
|
|
2306
|
-
const scrollXLoad = !!
|
|
2437
|
+
const scrollXLoad = !!virtualXOpts.enabled && virtualXOpts.gt > -1 && (virtualXOpts.gt === 0 || virtualXOpts.gt < tableFullColumn.length);
|
|
2307
2438
|
reactData.hasFixedColumn = leftList.length > 0 || rightList.length > 0;
|
|
2308
2439
|
Object.assign(columnStore, {
|
|
2309
2440
|
leftList,
|
|
@@ -2957,21 +3088,26 @@ const Methods = {
|
|
|
2957
3088
|
*/
|
|
2958
3089
|
loadTableData(datas, isReset) {
|
|
2959
3090
|
const $xeTable = this;
|
|
3091
|
+
const props = $xeTable;
|
|
2960
3092
|
const reactData = $xeTable;
|
|
2961
3093
|
const internalData = $xeTable;
|
|
2962
3094
|
const {
|
|
2963
3095
|
keepSource,
|
|
2964
|
-
treeConfig
|
|
2965
|
-
|
|
2966
|
-
|
|
3096
|
+
treeConfig
|
|
3097
|
+
} = props;
|
|
3098
|
+
const {
|
|
3099
|
+
scrollYLoad: oldScrollYLoad
|
|
3100
|
+
} = reactData;
|
|
3101
|
+
const {
|
|
2967
3102
|
scrollYStore,
|
|
2968
3103
|
scrollXStore,
|
|
2969
3104
|
lastScrollLeft,
|
|
2970
|
-
lastScrollTop
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
3105
|
+
lastScrollTop
|
|
3106
|
+
} = internalData;
|
|
3107
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
3108
|
+
const {
|
|
3109
|
+
transform
|
|
3110
|
+
} = treeOpts;
|
|
2975
3111
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2976
3112
|
let treeData = [];
|
|
2977
3113
|
let fullData = datas ? datas.slice(0) : [];
|
|
@@ -2980,7 +3116,7 @@ const Methods = {
|
|
|
2980
3116
|
}
|
|
2981
3117
|
if (treeConfig) {
|
|
2982
3118
|
// 树结构自动转换
|
|
2983
|
-
if (
|
|
3119
|
+
if (transform) {
|
|
2984
3120
|
if (!treeOpts.rowField) {
|
|
2985
3121
|
(0, _log.errLog)('vxe.error.reqProp', ['table.tree-config.rowField']);
|
|
2986
3122
|
}
|
|
@@ -3018,8 +3154,8 @@ const Methods = {
|
|
|
3018
3154
|
scrollXStore.endIndex = 1;
|
|
3019
3155
|
reactData.isRowLoading = true;
|
|
3020
3156
|
reactData.scrollVMLoading = false;
|
|
3021
|
-
|
|
3022
|
-
|
|
3157
|
+
internalData.insertRowMaps = {};
|
|
3158
|
+
internalData.removeRowMaps = {};
|
|
3023
3159
|
const sYLoad = updateScrollYStatus($xeTable, fullData);
|
|
3024
3160
|
reactData.isDragColMove = false;
|
|
3025
3161
|
reactData.isDragRowMove = false;
|
|
@@ -3037,15 +3173,15 @@ const Methods = {
|
|
|
3037
3173
|
if (keepSource) {
|
|
3038
3174
|
$xeTable.cacheSourceMap(fullData);
|
|
3039
3175
|
}
|
|
3040
|
-
if (
|
|
3041
|
-
|
|
3042
|
-
|
|
3176
|
+
if ($xeTable.clearCellAreas && props.mouseConfig) {
|
|
3177
|
+
$xeTable.clearCellAreas();
|
|
3178
|
+
$xeTable.clearCopyCellArea();
|
|
3043
3179
|
}
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
return
|
|
3180
|
+
$xeTable.clearMergeCells();
|
|
3181
|
+
$xeTable.clearMergeFooterItems();
|
|
3182
|
+
$xeTable.handleTableData(true);
|
|
3183
|
+
$xeTable.updateFooter();
|
|
3184
|
+
return $xeTable.$nextTick().then(() => {
|
|
3049
3185
|
updateHeight($xeTable);
|
|
3050
3186
|
updateStyle($xeTable);
|
|
3051
3187
|
}).then(() => {
|
|
@@ -3058,45 +3194,47 @@ const Methods = {
|
|
|
3058
3194
|
if (sYLoad) {
|
|
3059
3195
|
// if (showOverflow) {
|
|
3060
3196
|
// if (!rowOpts.height) {
|
|
3061
|
-
// const errColumn =
|
|
3197
|
+
// const errColumn = internalData.tableFullColumn.find((column: any) => column.showOverflow === false)
|
|
3062
3198
|
// if (errColumn) {
|
|
3063
3199
|
// errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
|
|
3064
3200
|
// }
|
|
3065
3201
|
// }
|
|
3066
3202
|
// }
|
|
3067
|
-
if (!(
|
|
3203
|
+
if (!(props.height || props.maxHeight)) {
|
|
3068
3204
|
(0, _log.errLog)('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
|
|
3069
3205
|
}
|
|
3070
|
-
// if (!
|
|
3206
|
+
// if (!props.showOverflow) {
|
|
3071
3207
|
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
3072
3208
|
// }
|
|
3073
|
-
if (
|
|
3209
|
+
if (props.spanMethod) {
|
|
3074
3210
|
(0, _log.errLog)('vxe.error.scrollErrProp', ['table.span-method']);
|
|
3075
3211
|
}
|
|
3076
3212
|
}
|
|
3077
3213
|
handleReserveStatus($xeTable);
|
|
3078
|
-
|
|
3214
|
+
$xeTable.checkSelectionStatus();
|
|
3079
3215
|
return new Promise(resolve => {
|
|
3080
|
-
this.$nextTick().then(() =>
|
|
3216
|
+
this.$nextTick().then(() => $xeTable.recalculate()).then(() => {
|
|
3081
3217
|
let targetScrollLeft = lastScrollLeft;
|
|
3082
3218
|
let targetScrollTop = lastScrollTop;
|
|
3219
|
+
const virtualXOpts = $xeTable.computeVirtualXOpts;
|
|
3220
|
+
const virtualYOpts = $xeTable.computeVirtualYOpts;
|
|
3083
3221
|
// 是否在更新数据之后自动滚动重置滚动条
|
|
3084
|
-
if (
|
|
3222
|
+
if (virtualXOpts.scrollToLeftOnChange) {
|
|
3085
3223
|
targetScrollLeft = 0;
|
|
3086
3224
|
}
|
|
3087
|
-
if (
|
|
3225
|
+
if (virtualYOpts.scrollToTopOnChange) {
|
|
3088
3226
|
targetScrollTop = 0;
|
|
3089
3227
|
}
|
|
3090
3228
|
reactData.isRowLoading = false;
|
|
3091
3229
|
calcCellHeight($xeTable);
|
|
3092
3230
|
// 是否变更虚拟滚动
|
|
3093
3231
|
if (oldScrollYLoad === sYLoad) {
|
|
3094
|
-
(0, _util.restoreScrollLocation)(
|
|
3232
|
+
(0, _util.restoreScrollLocation)($xeTable, targetScrollLeft, targetScrollTop).then(() => {
|
|
3095
3233
|
resolve();
|
|
3096
3234
|
});
|
|
3097
3235
|
} else {
|
|
3098
3236
|
setTimeout(() => {
|
|
3099
|
-
(0, _util.restoreScrollLocation)(
|
|
3237
|
+
(0, _util.restoreScrollLocation)($xeTable, targetScrollLeft, targetScrollTop).then(() => {
|
|
3100
3238
|
resolve();
|
|
3101
3239
|
});
|
|
3102
3240
|
});
|
|
@@ -3110,6 +3248,7 @@ const Methods = {
|
|
|
3110
3248
|
* @param {Array} datas 数据
|
|
3111
3249
|
*/
|
|
3112
3250
|
loadData(datas) {
|
|
3251
|
+
const $xeTable = this;
|
|
3113
3252
|
const {
|
|
3114
3253
|
initStatus
|
|
3115
3254
|
} = this;
|
|
@@ -3117,7 +3256,7 @@ const Methods = {
|
|
|
3117
3256
|
this.inited = true;
|
|
3118
3257
|
this.initStatus = true;
|
|
3119
3258
|
if (!initStatus) {
|
|
3120
|
-
|
|
3259
|
+
handleLoadDefaults($xeTable);
|
|
3121
3260
|
}
|
|
3122
3261
|
return this.recalculate();
|
|
3123
3262
|
});
|
|
@@ -3127,12 +3266,13 @@ const Methods = {
|
|
|
3127
3266
|
* @param {Array} datas 数据
|
|
3128
3267
|
*/
|
|
3129
3268
|
reloadData(datas) {
|
|
3269
|
+
const $xeTable = this;
|
|
3130
3270
|
return this.clearAll().then(() => {
|
|
3131
3271
|
this.inited = true;
|
|
3132
3272
|
this.initStatus = true;
|
|
3133
3273
|
return this.loadTableData(datas, true);
|
|
3134
3274
|
}).then(() => {
|
|
3135
|
-
|
|
3275
|
+
handleLoadDefaults($xeTable);
|
|
3136
3276
|
return this.recalculate();
|
|
3137
3277
|
});
|
|
3138
3278
|
},
|
|
@@ -3324,18 +3464,24 @@ const Methods = {
|
|
|
3324
3464
|
internalData.tableSourceData = sourceData;
|
|
3325
3465
|
},
|
|
3326
3466
|
getParams() {
|
|
3327
|
-
|
|
3467
|
+
const $xeTable = this;
|
|
3468
|
+
const props = $xeTable;
|
|
3469
|
+
return props.params;
|
|
3328
3470
|
},
|
|
3329
3471
|
loadTreeChildren(row, childRecords) {
|
|
3330
3472
|
const $xeTable = this;
|
|
3473
|
+
const props = $xeTable;
|
|
3474
|
+
const internalData = $xeTable;
|
|
3475
|
+
const {
|
|
3476
|
+
keepSource
|
|
3477
|
+
} = props;
|
|
3331
3478
|
const {
|
|
3332
|
-
keepSource,
|
|
3333
3479
|
tableSourceData,
|
|
3334
|
-
treeOpts,
|
|
3335
3480
|
fullDataRowIdData,
|
|
3336
3481
|
fullAllDataRowIdData,
|
|
3337
3482
|
sourceDataRowIdData
|
|
3338
|
-
} =
|
|
3483
|
+
} = internalData;
|
|
3484
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
3339
3485
|
const {
|
|
3340
3486
|
transform,
|
|
3341
3487
|
mapChildrenField
|
|
@@ -3394,20 +3540,24 @@ const Methods = {
|
|
|
3394
3540
|
* @param {Element} tr 元素
|
|
3395
3541
|
*/
|
|
3396
3542
|
getRowNode(tr) {
|
|
3543
|
+
const $xeTable = this;
|
|
3544
|
+
const internalData = $xeTable;
|
|
3397
3545
|
if (tr) {
|
|
3398
3546
|
const {
|
|
3399
3547
|
fullAllDataRowIdData
|
|
3400
|
-
} =
|
|
3548
|
+
} = internalData;
|
|
3401
3549
|
const rowid = tr.getAttribute('rowid');
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3550
|
+
if (rowid) {
|
|
3551
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
3552
|
+
if (rowRest) {
|
|
3553
|
+
return {
|
|
3554
|
+
rowid: rowRest.rowid,
|
|
3555
|
+
item: rowRest.row,
|
|
3556
|
+
index: rowRest.index,
|
|
3557
|
+
items: rowRest.items,
|
|
3558
|
+
parent: rowRest.parent
|
|
3559
|
+
};
|
|
3560
|
+
}
|
|
3411
3561
|
}
|
|
3412
3562
|
}
|
|
3413
3563
|
return null;
|
|
@@ -3417,10 +3567,12 @@ const Methods = {
|
|
|
3417
3567
|
* @param {Element} cell 元素
|
|
3418
3568
|
*/
|
|
3419
3569
|
getColumnNode(cell) {
|
|
3570
|
+
const $xeTable = this;
|
|
3571
|
+
const internalData = $xeTable;
|
|
3420
3572
|
if (cell) {
|
|
3421
3573
|
const {
|
|
3422
3574
|
fullColumnIdData
|
|
3423
|
-
} =
|
|
3575
|
+
} = internalData;
|
|
3424
3576
|
const colid = cell.getAttribute('colid');
|
|
3425
3577
|
if (colid) {
|
|
3426
3578
|
const colRest = fullColumnIdData[colid];
|
|
@@ -3512,20 +3664,23 @@ const Methods = {
|
|
|
3512
3664
|
* @param {Row} records 行数据
|
|
3513
3665
|
*/
|
|
3514
3666
|
defineField(records) {
|
|
3667
|
+
const $xeTable = this;
|
|
3668
|
+
const props = $xeTable;
|
|
3669
|
+
const internalData = $xeTable;
|
|
3515
3670
|
const {
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3671
|
+
treeConfig
|
|
3672
|
+
} = props;
|
|
3673
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
3674
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
3675
|
+
const radioOpts = $xeTable.computeRadioOpts;
|
|
3676
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
3522
3677
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
3523
|
-
const rowkey = (0, _util.getRowkey)(
|
|
3678
|
+
const rowkey = (0, _util.getRowkey)($xeTable);
|
|
3524
3679
|
if (!_xeUtils.default.isArray(records)) {
|
|
3525
3680
|
records = [records || {}];
|
|
3526
3681
|
}
|
|
3527
3682
|
return records.map(record => {
|
|
3528
|
-
|
|
3683
|
+
internalData.tableFullColumn.forEach(column => {
|
|
3529
3684
|
const {
|
|
3530
3685
|
field,
|
|
3531
3686
|
editRender
|
|
@@ -3569,8 +3724,9 @@ const Methods = {
|
|
|
3569
3724
|
* @param {Array} records 新数据
|
|
3570
3725
|
*/
|
|
3571
3726
|
createData(records) {
|
|
3572
|
-
|
|
3573
|
-
|
|
3727
|
+
const $xeTable = this;
|
|
3728
|
+
return $xeTable.$nextTick().then(() => {
|
|
3729
|
+
return $xeTable.defineField(records);
|
|
3574
3730
|
});
|
|
3575
3731
|
},
|
|
3576
3732
|
/**
|
|
@@ -3579,11 +3735,12 @@ const Methods = {
|
|
|
3579
3735
|
* @param {Array/Object} records 新数据
|
|
3580
3736
|
*/
|
|
3581
3737
|
createRow(records) {
|
|
3738
|
+
const $xeTable = this;
|
|
3582
3739
|
const isArr = _xeUtils.default.isArray(records);
|
|
3583
3740
|
if (!isArr) {
|
|
3584
3741
|
records = [records];
|
|
3585
3742
|
}
|
|
3586
|
-
return
|
|
3743
|
+
return $xeTable.createData(records).then(rows => isArr ? rows : rows[0]);
|
|
3587
3744
|
},
|
|
3588
3745
|
/**
|
|
3589
3746
|
* 还原数据
|
|
@@ -3601,18 +3758,15 @@ const Methods = {
|
|
|
3601
3758
|
keepSource,
|
|
3602
3759
|
treeConfig
|
|
3603
3760
|
} = props;
|
|
3604
|
-
const {
|
|
3605
|
-
editStore
|
|
3606
|
-
} = reactData;
|
|
3607
3761
|
const {
|
|
3608
3762
|
fullAllDataRowIdData,
|
|
3609
3763
|
fullDataRowIdData,
|
|
3610
3764
|
tableSourceData,
|
|
3611
3765
|
sourceDataRowIdData,
|
|
3612
3766
|
tableFullData,
|
|
3613
|
-
afterFullData
|
|
3767
|
+
afterFullData,
|
|
3768
|
+
removeRowMaps
|
|
3614
3769
|
} = internalData;
|
|
3615
|
-
const removeTempMaps = Object.assign({}, editStore.removeMaps);
|
|
3616
3770
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
3617
3771
|
const {
|
|
3618
3772
|
transform
|
|
@@ -3650,7 +3804,9 @@ const Methods = {
|
|
|
3650
3804
|
_xeUtils.default.destructuring(row, _xeUtils.default.clone(oRow, true));
|
|
3651
3805
|
}
|
|
3652
3806
|
if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
|
|
3653
|
-
|
|
3807
|
+
if (removeRowMaps[rowid]) {
|
|
3808
|
+
delete removeRowMaps[rowid];
|
|
3809
|
+
}
|
|
3654
3810
|
tableFullData.unshift(row);
|
|
3655
3811
|
afterFullData.unshift(row);
|
|
3656
3812
|
reDelFlag = true;
|
|
@@ -3662,7 +3818,7 @@ const Methods = {
|
|
|
3662
3818
|
}
|
|
3663
3819
|
if (rows) {
|
|
3664
3820
|
if (reDelFlag) {
|
|
3665
|
-
|
|
3821
|
+
reactData.removeRowFlag++;
|
|
3666
3822
|
$xeTable.updateFooter();
|
|
3667
3823
|
$xeTable.cacheRowMap(false);
|
|
3668
3824
|
$xeTable.handleTableData(treeConfig && transform);
|
|
@@ -3691,10 +3847,12 @@ const Methods = {
|
|
|
3691
3847
|
* @param {String} field 字段名
|
|
3692
3848
|
*/
|
|
3693
3849
|
clearData(rows, field) {
|
|
3850
|
+
const $xeTable = this;
|
|
3851
|
+
const internalData = $xeTable;
|
|
3694
3852
|
const {
|
|
3695
3853
|
tableFullData,
|
|
3696
3854
|
visibleColumn
|
|
3697
|
-
} =
|
|
3855
|
+
} = internalData;
|
|
3698
3856
|
if (!arguments.length) {
|
|
3699
3857
|
rows = tableFullData;
|
|
3700
3858
|
} else if (rows && !_xeUtils.default.isArray(rows)) {
|
|
@@ -3711,7 +3869,7 @@ const Methods = {
|
|
|
3711
3869
|
});
|
|
3712
3870
|
});
|
|
3713
3871
|
}
|
|
3714
|
-
return
|
|
3872
|
+
return $xeTable.$nextTick();
|
|
3715
3873
|
},
|
|
3716
3874
|
getCellElement(row, fieldOrColumn) {
|
|
3717
3875
|
const $xeTable = this;
|
|
@@ -3812,20 +3970,16 @@ const Methods = {
|
|
|
3812
3970
|
isInsertByRow(row) {
|
|
3813
3971
|
const $xeTable = this;
|
|
3814
3972
|
const reactData = $xeTable;
|
|
3815
|
-
const
|
|
3816
|
-
editStore
|
|
3817
|
-
} = reactData;
|
|
3973
|
+
const internalData = $xeTable;
|
|
3818
3974
|
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
3819
|
-
return !!
|
|
3975
|
+
return !!reactData.insertRowFlag && !!internalData.insertRowMaps[rowid];
|
|
3820
3976
|
},
|
|
3821
3977
|
isRemoveByRow(row) {
|
|
3822
3978
|
const $xeTable = this;
|
|
3823
3979
|
const reactData = $xeTable;
|
|
3824
|
-
const
|
|
3825
|
-
editStore
|
|
3826
|
-
} = reactData;
|
|
3980
|
+
const internalData = $xeTable;
|
|
3827
3981
|
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
3828
|
-
return !!
|
|
3982
|
+
return !!reactData.removeRowFlag && !!internalData.removeRowMaps[rowid];
|
|
3829
3983
|
},
|
|
3830
3984
|
/**
|
|
3831
3985
|
* 删除所有新增的临时数据
|
|
@@ -3833,11 +3987,8 @@ const Methods = {
|
|
|
3833
3987
|
*/
|
|
3834
3988
|
removeInsertRow() {
|
|
3835
3989
|
const $xeTable = this;
|
|
3836
|
-
const
|
|
3837
|
-
|
|
3838
|
-
editStore
|
|
3839
|
-
} = reactData;
|
|
3840
|
-
editStore.insertMaps = {};
|
|
3990
|
+
const internalData = $xeTable;
|
|
3991
|
+
internalData.insertRowMaps = {};
|
|
3841
3992
|
return $xeTable.remove($xeTable.getInsertRecords());
|
|
3842
3993
|
},
|
|
3843
3994
|
/**
|
|
@@ -3885,14 +4036,19 @@ const Methods = {
|
|
|
3885
4036
|
* @param {Number} columnIndex 索引
|
|
3886
4037
|
*/
|
|
3887
4038
|
getColumns(columnIndex) {
|
|
3888
|
-
const
|
|
3889
|
-
|
|
4039
|
+
const $xeTable = this;
|
|
4040
|
+
const internalData = $xeTable;
|
|
4041
|
+
const {
|
|
4042
|
+
visibleColumn
|
|
4043
|
+
} = internalData;
|
|
4044
|
+
return _xeUtils.default.isUndefined(columnIndex) ? visibleColumn.slice(0) : visibleColumn[columnIndex];
|
|
3890
4045
|
},
|
|
3891
4046
|
/**
|
|
3892
4047
|
* 根据列获取列的唯一主键
|
|
3893
4048
|
*/
|
|
3894
4049
|
getColid(fieldOrColumn) {
|
|
3895
|
-
const
|
|
4050
|
+
const $xeTable = this;
|
|
4051
|
+
const column = (0, _util.handleFieldOrColumn)($xeTable, fieldOrColumn);
|
|
3896
4052
|
return column ? column.id : null;
|
|
3897
4053
|
},
|
|
3898
4054
|
/**
|
|
@@ -3900,7 +4056,11 @@ const Methods = {
|
|
|
3900
4056
|
* @param {String} colid 列主键
|
|
3901
4057
|
*/
|
|
3902
4058
|
getColumnById(colid) {
|
|
3903
|
-
const
|
|
4059
|
+
const $xeTable = this;
|
|
4060
|
+
const internalData = $xeTable;
|
|
4061
|
+
const {
|
|
4062
|
+
fullColumnIdData
|
|
4063
|
+
} = internalData;
|
|
3904
4064
|
return fullColumnIdData[colid] ? fullColumnIdData[colid].column : null;
|
|
3905
4065
|
},
|
|
3906
4066
|
/**
|
|
@@ -3908,7 +4068,11 @@ const Methods = {
|
|
|
3908
4068
|
* @param {String} field 字段名
|
|
3909
4069
|
*/
|
|
3910
4070
|
getColumnByField(field) {
|
|
3911
|
-
const
|
|
4071
|
+
const $xeTable = this;
|
|
4072
|
+
const internalData = $xeTable;
|
|
4073
|
+
const {
|
|
4074
|
+
fullColumnFieldData
|
|
4075
|
+
} = internalData;
|
|
3912
4076
|
return fullColumnFieldData[field] ? fullColumnFieldData[field].column : null;
|
|
3913
4077
|
},
|
|
3914
4078
|
getParentColumn(fieldOrColumn) {
|
|
@@ -3921,11 +4085,14 @@ const Methods = {
|
|
|
3921
4085
|
* 收集到的全量列、全量表头列、处理条件之后的全量表头列、当前渲染中的表头列
|
|
3922
4086
|
*/
|
|
3923
4087
|
getTableColumn() {
|
|
4088
|
+
const $xeTable = this;
|
|
4089
|
+
const reactData = $xeTable;
|
|
4090
|
+
const internalData = $xeTable;
|
|
3924
4091
|
return {
|
|
3925
|
-
collectColumn:
|
|
3926
|
-
fullColumn:
|
|
3927
|
-
visibleColumn:
|
|
3928
|
-
tableColumn:
|
|
4092
|
+
collectColumn: internalData.collectColumn.slice(0),
|
|
4093
|
+
fullColumn: internalData.tableFullColumn.slice(0),
|
|
4094
|
+
visibleColumn: internalData.visibleColumn.slice(0),
|
|
4095
|
+
tableColumn: reactData.tableColumn.slice(0)
|
|
3929
4096
|
};
|
|
3930
4097
|
},
|
|
3931
4098
|
/**
|
|
@@ -4456,16 +4623,21 @@ const Methods = {
|
|
|
4456
4623
|
* 如果存在排序,继续处理
|
|
4457
4624
|
*/
|
|
4458
4625
|
getTableData() {
|
|
4626
|
+
const $xeTable = this;
|
|
4627
|
+
const props = $xeTable;
|
|
4628
|
+
const reactData = $xeTable;
|
|
4629
|
+
const internalData = $xeTable;
|
|
4630
|
+
const {
|
|
4631
|
+
tableData,
|
|
4632
|
+
footerTableData
|
|
4633
|
+
} = reactData;
|
|
4459
4634
|
const {
|
|
4460
|
-
treeConfig,
|
|
4461
4635
|
tableFullData,
|
|
4462
4636
|
afterFullData,
|
|
4463
|
-
tableData,
|
|
4464
|
-
footerTableData,
|
|
4465
4637
|
tableFullTreeData
|
|
4466
|
-
} =
|
|
4638
|
+
} = internalData;
|
|
4467
4639
|
return {
|
|
4468
|
-
fullData: treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0),
|
|
4640
|
+
fullData: props.treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0),
|
|
4469
4641
|
visibleData: afterFullData.slice(0),
|
|
4470
4642
|
tableData: tableData.slice(0),
|
|
4471
4643
|
footerData: footerTableData.slice(0)
|
|
@@ -4514,37 +4686,15 @@ const Methods = {
|
|
|
4514
4686
|
*/
|
|
4515
4687
|
handleLoadDefaults() {
|
|
4516
4688
|
const $xeTable = this;
|
|
4517
|
-
|
|
4518
|
-
this.handleDefaultSelectionChecked();
|
|
4519
|
-
}
|
|
4520
|
-
if (this.radioConfig) {
|
|
4521
|
-
this.handleDefaultRadioChecked();
|
|
4522
|
-
}
|
|
4523
|
-
if (this.expandConfig) {
|
|
4524
|
-
this.handleDefaultRowExpand();
|
|
4525
|
-
}
|
|
4526
|
-
if (this.treeConfig) {
|
|
4527
|
-
handleDefaultTreeExpand($xeTable);
|
|
4528
|
-
}
|
|
4529
|
-
if (this.mergeCells) {
|
|
4530
|
-
this.handleDefaultMergeCells();
|
|
4531
|
-
}
|
|
4532
|
-
if (this.mergeFooterItems) {
|
|
4533
|
-
this.handleDefaultMergeFooterItems();
|
|
4534
|
-
}
|
|
4535
|
-
this.$nextTick(() => setTimeout(this.recalculate));
|
|
4689
|
+
handleLoadDefaults($xeTable);
|
|
4536
4690
|
},
|
|
4537
4691
|
/**
|
|
4538
4692
|
* 处理初始化的默认行为
|
|
4539
4693
|
* 只会执行一次
|
|
4540
4694
|
*/
|
|
4541
4695
|
handleInitDefaults() {
|
|
4542
|
-
const
|
|
4543
|
-
|
|
4544
|
-
} = this;
|
|
4545
|
-
if (sortConfig) {
|
|
4546
|
-
this.handleDefaultSort();
|
|
4547
|
-
}
|
|
4696
|
+
const $xeTable = this;
|
|
4697
|
+
handleInitDefaults($xeTable);
|
|
4548
4698
|
},
|
|
4549
4699
|
/**
|
|
4550
4700
|
* 设置为固定列
|
|
@@ -4706,76 +4856,34 @@ const Methods = {
|
|
|
4706
4856
|
return this.resetCustom(options);
|
|
4707
4857
|
},
|
|
4708
4858
|
handleCustom() {
|
|
4859
|
+
const $xeTable = this;
|
|
4860
|
+
const props = $xeTable;
|
|
4709
4861
|
const {
|
|
4710
4862
|
mouseConfig
|
|
4711
|
-
} =
|
|
4863
|
+
} = props;
|
|
4712
4864
|
if (mouseConfig) {
|
|
4713
|
-
if (
|
|
4714
|
-
|
|
4865
|
+
if ($xeTable.clearSelected) {
|
|
4866
|
+
$xeTable.clearSelected();
|
|
4715
4867
|
}
|
|
4716
|
-
if (
|
|
4717
|
-
|
|
4718
|
-
|
|
4868
|
+
if ($xeTable.clearCellAreas) {
|
|
4869
|
+
$xeTable.clearCellAreas();
|
|
4870
|
+
$xeTable.clearCopyCellArea();
|
|
4719
4871
|
}
|
|
4720
4872
|
}
|
|
4721
|
-
|
|
4722
|
-
return
|
|
4723
|
-
},
|
|
4724
|
-
handleCustomRestore(storeData) {
|
|
4725
|
-
const $xeTable = this;
|
|
4726
|
-
const reactData = $xeTable;
|
|
4727
|
-
const internalData = $xeTable;
|
|
4728
|
-
let {
|
|
4729
|
-
collectColumn
|
|
4730
|
-
} = internalData;
|
|
4731
|
-
const {
|
|
4732
|
-
resizableData,
|
|
4733
|
-
sortData,
|
|
4734
|
-
visibleData,
|
|
4735
|
-
fixedData
|
|
4736
|
-
} = storeData;
|
|
4737
|
-
let hasCustomSort = false;
|
|
4738
|
-
// 处理还原
|
|
4739
|
-
if (resizableData || sortData || visibleData || fixedData) {
|
|
4740
|
-
_xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentRow) => {
|
|
4741
|
-
const colKey = column.getKey();
|
|
4742
|
-
// 支持一级
|
|
4743
|
-
if (!parentRow) {
|
|
4744
|
-
if (fixedData && fixedData[colKey] !== undefined) {
|
|
4745
|
-
column.fixed = fixedData[colKey];
|
|
4746
|
-
}
|
|
4747
|
-
if (sortData && _xeUtils.default.isNumber(sortData[colKey])) {
|
|
4748
|
-
hasCustomSort = true;
|
|
4749
|
-
column.renderSortNumber = sortData[colKey];
|
|
4750
|
-
}
|
|
4751
|
-
}
|
|
4752
|
-
if (resizableData && _xeUtils.default.isNumber(resizableData[colKey])) {
|
|
4753
|
-
column.resizeWidth = resizableData[colKey];
|
|
4754
|
-
}
|
|
4755
|
-
if (visibleData && _xeUtils.default.isBoolean(visibleData[colKey])) {
|
|
4756
|
-
column.visible = visibleData[colKey];
|
|
4757
|
-
}
|
|
4758
|
-
});
|
|
4759
|
-
// 如果自定义了顺序
|
|
4760
|
-
if (hasCustomSort) {
|
|
4761
|
-
collectColumn = _xeUtils.default.orderBy(collectColumn, 'renderSortNumber');
|
|
4762
|
-
internalData.collectColumn = collectColumn;
|
|
4763
|
-
internalData.tableFullColumn = getColumnList(collectColumn);
|
|
4764
|
-
}
|
|
4765
|
-
reactData.isCustomStatus = true;
|
|
4766
|
-
} else {
|
|
4767
|
-
reactData.isCustomStatus = false;
|
|
4768
|
-
}
|
|
4873
|
+
$xeTable.analyColumnWidth();
|
|
4874
|
+
return $xeTable.refreshColumn(true);
|
|
4769
4875
|
},
|
|
4770
4876
|
/**
|
|
4771
4877
|
* 还原自定义列操作状态
|
|
4772
4878
|
*/
|
|
4773
4879
|
restoreCustomStorage() {
|
|
4880
|
+
const $xeTable = this;
|
|
4881
|
+
const props = $xeTable;
|
|
4774
4882
|
const {
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4883
|
+
customConfig
|
|
4884
|
+
} = props;
|
|
4885
|
+
const tableId = $xeTable.computeTableId;
|
|
4886
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
4779
4887
|
const {
|
|
4780
4888
|
storage,
|
|
4781
4889
|
restoreStore
|
|
@@ -4801,10 +4909,10 @@ const Methods = {
|
|
|
4801
4909
|
if (!storeData) {
|
|
4802
4910
|
return;
|
|
4803
4911
|
}
|
|
4804
|
-
return
|
|
4912
|
+
return handleCustomRestore($xeTable, storeData);
|
|
4805
4913
|
}).catch(e => e);
|
|
4806
4914
|
} else {
|
|
4807
|
-
return
|
|
4915
|
+
return handleCustomRestore($xeTable, storeData);
|
|
4808
4916
|
}
|
|
4809
4917
|
}
|
|
4810
4918
|
},
|
|
@@ -6457,31 +6565,6 @@ const Methods = {
|
|
|
6457
6565
|
}
|
|
6458
6566
|
return [];
|
|
6459
6567
|
},
|
|
6460
|
-
/**
|
|
6461
|
-
* 处理默认勾选
|
|
6462
|
-
*/
|
|
6463
|
-
handleDefaultSelectionChecked() {
|
|
6464
|
-
const $xeTable = this;
|
|
6465
|
-
const {
|
|
6466
|
-
fullDataRowIdData,
|
|
6467
|
-
checkboxOpts
|
|
6468
|
-
} = this;
|
|
6469
|
-
const {
|
|
6470
|
-
checkAll,
|
|
6471
|
-
checkRowKeys
|
|
6472
|
-
} = checkboxOpts;
|
|
6473
|
-
if (checkAll) {
|
|
6474
|
-
handleCheckedAllCheckboxRow($xeTable, true, true);
|
|
6475
|
-
} else if (checkRowKeys) {
|
|
6476
|
-
const defSelection = [];
|
|
6477
|
-
checkRowKeys.forEach(rowid => {
|
|
6478
|
-
if (fullDataRowIdData[rowid]) {
|
|
6479
|
-
defSelection.push(fullDataRowIdData[rowid].row);
|
|
6480
|
-
}
|
|
6481
|
-
});
|
|
6482
|
-
handleCheckedCheckboxRow($xeTable, defSelection, true, true);
|
|
6483
|
-
}
|
|
6484
|
-
},
|
|
6485
6568
|
handleCheckedCheckboxRow(rows, value, isForce) {
|
|
6486
6569
|
const $xeTable = this;
|
|
6487
6570
|
return handleCheckedCheckboxRow($xeTable, rows, value, isForce);
|
|
@@ -7180,31 +7263,6 @@ const Methods = {
|
|
|
7180
7263
|
reactData.updateCheckboxFlag++;
|
|
7181
7264
|
return this.$nextTick();
|
|
7182
7265
|
},
|
|
7183
|
-
/**
|
|
7184
|
-
* 处理单选框默认勾选
|
|
7185
|
-
*/
|
|
7186
|
-
handleDefaultRadioChecked() {
|
|
7187
|
-
const $xeTable = this;
|
|
7188
|
-
const {
|
|
7189
|
-
radioOpts,
|
|
7190
|
-
fullDataRowIdData
|
|
7191
|
-
} = this;
|
|
7192
|
-
const {
|
|
7193
|
-
checkRowKey: rowid,
|
|
7194
|
-
reserve
|
|
7195
|
-
} = radioOpts;
|
|
7196
|
-
if (rowid) {
|
|
7197
|
-
if (fullDataRowIdData[rowid]) {
|
|
7198
|
-
handleCheckedRadioRow($xeTable, fullDataRowIdData[rowid].row, true);
|
|
7199
|
-
}
|
|
7200
|
-
if (reserve) {
|
|
7201
|
-
const rowkey = (0, _util.getRowkey)(this);
|
|
7202
|
-
this.radioReserveRow = {
|
|
7203
|
-
[rowkey]: rowid
|
|
7204
|
-
};
|
|
7205
|
-
}
|
|
7206
|
-
}
|
|
7207
|
-
},
|
|
7208
7266
|
/**
|
|
7209
7267
|
* 单选,行选中事件
|
|
7210
7268
|
*/
|
|
@@ -7665,39 +7723,6 @@ const Methods = {
|
|
|
7665
7723
|
}
|
|
7666
7724
|
this.emitEvent('cell-dblclick', params, evnt);
|
|
7667
7725
|
},
|
|
7668
|
-
handleDefaultSort() {
|
|
7669
|
-
const $xeTable = this;
|
|
7670
|
-
const {
|
|
7671
|
-
sortConfig,
|
|
7672
|
-
sortOpts
|
|
7673
|
-
} = this;
|
|
7674
|
-
let {
|
|
7675
|
-
defaultSort
|
|
7676
|
-
} = sortOpts;
|
|
7677
|
-
if (defaultSort) {
|
|
7678
|
-
if (!_xeUtils.default.isArray(defaultSort)) {
|
|
7679
|
-
defaultSort = [defaultSort];
|
|
7680
|
-
}
|
|
7681
|
-
if (defaultSort.length) {
|
|
7682
|
-
(sortConfig.multiple ? defaultSort : defaultSort.slice(0, 1)).forEach((item, index) => {
|
|
7683
|
-
const {
|
|
7684
|
-
field,
|
|
7685
|
-
order
|
|
7686
|
-
} = item;
|
|
7687
|
-
if (field && order) {
|
|
7688
|
-
const column = this.getColumnByField(field);
|
|
7689
|
-
if (column && column.sortable) {
|
|
7690
|
-
column.order = order;
|
|
7691
|
-
column.sortTime = Date.now() + index;
|
|
7692
|
-
}
|
|
7693
|
-
}
|
|
7694
|
-
});
|
|
7695
|
-
if (!sortOpts.remote) {
|
|
7696
|
-
this.handleTableData(true).then(() => updateStyle($xeTable));
|
|
7697
|
-
}
|
|
7698
|
-
}
|
|
7699
|
-
}
|
|
7700
|
-
},
|
|
7701
7726
|
handleColumnSortEvent(evnt, column) {
|
|
7702
7727
|
const $xeTable = this;
|
|
7703
7728
|
const props = $xeTable;
|
|
@@ -9015,30 +9040,6 @@ const Methods = {
|
|
|
9015
9040
|
toggleRowExpand(row) {
|
|
9016
9041
|
return this.setRowExpand(row, !this.isRowExpandByRow(row));
|
|
9017
9042
|
},
|
|
9018
|
-
/**
|
|
9019
|
-
* 处理默认展开行
|
|
9020
|
-
*/
|
|
9021
|
-
handleDefaultRowExpand() {
|
|
9022
|
-
const {
|
|
9023
|
-
expandOpts,
|
|
9024
|
-
fullDataRowIdData
|
|
9025
|
-
} = this;
|
|
9026
|
-
const {
|
|
9027
|
-
expandAll,
|
|
9028
|
-
expandRowKeys
|
|
9029
|
-
} = expandOpts;
|
|
9030
|
-
if (expandAll) {
|
|
9031
|
-
this.setAllRowExpand(true);
|
|
9032
|
-
} else if (expandRowKeys) {
|
|
9033
|
-
const defExpandeds = [];
|
|
9034
|
-
expandRowKeys.forEach(rowid => {
|
|
9035
|
-
if (fullDataRowIdData[rowid]) {
|
|
9036
|
-
defExpandeds.push(fullDataRowIdData[rowid].row);
|
|
9037
|
-
}
|
|
9038
|
-
});
|
|
9039
|
-
this.setRowExpand(defExpandeds, true);
|
|
9040
|
-
}
|
|
9041
|
-
},
|
|
9042
9043
|
/**
|
|
9043
9044
|
* 设置所有行的展开与否
|
|
9044
9045
|
* @param {Boolean} expanded 是否展开
|
|
@@ -9726,8 +9727,8 @@ const Methods = {
|
|
|
9726
9727
|
*/
|
|
9727
9728
|
triggerScrollXEvent() {
|
|
9728
9729
|
const $xeTable = this;
|
|
9729
|
-
const
|
|
9730
|
-
if (
|
|
9730
|
+
const virtualXOpts = $xeTable.computeVirtualXOpts;
|
|
9731
|
+
if (virtualXOpts.immediate) {
|
|
9731
9732
|
loadScrollXData($xeTable);
|
|
9732
9733
|
} else {
|
|
9733
9734
|
lazyScrollXData($xeTable);
|
|
@@ -9738,8 +9739,8 @@ const Methods = {
|
|
|
9738
9739
|
*/
|
|
9739
9740
|
triggerScrollYEvent() {
|
|
9740
9741
|
const $xeTable = this;
|
|
9741
|
-
const
|
|
9742
|
-
if (
|
|
9742
|
+
const virtualYOpts = $xeTable.computeVirtualYOpts;
|
|
9743
|
+
if (virtualYOpts.immediate) {
|
|
9743
9744
|
loadScrollYData($xeTable);
|
|
9744
9745
|
} else {
|
|
9745
9746
|
lazyScrollYData($xeTable);
|
|
@@ -9990,8 +9991,8 @@ const Methods = {
|
|
|
9990
9991
|
return;
|
|
9991
9992
|
}
|
|
9992
9993
|
const wheelSpeed = getWheelSpeed(reactData.lastScrollTime);
|
|
9993
|
-
const deltaTop =
|
|
9994
|
-
const deltaLeft = Math.ceil((shiftKey ? deltaY : deltaX) * wheelSpeed);
|
|
9994
|
+
const deltaTop = shiftKey ? 0 : Math.ceil(deltaY * wheelSpeed);
|
|
9995
|
+
const deltaLeft = Math.ceil((shiftKey ? deltaY || deltaX : deltaX) * wheelSpeed);
|
|
9995
9996
|
const isTopWheel = deltaTop < 0;
|
|
9996
9997
|
const currScrollTop = bodyScrollElem.scrollTop;
|
|
9997
9998
|
// 如果滚动位置已经是顶部或底部,则不需要触发
|
|
@@ -10564,9 +10565,6 @@ const Methods = {
|
|
|
10564
10565
|
}
|
|
10565
10566
|
});
|
|
10566
10567
|
},
|
|
10567
|
-
handleDefaultMergeCells() {
|
|
10568
|
-
this.setMergeCells(this.mergeCells);
|
|
10569
|
-
},
|
|
10570
10568
|
/**
|
|
10571
10569
|
* 设置合并单元格
|
|
10572
10570
|
* @param {TableMergeConfig[]} merges { row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }
|
|
@@ -10614,9 +10612,6 @@ const Methods = {
|
|
|
10614
10612
|
return updateStyle($xeTable);
|
|
10615
10613
|
});
|
|
10616
10614
|
},
|
|
10617
|
-
handleDefaultMergeFooterItems() {
|
|
10618
|
-
this.setMergeFooterItems(this.mergeFooterItems);
|
|
10619
|
-
},
|
|
10620
10615
|
setMergeFooterItems(merges) {
|
|
10621
10616
|
const $xeTable = this;
|
|
10622
10617
|
if (this.footerSpanMethod) {
|