vxe-table 3.20.13 → 3.21.0-beta.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.
Files changed (57) hide show
  1. package/es/style.css +1 -1
  2. package/es/table/module/edit/mixin.js +33 -12
  3. package/es/table/module/keyboard/mixin.js +2 -2
  4. package/es/table/src/cell.js +3 -3
  5. package/es/table/src/column.js +6 -3
  6. package/es/table/src/group.js +6 -3
  7. package/es/table/src/methods.js +365 -165
  8. package/es/table/src/props.js +2 -2
  9. package/es/table/src/table.js +13 -6
  10. package/es/table/src/util.js +12 -3
  11. package/es/ui/index.js +3 -3
  12. package/es/ui/src/dom.js +4 -0
  13. package/es/ui/src/log.js +1 -1
  14. package/lib/index.umd.js +364 -302
  15. package/lib/index.umd.min.js +1 -1
  16. package/lib/style.css +1 -1
  17. package/lib/table/module/edit/mixin.js +39 -12
  18. package/lib/table/module/edit/mixin.min.js +1 -1
  19. package/lib/table/module/keyboard/mixin.js +2 -2
  20. package/lib/table/module/keyboard/mixin.min.js +1 -1
  21. package/lib/table/src/cell.js +3 -3
  22. package/lib/table/src/column.js +6 -3
  23. package/lib/table/src/column.min.js +1 -1
  24. package/lib/table/src/group.js +6 -3
  25. package/lib/table/src/group.min.js +1 -1
  26. package/lib/table/src/methods.js +35 -29
  27. package/lib/table/src/methods.min.js +1 -1
  28. package/lib/table/src/props.js +2 -2
  29. package/lib/table/src/props.min.js +1 -1
  30. package/lib/table/src/table.js +15 -6
  31. package/lib/table/src/table.min.js +1 -1
  32. package/lib/table/src/util.js +12 -3
  33. package/lib/table/src/util.min.js +1 -1
  34. package/lib/ui/index.js +3 -3
  35. package/lib/ui/index.min.js +1 -1
  36. package/lib/ui/src/dom.js +5 -0
  37. package/lib/ui/src/dom.min.js +1 -1
  38. package/lib/ui/src/log.js +1 -1
  39. package/lib/ui/src/log.min.js +1 -1
  40. package/package.json +3 -3
  41. package/packages/table/module/edit/mixin.ts +47 -12
  42. package/packages/table/module/keyboard/mixin.ts +2 -2
  43. package/packages/table/src/cell.ts +5 -5
  44. package/packages/table/src/column.ts +10 -7
  45. package/packages/table/src/group.ts +10 -6
  46. package/packages/table/src/methods.ts +376 -161
  47. package/packages/table/src/props.ts +3 -3
  48. package/packages/table/src/table.ts +13 -6
  49. package/packages/table/src/util.ts +16 -6
  50. package/packages/ui/index.ts +2 -2
  51. package/packages/ui/src/dom.ts +5 -0
  52. /package/es/{iconfont.1776926445391.ttf → iconfont.1777796331871.ttf} +0 -0
  53. /package/es/{iconfont.1776926445391.woff → iconfont.1777796331871.woff} +0 -0
  54. /package/es/{iconfont.1776926445391.woff2 → iconfont.1777796331871.woff2} +0 -0
  55. /package/lib/{iconfont.1776926445391.ttf → iconfont.1777796331871.ttf} +0 -0
  56. /package/lib/{iconfont.1776926445391.woff → iconfont.1777796331871.woff} +0 -0
  57. /package/lib/{iconfont.1776926445391.woff2 → iconfont.1777796331871.woff2} +0 -0
