vxe-table 4.18.13 → 4.19.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/README.md +2 -2
  2. package/es/grid/src/grid.js +1 -1
  3. package/es/index.css +1 -1
  4. package/es/index.min.css +1 -1
  5. package/es/style.css +1 -1
  6. package/es/style.min.css +1 -1
  7. package/es/table/module/edit/hook.js +36 -12
  8. package/es/table/module/keyboard/hook.js +2 -2
  9. package/es/table/src/emits.js +2 -0
  10. package/es/table/src/props.js +2 -2
  11. package/es/table/src/table.js +325 -141
  12. package/es/table/src/util.js +12 -3
  13. package/es/ui/index.js +3 -3
  14. package/es/ui/src/dom.js +4 -0
  15. package/es/ui/src/log.js +1 -1
  16. package/lib/grid/src/grid.js +1 -1
  17. package/lib/grid/src/grid.min.js +1 -1
  18. package/lib/index.css +1 -1
  19. package/lib/index.min.css +1 -1
  20. package/lib/index.umd.js +108 -55
  21. package/lib/index.umd.min.js +1 -1
  22. package/lib/style.css +1 -1
  23. package/lib/style.min.css +1 -1
  24. package/lib/table/module/edit/hook.js +42 -12
  25. package/lib/table/module/edit/hook.min.js +1 -1
  26. package/lib/table/module/keyboard/hook.js +2 -2
  27. package/lib/table/module/keyboard/hook.min.js +1 -1
  28. package/lib/table/src/emits.js +1 -1
  29. package/lib/table/src/emits.min.js +1 -1
  30. package/lib/table/src/props.js +2 -2
  31. package/lib/table/src/props.min.js +1 -1
  32. package/lib/table/src/table.js +39 -30
  33. package/lib/table/src/table.min.js +1 -1
  34. package/lib/table/src/util.js +12 -3
  35. package/lib/table/src/util.min.js +1 -1
  36. package/lib/ui/index.js +3 -3
  37. package/lib/ui/index.min.js +1 -1
  38. package/lib/ui/src/dom.js +5 -0
  39. package/lib/ui/src/dom.min.js +1 -1
  40. package/lib/ui/src/log.js +1 -1
  41. package/lib/ui/src/log.min.js +1 -1
  42. package/package.json +3 -3
  43. package/packages/grid/src/grid.ts +1 -1
  44. package/packages/table/module/edit/hook.ts +44 -12
  45. package/packages/table/module/keyboard/hook.ts +2 -2
  46. package/packages/table/src/emits.ts +2 -0
  47. package/packages/table/src/props.ts +2 -2
  48. package/packages/table/src/table.ts +320 -136
  49. package/packages/table/src/util.ts +15 -5
  50. package/packages/ui/index.ts +2 -2
  51. package/packages/ui/src/dom.ts +5 -0
  52. /package/es/{iconfont.1776926463538.ttf → iconfont.1777796358891.ttf} +0 -0
  53. /package/es/{iconfont.1776926463538.woff → iconfont.1777796358891.woff} +0 -0
  54. /package/es/{iconfont.1776926463538.woff2 → iconfont.1777796358891.woff2} +0 -0
  55. /package/lib/{iconfont.1776926463538.ttf → iconfont.1777796358891.ttf} +0 -0
  56. /package/lib/{iconfont.1776926463538.woff → iconfont.1777796358891.woff} +0 -0
  57. /package/lib/{iconfont.1776926463538.woff2 → iconfont.1777796358891.woff2} +0 -0
