@visactor/vtable 1.18.2-alpha.3 → 1.18.2

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 (61) hide show
  1. package/cjs/ListTable.d.ts +1 -3
  2. package/cjs/ListTable.js +4 -6
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/components/menu/dom/MenuHandler.js +1 -1
  5. package/cjs/components/menu/dom/MenuHandler.js.map +1 -1
  6. package/cjs/components/tooltip/TooltipHandler.js +1 -1
  7. package/cjs/components/tooltip/TooltipHandler.js.map +1 -1
  8. package/cjs/core/BaseTable.d.ts +2 -1
  9. package/cjs/core/BaseTable.js +33 -22
  10. package/cjs/core/BaseTable.js.map +1 -1
  11. package/cjs/event/listener/container-dom.js +3 -1
  12. package/cjs/event/listener/container-dom.js.map +1 -1
  13. package/cjs/event/listener/table-group.js +4 -0
  14. package/cjs/event/listener/table-group.js.map +1 -1
  15. package/cjs/event/listener/touch.js +3 -2
  16. package/cjs/event/listener/touch.js.map +1 -1
  17. package/cjs/index.d.ts +1 -1
  18. package/cjs/index.js +1 -1
  19. package/cjs/index.js.map +1 -1
  20. package/cjs/plugins/interface.d.ts +2 -1
  21. package/cjs/plugins/interface.js.map +1 -1
  22. package/cjs/plugins/plugin-manager.d.ts +3 -2
  23. package/cjs/plugins/plugin-manager.js +20 -13
  24. package/cjs/plugins/plugin-manager.js.map +1 -1
  25. package/cjs/ts-types/base-table.d.ts +1 -1
  26. package/cjs/ts-types/base-table.js.map +1 -1
  27. package/cjs/ts-types/table-engine.d.ts +1 -0
  28. package/cjs/ts-types/table-engine.js.map +1 -1
  29. package/cjs/vrender.js.map +1 -1
  30. package/dist/vtable.js +63 -24
  31. package/dist/vtable.min.js +1 -1
  32. package/es/ListTable.d.ts +1 -3
  33. package/es/ListTable.js +4 -6
  34. package/es/ListTable.js.map +1 -1
  35. package/es/components/menu/dom/MenuHandler.js +1 -1
  36. package/es/components/menu/dom/MenuHandler.js.map +1 -1
  37. package/es/components/tooltip/TooltipHandler.js +1 -1
  38. package/es/components/tooltip/TooltipHandler.js.map +1 -1
  39. package/es/core/BaseTable.d.ts +2 -1
  40. package/es/core/BaseTable.js +33 -22
  41. package/es/core/BaseTable.js.map +1 -1
  42. package/es/event/listener/container-dom.js +3 -1
  43. package/es/event/listener/container-dom.js.map +1 -1
  44. package/es/event/listener/table-group.js +4 -0
  45. package/es/event/listener/table-group.js.map +1 -1
  46. package/es/event/listener/touch.js +3 -2
  47. package/es/event/listener/touch.js.map +1 -1
  48. package/es/index.d.ts +1 -1
  49. package/es/index.js +1 -1
  50. package/es/index.js.map +1 -1
  51. package/es/plugins/interface.d.ts +2 -1
  52. package/es/plugins/interface.js.map +1 -1
  53. package/es/plugins/plugin-manager.d.ts +3 -2
  54. package/es/plugins/plugin-manager.js +20 -13
  55. package/es/plugins/plugin-manager.js.map +1 -1
  56. package/es/ts-types/base-table.d.ts +1 -1
  57. package/es/ts-types/base-table.js.map +1 -1
  58. package/es/ts-types/table-engine.d.ts +1 -0
  59. package/es/ts-types/table-engine.js.map +1 -1
  60. package/es/vrender.js.map +1 -1
  61. package/package.json +5 -5
package/dist/vtable.js CHANGED
@@ -55638,6 +55638,12 @@
55638
55638
  });
55639
55639
  }
55640
55640
  }
55641
+ setTimeout(() => {
55642
+ eventManager.isTouchdown = false;
55643
+ eventManager.isTouchMove = false;
55644
+ eventManager.isDraging = false;
55645
+ eventManager.touchMovePoints = [];
55646
+ }, 0);
55641
55647
  });
