vxe-table 3.5.0-beta.4 → 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.
@@ -1150,12 +1150,12 @@ const Methods = {
1150
1150
  updateAfterFullData () {
1151
1151
  const { tableFullColumn, tableFullData, filterOpts, sortOpts, treeConfig, treeOpts, tableFullTreeData } = this
1152
1152
  const { remote: allRemoteFilter, filterMethod: allFilterMethod } = filterOpts
1153
- const { remote: allRemoteSort, sortMethod: allSortMethod, multiple: sortMultiple } = sortOpts
1153
+ const { remote: allRemoteSort, sortMethod: allSortMethod, multiple: sortMultiple, chronological } = sortOpts
1154
1154
  const { transform } = treeOpts
1155
1155
  let tableData = []
1156
1156
  let tableTree = []
1157
1157
  const filterColumns = []
1158
- const orderColumns = []
1158
+ let orderColumns = []
1159
1159
  tableFullColumn.forEach(column => {
1160
1160
  const { property, sortable, order, filters } = column
1161
1161
  if (!allRemoteFilter && filters && filters.length) {
@@ -1172,9 +1172,12 @@ const Methods = {
1172
1172
  }
1173
1173
  }
1174
1174
  if (!allRemoteSort && sortable && order) {
1175
- orderColumns.push({ column, field: column.property, property, order })
1175
+ orderColumns.push({ column, field: column.property, property, order, sortTime: column.sortTime })
1176
1176
  }
1177
1177
  })
1178
+ if (sortMultiple && chronological && orderColumns.length > 1) {
1179
+ orderColumns = XEUtils.orderBy(orderColumns, 'sortTime')
1180
+ }
1178
1181
  if (filterColumns.length) {
1179
1182
  const handleFilter = (row) => {
1180
1183
  return filterColumns.every(({ column, valueList, itemList }) => {
@@ -3512,13 +3515,13 @@ const Methods = {
3512
3515
  defaultSort = [defaultSort]
3513
3516
  }
3514
3517
  if (defaultSort.length) {
3515
- (sortConfig.multiple ? defaultSort : defaultSort.slice(0, 1)).forEach((item) => {
3518
+ (sortConfig.multiple ? defaultSort : defaultSort.slice(0, 1)).forEach((item, index) => {
3516
3519
  const { field, order } = item
3517
3520
  if (field && order) {
3518
3521
  const column = this.getColumnByField(field)
3519
3522
  if (column && column.sortable) {
3520
3523
  column.order = order
3521
- column.sortTime = Date.now()
3524
+ column.sortTime = Date.now() + index
3522
3525
  }
3523
3526
  }
3524
3527
  })
@@ -3562,7 +3565,7 @@ const Methods = {
3562
3565
  if (!multiple) {
3563
3566
  clearAllSort(this)
3564
3567
  }
3565
- (multiple ? sortConfs : [sortConfs[0]]).forEach((confs) => {
3568
+ (multiple ? sortConfs : [sortConfs[0]]).forEach((confs, index) => {
3566
3569
  let { field, order } = confs
3567
3570
  let column = field
3568
3571
  if (XEUtils.isString(field)) {
@@ -3578,6 +3581,7 @@ const Methods = {
3578
3581
  if (column.order !== order) {
3579
3582
  column.order = order
3580
3583
  }
3584
+ column.sortTime = Date.now() + index
3581
3585
  }
3582
3586
  })
3583
3587
  // 如果是服务端排序,则跳过本地排序处理
@@ -3623,13 +3627,17 @@ const Methods = {
3623
3627
  return this.getSortColumns().length > 0
3624
3628
  },
3625
3629
  getSortColumns () {
3630
+ const { multiple, chronological } = this.sortOpts
3626
3631
  const sortList = []
3627
3632
  this.tableFullColumn.forEach((column) => {
3628
3633
  const { property, order } = column
3629
3634
  if ((column.sortable || column.remoteSort) && order) {
3630
- sortList.push({ column, field: column.property, property, order })
3635
+ sortList.push({ column, field: column.property, property, order, sortTime: column.sortTime })
3631
3636
  }
3632
3637
  })
3638
+ if (multiple && chronological && sortList.length > 1) {
3639
+ return XEUtils.orderBy(sortList, 'sortTime')
3640
+ }
3633
3641
  return sortList
3634
3642
  },
3635
3643
  /**
@@ -4630,7 +4638,7 @@ const Methods = {
4630
4638
  }
4631
4639
 
4632
4640
  // Module methods
4633
- const 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(',')
4641
+ const 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(',')
4634
4642
 
4635
4643
  funcs.forEach(name => {
4636
4644
  Methods[name] = function (...args) {