@@ -44,7 +44,7 @@ hooks.add('tableEditModule', {
44
44
  const editOpts = computeEditOpts.value;
45
45
  const { actived } = editStore;
46
46
  const { row, column } = actived;
47
- if (row || column) {
47
+ if (row && column) {
48
48
  if (editOpts.mode === 'row') {
49
49
  tableColumn.forEach((column) => setEditColumnModel(row, column));
50
50
  }
@@ -92,6 +92,7 @@ hooks.add('tableEditModule', {
92
92
  fullAllDataRowIdData[rowid] = rest;
93
93
  }
94
94
  });
95
+ $xeTable.handleClearStack();
95
96
  };
96
97
  // const insertGroupRow = (newRecords: any[], isAppend: boolean) => {
97
98
  // }
@@ -146,6 +147,7 @@ hooks.add('tableEditModule', {
146
147
  mergeItem.row = mergeRowIndex + newRecords.length;
147
148
  }
148
149
  });
150
+ $xeTable.handleClearStack();
149
151
  }
150
152
  }
151
153
  else {
@@ -171,6 +173,7 @@ hooks.add('tableEditModule', {
171
173
  afterFullData.push(item);
172
174
  tableFullData.push(item);
173
175
  });
176
+ $xeTable.handleClearStack();
174
177
  }
175
178
  }
176
179
  else {
@@ -224,6 +227,7 @@ hooks.add('tableEditModule', {
224
227
  parentChilds.splice(targetIndex, 0, ...treeRecords);
225
228
  }
226
229
  }
230
+ $xeTable.handleClearStack();
227
231
  }
228
232
  else {
229
233
  warnLog('vxe.error.unableInsert');
@@ -276,6 +280,7 @@ hooks.add('tableEditModule', {
276
280
  mergeItem.rowspan = mergeRowspan + newRecords.length;
277
281
  }
278
282
  });
283
+ $xeTable.handleClearStack();
279
284
  }
280
285
  }
281
286
  }