55642
55648
  table.scenegraph.tableGroup.addEventListener('rightdown', (e) => {
55643
55649
  const eventArgsSet = getCellEventArgsSet(e);
@@ -56672,6 +56678,9 @@
56672
56678
  return values;
56673
56679
  }
56674
56680
  const globalPointerdownCallback = (e) => {
56681
+ if (table.isReleased) {
56682
+ return;
56683
+ }
56675
56684
  table.eventManager.LastBodyPointerXY = { x: e.x, y: e.y };
56676
56685
  table.eventManager.isDown = true;
56677
56686
  const target = e.target;
@@ -56734,6 +56743,9 @@
56734
56743
  }
56735
56744
  };
56736
56745
  const globalPointerupCallback = (e) => {
56746
+ if (table.isReleased) {
56747
+ return;
56748
+ }
56737
56749
  const target = e.target;
56738
56750
  if (target !== table.canvas) {
56739
56751
  globalPointerupOutsideCallback(e);
@@ -56779,7 +56791,7 @@
56779
56791
  table.eventManager.isDraging = true;
56780
56792
  }
56781
56793
  }
56782
- const { x, y } = table._getMouseAbstractPoint(e, false);
56794
+ const { x, y } = table._getMouseAbstractPoint(e);
56783
56795
  if (stateManager.interactionState === InteractionState.grabing) {
56784
56796
  if (stateManager.isResizeCol()) {
56785
56797
  eventManager.dealColumnResize(x, y);
@@ -57001,6 +57013,7 @@
57001
57013
  }
57002
57014
  eventManager.isTouchdown = false;
57003
57015
  eventManager.isTouchMove = false;
57016
+ eventManager.isDraging = false;
57004
57017
  eventManager.touchMovePoints = [];
57005
57018
  };
57006
57019
  vglobal.addEventListener('touchend', globalTouchEndCallback);
@@ -57018,6 +57031,7 @@
57018
57031
  eventManager.isTouchdown = false;
57019
57032
  eventManager.isTouchMove = false;
57020
57033
  eventManager.touchMovePoints = [];
57034
+ eventManager.isDraging = false;
57021
57035
  };
57022
57036
  vglobal.addEventListener('touchcancel', globalTouchCancelCallback);
