vxe-table 3.13.4 → 3.13.6
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/locale/lang/ar-EG.js +2 -1
- package/es/locale/lang/de-DE.js +2 -1
- package/es/locale/lang/en-US.js +2 -1
- package/es/locale/lang/es-ES.js +2 -1
- package/es/locale/lang/fr-FR.js +2 -1
- package/es/locale/lang/hu-HU.js +2 -1
- package/es/locale/lang/hy-AM.js +2 -1
- package/es/locale/lang/id-ID.js +2 -1
- package/es/locale/lang/it-IT.js +2 -1
- package/es/locale/lang/ja-JP.js +2 -1
- package/es/locale/lang/ko-KR.js +2 -1
- package/es/locale/lang/nb-NO.js +2 -1
- package/es/locale/lang/pt-BR.js +2 -1
- package/es/locale/lang/ru-RU.js +2 -1
- package/es/locale/lang/th-TH.js +2 -1
- package/es/locale/lang/ug-CN.js +2 -1
- package/es/locale/lang/uk-UA.js +2 -1
- package/es/locale/lang/vi-VN.js +2 -1
- package/es/locale/lang/zh-CHT.js +2 -1
- package/es/locale/lang/zh-CN.js +2 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/export/export-panel.js +7 -4
- package/es/table/module/export/mixin.js +2 -2
- package/es/table/src/methods.js +287 -252
- package/es/table/src/table.js +1 -1
- package/es/table/style.css +1 -1
- 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 +1 -1
- 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 +340 -313
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +2 -1
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +2 -1
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +2 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +2 -1
- package/lib/locale/lang/es-ES.js +2 -1
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +2 -1
- package/lib/locale/lang/fr-FR.js +2 -1
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +2 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +2 -1
- package/lib/locale/lang/hy-AM.js +2 -1
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/id-ID.js +2 -1
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/it-IT.js +2 -1
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +2 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +2 -1
- package/lib/locale/lang/ko-KR.js +2 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +2 -1
- package/lib/locale/lang/nb-NO.js +2 -1
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +2 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +2 -1
- package/lib/locale/lang/ru-RU.js +2 -1
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +2 -1
- package/lib/locale/lang/th-TH.js +2 -1
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/ug-CN.js +2 -1
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +2 -1
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +2 -1
- package/lib/locale/lang/vi-VN.js +2 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +2 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +2 -1
- package/lib/locale/lang/zh-CN.js +2 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +2 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/export/export-panel.js +7 -4
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/mixin.js +2 -2
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/src/methods.js +324 -301
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +1 -1
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +1 -1
- 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 +1 -1
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/locale/lang/ar-EG.ts +2 -1
- package/packages/locale/lang/de-DE.ts +2 -1
- package/packages/locale/lang/en-US.ts +2 -1
- package/packages/locale/lang/es-ES.ts +2 -1
- package/packages/locale/lang/fr-FR.ts +2 -1
- package/packages/locale/lang/hu-HU.ts +2 -1
- package/packages/locale/lang/hy-AM.ts +2 -1
- package/packages/locale/lang/id-ID.ts +2 -1
- package/packages/locale/lang/it-IT.ts +2 -1
- package/packages/locale/lang/ja-JP.ts +2 -1
- package/packages/locale/lang/ko-KR.ts +2 -1
- package/packages/locale/lang/nb-NO.ts +2 -1
- package/packages/locale/lang/pt-BR.ts +2 -1
- package/packages/locale/lang/ru-RU.ts +2 -1
- package/packages/locale/lang/th-TH.ts +2 -1
- package/packages/locale/lang/ug-CN.ts +2 -1
- package/packages/locale/lang/uk-UA.ts +2 -1
- package/packages/locale/lang/vi-VN.ts +2 -1
- package/packages/locale/lang/zh-CHT.ts +2 -1
- package/packages/locale/lang/zh-CN.ts +2 -1
- package/packages/table/module/export/export-panel.ts +7 -4
- package/packages/table/module/export/mixin.ts +2 -2
- package/packages/table/src/methods.ts +306 -255
- package/packages/table/src/table.ts +1 -1
- package/styles/components/table.scss +1 -1
- package/styles/theme/base.scss +1 -1
- /package/es/{iconfont.1740013687420.ttf → iconfont.1740103990490.ttf} +0 -0
- /package/es/{iconfont.1740013687420.woff → iconfont.1740103990490.woff} +0 -0
- /package/es/{iconfont.1740013687420.woff2 → iconfont.1740103990490.woff2} +0 -0
- /package/lib/{iconfont.1740013687420.ttf → iconfont.1740103990490.ttf} +0 -0
- /package/lib/{iconfont.1740013687420.woff → iconfont.1740103990490.woff} +0 -0
- /package/lib/{iconfont.1740013687420.woff2 → iconfont.1740103990490.woff2} +0 -0
package/lib/table/src/methods.js
CHANGED
|
@@ -54,10 +54,11 @@ const setCustomStorageMap = (id, data) => {
|
|
|
54
54
|
maps._v = version;
|
|
55
55
|
localStorage.setItem(customStorageKey, _xeUtils.default.toJSONString(maps));
|
|
56
56
|
};
|
|
57
|
-
const getRecoverRowMaps = (
|
|
57
|
+
const getRecoverRowMaps = ($xeTable, keyMaps) => {
|
|
58
|
+
const internalData = $xeTable;
|
|
58
59
|
const {
|
|
59
60
|
fullAllDataRowIdData
|
|
60
|
-
} =
|
|
61
|
+
} = internalData;
|
|
61
62
|
const restKeys = {};
|
|
62
63
|
_xeUtils.default.each(keyMaps, (row, rowid) => {
|
|
63
64
|
if (fullAllDataRowIdData[rowid]) {
|
|
@@ -66,10 +67,11 @@ const getRecoverRowMaps = (_vm, keyMaps) => {
|
|
|
66
67
|
});
|
|
67
68
|
return restKeys;
|
|
68
69
|
};
|
|
69
|
-
function handleReserveRow(
|
|
70
|
+
function handleReserveRow($xeTable, reserveRowMap) {
|
|
71
|
+
const internalData = $xeTable;
|
|
70
72
|
const {
|
|
71
73
|
fullDataRowIdData
|
|
72
|
-
} =
|
|
74
|
+
} = internalData;
|
|
73
75
|
const reserveList = [];
|
|
74
76
|
_xeUtils.default.each(reserveRowMap, (item, rowid) => {
|
|
75
77
|
if (fullDataRowIdData[rowid] && reserveList.indexOf(fullDataRowIdData[rowid].row) === -1) {
|
|
@@ -868,6 +870,253 @@ function updateStyle($xeTable) {
|
|
|
868
870
|
}
|
|
869
871
|
return $xeTable.$nextTick();
|
|
870
872
|
}
|
|
873
|
+
function handleRadioReserveRow($xeTable, row) {
|
|
874
|
+
const internalData = $xeTable;
|
|
875
|
+
const radioOpts = $xeTable.computeRadioOpts;
|
|
876
|
+
if (radioOpts.reserve) {
|
|
877
|
+
internalData.radioReserveRow = row;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
function handleCheckboxReserveRow($xeTable, row, checked) {
|
|
881
|
+
const internalData = $xeTable;
|
|
882
|
+
const {
|
|
883
|
+
checkboxReserveRowMap
|
|
884
|
+
} = internalData;
|
|
885
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
886
|
+
if (checkboxOpts.reserve) {
|
|
887
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
888
|
+
if (checked) {
|
|
889
|
+
checkboxReserveRowMap[rowid] = row;
|
|
890
|
+
} else if (checkboxReserveRowMap[rowid]) {
|
|
891
|
+
delete checkboxReserveRowMap[rowid];
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
function handleCheckedRadioRow($xeTable, row, isForce) {
|
|
896
|
+
const reactData = $xeTable;
|
|
897
|
+
const radioOpts = $xeTable.computeRadioOpts;
|
|
898
|
+
const {
|
|
899
|
+
checkMethod
|
|
900
|
+
} = radioOpts;
|
|
901
|
+
if (row && (isForce || !checkMethod || checkMethod({
|
|
902
|
+
row
|
|
903
|
+
}))) {
|
|
904
|
+
reactData.selectRadioRow = row;
|
|
905
|
+
handleRadioReserveRow($xeTable, row);
|
|
906
|
+
}
|
|
907
|
+
return $xeTable.$nextTick();
|
|
908
|
+
}
|
|
909
|
+
function handleCheckedCheckboxRow($xeTable, rows, value, isForce) {
|
|
910
|
+
if (rows && !_xeUtils.default.isArray(rows)) {
|
|
911
|
+
rows = [rows];
|
|
912
|
+
}
|
|
913
|
+
$xeTable.handleBatchSelectRows(rows, !!value, isForce);
|
|
914
|
+
$xeTable.checkSelectionStatus();
|
|
915
|
+
return $xeTable.$nextTick();
|
|
916
|
+
}
|
|
917
|
+
function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
918
|
+
const props = $xeTable;
|
|
919
|
+
const reactData = $xeTable;
|
|
920
|
+
const internalData = $xeTable;
|
|
921
|
+
const {
|
|
922
|
+
treeConfig
|
|
923
|
+
} = props;
|
|
924
|
+
const {
|
|
925
|
+
selectCheckboxMaps
|
|
926
|
+
} = reactData;
|
|
927
|
+
const {
|
|
928
|
+
afterFullData,
|
|
929
|
+
checkboxReserveRowMap
|
|
930
|
+
} = internalData;
|
|
931
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
932
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
933
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
934
|
+
const {
|
|
935
|
+
checkField,
|
|
936
|
+
reserve,
|
|
937
|
+
checkMethod
|
|
938
|
+
} = checkboxOpts;
|
|
939
|
+
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
940
|
+
const selectRowMaps = {};
|
|
941
|
+
/**
|
|
942
|
+
* 绑定属性方式(高性能,有污染)
|
|
943
|
+
* 必须在行数据存在对应的属性,否则将不响应
|
|
944
|
+
*/
|
|
945
|
+
if (checkField) {
|
|
946
|
+
const checkValFn = row => {
|
|
947
|
+
if (isForce || !checkMethod || checkMethod({
|
|
948
|
+
row
|
|
949
|
+
})) {
|
|
950
|
+
if (checked) {
|
|
951
|
+
selectRowMaps[(0, _util.getRowid)($xeTable, row)] = row;
|
|
952
|
+
}
|
|
953
|
+
_xeUtils.default.set(row, checkField, checked);
|
|
954
|
+
}
|
|
955
|
+
if (treeConfig && indeterminateField) {
|
|
956
|
+
_xeUtils.default.set(row, indeterminateField, false);
|
|
957
|
+
}
|
|
958
|
+
};
|
|
959
|
+
// 如果存在选中方法
|
|
960
|
+
// 如果方法成立,则更新值,否则忽略该数据
|
|
961
|
+
if (treeConfig) {
|
|
962
|
+
_xeUtils.default.eachTree(afterFullData, checkValFn, {
|
|
963
|
+
children: childrenField
|
|
964
|
+
});
|
|
965
|
+
} else {
|
|
966
|
+
afterFullData.forEach(checkValFn);
|
|
967
|
+
}
|
|
968
|
+
} else {
|
|
969
|
+
/**
|
|
970
|
+
* 默认方式(低性能,无污染)
|
|
971
|
+
* 无需任何属性,直接绑定
|
|
972
|
+
*/
|
|
973
|
+
if (treeConfig) {
|
|
974
|
+
if (checked) {
|
|
975
|
+
/**
|
|
976
|
+
* 如果是树勾选
|
|
977
|
+
* 如果方法成立,则添加到临时集合中
|
|
978
|
+
*/
|
|
979
|
+
_xeUtils.default.eachTree(afterFullData, row => {
|
|
980
|
+
if (isForce || !checkMethod || checkMethod({
|
|
981
|
+
row
|
|
982
|
+
})) {
|
|
983
|
+
selectRowMaps[(0, _util.getRowid)($xeTable, row)] = row;
|
|
984
|
+
}
|
|
985
|
+
}, {
|
|
986
|
+
children: childrenField
|
|
987
|
+
});
|
|
988
|
+
} else {
|
|
989
|
+
/**
|
|
990
|
+
* 如果是树取消
|
|
991
|
+
* 如果方法成立,则不添加到临时集合中
|
|
992
|
+
*/
|
|
993
|
+
if (!isForce && checkMethod) {
|
|
994
|
+
_xeUtils.default.eachTree(afterFullData, row => {
|
|
995
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
996
|
+
if (checkMethod({
|
|
997
|
+
row
|
|
998
|
+
}) ? 0 : selectCheckboxMaps[rowid]) {
|
|
999
|
+
selectRowMaps[rowid] = row;
|
|
1000
|
+
}
|
|
1001
|
+
}, {
|
|
1002
|
+
children: childrenField
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
} else {
|
|
1007
|
+
if (checked) {
|
|
1008
|
+
/**
|
|
1009
|
+
* 如果是行勾选
|
|
1010
|
+
* 如果存在选中方法且成立或者本身已勾选,则添加到临时集合中
|
|
1011
|
+
* 如果不存在选中方法,则添加所有数据到临时集合中
|
|
1012
|
+
*/
|
|
1013
|
+
if (!isForce && checkMethod) {
|
|
1014
|
+
afterFullData.forEach(row => {
|
|
1015
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
1016
|
+
if (selectCheckboxMaps[rowid] || checkMethod({
|
|
1017
|
+
row
|
|
1018
|
+
})) {
|
|
1019
|
+
selectRowMaps[rowid] = row;
|
|
1020
|
+
}
|
|
1021
|
+
});
|
|
1022
|
+
} else {
|
|
1023
|
+
afterFullData.forEach(row => {
|
|
1024
|
+
selectRowMaps[(0, _util.getRowid)($xeTable, row)] = row;
|
|
1025
|
+
});
|
|
1026
|
+
}
|
|
1027
|
+
} else {
|
|
1028
|
+
/**
|
|
1029
|
+
* 如果是行取消
|
|
1030
|
+
* 如果方法成立,则不添加到临时集合中;如果方法不成立则判断当前是否已勾选,如果已被勾选则添加到新集合中
|
|
1031
|
+
* 如果不存在选中方法,无需处理,临时集合默认为空
|
|
1032
|
+
*/
|
|
1033
|
+
if (!isForce && checkMethod) {
|
|
1034
|
+
afterFullData.forEach(row => {
|
|
1035
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
1036
|
+
if (checkMethod({
|
|
1037
|
+
row
|
|
1038
|
+
}) ? 0 : selectCheckboxMaps[rowid]) {
|
|
1039
|
+
selectRowMaps[rowid] = row;
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
if (reserve) {
|
|
1047
|
+
if (checked) {
|
|
1048
|
+
_xeUtils.default.each(selectRowMaps, (row, rowid) => {
|
|
1049
|
+
checkboxReserveRowMap[rowid] = row;
|
|
1050
|
+
});
|
|
1051
|
+
} else {
|
|
1052
|
+
afterFullData.forEach(row => handleCheckboxReserveRow($xeTable, row, false));
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
reactData.selectCheckboxMaps = checkField ? {} : selectRowMaps;
|
|
1056
|
+
reactData.isAllSelected = checked;
|
|
1057
|
+
reactData.isIndeterminate = false;
|
|
1058
|
+
reactData.treeIndeterminateMaps = {};
|
|
1059
|
+
internalData.treeIndeterminateRowMaps = {};
|
|
1060
|
+
$xeTable.checkSelectionStatus();
|
|
1061
|
+
return $xeTable.$nextTick();
|
|
1062
|
+
}
|
|
1063
|
+
// 还原展开、选中等相关状态
|
|
1064
|
+
function handleReserveStatus($xeTable) {
|
|
1065
|
+
const props = $xeTable;
|
|
1066
|
+
const reactData = $xeTable;
|
|
1067
|
+
const internalData = $xeTable;
|
|
1068
|
+
const {
|
|
1069
|
+
treeConfig
|
|
1070
|
+
} = props;
|
|
1071
|
+
const {
|
|
1072
|
+
expandColumn,
|
|
1073
|
+
currentRow,
|
|
1074
|
+
selectCheckboxMaps,
|
|
1075
|
+
selectRadioRow,
|
|
1076
|
+
rowExpandedMaps,
|
|
1077
|
+
treeExpandedMaps
|
|
1078
|
+
} = reactData;
|
|
1079
|
+
const {
|
|
1080
|
+
fullDataRowIdData,
|
|
1081
|
+
fullAllDataRowIdData,
|
|
1082
|
+
radioReserveRow
|
|
1083
|
+
} = internalData;
|
|
1084
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
1085
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
1086
|
+
const radioOpts = $xeTable.computeRadioOpts;
|
|
1087
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
1088
|
+
// 单选框
|
|
1089
|
+
if (selectRadioRow && !fullAllDataRowIdData[(0, _util.getRowid)($xeTable, selectRadioRow)]) {
|
|
1090
|
+
reactData.selectRadioRow = null; // 刷新单选行状态
|
|
1091
|
+
}
|
|
1092
|
+
// 还原保留选中状态
|
|
1093
|
+
if (radioOpts.reserve && radioReserveRow) {
|
|
1094
|
+
const rowid = (0, _util.getRowid)($xeTable, radioReserveRow);
|
|
1095
|
+
if (fullDataRowIdData[rowid]) {
|
|
1096
|
+
handleCheckedRadioRow($xeTable, fullDataRowIdData[rowid].row, true);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
// 复选框
|
|
1100
|
+
reactData.selectCheckboxMaps = getRecoverRowMaps($xeTable, selectCheckboxMaps); // 刷新多选行状态
|
|
1101
|
+
// 还原保留选中状态
|
|
1102
|
+
if (checkboxOpts.reserve) {
|
|
1103
|
+
handleCheckedCheckboxRow($xeTable, handleReserveRow($xeTable, internalData.checkboxReserveRowMap), true, true);
|
|
1104
|
+
}
|
|
1105
|
+
if (currentRow && !fullAllDataRowIdData[(0, _util.getRowid)($xeTable, currentRow)]) {
|
|
1106
|
+
reactData.currentRow = null; // 刷新当前行状态
|
|
1107
|
+
}
|
|
1108
|
+
// 行展开
|
|
1109
|
+
reactData.rowExpandedMaps = expandColumn ? getRecoverRowMaps($xeTable, rowExpandedMaps) : {}; // 刷新行展开状态
|
|
1110
|
+
// 还原保留状态
|
|
1111
|
+
if (expandColumn && expandOpts.reserve) {
|
|
1112
|
+
$xeTable.setRowExpand(handleReserveRow($xeTable, internalData.rowExpandedReserveRowMap), true);
|
|
1113
|
+
}
|
|
1114
|
+
// 树展开
|
|
1115
|
+
reactData.treeExpandedMaps = treeConfig ? getRecoverRowMaps($xeTable, treeExpandedMaps) : {}; // 刷新树展开状态
|
|
1116
|
+
if (treeConfig && treeOpts.reserve) {
|
|
1117
|
+
$xeTable.setTreeExpand(handleReserveRow($xeTable, internalData.treeExpandedReserveRowMap), true);
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
871
1120
|
function calcVarRowHeightConfig($xeTable, sizeKey, sizeEl) {
|
|
872
1121
|
const reactData = $xeTable;
|
|
873
1122
|
const {
|
|
@@ -2462,15 +2711,11 @@ const Methods = {
|
|
|
2462
2711
|
internalData.tableFullData = fullData;
|
|
2463
2712
|
internalData.tableFullTreeData = treeData;
|
|
2464
2713
|
// 缓存数据
|
|
2465
|
-
$xeTable.cacheRowMap(true
|
|
2714
|
+
$xeTable.cacheRowMap(true);
|
|
2466
2715
|
// 原始数据
|
|
2467
2716
|
internalData.tableSynchData = datas;
|
|
2468
2717
|
if (isReset) {
|
|
2469
2718
|
internalData.isResizeCellHeight = false;
|
|
2470
|
-
reactData.rowExpandedMaps = {};
|
|
2471
|
-
reactData.rowExpandLazyLoadedMaps = {};
|
|
2472
|
-
reactData.treeExpandedMaps = {};
|
|
2473
|
-
reactData.treeExpandLazyLoadedMaps = {};
|
|
2474
2719
|
}
|
|
2475
2720
|
// 克隆原数据,用于显示编辑状态,与编辑值做对比
|
|
2476
2721
|
if (keepSource) {
|
|
@@ -2515,7 +2760,7 @@ const Methods = {
|
|
|
2515
2760
|
}
|
|
2516
2761
|
}
|
|
2517
2762
|
}
|
|
2518
|
-
|
|
2763
|
+
handleReserveStatus($xeTable);
|
|
2519
2764
|
this.checkSelectionStatus();
|
|
2520
2765
|
return new Promise(resolve => {
|
|
2521
2766
|
this.$nextTick().then(() => this.recalculate()).then(() => {
|
|
@@ -2653,22 +2898,27 @@ const Methods = {
|
|
|
2653
2898
|
/**
|
|
2654
2899
|
* 更新数据行的 Map
|
|
2655
2900
|
*/
|
|
2656
|
-
cacheRowMap(
|
|
2901
|
+
cacheRowMap() {
|
|
2902
|
+
const $xeTable = this;
|
|
2903
|
+
const props = $xeTable;
|
|
2904
|
+
const internalData = $xeTable;
|
|
2905
|
+
const {
|
|
2906
|
+
treeConfig
|
|
2907
|
+
} = props;
|
|
2908
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
2657
2909
|
const {
|
|
2658
|
-
treeConfig,
|
|
2659
|
-
treeOpts,
|
|
2660
|
-
tableFullData,
|
|
2661
2910
|
fullAllDataRowIdData,
|
|
2911
|
+
tableFullData,
|
|
2662
2912
|
tableFullTreeData
|
|
2663
|
-
} =
|
|
2913
|
+
} = internalData;
|
|
2664
2914
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2665
2915
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
2666
|
-
const rowkey = (0, _util.getRowkey)(
|
|
2916
|
+
const rowkey = (0, _util.getRowkey)($xeTable);
|
|
2667
2917
|
const isLazy = treeConfig && treeOpts.lazy;
|
|
2668
2918
|
const fullAllDataRowIdMaps = {};
|
|
2669
2919
|
const fullDataRowIdMaps = {};
|
|
2670
|
-
const
|
|
2671
|
-
let rowid = (0, _util.getRowid)(
|
|
2920
|
+
const handleRow = (row, index, items, path, parentRow, nodes) => {
|
|
2921
|
+
let rowid = (0, _util.getRowid)($xeTable, row);
|
|
2672
2922
|
const seq = treeConfig && path ? (0, _util.toTreePathSeq)(path) : index + 1;
|
|
2673
2923
|
const level = nodes ? nodes.length - 1 : 0;
|
|
2674
2924
|
if ((0, _utils.eqEmptyValue)(rowid)) {
|
|
@@ -2678,9 +2928,9 @@ const Methods = {
|
|
|
2678
2928
|
if (isLazy && row[hasChildField] && _xeUtils.default.isUndefined(row[childrenField])) {
|
|
2679
2929
|
row[childrenField] = null;
|
|
2680
2930
|
}
|
|
2681
|
-
let
|
|
2682
|
-
if (
|
|
2683
|
-
|
|
2931
|
+
let rowRest = fullAllDataRowIdData[rowid];
|
|
2932
|
+
if (!rowRest) {
|
|
2933
|
+
rowRest = {
|
|
2684
2934
|
row,
|
|
2685
2935
|
rowid,
|
|
2686
2936
|
seq,
|
|
@@ -2697,26 +2947,22 @@ const Methods = {
|
|
|
2697
2947
|
expandHeight: 0
|
|
2698
2948
|
};
|
|
2699
2949
|
}
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
}
|
|
2708
|
-
fullAllDataRowIdMaps[rowid] = cacheItem;
|
|
2950
|
+
rowRest.row = row;
|
|
2951
|
+
rowRest.items = items;
|
|
2952
|
+
rowRest.parent = parentRow;
|
|
2953
|
+
rowRest.level = level;
|
|
2954
|
+
rowRest.index = treeConfig && parentRow ? -1 : index;
|
|
2955
|
+
fullDataRowIdMaps[rowid] = rowRest;
|
|
2956
|
+
fullAllDataRowIdMaps[rowid] = rowRest;
|
|
2709
2957
|
};
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
}
|
|
2713
|
-
this.fullAllDataRowIdData = fullAllDataRowIdMaps;
|
|
2958
|
+
internalData.fullDataRowIdData = fullDataRowIdMaps;
|
|
2959
|
+
internalData.fullAllDataRowIdData = fullAllDataRowIdMaps;
|
|
2714
2960
|
if (treeConfig) {
|
|
2715
|
-
_xeUtils.default.eachTree(tableFullTreeData,
|
|
2961
|
+
_xeUtils.default.eachTree(tableFullTreeData, handleRow, {
|
|
2716
2962
|
children: childrenField
|
|
2717
2963
|
});
|
|
2718
2964
|
} else {
|
|
2719
|
-
tableFullData.forEach(
|
|
2965
|
+
tableFullData.forEach(handleRow);
|
|
2720
2966
|
}
|
|
2721
2967
|
},
|
|
2722
2968
|
cacheSourceMap(fullData) {
|
|
@@ -3721,7 +3967,7 @@ const Methods = {
|
|
|
3721
3967
|
treeConfig
|
|
3722
3968
|
} = props;
|
|
3723
3969
|
const {
|
|
3724
|
-
|
|
3970
|
+
fullAllDataRowIdData
|
|
3725
3971
|
} = internalData;
|
|
3726
3972
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
3727
3973
|
const {
|
|
@@ -3737,7 +3983,7 @@ const Methods = {
|
|
|
3737
3983
|
rowid = (0, _util.getRowid)($xeTable, rowOrRowid);
|
|
3738
3984
|
}
|
|
3739
3985
|
if (rowid) {
|
|
3740
|
-
const rest =
|
|
3986
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
3741
3987
|
const row = rest ? rest.row : null;
|
|
3742
3988
|
if (row) {
|
|
3743
3989
|
return row[transform ? mapChildrenField : childrenField] || [];
|
|
@@ -3757,7 +4003,7 @@ const Methods = {
|
|
|
3757
4003
|
treeConfig
|
|
3758
4004
|
} = props;
|
|
3759
4005
|
const {
|
|
3760
|
-
|
|
4006
|
+
fullAllDataRowIdData
|
|
3761
4007
|
} = internalData;
|
|
3762
4008
|
if (rowOrRowid && treeConfig) {
|
|
3763
4009
|
let rowid;
|
|
@@ -3767,7 +4013,7 @@ const Methods = {
|
|
|
3767
4013
|
rowid = (0, _util.getRowid)($xeTable, rowOrRowid);
|
|
3768
4014
|
}
|
|
3769
4015
|
if (rowid) {
|
|
3770
|
-
const rest =
|
|
4016
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
3771
4017
|
return rest ? rest.parent : null;
|
|
3772
4018
|
}
|
|
3773
4019
|
}
|
|
@@ -3786,10 +4032,10 @@ const Methods = {
|
|
|
3786
4032
|
const $xeTable = this;
|
|
3787
4033
|
const internalData = $xeTable;
|
|
3788
4034
|
const {
|
|
3789
|
-
|
|
4035
|
+
fullAllDataRowIdData
|
|
3790
4036
|
} = internalData;
|
|
3791
4037
|
const rowid = _xeUtils.default.eqNull(cellValue) ? '' : encodeURIComponent(cellValue);
|
|
3792
|
-
return
|
|
4038
|
+
return fullAllDataRowIdData[rowid] ? fullAllDataRowIdData[rowid].row : null;
|
|
3793
4039
|
},
|
|
3794
4040
|
/**
|
|
3795
4041
|
* 根据行获取行的唯一主键
|
|
@@ -5781,6 +6027,7 @@ const Methods = {
|
|
|
5781
6027
|
* 处理默认勾选
|
|
5782
6028
|
*/
|
|
5783
6029
|
handleDefaultSelectionChecked() {
|
|
6030
|
+
const $xeTable = this;
|
|
5784
6031
|
const {
|
|
5785
6032
|
fullDataRowIdData,
|
|
5786
6033
|
checkboxOpts
|
|
@@ -5790,7 +6037,7 @@ const Methods = {
|
|
|
5790
6037
|
checkRowKeys
|
|
5791
6038
|
} = checkboxOpts;
|
|
5792
6039
|
if (checkAll) {
|
|
5793
|
-
|
|
6040
|
+
handleCheckedAllCheckboxRow($xeTable, true, true);
|
|
5794
6041
|
} else if (checkRowKeys) {
|
|
5795
6042
|
const defSelection = [];
|
|
5796
6043
|
checkRowKeys.forEach(rowid => {
|
|
@@ -5798,17 +6045,12 @@ const Methods = {
|
|
|
5798
6045
|
defSelection.push(fullDataRowIdData[rowid].row);
|
|
5799
6046
|
}
|
|
5800
6047
|
});
|
|
5801
|
-
|
|
6048
|
+
handleCheckedCheckboxRow($xeTable, defSelection, true, true);
|
|
5802
6049
|
}
|
|
5803
6050
|
},
|
|
5804
6051
|
handleCheckedCheckboxRow(rows, value, isForce) {
|
|
5805
6052
|
const $xeTable = this;
|
|
5806
|
-
|
|
5807
|
-
rows = [rows];
|
|
5808
|
-
}
|
|
5809
|
-
$xeTable.handleBatchSelectRows(rows, !!value, isForce);
|
|
5810
|
-
$xeTable.checkSelectionStatus();
|
|
5811
|
-
return this.$nextTick();
|
|
6053
|
+
return handleCheckedCheckboxRow($xeTable, rows, value, isForce);
|
|
5812
6054
|
},
|
|
5813
6055
|
/**
|
|
5814
6056
|
* 用于多选行,设置行为选中状态,第二个参数为选中与否
|
|
@@ -5820,7 +6062,7 @@ const Methods = {
|
|
|
5820
6062
|
if (rows && !_xeUtils.default.isArray(rows)) {
|
|
5821
6063
|
rows = [rows];
|
|
5822
6064
|
}
|
|
5823
|
-
return $xeTable
|
|
6065
|
+
return handleCheckedCheckboxRow($xeTable, rows, checked, true);
|
|
5824
6066
|
},
|
|
5825
6067
|
setCheckboxRowKey(keys, checked) {
|
|
5826
6068
|
const $xeTable = this;
|
|
@@ -5838,7 +6080,7 @@ const Methods = {
|
|
|
5838
6080
|
rows.push(rowRest.row);
|
|
5839
6081
|
}
|
|
5840
6082
|
});
|
|
5841
|
-
return $xeTable
|
|
6083
|
+
return handleCheckedCheckboxRow($xeTable, rows, checked, true);
|
|
5842
6084
|
},
|
|
5843
6085
|
isCheckedByCheckboxRow(row) {
|
|
5844
6086
|
const $xeTable = this;
|
|
@@ -5934,7 +6176,7 @@ const Methods = {
|
|
|
5934
6176
|
if (indeterminateField) {
|
|
5935
6177
|
_xeUtils.default.set(row, indeterminateField, false);
|
|
5936
6178
|
}
|
|
5937
|
-
$xeTable
|
|
6179
|
+
handleCheckboxReserveRow($xeTable, row, checked);
|
|
5938
6180
|
}
|
|
5939
6181
|
}, {
|
|
5940
6182
|
children: transform ? mapChildrenField : childrenField
|
|
@@ -5948,7 +6190,7 @@ const Methods = {
|
|
|
5948
6190
|
row
|
|
5949
6191
|
})) {
|
|
5950
6192
|
_xeUtils.default.set(row, checkField, checked);
|
|
5951
|
-
$xeTable
|
|
6193
|
+
handleCheckboxReserveRow($xeTable, row, checked);
|
|
5952
6194
|
}
|
|
5953
6195
|
});
|
|
5954
6196
|
}
|
|
@@ -5970,7 +6212,7 @@ const Methods = {
|
|
|
5970
6212
|
delete selectRowMaps[rowid];
|
|
5971
6213
|
}
|
|
5972
6214
|
}
|
|
5973
|
-
$xeTable
|
|
6215
|
+
handleCheckboxReserveRow($xeTable, row, checked);
|
|
5974
6216
|
}
|
|
5975
6217
|
}, {
|
|
5976
6218
|
children: transform ? mapChildrenField : childrenField
|
|
@@ -5993,7 +6235,7 @@ const Methods = {
|
|
|
5993
6235
|
delete selectRowMaps[rowid];
|
|
5994
6236
|
}
|
|
5995
6237
|
}
|
|
5996
|
-
$xeTable
|
|
6238
|
+
handleCheckboxReserveRow($xeTable, row, checked);
|
|
5997
6239
|
}
|
|
5998
6240
|
});
|
|
5999
6241
|
reactData.selectCheckboxMaps = selectRowMaps;
|
|
@@ -6037,6 +6279,7 @@ const Methods = {
|
|
|
6037
6279
|
}
|
|
6038
6280
|
},
|
|
6039
6281
|
triggerCheckRowEvent(evnt, params, checked) {
|
|
6282
|
+
const $xeTable = this;
|
|
6040
6283
|
const {
|
|
6041
6284
|
checkboxOpts,
|
|
6042
6285
|
afterFullData
|
|
@@ -6061,7 +6304,7 @@ const Methods = {
|
|
|
6061
6304
|
if (_rowIndex !== _firstRowIndex) {
|
|
6062
6305
|
this.setAllCheckboxRow(false);
|
|
6063
6306
|
const rangeRows = _rowIndex < _firstRowIndex ? afterFullData.slice(_rowIndex, _firstRowIndex + 1) : afterFullData.slice(_firstRowIndex, _rowIndex + 1);
|
|
6064
|
-
|
|
6307
|
+
handleCheckedCheckboxRow($xeTable, rangeRows, true, false);
|
|
6065
6308
|
this.emitEvent('checkbox-range-select', Object.assign({
|
|
6066
6309
|
rangeRecords: rangeRows
|
|
6067
6310
|
}, params), evnt);
|
|
@@ -6099,168 +6342,13 @@ const Methods = {
|
|
|
6099
6342
|
$xeTable.checkSelectionStatus();
|
|
6100
6343
|
return $xeTable.$nextTick();
|
|
6101
6344
|
},
|
|
6102
|
-
handleCheckedAllCheckboxRow(checked, isForce) {
|
|
6103
|
-
const $xeTable = this;
|
|
6104
|
-
const reactData = $xeTable;
|
|
6105
|
-
const {
|
|
6106
|
-
afterFullData,
|
|
6107
|
-
treeConfig,
|
|
6108
|
-
treeOpts,
|
|
6109
|
-
selectCheckboxMaps,
|
|
6110
|
-
checkboxReserveRowMap,
|
|
6111
|
-
checkboxOpts,
|
|
6112
|
-
afterFullRowMaps
|
|
6113
|
-
} = this;
|
|
6114
|
-
const {
|
|
6115
|
-
checkField,
|
|
6116
|
-
reserve,
|
|
6117
|
-
checkStrictly,
|
|
6118
|
-
checkMethod
|
|
6119
|
-
} = checkboxOpts;
|
|
6120
|
-
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
6121
|
-
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
6122
|
-
const selectRowMaps = {};
|
|
6123
|
-
// 疑惑!
|
|
6124
|
-
if (!treeConfig) {
|
|
6125
|
-
_xeUtils.default.each(selectCheckboxMaps, (row, rowid) => {
|
|
6126
|
-
if (!afterFullRowMaps[rowid]) {
|
|
6127
|
-
selectRowMaps[rowid] = row;
|
|
6128
|
-
}
|
|
6129
|
-
});
|
|
6130
|
-
}
|
|
6131
|
-
// 疑惑!
|
|
6132
|
-
if (checkStrictly) {
|
|
6133
|
-
this.isAllSelected = checked;
|
|
6134
|
-
} else {
|
|
6135
|
-
/**
|
|
6136
|
-
* 绑定属性方式(高性能,有污染)
|
|
6137
|
-
* 必须在行数据存在对应的属性,否则将不响应
|
|
6138
|
-
*/
|
|
6139
|
-
if (checkField) {
|
|
6140
|
-
const checkValFn = row => {
|
|
6141
|
-
if (isForce || !checkMethod || checkMethod({
|
|
6142
|
-
row
|
|
6143
|
-
})) {
|
|
6144
|
-
if (checked) {
|
|
6145
|
-
selectRowMaps[(0, _util.getRowid)(this, row)] = row;
|
|
6146
|
-
}
|
|
6147
|
-
_xeUtils.default.set(row, checkField, checked);
|
|
6148
|
-
}
|
|
6149
|
-
if (treeConfig && indeterminateField) {
|
|
6150
|
-
_xeUtils.default.set(row, indeterminateField, false);
|
|
6151
|
-
}
|
|
6152
|
-
};
|
|
6153
|
-
// 如果存在选中方法
|
|
6154
|
-
// 如果方法成立,则更新值,否则忽略该数据
|
|
6155
|
-
if (treeConfig) {
|
|
6156
|
-
_xeUtils.default.eachTree(afterFullData, checkValFn, {
|
|
6157
|
-
children: childrenField
|
|
6158
|
-
});
|
|
6159
|
-
} else {
|
|
6160
|
-
afterFullData.forEach(checkValFn);
|
|
6161
|
-
}
|
|
6162
|
-
} else {
|
|
6163
|
-
/**
|
|
6164
|
-
* 默认方式(低性能,无污染)
|
|
6165
|
-
* 无需任何属性,直接绑定
|
|
6166
|
-
*/
|
|
6167
|
-
if (treeConfig) {
|
|
6168
|
-
if (checked) {
|
|
6169
|
-
/**
|
|
6170
|
-
* 如果是树勾选
|
|
6171
|
-
* 如果方法成立,则添加到临时集合中
|
|
6172
|
-
*/
|
|
6173
|
-
_xeUtils.default.eachTree(afterFullData, row => {
|
|
6174
|
-
if (isForce || !checkMethod || checkMethod({
|
|
6175
|
-
row
|
|
6176
|
-
})) {
|
|
6177
|
-
selectRowMaps[(0, _util.getRowid)(this, row)] = row;
|
|
6178
|
-
}
|
|
6179
|
-
}, {
|
|
6180
|
-
children: childrenField
|
|
6181
|
-
});
|
|
6182
|
-
} else {
|
|
6183
|
-
/**
|
|
6184
|
-
* 如果是树取消
|
|
6185
|
-
* 如果方法成立,则不添加到临时集合中
|
|
6186
|
-
*/
|
|
6187
|
-
if (!isForce && checkMethod) {
|
|
6188
|
-
_xeUtils.default.eachTree(afterFullData, row => {
|
|
6189
|
-
const rowid = (0, _util.getRowid)(this, row);
|
|
6190
|
-
if (checkMethod({
|
|
6191
|
-
row
|
|
6192
|
-
}) ? 0 : selectCheckboxMaps[rowid]) {
|
|
6193
|
-
selectRowMaps[rowid] = row;
|
|
6194
|
-
}
|
|
6195
|
-
}, {
|
|
6196
|
-
children: childrenField
|
|
6197
|
-
});
|
|
6198
|
-
}
|
|
6199
|
-
}
|
|
6200
|
-
} else {
|
|
6201
|
-
if (checked) {
|
|
6202
|
-
/**
|
|
6203
|
-
* 如果是行勾选
|
|
6204
|
-
* 如果存在选中方法且成立或者本身已勾选,则添加到临时集合中
|
|
6205
|
-
* 如果不存在选中方法,则添加所有数据到临时集合中
|
|
6206
|
-
*/
|
|
6207
|
-
if (!isForce && checkMethod) {
|
|
6208
|
-
afterFullData.forEach(row => {
|
|
6209
|
-
const rowid = (0, _util.getRowid)(this, row);
|
|
6210
|
-
if (selectCheckboxMaps[rowid] || checkMethod({
|
|
6211
|
-
row
|
|
6212
|
-
})) {
|
|
6213
|
-
selectRowMaps[rowid] = row;
|
|
6214
|
-
}
|
|
6215
|
-
});
|
|
6216
|
-
} else {
|
|
6217
|
-
afterFullData.forEach(row => {
|
|
6218
|
-
selectRowMaps[(0, _util.getRowid)(this, row)] = row;
|
|
6219
|
-
});
|
|
6220
|
-
}
|
|
6221
|
-
} else {
|
|
6222
|
-
/**
|
|
6223
|
-
* 如果是行取消
|
|
6224
|
-
* 如果方法成立,则不添加到临时集合中;如果方法不成立则判断当前是否已勾选,如果已被勾选则添加到新集合中
|
|
6225
|
-
* 如果不存在选中方法,无需处理,临时集合默认为空
|
|
6226
|
-
*/
|
|
6227
|
-
if (!isForce && checkMethod) {
|
|
6228
|
-
afterFullData.forEach(row => {
|
|
6229
|
-
const rowid = (0, _util.getRowid)(this, row);
|
|
6230
|
-
if (checkMethod({
|
|
6231
|
-
row
|
|
6232
|
-
}) ? 0 : selectCheckboxMaps[rowid]) {
|
|
6233
|
-
selectRowMaps[rowid] = row;
|
|
6234
|
-
}
|
|
6235
|
-
});
|
|
6236
|
-
}
|
|
6237
|
-
}
|
|
6238
|
-
}
|
|
6239
|
-
}
|
|
6240
|
-
if (reserve) {
|
|
6241
|
-
if (checked) {
|
|
6242
|
-
_xeUtils.default.each(selectRowMaps, (row, rowid) => {
|
|
6243
|
-
checkboxReserveRowMap[rowid] = row;
|
|
6244
|
-
});
|
|
6245
|
-
} else {
|
|
6246
|
-
afterFullData.forEach(row => this.handleCheckboxReserveRow(row, false));
|
|
6247
|
-
}
|
|
6248
|
-
}
|
|
6249
|
-
this.selectCheckboxMaps = checkField ? {} : selectRowMaps;
|
|
6250
|
-
}
|
|
6251
|
-
reactData.isAllSelected = checked;
|
|
6252
|
-
reactData.isIndeterminate = false;
|
|
6253
|
-
this.treeIndeterminateMaps = {};
|
|
6254
|
-
this.treeIndeterminateRowMaps = {};
|
|
6255
|
-
this.checkSelectionStatus();
|
|
6256
|
-
return this.$nextTick();
|
|
6257
|
-
},
|
|
6258
6345
|
/**
|
|
6259
6346
|
* 用于多选行,设置所有行的选中状态
|
|
6260
6347
|
* @param {Boolean} value 是否选中
|
|
6261
6348
|
*/
|
|
6262
6349
|
setAllCheckboxRow(value) {
|
|
6263
|
-
|
|
6350
|
+
const $xeTable = this;
|
|
6351
|
+
return handleCheckedAllCheckboxRow($xeTable, value, true);
|
|
6264
6352
|
},
|
|
6265
6353
|
updateCheckboxStatus() {
|
|
6266
6354
|
const $xeTable = this;
|
|
@@ -6439,57 +6527,6 @@ const Methods = {
|
|
|
6439
6527
|
$xeTable.updateCheckboxStatus();
|
|
6440
6528
|
$xeTable.updateAllCheckboxStatus();
|
|
6441
6529
|
},
|
|
6442
|
-
// 还原展开、选中等相关状态
|
|
6443
|
-
handleReserveStatus() {
|
|
6444
|
-
const $xeTable = this;
|
|
6445
|
-
const {
|
|
6446
|
-
expandColumn,
|
|
6447
|
-
treeOpts,
|
|
6448
|
-
treeConfig,
|
|
6449
|
-
fullDataRowIdData,
|
|
6450
|
-
fullAllDataRowIdData,
|
|
6451
|
-
currentRow,
|
|
6452
|
-
selectRadioRow,
|
|
6453
|
-
radioReserveRow,
|
|
6454
|
-
radioOpts,
|
|
6455
|
-
checkboxOpts,
|
|
6456
|
-
selectCheckboxMaps,
|
|
6457
|
-
rowExpandedMaps,
|
|
6458
|
-
treeExpandedMaps,
|
|
6459
|
-
expandOpts
|
|
6460
|
-
} = this;
|
|
6461
|
-
// 单选框
|
|
6462
|
-
if (selectRadioRow && !fullAllDataRowIdData[(0, _util.getRowid)($xeTable, selectRadioRow)]) {
|
|
6463
|
-
this.selectRadioRow = null; // 刷新单选行状态
|
|
6464
|
-
}
|
|
6465
|
-
// 还原保留选中状态
|
|
6466
|
-
if (radioOpts.reserve && radioReserveRow) {
|
|
6467
|
-
const rowid = (0, _util.getRowid)(this, radioReserveRow);
|
|
6468
|
-
if (fullDataRowIdData[rowid]) {
|
|
6469
|
-
this.handleCheckedRadioRow(fullDataRowIdData[rowid].row, true);
|
|
6470
|
-
}
|
|
6471
|
-
}
|
|
6472
|
-
// 复选框
|
|
6473
|
-
this.selectCheckboxMaps = getRecoverRowMaps(this, selectCheckboxMaps); // 刷新多选行状态
|
|
6474
|
-
// 还原保留选中状态
|
|
6475
|
-
if (checkboxOpts.reserve) {
|
|
6476
|
-
this.handleCheckedCheckboxRow(handleReserveRow(this, this.checkboxReserveRowMap), true, true);
|
|
6477
|
-
}
|
|
6478
|
-
if (currentRow && !this.fullAllDataRowIdData[(0, _util.getRowid)($xeTable, currentRow)]) {
|
|
6479
|
-
this.currentRow = null; // 刷新当前行状态
|
|
6480
|
-
}
|
|
6481
|
-
// 行展开
|
|
6482
|
-
this.rowExpandedMaps = expandColumn ? getRecoverRowMaps(this, rowExpandedMaps) : []; // 刷新行展开状态
|
|
6483
|
-
// 还原保留状态
|
|
6484
|
-
if (expandColumn && expandOpts.reserve) {
|
|
6485
|
-
this.setRowExpand(handleReserveRow(this, this.rowExpandedReserveRowMap), true);
|
|
6486
|
-
}
|
|
6487
|
-
// 树展开
|
|
6488
|
-
this.treeExpandedMaps = treeConfig ? getRecoverRowMaps(this, treeExpandedMaps) : []; // 刷新树展开状态
|
|
6489
|
-
if (treeConfig && treeOpts.reserve) {
|
|
6490
|
-
this.setTreeExpand(handleReserveRow(this, this.treeExpandedReserveRowMap), true);
|
|
6491
|
-
}
|
|
6492
|
-
},
|
|
6493
6530
|
/**
|
|
6494
6531
|
* 获取单选框保留选中的行
|
|
6495
6532
|
*/
|
|
@@ -6531,14 +6568,6 @@ const Methods = {
|
|
|
6531
6568
|
this.radioReserveRow = null;
|
|
6532
6569
|
return this.$nextTick();
|
|
6533
6570
|
},
|
|
6534
|
-
handleRadioReserveRow(row) {
|
|
6535
|
-
const {
|
|
6536
|
-
radioOpts
|
|
6537
|
-
} = this;
|
|
6538
|
-
if (radioOpts.reserve) {
|
|
6539
|
-
this.radioReserveRow = row;
|
|
6540
|
-
}
|
|
6541
|
-
},
|
|
6542
6571
|
/**
|
|
6543
6572
|
* 获取复选框保留选中的行
|
|
6544
6573
|
*/
|
|
@@ -6601,12 +6630,13 @@ const Methods = {
|
|
|
6601
6630
|
}
|
|
6602
6631
|
},
|
|
6603
6632
|
handleCheckAllEvent(evnt, value) {
|
|
6604
|
-
this
|
|
6633
|
+
const $xeTable = this;
|
|
6634
|
+
handleCheckedAllCheckboxRow($xeTable, value);
|
|
6605
6635
|
if (evnt) {
|
|
6606
|
-
|
|
6607
|
-
records:
|
|
6608
|
-
reserves:
|
|
6609
|
-
indeterminates:
|
|
6636
|
+
$xeTable.dispatchEvent('checkbox-all', {
|
|
6637
|
+
records: $xeTable.getCheckboxRecords(),
|
|
6638
|
+
reserves: $xeTable.getCheckboxReserveRecords(),
|
|
6639
|
+
indeterminates: $xeTable.getCheckboxIndeterminateRecords(),
|
|
6610
6640
|
checked: value
|
|
6611
6641
|
}, evnt);
|
|
6612
6642
|
}
|
|
@@ -6615,6 +6645,7 @@ const Methods = {
|
|
|
6615
6645
|
* 多选,选中所有事件
|
|
6616
6646
|
*/
|
|
6617
6647
|
triggerCheckAllEvent(evnt, value) {
|
|
6648
|
+
const $xeTable = this;
|
|
6618
6649
|
const {
|
|
6619
6650
|
checkboxOpts
|
|
6620
6651
|
} = this;
|
|
@@ -6627,7 +6658,7 @@ const Methods = {
|
|
|
6627
6658
|
if (evnt) {
|
|
6628
6659
|
evnt.stopPropagation();
|
|
6629
6660
|
}
|
|
6630
|
-
|
|
6661
|
+
$xeTable.handleCheckAllEvent(evnt, value);
|
|
6631
6662
|
},
|
|
6632
6663
|
/**
|
|
6633
6664
|
* 多选,切换所有行的选中状态
|
|
@@ -6681,6 +6712,7 @@ const Methods = {
|
|
|
6681
6712
|
* 处理单选框默认勾选
|
|
6682
6713
|
*/
|
|
6683
6714
|
handleDefaultRadioChecked() {
|
|
6715
|
+
const $xeTable = this;
|
|
6684
6716
|
const {
|
|
6685
6717
|
radioOpts,
|
|
6686
6718
|
fullDataRowIdData
|
|
@@ -6691,7 +6723,7 @@ const Methods = {
|
|
|
6691
6723
|
} = radioOpts;
|
|
6692
6724
|
if (rowid) {
|
|
6693
6725
|
if (fullDataRowIdData[rowid]) {
|
|
6694
|
-
|
|
6726
|
+
handleCheckedRadioRow($xeTable, fullDataRowIdData[rowid].row, true);
|
|
6695
6727
|
}
|
|
6696
6728
|
if (reserve) {
|
|
6697
6729
|
const rowkey = (0, _util.getRowkey)(this);
|
|
@@ -6705,6 +6737,7 @@ const Methods = {
|
|
|
6705
6737
|
* 单选,行选中事件
|
|
6706
6738
|
*/
|
|
6707
6739
|
triggerRadioRowEvent(evnt, params) {
|
|
6740
|
+
const $xeTable = this;
|
|
6708
6741
|
const {
|
|
6709
6742
|
selectRadioRow: oldValue,
|
|
6710
6743
|
radioOpts
|
|
@@ -6722,7 +6755,7 @@ const Methods = {
|
|
|
6722
6755
|
let newValue = row;
|
|
6723
6756
|
let isChange = oldValue !== newValue;
|
|
6724
6757
|
if (isChange) {
|
|
6725
|
-
|
|
6758
|
+
handleCheckedRadioRow($xeTable, newValue);
|
|
6726
6759
|
} else if (!radioOpts.strict) {
|
|
6727
6760
|
isChange = oldValue === newValue;
|
|
6728
6761
|
if (isChange) {
|
|
@@ -6819,28 +6852,13 @@ const Methods = {
|
|
|
6819
6852
|
}
|
|
6820
6853
|
return false;
|
|
6821
6854
|
},
|
|
6822
|
-
handleCheckedRadioRow(row, isForce) {
|
|
6823
|
-
const {
|
|
6824
|
-
radioOpts
|
|
6825
|
-
} = this;
|
|
6826
|
-
const {
|
|
6827
|
-
checkMethod
|
|
6828
|
-
} = radioOpts;
|
|
6829
|
-
if (row && (isForce || !checkMethod || checkMethod({
|
|
6830
|
-
row
|
|
6831
|
-
}))) {
|
|
6832
|
-
this.selectRadioRow = row;
|
|
6833
|
-
this.handleRadioReserveRow(row);
|
|
6834
|
-
}
|
|
6835
|
-
return this.$nextTick();
|
|
6836
|
-
},
|
|
6837
6855
|
/**
|
|
6838
6856
|
* 用于单选行,设置某一行为选中状态
|
|
6839
6857
|
* @param {Row} row 行对象
|
|
6840
6858
|
*/
|
|
6841
6859
|
setRadioRow(row) {
|
|
6842
6860
|
const $xeTable = this;
|
|
6843
|
-
return $xeTable
|
|
6861
|
+
return handleCheckedRadioRow($xeTable, row, true);
|
|
6844
6862
|
},
|
|
6845
6863
|
/**
|
|
6846
6864
|
* 用于单选行,设置某一行为选中状态
|
|
@@ -6854,7 +6872,7 @@ const Methods = {
|
|
|
6854
6872
|
} = internalData;
|
|
6855
6873
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
6856
6874
|
if (rowRest) {
|
|
6857
|
-
return $xeTable
|
|
6875
|
+
return handleCheckedRadioRow($xeTable, rowRest.row, true);
|
|
6858
6876
|
}
|
|
6859
6877
|
return $xeTable.$nextTick();
|
|
6860
6878
|
},
|
|
@@ -8752,7 +8770,6 @@ const Methods = {
|
|
|
8752
8770
|
const $xeTable = this;
|
|
8753
8771
|
const reactData = $xeTable;
|
|
8754
8772
|
const internalData = $xeTable;
|
|
8755
|
-
const tExpandedMaps = Object.assign({}, reactData.treeExpandedMaps);
|
|
8756
8773
|
const {
|
|
8757
8774
|
fullAllDataRowIdData
|
|
8758
8775
|
} = internalData;
|
|
@@ -8760,7 +8777,9 @@ const Methods = {
|
|
|
8760
8777
|
const {
|
|
8761
8778
|
transform
|
|
8762
8779
|
} = treeOpts;
|
|
8780
|
+
let tExpandedMaps = {};
|
|
8763
8781
|
if (rows) {
|
|
8782
|
+
tExpandedMaps = Object.assign({}, reactData.treeExpandedMaps);
|
|
8764
8783
|
if (!_xeUtils.default.isArray(rows)) {
|
|
8765
8784
|
rows = [rows];
|
|
8766
8785
|
}
|
|
@@ -8774,8 +8793,12 @@ const Methods = {
|
|
|
8774
8793
|
}
|
|
8775
8794
|
}
|
|
8776
8795
|
});
|
|
8796
|
+
} else {
|
|
8797
|
+
_xeUtils.default.each(fullAllDataRowIdData, rowRest => {
|
|
8798
|
+
rowRest.treeLoaded = false;
|
|
8799
|
+
});
|
|
8777
8800
|
}
|
|
8778
|
-
reactData.treeExpandedMaps =
|
|
8801
|
+
reactData.treeExpandedMaps = {};
|
|
8779
8802
|
if (transform) {
|
|
8780
8803
|
handleVirtualTreeToList($xeTable);
|
|
8781
8804
|
return $xeTable.handleTableData();
|
|
@@ -8937,7 +8960,7 @@ const Methods = {
|
|
|
8937
8960
|
}
|
|
8938
8961
|
// 如果当前节点已选中,则展开后子节点也被选中
|
|
8939
8962
|
if (!checkStrictly && this.isCheckedByCheckboxRow(row)) {
|
|
8940
|
-
|
|
8963
|
+
handleCheckedCheckboxRow($xeTable, childRows, true);
|
|
8941
8964
|
}
|
|
8942
8965
|
return this.$nextTick().then(() => {
|
|
8943
8966
|
if (transform) {
|