vxe-table 3.5.0-beta.2 → 3.5.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/export/src/mixin.js +1 -1
- package/lib/export/src/mixin.min.js +1 -1
- package/lib/index.umd.js +70 -41
- package/lib/index.umd.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/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/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/locale/lang/zh-HK.min.js +1 -1
- package/lib/locale/lang/zh-HK.umd.js +2 -1
- package/lib/locale/lang/zh-MO.min.js +1 -1
- package/lib/locale/lang/zh-MO.umd.js +2 -1
- package/lib/locale/lang/zh-TC.js +2 -1
- package/lib/locale/lang/zh-TC.min.js +1 -1
- package/lib/locale/lang/zh-TC.umd.js +2 -1
- package/lib/locale/lang/zh-TW.min.js +1 -1
- package/lib/locale/lang/zh-TW.umd.js +2 -1
- package/lib/table/src/methods.js +64 -36
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +16 -4
- 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/lib/v-x-e-table/src/conf.js +1 -1
- package/lib/v-x-e-table/src/conf.min.js +1 -1
- package/package.json +1 -1
- package/packages/export/src/mixin.js +1 -1
- package/packages/locale/lang/en-US.js +2 -1
- package/packages/locale/lang/ja-JP.js +2 -1
- package/packages/locale/lang/zh-CN.js +2 -1
- package/packages/locale/lang/zh-TC.js +2 -1
- package/packages/table/src/methods.js +27 -14
- package/packages/table/src/table.js +15 -3
- package/packages/v-x-e-table/src/conf.js +1 -1
- package/types/table.d.ts +6 -6
package/lib/table/src/methods.js
CHANGED
|
@@ -80,8 +80,7 @@ function eqCellValue(row1, row2, field) {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
if (_xeUtils.default.isString(val1) || _xeUtils.default.isNumber(val1)) {
|
|
83
|
-
|
|
84
|
-
return val1 == val2;
|
|
83
|
+
return '' + val1 === '' + val2;
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
return _xeUtils.default.isEqual(val1, val2);
|
|
@@ -1636,7 +1635,8 @@ var Methods = {
|
|
|
1636
1635
|
allFilterMethod = filterOpts.filterMethod;
|
|
1637
1636
|
var allRemoteSort = sortOpts.remote,
|
|
1638
1637
|
allSortMethod = sortOpts.sortMethod,
|
|
1639
|
-
sortMultiple = sortOpts.multiple
|
|
1638
|
+
sortMultiple = sortOpts.multiple,
|
|
1639
|
+
chronological = sortOpts.chronological;
|
|
1640
1640
|
var transform = treeOpts.transform;
|
|
1641
1641
|
var tableData = [];
|
|
1642
1642
|
var tableTree = [];
|
|
@@ -1672,11 +1672,16 @@ var Methods = {
|
|
|
1672
1672
|
column: column,
|
|
1673
1673
|
field: column.property,
|
|
1674
1674
|
property: property,
|
|
1675
|
-
order: order
|
|
1675
|
+
order: order,
|
|
1676
|
+
sortTime: column.sortTime
|
|
1676
1677
|
});
|
|
1677
1678
|
}
|
|
1678
1679
|
});
|
|
1679
1680
|
|
|
1681
|
+
if (sortMultiple && chronological && orderColumns.length > 1) {
|
|
1682
|
+
orderColumns = _xeUtils.default.orderBy(orderColumns, 'sortTime');
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1680
1685
|
if (filterColumns.length) {
|
|
1681
1686
|
var handleFilter = function handleFilter(row) {
|
|
1682
1687
|
return filterColumns.every(function (_ref) {
|
|
@@ -4901,7 +4906,7 @@ var Methods = {
|
|
|
4901
4906
|
}
|
|
4902
4907
|
|
|
4903
4908
|
if (defaultSort.length) {
|
|
4904
|
-
(sortConfig.multiple ? defaultSort : defaultSort.slice(0, 1)).forEach(function (item) {
|
|
4909
|
+
(sortConfig.multiple ? defaultSort : defaultSort.slice(0, 1)).forEach(function (item, index) {
|
|
4905
4910
|
var field = item.field,
|
|
4906
4911
|
order = item.order;
|
|
4907
4912
|
|
|
@@ -4910,7 +4915,7 @@ var Methods = {
|
|
|
4910
4915
|
|
|
4911
4916
|
if (column && column.sortable) {
|
|
4912
4917
|
column.order = order;
|
|
4913
|
-
column.sortTime = Date.now();
|
|
4918
|
+
column.sortTime = Date.now() + index;
|
|
4914
4919
|
}
|
|
4915
4920
|
}
|
|
4916
4921
|
});
|
|
@@ -4976,7 +4981,7 @@ var Methods = {
|
|
|
4976
4981
|
clearAllSort(this);
|
|
4977
4982
|
}
|
|
4978
4983
|
|
|
4979
|
-
(multiple ? sortConfs : [sortConfs[0]]).forEach(function (confs) {
|
|
4984
|
+
(multiple ? sortConfs : [sortConfs[0]]).forEach(function (confs, index) {
|
|
4980
4985
|
var field = confs.field,
|
|
4981
4986
|
order = confs.order;
|
|
4982
4987
|
var column = field;
|
|
@@ -4997,6 +5002,8 @@ var Methods = {
|
|
|
4997
5002
|
if (column.order !== order) {
|
|
4998
5003
|
column.order = order;
|
|
4999
5004
|
}
|
|
5005
|
+
|
|
5006
|
+
column.sortTime = Date.now() + index;
|
|
5000
5007
|
}
|
|
5001
5008
|
}); // 如果是服务端排序,则跳过本地排序处理
|
|
5002
5009
|
|
|
@@ -5053,6 +5060,9 @@ var Methods = {
|
|
|
5053
5060
|
return this.getSortColumns().length > 0;
|
|
5054
5061
|
},
|
|
5055
5062
|
getSortColumns: function getSortColumns() {
|
|
5063
|
+
var _this$sortOpts = this.sortOpts,
|
|
5064
|
+
multiple = _this$sortOpts.multiple,
|
|
5065
|
+
chronological = _this$sortOpts.chronological;
|
|
5056
5066
|
var sortList = [];
|
|
5057
5067
|
this.tableFullColumn.forEach(function (column) {
|
|
5058
5068
|
var property = column.property,
|
|
@@ -5063,10 +5073,16 @@ var Methods = {
|
|
|
5063
5073
|
column: column,
|
|
5064
5074
|
field: column.property,
|
|
5065
5075
|
property: property,
|
|
5066
|
-
order: order
|
|
5076
|
+
order: order,
|
|
5077
|
+
sortTime: column.sortTime
|
|
5067
5078
|
});
|
|
5068
5079
|
}
|
|
5069
5080
|
});
|
|
5081
|
+
|
|
5082
|
+
if (multiple && chronological && sortList.length > 1) {
|
|
5083
|
+
return _xeUtils.default.orderBy(sortList, 'sortTime');
|
|
5084
|
+
}
|
|
5085
|
+
|
|
5070
5086
|
return sortList;
|
|
5071
5087
|
},
|
|
5072
5088
|
|
|
@@ -5967,8 +5983,14 @@ var Methods = {
|
|
|
5967
5983
|
this.tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0);
|
|
5968
5984
|
},
|
|
5969
5985
|
updateScrollXData: function updateScrollXData() {
|
|
5970
|
-
this
|
|
5971
|
-
|
|
5986
|
+
var _this49 = this;
|
|
5987
|
+
|
|
5988
|
+
this.tableColumn = [];
|
|
5989
|
+
this.$nextTick(function () {
|
|
5990
|
+
_this49.handleTableColumn();
|
|
5991
|
+
|
|
5992
|
+
_this49.updateScrollXSpace();
|
|
5993
|
+
});
|
|
5972
5994
|
},
|
|
5973
5995
|
// 更新横向 X 可视渲染上下剩余空间大小
|
|
5974
5996
|
updateScrollXSpace: function updateScrollXSpace() {
|
|
@@ -6024,8 +6046,14 @@ var Methods = {
|
|
|
6024
6046
|
}
|
|
6025
6047
|
},
|
|
6026
6048
|
updateScrollYData: function updateScrollYData() {
|
|
6027
|
-
this
|
|
6028
|
-
|
|
6049
|
+
var _this50 = this;
|
|
6050
|
+
|
|
6051
|
+
this.tableData = [];
|
|
6052
|
+
this.$nextTick(function () {
|
|
6053
|
+
_this50.handleTableData();
|
|
6054
|
+
|
|
6055
|
+
_this50.updateScrollYSpace();
|
|
6056
|
+
});
|
|
6029
6057
|
},
|
|
6030
6058
|
// 更新纵向 Y 可视渲染上下剩余空间大小
|
|
6031
6059
|
updateScrollYSpace: function updateScrollYSpace() {
|
|
@@ -6071,7 +6099,7 @@ var Methods = {
|
|
|
6071
6099
|
* @param {Number} scrollTop 上距离
|
|
6072
6100
|
*/
|
|
6073
6101
|
scrollTo: function scrollTo(scrollLeft, scrollTop) {
|
|
6074
|
-
var
|
|
6102
|
+
var _this51 = this;
|
|
6075
6103
|
|
|
6076
6104
|
var $refs = this.$refs;
|
|
6077
6105
|
var tableBody = $refs.tableBody,
|
|
@@ -6092,7 +6120,7 @@ var Methods = {
|
|
|
6092
6120
|
if (this.scrollXLoad || this.scrollYLoad) {
|
|
6093
6121
|
return new Promise(function (resolve) {
|
|
6094
6122
|
return setTimeout(function () {
|
|
6095
|
-
return resolve(
|
|
6123
|
+
return resolve(_this51.$nextTick());
|
|
6096
6124
|
}, 50);
|
|
6097
6125
|
});
|
|
6098
6126
|
}
|
|
@@ -6143,7 +6171,7 @@ var Methods = {
|
|
|
6143
6171
|
* @param {Row} row 行对象
|
|
6144
6172
|
*/
|
|
6145
6173
|
scrollToTreeRow: function scrollToTreeRow(row) {
|
|
6146
|
-
var
|
|
6174
|
+
var _this52 = this;
|
|
6147
6175
|
|
|
6148
6176
|
var tableFullData = this.tableFullData,
|
|
6149
6177
|
treeConfig = this.treeConfig,
|
|
@@ -6158,15 +6186,15 @@ var Methods = {
|
|
|
6158
6186
|
if (matchObj) {
|
|
6159
6187
|
var nodes = matchObj.nodes;
|
|
6160
6188
|
nodes.forEach(function (row, index) {
|
|
6161
|
-
if (index < nodes.length - 1 && !
|
|
6162
|
-
rests.push(
|
|
6189
|
+
if (index < nodes.length - 1 && !_this52.isTreeExpandByRow(row)) {
|
|
6190
|
+
rests.push(_this52.setTreeExpand(row, true));
|
|
6163
6191
|
}
|
|
6164
6192
|
});
|
|
6165
6193
|
}
|
|
6166
6194
|
}
|
|
6167
6195
|
|
|
6168
6196
|
return Promise.all(rests).then(function () {
|
|
6169
|
-
return _dom.default.rowToVisible(
|
|
6197
|
+
return _dom.default.rowToVisible(_this52, row);
|
|
6170
6198
|
});
|
|
6171
6199
|
},
|
|
6172
6200
|
|
|
@@ -6230,29 +6258,29 @@ var Methods = {
|
|
|
6230
6258
|
* 如果单元格配置了校验规则,则会进行校验
|
|
6231
6259
|
*/
|
|
6232
6260
|
updateStatus: function updateStatus(scope, cellValue) {
|
|
6233
|
-
var
|
|
6261
|
+
var _this53 = this;
|
|
6234
6262
|
|
|
6235
6263
|
var customVal = !_xeUtils.default.isUndefined(cellValue);
|
|
6236
6264
|
return this.$nextTick().then(function () {
|
|
6237
|
-
var $refs =
|
|
6238
|
-
editRules =
|
|
6239
|
-
validStore =
|
|
6265
|
+
var $refs = _this53.$refs,
|
|
6266
|
+
editRules = _this53.editRules,
|
|
6267
|
+
validStore = _this53.validStore;
|
|
6240
6268
|
|
|
6241
6269
|
if (scope && $refs.tableBody && editRules) {
|
|
6242
6270
|
var row = scope.row,
|
|
6243
6271
|
column = scope.column;
|
|
6244
6272
|
var type = 'change';
|
|
6245
6273
|
|
|
6246
|
-
if (
|
|
6247
|
-
var cell =
|
|
6274
|
+
if (_this53.hasCellRules(type, row, column)) {
|
|
6275
|
+
var cell = _this53.getCell(row, column);
|
|
6248
6276
|
|
|
6249
6277
|
if (cell) {
|
|
6250
|
-
return
|
|
6278
|
+
return _this53.validCellRules(type, row, column, cellValue).then(function () {
|
|
6251
6279
|
if (customVal && validStore.visible) {
|
|
6252
6280
|
setCellValue(row, column, cellValue);
|
|
6253
6281
|
}
|
|
6254
6282
|
|
|
6255
|
-
|
|
6283
|
+
_this53.clearValidate();
|
|
6256
6284
|
}).catch(function (_ref8) {
|
|
6257
6285
|
var rule = _ref8.rule;
|
|
6258
6286
|
|
|
@@ -6260,7 +6288,7 @@ var Methods = {
|
|
|
6260
6288
|
setCellValue(row, column, cellValue);
|
|
6261
6289
|
}
|
|
6262
6290
|
|
|
6263
|
-
|
|
6291
|
+
_this53.showValidTooltip({
|
|
6264
6292
|
rule: rule,
|
|
6265
6293
|
row: row,
|
|
6266
6294
|
column: column,
|
|
@@ -6281,7 +6309,7 @@ var Methods = {
|
|
|
6281
6309
|
* @param {TableMergeConfig[]} merges { row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }
|
|
6282
6310
|
*/
|
|
6283
6311
|
setMergeCells: function setMergeCells(merges) {
|
|
6284
|
-
var
|
|
6312
|
+
var _this54 = this;
|
|
6285
6313
|
|
|
6286
6314
|
if (this.spanMethod) {
|
|
6287
6315
|
(0, _log.errLog)('vxe.error.errConflicts', ['merge-cells', 'span-method']);
|
|
@@ -6289,7 +6317,7 @@ var Methods = {
|
|
|
6289
6317
|
|
|
6290
6318
|
setMerges(this, merges, this.mergeList, this.afterFullData);
|
|
6291
6319
|
return this.$nextTick().then(function () {
|
|
6292
|
-
return
|
|
6320
|
+
return _this54.updateCellAreas();
|
|
6293
6321
|
});
|
|
6294
6322
|
},
|
|
6295
6323
|
|
|
@@ -6298,7 +6326,7 @@ var Methods = {
|
|
|
6298
6326
|
* @param {TableMergeConfig[]} merges 多个或数组 [{row:Row|number, col:ColumnInfo|number}]
|
|
6299
6327
|
*/
|
|
6300
6328
|
removeMergeCells: function removeMergeCells(merges) {
|
|
6301
|
-
var
|
|
6329
|
+
var _this55 = this;
|
|
6302
6330
|
|
|
6303
6331
|
if (this.spanMethod) {
|
|
6304
6332
|
(0, _log.errLog)('vxe.error.errConflicts', ['merge-cells', 'span-method']);
|
|
@@ -6306,7 +6334,7 @@ var Methods = {
|
|
|
6306
6334
|
|
|
6307
6335
|
var rest = removeMerges(this, merges, this.mergeList, this.afterFullData);
|
|
6308
6336
|
return this.$nextTick().then(function () {
|
|
6309
|
-
|
|
6337
|
+
_this55.updateCellAreas();
|
|
6310
6338
|
|
|
6311
6339
|
return rest;
|
|
6312
6340
|
});
|
|
@@ -6330,7 +6358,7 @@ var Methods = {
|
|
|
6330
6358
|
this.setMergeFooterItems(this.mergeFooterItems);
|
|
6331
6359
|
},
|
|
6332
6360
|
setMergeFooterItems: function setMergeFooterItems(merges) {
|
|
6333
|
-
var
|
|
6361
|
+
var _this56 = this;
|
|
6334
6362
|
|
|
6335
6363
|
if (this.footerSpanMethod) {
|
|
6336
6364
|
(0, _log.errLog)('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method']);
|
|
@@ -6338,11 +6366,11 @@ var Methods = {
|
|
|
6338
6366
|
|
|
6339
6367
|
setMerges(this, merges, this.mergeFooterList, null);
|
|
6340
6368
|
return this.$nextTick().then(function () {
|
|
6341
|
-
return
|
|
6369
|
+
return _this56.updateCellAreas();
|
|
6342
6370
|
});
|
|
6343
6371
|
},
|
|
6344
6372
|
removeMergeFooterItems: function removeMergeFooterItems(merges) {
|
|
6345
|
-
var
|
|
6373
|
+
var _this57 = this;
|
|
6346
6374
|
|
|
6347
6375
|
if (this.footerSpanMethod) {
|
|
6348
6376
|
(0, _log.errLog)('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method']);
|
|
@@ -6350,7 +6378,7 @@ var Methods = {
|
|
|
6350
6378
|
|
|
6351
6379
|
var rest = removeMerges(this, merges, this.mergeFooterList, null);
|
|
6352
6380
|
return this.$nextTick().then(function () {
|
|
6353
|
-
|
|
6381
|
+
_this57.updateCellAreas();
|
|
6354
6382
|
|
|
6355
6383
|
return rest;
|
|
6356
6384
|
});
|
|
@@ -6493,7 +6521,7 @@ var Methods = {
|
|
|
6493
6521
|
}
|
|
6494
6522
|
}; // Module methods
|
|
6495
6523
|
|
|
6496
|
-
var funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,clearCopyCellArea,setCellAreas,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearActived,getActiveRecord,isActiveByRow,setActiveRow,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',');
|
|
6524
|
+
var funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearActived,getActiveRecord,isActiveByRow,setActiveRow,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',');
|
|
6497
6525
|
funcs.forEach(function (name) {
|
|
6498
6526
|
Methods[name] = function () {
|
|
6499
6527
|
if (process.env.NODE_ENV === 'development') {
|