@visactor/react-vtable 0.15.0-alpha.2 → 0.15.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 (62) hide show
  1. package/README.md +24 -82
  2. package/cjs/components/component/menu.d.ts +1 -1
  3. package/cjs/components/component/menu.js.map +1 -1
  4. package/cjs/components/list/list-column.d.ts +2 -2
  5. package/cjs/components/list/list-column.js.map +1 -1
  6. package/cjs/components/pivot/pivot-corner.d.ts +2 -2
  7. package/cjs/components/pivot/pivot-corner.js.map +1 -1
  8. package/cjs/components/pivot/pivot-dimension.d.ts +3 -3
  9. package/cjs/components/pivot/pivot-dimension.js.map +1 -1
  10. package/cjs/components/pivot/pivot-header-title.d.ts +3 -3
  11. package/cjs/components/pivot/pivot-header-title.js.map +1 -1
  12. package/cjs/components/pivot/pivot-indicator.d.ts +2 -2
  13. package/cjs/components/pivot/pivot-indicator.js.map +1 -1
  14. package/cjs/context/table.d.ts +1 -1
  15. package/cjs/context/table.js.map +1 -1
  16. package/cjs/eventsUtils.d.ts +40 -40
  17. package/cjs/eventsUtils.js +1 -1
  18. package/cjs/eventsUtils.js.map +1 -1
  19. package/cjs/index_old.js +2 -2
  20. package/cjs/index_old.js.map +1 -1
  21. package/cjs/tables/base-table.d.ts +1 -1
  22. package/cjs/tables/base-table.js +4 -2
  23. package/cjs/tables/base-table.js.map +1 -1
  24. package/cjs/tables/list-table.d.ts +3 -3
  25. package/cjs/tables/list-table.js.map +1 -1
  26. package/cjs/tables/pivot-chart.d.ts +3 -3
  27. package/cjs/tables/pivot-chart.js +1 -1
  28. package/cjs/tables/pivot-chart.js.map +1 -1
  29. package/cjs/tables/pivot-table.d.ts +3 -3
  30. package/cjs/tables/pivot-table.js.map +1 -1
  31. package/dist/react-vtable.js +1 -1
  32. package/dist/react-vtable.min.js +1 -1
  33. package/es/components/component/menu.d.ts +1 -1
  34. package/es/components/component/menu.js.map +1 -1
  35. package/es/components/list/list-column.d.ts +2 -2
  36. package/es/components/list/list-column.js.map +1 -1
  37. package/es/components/pivot/pivot-corner.d.ts +2 -2
  38. package/es/components/pivot/pivot-corner.js.map +1 -1
  39. package/es/components/pivot/pivot-dimension.d.ts +3 -3
  40. package/es/components/pivot/pivot-dimension.js.map +1 -1
  41. package/es/components/pivot/pivot-header-title.d.ts +3 -3
  42. package/es/components/pivot/pivot-header-title.js.map +1 -1
  43. package/es/components/pivot/pivot-indicator.d.ts +2 -2
  44. package/es/components/pivot/pivot-indicator.js.map +1 -1
  45. package/es/context/table.d.ts +1 -1
  46. package/es/context/table.js.map +1 -1
  47. package/es/eventsUtils.d.ts +40 -40
  48. package/es/eventsUtils.js +1 -1
  49. package/es/eventsUtils.js.map +1 -1
  50. package/es/index_old.js +1 -1
  51. package/es/index_old.js.map +1 -1
  52. package/es/tables/base-table.d.ts +1 -1
  53. package/es/tables/base-table.js +4 -2
  54. package/es/tables/base-table.js.map +1 -1
  55. package/es/tables/list-table.d.ts +3 -3
  56. package/es/tables/list-table.js.map +1 -1
  57. package/es/tables/pivot-chart.d.ts +3 -3
  58. package/es/tables/pivot-chart.js +1 -1
  59. package/es/tables/pivot-chart.js.map +1 -1
  60. package/es/tables/pivot-table.d.ts +3 -3
  61. package/es/tables/pivot-table.js.map +1 -1
  62. package/package.json +5 -5
package/README.md CHANGED
@@ -10,118 +10,60 @@
10
10
 
11
11
  <div align="center">
12
12
 
13
- VTable is not just a high-performance multidimensional data analysis table, but also a grid artist that creates art between rows and columns.
13
+ VTable is not just a high-performance multidimensional data analysis table, but also a grid artist that creates art between rows and columns.React-VTable is a React wrapper of VTable.
14
14
 
