vxe-table 3.9.10 → 3.9.11
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/render/index.js +3 -0
- package/es/table/src/methods.js +62 -63
- package/es/table/src/table.js +0 -1
- package/es/ui/index.js +2 -2
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +77 -83
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/render/index.js +3 -0
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/methods.js +71 -71
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +0 -1
- package/lib/table/src/table.min.js +1 -1
- package/lib/ui/index.js +2 -2
- 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 +3 -3
- package/packages/table/render/index.ts +3 -0
- package/packages/table/src/methods.ts +75 -64
- package/packages/table/src/table.ts +0 -1
- /package/es/{iconfont.1729062501514.ttf → iconfont.1729162486747.ttf} +0 -0
- /package/es/{iconfont.1729062501514.woff → iconfont.1729162486747.woff} +0 -0
- /package/es/{iconfont.1729062501514.woff2 → iconfont.1729162486747.woff2} +0 -0
- /package/lib/{iconfont.1729062501514.ttf → iconfont.1729162486747.ttf} +0 -0
- /package/lib/{iconfont.1729062501514.woff → iconfont.1729162486747.woff} +0 -0
- /package/lib/{iconfont.1729062501514.woff2 → iconfont.1729162486747.woff2} +0 -0
package/es/table/src/methods.js
CHANGED
|
@@ -639,7 +639,7 @@ const Methods = {
|
|
|
639
639
|
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
640
640
|
*/
|
|
641
641
|
cacheRowMap(isSource) {
|
|
642
|
-
const { treeConfig, treeOpts, tableFullData, fullAllDataRowIdData,
|
|
642
|
+
const { treeConfig, treeOpts, tableFullData, fullAllDataRowIdData, tableFullTreeData } = this;
|
|
643
643
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
644
644
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
645
645
|
const rowkey = getRowkey(this);
|
|
@@ -671,7 +671,6 @@ const Methods = {
|
|
|
671
671
|
this.fullDataRowIdData = fullDataRowIdMaps;
|
|
672
672
|
}
|
|
673
673
|
this.fullAllDataRowIdData = fullAllDataRowIdMaps;
|
|
674
|
-
fullAllDataRowMap.clear();
|
|
675
674
|
if (treeConfig) {
|
|
676
675
|
XEUtils.eachTree(tableFullTreeData, handleCache, { children: childrenField });
|
|
677
676
|
}
|
|
@@ -709,11 +708,12 @@ const Methods = {
|
|
|
709
708
|
return this.params;
|
|
710
709
|
},
|
|
711
710
|
loadTreeChildren(row, childRecords) {
|
|
712
|
-
const
|
|
711
|
+
const $xeTable = this;
|
|
712
|
+
const { keepSource, tableSourceData, treeOpts, fullDataRowIdData, fullAllDataRowIdData, sourceDataRowIdData } = this;
|
|
713
713
|
const { transform, mapChildrenField } = treeOpts;
|
|
714
714
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
715
|
-
const
|
|
716
|
-
const parentLevel =
|
|
715
|
+
const parentRest = fullAllDataRowIdData[getRowid($xeTable, row)];
|
|
716
|
+
const parentLevel = parentRest ? parentRest.level : 0;
|
|
717
717
|
return this.createData(childRecords).then((rows) => {
|
|
718
718
|
if (keepSource) {
|
|
719
719
|
const rowid = getRowid(this, row);
|
|
@@ -727,13 +727,11 @@ const Methods = {
|
|
|
727
727
|
});
|
|
728
728
|
}
|
|
729
729
|
XEUtils.eachTree(rows, (childRow, index, items, path, parent, nodes) => {
|
|
730
|
-
const rowid = getRowid(
|
|
731
|
-
const parentRow = parent || row;
|
|
730
|
+
const rowid = getRowid($xeTable, childRow);
|
|
731
|
+
const parentRow = parent || parentRest.row;
|
|
732
732
|
const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, items, parent: parentRow, level: parentLevel + nodes.length };
|
|
733
733
|
fullDataRowIdData[rowid] = rest;
|
|
734
|
-
fullDataRowMap.set(childRow, rest);
|
|
735
734
|
fullAllDataRowIdData[rowid] = rest;
|
|
736
|
-
fullAllDataRowMap.set(childRow, rest);
|
|
737
735
|
}, { children: childrenField });
|
|
738
736
|
row[childrenField] = rows;
|
|
739
737
|
if (transform) {
|
|
@@ -1193,6 +1191,7 @@ const Methods = {
|
|
|
1193
1191
|
return null;
|
|
1194
1192
|
},
|
|
1195
1193
|
getCellLabel(row, fieldOrColumn) {
|
|
1194
|
+
const $xeTable = this;
|
|
1196
1195
|
const column = handleFieldOrColumn(this, fieldOrColumn);
|
|
1197
1196
|
if (!column) {
|
|
1198
1197
|
return null;
|
|
@@ -1201,15 +1200,15 @@ const Methods = {
|
|
|
1201
1200
|
const cellValue = getCellValue(row, column);
|
|
1202
1201
|
let cellLabel = cellValue;
|
|
1203
1202
|
if (formatter) {
|
|
1204
|
-
let
|
|
1205
|
-
const {
|
|
1203
|
+
let formatData;
|
|
1204
|
+
const { fullAllDataRowIdData } = $xeTable;
|
|
1205
|
+
const rowid = getRowid($xeTable, row);
|
|
1206
1206
|
const colid = column.id;
|
|
1207
|
-
const
|
|
1208
|
-
if (
|
|
1209
|
-
rest = fullAllDataRowMap.get(row);
|
|
1207
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
1208
|
+
if (rest) {
|
|
1210
1209
|
formatData = rest.formatData;
|
|
1211
1210
|
if (!formatData) {
|
|
1212
|
-
formatData =
|
|
1211
|
+
formatData = fullAllDataRowIdData[rowid].formatData = {};
|
|
1213
1212
|
}
|
|
1214
1213
|
if (rest && formatData[colid]) {
|
|
1215
1214
|
if (formatData[colid].value === cellValue) {
|
|
@@ -1606,8 +1605,9 @@ const Methods = {
|
|
|
1606
1605
|
* @param {Row} row 行对象
|
|
1607
1606
|
*/
|
|
1608
1607
|
getRowid(row) {
|
|
1609
|
-
const
|
|
1610
|
-
|
|
1608
|
+
const $xeTable = this;
|
|
1609
|
+
const rowid = XEUtils.get(row, getRowkey($xeTable));
|
|
1610
|
+
return XEUtils.eqNull(rowid) ? '' : encodeURIComponent(rowid);
|
|
1611
1611
|
},
|
|
1612
1612
|
/**
|
|
1613
1613
|
* 获取处理后的表格数据
|
|
@@ -3909,9 +3909,10 @@ const Methods = {
|
|
|
3909
3909
|
},
|
|
3910
3910
|
// 还原展开、选中等相关状态
|
|
3911
3911
|
handleReserveStatus() {
|
|
3912
|
-
const
|
|
3912
|
+
const $xeTable = this;
|
|
3913
|
+
const { expandColumn, treeOpts, treeConfig, fullDataRowIdData, fullAllDataRowIdData, currentRow, selectRadioRow, radioReserveRow, radioOpts, checkboxOpts, selectCheckboxMaps, rowExpandedMaps, treeExpandedMaps, expandOpts } = this;
|
|
3913
3914
|
// 单选框
|
|
3914
|
-
if (selectRadioRow && !
|
|
3915
|
+
if (selectRadioRow && !fullAllDataRowIdData[getRowid($xeTable, selectRadioRow)]) {
|
|
3915
3916
|
this.selectRadioRow = null; // 刷新单选行状态
|
|
3916
3917
|
}
|
|
3917
3918
|
// 还原保留选中状态
|
|
@@ -3927,7 +3928,7 @@ const Methods = {
|
|
|
3927
3928
|
if (checkboxOpts.reserve) {
|
|
3928
3929
|
this.handleCheckedCheckboxRow(handleReserveRow(this, this.checkboxReserveRowMap), true, true);
|
|
3929
3930
|
}
|
|
3930
|
-
if (currentRow && !
|
|
3931
|
+
if (currentRow && !this.fullAllDataRowIdData[getRowid($xeTable, currentRow)]) {
|
|
3931
3932
|
this.currentRow = null; // 刷新当前行状态
|
|
3932
3933
|
}
|
|
3933
3934
|
// 行展开
|
|
@@ -4659,14 +4660,17 @@ const Methods = {
|
|
|
4659
4660
|
* @param {Row} row 行对象
|
|
4660
4661
|
*/
|
|
4661
4662
|
isRowExpandLoaded(row) {
|
|
4662
|
-
const
|
|
4663
|
-
|
|
4663
|
+
const $xeTable = this;
|
|
4664
|
+
const { fullAllDataRowIdData } = this;
|
|
4665
|
+
const rest = fullAllDataRowIdData[getRowid($xeTable, row)];
|
|
4666
|
+
return rest && !!rest.expandLoaded;
|
|
4664
4667
|
},
|
|
4665
4668
|
clearRowExpandLoaded(row) {
|
|
4666
|
-
const
|
|
4669
|
+
const $xeTable = this;
|
|
4670
|
+
const { expandOpts, rowExpandLazyLoadedMaps, fullAllDataRowIdData } = this;
|
|
4667
4671
|
const { lazy } = expandOpts;
|
|
4668
|
-
const rowid = getRowid(
|
|
4669
|
-
const rest =
|
|
4672
|
+
const rowid = getRowid($xeTable, row);
|
|
4673
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
4670
4674
|
if (lazy && rest) {
|
|
4671
4675
|
rest.expandLoaded = false;
|
|
4672
4676
|
const rowTempExpandLazyLoadedMaps = Object.assign({}, rowExpandLazyLoadedMaps);
|
|
@@ -4762,32 +4766,27 @@ const Methods = {
|
|
|
4762
4766
|
return this.setRowExpand(expandedRows, expanded);
|
|
4763
4767
|
},
|
|
4764
4768
|
handleAsyncRowExpand(row) {
|
|
4765
|
-
const
|
|
4766
|
-
const rest = fullAllDataRowMap.get(row);
|
|
4769
|
+
const $xeTable = this;
|
|
4767
4770
|
return new Promise(resolve => {
|
|
4771
|
+
const { expandOpts } = this;
|
|
4768
4772
|
const { loadMethod } = expandOpts;
|
|
4769
4773
|
if (loadMethod) {
|
|
4770
|
-
const { rowExpandLazyLoadedMaps } = this;
|
|
4771
|
-
const
|
|
4772
|
-
const
|
|
4773
|
-
|
|
4774
|
-
this.
|
|
4775
|
-
loadMethod({ $table: this, row, rowIndex: this.getRowIndex(row), $rowIndex: this.getVMRowIndex(row) }).then(() => {
|
|
4776
|
-
rest.expandLoaded = true;
|
|
4774
|
+
const { rowExpandLazyLoadedMaps, fullAllDataRowIdData } = this;
|
|
4775
|
+
const rowid = getRowid($xeTable, row);
|
|
4776
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
4777
|
+
rowExpandLazyLoadedMaps[rowid] = row;
|
|
4778
|
+
loadMethod({ $table: $xeTable, row, rowIndex: this.getRowIndex(row), $rowIndex: this.getVMRowIndex(row) }).then(() => {
|
|
4777
4779
|
const { rowExpandedMaps } = this;
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
this.rowExpandedMaps = rowTempExpandedMaps;
|
|
4780
|
+
rest.expandLoaded = true;
|
|
4781
|
+
rowExpandedMaps[rowid] = row;
|
|
4781
4782
|
}).catch(() => {
|
|
4782
4783
|
rest.expandLoaded = false;
|
|
4783
4784
|
}).finally(() => {
|
|
4784
4785
|
const { rowExpandLazyLoadedMaps } = this;
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
delete rowTempExpandLazyLoadedMaps[rowid];
|
|
4786
|
+
if (rowExpandLazyLoadedMaps[rowid]) {
|
|
4787
|
+
delete rowExpandLazyLoadedMaps[rowid];
|
|
4788
4788
|
}
|
|
4789
|
-
this.
|
|
4790
|
-
resolve(this.$nextTick().then(this.recalculate));
|
|
4789
|
+
this.$nextTick().then(() => this.recalculate()).then(() => resolve());
|
|
4791
4790
|
});
|
|
4792
4791
|
}
|
|
4793
4792
|
else {
|
|
@@ -4933,14 +4932,17 @@ const Methods = {
|
|
|
4933
4932
|
* @param {Row} row 行对象
|
|
4934
4933
|
*/
|
|
4935
4934
|
isTreeExpandLoaded(row) {
|
|
4936
|
-
const
|
|
4937
|
-
|
|
4935
|
+
const $xeTable = this;
|
|
4936
|
+
const { fullAllDataRowIdData } = this;
|
|
4937
|
+
const rest = fullAllDataRowIdData[getRowid($xeTable, row)];
|
|
4938
|
+
return rest && !!rest.treeLoaded;
|
|
4938
4939
|
},
|
|
4939
4940
|
clearTreeExpandLoaded(row) {
|
|
4940
|
-
const
|
|
4941
|
+
const $xeTable = this;
|
|
4942
|
+
const { treeOpts, treeExpandedMaps, fullAllDataRowIdData } = this;
|
|
4941
4943
|
const { transform, lazy } = treeOpts;
|
|
4942
|
-
const rowid = getRowid(
|
|
4943
|
-
const rest =
|
|
4944
|
+
const rowid = getRowid($xeTable, row);
|
|
4945
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
4944
4946
|
if (lazy && rest) {
|
|
4945
4947
|
rest.treeLoaded = false;
|
|
4946
4948
|
if (treeExpandedMaps[rowid]) {
|
|
@@ -5034,20 +5036,20 @@ const Methods = {
|
|
|
5034
5036
|
}
|
|
5035
5037
|
},
|
|
5036
5038
|
handleAsyncTreeExpandChilds(row) {
|
|
5039
|
+
const $xeTable = this;
|
|
5037
5040
|
const { treeOpts, checkboxOpts } = this;
|
|
5038
5041
|
const { transform, loadMethod } = treeOpts;
|
|
5039
5042
|
const { checkStrictly } = checkboxOpts;
|
|
5040
5043
|
return new Promise(resolve => {
|
|
5041
5044
|
if (loadMethod) {
|
|
5042
|
-
const {
|
|
5043
|
-
const rowid = getRowid(
|
|
5044
|
-
const rest =
|
|
5045
|
+
const { treeExpandLazyLoadedMaps, fullAllDataRowIdData } = this;
|
|
5046
|
+
const rowid = getRowid($xeTable, row);
|
|
5047
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
5045
5048
|
treeExpandLazyLoadedMaps[rowid] = row;
|
|
5046
|
-
loadMethod({ $table:
|
|
5047
|
-
// 响应成功后则展开行,并将子节点挂载到该节点下
|
|
5049
|
+
Promise.resolve(loadMethod({ $table: $xeTable, row })).then((childRecords) => {
|
|
5048
5050
|
rest.treeLoaded = true;
|
|
5049
5051
|
if (treeExpandLazyLoadedMaps[rowid]) {
|
|
5050
|
-
treeExpandLazyLoadedMaps[rowid]
|
|
5052
|
+
delete treeExpandLazyLoadedMaps[rowid];
|
|
5051
5053
|
}
|
|
5052
5054
|
if (!XEUtils.isArray(childRecords)) {
|
|
5053
5055
|
childRecords = [];
|
|
@@ -5055,14 +5057,12 @@ const Methods = {
|
|
|
5055
5057
|
if (childRecords) {
|
|
5056
5058
|
return this.loadTreeChildren(row, childRecords).then((childRows) => {
|
|
5057
5059
|
const { treeExpandedMaps } = this;
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
treeTempExpandedMaps[rowid] = row;
|
|
5061
|
-
this.treeExpandedMaps = treeTempExpandedMaps;
|
|
5060
|
+
if (childRows.length && !treeExpandedMaps[rowid]) {
|
|
5061
|
+
treeExpandedMaps[rowid] = row;
|
|
5062
5062
|
}
|
|
5063
5063
|
// 如果当前节点已选中,则展开后子节点也被选中
|
|
5064
5064
|
if (!checkStrictly && this.isCheckedByCheckboxRow(row)) {
|
|
5065
|
-
this.handleCheckedCheckboxRow(childRows, true
|
|
5065
|
+
this.handleCheckedCheckboxRow(childRows, true);
|
|
5066
5066
|
}
|
|
5067
5067
|
return this.$nextTick().then(() => {
|
|
5068
5068
|
if (transform) {
|
|
@@ -5072,11 +5072,10 @@ const Methods = {
|
|
|
5072
5072
|
});
|
|
5073
5073
|
}
|
|
5074
5074
|
}).catch(() => {
|
|
5075
|
-
// 如果响应异常,则不展开,再次点击后将重新触发懒加载
|
|
5076
|
-
rest.treeLoaded = false;
|
|
5077
5075
|
const { treeExpandLazyLoadedMaps } = this;
|
|
5076
|
+
rest.treeLoaded = false;
|
|
5078
5077
|
if (treeExpandLazyLoadedMaps[rowid]) {
|
|
5079
|
-
treeExpandLazyLoadedMaps[rowid]
|
|
5078
|
+
delete treeExpandLazyLoadedMaps[rowid];
|
|
5080
5079
|
}
|
|
5081
5080
|
}).finally(() => {
|
|
5082
5081
|
this.$nextTick().then(() => this.recalculate()).then(() => resolve());
|
|
@@ -5111,7 +5110,7 @@ const Methods = {
|
|
|
5111
5110
|
* @returns
|
|
5112
5111
|
*/
|
|
5113
5112
|
handleBaseTreeExpand(rows, expanded) {
|
|
5114
|
-
const {
|
|
5113
|
+
const { fullAllDataRowIdData, tableFullData, treeExpandedMaps, treeOpts, treeExpandLazyLoadedMaps, treeNodeColumn } = this;
|
|
5115
5114
|
const { reserve, lazy, accordion, toggleMethod } = treeOpts;
|
|
5116
5115
|
const treeTempExpandedMaps = Object.assign({}, treeExpandedMaps);
|
|
5117
5116
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
@@ -5137,7 +5136,7 @@ const Methods = {
|
|
|
5137
5136
|
validRows.forEach((row) => {
|
|
5138
5137
|
const rowid = getRowid(this, row);
|
|
5139
5138
|
if (!treeTempExpandedMaps[rowid]) {
|
|
5140
|
-
const rest =
|
|
5139
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
5141
5140
|
const isLoad = lazy && row[hasChildField] && !rest.treeLoaded && !treeExpandLazyLoadedMaps[rowid];
|
|
5142
5141
|
// 是否使用懒加载
|
|
5143
5142
|
if (isLoad) {
|
package/es/table/src/table.js
CHANGED
package/es/ui/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VxeUI } from '@vxe-ui/core';
|
|
2
2
|
import { getFuncText } from './src/utils';
|
|
3
|
-
export const version = "3.9.
|
|
3
|
+
export const version = "3.9.11";
|
|
4
4
|
VxeUI.version = version;
|
|
5
|
-
VxeUI.tableVersion = "3.9.
|
|
5
|
+
VxeUI.tableVersion = "3.9.11";
|
|
6
6
|
VxeUI.setConfig({
|
|
7
7
|
emptyCell: ' ',
|
|
8
8
|
table: {
|
package/es/ui/src/log.js
CHANGED