vxe-table 3.7.0-beta.11 → 3.7.0-beta.13

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.
Files changed (53) hide show
  1. package/lib/edit/src/mixin.js +257 -207
  2. package/lib/edit/src/mixin.min.js +1 -1
  3. package/lib/icon/style/style.css +1 -1
  4. package/lib/icon/style/style.min.css +1 -1
  5. package/lib/index.css +1 -1
  6. package/lib/index.umd.js +312 -234
  7. package/lib/index.umd.min.js +1 -1
  8. package/lib/style.css +1 -1
  9. package/lib/style.min.css +1 -1
  10. package/lib/table/src/body.js +5 -5
  11. package/lib/table/src/body.min.js +1 -1
  12. package/lib/table/src/cell.js +12 -12
  13. package/lib/table/src/cell.min.js +1 -1
  14. package/lib/table/src/methods.js +41 -14
  15. package/lib/table/src/methods.min.js +1 -1
  16. package/lib/table/src/table.js +6 -0
  17. package/lib/table/src/table.min.js +1 -1
  18. package/lib/table/src/util.js +1 -1
  19. package/lib/table/src/util.min.js +1 -1
  20. package/lib/tools/log.js +1 -1
  21. package/lib/tools/log.min.js +1 -1
  22. package/lib/v-x-e-table/index.js +1 -1
  23. package/lib/v-x-e-table/index.min.js +1 -1
  24. package/lib/v-x-e-table/src/commands.js +1 -1
  25. package/lib/v-x-e-table/src/commands.min.js +1 -1
  26. package/lib/v-x-e-table/src/conf.js +2 -2
  27. package/lib/v-x-e-table/src/conf.min.js +1 -1
  28. package/lib/v-x-e-table/src/formats.js +1 -1
  29. package/lib/v-x-e-table/src/formats.min.js +1 -1
  30. package/lib/v-x-e-table/src/menus.js +1 -1
  31. package/lib/v-x-e-table/src/menus.min.js +1 -1
  32. package/lib/v-x-e-table/src/renderer.js +4 -4
  33. package/lib/v-x-e-table/src/renderer.min.js +1 -1
  34. package/package.json +3 -3
  35. package/packages/edit/src/mixin.js +174 -134
  36. package/packages/table/src/body.js +5 -5
  37. package/packages/table/src/cell.js +8 -7
  38. package/packages/table/src/methods.js +39 -10
  39. package/packages/table/src/table.js +6 -0
  40. package/packages/table/src/util.js +1 -1
  41. package/packages/v-x-e-table/src/commands.js +1 -1
  42. package/packages/v-x-e-table/src/conf.js +2 -2
  43. package/packages/v-x-e-table/src/formats.js +1 -1
  44. package/packages/v-x-e-table/src/menus.js +1 -1
  45. package/packages/v-x-e-table/src/renderer.js +4 -4
  46. package/types/table.d.ts +16 -1
  47. package/types/v-x-e-table/index.d.ts +1 -1
  48. /package/lib/icon/style/{iconfont.1691021948915.ttf → iconfont.1692439110338.ttf} +0 -0
  49. /package/lib/icon/style/{iconfont.1691021948915.woff → iconfont.1692439110338.woff} +0 -0
  50. /package/lib/icon/style/{iconfont.1691021948915.woff2 → iconfont.1692439110338.woff2} +0 -0
  51. /package/lib/{iconfont.1691021948915.ttf → iconfont.1692439110338.ttf} +0 -0
  52. /package/lib/{iconfont.1691021948915.woff → iconfont.1692439110338.woff} +0 -0
  53. /package/lib/{iconfont.1691021948915.woff2 → iconfont.1692439110338.woff2} +0 -0