@@ -356,10 +361,10 @@ hooks.add('tableEditModule', {
356
361
  return nextTick();
357
362
  }
358
363
  syncActivedCell();
364
+ $xeTable.updateFooter();
359
365
  actived.args = null;
360
366
  actived.row = null;
361
367
  actived.column = null;
362
- $xeTable.updateFooter();
363
368
  $xeTable.dispatchEvent('edit-closed', {
364
369
  row,
365
370
  rowIndex: $xeTable.getRowIndex(row),
@@ -380,7 +385,7 @@ hooks.add('tableEditModule', {
380
385
  }
381
386
  return nextTick().then(() => $xeTable.updateCellAreas());
382
387
  };
383
- const handleEditActive = (params, evnt, isFocus, isPos) => {
388
+ const handleEditActive = (params, evnt, options) => {
384
389
  const $xeGrid = $xeTable.xeGrid;
385
390
  const $xeGantt = $xeTable.xeGantt;
386
391
  const { editConfig, mouseConfig } = props;
@@ -390,6 +395,7 @@ hooks.add('tableEditModule', {
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 @@ hooks.add('tableEditModule', {
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 @@ hooks.add('tableEditModule', {
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,8 +496,9 @@ hooks.add('tableEditModule', {
486
496
  }
487
497
  return nextTick();
488
498
  };
489
- const handleEditCell = (row, fieldOrColumn, isPos) => {
499
+ const handleEditCell = (row, fieldOrColumn, options) => {
490
500
  const { editConfig } = props;
501
+ const { isPos } = options;
491
502
  const column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
492
503
  if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender) && !$xeTable.isAggregateRecord(row)) {
493
504
  return Promise.resolve(isPos ? $xeTable.scrollToRow(row, column) : null).then(() => {
@@ -500,7 +511,10 @@ hooks.add('tableEditModule', {
500
511
  columnIndex: $xeTable.getColumnIndex(column),
501
512
  cell,
502
513
  $table: $xeTable
503
- }, null, isPos, isPos);
514
+ }, null, {
515
+ isFocus: isPos,
516
+ isPos
517
+ });
504
518
  internalData._lastCallTime = Date.now();
505
519
  }
506
520
  return nextTick();
@@ -651,6 +665,7 @@ hooks.add('tableEditModule', {
651
665
  reactData.removeRowFlag++;
652
666
  reactData.insertRowFlag++;
653
667
  reactData.pendingRowFlag++;
668
+ $xeTable.handleClearStack();
654
669
  $xeTable.cacheRowMap(false);
655
670
  $xeTable.handleTableData(treeConfig && transform);
656
671
  $xeTable.updateFooter();
@@ -848,7 +863,7 @@ hooks.add('tableEditModule', {
848
863
  /**
849
864
  * 激活行编辑
850
865
  */
851
- setEditRow(row, fieldOrColumn) {
866
+ setEditRow(row, fieldOrColumn, options) {
852
867
  const { visibleColumn } = internalData;
853
868
  let column = XEUtils.find(visibleColumn, column => isEnableConf(column.editRender));
854
869
  let isPos = false;
@@ -858,7 +873,10 @@ hooks.add('tableEditModule', {
858
873
  column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
859
874
  }
860
875
  }
861
- return handleEditCell(row, column, isPos);
876
+ return handleEditCell(row, column, Object.assign({
877
+ isPos,
878
+ isFocus: isPos
879
+ }, options));
862
880
  },
863
881
  setActiveCell(row, fieldOrColumn) {
864
882
  warnLog('vxe.error.delFunc', ['setActiveCell', 'setEditCell']);
@@ -868,8 +886,11 @@ hooks.add('tableEditModule', {
868
886
  /**
869
887
  * 激活单元格编辑
870
888
  */
871
- setEditCell(row, fieldOrColumn) {
872
- return handleEditCell(row, fieldOrColumn, true);
889
+ setEditCell(row, fieldOrColumn, options) {
890
+ return handleEditCell(row, fieldOrColumn, Object.assign({
891
+ isFocus: true,
892
+ isPos: true
893
+ }, options));
873
894
  },
874
895
  /**
875
896
  * 只对 trigger=dblclick 有效,选中单元格
@@ -899,8 +920,11 @@ hooks.add('tableEditModule', {
899
920
  /**
900
921
  * 处理激活编辑
901
922
  */
902
- handleEdit(params, evnt) {
903
- return handleEditActive(params, evnt, true, true);
923
+ handleEdit(params, evnt, options) {
924
+ return handleEditActive(params, evnt, Object.assign({
925
+ isFocus: true,
926
+ isPos: true
927
+ }, options));
904
928
  },
905
929
  /**
906
930
  * @deprecated
@@ -250,8 +250,8 @@ hooks.add('tableKeyboardModule', {
250
250
  const checkboxOpts = computeCheckboxOpts.value;
251
251
  const mouseOpts = computeMouseOpts.value;
252
252
  const editOpts = computeEditOpts.value;
253
- if (mouseConfig && mouseOpts.area && $xeTable.triggerClAreaModnEvent) {
254
- return $xeTable.triggerClAreaModnEvent(evnt, params);
253
+ if (mouseConfig && mouseOpts.area && $xeTable.triggerCelllAreaMnEvent) {
254
+ return $xeTable.triggerCelllAreaMnEvent(evnt, params);
255
255
  }
256
256
  else {
257
257
  if (checkboxConfig && checkboxOpts.range) {
@@ -9,6 +9,8 @@ export const tableEmits = [
9
9
  'paste',
10
10
  'copy',
11
11
  'cut',
12
+ 'undo',
13
+ 'redo',
12
14
  'context-menu',
13
15
  'columns-change',
14
16
  'data-change',
@@ -301,8 +301,8 @@ export const tableProps = {
301
301
  virtualYConfig: Object,
302
302
  // 滚动条配置项
303
303
  scrollbarConfig: Object,
304
- // 可撤销配置项
305
- undoHistoryConfig: Object,
304
+ // 撤销/恢复历史配置项
305
+ undoRedoHistoryConfig: Object,
306
306
  // (即将废弃)优化相关
307
307
  animat: {
308
308
  type: Boolean,