15
- <p align="center">
16
- <a href="">Introduction</a> •
17
- <a href="">demo</a> •
18
- <a href="">Tutorial</a> •
19
- <a href="">API</a>•
20
- </p>
21
-
22
- [![npm Version](https://img.shields.io/npm/v/@visactor/vtable.svg)](https://www.npmjs.com/package/@visactor/vtable)
23
- [![npm Download](https://img.shields.io/npm/dm/@visactor/vtable.svg)](https://www.npmjs.com/package/@visactor/vtable)
15
+ [![npm Version](https://img.shields.io/npm/v/@visactor/vtable.svg)](https://www.npmjs.com/package/@visactor/react-vtable)
16
+ [![npm Download](https://img.shields.io/npm/dm/@visactor/vtable.svg)](https://www.npmjs.com/package/@visactor/react-vvtable)
24
17
  [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/visactor/vtable/blob/main/LICENSE)
25
18
 
26
19
  </div>
27
20
 
28
- <div align="center">
29
-
30
- English| [简体中文](./README.zh-CN.md)
31
-
32
- </div>
33
-
34
- <div align="center">
35
-
36
- (video)
37
-
38
- </div>
39
-
40
- # Introduction
41
-
42
- VTable is a canvas table library based on visual rendering engine [VRender](https://github.com/VisActor/VRender).
43
-
44
- The core capabilities are as follows:
45
-
46
- 1. Extreme performance: Supports fast computation and rendering of millions of data points.
47
- 2. Multidimensional analysis: Automatically analyzes and presents multidimensional data.
48
- 3. Strong expressiveness: Provides flexible and powerful graphic capabilities, seamlessly integrating with charts of [VChart](https://github.com/VisActor/VChart).
49
-
50
- # Repo Intro
51
-
52
- This repository includes the following packages:
53
-
54
- 1. vtable: VTable components
55
- 2. vtable-docs: VTable documentation
56
-
57
21
  # Usage
58
22
 
59
23
  ## Installation
60
24
 
61
- [npm package](https://www.npmjs.com/package/@visactor/vtable)
25
+ [npm package](https://www.npmjs.com/package/@visactor/react-vtable)
62
26
 
63
27
  ```bash
64
28
  // npm
65
- npm install @visactor/vtable
29
+ npm install @visactor/react-vtable
66
30
 
67
31
  // yarn
68
- yarn add @visactor/vtable
32
+ yarn add @visactor/react-vtable
69
33
  ```
70
34
 
71
35
  ## Quick Start
72
36
 
73
- ```javascript
74
- import * as VTable from '@visactor/vtable';
37
+ ```jsx
38
+ import React from 'react';
39
+ import ReactDOM from 'react-dom/client';
40
+ import { ListTable } from "@visactor/react-vtable";
75
41
 
76
- const columns =[
42
+ const option = {
43
+ header: [
77
44
  {
78
- "field": "Order ID",
79
- "caption": "Order ID",
45
+ field: "0",
46
+ caption: "name",
80
47
  },
81
48
  {
82
- "field": "Customer ID",
83
- "caption": "Customer ID",
49
+ field: "1",
50
+ caption: "age",
84
51
  },
85
52
  {
86
- "field": "Product Name",
87
- "caption": "Product Name",
53
+ field: "2",
54
+ caption: "gender",
88
55
  },
89
56
  {
90
- "field": "Sales",
91
- "caption": "Sales",
57
+ field: "3",
58
+ caption: "hobby",
92
59
  },
93
- {
94
- "field": "Profit",
95
- "caption": "Profit",
96
- }
97
- ];
98
-
99
- const option = {
100
- records:[
101
- {
102
- "Order ID": "CA-2018-156720",
103
- "Customer ID": "JM-15580",
104
- "Product Name": "Bagged Rubber Bands",
105
- "Sales": "3.024",
106
- "Profit": "-0.605"
107
- },
108
- {
109
- "Order ID": "CA-2018-115427",
110
- "Customer ID": "EB-13975",
111
- "Product Name": "GBC Binding covers",
112
- "Sales": "20.72",
113
- "Profit": "6.475"
114
- },
115
- ...
116
60
  ],
117
- columns,
118
- widthMode:'standard'
61
+ records: new Array(1000).fill(["John", 18, "male", "🏀"]),
119
62
  };
120
- const tableInstance = new VTable.ListTable(document.getElementById(CONTAINER_ID), option);
121
-
122
-
123
-
124
63
 
64
+ ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
65
+ <ListTable option={option} height={'500px'}/>
66
+ );
125
67
  ```
126
68
 
127
69
  ##
@@ -1,5 +1,5 @@
1
1
  import type { BaseComponentProps } from '../base-component';
2
- import type { TYPES } from './../../../../vtable/src/index.ts';
2
+ import type { TYPES } from '@visactor/vtable';
3
3
  export type MenuProps = {
4
4
  renderMode?: 'canvas' | 'html';
5
5
  defaultHeaderMenuItems?: TYPES.MenuListItem[];
@@ -1 +1 @@
1
- {"version":3,"sources":["components/component/menu.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAcvC,QAAA,IAAI,GAAG,IAAA,gCAAe,EAAY,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","file":"menu.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { TYPES } from './../../../../vtable/src/index.ts';\n\nexport type MenuProps = {\n /** 代替原来的option.menuType html目前实现较完整 先默认html渲染方式*/\n renderMode?: 'canvas' | 'html';\n /** 内置下拉菜单的全局设置项 目前只针对基本表格有效 会对每个表头单元格开启默认的下拉菜单功能。代替原来的option.dropDownMenu*/\n defaultHeaderMenuItems?: TYPES.MenuListItem[];\n /** 右键菜单。代替原来的option.contextmenu */\n contextMenuItems?: TYPES.MenuListItem[] | ((field: string, row: number) => TYPES.MenuListItem[]);\n /** 设置选中状态的菜单。代替原来的option.dropDownMenuHighlight */\n dropDownMenuHighlight?: TYPES.DropDownMenuHighlightInfo[];\n} & BaseComponentProps;\n\nexport const Menu = createComponent<MenuProps>('Menu', 'menu', undefined, true);\n"]}
1
+ {"version":3,"sources":["components/component/menu.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAcvC,QAAA,IAAI,GAAG,IAAA,gCAAe,EAAY,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","file":"menu.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { TYPES } from '@visactor/vtable';\n\nexport type MenuProps = {\n /** 代替原来的option.menuType html目前实现较完整 先默认html渲染方式*/\n renderMode?: 'canvas' | 'html';\n /** 内置下拉菜单的全局设置项 目前只针对基本表格有效 会对每个表头单元格开启默认的下拉菜单功能。代替原来的option.dropDownMenu*/\n defaultHeaderMenuItems?: TYPES.MenuListItem[];\n /** 右键菜单。代替原来的option.contextmenu */\n contextMenuItems?: TYPES.MenuListItem[] | ((field: string, row: number) => TYPES.MenuListItem[]);\n /** 设置选中状态的菜单。代替原来的option.dropDownMenuHighlight */\n dropDownMenuHighlight?: TYPES.DropDownMenuHighlightInfo[];\n} & BaseComponentProps;\n\nexport const Menu = createComponent<MenuProps>('Menu', 'menu', undefined, true);\n"]}
@@ -1,4 +1,4 @@
1
1
  import type { BaseComponentProps } from '../base-component';
2
- import type { ColumnDefine } from './../../../../vtable/src/index.ts';
2
+ import type { ColumnDefine } from '@visactor/vtable';
3
3
  export type ListColumnProps = ColumnDefine & BaseComponentProps;
4
- export declare const ListColumn: import("react").FC<any>;
4
+ export declare const ListColumn: import("react").FC<ListColumnProps>;
@@ -1 +1 @@
1
- {"version":3,"sources":["components/list/list-column.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAKvC,QAAA,UAAU,GAAG,IAAA,gCAAe,EAAkB,YAAY,EAAE,SAAS,CAAC,CAAC","file":"list-column.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { ColumnDefine } from './../../../../vtable/src/index.ts';\n\nexport type ListColumnProps = ColumnDefine & BaseComponentProps;\n\nexport const ListColumn = createComponent<ListColumnProps>('ListColumn', 'columns');\n"]}
1
+ {"version":3,"sources":["components/list/list-column.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAKvC,QAAA,UAAU,GAAG,IAAA,gCAAe,EAAkB,YAAY,EAAE,SAAS,CAAC,CAAC","file":"list-column.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { ColumnDefine } from '@visactor/vtable';\n\nexport type ListColumnProps = ColumnDefine & BaseComponentProps;\n\nexport const ListColumn = createComponent<ListColumnProps>('ListColumn', 'columns');\n"]}
@@ -1,4 +1,4 @@
1
1
  import type { BaseComponentProps } from '../base-component';
2
- import type { ICornerDefine } from './../../../../vtable/src/index.ts';
2
+ import type { ICornerDefine } from '@visactor/vtable';
3
3
  export type PivotCornerProps = ICornerDefine & BaseComponentProps;
4
- export declare const PivotCorner: import("react").FC<any>;
4
+ export declare const PivotCorner: import("react").FC<PivotCornerProps>;
@@ -1 +1 @@
1
- {"version":3,"sources":["components/pivot/pivot-corner.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAKvC,QAAA,WAAW,GAAG,IAAA,gCAAe,EAAmB,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","file":"pivot-corner.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { ICornerDefine } from './../../../../vtable/src/index.ts';\n\nexport type PivotCornerProps = ICornerDefine & BaseComponentProps;\n\nexport const PivotCorner = createComponent<PivotCornerProps>('PivotCorner', 'corner', undefined, true);\n"]}
1
+ {"version":3,"sources":["components/pivot/pivot-corner.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAKvC,QAAA,WAAW,GAAG,IAAA,gCAAe,EAAmB,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","file":"pivot-corner.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { ICornerDefine } from '@visactor/vtable';\n\nexport type PivotCornerProps = ICornerDefine & BaseComponentProps;\n\nexport const PivotCorner = createComponent<PivotCornerProps>('PivotCorner', 'corner', undefined, true);\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { BaseComponentProps } from '../base-component';
2
- import type { IDimension } from './../../../../vtable/src/index.ts';
2
+ import type { IDimension } from '@visactor/vtable';
3
3
  export type PivotDimensionProps = IDimension & BaseComponentProps;
4
- export declare const PivotColumnDimension: import("react").FC<any>;
5
- export declare const PivotRowDimension: import("react").FC<any>;
4
+ export declare const PivotColumnDimension: import("react").FC<PivotDimensionProps>;
5
+ export declare const PivotRowDimension: import("react").FC<PivotDimensionProps>;
@@ -1 +1 @@
1
- {"version":3,"sources":["components/pivot/pivot-dimension.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAKvC,QAAA,oBAAoB,GAAG,IAAA,gCAAe,EAAsB,sBAAsB,EAAE,SAAS,CAAC,CAAC;AAC/F,QAAA,iBAAiB,GAAG,IAAA,gCAAe,EAAsB,mBAAmB,EAAE,MAAM,CAAC,CAAC","file":"pivot-dimension.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { IDimension } from './../../../../vtable/src/index.ts';\n\nexport type PivotDimensionProps = IDimension & BaseComponentProps;\n\nexport const PivotColumnDimension = createComponent<PivotDimensionProps>('PivotColumnDimension', 'columns');\nexport const PivotRowDimension = createComponent<PivotDimensionProps>('PivotRowDimension', 'rows');\n"]}
1
+ {"version":3,"sources":["components/pivot/pivot-dimension.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAKvC,QAAA,oBAAoB,GAAG,IAAA,gCAAe,EAAsB,sBAAsB,EAAE,SAAS,CAAC,CAAC;AAC/F,QAAA,iBAAiB,GAAG,IAAA,gCAAe,EAAsB,mBAAmB,EAAE,MAAM,CAAC,CAAC","file":"pivot-dimension.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { IDimension } from '@visactor/vtable';\n\nexport type PivotDimensionProps = IDimension & BaseComponentProps;\n\nexport const PivotColumnDimension = createComponent<PivotDimensionProps>('PivotColumnDimension', 'columns');\nexport const PivotRowDimension = createComponent<PivotDimensionProps>('PivotRowDimension', 'rows');\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { BaseComponentProps } from '../base-component';
2
- import type { ITitleDefine } from './../../../../vtable/src/index.ts';
2
+ import type { ITitleDefine } from '@visactor/vtable';
3
3
  export type PivotHeaderTitleProps = ITitleDefine & BaseComponentProps;
4
- export declare const PivotColumnHeaderTitle: import("react").FC<any>;
5
- export declare const PivotRowHeaderTitle: import("react").FC<any>;
4
+ export declare const PivotColumnHeaderTitle: import("react").FC<PivotHeaderTitleProps>;
5
+ export declare const PivotRowHeaderTitle: import("react").FC<PivotHeaderTitleProps>;
@@ -1 +1 @@
1
- {"version":3,"sources":["components/pivot/pivot-header-title.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAKvC,QAAA,sBAAsB,GAAG,IAAA,gCAAe,EACnD,wBAAwB,EACxB,mBAAmB,EACnB,SAAS,EACT,IAAI,CACL,CAAC;AACW,QAAA,mBAAmB,GAAG,IAAA,gCAAe,EAChD,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACT,IAAI,CACL,CAAC","file":"pivot-header-title.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { ITitleDefine } from './../../../../vtable/src/index.ts';\n\nexport type PivotHeaderTitleProps = ITitleDefine & BaseComponentProps;\n\nexport const PivotColumnHeaderTitle = createComponent<PivotHeaderTitleProps>(\n 'PivotColumnHeaderTitle',\n 'columnHeaderTitle',\n undefined,\n true\n);\nexport const PivotRowHeaderTitle = createComponent<PivotHeaderTitleProps>(\n 'PivotRowHeaderTitle',\n 'rowHeaderTitle',\n undefined,\n true\n);\n"]}
1
+ {"version":3,"sources":["components/pivot/pivot-header-title.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAKvC,QAAA,sBAAsB,GAAG,IAAA,gCAAe,EACnD,wBAAwB,EACxB,mBAAmB,EACnB,SAAS,EACT,IAAI,CACL,CAAC;AACW,QAAA,mBAAmB,GAAG,IAAA,gCAAe,EAChD,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACT,IAAI,CACL,CAAC","file":"pivot-header-title.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { ITitleDefine } from '@visactor/vtable';\n\nexport type PivotHeaderTitleProps = ITitleDefine & BaseComponentProps;\n\nexport const PivotColumnHeaderTitle = createComponent<PivotHeaderTitleProps>(\n 'PivotColumnHeaderTitle',\n 'columnHeaderTitle',\n undefined,\n true\n);\nexport const PivotRowHeaderTitle = createComponent<PivotHeaderTitleProps>(\n 'PivotRowHeaderTitle',\n 'rowHeaderTitle',\n undefined,\n true\n);\n"]}
@@ -1,4 +1,4 @@
1
1
  import type { BaseComponentProps } from '../base-component';
2
- import type { IIndicator } from './../../../../vtable/src/index.ts';
2
+ import type { IIndicator } from '@visactor/vtable';
3
3
  export type PivotIndicatorProps = IIndicator & BaseComponentProps;
4
- export declare const PivotIndicator: import("react").FC<any>;
4
+ export declare const PivotIndicator: import("react").FC<PivotIndicatorProps>;
@@ -1 +1 @@
1
- {"version":3,"sources":["components/pivot/pivot-indicator.ts"],"names":[],"mappings":";;;AACA,sDAAoD;AAKvC,QAAA,cAAc,GAAG,IAAA,gCAAe,EAAsB,gBAAgB,EAAE,YAAY,CAAC,CAAC","file":"pivot-indicator.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { IIndicator } from './../../../../vtable/src/index.ts';\n\nexport type PivotIndicatorProps = IIndicator & BaseComponentProps;\n\nexport const PivotIndicator = createComponent<PivotIndicatorProps>('PivotIndicator', 'indicators');\n"]}
1
+ {"version":3,"sources":["components/pivot/pivot-indicator.ts"],"names":[],"mappings":";;;AACA,sDAAoD;AAKvC,QAAA,cAAc,GAAG,IAAA,gCAAe,EAAsB,gBAAgB,EAAE,YAAY,CAAC,CAAC","file":"pivot-indicator.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { IIndicator } from '@visactor/vtable';\n\nexport type PivotIndicatorProps = IIndicator & BaseComponentProps;\n\nexport const PivotIndicator = createComponent<PivotIndicatorProps>('PivotIndicator', 'indicators');\n"]}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { ListTable, PivotTable, PivotChart } from './../../../vtable/src/index.ts';
2
+ import type { ListTable, PivotTable, PivotChart } from '@visactor/vtable';
3
3
  export interface TableContextType {
4
4
  table?: ListTable | PivotTable | PivotChart;
5
5
  optionFromChildren: any;
@@ -1 +1 @@
1
- {"version":3,"sources":["context/table.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAS1B,MAAM,YAAY,GAAG,eAAK,CAAC,aAAa,CAAmB,IAAI,CAAC,CAAC;AACjE,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAE1C,SAAgB,iBAAiB,CAAI,SAAiC;IACpE,MAAM,GAAG,GAAG,eAAK,CAAC,UAAU,CAAS,CAAC,KAAQ,EAAE,GAAG,EAAE,EAAE;QACrD,OAAO,CACL,8BAAC,YAAY,CAAC,QAAQ,QACnB,CAAC,GAAqB,EAAE,EAAE,CAAC,8BAAC,SAAS,kBAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,IAAM,KAAK,EAAI,CAC1D,CACzB,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC;IACjC,OAAO,GAAG,CAAC;AACb,CAAC;AAVD,8CAUC;AAED,kBAAe,YAAY,CAAC","file":"table.js","sourcesContent":["import React from 'react';\nimport type { ListTable, PivotTable, PivotChart } from './../../../vtable/src/index.ts';\n\nexport interface TableContextType {\n table?: ListTable | PivotTable | PivotChart;\n optionFromChildren: any;\n isChildrenUpdated?: boolean;\n}\n\nconst TableContext = React.createContext<TableContextType>(null);\nTableContext.displayName = 'TableContext';\n\nexport function withTableInstance<T>(Component: typeof React.Component) {\n const Com = React.forwardRef<any, T>((props: T, ref) => {\n return (\n <TableContext.Consumer>\n {(ctx: TableContextType) => <Component ref={ref} table={ctx.table} {...props} />}\n </TableContext.Consumer>\n );\n });\n Com.displayName = Component.name;\n return Com;\n}\n\nexport default TableContext;\n"]}
1
+ {"version":3,"sources":["context/table.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAS1B,MAAM,YAAY,GAAG,eAAK,CAAC,aAAa,CAAmB,IAAI,CAAC,CAAC;AACjE,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAE1C,SAAgB,iBAAiB,CAAI,SAAiC;IACpE,MAAM,GAAG,GAAG,eAAK,CAAC,UAAU,CAAS,CAAC,KAAQ,EAAE,GAAG,EAAE,EAAE;QACrD,OAAO,CACL,8BAAC,YAAY,CAAC,QAAQ,QACnB,CAAC,GAAqB,EAAE,EAAE,CAAC,8BAAC,SAAS,kBAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,IAAM,KAAK,EAAI,CAC1D,CACzB,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC;IACjC,OAAO,GAAG,CAAC;AACb,CAAC;AAVD,8CAUC;AAED,kBAAe,YAAY,CAAC","file":"table.js","sourcesContent":["import React from 'react';\nimport type { ListTable, PivotTable, PivotChart } from '@visactor/vtable';\n\nexport interface TableContextType {\n table?: ListTable | PivotTable | PivotChart;\n optionFromChildren: any;\n isChildrenUpdated?: boolean;\n}\n\nconst TableContext = React.createContext<TableContextType>(null);\nTableContext.displayName = 'TableContext';\n\nexport function withTableInstance<T>(Component: typeof React.Component) {\n const Com = React.forwardRef<any, T>((props: T, ref) => {\n return (\n <TableContext.Consumer>\n {(ctx: TableContextType) => <Component ref={ref} table={ctx.table} {...props} />}\n </TableContext.Consumer>\n );\n });\n Com.displayName = Component.name;\n return Com;\n}\n\nexport default TableContext;\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { IVTable } from './tables/base-table';
2
- import type { TableEventHandlersEventArgumentMap } from './../../vtable/src/index.ts/src/ts-types';
2
+ import type { TableEventHandlersEventArgumentMap } from '@visactor/vtable/src/ts-types';
3
3
  export type EventCallback<Params> = (params: Params) => void;
4
4
  export interface EventsProps {
5
5
  onClickCell?: EventCallback<TableEventHandlersEventArgumentMap['click_cell']>;
@@ -43,45 +43,45 @@ export interface EventsProps {
43
43
  onVChartEventType?: EventCallback<TableEventHandlersEventArgumentMap['vchart_event_type']>;
44
44
  }
45
45
  export declare const TABLE_EVENTS: {
46
- onClickCell: any;
47
- onDblClickCell: any;
48
- onMouseDownCell: any;
49
- onMouseUpCell: any;
50
- onSelectedCell: any;
51
- onKeyDown: any;
52
- onMouseEnterTable: any;
53
- onMouseLeaveTable: any;
54
- onMouseMoveCell: any;
55
- onMouseEnterCell: any;
56
- onMouseLeaveCell: any;
57
- onContextMenuCell: any;
58
- onResizeColumn: any;
59
- onResizeColumnEnd: any;
60
- onChangeHeaderPosition: any;
61
- onSortClick: any;
62
- onFreezeClick: any;
63
- onScroll: any;
64
- onDropdownMenuClick: any;
65
- onMouseOverChartSymbol: any;
66
- onDragSelectEnd: any;
67
- onDropdownIconClick: any;
68
- onDropdownMenuClear: any;
69
- onTreeHierarchyStateChange: any;
70
- onShowMenu: any;
71
- onHideMenu: any;
72
- onIconClick: any;
73
- onLegendItemClick: any;
74
- onLegendItemHover: any;
75
- onLegendItemUnHover: any;
76
- onLegendChange: any;
77
- onMouseEnterAxis: any;
78
- onMouseLeaveAxis: any;
79
- onCheckboxStateChange: any;
80
- onAfterRender: any;
81
- onInitialized: any;
82
- onPivotSortClick: any;
83
- onDrillMenuClick: any;
84
- onVChartEventType: any;
46
+ onClickCell: "click_cell";
47
+ onDblClickCell: "dblclick_cell";
48
+ onMouseDownCell: "mousedown_cell";
49
+ onMouseUpCell: "mouseup_cell";
50
+ onSelectedCell: "selected_cell";
51
+ onKeyDown: "keydown";
52
+ onMouseEnterTable: "mouseenter_table";
53
+ onMouseLeaveTable: "mouseleave_table";
54
+ onMouseMoveCell: "mousemove_cell";
55
+ onMouseEnterCell: "mouseenter_cell";
56
+ onMouseLeaveCell: "mouseleave_cell";
57
+ onContextMenuCell: "contextmenu_cell";
58
+ onResizeColumn: "resize_column";
59
+ onResizeColumnEnd: "resize_column_end";
60
+ onChangeHeaderPosition: "change_header_position";
61
+ onSortClick: "sort_click";
62
+ onFreezeClick: "freeze_click";
63
+ onScroll: "scroll";
64
+ onDropdownMenuClick: "dropdown_menu_click";
65
+ onMouseOverChartSymbol: "mouseover_chart_symbol";
66
+ onDragSelectEnd: "drag_select_end";
67
+ onDropdownIconClick: "dropdown_icon_click";
68
+ onDropdownMenuClear: "dropdown_menu_clear";
69
+ onTreeHierarchyStateChange: "tree_hierarchy_state_change";
70
+ onShowMenu: "show_menu";
71
+ onHideMenu: "hide_menu";
72
+ onIconClick: "icon_click";
73
+ onLegendItemClick: "legend_item_click";
74
+ onLegendItemHover: "legend_item_hover";
75
+ onLegendItemUnHover: "legend_item_unHover";
76
+ onLegendChange: "legend_change";
77
+ onMouseEnterAxis: "mouseenter_axis";
78
+ onMouseLeaveAxis: "mouseleave_axis";
79
+ onCheckboxStateChange: "checkbox_state_change";
80
+ onAfterRender: "after_render";
81
+ onInitialized: "initialized";
82
+ onPivotSortClick: "pivot_sort_click";
83
+ onDrillMenuClick: "drillmenu_click";
84
+ onVChartEventType: "vchart_event_type";
85
85
  };
86
86
  export declare const TABLE_EVENTS_KEYS: string[];
87
87
  export declare const findEventProps: <T extends EventsProps>(props: T, supportedEvents?: Record<string, string>) => EventsProps;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.bindEventsToTable = exports.findEventProps = exports.TABLE_EVENTS_KEYS = exports.TABLE_EVENTS = void 0;
6
6
 
7
- const index_ts_1 = require("./../../vtable/src/index.ts"), EVENT_TYPE = Object.assign(Object.assign(Object.assign({}, index_ts_1.ListTable.EVENT_TYPE), index_ts_1.PivotTable.EVENT_TYPE), index_ts_1.PivotChart.EVENT_TYPE);
7
+ const vtable_1 = require("@visactor/vtable"), EVENT_TYPE = Object.assign(Object.assign(Object.assign({}, vtable_1.ListTable.EVENT_TYPE), vtable_1.PivotTable.EVENT_TYPE), vtable_1.PivotChart.EVENT_TYPE);
8
8
 
9
9
  exports.TABLE_EVENTS = {
10
10
  onClickCell: EVENT_TYPE.CLICK_CELL,
@@ -1 +1 @@
1
- {"version":3,"sources":["eventsUtils.ts"],"names":[],"mappings":";;;AAAA,0DAAgF;AAMhF,MAAM,UAAU,iDACX,oBAAS,CAAC,UAAU,GACpB,qBAAU,CAAC,UAAU,GACrB,qBAAU,CAAC,UAAU,CACzB,CAAC;AAuDW,QAAA,YAAY,GAAG;IAC1B,WAAW,EAAE,UAAU,CAAC,UAAU;IAClC,cAAc,EAAE,UAAU,CAAC,aAAa;IACxC,eAAe,EAAE,UAAU,CAAC,cAAc;IAC1C,aAA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CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,KAAK,cAAc,CAAC,QAAQ,CAAC,EAAE;gBACtG,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC3D;QACH,CAAC,CAAC,CAAC;KACJ;IAED,IAAI,aAAa,EAAE;QACjB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC5C,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC,KAAK,aAAa,CAAC,QAAQ,CAAC,EAAE;gBACxG,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,QAAQ,CAA6C,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC1G;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AA9BW,QAAA,iBAAiB,qBA8B5B","file":"eventsUtils.js","sourcesContent":["import { ListTable, PivotTable, PivotChart } from './../../vtable/src/index.ts';\nimport type { IVTable } from './tables/base-table';\nimport type { TableEventHandlersEventArgumentMap } from './../../vtable/src/index.ts/src/ts-types';\n\nexport type EventCallback<Params> = (params: Params) => void;\n\nconst EVENT_TYPE = {\n ...ListTable.EVENT_TYPE,\n ...PivotTable.EVENT_TYPE,\n ...PivotChart.EVENT_TYPE\n};\n\nexport interface EventsProps {\n onClickCell?: EventCallback<TableEventHandlersEventArgumentMap['click_cell']>;\n onDblClickCell?: EventCallback<TableEventHandlersEventArgumentMap['dblclick_cell']>;\n onMouseDownCell?: EventCallback<TableEventHandlersEventArgumentMap['mousedown_cell']>;\n onMouseUpCell?: EventCallback<TableEventHandlersEventArgumentMap['mouseup_cell']>;\n onSelectedCell?: EventCallback<TableEventHandlersEventArgumentMap['selected_cell']>;\n onKeyDown?: EventCallback<TableEventHandlersEventArgumentMap['keydown']>;\n onMouseEnterTable?: EventCallback<TableEventHandlersEventArgumentMap['mouseenter_table']>;\n onMouseLeaveTable?: EventCallback<TableEventHandlersEventArgumentMap['mouseleave_table']>;\n onMouseMoveCell?: EventCallback<TableEventHandlersEventArgumentMap['mousemove_cell']>;\n onMouseEnterCell?: EventCallback<TableEventHandlersEventArgumentMap['mouseenter_cell']>;\n onMouseLeaveCell?: EventCallback<TableEventHandlersEventArgumentMap['mouseleave_cell']>;\n onContextMenuCell?: EventCallback<TableEventHandlersEventArgumentMap['contextmenu_cell']>;\n onResizeColumn?: EventCallback<TableEventHandlersEventArgumentMap['resize_column']>;\n onResizeColumnEnd?: EventCallback<TableEventHandlersEventArgumentMap['resize_column_end']>;\n onChangeHeaderPosition?: EventCallback<TableEventHandlersEventArgumentMap['change_header_position']>;\n onSortClick?: EventCallback<TableEventHandlersEventArgumentMap['sort_click']>;\n onFreezeClick?: EventCallback<TableEventHandlersEventArgumentMap['freeze_click']>;\n onScroll?: EventCallback<TableEventHandlersEventArgumentMap['scroll']>;\n onDropdownMenuClick?: EventCallback<TableEventHandlersEventArgumentMap['dropdown_menu_click']>;\n onMouseOverChartSymbol?: EventCallback<TableEventHandlersEventArgumentMap['mouseover_chart_symbol']>;\n onDragSelectEnd?: EventCallback<TableEventHandlersEventArgumentMap['drag_select_end']>;\n\n onDropdownIconClick?: EventCallback<TableEventHandlersEventArgumentMap['dropdown_icon_click']>;\n onDropdownMenuClear?: EventCallback<TableEventHandlersEventArgumentMap['dropdown_menu_clear']>;\n\n onTreeHierarchyStateChange?: EventCallback<TableEventHandlersEventArgumentMap['tree_hierarchy_state_change']>;\n\n onShowMenu?: EventCallback<TableEventHandlersEventArgumentMap['show_menu']>;\n onHideMenu?: EventCallback<TableEventHandlersEventArgumentMap['hide_menu']>;\n\n onIconClick?: EventCallback<TableEventHandlersEventArgumentMap['icon_click']>;\n\n onLegendItemClick?: EventCallback<TableEventHandlersEventArgumentMap['legend_item_click']>;\n onLegendItemHover?: EventCallback<TableEventHandlersEventArgumentMap['legend_item_hover']>;\n onLegendItemUnHover?: EventCallback<TableEventHandlersEventArgumentMap['legend_item_unHover']>;\n onLegendChange?: EventCallback<TableEventHandlersEventArgumentMap['legend_change']>;\n\n onMouseEnterAxis?: EventCallback<TableEventHandlersEventArgumentMap['mouseenter_axis']>;\n onMouseLeaveAxis?: EventCallback<TableEventHandlersEventArgumentMap['mouseleave_axis']>;\n\n onCheckboxStateChange?: EventCallback<TableEventHandlersEventArgumentMap['checkbox_state_change']>;\n onAfterRender?: EventCallback<TableEventHandlersEventArgumentMap['after_render']>;\n onInitialized?: EventCallback<TableEventHandlersEventArgumentMap['initialized']>;\n\n // pivot table only\n onPivotSortClick?: EventCallback<TableEventHandlersEventArgumentMap['pivot_sort_click']>;\n onDrillMenuClick?: EventCallback<TableEventHandlersEventArgumentMap['drillmenu_click']>;\n\n // pivot chart only\n onVChartEventType?: EventCallback<TableEventHandlersEventArgumentMap['vchart_event_type']>;\n}\n\nexport const TABLE_EVENTS = {\n onClickCell: EVENT_TYPE.CLICK_CELL,\n onDblClickCell: EVENT_TYPE.DBLCLICK_CELL,\n onMouseDownCell: EVENT_TYPE.MOUSEDOWN_CELL,\n onMouseUpCell: EVENT_TYPE.MOUSEUP_CELL,\n onSelectedCell: EVENT_TYPE.SELECTED_CELL,\n onKeyDown: EVENT_TYPE.KEYDOWN,\n onMouseEnterTable: EVENT_TYPE.MOUSEENTER_TABLE,\n onMouseLeaveTable: EVENT_TYPE.MOUSELEAVE_TABLE,\n onMouseMoveCell: EVENT_TYPE.MOUSEMOVE_CELL,\n onMouseEnterCell: EVENT_TYPE.MOUSEENTER_CELL,\n onMouseLeaveCell: EVENT_TYPE.MOUSELEAVE_CELL,\n onContextMenuCell: EVENT_TYPE.CONTEXTMENU_CELL,\n onResizeColumn: EVENT_TYPE.RESIZE_COLUMN,\n onResizeColumnEnd: EVENT_TYPE.RESIZE_COLUMN_END,\n onChangeHeaderPosition: EVENT_TYPE.CHANGE_HEADER_POSITION,\n onSortClick: EVENT_TYPE.SORT_CLICK,\n onFreezeClick: EVENT_TYPE.FREEZE_CLICK,\n onScroll: EVENT_TYPE.SCROLL,\n onDropdownMenuClick: EVENT_TYPE.DROPDOWN_MENU_CLICK,\n onMouseOverChartSymbol: EVENT_TYPE.MOUSEOVER_CHART_SYMBOL,\n onDragSelectEnd: EVENT_TYPE.DRAG_SELECT_END,\n\n onDropdownIconClick: EVENT_TYPE.DROPDOWN_ICON_CLICK,\n onDropdownMenuClear: EVENT_TYPE.DROPDOWN_MENU_CLEAR,\n\n onTreeHierarchyStateChange: EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE,\n\n onShowMenu: EVENT_TYPE.SHOW_MENU,\n onHideMenu: EVENT_TYPE.HIDE_MENU,\n\n onIconClick: EVENT_TYPE.ICON_CLICK,\n\n onLegendItemClick: EVENT_TYPE.LEGEND_ITEM_CLICK,\n onLegendItemHover: EVENT_TYPE.LEGEND_ITEM_HOVER,\n onLegendItemUnHover: EVENT_TYPE.LEGEND_ITEM_UNHOVER,\n onLegendChange: EVENT_TYPE.LEGEND_CHANGE,\n\n onMouseEnterAxis: EVENT_TYPE.MOUSEENTER_AXIS,\n onMouseLeaveAxis: EVENT_TYPE.MOUSELEAVE_AXIS,\n\n onCheckboxStateChange: EVENT_TYPE.CHECKBOX_STATE_CHANGE,\n onAfterRender: EVENT_TYPE.AFTER_RENDER,\n onInitialized: EVENT_TYPE.INITIALIZED,\n\n // pivot table only\n onPivotSortClick: EVENT_TYPE.PIVOT_SORT_CLICK,\n onDrillMenuClick: EVENT_TYPE.DRILLMENU_CLICK,\n\n // pivot chart only\n onVChartEventType: EVENT_TYPE.VCHART_EVENT_TYPE\n};\n\nexport const TABLE_EVENTS_KEYS = Object.keys(TABLE_EVENTS);\n\nexport const findEventProps = <T extends EventsProps>(\n props: T,\n supportedEvents: Record<string, string> = TABLE_EVENTS\n): EventsProps => {\n const result: EventsProps = {};\n\n Object.keys(props).forEach(key => {\n if (supportedEvents[key]) {\n result[key] = props[key];\n }\n });\n\n return result;\n};\n\nexport const bindEventsToTable = <T>(\n table: IVTable,\n newProps?: T | null,\n prevProps?: T | null,\n supportedEvents: Record<string, string> = TABLE_EVENTS\n) => {\n if ((!newProps && !prevProps) || !table) {\n return false;\n }\n\n const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;\n const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;\n\n if (prevEventProps) {\n Object.keys(prevEventProps).forEach(eventKey => {\n if (!newEventProps || !newEventProps[eventKey] || newEventProps[eventKey] !== prevEventProps[eventKey]) {\n table.off(supportedEvents[eventKey], prevProps[eventKey]);\n }\n });\n }\n\n if (newEventProps) {\n Object.keys(newEventProps).forEach(eventKey => {\n if (!prevEventProps || !prevEventProps[eventKey] || prevEventProps[eventKey] !== newEventProps[eventKey]) {\n table.on(supportedEvents[eventKey] as keyof TableEventHandlersEventArgumentMap, newEventProps[eventKey]);\n }\n });\n }\n\n return true;\n};\n"]}
1
+ {"version":3,"sources":["eventsUtils.ts"],"names":[],"mappings":";;;AAAA,6CAAqE;AAMrE,MAAM,UAAU,iDACX,kBAAS,CAAC,UAAU,GACpB,mBAAU,CAAC,UAAU,GACrB,mBAAU,CAAC,UAAU,CACzB,CAAC;AAuDW,QAAA,YAAY,GAAG;IAC1B,WAAW,EAAE,UAAU,CAAC,UAAU;IAClC,cAAc,EAAE,UAAU,CAAC,aAAa;IACxC,eAAe,EAAE,UAAU,CAAC,cAAc;IAC1C,aAAa,EAAE,UAAU,CAAC,YAAY;IACtC,cAAc,EAAE,UAAU,CAAC,aAAa;IACxC,SAAS,EAAE,UAAU,CAAC,OAAO;IAC7B,iBAAiB,EAAE,UAAU,CAAC,gBAAgB;IAC9C,iBAAiB,EAAE,UAAU,CAAC,gBAAgB;IAC9C,eAAe,EAAE,UAAU,CAAC,cAAc;IAC1C,gBAAgB,EAAE,UAAU,CAAC,eAAe;IAC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,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC5C,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC,KAAK,aAAa,CAAC,QAAQ,CAAC,EAAE;gBACxG,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,QAAQ,CAA6C,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC1G;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AA9BW,QAAA,iBAAiB,qBA8B5B","file":"eventsUtils.js","sourcesContent":["import { ListTable, PivotTable, PivotChart } from '@visactor/vtable';\nimport type { IVTable } from './tables/base-table';\nimport type { TableEventHandlersEventArgumentMap } from '@visactor/vtable/src/ts-types';\n\nexport type EventCallback<Params> = (params: Params) => void;\n\nconst EVENT_TYPE = {\n ...ListTable.EVENT_TYPE,\n ...PivotTable.EVENT_TYPE,\n ...PivotChart.EVENT_TYPE\n};\n\nexport interface EventsProps {\n onClickCell?: EventCallback<TableEventHandlersEventArgumentMap['click_cell']>;\n onDblClickCell?: EventCallback<TableEventHandlersEventArgumentMap['dblclick_cell']>;\n onMouseDownCell?: EventCallback<TableEventHandlersEventArgumentMap['mousedown_cell']>;\n onMouseUpCell?: EventCallback<TableEventHandlersEventArgumentMap['mouseup_cell']>;\n onSelectedCell?: EventCallback<TableEventHandlersEventArgumentMap['selected_cell']>;\n onKeyDown?: EventCallback<TableEventHandlersEventArgumentMap['keydown']>;\n onMouseEnterTable?: EventCallback<TableEventHandlersEventArgumentMap['mouseenter_table']>;\n onMouseLeaveTable?: EventCallback<TableEventHandlersEventArgumentMap['mouseleave_table']>;\n onMouseMoveCell?: EventCallback<TableEventHandlersEventArgumentMap['mousemove_cell']>;\n onMouseEnterCell?: EventCallback<TableEventHandlersEventArgumentMap['mouseenter_cell']>;\n onMouseLeaveCell?: EventCallback<TableEventHandlersEventArgumentMap['mouseleave_cell']>;\n onContextMenuCell?: EventCallback<TableEventHandlersEventArgumentMap['contextmenu_cell']>;\n onResizeColumn?: EventCallback<TableEventHandlersEventArgumentMap['resize_column']>;\n onResizeColumnEnd?: EventCallback<TableEventHandlersEventArgumentMap['resize_column_end']>;\n onChangeHeaderPosition?: EventCallback<TableEventHandlersEventArgumentMap['change_header_position']>;\n onSortClick?: EventCallback<TableEventHandlersEventArgumentMap['sort_click']>;\n onFreezeClick?: EventCallback<TableEventHandlersEventArgumentMap['freeze_click']>;\n onScroll?: EventCallback<TableEventHandlersEventArgumentMap['scroll']>;\n onDropdownMenuClick?: EventCallback<TableEventHandlersEventArgumentMap['dropdown_menu_click']>;\n onMouseOverChartSymbol?: EventCallback<TableEventHandlersEventArgumentMap['mouseover_chart_symbol']>;\n onDragSelectEnd?: EventCallback<TableEventHandlersEventArgumentMap['drag_select_end']>;\n\n onDropdownIconClick?: EventCallback<TableEventHandlersEventArgumentMap['dropdown_icon_click']>;\n onDropdownMenuClear?: EventCallback<TableEventHandlersEventArgumentMap['dropdown_menu_clear']>;\n\n onTreeHierarchyStateChange?: EventCallback<TableEventHandlersEventArgumentMap['tree_hierarchy_state_change']>;\n\n onShowMenu?: EventCallback<TableEventHandlersEventArgumentMap['show_menu']>;\n onHideMenu?: EventCallback<TableEventHandlersEventArgumentMap['hide_menu']>;\n\n onIconClick?: EventCallback<TableEventHandlersEventArgumentMap['icon_click']>;\n\n onLegendItemClick?: EventCallback<TableEventHandlersEventArgumentMap['legend_item_click']>;\n onLegendItemHover?: EventCallback<TableEventHandlersEventArgumentMap['legend_item_hover']>;\n onLegendItemUnHover?: EventCallback<TableEventHandlersEventArgumentMap['legend_item_unHover']>;\n onLegendChange?: EventCallback<TableEventHandlersEventArgumentMap['legend_change']>;\n\n onMouseEnterAxis?: EventCallback<TableEventHandlersEventArgumentMap['mouseenter_axis']>;\n onMouseLeaveAxis?: EventCallback<TableEventHandlersEventArgumentMap['mouseleave_axis']>;\n\n onCheckboxStateChange?: EventCallback<TableEventHandlersEventArgumentMap['checkbox_state_change']>;\n onAfterRender?: EventCallback<TableEventHandlersEventArgumentMap['after_render']>;\n onInitialized?: EventCallback<TableEventHandlersEventArgumentMap['initialized']>;\n\n // pivot table only\n onPivotSortClick?: EventCallback<TableEventHandlersEventArgumentMap['pivot_sort_click']>;\n onDrillMenuClick?: EventCallback<TableEventHandlersEventArgumentMap['drillmenu_click']>;\n\n // pivot chart only\n onVChartEventType?: EventCallback<TableEventHandlersEventArgumentMap['vchart_event_type']>;\n}\n\nexport const TABLE_EVENTS = {\n onClickCell: EVENT_TYPE.CLICK_CELL,\n onDblClickCell: EVENT_TYPE.DBLCLICK_CELL,\n onMouseDownCell: EVENT_TYPE.MOUSEDOWN_CELL,\n onMouseUpCell: EVENT_TYPE.MOUSEUP_CELL,\n onSelectedCell: EVENT_TYPE.SELECTED_CELL,\n onKeyDown: EVENT_TYPE.KEYDOWN,\n onMouseEnterTable: EVENT_TYPE.MOUSEENTER_TABLE,\n onMouseLeaveTable: EVENT_TYPE.MOUSELEAVE_TABLE,\n onMouseMoveCell: EVENT_TYPE.MOUSEMOVE_CELL,\n onMouseEnterCell: EVENT_TYPE.MOUSEENTER_CELL,\n onMouseLeaveCell: EVENT_TYPE.MOUSELEAVE_CELL,\n onContextMenuCell: EVENT_TYPE.CONTEXTMENU_CELL,\n onResizeColumn: EVENT_TYPE.RESIZE_COLUMN,\n onResizeColumnEnd: EVENT_TYPE.RESIZE_COLUMN_END,\n onChangeHeaderPosition: EVENT_TYPE.CHANGE_HEADER_POSITION,\n onSortClick: EVENT_TYPE.SORT_CLICK,\n onFreezeClick: EVENT_TYPE.FREEZE_CLICK,\n onScroll: EVENT_TYPE.SCROLL,\n onDropdownMenuClick: EVENT_TYPE.DROPDOWN_MENU_CLICK,\n onMouseOverChartSymbol: EVENT_TYPE.MOUSEOVER_CHART_SYMBOL,\n onDragSelectEnd: EVENT_TYPE.DRAG_SELECT_END,\n\n onDropdownIconClick: EVENT_TYPE.DROPDOWN_ICON_CLICK,\n onDropdownMenuClear: EVENT_TYPE.DROPDOWN_MENU_CLEAR,\n\n onTreeHierarchyStateChange: EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE,\n\n onShowMenu: EVENT_TYPE.SHOW_MENU,\n onHideMenu: EVENT_TYPE.HIDE_MENU,\n\n onIconClick: EVENT_TYPE.ICON_CLICK,\n\n onLegendItemClick: EVENT_TYPE.LEGEND_ITEM_CLICK,\n onLegendItemHover: EVENT_TYPE.LEGEND_ITEM_HOVER,\n onLegendItemUnHover: EVENT_TYPE.LEGEND_ITEM_UNHOVER,\n onLegendChange: EVENT_TYPE.LEGEND_CHANGE,\n\n onMouseEnterAxis: EVENT_TYPE.MOUSEENTER_AXIS,\n onMouseLeaveAxis: EVENT_TYPE.MOUSELEAVE_AXIS,\n\n onCheckboxStateChange: EVENT_TYPE.CHECKBOX_STATE_CHANGE,\n onAfterRender: EVENT_TYPE.AFTER_RENDER,\n onInitialized: EVENT_TYPE.INITIALIZED,\n\n // pivot table only\n onPivotSortClick: EVENT_TYPE.PIVOT_SORT_CLICK,\n onDrillMenuClick: EVENT_TYPE.DRILLMENU_CLICK,\n\n // pivot chart only\n onVChartEventType: EVENT_TYPE.VCHART_EVENT_TYPE\n};\n\nexport const TABLE_EVENTS_KEYS = Object.keys(TABLE_EVENTS);\n\nexport const findEventProps = <T extends EventsProps>(\n props: T,\n supportedEvents: Record<string, string> = TABLE_EVENTS\n): EventsProps => {\n const result: EventsProps = {};\n\n Object.keys(props).forEach(key => {\n if (supportedEvents[key]) {\n result[key] = props[key];\n }\n });\n\n return result;\n};\n\nexport const bindEventsToTable = <T>(\n table: IVTable,\n newProps?: T | null,\n prevProps?: T | null,\n supportedEvents: Record<string, string> = TABLE_EVENTS\n) => {\n if ((!newProps && !prevProps) || !table) {\n return false;\n }\n\n const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;\n const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;\n\n if (prevEventProps) {\n Object.keys(prevEventProps).forEach(eventKey => {\n if (!newEventProps || !newEventProps[eventKey] || newEventProps[eventKey] !== prevEventProps[eventKey]) {\n table.off(supportedEvents[eventKey], prevProps[eventKey]);\n }\n });\n }\n\n if (newEventProps) {\n Object.keys(newEventProps).forEach(eventKey => {\n if (!prevEventProps || !prevEventProps[eventKey] || prevEventProps[eventKey] !== newEventProps[eventKey]) {\n table.on(supportedEvents[eventKey] as keyof TableEventHandlersEventArgumentMap, newEventProps[eventKey]);\n }\n });\n }\n\n return true;\n};\n"]}
package/cjs/index_old.js CHANGED
@@ -18,11 +18,11 @@ Object.defineProperty(exports, "__esModule", {
18
18
  value: !0
19
19
  }), exports.ReactVTable = void 0;
20
20
 
21
- const index_ts_1 = require("./../../vtable/src/index.ts"), react_1 = __importDefault(require("react")), react_2 = require("react"), ReactVTable = props => {
21
+ const vtable_1 = require("@visactor/vtable"), react_1 = __importDefault(require("react")), react_2 = require("react"), ReactVTable = props => {
22
22
  const {type: type, option: option, height: height = "100%", style: style} = props, restProps = __rest(props, [ "type", "option", "height", "style" ]), containerRef = (0,
23
23
  react_2.useRef)(null);
24
24
  return (0, react_2.useEffect)((() => {
25
- containerRef.current && (option.container = containerRef.current, new index_ts_1.ListTable(option));
25
+ containerRef.current && (option.container = containerRef.current, new vtable_1.ListTable(option));
26
26
  }), [ option, type ]), react_1.default.createElement("div", Object.assign({
27
27
  style: Object.assign(Object.assign({}, style), {
28
28
  height: height
@@ -1 +1 @@
1
- {"version":3,"sources":["index_old.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,0DAAwD;AAExD,kDAA0B;AAC1B,iCAA0C;AAInC,MAAM,WAAW,GAAc,KAAK,CAAC,EAAE;IAC5C,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,KAAmB,KAAK,EAAnB,SAAS,UAAK,KAAK,EAA9D,qCAAsD,CAAQ,CAAC;IACrE,MAAM,YAAY,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAElD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,YAAY,CAAC,OAAO,EAAE;YACxB,MAAM,CAAC,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC;YACxC,IAAI,oBAAS,CAAC,MAAM,CAAC,CAAC;SACvB;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,qDACE,KAAK,kCACA,KAAK,KACR,MAAM,OAEJ,SAAS,IACb,GAAG,EAAE,YAAY,EACjB,EAAE,EAAC,cAAc,IACjB,CACH,CAAC;AACJ,CAAC,CAAC;AAtBW,QAAA,WAAW,eAsBtB","file":"index_old.js","sourcesContent":["/* eslint-disable @typescript-eslint/no-duplicate-imports */\n/* eslint-disable @typescript-eslint/consistent-type-imports */\nimport { ListTable } from './../../vtable/src/index.ts';\nimport type { FC } from 'react';\nimport React from 'react';\nimport { useEffect, useRef } from 'react';\n\ntype Props = React.PropsWithChildren<any>;\n\nexport const ReactVTable: FC<Props> = props => {\n const { type, option, height = '100%', style, ...restProps } = props;\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (containerRef.current) {\n option.container = containerRef.current;\n new ListTable(option);\n }\n }, [option, type]);\n\n return (\n <div\n style={{\n ...style,\n height\n }}\n {...restProps}\n ref={containerRef}\n id=\"react-VTable\"\n />\n );\n};\n"]}
1
+ {"version":3,"sources":["index_old.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,6CAA6C;AAE7C,kDAA0B;AAC1B,iCAA0C;AAInC,MAAM,WAAW,GAAc,KAAK,CAAC,EAAE;IAC5C,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,KAAmB,KAAK,EAAnB,SAAS,UAAK,KAAK,EAA9D,qCAAsD,CAAQ,CAAC;IACrE,MAAM,YAAY,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAElD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,YAAY,CAAC,OAAO,EAAE;YACxB,MAAM,CAAC,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC;YACxC,IAAI,kBAAS,CAAC,MAAM,CAAC,CAAC;SACvB;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,qDACE,KAAK,kCACA,KAAK,KACR,MAAM,OAEJ,SAAS,IACb,GAAG,EAAE,YAAY,EACjB,EAAE,EAAC,cAAc,IACjB,CACH,CAAC;AACJ,CAAC,CAAC;AAtBW,QAAA,WAAW,eAsBtB","file":"index_old.js","sourcesContent":["/* eslint-disable @typescript-eslint/no-duplicate-imports */\n/* eslint-disable @typescript-eslint/consistent-type-imports */\nimport { ListTable } from '@visactor/vtable';\nimport type { FC } from 'react';\nimport React from 'react';\nimport { useEffect, useRef } from 'react';\n\ntype Props = React.PropsWithChildren<any>;\n\nexport const ReactVTable: FC<Props> = props => {\n const { type, option, height = '100%', style, ...restProps } = props;\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (containerRef.current) {\n option.container = containerRef.current;\n new ListTable(option);\n }\n }, [option, type]);\n\n return (\n <div\n style={{\n ...style,\n height\n }}\n {...restProps}\n ref={containerRef}\n id=\"react-VTable\"\n />\n );\n};\n"]}
@@ -1,4 +1,4 @@
1
- import * as VTable from './../../../vtable/src/index.ts';
1
+ import * as VTable from '@visactor/vtable';
2
2
  import React from 'react';
3
3
  import type { ContainerProps } from '../containers/withContainer';
4
4
  import type { EventsProps } from '../eventsUtils';
@@ -33,7 +33,7 @@ Object.defineProperty(exports, "__esModule", {
33
33
  value: !0
34
34
  }), exports.createTable = void 0;
35
35
 
36
- const VTable = __importStar(require("./../../../vtable/src/index.ts")), react_1 = __importStar(require("react")), withContainer_1 = __importDefault(require("../containers/withContainer")), table_1 = __importDefault(require("../context/table")), vutils_1 = require("@visactor/vutils"), util_1 = require("../util"), constants_1 = require("../constants"), eventsUtils_1 = require("../eventsUtils"), notOptionKeys = [ ...constants_1.REACT_PRIVATE_PROPS, ...eventsUtils_1.TABLE_EVENTS_KEYS, "skipFunctionDiff", "onError", "onReady", "option", "records", "container" ], BaseTable = react_1.default.forwardRef(((props, ref) => {
36
+ const VTable = __importStar(require("@visactor/vtable")), react_1 = __importStar(require("react")), withContainer_1 = __importDefault(require("../containers/withContainer")), table_1 = __importDefault(require("../context/table")), vutils_1 = require("@visactor/vutils"), util_1 = require("../util"), constants_1 = require("../constants"), eventsUtils_1 = require("../eventsUtils"), notOptionKeys = [ ...constants_1.REACT_PRIVATE_PROPS, ...eventsUtils_1.TABLE_EVENTS_KEYS, "skipFunctionDiff", "onError", "onReady", "option", "records", "container" ], BaseTable = react_1.default.forwardRef(((props, ref) => {
37
37
  const [updateId, setUpdateId] = (0, react_1.useState)(0), tableContext = (0, react_1.useRef)({
38
38
  optionFromChildren: {}
39
39
  });
@@ -62,7 +62,9 @@ const VTable = __importStar(require("./../../../vtable/src/index.ts")), react_1
62
62
  }
63
63
  }), [ handleTableRender, props ]);
64
64
  return (0, react_1.useEffect)((() => {
65
- if (!tableContext.current.table) return createTable(props), renderTable(), (0, eventsUtils_1.bindEventsToTable)(tableContext.current.table, props, null, eventsUtils_1.TABLE_EVENTS),
65
+ var _a;
66
+ if (!(null === (_a = tableContext.current) || void 0 === _a ? void 0 : _a.table)) return createTable(props),
67
+ renderTable(), (0, eventsUtils_1.bindEventsToTable)(tableContext.current.table, props, null, eventsUtils_1.TABLE_EVENTS),
66
68
  tableContext.current = Object.assign(Object.assign({}, tableContext.current), {
67
69
  isChildrenUpdated: !1
68
70
  }), void (eventsBinded.current = props);
@@ -1 +1 @@
1
- {"version":3,"sources":["tables/base-table.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,uEAAyD;AACzD,+CAA6F;AA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,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,8BAAC,eAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,CAAC,OAAO,IACnD,IAAA,cAAO,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,KAAsB,EAAE,KAAa,EAAE,EAAE;;QACrE,OAAO,CACL,8BAAC,eAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,MAAA,MAAA,MAAC,KAAa,aAAb,KAAK,uBAAL,KAAK,CAAU,KAAK,0CAAE,EAAE,mCAAK,KAAa,aAAb,KAAK,uBAAL,KAAK,CAAU,EAAE,mCAAI,SAAS,KAAK,EAAE,IACrF,eAAK,CAAC,YAAY,CAAC,KAAqB,EAAE;YACzC,QAAQ,EAAE,QAAQ;SACnB,CAAC,CACa,CAClB,CAAC;IACJ,CAAC,CAAC,CACwB,CAC7B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEI,MAAM,WAAW,GAAG,CAAkB,aAAqB,EAAE,IAAa,EAAE,QAA0B,EAAE,EAAE;IAC/G,MAAM,GAAG,GAAG,IAAA,uBAAa,EAAoB,SAAgB,EAAE,aAAa,EAAE,CAAC,KAAQ,EAAE,EAAE;QACzF,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAElB,IAAI,QAAQ,EAAE;YACZ,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;SACxB;QAED,IAAI,IAAI,EAAE;YACR,uCAAY,KAAK,KAAE,IAAI,IAAG;SAC3B;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,aAAa,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAfW,QAAA,WAAW,eAetB","file":"base-table.js","sourcesContent":["/* eslint-disable react/display-name */\n// import type { IData, IInitOption, ISpec } from '@visactor/vchart';\n// import VChart from '@visactor/vchart';\nimport * as VTable from './../../../vtable/src/index.ts';\nimport React, { useState, useEffect, useRef, useImperativeHandle, useCallback } from 'react';\nimport type { ContainerProps } from '../containers/withContainer';\nimport withContainer from '../containers/withContainer';\nimport type { TableContextType } from '../context/table';\nimport RootTableContext from '../context/table';\nimport { isEqual, pickWithout } from '@visactor/vutils';\nimport { toArray } from '../util';\nimport { REACT_PRIVATE_PROPS } from '../constants';\nimport type { IMarkElement } from '../components';\nimport type {\n EventsProps\n // LegendEventProps,\n // ScrollBarEventProps,\n // BrushEventProps,\n // DataZoomEventProps,\n // PlayerEventProps,\n // DimensionEventProps,\n // HierarchyEventProps,\n // TableLifeCycleEventProps\n} from '../eventsUtils';\nimport { bindEventsToTable, TABLE_EVENTS_KEYS, TABLE_EVENTS } from '../eventsUtils';\n\nexport type IVTable = VTable.ListTable | VTable.PivotTable | VTable.PivotChart;\n\nexport interface BaseTableProps extends EventsProps {\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /** option */\n option?: any;\n /** 数据 */\n records?: any;\n /** 画布宽度 */\n width?: number;\n /** 画布高度 */\n height?: number;\n skipFunctionDiff?: boolean;\n\n /** 表格渲染完成事件 */\n onReady?: (instance: IVTable, isInitial: boolean) => void;\n /** throw error when chart run into an error */\n onError?: (err: Error) => void;\n}\n\ntype Props = React.PropsWithChildren<BaseTableProps>;\n\nconst notOptionKeys = [\n ...REACT_PRIVATE_PROPS,\n ...TABLE_EVENTS_KEYS,\n 'skipFunctionDiff',\n 'onError',\n 'onReady',\n 'option',\n 'records',\n 'container'\n];\n\nconst BaseTable: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const tableContext = useRef<TableContextType>({\n optionFromChildren: {}\n });\n useImperativeHandle(ref, () => tableContext.current.table);\n const hasOption = !!props.option;\n const hasRecords = !!props.records;\n const isUnmount = useRef<boolean>(false);\n const prevOption = useRef(pickWithout(props, notOptionKeys));\n const prevRecords = useRef(props.records);\n const eventsBinded = React.useRef<BaseTableProps>(null);\n const skipFunctionDiff = !!props.skipFunctionDiff;\n\n const parseOption = useCallback(\n (props: Props) => {\n if (hasOption && props.option) {\n if (hasRecords && props.records) {\n return {\n ...props.option,\n records: props.records\n };\n }\n return props.option;\n }\n\n return {\n records: props.records,\n ...prevOption.current,\n ...tableContext.current.optionFromChildren\n };\n },\n [hasOption, hasRecords]\n );\n\n const createTable = useCallback(\n (props: Props) => {\n let vtable;\n if (props.type === 'pivot-table') {\n vtable = new VTable.PivotTable(props.container, parseOption(props));\n } else if (props.type === 'pivot-chart') {\n vtable = new VTable.PivotChart(props.container, parseOption(props));\n } else {\n vtable = new VTable.ListTable(props.container, parseOption(props));\n }\n tableContext.current = { ...tableContext.current, table: vtable };\n },\n [parseOption]\n );\n\n const handleTableRender = useCallback(() => {\n // rebind events after render\n bindEventsToTable(tableContext.current.table, props, eventsBinded.current, TABLE_EVENTS);\n\n if (!isUnmount.current) {\n // to be fixed\n // will cause another useEffect\n setUpdateId(updateId + 1);\n if (props.onReady) {\n props.onReady(tableContext.current.table, updateId === 0);\n }\n }\n }, [updateId, setUpdateId, props]);\n\n const renderTable = useCallback(() => {\n if (tableContext.current.table) {\n // eslint-disable-next-line promise/catch-or-return\n const renderPromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n renderPromise.catch(props.onError);\n }\n }\n }, [handleTableRender, props]);\n\n useEffect(() => {\n if (!tableContext.current.table) {\n createTable(props);\n renderTable();\n bindEventsToTable(tableContext.current.table, props, null, TABLE_EVENTS);\n tableContext.current = {\n ...tableContext.current,\n isChildrenUpdated: false\n };\n eventsBinded.current = props;\n return;\n }\n\n if (hasOption) {\n if (!isEqual(eventsBinded.current.option, props.option, { skipFunction: skipFunctionDiff })) {\n eventsBinded.current = props;\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\n } else if (\n hasRecords &&\n !isEqual(eventsBinded.current.records, props.records, { skipFunction: skipFunctionDiff })\n ) {\n eventsBinded.current = props;\n tableContext.current.table.setRecords(props.records);\n const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\n }\n return;\n }\n\n const newOption = pickWithout(props, notOptionKeys);\n\n if (\n !isEqual(newOption, prevOption.current, { skipFunction: skipFunctionDiff }) ||\n tableContext.current.isChildrenUpdated\n ) {\n prevOption.current = newOption;\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\n } else if (hasRecords && !isEqual(props.records, prevRecords.current, { skipFunction: skipFunctionDiff })) {\n prevRecords.current = props.records;\n tableContext.current.table.setRecords(props.records);\n const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\n }\n tableContext.current = {\n ...tableContext.current,\n isChildrenUpdated: false\n };\n }, [createTable, hasOption, hasRecords, parseOption, handleTableRender, renderTable, skipFunctionDiff, props]);\n\n useEffect(() => {\n return () => {\n if (tableContext) {\n if (tableContext.current.table) {\n tableContext.current.table.release();\n }\n tableContext.current = null;\n }\n isUnmount.current = true;\n };\n }, []);\n\n return (\n <RootTableContext.Provider value={tableContext.current}>\n {toArray(props.children).map((child: React.ReactNode, index: number) => {\n return (\n <React.Fragment key={(child as any)?.props?.id ?? (child as any)?.id ?? `child-${index}`}>\n {React.cloneElement(child as IMarkElement, {\n updateId: updateId\n })}\n </React.Fragment>\n );\n })}\n </RootTableContext.Provider>\n );\n});\n\nexport const createTable = <T extends Props>(componentName: string, type?: string, callback?: (props: T) => T) => {\n const Com = withContainer<ContainerProps, T>(BaseTable as any, componentName, (props: T) => {\n props.type = type;\n\n if (callback) {\n return callback(props);\n }\n\n if (type) {\n return { ...props, type };\n }\n return props;\n });\n Com.displayName = componentName;\n return Com;\n};\n"]}
1
+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Content":["/* eslint-disable react/display-name */\nimport * as VTable from '@visactor/vtable';\nimport React, { useState, useEffect, useRef, useImperativeHandle, useCallback } from 'react';\nimport type { ContainerProps } from '../containers/withContainer';\nimport withContainer from '../containers/withContainer';\nimport type { TableContextType } from '../context/table';\nimport RootTableContext from '../context/table';\nimport { isEqual, pickWithout } from '@visactor/vutils';\nimport { toArray } from '../util';\nimport { REACT_PRIVATE_PROPS } from '../constants';\nimport type { IMarkElement } from '../components';\nimport type {\n EventsProps\n // LegendEventProps,\n // ScrollBarEventProps,\n // BrushEventProps,\n // DataZoomEventProps,\n // PlayerEventProps,\n // DimensionEventProps,\n // HierarchyEventProps,\n // TableLifeCycleEventProps\n} from '../eventsUtils';\nimport { bindEventsToTable, TABLE_EVENTS_KEYS, TABLE_EVENTS } from '../eventsUtils';\n\nexport type IVTable = VTable.ListTable | VTable.PivotTable | VTable.PivotChart;\n\nexport interface BaseTableProps extends EventsProps {\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /** option */\n option?: any;\n /** 数据 */\n records?: any;\n /** 画布宽度 */\n width?: number;\n /** 画布高度 */\n height?: number;\n skipFunctionDiff?: boolean;\n\n /** 表格渲染完成事件 */\n onReady?: (instance: IVTable, isInitial: boolean) => void;\n /** throw error when chart run into an error */\n onError?: (err: Error) => void;\n}\n\ntype Props = React.PropsWithChildren<BaseTableProps>;\n\nconst notOptionKeys = [\n ...REACT_PRIVATE_PROPS,\n ...TABLE_EVENTS_KEYS,\n 'skipFunctionDiff',\n 'onError',\n 'onReady',\n 'option',\n 'records',\n 'container'\n];\n\nconst BaseTable: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const tableContext = useRef<TableContextType>({\n optionFromChildren: {}\n });\n useImperativeHandle(ref, () => tableContext.current.table);\n const hasOption = !!props.option;\n const hasRecords = !!props.records;\n const isUnmount = useRef<boolean>(false);\n const prevOption = useRef(pickWithout(props, notOptionKeys));\n const prevRecords = useRef(props.records);\n const eventsBinded = React.useRef<BaseTableProps>(null);\n const skipFunctionDiff = !!props.skipFunctionDiff;\n\n const parseOption = useCallback(\n (props: Props) => {\n if (hasOption && props.option) {\n if (hasRecords && props.records) {\n return {\n ...props.option,\n records: props.records\n };\n }\n return props.option;\n }\n\n return {\n records: props.records,\n ...prevOption.current,\n ...tableContext.current.optionFromChildren\n };\n },\n [hasOption, hasRecords]\n );\n\n const createTable = useCallback(\n (props: Props) => {\n let vtable;\n if (props.type === 'pivot-table') {\n vtable = new VTable.PivotTable(props.container, parseOption(props));\n } else if (props.type === 'pivot-chart') {\n vtable = new VTable.PivotChart(props.container, parseOption(props));\n } else {\n vtable = new VTable.ListTable(props.container, parseOption(props));\n }\n tableContext.current = { ...tableContext.current, table: vtable };\n },\n [parseOption]\n );\n\n const handleTableRender = useCallback(() => {\n // rebind events after render\n bindEventsToTable(tableContext.current.table, props, eventsBinded.current, TABLE_EVENTS);\n\n if (!isUnmount.current) {\n // to be fixed\n // will cause another useEffect\n setUpdateId(updateId + 1);\n if (props.onReady) {\n props.onReady(tableContext.current.table, updateId === 0);\n }\n }\n }, [updateId, setUpdateId, props]);\n\n const renderTable = useCallback(() => {\n if (tableContext.current.table) {\n // eslint-disable-next-line promise/catch-or-return\n const renderPromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n renderPromise.catch(props.onError);\n }\n }\n }, [handleTableRender, props]);\n\n useEffect(() => {\n if (!tableContext.current?.table) {\n createTable(props);\n renderTable();\n bindEventsToTable(tableContext.current.table, props, null, TABLE_EVENTS);\n tableContext.current = {\n ...tableContext.current,\n isChildrenUpdated: false\n };\n eventsBinded.current = props;\n return;\n }\n\n if (hasOption) {\n if (!isEqual(eventsBinded.current.option, props.option, { skipFunction: skipFunctionDiff })) {\n eventsBinded.current = props;\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\n } else if (\n hasRecords &&\n !isEqual(eventsBinded.current.records, props.records, { skipFunction: skipFunctionDiff })\n ) {\n eventsBinded.current = props;\n tableContext.current.table.setRecords(props.records);\n const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\n }\n return;\n }\n\n const newOption = pickWithout(props, notOptionKeys);\n\n if (\n !isEqual(newOption, prevOption.current, { skipFunction: skipFunctionDiff }) ||\n tableContext.current.isChildrenUpdated\n ) {\n prevOption.current = newOption;\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\n } else if (hasRecords && !isEqual(props.records, prevRecords.current, { skipFunction: skipFunctionDiff })) {\n prevRecords.current = props.records;\n tableContext.current.table.setRecords(props.records);\n const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\n }\n tableContext.current = {\n ...tableContext.current,\n isChildrenUpdated: false\n };\n }, [createTable, hasOption, hasRecords, parseOption, handleTableRender, renderTable, skipFunctionDiff, props]);\n\n useEffect(() => {\n return () => {\n if (tableContext) {\n if (tableContext.current.table) {\n tableContext.current.table.release();\n }\n tableContext.current = null;\n }\n isUnmount.current = true;\n };\n }, []);\n\n return (\n <RootTableContext.Provider value={tableContext.current}>\n {toArray(props.children).map((child: React.ReactNode, index: number) => {\n return (\n <React.Fragment key={(child as any)?.props?.id ?? (child as any)?.id ?? `child-${index}`}>\n {React.cloneElement(child as IMarkElement, {\n updateId: updateId\n })}\n </React.Fragment>\n );\n })}\n </RootTableContext.Provider>\n );\n});\n\nexport const createTable = <T extends Props>(componentName: string, type?: string, callback?: (props: T) => T) => {\n const Com = withContainer<ContainerProps, T>(BaseTable as any, componentName, (props: T) => {\n props.type = type;\n\n if (callback) {\n return callback(props);\n }\n\n if (type) {\n return { ...props, type };\n }\n return props;\n });\n Com.displayName = componentName;\n return Com;\n};\n"]}
@@ -1,8 +1,8 @@
1
1
  import type React from 'react';
2
- import type { ListTableConstructorOptions } from './../../../vtable/src/index.ts';
2
+ import type { ListTableConstructorOptions } from '@visactor/vtable';
3
3
  import type { BaseTableProps } from './base-table';
4
4
  export interface ListTableProps extends Omit<BaseTableProps, 'option' | 'records' | 'type'>, Omit<ListTableConstructorOptions, 'container'> {
5
5
  }
6
- export declare const ListTable: React.ForwardRefExoticComponent<Omit<ListTableProps & {
6
+ export declare const ListTable: React.ForwardRefExoticComponent<ListTableProps & {
7
7
  children?: React.ReactNode;
8
- } & import("../containers/withContainer").ContainerProps, "ref"> & React.RefAttributes<any>>;
8
+ } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
@@ -1 +1 @@
1
- {"version":3,"sources":["tables/list-table.tsx"],"names":[],"mappings":";;;AAGA,6CAA2C;AAM9B,QAAA,SAAS,GAAG,IAAA,wBAAW,EAA0C,WAAW,EAAE,YAAY,CAAC,CAAC","file":"list-table.js","sourcesContent":["import type React from 'react';\nimport type { ListTableConstructorOptions } from './../../../vtable/src/index.ts';\nimport type { BaseTableProps } from './base-table';\nimport { createTable } from './base-table';\n\nexport interface ListTableProps\n extends Omit<BaseTableProps, 'option' | 'records' | 'type'>,\n Omit<ListTableConstructorOptions, 'container'> {}\n\nexport const ListTable = createTable<React.PropsWithChildren<ListTableProps>>('ListTable', 'list-table');\n"]}
1
+ {"version":3,"sources":["tables/list-table.tsx"],"names":[],"mappings":";;;AAGA,6CAA2C;AAM9B,QAAA,SAAS,GAAG,IAAA,wBAAW,EAA0C,WAAW,EAAE,YAAY,CAAC,CAAC","file":"list-table.js","sourcesContent":["import type React from 'react';\nimport type { ListTableConstructorOptions } from '@visactor/vtable';\nimport type { BaseTableProps } from './base-table';\nimport { createTable } from './base-table';\n\nexport interface ListTableProps\n extends Omit<BaseTableProps, 'option' | 'records' | 'type'>,\n Omit<ListTableConstructorOptions, 'container'> {}\n\nexport const ListTable = createTable<React.PropsWithChildren<ListTableProps>>('ListTable', 'list-table');\n"]}
@@ -1,9 +1,9 @@
1
1
  import type React from 'react';
2
- import type { PivotChartConstructorOptions } from './../../../vtable/src/index.ts';
2
+ import type { PivotChartConstructorOptions } from '@visactor/vtable';
3
3
  import type { BaseTableProps } from './base-table';
4
4
  export interface PivotChartProps extends Omit<BaseTableProps, 'option' | 'records' | 'type'>, Omit<PivotChartConstructorOptions, 'container'> {
5
5
  }
6
- export declare const PivotChart: React.ForwardRefExoticComponent<Omit<PivotChartProps & {
6
+ export declare const PivotChart: React.ForwardRefExoticComponent<PivotChartProps & {
7
7
  children?: React.ReactNode;
8
- } & import("../containers/withContainer").ContainerProps, "ref"> & React.RefAttributes<any>>;
8
+ } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
9
9
  export declare function registerChartModule(name: string, chart: any): void;
@@ -29,7 +29,7 @@ Object.defineProperty(exports, "__esModule", {
29
29
  value: !0
30
30
  }), exports.registerChartModule = exports.PivotChart = void 0;
31
31
 
32
- const VTable = __importStar(require("./../../../vtable/src/index.ts")), base_table_1 = require("./base-table");
32
+ const VTable = __importStar(require("@visactor/vtable")), base_table_1 = require("./base-table");
33
33
 
34
34
  function registerChartModule(name, chart) {
35
35
  VTable.register.chartModule(name, chart);
@@ -1 +1 @@
1
- {"version":3,"sources":["tables/pivot-chart.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uEAAyD;AAGzD,6CAA2C;AAM9B,QAAA,UAAU,GAAG,IAAA,wBAAW,EAA2C,YAAY,EAAE,aAAa,CAAC,CAAC;AAE7G,SAAgB,mBAAmB,CAAC,IAAY,EAAE,KAAU;IAC1D,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC;AAFD,kDAEC","file":"pivot-chart.js","sourcesContent":["import type React from 'react';\nimport * as VTable from './../../../vtable/src/index.ts';\nimport type { PivotChartConstructorOptions } from './../../../vtable/src/index.ts';\nimport type { BaseTableProps } from './base-table';\nimport { createTable } from './base-table';\n\nexport interface PivotChartProps\n extends Omit<BaseTableProps, 'option' | 'records' | 'type'>,\n Omit<PivotChartConstructorOptions, 'container'> {}\n\nexport const PivotChart = createTable<React.PropsWithChildren<PivotChartProps>>('PivotChart', 'pivot-chart');\n\nexport function registerChartModule(name: string, chart: any) {\n VTable.register.chartModule(name, chart);\n}\n"]}
1
+ {"version":3,"sources":["tables/pivot-chart.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yDAA2C;AAG3C,6CAA2C;AAM9B,QAAA,UAAU,GAAG,IAAA,wBAAW,EAA2C,YAAY,EAAE,aAAa,CAAC,CAAC;AAE7G,SAAgB,mBAAmB,CAAC,IAAY,EAAE,KAAU;IAC1D,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC;AAFD,kDAEC","file":"pivot-chart.js","sourcesContent":["import type React from 'react';\nimport * as VTable from '@visactor/vtable';\nimport type { PivotChartConstructorOptions } from '@visactor/vtable';\nimport type { BaseTableProps } from './base-table';\nimport { createTable } from './base-table';\n\nexport interface PivotChartProps\n extends Omit<BaseTableProps, 'option' | 'records' | 'type'>,\n Omit<PivotChartConstructorOptions, 'container'> {}\n\nexport const PivotChart = createTable<React.PropsWithChildren<PivotChartProps>>('PivotChart', 'pivot-chart');\n\nexport function registerChartModule(name: string, chart: any) {\n VTable.register.chartModule(name, chart);\n}\n"]}