@@ -36,7 +36,7 @@ function syncActivedCell($xeTable) {
36
36
  const editOpts = $xeTable.computeEditOpts;
37
37
  const { actived } = editStore;
38
38
  const { row, column } = actived;
39
- if (row || column) {
39
+ if (row && column) {
40
40
  if (editOpts.mode === 'row') {
41
41
  tableColumn.forEach((column) => setEditColumnModel(row, column));
42
42
  }
@@ -85,6 +85,7 @@ function insertTreeRow($xeTable, newRecords, isAppend) {
85
85
  fullAllDataRowIdData[rowid] = rest;
86
86
  }
87
87
  });
88
+ $xeTable.handleClearStack();
88
89
  }
89
90
  // function insertGroupRow ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, newRecords: any[], isAppend: boolean) {
90
91
  // }
@@ -142,6 +143,7 @@ function handleInsertRowAt($xeTable, records, targetRowOrRowid, isInsertNextRow)
142
143
  mergeItem.row = mergeRowIndex + newRecords.length;
143
144
  }
144
145
  });
146
+ $xeTable.handleClearStack();
145
147
  }
146
148
  }
147
149
  else {
@@ -167,6 +169,7 @@ function handleInsertRowAt($xeTable, records, targetRowOrRowid, isInsertNextRow)
167
169
  afterFullData.push(item);
168
170
  tableFullData.push(item);
169
171
  });
172
+ $xeTable.handleClearStack();
170
173
  }
171
174
  }
172
175
  else {
@@ -220,6 +223,7 @@ function handleInsertRowAt($xeTable, records, targetRowOrRowid, isInsertNextRow)
220
223
  parentChilds.splice(targetIndex, 0, ...treeRecords);
221
224
  }
222
225
  }
226
+ $xeTable.handleClearStack();
223
227
  }
224
228
  else {
225
229
  warnLog('vxe.error.unableInsert');
@@ -272,6 +276,7 @@ function handleInsertRowAt($xeTable, records, targetRowOrRowid, isInsertNextRow)
272
276
  mergeItem.rowspan = mergeRowspan + newRecords.length;
273
277
  }
274
278
  });
279
+ $xeTable.handleClearStack();
275
280
  }
276
281
  }
277
282
  }
@@ -355,10 +360,10 @@ function handleClearEdit($xeTable, evnt, targetRow) {
355
360
  return $xeTable.$nextTick();
356
361
  }
357
362
  syncActivedCell($xeTable);
363
+ $xeTable.updateFooter();
358
364
  actived.args = null;
359
365
  actived.row = null;
360
366
  actived.column = null;