57023
57037
  eventManager.globalEventListeners.push({
@@ -62366,8 +62380,8 @@
62366
62380
  this.table = table;
62367
62381
  options.plugins?.map(plugin => {
62368
62382
  this.register(plugin);
62383
+ this._bindTableEventForPlugin(plugin);
62369
62384
  });
62370
- this.initPlugins(table);
62371
62385
  }
62372
62386
  register(plugin) {
62373
62387
  this.plugins.set(plugin.id, plugin);
@@ -62378,21 +62392,32 @@
62378
62392
  getPlugin(id) {
62379
62393
  return this.plugins.get(id);
62380
62394
  }
62381
- initPlugins(table) {
62382
- this.plugins.forEach(plugin => {
62383
- plugin.runTime?.forEach(runTime => {
62384
- table.on(runTime, (...args) => {
62385
- plugin.run?.(...args, runTime, table);
62386
- });
62395
+ getPluginByName(name) {
62396
+ return Array.from(this.plugins.values()).find(plugin => plugin.name === name);
62397
+ }
62398
+ _bindTableEventForPlugin(plugin) {
62399
+ plugin.runTime?.forEach(runTime => {
62400
+ this.table.on(runTime, (...args) => {
62401
+ plugin.run?.(...args, runTime, this.table);
62387
62402
  });
62388
62403
  });
62389
62404
  }
62390
- updatePlugins() {
62405
+ updatePlugins(plugins) {
62406
+ const removedPlugins = Array.from(this.plugins.values()).filter(plugin => !plugins?.some(p => p.id === plugin.id));
62407
+ removedPlugins.forEach(plugin => {
62408
+ this.release();
62409
+ this.plugins.delete(plugin.id);
62410
+ });
62391
62411
  this.plugins.forEach(plugin => {
62392
62412
  if (plugin.update) {
62393
- plugin.update(this.table);
62413
+ plugin.update();
62394
62414
  }
62395
62415
  });
62416
+ const addedPlugins = plugins?.filter(plugin => !this.plugins.has(plugin.id));
62417
+ addedPlugins?.forEach(plugin => {
62418
+ this.register(plugin);
62419
+ this._bindTableEventForPlugin(plugin);
62420
+ });
62396
62421
  }
62397
62422
  release() {
62398
62423
  this.plugins.forEach(plugin => {
@@ -62435,7 +62460,7 @@
62435
62460
  return TABLE_EVENT_TYPE;
62436
62461
  }
62437
62462
  options;
62438
- version = "1.18.2-alpha.3";
62463
+ version = "1.18.2";
62439
62464
  pagination;
62440
62465
  id = `VTable${Date.now()}`;
62441
62466
  headerStyleCache;
@@ -62450,6 +62475,7 @@
62450
62475
  reactCustomLayout;
62451
62476
  _hasAutoImageColumn;
62452
62477
  pluginManager;
62478
+ rotateDegree;
62453
62479
  constructor(container, options = {}) {
62454
62480
  super();
62455
62481
  if (Env.mode === 'node') {
@@ -63863,6 +63889,7 @@
63863
63889
  return super.fireListeners(type, event);
63864
63890
  }
63865
63891
  updateOption(options) {
63892
+ this.editorManager?.cancelEdit();
63866
63893
  this.options = options;
63867
63894
  this._hasAutoImageColumn = undefined;
63868
63895
  const { frozenColCount = 0, unfreezeAllOnExceedsMaxWidth, defaultRowHeight = 40, defaultHeaderRowHeight, defaultColWidth = 80, defaultHeaderColWidth = 80, keyboardOptions, eventOptions, rowSeriesNumber, columnResizeMode, rowResizeMode = 'none', resize, dragHeaderMode, dragOrder, showFrozenIcon, allowFrozenColCount, padding, hover, menu, select: click, pixelRatio, widthMode, heightMode, autoFillWidth, autoFillHeight, widthAdaptiveMode, heightAdaptiveMode, customRender, renderChartAsync, renderChartAsyncBatchCount, canvasWidth, canvasHeight, overscrollBehavior, limitMinWidth, limitMinHeight } = options;
@@ -64058,7 +64085,7 @@
64058
64085
  const height = Math.min(this.tableNoFrameHeight, this.getAllRowsHeight());
64059
64086
  return new Rect$1(this.tableX, this.tableY, width, height);
64060
64087
  }
64061
- _getMouseAbstractPoint(evt, isAddScroll = true) {
64088
+ _getMouseAbstractPoint(evt) {
64062
64089
  const table = this;
64063
64090
  let e;
64064
64091
  if (!evt) {
@@ -64081,17 +64108,27 @@
64081
64108
  inTable = false;
64082
64109
  }
64083
64110
  const currentWidth = rect.width;
64084
- const originWidth = this.canvas.offsetWidth || currentWidth;
64111
+ const originWidth = (this.rotateDegree === 90 ? this.canvas.offsetHeight : this.canvas.offsetWidth) || currentWidth;
64085
64112
  const widthRatio = currentWidth / originWidth;
64086
64113
  const currentHeight = rect.height;
64087
- const originHeight = this.canvas.offsetHeight || currentHeight;
64114
+ const originHeight = (this.rotateDegree === 90 ? this.canvas.offsetWidth : this.canvas.offsetHeight) || currentHeight;
64088
64115
  const heightRatio = currentHeight / originHeight;
64089
- const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0) - (this.options.viewBox?.x1 ?? 0);
64090
- const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0) - (this.options.viewBox?.y1 ?? 0);
64116
+ const rotateTablePlugin = this.pluginManager.getPluginByName('Rotate Table');
64117
+ if (rotateTablePlugin && this.rotateDegree === 90) {
64118
+ const x = clientX / widthRatio - (this.options.viewBox?.x1 ?? 0);
64119
+ const y = clientY / heightRatio - (this.options.viewBox?.y1 ?? 0);
64120
+ const point = { x, y, inTable };
64121
+ const matrix = rotateTablePlugin.matrix;
64122
+ matrix.transformPoint(point, point);
64123
+ return point;
64124
+ }
64125
+ const x = (clientX - rect.left) / widthRatio - (this.options.viewBox?.x1 ?? 0);
64126
+ const y = (clientY - rect.top) / heightRatio - (this.options.viewBox?.y1 ?? 0);
64091
64127
  const point = { x, y, inTable };
64092
64128
  if (this.internalProps.modifiedViewBoxTransform && this.scenegraph.stage.window.getViewBoxTransform()) {
64093
64129
  const transform = this.scenegraph.stage.window.getViewBoxTransform();
64094
64130
  transform.transformPoint(point, point);
64131
+ return point;
64095
64132
  }
64096
64133
  return point;
64097
64134
  }
@@ -69778,9 +69815,7 @@
69778
69815
  }
69779
69816
  return ifCan;
69780
69817
  }
69781
- updateOption(options, updateConfig = {
69782
- keepData: false
69783
- }) {
69818
+ updateOption(options) {
69784
69819
  const internalProps = this.internalProps;
69785
69820
  super.updateOption(options);
69786
69821
  internalProps.frozenColDragHeaderMode =
@@ -69804,7 +69839,7 @@
69804
69839
  if (internalProps.releaseList) {
69805
69840
  for (let i = internalProps.releaseList.length - 1; i >= 0; i--) {
69806
69841
  const releaseObj = internalProps.releaseList[i];
69807
- if (updateConfig.keepData && releaseObj instanceof DataSource) {
69842
+ if (releaseObj instanceof DataSource) {
69808
69843
  releaseObj.updateColumns(this.internalProps.columns);
69809
69844
  }
69810
69845
  else {
@@ -69842,6 +69877,7 @@
69842
69877
  this.internalProps.emptyTip?.resetVisible();
69843
69878
  }
69844
69879
  }
69880
+ this.pluginManager.updatePlugins(options.plugins);
69845
69881
  return new Promise(resolve => {
69846
69882
  setTimeout(resolve, 0);
69847
69883
  });
@@ -69883,7 +69919,10 @@
69883
69919
  }
69884
69920
  const dataCount = table.internalProps.dataSource?.length ?? 0;
69885
69921
  layoutMap.recordsCount =
69886
- dataCount + (dataCount > 0 ? layoutMap.hasAggregationOnTopCount + layoutMap.hasAggregationOnBottomCount : 0);
69922
+ dataCount +
69923
+ (dataCount > 0 || !!this.options.showAggregationWhenEmpty
69924
+ ? layoutMap.hasAggregationOnTopCount + layoutMap.hasAggregationOnBottomCount
69925
+ : 0);
69887
69926
  if (table.transpose) {
69888
69927
  table.rowCount = layoutMap.rowCount ?? 0;
69889
69928
  table.colCount = layoutMap.colCount ?? 0;
@@ -73462,7 +73501,7 @@
73462
73501
  });
73463
73502
  table.on(TABLE_EVENT_TYPE.CONTEXTMENU_CELL, e => {
73464
73503
  if (table.internalProps.menu?.renderMode === 'html') {
73465
- const abstractPos = table._getMouseAbstractPoint(e.event, false);
73504
+ const abstractPos = table._getMouseAbstractPoint(e.event);
73466
73505
  let menu = null;
73467
73506
  if (abstractPos.inTable && typeof table.internalProps.menu?.contextMenuItems === 'function') {
73468
73507
  menu = table.internalProps.menu.contextMenuItems(table.getHeaderField(e.col, e.row), e.row, e.col, table);
@@ -74188,7 +74227,7 @@
74188
74227
  const position = this._attachInfo.tooltipOptions.referencePosition;
74189
74228
  const { event } = e;
74190
74229
  const { left, right, top, bottom } = position.rect;
74191
- const abstractPos = table._getMouseAbstractPoint(event, false);
74230
+ const abstractPos = table._getMouseAbstractPoint(event);
74192
74231
  if (!(abstractPos.inTable &&
74193
74232
  abstractPos.x >= left - 5 &&
74194
74233
  abstractPos.x <= right + 5 &&
@@ -85316,7 +85355,7 @@
85316
85355
  }
85317
85356
 
85318
85357
  registerForVrender();
85319
- const version = "1.18.2-alpha.3";
85358
+ const version = "1.18.2";
85320
85359
  function getIcons() {
85321
85360
  return get$2();
85322
85361
  }