vxe-table 3.7.0-beta.1 → 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) {
@@ -625,6 +625,30 @@ const Methods = {
625
625
  tableFullData.forEach(handleCache)
626
626
  }
627
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 = {}
633
+ const handleSourceRow = (row) => {
634
+ let rowid = getRowid(this, row)
635
+ if (eqEmptyValue(rowid)) {
636
+ rowid = getRowUniqueId()
637
+ XEUtils.set(row, rowkey, rowid)
638
+ }
639
+ sourceDataRowIdData[rowid] = {
640
+ row,
641
+ rowid
642
+ }
643
+ }
644
+ // 源数据缓存
645
+ if (treeConfig && !treeOpts.transform) {
646
+ XEUtils.eachTree(sourceData, handleSourceRow, treeOpts)
647
+ } else {
648
+ sourceData.forEach(handleSourceRow)
649
+ }
650
+ this.tableSourceData = sourceData
651
+ },
628
652
  loadTreeChildren (row, childRecords) {
629
653
  const { keepSource, tableSourceData, treeOpts, fullDataRowIdData, fullDataRowMap, fullAllDataRowMap, fullAllDataRowIdData } = this
630
654
  const { transform, children, mapChildren } = treeOpts
@@ -1061,31 +1085,21 @@ const Methods = {
1061
1085
  * @param {String} field 字段名
1062
1086
  */
1063
1087
  isUpdateByRow (row, field) {
1064
- const { tableFullColumn, keepSource, treeConfig, treeOpts, tableSourceData, fullDataRowIdData } = this
1088
+ const { tableFullColumn, keepSource, sourceDataRowIdData, fullDataRowIdData } = this
1065
1089
  if (keepSource) {
1066
- let oRow, property
1067
1090
  const rowid = getRowid(this, row)
1068
1091
  // 新增的数据不需要检测
1069
1092
  if (!fullDataRowIdData[rowid]) {
1070
1093
  return false
1071
1094
  }
1072
- if (treeConfig) {
1073
- const children = treeOpts.children
1074
- const matchObj = XEUtils.findTree(tableSourceData, item => rowid === getRowid(this, item), treeOpts)
1075
- row = Object.assign({}, row, { [children]: null })
1076
- if (matchObj) {
1077
- oRow = Object.assign({}, matchObj.item, { [children]: null })
1078
- }
1079
- } else {
1080
- const oRowIndex = fullDataRowIdData[rowid].index
1081
- oRow = tableSourceData[oRowIndex]
1082
- }
1083
- if (oRow) {
1095
+ const oldRest = sourceDataRowIdData[rowid]
1096
+ if (oldRest) {
1097
+ const oRow = oldRest.row
1084
1098
  if (arguments.length > 1) {
1085
1099
  return !eqCellValue(oRow, row, field)
1086
1100
  }
1087
1101
  for (let index = 0, len = tableFullColumn.length; index < len; index++) {
1088
- property = tableFullColumn[index].field
1102
+ const property = tableFullColumn[index].field
1089
1103
  if (property && !eqCellValue(oRow, row, property)) {
1090
1104
  return true
1091
1105
  }
@@ -1460,7 +1474,7 @@ const Methods = {
1460
1474
  */
1461
1475
  showColumn (fieldOrColumn) {
1462
1476
  const column = handleFieldOrColumn(this, fieldOrColumn)
1463
- if (column & !column.visible) {
1477
+ if (column && column.visible) {
1464
1478
  column.visible = true
1465
1479
  return this.handleCustom()
1466
1480
  }
@@ -3788,7 +3802,10 @@ const Methods = {
3788
3802
  if (!remote || (firstSortColumn && firstSortColumn.remoteSort)) {
3789
3803
  this.handleTableData(true)
3790
3804
  }
3791
- return this.$nextTick().then(this.updateStyle)
3805
+ return this.$nextTick().then(() => {
3806
+ this.updateCellAreas()
3807
+ return this.updateStyle()
3808
+ })
3792
3809
  }
3793
3810
  return this.$nextTick()
3794
3811
  },
package/types/export.d.ts CHANGED
@@ -231,6 +231,7 @@ export interface ColumnExportCellRenderParams extends GridRenderParams {
231
231
 
232
232
  export interface ColumnExportHeaderRenderParams extends GridRenderParams {
233
233
  column: ColumnInfo;
234
+ options: ExportParams;
234
235
  }
235
236
 
236
237
  export interface ColumnExportFooterRenderParams extends GridRenderParams {
package/types/table.d.ts CHANGED
@@ -1250,6 +1250,7 @@ export interface TableColumnConfig {
1250
1250
  width?: number
1251
1251
  minWidth?: number
1252
1252
  maxWidth?: number
1253
+ headerExportMethod?(params: any): string | number
1253
1254
  }
1254
1255
  export type ColumnDefaultConfig = TableColumnConfig
1255
1256