vxe-table 3.8.5 → 3.8.6-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/custom/src/panel.js +10 -3
- package/lib/custom/src/panel.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.umd.js +76 -22
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/methods.js +64 -17
- package/lib/table/src/methods.min.js +1 -1
- package/lib/tools/log.js +1 -1
- package/lib/tools/log.min.js +1 -1
- package/lib/v-x-e-table/index.js +1 -1
- package/lib/v-x-e-table/index.min.js +1 -1
- package/package.json +1 -1
- package/packages/custom/src/panel.js +10 -3
- package/packages/table/src/methods.js +62 -14
- /package/lib/icon/style/{iconfont.1715055533745.ttf → iconfont.1715127150277.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1715055533745.woff → iconfont.1715127150277.woff} +0 -0
- /package/lib/icon/style/{iconfont.1715055533745.woff2 → iconfont.1715127150277.woff2} +0 -0
- /package/lib/{iconfont.1715055533745.ttf → iconfont.1715127150277.ttf} +0 -0
- /package/lib/{iconfont.1715055533745.woff → iconfont.1715127150277.woff} +0 -0
- /package/lib/{iconfont.1715055533745.woff2 → iconfont.1715127150277.woff2} +0 -0
package/lib/table/src/methods.js
CHANGED
|
@@ -655,13 +655,22 @@ var Methods = {
|
|
|
655
655
|
return _this8.loadColumn(columns);
|
|
656
656
|
});
|
|
657
657
|
},
|
|
658
|
+
initColumnSort: function initColumnSort() {
|
|
659
|
+
var collectColumn = this.collectColumn;
|
|
660
|
+
collectColumn.forEach(function (column, index) {
|
|
661
|
+
var sortIndex = index + 1;
|
|
662
|
+
column.sortNumber = sortIndex;
|
|
663
|
+
column.renderSortNumber = sortIndex;
|
|
664
|
+
});
|
|
665
|
+
},
|
|
658
666
|
handleColumn: function handleColumn(collectColumn) {
|
|
659
667
|
var _this9 = this;
|
|
660
668
|
this.collectColumn = collectColumn;
|
|
661
669
|
var tableFullColumn = getColumnList(collectColumn);
|
|
662
670
|
this.tableFullColumn = tableFullColumn;
|
|
663
|
-
this.
|
|
671
|
+
this.initColumnSort();
|
|
664
672
|
this.restoreCustomStorage();
|
|
673
|
+
this.cacheColumnMap();
|
|
665
674
|
this.parseColumns().then(function () {
|
|
666
675
|
if (_this9.scrollXLoad) {
|
|
667
676
|
_this9.loadScrollXData(true);
|
|
@@ -840,7 +849,7 @@ var Methods = {
|
|
|
840
849
|
* 更新数据列的 Map
|
|
841
850
|
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
842
851
|
*/
|
|
843
|
-
cacheColumnMap: function cacheColumnMap(
|
|
852
|
+
cacheColumnMap: function cacheColumnMap() {
|
|
844
853
|
var _this13 = this;
|
|
845
854
|
var tableFullColumn = this.tableFullColumn,
|
|
846
855
|
collectColumn = this.collectColumn,
|
|
@@ -948,9 +957,6 @@ var Methods = {
|
|
|
948
957
|
if (fullColumnIdData[colid]) {
|
|
949
958
|
(0, _log.errLog)('vxe.error.colRepet', ['colId', colid]);
|
|
950
959
|
}
|
|
951
|
-
if (isInit) {
|
|
952
|
-
column.sortNumber = index;
|
|
953
|
-
}
|
|
954
960
|
fullColumnIdData[colid] = rest;
|
|
955
961
|
fullColumnMap.set(column, rest);
|
|
956
962
|
};
|
|
@@ -1917,6 +1923,9 @@ var Methods = {
|
|
|
1917
1923
|
if (opts.resizable) {
|
|
1918
1924
|
this.saveCustomResizable(true);
|
|
1919
1925
|
}
|
|
1926
|
+
if (opts.sort) {
|
|
1927
|
+
this.saveCustomSort(true);
|
|
1928
|
+
}
|
|
1920
1929
|
if (opts.fixed) {
|
|
1921
1930
|
this.saveCustomFixed();
|
|
1922
1931
|
}
|
|
@@ -1934,6 +1943,7 @@ var Methods = {
|
|
|
1934
1943
|
}
|
|
1935
1944
|
}
|
|
1936
1945
|
this.saveCustomVisible();
|
|
1946
|
+
this.saveCustomSort();
|
|
1937
1947
|
this.analyColumnWidth();
|
|
1938
1948
|
return this.refreshColumn(true);
|
|
1939
1949
|
},
|
|
@@ -1942,7 +1952,6 @@ var Methods = {
|
|
|
1942
1952
|
*/
|
|
1943
1953
|
restoreCustomStorage: function restoreCustomStorage() {
|
|
1944
1954
|
var id = this.id,
|
|
1945
|
-
collectColumn = this.collectColumn,
|
|
1946
1955
|
customConfig = this.customConfig,
|
|
1947
1956
|
customOpts = this.customOpts;
|
|
1948
1957
|
var storage = customOpts.storage;
|
|
@@ -1991,22 +2000,21 @@ var Methods = {
|
|
|
1991
2000
|
}
|
|
1992
2001
|
}
|
|
1993
2002
|
// 自定义顺序
|
|
2003
|
+
var hasCustomSort = false;
|
|
1994
2004
|
if (isCustomSort) {
|
|
1995
2005
|
var columnSortStorage = getCustomStorageMap(sortStorageKey)[id];
|
|
1996
2006
|
if (columnSortStorage) {
|
|
1997
|
-
|
|
1998
|
-
colOrderSeqs.forEach(function (orderConf) {
|
|
1999
|
-
var _orderConf$split = orderConf.split('|'),
|
|
2000
|
-
_orderConf$split2 = _slicedToArray(_orderConf$split, 2),
|
|
2001
|
-
colKey = _orderConf$split2[0],
|
|
2002
|
-
sortNumber = _orderConf$split2[1];
|
|
2007
|
+
_xeUtils.default.each(columnSortStorage, function (renderSortNumber, colKey) {
|
|
2003
2008
|
if (customMap[colKey]) {
|
|
2004
|
-
customMap[colKey].
|
|
2009
|
+
customMap[colKey].renderSortNumber = renderSortNumber;
|
|
2005
2010
|
} else {
|
|
2006
2011
|
customMap[colKey] = {
|
|
2007
|
-
|
|
2012
|
+
renderSortNumber: renderSortNumber
|
|
2008
2013
|
};
|
|
2009
2014
|
}
|
|
2015
|
+
if (!hasCustomSort) {
|
|
2016
|
+
hasCustomSort = true;
|
|
2017
|
+
}
|
|
2010
2018
|
});
|
|
2011
2019
|
}
|
|
2012
2020
|
}
|
|
@@ -2038,6 +2046,7 @@ var Methods = {
|
|
|
2038
2046
|
});
|
|
2039
2047
|
}
|
|
2040
2048
|
}
|
|
2049
|
+
var collectColumn = this.collectColumn;
|
|
2041
2050
|
var keyMap = {};
|
|
2042
2051
|
_xeUtils.default.eachTree(collectColumn, function (column) {
|
|
2043
2052
|
var colKey = column.getKey();
|
|
@@ -2049,7 +2058,7 @@ var Methods = {
|
|
|
2049
2058
|
var visible = _ref5.visible,
|
|
2050
2059
|
resizeWidth = _ref5.resizeWidth,
|
|
2051
2060
|
fixed = _ref5.fixed,
|
|
2052
|
-
|
|
2061
|
+
renderSortNumber = _ref5.renderSortNumber;
|
|
2053
2062
|
var column = keyMap[field];
|
|
2054
2063
|
if (column) {
|
|
2055
2064
|
if (_xeUtils.default.isNumber(resizeWidth)) {
|
|
@@ -2061,11 +2070,17 @@ var Methods = {
|
|
|
2061
2070
|
if (fixed) {
|
|
2062
2071
|
column.fixed = fixed;
|
|
2063
2072
|
}
|
|
2064
|
-
if (
|
|
2065
|
-
column.
|
|
2073
|
+
if (renderSortNumber) {
|
|
2074
|
+
column.renderSortNumber = Number(renderSortNumber);
|
|
2066
2075
|
}
|
|
2067
2076
|
}
|
|
2068
2077
|
});
|
|
2078
|
+
// 如果自定义了顺序
|
|
2079
|
+
if (hasCustomSort) {
|
|
2080
|
+
collectColumn = _xeUtils.default.orderBy(collectColumn, 'renderSortNumber');
|
|
2081
|
+
this.collectColumn = collectColumn;
|
|
2082
|
+
this.tableFullColumn = getColumnList(collectColumn);
|
|
2083
|
+
}
|
|
2069
2084
|
}
|
|
2070
2085
|
},
|
|
2071
2086
|
saveCustomFixed: function saveCustomFixed() {
|
|
@@ -2166,6 +2181,38 @@ var Methods = {
|
|
|
2166
2181
|
localStorage.setItem(resizableStorageKey, _xeUtils.default.toJSONString(columnWidthStorageMap));
|
|
2167
2182
|
}
|
|
2168
2183
|
},
|
|
2184
|
+
saveCustomSort: function saveCustomSort(isReset) {
|
|
2185
|
+
var id = this.id,
|
|
2186
|
+
collectColumn = this.collectColumn,
|
|
2187
|
+
customConfig = this.customConfig,
|
|
2188
|
+
customOpts = this.customOpts;
|
|
2189
|
+
var storage = customOpts.storage;
|
|
2190
|
+
var isAllStorage = storage === true;
|
|
2191
|
+
var storageOpts = isAllStorage ? {} : Object.assign({}, storage || {});
|
|
2192
|
+
var isSort = isAllStorage || storageOpts.sort;
|
|
2193
|
+
if (customConfig && isSort) {
|
|
2194
|
+
var columnSortStorageMap = getCustomStorageMap(sortStorageKey);
|
|
2195
|
+
var columnWidthStorage;
|
|
2196
|
+
if (!id) {
|
|
2197
|
+
(0, _log.errLog)('vxe.error.reqProp', ['id']);
|
|
2198
|
+
return;
|
|
2199
|
+
}
|
|
2200
|
+
if (!isReset) {
|
|
2201
|
+
columnWidthStorage = _xeUtils.default.isPlainObject(columnSortStorageMap[id]) ? columnSortStorageMap[id] : {};
|
|
2202
|
+
// 排序只支持一级
|
|
2203
|
+
collectColumn.forEach(function (column) {
|
|
2204
|
+
if (column.sortNumber !== column.renderSortNumber) {
|
|
2205
|
+
var colKey = column.getKey();
|
|
2206
|
+
if (colKey) {
|
|
2207
|
+
columnWidthStorage[colKey] = column.renderSortNumber;
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
});
|
|
2211
|
+
}
|
|
2212
|
+
columnSortStorageMap[id] = _xeUtils.default.isEmpty(columnWidthStorage) ? undefined : columnWidthStorage;
|
|
2213
|
+
localStorage.setItem(sortStorageKey, _xeUtils.default.toJSONString(columnSortStorageMap));
|
|
2214
|
+
}
|
|
2215
|
+
},
|
|
2169
2216
|
handleUpdateDataQueue: function handleUpdateDataQueue() {
|
|
2170
2217
|
this.upDataFlag++;
|
|
2171
2218
|
},
|