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.
package/lib/index.umd.js CHANGED
@@ -11042,7 +11042,7 @@ var es_array_concat = __webpack_require__(2222);
11042
11042
 
11043
11043
 
11044
11044
  function getLog(message, params) {
11045
- return "[vxe-table v".concat("3.7.0-beta.2", "] ").concat(conf.i18n(message, params));
11045
+ return "[vxe-table v".concat("3.7.0-beta.3", "] ").concat(conf.i18n(message, params));
11046
11046
  }
11047
11047
  function outLog(type) {
11048
11048
  return function (message, params) {
@@ -12229,7 +12229,7 @@ function _t(key, args) {
12229
12229
  var v = 'v3';
12230
12230
  var VXETable = {
12231
12231
  v: v,
12232
- version: "3.7.0-beta.2",
12232
+ version: "3.7.0-beta.3",
12233
12233
  reg: reg,
12234
12234
  use: use,
12235
12235
  setup: setup,
@@ -15890,7 +15890,7 @@ var Methods = {
15890
15890
  this.tableSynchData = datas;
15891
15891
  // 克隆原数据,用于显示编辑状态,与编辑值做对比
15892
15892
  if (keepSource) {
15893
- this.tableSourceData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(fullData, true);
15893
+ this.cacheSourceMap(fullData);
15894
15894
  }
15895
15895
  if (false) {}
15896
15896
  if (this.clearCellAreas && this.mouseConfig) {
@@ -16069,11 +16069,9 @@ var Methods = {
16069
16069
  tableFullData = this.tableFullData,
16070
16070
  fullDataRowMap = this.fullDataRowMap,
16071
16071
  fullAllDataRowMap = this.fullAllDataRowMap,
16072
- tableFullTreeData = this.tableFullTreeData,
16073
- tableSourceData = this.tableSourceData;
16072
+ tableFullTreeData = this.tableFullTreeData;
16074
16073
  var fullDataRowIdData = this.fullDataRowIdData,
16075
- fullAllDataRowIdData = this.fullAllDataRowIdData,
16076
- sourceDataRowIdData = this.sourceDataRowIdData;
16074
+ fullAllDataRowIdData = this.fullAllDataRowIdData;
16077
16075
  var rowkey = getRowkey(this);
16078
16076
  var isLazy = treeConfig && treeOpts.lazy;
16079
16077
  var handleCache = function handleCache(row, index, items, path, parent, nodes) {
@@ -16110,15 +16108,23 @@ var Methods = {
16110
16108
  fullDataRowMap.clear();
16111
16109
  }
16112
16110
  fullAllDataRowIdData = this.fullAllDataRowIdData = {};
16113
- sourceDataRowIdData = this.sourceDataRowIdData = {};
16114
16111
  fullAllDataRowMap.clear();
16115
16112
  if (treeConfig) {
16116
16113
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableFullTreeData, handleCache, treeOpts);
16117
16114
  } else {
16118
16115
  tableFullData.forEach(handleCache);
16119
16116
  }
16117
+ },
16118
+ cacheSourceMap: function cacheSourceMap(fullData) {
16119
+ var _this11 = this;
16120
+ var treeConfig = this.treeConfig,
16121
+ treeOpts = this.treeOpts,
16122
+ sourceDataRowIdData = this.sourceDataRowIdData;
16123
+ var sourceData = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(fullData, true);
16124
+ var rowkey = getRowkey(this);
16125
+ sourceDataRowIdData = this.sourceDataRowIdData = {};
16120
16126
  var handleSourceRow = function handleSourceRow(row) {
16121
- var rowid = getRowid(_this10, row);
16127
+ var rowid = getRowid(_this11, row);
16122
16128
  if (eqEmptyValue(rowid)) {
16123
16129
  rowid = getRowUniqueId();
16124
16130
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row, rowkey, rowid);
@@ -16130,13 +16136,14 @@ var Methods = {
16130
16136
  };
16131
16137
  // 源数据缓存
16132
16138
  if (treeConfig && !treeOpts.transform) {
16133
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(tableSourceData, handleSourceRow, treeOpts);
16139
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(sourceData, handleSourceRow, treeOpts);
16134
16140
  } else {
16135
- tableSourceData.forEach(handleSourceRow);
16141
+ sourceData.forEach(handleSourceRow);
16136
16142
  }
16143
+ this.tableSourceData = sourceData;
16137
16144
  },
16138
16145
  loadTreeChildren: function loadTreeChildren(row, childRecords) {
16139
- var _this11 = this;
16146
+ var _this12 = this;
16140
16147
  var keepSource = this.keepSource,
16141
16148
  tableSourceData = this.tableSourceData,
16142
16149
  treeOpts = this.treeOpts,
@@ -16151,16 +16158,16 @@ var Methods = {
16151
16158
  var parentLevel = rest ? rest.level : 0;
16152
16159
  return this.createData(childRecords).then(function (rows) {
16153
16160
  if (keepSource) {
16154
- var rowid = getRowid(_this11, row);
16161
+ var rowid = getRowid(_this12, row);
16155
16162
  var matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableSourceData, function (item) {
16156
- return rowid === getRowid(_this11, item);
16163
+ return rowid === getRowid(_this12, item);
16157
16164
  }, treeOpts);
16158
16165
  if (matchObj) {
16159
16166
  matchObj.item[children] = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(rows, true);
16160
16167
  }
16161
16168
  }
16162
16169
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(rows, function (childRow, index, items, path, parent, nodes) {
16163
- var rowid = getRowid(_this11, childRow);
16170
+ var rowid = getRowid(_this12, childRow);
16164
16171
  var rest = {
16165
16172
  row: childRow,
16166
16173
  rowid: rowid,
@@ -16181,7 +16188,7 @@ var Methods = {
16181
16188
  if (transform) {
16182
16189
  row[mapChildren] = rows;
16183
16190
  }
16184
- _this11.updateAfterDataIndex();
16191
+ _this12.updateAfterDataIndex();
16185
16192
  return rows;
16186
16193
  });
16187
16194
  },
@@ -16190,7 +16197,7 @@ var Methods = {
16190
16197
  * 牺牲数据组装的耗时,用来换取使用过程中的流畅
16191
16198
  */
16192
16199
  cacheColumnMap: function cacheColumnMap() {
16193
- var _this12 = this;
16200
+ var _this13 = this;
16194
16201
  var tableFullColumn = this.tableFullColumn,
16195
16202
  collectColumn = this.collectColumn,
16196
16203
  fullColumnMap = this.fullColumnMap,
@@ -16399,7 +16406,7 @@ var Methods = {
16399
16406
  * @param {Row} records 行数据
16400
16407
  */
16401
16408
  defineField: function defineField(records) {
16402
- var _this13 = this;
16409
+ var _this14 = this;
16403
16410
  var radioOpts = this.radioOpts,
16404
16411
  checkboxOpts = this.checkboxOpts,
16405
16412
  treeConfig = this.treeConfig,
@@ -16410,7 +16417,7 @@ var Methods = {
16410
16417
  records = [records || {}];
16411
16418
  }
16412
16419
  return records.map(function (record) {
16413
- _this13.tableFullColumn.forEach(function (column) {
16420
+ _this14.tableFullColumn.forEach(function (column) {
16414
16421
  var field = column.field,
16415
16422
  editRender = column.editRender;
16416
16423
  if (field && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().has(record, field)) {
@@ -16450,9 +16457,9 @@ var Methods = {
16450
16457
  * @param {Array} records 新数据
16451
16458
  */
16452
16459
  createData: function createData(records) {
16453
- var _this14 = this;
16460
+ var _this15 = this;
16454
16461
  return this.$nextTick().then(function () {
16455
- return _this14.defineField(records);
16462
+ return _this15.defineField(records);
16456
16463
  });
16457
16464
  },
16458
16465
  /**
@@ -16477,7 +16484,7 @@ var Methods = {
16477
16484
  * 如果还额外传了 field 则还原指定的单元格数据
16478
16485
  */
16479
16486
  revertData: function revertData(rows, field) {
16480
- var _this15 = this;
16487
+ var _this16 = this;
16481
16488
  var keepSource = this.keepSource,
16482
16489
  tableSourceData = this.tableSourceData,
16483
16490
  treeConfig = this.treeConfig;
@@ -16495,8 +16502,8 @@ var Methods = {
16495
16502
  }
16496
16503
  if (targetRows.length) {
16497
16504
  targetRows.forEach(function (row) {
16498
- if (!_this15.isInsertByRow(row)) {
16499
- var rowIndex = _this15.getRowIndex(row);
16505
+ if (!_this16.isInsertByRow(row)) {
16506
+ var rowIndex = _this16.getRowIndex(row);
16500
16507
  if (treeConfig && rowIndex === -1) {
16501
16508
  errLog('vxe.error.noTree', ['revertData']);
16502
16509
  }
@@ -16570,39 +16577,24 @@ var Methods = {
16570
16577
  * @param {String} field 字段名
16571
16578
  */
16572
16579
  isUpdateByRow: function isUpdateByRow(row, field) {
16573
- var _this16 = this;
16574
16580
  var tableFullColumn = this.tableFullColumn,
16575
16581
  keepSource = this.keepSource,
16576
- treeConfig = this.treeConfig,
16577
- treeOpts = this.treeOpts,
16578
- tableSourceData = this.tableSourceData,
16582
+ sourceDataRowIdData = this.sourceDataRowIdData,
16579
16583
  fullDataRowIdData = this.fullDataRowIdData;
16580
16584
  if (keepSource) {
16581
- var oRow, property;
16582
16585
  var rowid = getRowid(this, row);
16583
16586
  // 新增的数据不需要检测
16584
16587
  if (!fullDataRowIdData[rowid]) {
16585
16588
  return false;
16586
16589
  }
16587
- if (treeConfig) {
16588
- var children = treeOpts.children;
16589
- var matchObj = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(tableSourceData, function (item) {
16590
- return rowid === getRowid(_this16, item);
16591
- }, treeOpts);
16592
- row = Object.assign({}, row, _defineProperty({}, children, null));
16593
- if (matchObj) {
16594
- oRow = Object.assign({}, matchObj.item, _defineProperty({}, children, null));
16595
- }
16596
- } else {
16597
- var oRowIndex = fullDataRowIdData[rowid].index;
16598
- oRow = tableSourceData[oRowIndex];
16599
- }
16600
- if (oRow) {
16590
+ var oldRest = sourceDataRowIdData[rowid];
16591
+ if (oldRest) {
16592
+ var oRow = oldRest.row;
16601
16593
  if (arguments.length > 1) {
16602
16594
  return !eqCellValue(oRow, row, field);
16603
16595
  }
16604
16596
  for (var index = 0, len = tableFullColumn.length; index < len; index++) {
16605
- property = tableFullColumn[index].field;
16597
+ var property = tableFullColumn[index].field;
16606
16598
  if (property && !eqCellValue(oRow, row, property)) {
16607
16599
  return true;
16608
16600
  }
@@ -19868,7 +19860,10 @@ var Methods = {
19868
19860
  if (!remote || firstSortColumn && firstSortColumn.remoteSort) {
19869
19861
  this.handleTableData(true);
19870
19862
  }
19871
- return this.$nextTick().then(this.updateStyle);
19863
+ return this.$nextTick().then(function () {
19864
+ _this41.updateCellAreas();
19865
+ return _this41.updateStyle();
19866
+ });
19872
19867
  }
19873
19868
  return this.$nextTick();
19874
19869
  },