361
- $xeTable.updateFooter();
362
367
  $xeTable.dispatchEvent('edit-closed', {
363
368
  row,
364
369
  rowIndex: $xeTable.getRowIndex(row),
@@ -379,7 +384,7 @@ function handleClearEdit($xeTable, evnt, targetRow) {
379
384
  }
380
385
  return $xeTable.$nextTick().then(() => $xeTable.updateCellAreas());
381
386
  }
382
- function handleEditActive($xeTable, params, evnt, isFocus, isPos) {
387
+ function handleEditActive($xeTable, params, evnt, options) {
383
388
  const props = $xeTable;
384
389
  const reactData = $xeTable;
385
390
  const $xeGrid = $xeTable.$xeGrid;
@@ -390,6 +395,7 @@ function handleEditActive($xeTable, params, evnt, isFocus, isPos) {
390
395
  const { actived, focused } = editStore;
391
396
  const { row, column } = params;
392
397
  const { editRender } = column;
398
+ const { isFocus, isPos, isClear } = options;
393
399
  const cell = (params.cell || $xeTable.getCellElement(row, column));
394
400
  const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
395
401
  params.cell = cell;
@@ -416,6 +422,10 @@ function handleEditActive($xeTable, params, evnt, isFocus, isPos) {
416
422
  actived.args = params;
417
423
  actived.row = row;
418
424
  actived.column = column;
425
+ $xeTable.handlePushStack();
426
+ if (isClear) {
427
+ setCellValue(row, column, null);
428
+ }
419
429
  if (mode === 'row') {
420
430
  tableColumn.forEach((column) => getEditColumnModel(row, column));
421
431
  }
@@ -461,7 +471,7 @@ function handleEditActive($xeTable, params, evnt, isFocus, isPos) {
461
471
  $xeTable.clearCopyCellArea();
462
472
  }
463
473
  }
464
- if (oldColumn !== column) {
474
+ if (oldColumn && oldColumn !== column) {
465
475
  const { model: oldModel } = oldColumn;
466
476
  if (oldModel.update) {
467
477
  setCellValue(row, oldColumn, oldModel.value);
@@ -486,10 +496,11 @@ function handleEditActive($xeTable, params, evnt, isFocus, isPos) {
486
496
  }
487
497
  return $xeTable.$nextTick();
488
498
  }
489
- function handleEditCell($xeTable, row, fieldOrColumn, isPos) {
499
+ function handleEditCell($xeTable, row, fieldOrColumn, options) {
490
500
  const props = $xeTable;
491
501
  const internalData = $xeTable;
492
502
  const { editConfig } = props;
503
+ const { isPos } = options;
493
504
  const column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
494
505
  if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender) && !$xeTable.isAggregateRecord(row)) {
495
506
  return Promise.resolve(isPos ? $xeTable.scrollToRow(row, column) : null).then(() => {
@@ -502,7 +513,7 @@ function handleEditCell($xeTable, row, fieldOrColumn, isPos) {
502
513
  columnIndex: $xeTable.getColumnIndex(column),
503
514
  cell,
504
515
  $table: $xeTable
505
- }, null, isPos, isPos);
516
+ }, null, options);
506
517
  internalData._lastCallTime = Date.now();
507
518
  }
508
519
  return $xeTable.$nextTick();
@@ -658,6 +669,7 @@ export default {
658
669
  reactData.removeRowFlag++;
659
670
  reactData.insertRowFlag++;
660
671
  reactData.pendingRowFlag++;
672
+ $xeTable.handleClearStack();
661
673
  $xeTable.cacheRowMap(false);
662
674
  $xeTable.handleTableData(treeConfig && transform);
663
675
  $xeTable.updateFooter();
@@ -779,9 +791,12 @@ export default {
779
791
  /**
780
792
  * 处理激活编辑
781
793
  */
782
- handleEdit(params, evnt) {
794
+ handleEdit(params, evnt, options) {
783
795
  const $xeTable = this;
784
- return handleEditActive($xeTable, params, evnt, true, true);
796
+ return handleEditActive($xeTable, params, evnt, Object.assign({
797
+ isFocus: true,
798
+ isPos: true
799
+ }, options));
785
800
  },
786
801
  /**
787
802
  * @deprecated
@@ -948,7 +963,7 @@ export default {
948
963
  /**
949
964
  * 激活行编辑
950
965
  */
951
- _setEditRow(row, fieldOrColumn) {
966
+ _setEditRow(row, fieldOrColumn, options) {
952
967
  const $xeTable = this;
953
968
  const internalData = $xeTable;
954
969
  const { visibleColumn } = internalData;
@@ -960,7 +975,10 @@ export default {
960
975
  column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
961
976
  }
962
977
  }
963
- return handleEditCell($xeTable, row, column, isPos);
978
+ return handleEditCell($xeTable, row, column, Object.assign({
979
+ isPos,
980
+ isFocus: isPos
981
+ }, options));
964
982
  },
965
983
  _setActiveCell(row, fieldOrColumn) {
966
984
  const $xeTable = this;
@@ -971,9 +989,12 @@ export default {
971
989
  /**
972
990
  * 激活单元格编辑
973
991
  */
974
- _setEditCell(row, fieldOrColumn) {
992
+ _setEditCell(row, fieldOrColumn, options) {
975
993
  const $xeTable = this;
976
- return handleEditCell($xeTable, row, fieldOrColumn, true);
994
+ return handleEditCell($xeTable, row, fieldOrColumn, Object.assign({
995
+ isFocus: true,
996
+ isPos: true
997
+ }, options));
977
998
  },
978
999
  /**
979
1000
  * 只对 trigger=dblclick 有效,选中单元格
@@ -510,8 +510,8 @@ export default {
510
510
  const checkboxOpts = $xeTable.computeCheckboxOpts;
511
511
  const mouseOpts = $xeTable.computeMouseOpts;
512
512
  const editOpts = $xeTable.computeEditOpts;
513
- if (mouseConfig && mouseOpts.area && $xeTable.triggerClAreaModnEvent) {
514
- return $xeTable.triggerClAreaModnEvent(evnt, params);
513
+ if (mouseConfig && mouseOpts.area && $xeTable.triggerCelllAreaMnEvent) {
514
+ return $xeTable.triggerCelllAreaMnEvent(evnt, params);
515
515
  }
516
516
  else {
517
517
  if (checkboxConfig && checkboxOpts.range) {
@@ -323,8 +323,8 @@ function renderFooterHandle(h, params) {
323
323
  return Cell.renderDefaultFooter(h, params);
324
324
  }
325
325
  export const Cell = {
326
- createColumn($xeTable, _vm) {
327
- const { type } = _vm;
326
+ createColumn($xeTable, columnOpts) {
327
+ const { type } = columnOpts;
328
328
  const renConfs = {
329
329
  renderHeader: renderHeaderHandle,
330
330
  renderCell: renderCellHandle,
@@ -333,7 +333,7 @@ export const Cell = {
333
333
  if (type === 'expand') {
334
334
  renConfs.renderData = Cell.renderExpandData;
335
335
  }
336
- return createColumn($xeTable, _vm, renConfs);
336
+ return createColumn($xeTable, columnOpts, renConfs);
337
337
  },
338
338
  /**
339
339
  * 列头标题
@@ -1,6 +1,6 @@
1
- import Cell from './cell';
2
1
  import { defineVxeComponent } from '../../ui/src/comp';
3
2
  import { assembleColumn, destroyColumn } from './util';
3
+ import Cell from './cell';
4
4
  export const columnProps = {
5
5
  // 列唯一主键
6
6
  colId: [String, Number],
@@ -163,8 +163,9 @@ export default {
163
163
  name: 'VxeColumn',
164
164
  props: columnProps,
165
165
  provide() {
166
+ const $xeColumn = this;
166
167
  return {
167
- $xeColumn: this,
168
+ $xeColumn,
168
169
  $xeGrid: null,
169
170
  $xeGantt: null
170
171
  };
@@ -179,8 +180,10 @@ export default {
179
180
  },
180
181
  watch: columnWatch,
181
182
  created() {
183
+ const $xeColumn = this;
184
+ const props = $xeColumn;
182
185
  const $xeTable = this.$xeTable;
183
- this.columnConfig = this.createColumn($xeTable, this);
186
+ this.columnConfig = Cell.createColumn($xeTable, props);
184
187
  },
185
188
  mounted() {
186
189
  this.columnConfig.slots = this.$scopedSlots;
@@ -1,13 +1,14 @@
1
- import Cell from './cell';
2
1
  import { defineVxeComponent } from '../../ui/src/comp';
3
2
  import { assembleColumn, destroyColumn } from './util';
4
3
  import { columnProps, columnWatch } from './column';
4
+ import Cell from './cell';
5
5
  export default {
6
6
  name: 'VxeColgroup',
7
7
  props: columnProps,
8
8
  provide() {
9
+ const $xeColgroup = this;
9
10
  return {
10
- $xeColumn: this,
11
+ $xeColumn: $xeColgroup,
11
12
  $xeGrid: null,
12
13
  $xeGantt: null
13
14
  };
@@ -22,8 +23,10 @@ export default {
22
23
  },
23
24
  watch: columnWatch,
24
25
  created() {
26
+ const $xeColgroup = this;
27
+ const props = $xeColgroup;
25
28
  const $xeTable = this.$xeTable;
26
- this.columnConfig = this.createColumn($xeTable, this);
29
+ this.columnConfig = Cell.createColumn($xeTable, props);
27
30
  },
28
31
  mounted() {
29
32
  const { $scopedSlots } = this;