@@ -16,13 +16,13 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
17
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
18
18
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
19
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
20
19
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
21
20
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
22
21
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
23
22
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
24
23
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
25
24
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
25
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
26
26
  function insertTreeRow(_vm, newRecords, isAppend) {
27
27
  var tableFullTreeData = _vm.tableFullTreeData,
28
28
  afterFullData = _vm.afterFullData,
@@ -47,10 +47,15 @@ function insertTreeRow(_vm, newRecords, isAppend) {
47
47
  var parentRest = fullAllDataRowIdData[(0, _util.getRowid)(_vm, parentRow)];
48
48
  var parentLevel = parentRest ? parentRest.level : 0;
49
49
  var parentChilds = parentRow[childrenField];
50
+ var mapChilds = parentRow[mapChildrenField];
50
51
  if (!_xeUtils["default"].isArray(parentChilds)) {
51
52
  parentChilds = parentRow[childrenField] = [];
52
53
  }
54
+ if (!_xeUtils["default"].isArray(mapChilds)) {
55
+ mapChilds = parentRow[childrenField] = [];
56
+ }
53
57
  parentChilds[funcName](item);
58
+ mapChilds[funcName](item);
54
59
  var rest = {
55
60
  row: item,
56
61
  rowid: rowid,
@@ -88,6 +93,189 @@ function insertTreeRow(_vm, newRecords, isAppend) {
88
93
  }
89
94
  });
90
95
  }
