@visactor/vtable-plugins 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 (53) hide show
  1. package/cjs/add-row-column.d.ts +1 -0
  2. package/cjs/add-row-column.js +1 -1
  3. package/cjs/add-row-column.js.map +1 -1
  4. package/cjs/carousel-animation.js.map +1 -1
  5. package/cjs/column-series.d.ts +2 -1
  6. package/cjs/column-series.js +5 -4
  7. package/cjs/column-series.js.map +1 -1
  8. package/cjs/excel-edit-cell-keyboard.d.ts +1 -0
  9. package/cjs/excel-edit-cell-keyboard.js +3 -2
  10. package/cjs/excel-edit-cell-keyboard.js.map +1 -1
  11. package/cjs/focus-highlight.d.ts +2 -1
  12. package/cjs/focus-highlight.js +6 -3
  13. package/cjs/focus-highlight.js.map +1 -1
  14. package/cjs/highlight-header-when-select-cell.d.ts +2 -0
  15. package/cjs/highlight-header-when-select-cell.js +5 -1
  16. package/cjs/highlight-header-when-select-cell.js.map +1 -1
  17. package/cjs/rotate-table.d.ts +3 -0
  18. package/cjs/rotate-table.js +16 -9
  19. package/cjs/rotate-table.js.map +1 -1
  20. package/cjs/row-series.d.ts +2 -1
  21. package/cjs/row-series.js +5 -5
  22. package/cjs/row-series.js.map +1 -1
  23. package/cjs/table-carousel-animation.d.ts +1 -0
  24. package/cjs/table-carousel-animation.js +3 -2
  25. package/cjs/table-carousel-animation.js.map +1 -1
  26. package/dist/vtable-plugins.js +62 -26
  27. package/dist/vtable-plugins.min.js +1 -1
  28. package/es/add-row-column.d.ts +1 -0
  29. package/es/add-row-column.js +1 -1
  30. package/es/add-row-column.js.map +1 -1
  31. package/es/carousel-animation.js.map +1 -1
  32. package/es/column-series.d.ts +2 -1
  33. package/es/column-series.js +5 -4
  34. package/es/column-series.js.map +1 -1
  35. package/es/excel-edit-cell-keyboard.d.ts +1 -0
  36. package/es/excel-edit-cell-keyboard.js +3 -2
  37. package/es/excel-edit-cell-keyboard.js.map +1 -1
  38. package/es/focus-highlight.d.ts +2 -1
  39. package/es/focus-highlight.js +7 -4
  40. package/es/focus-highlight.js.map +1 -1
  41. package/es/highlight-header-when-select-cell.d.ts +2 -0
  42. package/es/highlight-header-when-select-cell.js +5 -1
  43. package/es/highlight-header-when-select-cell.js.map +1 -1
  44. package/es/rotate-table.d.ts +3 -0
  45. package/es/rotate-table.js +16 -9
  46. package/es/rotate-table.js.map +1 -1
  47. package/es/row-series.d.ts +2 -1
  48. package/es/row-series.js +5 -5
  49. package/es/row-series.js.map +1 -1
  50. package/es/table-carousel-animation.d.ts +1 -0
  51. package/es/table-carousel-animation.js +3 -2
  52. package/es/table-carousel-animation.js.map +1 -1
  53. package/package.json +6 -6
@@ -2,10 +2,13 @@ import type { BaseTable } from '@visactor/vtable/src/core/BaseTable';
2
2
  import * as VTable from '@visactor/vtable';
3
3
  import type { TableEvents } from '@visactor/vtable/src/core/TABLE_EVENT_TYPE';
4
4
  import type { EventArg } from './types';
