vxe-table 3.7.0-beta.3 → 3.7.0-beta.4

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.
@@ -414,7 +414,7 @@ const Methods = {
414
414
  this.tableSynchData = datas
415
415
  // 克隆原数据,用于显示编辑状态,与编辑值做对比
416
416
  if (keepSource) {
417
- this.tableSourceData = XEUtils.clone(fullData, true)
417
+ this.cacheSourceMap(fullData)
418
418
  }
419
419
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
420
420
  if (sYLoad) {
@@ -590,8 +590,8 @@ const Methods = {
590
590
  * 牺牲数据组装的耗时,用来换取使用过程中的流畅
591
591
  */
592
592
  cacheRowMap (source) {
593
- const { treeConfig, treeOpts, tableFullData, fullDataRowMap, fullAllDataRowMap, tableFullTreeData, tableSourceData } = this
594
- let { fullDataRowIdData, fullAllDataRowIdData, sourceDataRowIdData } = this
593
+ const { treeConfig, treeOpts, tableFullData, fullDataRowMap, fullAllDataRowMap, tableFullTreeData } = this
594
+ let { fullDataRowIdData, fullAllDataRowIdData } = this
595
595
  const rowkey = getRowkey(this)
596
596
  const isLazy = treeConfig && treeOpts.lazy
597
597
  const handleCache = (row, index, items, path, parent, nodes) => {
@@ -618,14 +618,18 @@ const Methods = {
618
618
  fullDataRowMap.clear()
619
619
  }
620
620
  fullAllDataRowIdData = this.fullAllDataRowIdData = {}
621
- sourceDataRowIdData = this.sourceDataRowIdData = {}
622
621
  fullAllDataRowMap.clear()
623
622
  if (treeConfig) {
624
623
  XEUtils.eachTree(tableFullTreeData, handleCache, treeOpts)
625
624
  } else {
626
625
  tableFullData.forEach(handleCache)
627
626
  }
628
-
627
+ },
628
+ cacheSourceMap (fullData) {
629
+ let { treeConfig, treeOpts, sourceDataRowIdData } = this
630
+ const sourceData = XEUtils.clone(fullData, true)
631
+ const rowkey = getRowkey(this)
632
+ sourceDataRowIdData = this.sourceDataRowIdData = {}
629
633
  const handleSourceRow = (row) => {
630
634
  let rowid = getRowid(this, row)
631
635
  if (eqEmptyValue(rowid)) {
@@ -639,10 +643,11 @@ const Methods = {
639
643
  }
640
644
  // 源数据缓存
641
645
  if (treeConfig && !treeOpts.transform) {
642
- XEUtils.eachTree(tableSourceData, handleSourceRow, treeOpts)
646
+ XEUtils.eachTree(sourceData, handleSourceRow, treeOpts)
643
647
  } else {
644
- tableSourceData.forEach(handleSourceRow)
648
+ sourceData.forEach(handleSourceRow)
645
649
  }
650
+ this.tableSourceData = sourceData
646
651
  },
647
652
  loadTreeChildren (row, childRecords) {
648
653
  const { keepSource, tableSourceData, treeOpts, fullDataRowIdData, fullDataRowMap, fullAllDataRowMap, fullAllDataRowIdData } = this
@@ -1080,31 +1085,21 @@ const Methods = {
1080
1085
  * @param {String} field 字段名
1081
1086
  */
1082
1087
  isUpdateByRow (row, field) {
1083
- const { tableFullColumn, keepSource, treeConfig, treeOpts, tableSourceData, fullDataRowIdData } = this
1088
+ const { tableFullColumn, keepSource, sourceDataRowIdData, fullDataRowIdData } = this
1084
1089
  if (keepSource) {
1085
- let oRow, property
1086
1090
  const rowid = getRowid(this, row)
1087
1091
  // 新增的数据不需要检测
1088
1092
  if (!fullDataRowIdData[rowid]) {
1089
1093
  return false
1090
1094
  }
1091
- if (treeConfig) {
1092
- const children = treeOpts.children
1093
- const matchObj = XEUtils.findTree(tableSourceData, item => rowid === getRowid(this, item), treeOpts)
1094
- row = Object.assign({}, row, { [children]: null })
1095
- if (matchObj) {
1096
- oRow = Object.assign({}, matchObj.item, { [children]: null })
1097
- }
1098
- } else {
1099
- const oRowIndex = fullDataRowIdData[rowid].index
1100
- oRow = tableSourceData[oRowIndex]
1101
- }
1102
- if (oRow) {
1095
+ const oldRest = sourceDataRowIdData[rowid]
1096
+ if (oldRest) {
1097
+ const oRow = oldRest.row
1103
1098
  if (arguments.length > 1) {
1104
1099
  return !eqCellValue(oRow, row, field)
1105
1100
  }
1106
1101
  for (let index = 0, len = tableFullColumn.length; index < len; index++) {
1107
- property = tableFullColumn[index].field
1102
+ const property = tableFullColumn[index].field
1108
1103
  if (property && !eqCellValue(oRow, row, property)) {
1109
1104
  return true
1110
1105
  }
@@ -3807,7 +3802,10 @@ const Methods = {
3807
3802
  if (!remote || (firstSortColumn && firstSortColumn.remoteSort)) {
3808
3803
  this.handleTableData(true)
3809
3804
  }
3810
- return this.$nextTick().then(this.updateStyle)
3805
+ return this.$nextTick().then(() => {
3806
+ this.updateCellAreas()
3807
+ return this.updateStyle()
3808
+ })
3811
3809
  }
3812
3810
  return this.$nextTick()
3813
3811
  },