96
+ function handleInsertRowAt(_vm, records, row, isInsertNextRow) {
97
+ var tableFullTreeData = _vm.tableFullTreeData,
98
+ mergeList = _vm.mergeList,
99
+ afterFullData = _vm.afterFullData,
100
+ editStore = _vm.editStore,
101
+ tableFullData = _vm.tableFullData,
102
+ treeConfig = _vm.treeConfig,
103
+ fullDataRowIdData = _vm.fullDataRowIdData,
104
+ fullAllDataRowIdData = _vm.fullAllDataRowIdData,
105
+ treeOpts = _vm.treeOpts;
106
+ var transform = treeOpts.transform,
107
+ rowField = treeOpts.rowField,
108
+ mapChildrenField = treeOpts.mapChildrenField;
109
+ var childrenField = treeOpts.children || treeOpts.childrenField;
110
+ if (!_xeUtils["default"].isArray(records)) {
111
+ records = [records];
112
+ }
113
+ var newRecords = _vm.defineField(records.map(function (record) {
114
+ var _ref;
115
+ return Object.assign(treeConfig && transform ? (_ref = {}, _defineProperty(_ref, mapChildrenField, []), _defineProperty(_ref, childrenField, []), _ref) : {}, record);
116
+ }));
117
+ if (!row) {
118
+ // 如果为虚拟树
119
+ if (treeConfig && transform) {
120
+ insertTreeRow(_vm, newRecords, false);
121
+ } else {
122
+ afterFullData.unshift.apply(afterFullData, _toConsumableArray(newRecords));
123
+ tableFullData.unshift.apply(tableFullData, _toConsumableArray(newRecords));
124
+ // 刷新单元格合并
125
+ mergeList.forEach(function (mergeItem) {
126
+ var mergeRowIndex = mergeItem.row;
127
+ if (mergeRowIndex > 0) {
128
+ mergeItem.row = mergeRowIndex + newRecords.length;
129
+ }
130
+ });
131
+ }
132
+ } else {
133
+ if (row === -1) {
134
+ // 如果为虚拟树
135
+ if (treeConfig && transform) {
136
+ insertTreeRow(_vm, newRecords, true);
137
+ } else {
138
+ afterFullData.push.apply(afterFullData, _toConsumableArray(newRecords));
139
+ tableFullData.push.apply(tableFullData, _toConsumableArray(newRecords));
140
+ // 刷新单元格合并
141
+ mergeList.forEach(function (mergeItem) {
142
+ var mergeRowIndex = mergeItem.row,
143
+ mergeRowspan = mergeItem.rowspan;
144
+ if (mergeRowIndex + mergeRowspan > afterFullData.length) {
145
+ mergeItem.rowspan = mergeRowspan + newRecords.length;
146
+ }
147
+ });
148
+ }
149
+ } else {
150
+ // 如果为虚拟树
151
+ if (treeConfig && transform) {
152
+ var matchMapObj = _xeUtils["default"].findTree(tableFullTreeData, function (item) {
153
+ return row[rowField] === item[rowField];
154
+ }, {
155
+ children: mapChildrenField
156
+ });
157
+ if (matchMapObj) {
158
+ var parentRow = matchMapObj.parent;
159
+ var parentMapChilds = parentRow ? parentRow[mapChildrenField] : tableFullTreeData;
160
+ var parentRest = fullAllDataRowIdData[(0, _util.getRowid)(_vm, parentRow)];
161
+ var parentLevel = parentRest ? parentRest.level : 0;
162
+ newRecords.forEach(function (item, i) {
163
+ var rowid = (0, _util.getRowid)(_vm, item);
164
+ if (process.env.NODE_ENV === 'development') {
165
+ if (item[treeOpts.parentField]) {
166
+ if (parentRow && item[treeOpts.parentField] !== parentRow[rowField]) {
167
+ (0, _log.errLog)('vxe.error.errProp', ["".concat(treeOpts.parentField, "=").concat(item[treeOpts.parentField]), "".concat(treeOpts.parentField, "=").concat(parentRow[rowField])]);
168
+ }
169
+ }
170
+ }
171
+ if (parentRow) {
172
+ item[treeOpts.parentField] = parentRow[rowField];
173
+ }
174
+ var targetIndex = matchMapObj.index + i;
175
+ if (isInsertNextRow) {
176
+ targetIndex = targetIndex + 1;
177
+ }
178
+ parentMapChilds.splice(targetIndex, 0, item);
179
+ var rest = {
180
+ row: item,
181
+ rowid: rowid,
182
+ seq: -1,
183
+ index: -1,
184
+ _index: -1,
185
+ $index: -1,
186
+ items: parentMapChilds,
187
+ parent: parentRow,
188
+ level: parentLevel + 1
189
+ };
190
+ fullDataRowIdData[rowid] = rest;
191
+ fullAllDataRowIdData[rowid] = rest;
192
+ });
193
+
194
+ // 源
195
+ if (parentRow) {
196
+ var matchObj = _xeUtils["default"].findTree(tableFullTreeData, function (item) {
197
+ return row[rowField] === item[rowField];
198
+ }, {
199
+ children: childrenField
200
+ });
201
+ if (matchObj) {
202
+ var parentChilds = matchObj.items;
203
+ var targetIndex = matchObj.index;
204
+ if (isInsertNextRow) {
205
+ targetIndex = targetIndex + 1;
206
+ }
207
+ parentChilds.splice.apply(parentChilds, [targetIndex, 0].concat(_toConsumableArray(newRecords)));
208
+ }
209
+ }
210
+ } else {
211
+ if (process.env.NODE_ENV === 'development') {
212
+ (0, _log.warnLog)('vxe.error.unableInsert');
213
+ }
214
+ insertTreeRow(_vm, newRecords, true);
215
+ }
216
+ } else {
217
+ if (treeConfig) {
218
+ throw new Error((0, _log.getLog)('vxe.error.noTree', ['insert']));
219
+ }
220
+ var afIndex = -1;
221
+ // 如果是可视索引
222
+ if (_xeUtils["default"].isNumber(row)) {
223
+ if (row < afterFullData.length) {
224
+ afIndex = row;
225
+ }
226
+ } else {
227
+ afIndex = _vm.findRowIndexOf(afterFullData, row);
228
+ }
229
+ // 如果是插入指定行的下一行
230
+ if (isInsertNextRow) {
231
+ afIndex = Math.max(afterFullData.length, afIndex + 1);
232
+ }
233
+ if (afIndex === -1) {
234
+ throw new Error((0, _log.errLog)('vxe.error.unableInsert'));
235
+ }
236
+ afterFullData.splice.apply(afterFullData, [afIndex, 0].concat(_toConsumableArray(newRecords)));
237
+ tableFullData.splice.apply(tableFullData, [_vm.findRowIndexOf(tableFullData, row), 0].concat(_toConsumableArray(newRecords)));
238
+ // 刷新单元格合并
239
+ mergeList.forEach(function (mergeItem) {
240
+ var mergeRowIndex = mergeItem.row,
241
+ mergeRowspan = mergeItem.rowspan;
242
+ if (mergeRowIndex > afIndex) {
243
+ mergeItem.row = mergeRowIndex + newRecords.length;
244
+ } else if (mergeRowIndex + mergeRowspan > afIndex) {
245
+ mergeItem.rowspan = mergeRowspan + newRecords.length;
246
+ }
247
+ });
248
+ }
249
+ }
250
+ }
251
+ var insertList = editStore.insertList,
252
+ insertMaps = editStore.insertMaps;
253
+ newRecords.forEach(function (newRow) {
254
+ var rowid = (0, _util.getRowid)(_vm, newRow);
255
+ insertMaps[rowid] = newRow;
256
+ });
257
+ insertList.unshift.apply(insertList, _toConsumableArray(newRecords));
258
+ _vm.cacheRowMap();
259
+ _vm.updateScrollYStatus();
260
+ _vm.handleTableData(treeConfig && transform);
261
+ if (!(treeConfig && transform)) {
262
+ _vm.updateAfterDataIndex();
263
+ }
264
+ _vm.updateFooter();
265
+ _vm.checkSelectionStatus();
266
+ if (_vm.scrollYLoad) {
267
+ _vm.updateScrollYSpace();
268
+ }
269
+ return _vm.$nextTick().then(function () {
270
+ _vm.updateCellAreas();
271
+ return _vm.recalculate();
272
+ }).then(function () {
273
+ return {
274
+ row: newRecords.length ? newRecords[newRecords.length - 1] : null,
275
+ rows: newRecords
276
+ };
277
+ });
278
+ }
91
279
  var _default = {
92
280
  methods: {
93
281
  /**
@@ -96,7 +284,7 @@ var _default = {
96
284
  * @param {*} records
97
285
  */
98
286
  _insert: function _insert(records) {
99
- return this.insertAt(records);
287
+ return handleInsertRowAt(this, records, null);
100
288
  },
101
289
  /**
102
290
  * 往表格指定行中插入临时数据
@@ -105,163 +293,13 @@ var _default = {
105
293
  * 如果 row 为有效行则插入到该行的位置
106
294
  * @param {Object/Array} records 新的数据
107
295
  * @param {Row} row 指定行
296
+ * @returns
108
297
  */
109
298
  _insertAt: function _insertAt(records, row) {
110
- var _this = this;
111
- var tableFullTreeData = this.tableFullTreeData,
112
- mergeList = this.mergeList,
113
- afterFullData = this.afterFullData,
114
- editStore = this.editStore,
115
- tableFullData = this.tableFullData,
116
- treeConfig = this.treeConfig,
117
- fullDataRowIdData = this.fullDataRowIdData,
118
- fullAllDataRowIdData = this.fullAllDataRowIdData,
119
- treeOpts = this.treeOpts;
120
- var transform = treeOpts.transform,
121
- rowField = treeOpts.rowField,
122
- mapChildrenField = treeOpts.mapChildrenField;
123
- if (!_xeUtils["default"].isArray(records)) {
124
- records = [records];
125
- }
126
- var newRecords = this.defineField(records.map(function (record) {
127
- return Object.assign({}, record);
128
- }));
129
- if (!row) {
130
- // 如果为虚拟树
131
- if (treeConfig && transform) {
132
- insertTreeRow(this, newRecords, false);
133
- } else {
134
- afterFullData.unshift.apply(afterFullData, _toConsumableArray(newRecords));
135
- tableFullData.unshift.apply(tableFullData, _toConsumableArray(newRecords));
136
- // 刷新单元格合并
137
- mergeList.forEach(function (mergeItem) {
138
- var mergeRowIndex = mergeItem.row;
139
- if (mergeRowIndex > 0) {
140
- mergeItem.row = mergeRowIndex + newRecords.length;
141
- }
142
- });
143
- }
144
- } else {
145
- if (row === -1) {
146
- // 如果为虚拟树
147
- if (treeConfig && transform) {
148
- insertTreeRow(this, newRecords, true);
149
- } else {
150
- afterFullData.push.apply(afterFullData, _toConsumableArray(newRecords));
151
- tableFullData.push.apply(tableFullData, _toConsumableArray(newRecords));
152
- // 刷新单元格合并
153
- mergeList.forEach(function (mergeItem) {
154
- var mergeRowIndex = mergeItem.row,
155
- mergeRowspan = mergeItem.rowspan;
156
- if (mergeRowIndex + mergeRowspan > afterFullData.length) {
157
- mergeItem.rowspan = mergeRowspan + newRecords.length;
158
- }
159
- });
160
- }
161
- } else {
162
- // 如果为虚拟树
163
- if (treeConfig && transform) {
164
- var matchObj = _xeUtils["default"].findTree(tableFullTreeData, function (item) {
165
- return row[rowField] === item[rowField];
166
- }, {
167
- children: mapChildrenField
168
- });
169
- if (matchObj) {
170
- var parentRow = matchObj.parent;
171
- var parentChilds = matchObj.items;
172
- var parentRest = fullAllDataRowIdData[(0, _util.getRowid)(this, parentRow)];
173
- var parentLevel = parentRest ? parentRest.level : 0;
174
- newRecords.forEach(function (item, i) {
175
- var rowid = (0, _util.getRowid)(_this, item);
176
- if (process.env.NODE_ENV === 'development') {
177
- if (item[treeOpts.parentField]) {
178
- if (parentRow && item[treeOpts.parentField] !== parentRow[rowField]) {
179
- (0, _log.errLog)('vxe.error.errProp', ["".concat(treeOpts.parentField, "=").concat(item[treeOpts.parentField]), "".concat(treeOpts.parentField, "=").concat(parentRow[rowField])]);
180
- }
181
- }
182
- }
183
- if (parentRow) {
184
- item[treeOpts.parentField] = parentRow[rowField];
185
- }
186
- parentChilds.splice(matchObj.index + i, 0, item);
187
- var rest = {
188
- row: item,
189
- rowid: rowid,
190
- seq: -1,
191
- index: -1,
192
- _index: -1,
193
- $index: -1,
194
- items: parentChilds,
195
- parent: parentRow,
196
- level: parentLevel + 1
197
- };
198
- fullDataRowIdData[rowid] = rest;
199
- fullAllDataRowIdData[rowid] = rest;
200
- });
201
- } else {
202
- if (process.env.NODE_ENV === 'development') {
203
- (0, _log.warnLog)('vxe.error.unableInsert');
204
- }
205
- insertTreeRow(this, newRecords, true);
206
- }
207
- } else {
208
- if (treeConfig) {
209
- throw new Error((0, _log.getLog)('vxe.error.noTree', ['insert']));
210
- }
211
- var afIndex = -1;
212
- // 如果是可视索引
213
- if (_xeUtils["default"].isNumber(row)) {
214
- if (row < afterFullData.length) {
215
- afIndex = row;
216
- }
217
- } else {
218
- afIndex = this.findRowIndexOf(afterFullData, row);
219
- }
220
- if (afIndex === -1) {
221
- throw new Error((0, _log.errLog)('vxe.error.unableInsert'));
222
- }
223
- afterFullData.splice.apply(afterFullData, [afIndex, 0].concat(_toConsumableArray(newRecords)));
224
- tableFullData.splice.apply(tableFullData, [this.findRowIndexOf(tableFullData, row), 0].concat(_toConsumableArray(newRecords)));
225
- // 刷新单元格合并
226
- mergeList.forEach(function (mergeItem) {
227
- var mergeRowIndex = mergeItem.row,
228
- mergeRowspan = mergeItem.rowspan;
229
- if (mergeRowIndex > afIndex) {
230
- mergeItem.row = mergeRowIndex + newRecords.length;
231
- } else if (mergeRowIndex + mergeRowspan > afIndex) {
232
- mergeItem.rowspan = mergeRowspan + newRecords.length;
233
- }
234
- });
235
- }
236
- }
237
- }
238
- var insertList = editStore.insertList,
239
- insertMaps = editStore.insertMaps;
240
- newRecords.forEach(function (newRow) {
241
- var rowid = (0, _util.getRowid)(_this, newRow);
242
- insertMaps[rowid] = newRow;
243
- });
244
- insertList.unshift.apply(insertList, _toConsumableArray(newRecords));
245
- this.cacheRowMap();
246
- this.updateScrollYStatus();
247
- this.handleTableData(treeConfig && transform);
248
- if (!(treeConfig && transform)) {
249
- this.updateAfterDataIndex();
250
- }
251
- this.updateFooter();
252
- this.checkSelectionStatus();
253
- if (this.scrollYLoad) {
254
- this.updateScrollYSpace();
255
- }
256
- return this.$nextTick().then(function () {
257
- _this.updateCellAreas();
258
- return _this.recalculate();
259
- }).then(function () {
260
- return {
261
- row: newRecords.length ? newRecords[newRecords.length - 1] : null,
262
- rows: newRecords
263
- };
264
- });
299
+ return handleInsertRowAt(this, records, row);
300
+ },
301
+ _insertNextAt: function _insertNextAt(records, row) {
302
+ return handleInsertRowAt(this, records, row, true);
265
303
  },
266
304
  /**
267
305
  * 删除指定行数据
@@ -270,7 +308,7 @@ var _default = {
270
308
  * 如果为空则删除所有
271
309
  */
272
310
  _remove: function _remove(rows) {
273
- var _this2 = this;
311
+ var _this = this;
274
312
  var afterFullData = this.afterFullData,
275
313
  tableFullData = this.tableFullData,
276
314
  tableFullTreeData = this.tableFullTreeData,
@@ -281,13 +319,15 @@ var _default = {
281
319
  selectCheckboxRows = this.selectCheckboxRows,
282
320
  isInsertByRow = this.isInsertByRow,
283
321
  treeOpts = this.treeOpts;
284
- var transform = treeOpts.transform;
322
+ var transform = treeOpts.transform,
323
+ mapChildrenField = treeOpts.mapChildrenField;
324
+ var childrenField = treeOpts.children || treeOpts.childrenField;
285
325
  var actived = editStore.actived,
286
326
  removeList = editStore.removeList,
287
327
  insertList = editStore.insertList,
288
328
  insertMaps = editStore.insertMaps;
289
329
  var checkField = checkboxOpts.checkField;
290
- var rest = [];
330
+ var delList = [];
291
331
  if (!rows) {
292
332
  rows = tableFullData;
293
333
  } else if (!_xeUtils["default"].isArray(rows)) {
@@ -302,7 +342,7 @@ var _default = {
302
342
  // 如果绑定了多选属性,则更新状态
303
343
  if (!checkField) {
304
344
  rows.forEach(function (row) {
305
- var sIndex = _this2.findRowIndexOf(selectCheckboxRows, row);
345
+ var sIndex = _this.findRowIndexOf(selectCheckboxRows, row);
306
346
  if (sIndex > -1) {
307
347
  selectCheckboxRows.splice(sIndex, 1);
308
348
  }
@@ -310,7 +350,7 @@ var _default = {
310
350
  }
311
351
  // 从数据源中移除
312
352
  if (tableFullData === rows) {
313
- rows = rest = tableFullData.slice(0);
353
+ rows = delList = tableFullData.slice(0);
314
354
  this.tableFullData = [];
315
355
  this.afterFullData = [];
316
356
  this.clearMergeCells();
@@ -318,27 +358,37 @@ var _default = {
318
358
  // 如果为虚拟树
319
359
  if (treeConfig && transform) {
320
360
  rows.forEach(function (row) {
321
- var rowid = (0, _util.getRowid)(_this2, row);
361
+ var rowid = (0, _util.getRowid)(_this, row);
362
+ var matchMapObj = _xeUtils["default"].findTree(tableFullTreeData, function (item) {
363
+ return rowid === (0, _util.getRowid)(_this, item);
364
+ }, {
365
+ children: mapChildrenField
366
+ });
367
+ if (matchMapObj) {
368
+ var rItems = matchMapObj.items.splice(matchMapObj.index, 1);
369
+ delList.push(rItems[0]);
370
+ }
322
371
  var matchObj = _xeUtils["default"].findTree(tableFullTreeData, function (item) {
323
- return rowid === (0, _util.getRowid)(_this2, item);
324
- }, treeOpts);
372
+ return rowid === (0, _util.getRowid)(_this, item);
373
+ }, {
374
+ children: childrenField
375
+ });
325
376
  if (matchObj) {
326
- var rItems = matchObj.items.splice(matchObj.index, 1);
327
- rest.push(rItems[0]);
377
+ matchObj.items.splice(matchObj.index, 1);
328
378
  }
329
- var afIndex = _this2.findRowIndexOf(afterFullData, row);
379
+ var afIndex = _this.findRowIndexOf(afterFullData, row);
330
380
  if (afIndex > -1) {
331
381
  afterFullData.splice(afIndex, 1);
332
382
  }
333
383
  });
334
384
  } else {
335
385
  rows.forEach(function (row) {
336
- var tfIndex = _this2.findRowIndexOf(tableFullData, row);
386
+ var tfIndex = _this.findRowIndexOf(tableFullData, row);
337
387
  if (tfIndex > -1) {
338
388
  var rItems = tableFullData.splice(tfIndex, 1);
339
- rest.push(rItems[0]);
389
+ delList.push(rItems[0]);
340
390
  }
341
- var afIndex = _this2.findRowIndexOf(afterFullData, row);
391
+ var afIndex = _this.findRowIndexOf(afterFullData, row);
342
392
  if (afIndex > -1) {
343
393
  // 刷新单元格合并
344
394
  mergeList.forEach(function (mergeItem) {
@@ -361,8 +411,8 @@ var _default = {
361
411
  }
362
412
  // 从新增中移除已删除的数据
363
413
  rows.forEach(function (row) {
364
- var rowid = (0, _util.getRowid)(_this2, row);
365
- var iIndex = _this2.findRowIndexOf(insertList, row);
414
+ var rowid = (0, _util.getRowid)(_this, row);
415
+ var iIndex = _this.findRowIndexOf(insertList, row);
366
416
  if (iIndex > -1) {
367
417
  insertList.splice(iIndex, 1);
368
418
  }
@@ -379,12 +429,12 @@ var _default = {
379
429
  this.updateScrollYSpace();
380
430
  }
381
431
  return this.$nextTick().then(function () {
382
- _this2.updateCellAreas();
383
- return _this2.recalculate();
432
+ _this.updateCellAreas();
433
+ return _this.recalculate();
384
434
  }).then(function () {
385
435
  return {
386
- row: rest.length ? rest[rest.length - 1] : null,
387
- rows: rest
436
+ row: delList.length ? delList[delList.length - 1] : null,
437
+ rows: delList
388
438
  };
389
439
  });
390
440
  },
@@ -392,9 +442,9 @@ var _default = {
392
442
  * 删除复选框选中的数据
393
443
  */
394
444
  _removeCheckboxRow: function _removeCheckboxRow() {
395
- var _this3 = this;
445
+ var _this2 = this;
396
446
  return this.remove(this.getCheckboxRecords()).then(function (params) {
397
- _this3.clearCheckboxRow();
447
+ _this2.clearCheckboxRow();
398
448
  return params;
399
449
  });
400
450
  },
@@ -402,10 +452,10 @@ var _default = {
402
452
  * 删除单选框选中的数据
403
453
  */
404
454
  _removeRadioRow: function _removeRadioRow() {
405
- var _this4 = this;
455
+ var _this3 = this;
406
456
  var radioRecord = this.getRadioRecord();
407
457
  return this.remove(radioRecord || []).then(function (params) {
408
- _this4.clearRadioRow();
458
+ _this3.clearRadioRow();
409
459
  return params;
410
460
  });
411
461
  },
@@ -413,10 +463,10 @@ var _default = {
413
463
  * 删除当前行选中的数据
414
464
  */
415
465
  _removeCurrentRow: function _removeCurrentRow() {
416
- var _this5 = this;
466
+ var _this4 = this;
417
467
  var currentRecord = this.getCurrentRecord();
418
468
  return this.remove(currentRecord || []).then(function (params) {
419
- _this5.clearCurrentRow();
469
+ _this4.clearCurrentRow();
420
470
  return params;
421
471
  });
422
472
  },
@@ -434,12 +484,12 @@ var _default = {
434
484
  * 获取新增的临时数据
435
485
  */
436
486
  _getInsertRecords: function _getInsertRecords() {
437
- var _this6 = this;
487
+ var _this5 = this;
438
488
  var fullAllDataRowIdData = this.fullAllDataRowIdData;
439
489
  var insertList = this.editStore.insertList;
440
490
  var insertRecords = [];
441
491
  insertList.forEach(function (row) {
442
- var rowid = (0, _util.getRowid)(_this6, row);
492
+ var rowid = (0, _util.getRowid)(_this5, row);
443
493
  if (fullAllDataRowIdData[rowid]) {
444
494
  insertRecords.push(row);
445
495
  }
@@ -486,7 +536,7 @@ var _default = {
486
536
  * 处理激活编辑
487
537
  */
488
538
  handleActived: function handleActived(params, evnt) {
489
- var _this7 = this;
539
+ var _this6 = this;
490
540
  var editStore = this.editStore,
491
541
  editOpts = this.editOpts,
492
542
  tableColumn = this.tableColumn,
@@ -522,13 +572,13 @@ var _default = {
522
572
  actived.column = column;
523
573
  if (mode === 'row') {
524
574
  tableColumn.forEach(function (column) {
525
- return _this7._getColumnModel(row, column);
575
+ return _this6._getColumnModel(row, column);
526
576
  });
527
577
  } else {
528
578
  this._getColumnModel(row, column);
529
579
  }
530
580
  this.$nextTick(function () {
531
- _this7.handleFocus(params, evnt);
581
+ _this6.handleFocus(params, evnt);
532
582
  });
533
583
  }
534
584
  this.emitEvent(type, {
@@ -557,7 +607,7 @@ var _default = {
557
607
  actived.args = params;
558
608
  actived.column = column;
559
609
  setTimeout(function () {
560
- _this7.handleFocus(params, evnt);
610
+ _this6.handleFocus(params, evnt);
561
611
  });
562
612
  }
563
613
  this.focus();
@@ -582,7 +632,7 @@ var _default = {
582
632
  }
583
633
  },
584
634
  _syncActivedCell: function _syncActivedCell() {
585
- var _this8 = this;
635
+ var _this7 = this;
586
636
  var tableColumn = this.tableColumn,
587
637
  editStore = this.editStore,
588
638
  editOpts = this.editOpts;
@@ -592,7 +642,7 @@ var _default = {
592
642
  if (row || column) {
593
643
  if (editOpts.mode === 'row') {
594
644
  tableColumn.forEach(function (column) {
595
- return _this8._setColumnModel(row, column);
645
+ return _this7._setColumnModel(row, column);
596
646
  });
597
647
  } else {
598
648
  this._setColumnModel(row, column);
@@ -735,22 +785,22 @@ var _default = {
735
785
  * 激活单元格编辑
736
786
  */
737
787
  _setEditCell: function _setEditCell(row, fieldOrColumn) {
738
- var _this9 = this;
788
+ var _this8 = this;
739
789
  var editConfig = this.editConfig;
740
790
  var column = _xeUtils["default"].isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn;
741
791
  if (row && column && (0, _utils.isEnableConf)(editConfig) && (0, _utils.isEnableConf)(column.editRender)) {
742
792
  return this.scrollToRow(row, true).then(function () {
743
- var cell = _this9.getCell(row, column);
793
+ var cell = _this8.getCell(row, column);
744
794
  if (cell) {
745
- _this9.handleActived({
795
+ _this8.handleActived({
746
796
  row: row,
747
- rowIndex: _this9.getRowIndex(row),
797
+ rowIndex: _this8.getRowIndex(row),
748
798
  column: column,
749
- columnIndex: _this9.getColumnIndex(column),
799
+ columnIndex: _this8.getColumnIndex(column),
750
800
  cell: cell,
751
- $table: _this9
801
+ $table: _this8
752
802
  });
753
- _this9.lastCallTime = Date.now();
803
+ _this8.lastCallTime = Date.now();
754
804
  }
755
805
  });
756
806
  }
@@ -784,7 +834,7 @@ var _default = {
784
834
  * 处理选中源
785
835
  */
786
836
  handleSelected: function handleSelected(params, evnt) {
787
- var _this10 = this;
837
+ var _this9 = this;
788
838
  var mouseConfig = this.mouseConfig,
789
839
  mouseOpts = this.mouseOpts,
790
840
  editOpts = this.editOpts,
@@ -797,23 +847,23 @@ var _default = {
797
847
  var selectMethod = function selectMethod() {
798
848
  if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
799
849
  if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
800
- _this10.clearActived(evnt);
801
- _this10.clearSelected(evnt);
802
- _this10.clearCellAreas(evnt);
803
- _this10.clearCopyCellArea(evnt);
850
+ _this9.clearActived(evnt);
851
+ _this9.clearSelected(evnt);
852
+ _this9.clearCellAreas(evnt);
853
+ _this9.clearCopyCellArea(evnt);
804
854
  selected.args = params;
805
855
  selected.row = row;
806
856
  selected.column = column;
807
857
  if (isMouseSelected) {
808
- _this10.addColSdCls();
858
+ _this9.addColSdCls();
809
859
  }
810
- _this10.focus();
860
+ _this9.focus();
811
861
  if (evnt) {
812
- _this10.emitEvent('cell-selected', params, evnt);
862
+ _this9.emitEvent('cell-selected', params, evnt);
813
863
  }
814
864
  }
815
865
  }
816
- return _this10.$nextTick();
866
+ return _this9.$nextTick();
817
867
  };
818
868
  return selectMethod();
819
869
  },