5
+ import type { Matrix } from '@visactor/vutils';
5
6
  export declare class RotateTablePlugin implements VTable.plugins.IVTablePlugin {
6
7
  id: string;
8
+ name: string;
7
9
  runTime: "initialized"[];
8
10
  table: VTable.ListTable;
11
+ matrix: Matrix;
9
12
  vglobal_mapToCanvasPoint: any;
10
13
  constructor();
11
14
  run(...args: [EventArg, TableEvents[keyof TableEvents] | TableEvents[keyof TableEvents][], VTable.BaseTableAPI]): void;
@@ -33,7 +33,7 @@ const vrender_1 = require("@visactor/vtable/es/vrender"), VTable = __importStar(
33
33
 
34
34
  class RotateTablePlugin {
35
35
  constructor() {
36
- this.id = "rotate-table", this.runTime = [ VTable.TABLE_EVENT_TYPE.INITIALIZED ];
36
+ this.id = "rotate-table", this.name = "Rotate Table", this.runTime = [ VTable.TABLE_EVENT_TYPE.INITIALIZED ];
37
37
  }
38
38
  run(...args) {
39
39
  const table = args[2];
@@ -45,7 +45,7 @@ class RotateTablePlugin {
45
45
 
46
46
  function rotate90WithTransform(rotateDom) {
47
47
  this.rotateDegree = 90;
48
- const rotateCenter = Math.min(rotateDom.clientWidth, rotateDom.clientHeight) / 2, domRect = this.getElement().getBoundingClientRect(), x1 = domRect.left, y1 = domRect.top, x2 = domRect.right, y2 = domRect.bottom;
48
+ const rotateCenter = rotateDom.clientWidth < rotateDom.clientHeight ? Math.max(rotateDom.clientWidth, rotateDom.clientHeight) / 2 : Math.min(rotateDom.clientWidth, rotateDom.clientHeight) / 2, domRect = this.getElement().getBoundingClientRect(), x1 = domRect.left, y1 = domRect.top, x2 = domRect.right, y2 = domRect.bottom;
49
49
  rotateDom.style.transform = "rotate(90deg)", rotateDom.style.transformOrigin = `${rotateCenter}px ${rotateCenter}px`;
50
50
  const getRect = () => ({
51
51
  x1: x1,
@@ -53,15 +53,21 @@ function rotate90WithTransform(rotateDom) {
53
53
  x2: x2,
54
54
  y2: y2
55
55
  }), getMatrix = () => {
56
- const containerRect = rotateDom.getBoundingClientRect(), domRect = this.getElement().getBoundingClientRect(), x1 = domRect.top, y1 = containerRect.width - domRect.right, matrix = vrender_1.matrixAllocate.allocate(1, 0, 0, 1, 0, 0);
56
+ const viewPortWidth = ("undefined" != typeof window ? {
57
+ width: window.innerWidth || document.documentElement.clientWidth,
58
+ height: window.innerHeight || document.documentElement.clientHeight
59
+ } : vrender_1.vglobal && vrender_1.vglobal.getViewportSize ? vrender_1.vglobal.getViewportSize() : rotateDom.getBoundingClientRect()).width, domRect = this.getElement().getBoundingClientRect(), x1 = domRect.top, y1 = viewPortWidth - domRect.right, matrix = vrender_1.matrixAllocate.allocate(1, 0, 0, 1, 0, 0);
57
60
  matrix.translate(x1, y1);
58
61
  const centerX = rotateCenter - x1, centerY = rotateCenter - y1;
59
- return matrix.translate(centerX, centerY), matrix.rotate(Math.PI / 2), matrix.translate(-centerX, -centerY),
60
- matrix;
62
+ matrix.translate(centerX, centerY), matrix.rotate(Math.PI / 2), matrix.translate(-centerX, -centerY);
63
+ const rotateRablePlugin = this.pluginManager.getPluginByName("Rotate Table");
64
+ return rotateRablePlugin && (rotateRablePlugin.matrix = matrix), matrix;
61
65
  };
62
66
  (0, vrender_1.registerGlobalEventTransformer)(vrender_1.vglobal, this.getElement(), getMatrix, getRect, vrender_1.transformPointForCanvas),
63
- (0, vrender_1.registerWindowEventTransformer)(this.scenegraph.stage.window, this.getElement(), getMatrix, getRect, vrender_1.transformPointForCanvas),
64
- this.vglobal_mapToCanvasPoint = vrender_1.vglobal.mapToCanvasPoint, vrender_1.vglobal.mapToCanvasPoint = vrender_1.mapToCanvasPointForCanvas;
67
+ (0, vrender_1.registerWindowEventTransformer)(this.scenegraph.stage.window, this.getElement(), getMatrix, getRect, vrender_1.transformPointForCanvas);
68
+ const rotateRablePlugin = this.pluginManager.getPluginByName("Rotate Table");
69
+ rotateRablePlugin && (rotateRablePlugin.vglobal_mapToCanvasPoint = vrender_1.vglobal.mapToCanvasPoint),
70
+ vrender_1.vglobal.mapToCanvasPoint = vrender_1.mapToCanvasPointForCanvas;
65
71
  }
66
72
 
67
73
  function cancelTransform(rotateDom) {
@@ -76,8 +82,9 @@ function cancelTransform(rotateDom) {
76
82
  return matrix.translate(x1, y1), matrix;
77
83
  };
78
84
  (0, vrender_1.registerGlobalEventTransformer)(vrender_1.vglobal, this.getElement(), getMatrix, getRect, vrender_1.transformPointForCanvas),
79
- (0, vrender_1.registerWindowEventTransformer)(this.scenegraph.stage.window, this.getElement(), getMatrix, getRect, vrender_1.transformPointForCanvas),
80
- vrender_1.vglobal.mapToCanvasPoint = this.vglobal_mapToCanvasPoint;
85
+ (0, vrender_1.registerWindowEventTransformer)(this.scenegraph.stage.window, this.getElement(), getMatrix, getRect, vrender_1.transformPointForCanvas);
86
+ const rotateRablePlugin = this.pluginManager.getPluginByName("Rotate Table");
87
+ rotateRablePlugin && (vrender_1.vglobal.mapToCanvasPoint = rotateRablePlugin.vglobal_mapToCanvasPoint);
81
88
  }
82
89
 
83
90
  exports.RotateTablePlugin = RotateTablePlugin, exports.rotate90WithTransform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,iBAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,wBAAwB,CAAC;AAC3D,CAAC;AAhCD,0CAgCC","file":"rotate-table.js","sourcesContent":["import {\n matrixAllocate,\n transformPointForCanvas,\n mapToCanvasPointForCanvas,\n registerGlobalEventTransformer,\n registerWindowEventTransformer,\n vglobal\n} from '@visactor/vtable/es/vrender';\nimport type { BaseTable } from '@visactor/vtable/src/core/BaseTable';\nimport * as VTable from '@visactor/vtable';\nimport type { TableEvents } from '@visactor/vtable/src/core/TABLE_EVENT_TYPE';\nimport type { EventArg } from './types';\n// export type IRotateTablePluginOptions = {\n// // 旋转角度\n// rotate?: number;\n// };\n/**\n * 旋转表格插件。\n * 业务层旋转功能没有使用收系统接口的话,用的transform:'rotate(90deg)'的设置来达到旋转的目的。vtable及vrender都没有进行坐标处理,这样就会导致交互错乱。\n * 所以需要进行坐标转换,将旋转后的坐标转换后作为VRender及VTable逻辑中用到的坐标。\n * 这里使用transform:'rotate(90deg)'的设置来达到旋转的目的。 其他角度应该也是可以实现的,请自行扩展这个插件并兼容\n */\nexport class RotateTablePlugin implements VTable.plugins.IVTablePlugin {\n id = 'rotate-table';\n runTime = [VTable.TABLE_EVENT_TYPE.INITIALIZED];\n table: VTable.ListTable;\n vglobal_mapToCanvasPoint: any; // 保存vrender中vglobal的mapToCanvasPoint原方法\n // pluginOptions: IRotateTablePluginOptions;\n constructor() {\n // this.pluginOptions = pluginOptions;\n }\n run(...args: [EventArg, TableEvents[keyof TableEvents] | TableEvents[keyof TableEvents][], VTable.BaseTableAPI]) {\n const table: VTable.BaseTableAPI = args[2];\n this.table = table as VTable.ListTable;\n //将函数rotate90WithTransform绑定到table实例上\n this.table.rotate90WithTransform = rotate90WithTransform.bind(this.table);\n this.table.cancelTransform = cancelTransform.bind(this.table);\n }\n\n release() {\n // 移除绑定的事件\n }\n}\n\n/**\n * 业务层旋转功能没有使用收系统接口的话,用的transform:'rotate(90deg)'的设置来达到旋转的目的。vtable及vrender都没有进行坐标处理,这样就会导致交互错乱。\n * 所以需要进行坐标转换,将旋转后的坐标转换后作为VRender及VTable逻辑中用到的坐标。\n */\nexport function rotate90WithTransform(this: BaseTable, rotateDom: HTMLElement) {\n this.rotateDegree = 90;\n const rotateCenter = Math.min(rotateDom.clientWidth, rotateDom.clientHeight) / 2;\n const domRect = this.getElement().getBoundingClientRect();\n const x1 = domRect.left;\n const y1 = domRect.top;\n const x2 = domRect.right;\n const y2 = domRect.bottom;\n\n rotateDom.style.transform = 'rotate(90deg)';\n rotateDom.style.transformOrigin = `${rotateCenter}px ${rotateCenter}px`;\n const getRect = () => {\n return {\n x1,\n y1,\n x2,\n y2\n };\n };\n const getMatrix = () => {\n const containerRect = rotateDom.getBoundingClientRect(); //TODO 这个地方应该获取窗口的宽高 最好能从vglobal上直接获取\n const domRect = this.getElement().getBoundingClientRect();\n const x1 = domRect.top;\n const y1 = containerRect.width - domRect.right;\n\n const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);\n matrix.translate(x1, y1);\n const centerX = rotateCenter - x1;\n const centerY = rotateCenter - y1;\n matrix.translate(centerX, centerY);\n matrix.rotate(Math.PI / 2);\n matrix.translate(-centerX, -centerY);\n return matrix;\n };\n registerGlobalEventTransformer(vglobal, this.getElement(), getMatrix, getRect, transformPointForCanvas);\n registerWindowEventTransformer(\n this.scenegraph.stage.window,\n this.getElement(),\n getMatrix,\n getRect,\n transformPointForCanvas\n );\n this.vglobal_mapToCanvasPoint = vglobal.mapToCanvasPoint;\n vglobal.mapToCanvasPoint = mapToCanvasPointForCanvas;\n //transformPointForCanvas和mapToCanvasPointForCanvas时相对应的\n //具体逻辑在 VRender/packages/vrender-core/src/common/event-transformer.ts中\n // 可以自定义这两个函数 来修改事件属性,transformPointForCanvas中将坐标转换后存放了_canvasX _canvasY,mapToCanvasPointForCanvas中加以利用\n // 在VTable的touch文件中,利用到了_canvasX _canvasY 所以如果自定义上面两个函数也需提供_canvasX _canvasY\n}\nexport function cancelTransform(this: BaseTable, rotateDom: HTMLElement) {\n this.rotateDegree = 0;\n rotateDom.style.transform = 'none';\n rotateDom.style.transformOrigin = 'none';\n const domRect = this.getElement().getBoundingClientRect();\n const x1 = domRect.left;\n const y1 = domRect.top;\n const x2 = domRect.right;\n const y2 = domRect.bottom;\n\n const getRect = () => {\n return {\n x1,\n y1,\n x2,\n y2\n };\n };\n const getMatrix = () => {\n const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);\n matrix.translate(x1, y1);\n return matrix;\n };\n registerGlobalEventTransformer(vglobal, this.getElement(), getMatrix, getRect, transformPointForCanvas);\n registerWindowEventTransformer(\n this.scenegraph.stage.window,\n this.getElement(),\n getMatrix,\n getRect,\n transformPointForCanvas\n );\n vglobal.mapToCanvasPoint = this.vglobal_mapToCanvasPoint;\n}\n"]}
1
+ {"version":3,"sources":["rotate-table.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAOqC;AAErC,yDAA2C;AAc3C,MAAa,iBAAiB;IAQ5B;QAPA,OAAE,GAAG,cAAc,CAAC;QACpB,SAAI,GAAG,cAAc,CAAC;QACtB,YAAO,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAOhD,CAAC;IACD,GAAG,CAAC,GAAG,IAAwG;QAC7G,MAAM,KAAK,GAAwB,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3C,IAAI,CAAC,KAAK,GAAG,KAAyB,CAAC;QAEvC,IAAI,CAAC,KAAK,CAAC,qBAAqB,GAAG,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1E,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IAED,OAAO;IAEP,CAAC;CACF;AAtBD,8CAsBC;AAMD,SAAgB,qBAAqB,CAAkB,SAAsB;IAC3E,IAAI,CAAC,YAAY,GAAG,EAA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AAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,EAC5B,IAAI,CAAC,UAAU,EAAE,EACjB,SAAS,EACT,OAAO,EACP,iCAAuB,CACxB,CAAC;IACF,MAAM,iBAAiB,GAAG,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IAC7E,IAAI,iBAAiB,EAAE;QACrB,iBAAO,CAAC,gBAAgB,GAAI,iBAAuC,CAAC,wBAAwB,CAAC;KAC9F;AACH,CAAC;AAnCD,0CAmCC","file":"rotate-table.js","sourcesContent":["import {\n matrixAllocate,\n transformPointForCanvas,\n mapToCanvasPointForCanvas,\n registerGlobalEventTransformer,\n registerWindowEventTransformer,\n vglobal\n} from '@visactor/vtable/es/vrender';\nimport type { BaseTable } from '@visactor/vtable/src/core/BaseTable';\nimport * as VTable from '@visactor/vtable';\nimport type { TableEvents } from '@visactor/vtable/src/core/TABLE_EVENT_TYPE';\nimport type { EventArg } from './types';\nimport type { Matrix } from '@visactor/vutils';\n// export type IRotateTablePluginOptions = {\n// // 旋转角度\n// rotate?: number;\n// };\n/**\n * 旋转表格插件。\n * 业务层旋转功能没有使用收系统接口的话,用的transform:'rotate(90deg)'的设置来达到旋转的目的。vtable及vrender都没有进行坐标处理,这样就会导致交互错乱。\n * 所以需要进行坐标转换,将旋转后的坐标转换后作为VRender及VTable逻辑中用到的坐标。\n * 这里使用transform:'rotate(90deg)'的设置来达到旋转的目的。 其他角度应该也是可以实现的,请自行扩展这个插件并兼容\n */\nexport class RotateTablePlugin implements VTable.plugins.IVTablePlugin {\n id = 'rotate-table';\n name = 'Rotate Table';\n runTime = [VTable.TABLE_EVENT_TYPE.INITIALIZED];\n table: VTable.ListTable;\n matrix: Matrix;\n vglobal_mapToCanvasPoint: any; // 保存vrender中vglobal的mapToCanvasPoint原方法\n // pluginOptions: IRotateTablePluginOptions;\n constructor() {\n // this.pluginOptions = pluginOptions;\n }\n run(...args: [EventArg, TableEvents[keyof TableEvents] | TableEvents[keyof TableEvents][], VTable.BaseTableAPI]) {\n const table: VTable.BaseTableAPI = args[2];\n this.table = table as VTable.ListTable;\n //将函数rotate90WithTransform绑定到table实例上\n this.table.rotate90WithTransform = rotate90WithTransform.bind(this.table);\n this.table.cancelTransform = cancelTransform.bind(this.table);\n }\n\n release() {\n // 移除绑定的事件\n }\n}\n\n/**\n * 业务层旋转功能没有使用收系统接口的话,用的transform:'rotate(90deg)'的设置来达到旋转的目的。vtable及vrender都没有进行坐标处理,这样就会导致交互错乱。\n * 所以需要进行坐标转换,将旋转后的坐标转换后作为VRender及VTable逻辑中用到的坐标。\n */\nexport function rotate90WithTransform(this: BaseTable, rotateDom: HTMLElement) {\n this.rotateDegree = 90;\n const rotateCenter =\n rotateDom.clientWidth < rotateDom.clientHeight\n ? Math.max(rotateDom.clientWidth, rotateDom.clientHeight) / 2\n : Math.min(rotateDom.clientWidth, rotateDom.clientHeight) / 2;\n const domRect = this.getElement().getBoundingClientRect();\n const x1 = domRect.left;\n const y1 = domRect.top;\n const x2 = domRect.right;\n const y2 = domRect.bottom;\n\n rotateDom.style.transform = 'rotate(90deg)';\n rotateDom.style.transformOrigin = `${rotateCenter}px ${rotateCenter}px`;\n const getRect = () => {\n return {\n x1,\n y1,\n x2,\n y2\n };\n };\n // 获取视口尺寸的通用方法\n const getViewportDimensions = () => {\n // 浏览器环境\n if (typeof window !== 'undefined') {\n return {\n width: window.innerWidth || document.documentElement.clientWidth,\n height: window.innerHeight || document.documentElement.clientHeight\n };\n }\n // 如果有 vglobal 上的方法可以使用\n if (vglobal && vglobal.getViewportSize) {\n return vglobal.getViewportSize();\n }\n // 默认使用容器的尺寸\n return rotateDom.getBoundingClientRect();\n };\n\n const getMatrix = () => {\n const viewPortWidth = getViewportDimensions().width; //获取整个视口的尺寸\n const domRect = this.getElement().getBoundingClientRect(); //TODO 这个地方应该获取窗口的宽高 最好能从vglobal上直接获取\n const x1 = domRect.top;\n const y1 = viewPortWidth - domRect.right;\n\n const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);\n matrix.translate(x1, y1);\n const centerX = rotateCenter - x1;\n const centerY = rotateCenter - y1;\n matrix.translate(centerX, centerY);\n matrix.rotate(Math.PI / 2);\n matrix.translate(-centerX, -centerY);\n const rotateRablePlugin = this.pluginManager.getPluginByName('Rotate Table');\n if (rotateRablePlugin) {\n (rotateRablePlugin as RotateTablePlugin).matrix = matrix;\n }\n return matrix;\n };\n registerGlobalEventTransformer(vglobal, this.getElement(), getMatrix, getRect, transformPointForCanvas);\n registerWindowEventTransformer(\n this.scenegraph.stage.window,\n this.getElement(),\n getMatrix,\n getRect,\n transformPointForCanvas\n );\n const rotateRablePlugin = this.pluginManager.getPluginByName('Rotate Table');\n if (rotateRablePlugin) {\n (rotateRablePlugin as RotateTablePlugin).vglobal_mapToCanvasPoint = vglobal.mapToCanvasPoint;\n }\n vglobal.mapToCanvasPoint = mapToCanvasPointForCanvas;\n //transformPointForCanvas和mapToCanvasPointForCanvas时相对应的\n //具体逻辑在 VRender/packages/vrender-core/src/common/event-transformer.ts中\n // 可以自定义这两个函数 来修改事件属性,transformPointForCanvas中将坐标转换后存放了_canvasX _canvasY,mapToCanvasPointForCanvas中加以利用\n // 在VTable的touch文件中,利用到了_canvasX _canvasY 所以如果自定义上面两个函数也需提供_canvasX _canvasY\n}\nexport function cancelTransform(this: BaseTable, rotateDom: HTMLElement) {\n this.rotateDegree = 0;\n rotateDom.style.transform = 'none';\n rotateDom.style.transformOrigin = 'none';\n const domRect = this.getElement().getBoundingClientRect();\n const x1 = domRect.left;\n const y1 = domRect.top;\n const x2 = domRect.right;\n const y2 = domRect.bottom;\n\n const getRect = () => {\n return {\n x1,\n y1,\n x2,\n y2\n };\n };\n const getMatrix = () => {\n const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);\n matrix.translate(x1, y1);\n return matrix;\n };\n registerGlobalEventTransformer(vglobal, this.getElement(), getMatrix, getRect, transformPointForCanvas);\n registerWindowEventTransformer(\n this.scenegraph.stage.window,\n this.getElement(),\n getMatrix,\n getRect,\n transformPointForCanvas\n );\n const rotateRablePlugin = this.pluginManager.getPluginByName('Rotate Table');\n if (rotateRablePlugin) {\n vglobal.mapToCanvasPoint = (rotateRablePlugin as RotateTablePlugin).vglobal_mapToCanvasPoint;\n }\n}\n"]}
@@ -3,10 +3,11 @@ export interface RowSeriesOptions {
3
3
  rowCount: number;
4
4
  fillRowRecord?: (index: number) => any;
5
5
  rowSeriesNumber?: TYPES.IRowSeriesNumber;
6
- autoExtendRow?: boolean;
6
+ autoExtendRowTriggerKeys?: ('ArrowDown' | 'Enter')[];
7
7
  }
8
8
  export declare class RowSeriesPlugin implements plugins.IVTablePlugin {
9
9
  id: string;
10
+ name: string;
10
11
  runTime: ("before_keydown" | "before_init")[];
11
12
  pluginOptions: RowSeriesOptions;
12
13
  table: ListTable;
package/cjs/row-series.js CHANGED
@@ -8,14 +8,13 @@ const vtable_1 = require("@visactor/vtable");
8
8
 
9
9
  class RowSeriesPlugin {
10
10
  constructor(pluginOptions) {
11
- this.id = "row-series", this.runTime = [ vtable_1.TABLE_EVENT_TYPE.BEFORE_INIT, vtable_1.TABLE_EVENT_TYPE.BEFORE_KEYDOWN ],
11
+ this.id = `row-series-${Date.now()}`, this.name = "Row Series", this.runTime = [ vtable_1.TABLE_EVENT_TYPE.BEFORE_INIT, vtable_1.TABLE_EVENT_TYPE.BEFORE_KEYDOWN ],
12
12
  this.pluginOptions = Object.assign({
13
- rowCount: 100,
14
- autoExtendRow: !0
13
+ rowCount: 100
15
14
  }, pluginOptions);
16
15
  }
17
16
  run(...args) {
18
- var _a;
17
+ var _a, _b;
19
18
  if (args[1] === vtable_1.TABLE_EVENT_TYPE.BEFORE_INIT) {
20
19
  const eventArgs = args[0], table = args[2];
21
20
  this.table = table;
@@ -26,7 +25,8 @@ class RowSeriesPlugin {
26
25
  width: "auto"
27
26
  });
28
27
  } else if (args[1] === vtable_1.TABLE_EVENT_TYPE.BEFORE_KEYDOWN) {
29
- "ArrowDown" === args[0].event.key && this.pluginOptions.autoExtendRow && this.table.stateManager.select.cellPos.row === this.table.rowCount - 1 && this.table.addRecord(this.pluginOptions.fillRowRecord ? this.pluginOptions.fillRowRecord(this.table.rowCount - this.table.columnHeaderLevelCount) : {});
28
+ const e = args[0].event;
29
+ (null === (_b = this.pluginOptions.autoExtendRowTriggerKeys) || void 0 === _b ? void 0 : _b.includes(e.key)) && this.table.stateManager.select.cellPos.row === this.table.rowCount - 1 && this.table.addRecord(this.pluginOptions.fillRowRecord ? this.pluginOptions.fillRowRecord(this.table.rowCount - this.table.columnHeaderLevelCount) : {});
30
30
  }
31
31
  }
32
32
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["row-series.ts"],"names":[],"mappings":";;;AAAA,6CAAoD;AAkBpD,MAAa,eAAe;IAM1B,YAAY,aAA+B;QAL3C,OAAE,GAAG,YAAY,CAAC;QAClB,YAAO,GAAG,CAAC,yBAAgB,CAAC,WAAW,EAAE,yBAAgB,CAAC,cAAc,CAAC,CAAC;QAKxE,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,EAAE,aAAa,CAAC,CAAC;IAC5F,CAAC;IACD,GAAG,CAAC,GAAG,IAAW;;QAChB,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,yBAAgB,CAAC,WAAW,EAAE;YAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAC1B,MAAM,KAAK,GAAiB,IAAI,CAAC,CAAC,CAAC,CAAC;YACpC,IAAI,CAAC,KAAK,GAAG,KAAkB,CAAC;YAChC,MAAM,OAAO,GAAgC,SAAS,CAAC,OAAO,CAAC;YAC/D,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,EAAE,CAAC;YAEtC,KAAK,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,a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3F,CAAC,CAAC,EAAE,CACP,CAAC;iBACH;aACF;SACF;IACH,CAAC;CACF;AAjDD,0CAiDC","file":"row-series.js","sourcesContent":["import { TABLE_EVENT_TYPE } from '@visactor/vtable';\nimport type { TYPES, BaseTableAPI, ListTable, ListTableConstructorOptions, plugins } from '@visactor/vtable';\n/**\n * 添加行和列的插件的配置选项\n */\nexport interface RowSeriesOptions {\n rowCount: number;\n fillRowRecord?: (index: number) => any;\n rowSeriesNumber?: TYPES.IRowSeriesNumber;\n /**\n * 是否自动扩展行\n * @default true\n */\n autoExtendRow?: boolean;\n}\n/**\n * 生成行序号标题的插件\n */\nexport class RowSeriesPlugin implements plugins.IVTablePlugin {\n id = 'row-series';\n runTime = [TABLE_EVENT_TYPE.BEFORE_INIT, TABLE_EVENT_TYPE.BEFORE_KEYDOWN];\n pluginOptions: RowSeriesOptions;\n table: ListTable;\n\n constructor(pluginOptions: RowSeriesOptions) {\n this.pluginOptions = Object.assign({ rowCount: 100, autoExtendRow: true }, pluginOptions);\n }\n run(...args: any[]) {\n if (args[1] === TABLE_EVENT_TYPE.BEFORE_INIT) {\n const eventArgs = args[0];\n const table: BaseTableAPI = args[2];\n this.table = table as ListTable;\n const options: ListTableConstructorOptions = eventArgs.options;\n const records = options.records ?? [];\n //用空数据将records填充到pluginOptions.rowCount\n for (let i = records.length; i < this.pluginOptions.rowCount; i++) {\n records.push(this.pluginOptions.fillRowRecord ? this.pluginOptions.fillRowRecord(i) : {});\n }\n options.records = records;\n if (this.pluginOptions.rowSeriesNumber) {\n options.rowSeriesNumber = this.pluginOptions.rowSeriesNumber;\n if (!this.pluginOptions.rowSeriesNumber.width) {\n options.rowSeriesNumber.width = 'auto';\n }\n } else if (!options.rowSeriesNumber) {\n options.rowSeriesNumber = {\n width: 'auto'\n };\n }\n } else if (args[1] === TABLE_EVENT_TYPE.BEFORE_KEYDOWN) {\n const eventArgs = args[0];\n\n const e = eventArgs.event;\n if (e.key === 'ArrowDown') {\n if (\n this.pluginOptions.autoExtendRow &&\n this.table.stateManager.select.cellPos.row === this.table.rowCount - 1\n ) {\n (this.table as ListTable).addRecord(\n this.pluginOptions.fillRowRecord\n ? this.pluginOptions.fillRowRecord(this.table.rowCount - this.table.columnHeaderLevelCount)\n : {}\n );\n }\n }\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["row-series.ts"],"names":[],"mappings":";;;AAAA,6CAAoD;AAkBpD,MAAa,eAAe;IAO1B,YAAY,aAA+B;QAN3C,OAAE,GAAG,cAAc,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QAChC,SAAI,GAAG,YAAY,CAAC;QACpB,YAAO,GAAG,CAAC,yBAAgB,CAAC,WAAW,EAAE,yBAAgB,CAAC,cAAc,CAAC,CAAC;QAKxE,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,aAAa,CAAC,CAAC;IACvE,CAAC;IACD,GAAG,CAAC,GAAG,IAAW;;QAChB,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,yBAAgB,CAAC,WAAW,EAAE;YAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAC1B,MAAM,KAAK,GAAiB,IAAI,CAAC,CAAC,CAAC,CAAC;YACpC,IAAI,CAAC,KAAK,GAAG,KAAkB,CAAC;YAChC,MAAM,OAAO,GAAgC,SAAS,CAAC,OAAO,CAAC;YAC/D,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,EAAE,CAAC;YAEtC,KAAK,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE;gBACjE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC3F;YACD,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;YAC1B,IAAI,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE;gBACtC,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC;gBAC7D,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,KAAK,EAAE;oBAC7C,OAAO,CAAC,eAAe,CAAC,KAAK,GAAG,MAAM,CAAC;iBACxC;aACF;iBAAM,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE;gBACnC,OAAO,CAAC,eAAe,GAAG;oBACxB,KAAK,EAAE,MAAM;iBACd,CAAC;aACH;SACF;aAAM,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,yBAAgB,CAAC,cAAc,EAAE;YACtD,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAE1B,MAAM,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC;YAE1B,IACE,CAAA,MAAA,IAAI,CAAC,aAAa,CAAC,wBAAwB,0CAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC;gBAC5D,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,KAAK,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,EACtE;gBACC,IAAI,CAAC,KAAmB,CAAC,SAAS,CACjC,IAAI,CAAC,aAAa,CAAC,aAAa;oBAC9B,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC;oBAC3F,CAAC,CAAC,EAAE,CACP,CAAC;aACH;SACF;IACH,CAAC;CACF;AAjDD,0CAiDC","file":"row-series.js","sourcesContent":["import { TABLE_EVENT_TYPE } from '@visactor/vtable';\nimport type { TYPES, BaseTableAPI, ListTable, ListTableConstructorOptions, plugins } from '@visactor/vtable';\n/**\n * 添加行和列的插件的配置选项\n */\nexport interface RowSeriesOptions {\n rowCount: number;\n fillRowRecord?: (index: number) => any;\n rowSeriesNumber?: TYPES.IRowSeriesNumber;\n /**\n * 是否自动扩展行\n * @default true\n */\n autoExtendRowTriggerKeys?: ('ArrowDown' | 'Enter')[];\n}\n/**\n * 生成行序号标题的插件\n */\nexport class RowSeriesPlugin implements plugins.IVTablePlugin {\n id = `row-series-${Date.now()}`;\n name = 'Row Series';\n runTime = [TABLE_EVENT_TYPE.BEFORE_INIT, TABLE_EVENT_TYPE.BEFORE_KEYDOWN];\n pluginOptions: RowSeriesOptions;\n table: ListTable;\n\n constructor(pluginOptions: RowSeriesOptions) {\n this.pluginOptions = Object.assign({ rowCount: 100 }, pluginOptions);\n }\n run(...args: any[]) {\n if (args[1] === TABLE_EVENT_TYPE.BEFORE_INIT) {\n const eventArgs = args[0];\n const table: BaseTableAPI = args[2];\n this.table = table as ListTable;\n const options: ListTableConstructorOptions = eventArgs.options;\n const records = options.records ?? [];\n //用空数据将records填充到pluginOptions.rowCount\n for (let i = records.length; i < this.pluginOptions.rowCount; i++) {\n records.push(this.pluginOptions.fillRowRecord ? this.pluginOptions.fillRowRecord(i) : {});\n }\n options.records = records;\n if (this.pluginOptions.rowSeriesNumber) {\n options.rowSeriesNumber = this.pluginOptions.rowSeriesNumber;\n if (!this.pluginOptions.rowSeriesNumber.width) {\n options.rowSeriesNumber.width = 'auto';\n }\n } else if (!options.rowSeriesNumber) {\n options.rowSeriesNumber = {\n width: 'auto'\n };\n }\n } else if (args[1] === TABLE_EVENT_TYPE.BEFORE_KEYDOWN) {\n const eventArgs = args[0];\n\n const e = eventArgs.event;\n\n if (\n this.pluginOptions.autoExtendRowTriggerKeys?.includes(e.key) &&\n this.table.stateManager.select.cellPos.row === this.table.rowCount - 1\n ) {\n (this.table as ListTable).addRecord(\n this.pluginOptions.fillRowRecord\n ? this.pluginOptions.fillRowRecord(this.table.rowCount - this.table.columnHeaderLevelCount)\n : {}\n );\n }\n }\n }\n}\n"]}
@@ -20,6 +20,7 @@ export interface ITableCarouselAnimationPluginOptions {
20
20
  }
21
21
  export declare class TableCarouselAnimationPlugin implements VTable.plugins.IVTablePlugin {
22
22
  id: string;
23
+ name: string;
23
24
  runTime: "initialized"[];
24
25
  table: BaseTableAPI;
25
26
  rowCount: number;
@@ -13,8 +13,9 @@ function isInteger(value) {
13
13
  class TableCarouselAnimationPlugin {
14
14
  constructor(options = {}) {
15
15
  var _a, _b, _c, _d, _e, _f, _g;
16
- this.id = "table-carousel-animation", this.runTime = [ vtable_1.TABLE_EVENT_TYPE.INITIALIZED ],
17
- this.willUpdateRow = !1, this.willUpdateCol = !1, this.rowCount = null !== (_a = null == options ? void 0 : options.rowCount) && void 0 !== _a ? _a : void 0,
16
+ this.id = `table-carousel-animation-${Date.now()}`, this.name = "Table Carousel Animation",
17
+ this.runTime = [ vtable_1.TABLE_EVENT_TYPE.INITIALIZED ], this.willUpdateRow = !1,
18
+ this.willUpdateCol = !1, this.rowCount = null !== (_a = null == options ? void 0 : options.rowCount) && void 0 !== _a ? _a : void 0,
18
19
  this.colCount = null !== (_b = null == options ? void 0 : options.colCount) && void 0 !== _b ? _b : void 0,
19
20
  this.animationDuration = null !== (_c = null == options ? void 0 : options.animationDuration) && void 0 !== _c ? _c : 500,
20
21
  this.animationDelay = null !== (_d = null == options ? void 0 : options.animationDelay) && void 0 !== _d ? _d : 1e3,
@@ -1 +1 @@
1
- {"version":3,"sources":["table-carousel-animation.ts"],"names":[],"mappings":";;;AAEA,6CAAoD;AAEpD,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC;AACrC,CAAC;AAeD,MAAa,4BAA4B;IAqBvC,YAAY,UAAgD,EAAE;;QApB9D,OAAE,GAAG,0BAA0B,CAAC;QAChC,YAAO,GAAG,CAAC,yBAAgB,CAAC,WAAW,CAAC,CAAC;QAYzC,kBAAa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,SAAS,CAAC,SAAS,mCAAI,IAAI,CAAC;SACzC;aAAM,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC,GAAG,EAAE;YACxF,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;YACrC,SAAS,GAAG,KAAK,CAAC;SACnB;aAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YACrG,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;YACrC,SAAS,GAAG,KAAK,CAAC;SACnB;aAAM;YACL,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC;SAC3B;QAED,IAAI,CAAC,KAAK,CAAC,WAAW,CACpB,IAAI,CAAC,GAAG,EACR,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAAE,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,SAAS,CAC3F,CAAC;QAEF,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,UAAU,CACR,GAAG,EAAE;YACH,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;YAC3B,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,CAAC,EAED,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAC7C,CAAC;IACJ,CAAC;IACD,OAAO;IAEP,CAAC;CACF;AA5ID,oEA4IC","file":"table-carousel-animation.js","sourcesContent":["import type { EasingType } from '@visactor/vtable/es/vrender';\nimport type { BaseTableAPI } from '@visactor/vtable/es/ts-types/base-table';\nimport { TABLE_EVENT_TYPE } from '@visactor/vtable';\nimport type * as VTable from '@visactor/vtable';\nfunction isInteger(value: number) {\n return Math.floor(value) === value;\n}\n\nexport interface ITableCarouselAnimationPluginOptions {\n rowCount?: number;\n colCount?: number;\n animationDuration?: number;\n animationDelay?: number;\n animationEasing?: EasingType;\n autoPlay?: boolean;\n autoPlayDelay?: number;\n\n customDistRowFunction?: (row: number, table: BaseTableAPI) => { distRow: number; animation?: boolean } | undefined;\n customDistColFunction?: (col: number, table: BaseTableAPI) => { distCol: number; animation?: boolean } | undefined;\n}\n\nexport class TableCarouselAnimationPlugin implements VTable.plugins.IVTablePlugin {\n id = 'table-carousel-animation';\n runTime = [TABLE_EVENT_TYPE.INITIALIZED];\n table: BaseTableAPI;\n\n rowCount: number;\n colCount: number;\n animationDuration: number;\n animationDelay: number;\n animationEasing: EasingType;\n\n playing: boolean;\n row: number;\n col: number;\n willUpdateRow: boolean = false;\n willUpdateCol: boolean = false;\n autoPlay: boolean;\n autoPlayDelay: number;\n\n customDistRowFunction?: (row: number, table: BaseTableAPI) => { distRow: number; animation?: boolean } | undefined;\n customDistColFunction?: (col: number, table: BaseTableAPI) => { distCol: number; animation?: boolean } | undefined;\n constructor(options: ITableCarouselAnimationPluginOptions = {}) {\n this.rowCount = options?.rowCount ?? undefined;\n this.colCount = options?.colCount ?? undefined;\n this.animationDuration = options?.animationDuration ?? 500;\n this.animationDelay = options?.animationDelay ?? 1000;\n this.animationEasing = options?.animationEasing ?? 'linear';\n this.autoPlay = options?.autoPlay ?? false;\n this.autoPlayDelay = options?.autoPlayDelay ?? 0;\n this.customDistColFunction = options.customDistColFunction;\n this.customDistRowFunction = options.customDistRowFunction;\n }\n run(...args: any[]) {\n if (!this.table) {\n this.table = args[2] as BaseTableAPI;\n }\n this.reset();\n\n if (this.autoPlay) {\n setTimeout(() => {\n this.play();\n }, this.autoPlayDelay);\n }\n }\n\n reset() {\n this.playing = false;\n this.row = this.table.frozenRowCount;\n this.col = this.table.frozenColCount;\n }\n\n play() {\n if (!this.table) {\n throw new Error('table is not initialized');\n }\n this.playing = true;\n\n if (this.rowCount && !this.willUpdateRow) {\n this.updateRow();\n } else if (this.colCount && !this.willUpdateCol) {\n this.updateCol();\n }\n }\n\n pause() {\n this.playing = false;\n }\n\n updateRow() {\n if (!this.playing || this.table.isReleased) {\n return;\n }\n\n let animation = true;\n const customRow = this.customDistRowFunction && this.customDistRowFunction(this.row, this.table);\n if (customRow) {\n this.row = customRow.distRow;\n animation = customRow.animation ?? true;\n } else if (isInteger(this.row) && this.table.scenegraph.proxy.screenTopRow !== this.row) {\n this.row = this.table.frozenRowCount;\n animation = false;\n } else if (!isInteger(this.row) && this.table.scenegraph.proxy.screenTopRow !== Math.floor(this.row)) {\n this.row = this.table.frozenRowCount;\n animation = false;\n } else {\n this.row += this.rowCount;\n }\n this.table.scrollToRow(\n this.row,\n animation ? { duration: this.animationDuration, easing: this.animationEasing } : undefined\n );\n this.willUpdateRow = true;\n setTimeout(\n () => {\n this.willUpdateRow = false;\n this.updateRow();\n },\n // animation ? this.animationDuration + this.animationDelay : 0\n this.animationDuration + this.animationDelay\n );\n }\n\n updateCol() {\n if (!this.playing || this.table.isReleased) {\n return;\n }\n\n let animation = true;\n const customCol = this.customDistColFunction && this.customDistColFunction(this.col, this.table);\n if (customCol) {\n this.col = customCol.distCol;\n animation = customCol.animation ?? true;\n } else if (isInteger(this.col) && this.table.scenegraph.proxy.screenLeftCol !== this.col) {\n this.col = this.table.frozenColCount;\n animation = false;\n } else if (!isInteger(this.col) && this.table.scenegraph.proxy.screenLeftCol !== Math.floor(this.col)) {\n this.col = this.table.frozenColCount;\n animation = false;\n } else {\n this.col += this.colCount;\n }\n\n this.table.scrollToCol(\n this.col,\n animation ? { duration: this.animationDuration, easing: this.animationEasing } : undefined\n );\n\n this.willUpdateCol = true;\n setTimeout(\n () => {\n this.willUpdateCol = false;\n this.updateCol();\n },\n // animation ? this.animationDuration + this.animationDelay : 0\n this.animationDuration + this.animationDelay\n );\n }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AAC,SAAS,CAC3F,CAAC;QAEF,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,UAAU,CACR,GAAG,EAAE;YACH,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;YAC3B,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,CAAC,EAED,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAC7C,CAAC;IACJ,CAAC;IACD,OAAO;IAEP,CAAC;CACF;AA7ID,oEA6IC","file":"table-carousel-animation.js","sourcesContent":["import type { EasingType } from '@visactor/vtable/es/vrender';\nimport type { BaseTableAPI } from '@visactor/vtable/es/ts-types/base-table';\nimport { TABLE_EVENT_TYPE } from '@visactor/vtable';\nimport type * as VTable from '@visactor/vtable';\nfunction isInteger(value: number) {\n return Math.floor(value) === value;\n}\n\nexport interface ITableCarouselAnimationPluginOptions {\n rowCount?: number;\n colCount?: number;\n animationDuration?: number;\n animationDelay?: number;\n animationEasing?: EasingType;\n autoPlay?: boolean;\n autoPlayDelay?: number;\n\n customDistRowFunction?: (row: number, table: BaseTableAPI) => { distRow: number; animation?: boolean } | undefined;\n customDistColFunction?: (col: number, table: BaseTableAPI) => { distCol: number; animation?: boolean } | undefined;\n}\n\nexport class TableCarouselAnimationPlugin implements VTable.plugins.IVTablePlugin {\n id = `table-carousel-animation-${Date.now()}`;\n name = 'Table Carousel Animation';\n runTime = [TABLE_EVENT_TYPE.INITIALIZED];\n table: BaseTableAPI;\n\n rowCount: number;\n colCount: number;\n animationDuration: number;\n animationDelay: number;\n animationEasing: EasingType;\n\n playing: boolean;\n row: number;\n col: number;\n willUpdateRow: boolean = false;\n willUpdateCol: boolean = false;\n autoPlay: boolean;\n autoPlayDelay: number;\n\n customDistRowFunction?: (row: number, table: BaseTableAPI) => { distRow: number; animation?: boolean } | undefined;\n customDistColFunction?: (col: number, table: BaseTableAPI) => { distCol: number; animation?: boolean } | undefined;\n constructor(options: ITableCarouselAnimationPluginOptions = {}) {\n this.rowCount = options?.rowCount ?? undefined;\n this.colCount = options?.colCount ?? undefined;\n this.animationDuration = options?.animationDuration ?? 500;\n this.animationDelay = options?.animationDelay ?? 1000;\n this.animationEasing = options?.animationEasing ?? 'linear';\n this.autoPlay = options?.autoPlay ?? false;\n this.autoPlayDelay = options?.autoPlayDelay ?? 0;\n this.customDistColFunction = options.customDistColFunction;\n this.customDistRowFunction = options.customDistRowFunction;\n }\n run(...args: any[]) {\n if (!this.table) {\n this.table = args[2] as BaseTableAPI;\n }\n this.reset();\n\n if (this.autoPlay) {\n setTimeout(() => {\n this.play();\n }, this.autoPlayDelay);\n }\n }\n\n reset() {\n this.playing = false;\n this.row = this.table.frozenRowCount;\n this.col = this.table.frozenColCount;\n }\n\n play() {\n if (!this.table) {\n throw new Error('table is not initialized');\n }\n this.playing = true;\n\n if (this.rowCount && !this.willUpdateRow) {\n this.updateRow();\n } else if (this.colCount && !this.willUpdateCol) {\n this.updateCol();\n }\n }\n\n pause() {\n this.playing = false;\n }\n\n updateRow() {\n if (!this.playing || this.table.isReleased) {\n return;\n }\n\n let animation = true;\n const customRow = this.customDistRowFunction && this.customDistRowFunction(this.row, this.table);\n if (customRow) {\n this.row = customRow.distRow;\n animation = customRow.animation ?? true;\n } else if (isInteger(this.row) && this.table.scenegraph.proxy.screenTopRow !== this.row) {\n this.row = this.table.frozenRowCount;\n animation = false;\n } else if (!isInteger(this.row) && this.table.scenegraph.proxy.screenTopRow !== Math.floor(this.row)) {\n this.row = this.table.frozenRowCount;\n animation = false;\n } else {\n this.row += this.rowCount;\n }\n this.table.scrollToRow(\n this.row,\n animation ? { duration: this.animationDuration, easing: this.animationEasing } : undefined\n );\n this.willUpdateRow = true;\n setTimeout(\n () => {\n this.willUpdateRow = false;\n this.updateRow();\n },\n // animation ? this.animationDuration + this.animationDelay : 0\n this.animationDuration + this.animationDelay\n );\n }\n\n updateCol() {\n if (!this.playing || this.table.isReleased) {\n return;\n }\n\n let animation = true;\n const customCol = this.customDistColFunction && this.customDistColFunction(this.col, this.table);\n if (customCol) {\n this.col = customCol.distCol;\n animation = customCol.animation ?? true;\n } else if (isInteger(this.col) && this.table.scenegraph.proxy.screenLeftCol !== this.col) {\n this.col = this.table.frozenColCount;\n animation = false;\n } else if (!isInteger(this.col) && this.table.scenegraph.proxy.screenLeftCol !== Math.floor(this.col)) {\n this.col = this.table.frozenColCount;\n animation = false;\n } else {\n this.col += this.colCount;\n }\n\n this.table.scrollToCol(\n this.col,\n animation ? { duration: this.animationDuration, easing: this.animationEasing } : undefined\n );\n\n this.willUpdateCol = true;\n setTimeout(\n () => {\n this.willUpdateCol = false;\n this.updateCol();\n },\n // animation ? this.animationDuration + this.animationDelay : 0\n this.animationDuration + this.animationDelay\n );\n }\n release() {\n // do nothing\n }\n}\n"]}
@@ -12066,7 +12066,8 @@
12066
12066
  }
12067
12067
 
12068
12068
  class AddRowColumnPlugin {
12069
- id = 'add-row-column';
12069
+ id = `add-row-column-${Date.now()}`;
12070
+ name = 'Add Row Column';
12070
12071
  runTime = [
12071
12072
  VTable__namespace.TABLE_EVENT_TYPE.MOUSEENTER_CELL,
12072
12073
  VTable__namespace.TABLE_EVENT_TYPE.MOUSELEAVE_CELL,
@@ -12410,13 +12411,14 @@
12410
12411
  }
12411
12412
 
12412
12413
  class ColumnSeriesPlugin {
12413
- id = 'column-series';
12414
+ id = `column-series-${Date.now()}`;
12415
+ name = 'Column Series';
12414
12416
  runTime = [VTable__namespace.TABLE_EVENT_TYPE.BEFORE_INIT, VTable__namespace.TABLE_EVENT_TYPE.BEFORE_KEYDOWN];
12415
12417
  pluginOptions;
12416
12418
  table;
12417
12419
  columns = [];
12418
12420
  constructor(pluginOptions) {
12419
- this.pluginOptions = Object.assign({ columnCount: 100, autoExtendColumn: true }, pluginOptions);
12421
+ this.pluginOptions = Object.assign({ columnCount: 100 }, pluginOptions);
12420
12422
  }
12421
12423
  run(...args) {
12422
12424
  if (args[1] === VTable__namespace.TABLE_EVENT_TYPE.BEFORE_INIT) {
@@ -12430,9 +12432,8 @@
12430
12432
  else if (args[1] === VTable__namespace.TABLE_EVENT_TYPE.BEFORE_KEYDOWN) {
12431
12433
  const eventArgs = args[0];
12432
12434
  const e = eventArgs.event;
12433
- if (e.key === 'ArrowRight') {
12434
- if (this.pluginOptions.autoExtendColumn &&
12435
- this.table.stateManager.select.cellPos.col === this.table.colCount - 1) {
12435
+ if (this.pluginOptions.autoExtendColumnTriggerKeys?.includes(e.key)) {
12436
+ if (this.table.stateManager.select.cellPos.col === this.table.colCount - 1) {
12436
12437
  this.table.addColumn(this.generateColumn(this.table.colCount - 1));
12437
12438
  }
12438
12439
  }
@@ -12474,12 +12475,13 @@
12474
12475
  }
12475
12476
 
12476
12477
  class RowSeriesPlugin {
12477
- id = 'row-series';
12478
+ id = `row-series-${Date.now()}`;
12479
+ name = 'Row Series';
12478
12480
  runTime = [VTable.TABLE_EVENT_TYPE.BEFORE_INIT, VTable.TABLE_EVENT_TYPE.BEFORE_KEYDOWN];
12479
12481
  pluginOptions;
12480
12482
  table;
12481
12483
  constructor(pluginOptions) {
12482
- this.pluginOptions = Object.assign({ rowCount: 100, autoExtendRow: true }, pluginOptions);
12484
+ this.pluginOptions = Object.assign({ rowCount: 100 }, pluginOptions);
12483
12485
  }
12484
12486
  run(...args) {
12485
12487
  if (args[1] === VTable.TABLE_EVENT_TYPE.BEFORE_INIT) {
@@ -12507,20 +12509,19 @@
12507
12509
  else if (args[1] === VTable.TABLE_EVENT_TYPE.BEFORE_KEYDOWN) {
12508
12510
  const eventArgs = args[0];
12509
12511
  const e = eventArgs.event;
12510
- if (e.key === 'ArrowDown') {
12511
- if (this.pluginOptions.autoExtendRow &&
12512
- this.table.stateManager.select.cellPos.row === this.table.rowCount - 1) {
12513
- this.table.addRecord(this.pluginOptions.fillRowRecord
12514
- ? this.pluginOptions.fillRowRecord(this.table.rowCount - this.table.columnHeaderLevelCount)
12515
- : {});
12516
- }
12512
+ if (this.pluginOptions.autoExtendRowTriggerKeys?.includes(e.key) &&
12513
+ this.table.stateManager.select.cellPos.row === this.table.rowCount - 1) {
12514
+ this.table.addRecord(this.pluginOptions.fillRowRecord
12515
+ ? this.pluginOptions.fillRowRecord(this.table.rowCount - this.table.columnHeaderLevelCount)
12516
+ : {});
12517
12517
  }
12518
12518
  }
12519
12519
  }
12520
12520
  }
12521
12521
 
12522
12522
  class HighlightHeaderWhenSelectCellPlugin {
12523
- id = 'highlight-header-when-select-cell';
12523
+ id = `highlight-header-when-select-cell-${Date.now()}`;
12524
+ name = 'Highlight Header When Select Cell';
12524
12525
  runTime = [
12525
12526
  VTable.TABLE_EVENT_TYPE.INITIALIZED,
12526
12527
  VTable.TABLE_EVENT_TYPE.SELECTED_CLEAR,
@@ -12661,6 +12662,10 @@
12661
12662
  }
12662
12663
  }
12663
12664
  }
12665
+ update() {
12666
+ this.registerStyle();
12667
+ this.updateHighlight();
12668
+ }
12664
12669
  release() {
12665
12670
  this.rowHeaderRanges = [];
12666
12671
  this.colHeaderRanges = [];
@@ -12677,7 +12682,8 @@
12677
12682
  }
12678
12683
 
12679
12684
  class ExcelEditCellKeyboardPlugin {
12680
- id = 'excel-edit-cell-keyboard';
12685
+ id = `excel-edit-cell-keyboard-${Date.now()}`;
12686
+ name = 'Excel Edit Cell Keyboard';
12681
12687
  runTime = [VTable__namespace.TABLE_EVENT_TYPE.INITIALIZED];
12682
12688
  table;
12683
12689
  pluginOptions;
@@ -12769,7 +12775,7 @@
12769
12775
  }
12770
12776
 
12771
12777
  class FocusHighlightPlugin {
12772
- id = 'focus-highlight';
12778
+ id = `focus-highlight-${Date.now()}`;
12773
12779
  name = 'Focus Highlight';
12774
12780
  runTime = [VTable.TABLE_EVENT_TYPE.INITIALIZED, VTable.TABLE_EVENT_TYPE.SELECTED_CELL, VTable.TABLE_EVENT_TYPE.SELECTED_CLEAR];
12775
12781
  table;
@@ -12813,7 +12819,7 @@
12813
12819
  this.setFocusHighlightRange(undefined);
12814
12820
  }
12815
12821
  }
12816
- setFocusHighlightRange(range) {
12822
+ setFocusHighlightRange(range, forceUpdate = false) {
12817
12823
  let cellRange;
12818
12824
  if (range && 'start' in range && 'end' in range) {
12819
12825
  cellRange = range;
@@ -12824,7 +12830,7 @@
12824
12830
  end: range
12825
12831
  };
12826
12832
  }
12827
- if (isSameRange$2(this.range, cellRange)) {
12833
+ if (isSameRange$2(this.range, cellRange) && !forceUpdate) {
12828
12834
  return;
12829
12835
  }
12830
12836
  this.range = cellRange;
@@ -12899,13 +12905,17 @@
12899
12905
  }
12900
12906
  });
12901
12907
  }
12908
+ update() {
12909
+ this.setFocusHighlightRange(this.range, true);
12910
+ }
12902
12911
  }
12903
12912
 
12904
12913
  function isInteger(value) {
12905
12914
  return Math.floor(value) === value;
12906
12915
  }
12907
12916
  class TableCarouselAnimationPlugin {
12908
- id = 'table-carousel-animation';
12917
+ id = `table-carousel-animation-${Date.now()}`;
12918
+ name = 'Table Carousel Animation';
12909
12919
  runTime = [VTable.TABLE_EVENT_TYPE.INITIALIZED];
12910
12920
  table;
12911
12921
  rowCount;
@@ -13026,8 +13036,10 @@
13026
13036
 
13027
13037
  class RotateTablePlugin {
13028
13038
  id = 'rotate-table';
13039
+ name = 'Rotate Table';
13029
13040
  runTime = [VTable__namespace.TABLE_EVENT_TYPE.INITIALIZED];
13030
13041
  table;
13042
+ matrix;
13031
13043
  vglobal_mapToCanvasPoint;
13032
13044
  constructor() {
13033
13045
  }
@@ -13042,7 +13054,9 @@
13042
13054
  }
13043
13055
  function rotate90WithTransform(rotateDom) {
13044
13056
  this.rotateDegree = 90;
13045
- const rotateCenter = Math.min(rotateDom.clientWidth, rotateDom.clientHeight) / 2;
13057
+ const rotateCenter = rotateDom.clientWidth < rotateDom.clientHeight
13058
+ ? Math.max(rotateDom.clientWidth, rotateDom.clientHeight) / 2
13059
+ : Math.min(rotateDom.clientWidth, rotateDom.clientHeight) / 2;
13046
13060
  const domRect = this.getElement().getBoundingClientRect();
13047
13061
  const x1 = domRect.left;
13048
13062
  const y1 = domRect.top;
@@ -13058,11 +13072,23 @@
13058
13072
  y2
13059
13073
  };
13060
13074
  };
13075
+ const getViewportDimensions = () => {
13076
+ if (typeof window !== 'undefined') {
13077
+ return {
13078
+ width: window.innerWidth || document.documentElement.clientWidth,
13079
+ height: window.innerHeight || document.documentElement.clientHeight
13080
+ };
13081
+ }
13082
+ if (vglobal && vglobal.getViewportSize) {
13083
+ return vglobal.getViewportSize();
13084
+ }
13085
+ return rotateDom.getBoundingClientRect();
13086
+ };
13061
13087
  const getMatrix = () => {
13062
- const containerRect = rotateDom.getBoundingClientRect();
13088
+ const viewPortWidth = getViewportDimensions().width;
13063
13089
  const domRect = this.getElement().getBoundingClientRect();
13064
13090
  const x1 = domRect.top;
13065
- const y1 = containerRect.width - domRect.right;
13091
+ const y1 = viewPortWidth - domRect.right;
13066
13092
  const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);
13067
13093
  matrix.translate(x1, y1);
13068
13094
  const centerX = rotateCenter - x1;
@@ -13070,11 +13096,18 @@
13070
13096
  matrix.translate(centerX, centerY);
13071
13097
  matrix.rotate(Math.PI / 2);
13072
13098
  matrix.translate(-centerX, -centerY);
13099
+ const rotateRablePlugin = this.pluginManager.getPluginByName('Rotate Table');
13100
+ if (rotateRablePlugin) {
13101
+ rotateRablePlugin.matrix = matrix;
13102
+ }
13073
13103
  return matrix;
13074
13104
  };
13075
13105
  registerGlobalEventTransformer(vglobal, this.getElement(), getMatrix, getRect, transformPointForCanvas);
13076
13106
  registerWindowEventTransformer(this.scenegraph.stage.window, this.getElement(), getMatrix, getRect, transformPointForCanvas);
13077
- this.vglobal_mapToCanvasPoint = vglobal.mapToCanvasPoint;
13107
+ const rotateRablePlugin = this.pluginManager.getPluginByName('Rotate Table');
13108
+ if (rotateRablePlugin) {
13109
+ rotateRablePlugin.vglobal_mapToCanvasPoint = vglobal.mapToCanvasPoint;
13110
+ }
13078
13111
  vglobal.mapToCanvasPoint = mapToCanvasPointForCanvas;
13079
13112
  }
13080
13113
  function cancelTransform(rotateDom) {
@@ -13101,7 +13134,10 @@
13101
13134
  };
13102
13135
  registerGlobalEventTransformer(vglobal, this.getElement(), getMatrix, getRect, transformPointForCanvas);
13103
13136
  registerWindowEventTransformer(this.scenegraph.stage.window, this.getElement(), getMatrix, getRect, transformPointForCanvas);
13104
- vglobal.mapToCanvasPoint = this.vglobal_mapToCanvasPoint;
13137
+ const rotateRablePlugin = this.pluginManager.getPluginByName('Rotate Table');
13138
+ if (rotateRablePlugin) {
13139
+ vglobal.mapToCanvasPoint = rotateRablePlugin.vglobal_mapToCanvasPoint;
13140
+ }
13105
13141
  }
13106
13142
 
13107
13143
  exports.AddRowColumnPlugin = AddRowColumnPlugin;