@visactor/react-vtable 0.15.0-alpha.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 (130) hide show
  1. package/README.md +151 -0
  2. package/cjs/components/base-component.d.ts +9 -0
  3. package/cjs/components/base-component.js +81 -0
  4. package/cjs/components/base-component.js.map +1 -0
  5. package/cjs/components/component/menu.d.ts +9 -0
  6. package/cjs/components/component/menu.js +10 -0
  7. package/cjs/components/component/menu.js.map +1 -0
  8. package/cjs/components/component/tooltip.d.ts +7 -0
  9. package/cjs/components/component/tooltip.js +10 -0
  10. package/cjs/components/component/tooltip.js.map +1 -0
  11. package/cjs/components/index.d.ts +14 -0
  12. package/cjs/components/index.js +79 -0
  13. package/cjs/components/index.js.map +1 -0
  14. package/cjs/components/list/list-column.d.ts +4 -0
  15. package/cjs/components/list/list-column.js +10 -0
  16. package/cjs/components/list/list-column.js.map +1 -0
  17. package/cjs/components/pivot/pivot-corner.d.ts +4 -0
  18. package/cjs/components/pivot/pivot-corner.js +10 -0
  19. package/cjs/components/pivot/pivot-corner.js.map +1 -0
  20. package/cjs/components/pivot/pivot-dimension.d.ts +5 -0
  21. package/cjs/components/pivot/pivot-dimension.js +11 -0
  22. package/cjs/components/pivot/pivot-dimension.js.map +1 -0
  23. package/cjs/components/pivot/pivot-header-title.d.ts +5 -0
  24. package/cjs/components/pivot/pivot-header-title.js +11 -0
  25. package/cjs/components/pivot/pivot-header-title.js.map +1 -0
  26. package/cjs/components/pivot/pivot-indicator.d.ts +4 -0
  27. package/cjs/components/pivot/pivot-indicator.js +10 -0
  28. package/cjs/components/pivot/pivot-indicator.js.map +1 -0
  29. package/cjs/constants.d.ts +1 -0
  30. package/cjs/constants.js +6 -0
  31. package/cjs/constants.js.map +1 -0
  32. package/cjs/containers/withContainer.d.ts +8 -0
  33. package/cjs/containers/withContainer.js +64 -0
  34. package/cjs/containers/withContainer.js.map +1 -0
  35. package/cjs/context/table.d.ts +10 -0
  36. package/cjs/context/table.js +25 -0
  37. package/cjs/context/table.js.map +1 -0
  38. package/cjs/eventsUtils.d.ts +88 -0
  39. package/cjs/eventsUtils.js +72 -0
  40. package/cjs/eventsUtils.js.map +1 -0
  41. package/cjs/index.d.ts +2 -0
  42. package/cjs/index.js +20 -0
  43. package/cjs/index.js.map +1 -0
  44. package/cjs/index_old.d.ts +5 -0
  45. package/cjs/index_old.js +36 -0
  46. package/cjs/index_old.js.map +1 -0
  47. package/cjs/tables/base-table.d.ts +19 -0
  48. package/cjs/tables/base-table.js +127 -0
  49. package/cjs/tables/base-table.js.map +1 -0
  50. package/cjs/tables/index.d.ts +3 -0
  51. package/cjs/tables/index.js +38 -0
  52. package/cjs/tables/index.js.map +1 -0
  53. package/cjs/tables/list-table.d.ts +8 -0
  54. package/cjs/tables/list-table.js +10 -0
  55. package/cjs/tables/list-table.js.map +1 -0
  56. package/cjs/tables/pivot-chart.d.ts +9 -0
  57. package/cjs/tables/pivot-chart.js +40 -0
  58. package/cjs/tables/pivot-chart.js.map +1 -0
  59. package/cjs/tables/pivot-table.d.ts +8 -0
  60. package/cjs/tables/pivot-table.js +10 -0
  61. package/cjs/tables/pivot-table.js.map +1 -0
  62. package/cjs/util.d.ts +8 -0
  63. package/cjs/util.js +57 -0
  64. package/cjs/util.js.map +1 -0
  65. package/dist/react-vtable.js +3628 -0
  66. package/dist/react-vtable.min.js +19 -0
  67. package/es/components/base-component.d.ts +9 -0
  68. package/es/components/base-component.js +53 -0
  69. package/es/components/base-component.js.map +1 -0
  70. package/es/components/component/menu.d.ts +9 -0
  71. package/es/components/component/menu.js +4 -0
  72. package/es/components/component/menu.js.map +1 -0
  73. package/es/components/component/tooltip.d.ts +7 -0
  74. package/es/components/component/tooltip.js +4 -0
  75. package/es/components/component/tooltip.js.map +1 -0
  76. package/es/components/index.d.ts +14 -0
  77. package/es/components/index.js +14 -0
  78. package/es/components/index.js.map +1 -0
  79. package/es/components/list/list-column.d.ts +4 -0
  80. package/es/components/list/list-column.js +4 -0
  81. package/es/components/list/list-column.js.map +1 -0
  82. package/es/components/pivot/pivot-corner.d.ts +4 -0
  83. package/es/components/pivot/pivot-corner.js +4 -0
  84. package/es/components/pivot/pivot-corner.js.map +1 -0
  85. package/es/components/pivot/pivot-dimension.d.ts +5 -0
  86. package/es/components/pivot/pivot-dimension.js +6 -0
  87. package/es/components/pivot/pivot-dimension.js.map +1 -0
  88. package/es/components/pivot/pivot-header-title.d.ts +5 -0
  89. package/es/components/pivot/pivot-header-title.js +6 -0
  90. package/es/components/pivot/pivot-header-title.js.map +1 -0
  91. package/es/components/pivot/pivot-indicator.d.ts +4 -0
  92. package/es/components/pivot/pivot-indicator.js +4 -0
  93. package/es/components/pivot/pivot-indicator.js.map +1 -0
  94. package/es/constants.d.ts +1 -0
  95. package/es/constants.js +2 -0
  96. package/es/constants.js.map +1 -0
  97. package/es/containers/withContainer.d.ts +8 -0
  98. package/es/containers/withContainer.js +33 -0
  99. package/es/containers/withContainer.js.map +1 -0
  100. package/es/context/table.d.ts +10 -0
  101. package/es/context/table.js +16 -0
  102. package/es/context/table.js.map +1 -0
  103. package/es/eventsUtils.d.ts +88 -0
  104. package/es/eventsUtils.js +65 -0
  105. package/es/eventsUtils.js.map +1 -0
  106. package/es/index.d.ts +2 -0
  107. package/es/index.js +3 -0
  108. package/es/index.js.map +1 -0
  109. package/es/index_old.d.ts +5 -0
  110. package/es/index_old.js +29 -0
  111. package/es/index_old.js.map +1 -0
  112. package/es/tables/base-table.d.ts +19 -0
  113. package/es/tables/base-table.js +104 -0
  114. package/es/tables/base-table.js.map +1 -0
  115. package/es/tables/index.d.ts +3 -0
  116. package/es/tables/index.js +6 -0
  117. package/es/tables/index.js.map +1 -0
  118. package/es/tables/list-table.d.ts +8 -0
  119. package/es/tables/list-table.js +4 -0
  120. package/es/tables/list-table.js.map +1 -0
  121. package/es/tables/pivot-chart.d.ts +9 -0
  122. package/es/tables/pivot-chart.js +10 -0
  123. package/es/tables/pivot-chart.js.map +1 -0
  124. package/es/tables/pivot-table.d.ts +8 -0
  125. package/es/tables/pivot-table.js +4 -0
  126. package/es/tables/pivot-table.js.map +1 -0
  127. package/es/util.d.ts +8 -0
  128. package/es/util.js +36 -0
  129. package/es/util.js.map +1 -0
  130. package/package.json +99 -0
package/README.md ADDED
@@ -0,0 +1,151 @@
1
+ <div align="center">
2
+ <a href="" target="_blank">
3
+ <img alt="VisActor Logo" width="200" src="https://github.com/VisActor/.github/blob/main/profile/500_200.svg"/>
4
+ </a>
5
+ </div>
6
+
7
+ <div align="center">
8
+ <h1>VTable</h1>
9
+ </div>
10
+
11
+ <div align="center">
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.
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)
24
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/visactor/vtable/blob/main/LICENSE)
25
+
26
+ </div>
27
+
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
+ # Usage
58
+
59
+ ## Installation
60
+
61
+ [npm package](https://www.npmjs.com/package/@visactor/vtable)
62
+
63
+ ```bash
64
+ // npm
65
+ npm install @visactor/vtable
66
+
67
+ // yarn
68
+ yarn add @visactor/vtable
69
+ ```
70
+
71
+ ## Quick Start
72
+
73
+ ```javascript
74
+ import * as VTable from '@visactor/vtable';
75
+
76
+ const columns =[
77
+ {
78
+ "field": "Order ID",
79
+ "caption": "Order ID",
80
+ },
81
+ {
82
+ "field": "Customer ID",
83
+ "caption": "Customer ID",
84
+ },
85
+ {
86
+ "field": "Product Name",
87
+ "caption": "Product Name",
88
+ },
89
+ {
90
+ "field": "Sales",
91
+ "caption": "Sales",
92
+ },
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
+ ],
117
+ columns,
118
+ widthMode:'standard'
119
+ };
120
+ const tableInstance = new VTable.ListTable(document.getElementById(CONTAINER_ID), option);
121
+
122
+
123
+
124
+
125
+ ```
126
+
127
+ ##
128
+
129
+ [More demos and detailed tutorials](https://visactor.io/vtable)
130
+
131
+ # Related Links
132
+
133
+ - [Official website](https://visactor.io/vtable)
134
+
135
+ # Ecosystem
136
+
137
+ | Project | Description |
138
+ | ----------------------------------------------------------- | -------------------------------------------------------------------------------------- |
139
+ | [AI-generated Components](https://visactor.io/ai-vtable) | AI-generated table component. |
140
+
141
+ # Contribution
142
+
143
+ If you would like to contribute, please read the [Code of Conduct ](./CODE_OF_CONDUCT.md) 和 [ Guide](./CONTRIBUTING.zh-CN.md) first。
144
+
145
+ Small streams converge to make great rivers and seas!
146
+
147
+ <a href="https://github.com/visactor/vtable/graphs/contributors"><img src="https://contrib.rocks/image?repo=visactor/vtable" /></a>
148
+
149
+ # License
150
+
151
+ [MIT License](./LICENSE)
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export interface BaseComponentProps {
3
+ id?: string | number;
4
+ }
5
+ type ComponentProps = BaseComponentProps & {
6
+ updateId?: number;
7
+ };
8
+ export declare const createComponent: <T extends ComponentProps>(componentName: string, optionName: string, supportedEvents?: Record<string, string> | null, isSingle?: boolean) => React.FC<T>;
9
+ export {};
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
4
+ void 0 === k2 && (k2 = k);
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ desc && !("get" in desc ? !m.__esModule : desc.writable || desc.configurable) || (desc = {
7
+ enumerable: !0,
8
+ get: function() {
9
+ return m[k];
10
+ }
11
+ }), Object.defineProperty(o, k2, desc);
12
+ } : function(o, m, k, k2) {
13
+ void 0 === k2 && (k2 = k), o[k2] = m[k];
14
+ }), __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function(o, v) {
15
+ Object.defineProperty(o, "default", {
16
+ enumerable: !0,
17
+ value: v
18
+ });
19
+ } : function(o, v) {
20
+ o.default = v;
21
+ }), __importStar = this && this.__importStar || function(mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (null != mod) for (var k in mod) "default" !== k && Object.prototype.hasOwnProperty.call(mod, k) && __createBinding(result, mod, k);
25
+ return __setModuleDefault(result, mod), result;
26
+ }, __importDefault = this && this.__importDefault || function(mod) {
27
+ return mod && mod.__esModule ? mod : {
28
+ default: mod
29
+ };
30
+ };
31
+
32
+ Object.defineProperty(exports, "__esModule", {
33
+ value: !0
34
+ }), exports.createComponent = void 0;
35
+
36
+ const react_1 = __importStar(require("react")), vutils_1 = require("@visactor/vutils"), table_1 = __importDefault(require("../context/table")), eventsUtils_1 = require("../eventsUtils"), util_1 = require("../util"), createComponent = (componentName, optionName, supportedEvents, isSingle) => {
37
+ const ignoreKeys = [ "id", "updateId" ], notOptionKeys = supportedEvents ? Object.keys(supportedEvents).concat(ignoreKeys) : ignoreKeys, Comp = props => {
38
+ const context = (0, react_1.useContext)(table_1.default), id = react_1.default.useRef((0,
39
+ vutils_1.isNil)(props.id) ? (0, util_1.uid)(optionName) : props.id), eventsBinded = react_1.default.useRef(null), updateId = react_1.default.useRef(props.updateId), componentOption = react_1.default.useRef();
40
+ if (props.updateId !== updateId.current) {
41
+ updateId.current = props.updateId;
42
+ !!supportedEvents && (0, eventsUtils_1.bindEventsToTable)(context.table, props, eventsBinded.current, supportedEvents) && (eventsBinded.current = props);
43
+ } else {
44
+ const newComponentOption = (0, vutils_1.pickWithout)(props, notOptionKeys);
45
+ (0, vutils_1.isEqual)(newComponentOption, componentOption.current) || (componentOption.current = newComponentOption,
46
+ updateToContext(context, id.current, optionName, isSingle, newComponentOption));
47
+ }
48
+ return (0, react_1.useEffect)((() => () => {
49
+ supportedEvents && (0, eventsUtils_1.bindEventsToTable)(context.table, null, eventsBinded.current, supportedEvents),
50
+ deleteToContext(context, id.current, optionName, isSingle);
51
+ }), []), null;
52
+ };
53
+ return Comp.displayName = componentName, Comp;
54
+ };
55
+
56
+ exports.createComponent = createComponent;
57
+
58
+ const updateToContext = (context, id, optionName, isSingle, props) => {
59
+ if (context.optionFromChildren) {
60
+ if (isSingle) context.optionFromChildren[optionName] = Object.assign({}, props); else {
61
+ context.optionFromChildren[optionName] || (context.optionFromChildren[optionName] = []);
62
+ const comps = context.optionFromChildren[optionName], index = comps.findIndex((entry => entry.id === id));
63
+ index >= 0 ? comps[index] = Object.assign({
64
+ id: id
65
+ }, props) : context.optionFromChildren[optionName].push(Object.assign({
66
+ id: id
67
+ }, props));
68
+ }
69
+ context.isChildrenUpdated = !0;
70
+ }
71
+ }, deleteToContext = (context, id, optionName, isSingle) => {
72
+ var _a;
73
+ if (context.optionFromChildren) if (isSingle) context.optionFromChildren[optionName] = null; else {
74
+ const comps = null !== (_a = context.optionFromChildren[optionName]) && void 0 !== _a ? _a : [], index = comps.findIndex((entry => entry.id === id));
75
+ if (index >= 0) {
76
+ const newComps = comps.slice(0, index - 1).concat(comps.slice(index + 1));
77
+ context.optionFromChildren[optionName] = newComps, context.isChildrenUpdated = !0;
78
+ }
79
+ }
80
+ };
81
+ //# sourceMappingURL=base-component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/base-component.tsx"],"names":[],"mappings":"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","file":"base-component.js","sourcesContent":["import React, { useContext, useEffect } from 'react';\nimport { isEqual, isNil, pickWithout } from '@visactor/vutils';\n\nimport type { TableContextType } from '../context/table';\nimport RootTableContext from '../context/table';\nimport { bindEventsToTable } from '../eventsUtils';\nimport { uid } from '../util';\n\nexport interface BaseComponentProps {\n id?: string | number;\n}\n\ntype ComponentProps = BaseComponentProps & { updateId?: number };\n\nexport const createComponent = <T extends ComponentProps>(\n componentName: string,\n optionName: string,\n supportedEvents?: Record<string, string> | null,\n isSingle?: boolean\n) => {\n const ignoreKeys = ['id', 'updateId'];\n const notOptionKeys = supportedEvents ? Object.keys(supportedEvents).concat(ignoreKeys) : ignoreKeys;\n\n const Comp: React.FC<T> = (props: T) => {\n const context = useContext(RootTableContext);\n const id = React.useRef<string | number>(isNil(props.id) ? uid(optionName) : props.id);\n\n const eventsBinded = React.useRef<T>(null);\n const updateId = React.useRef<number>(props.updateId);\n const componentOption = React.useRef<Partial<T>>();\n\n if (props.updateId !== updateId.current) {\n // update triggered by table when table is rendered\n updateId.current = props.updateId;\n\n // rebind events after table render\n const hasPrevEventsBinded = supportedEvents\n ? bindEventsToTable(context.table, props, eventsBinded.current, supportedEvents)\n : false;\n if (hasPrevEventsBinded) {\n eventsBinded.current = props;\n }\n } else {\n const newComponentOption: Partial<T> = pickWithout<T>(props, notOptionKeys);\n\n if (!isEqual(newComponentOption, componentOption.current)) {\n componentOption.current = newComponentOption;\n updateToContext(context, id.current, optionName, isSingle, newComponentOption);\n }\n }\n\n useEffect(() => {\n return () => {\n if (supportedEvents) {\n bindEventsToTable(context.table, null, eventsBinded.current, supportedEvents);\n }\n deleteToContext(context, id.current, optionName, isSingle);\n };\n }, []);\n\n return null;\n };\n\n Comp.displayName = componentName;\n return Comp;\n};\n\nconst updateToContext = (\n context: TableContextType,\n id: string | number,\n optionName: string,\n isSingle: boolean,\n props: Partial<ComponentProps>\n) => {\n if (!context.optionFromChildren) {\n return;\n }\n\n if (isSingle) {\n context.optionFromChildren[optionName] = { ...props };\n } else {\n if (!context.optionFromChildren[optionName]) {\n context.optionFromChildren[optionName] = [];\n }\n\n const comps = context.optionFromChildren[optionName];\n const index = comps.findIndex((entry: any) => entry.id === id);\n\n if (index >= 0) {\n comps[index] = {\n id,\n ...props\n };\n } else {\n context.optionFromChildren[optionName].push({\n id,\n ...props\n });\n }\n }\n context.isChildrenUpdated = true;\n};\n\nconst deleteToContext = (context: TableContextType, id: string | number, optionName: string, isSingle: boolean) => {\n if (!context.optionFromChildren) {\n return;\n }\n\n if (isSingle) {\n context.optionFromChildren[optionName] = null;\n } else {\n const comps = context.optionFromChildren[optionName] ?? [];\n const index = comps.findIndex((entry: any) => entry.id === id);\n\n if (index >= 0) {\n const newComps = comps.slice(0, index - 1).concat(comps.slice(index + 1));\n\n context.optionFromChildren[optionName] = newComps;\n context.isChildrenUpdated = true;\n }\n }\n};\n"]}
@@ -0,0 +1,9 @@
1
+ import type { BaseComponentProps } from '../base-component';
2
+ import type { TYPES } from './../../../../vtable/src/index.ts';
3
+ export type MenuProps = {
4
+ renderMode?: 'canvas' | 'html';
5
+ defaultHeaderMenuItems?: TYPES.MenuListItem[];
6
+ contextMenuItems?: TYPES.MenuListItem[] | ((field: string, row: number) => TYPES.MenuListItem[]);
7
+ dropDownMenuHighlight?: TYPES.DropDownMenuHighlightInfo[];
8
+ } & BaseComponentProps;
9
+ export declare const Menu: import("react").FC<MenuProps>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.Menu = void 0;
6
+
7
+ const base_component_1 = require("../base-component");
8
+
9
+ exports.Menu = (0, base_component_1.createComponent)("Menu", "menu", void 0, !0);
10
+ //# sourceMappingURL=menu.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,7 @@
1
+ import type { BaseComponentProps } from '../base-component';
2
+ export type TooltipProps = {
3
+ renderMode?: 'html';
4
+ isShowOverflowTextTooltip?: boolean;
5
+ confine?: boolean;
6
+ } & BaseComponentProps;
7
+ export declare const Tooltip: import("react").FC<TooltipProps>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.Tooltip = void 0;
6
+
7
+ const base_component_1 = require("../base-component");
8
+
9
+ exports.Tooltip = (0, base_component_1.createComponent)("Tooltip", "tooltip", void 0, !0);
10
+ //# sourceMappingURL=tooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/component/tooltip.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAWvC,QAAA,OAAO,GAAG,IAAA,gCAAe,EAAe,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","file":"tooltip.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\n\nexport type TooltipProps = {\n /** html目前实现较完整 先默认html渲染方式 */\n renderMode?: 'html'; // 目前暂不支持canvas方案\n /** 代替原来hover:isShowTooltip配置 暂时需要将renderMode配置为html才能显示,canvas的还未开发*/\n isShowOverflowTextTooltip?: boolean;\n /** 是否将 tooltip 框限制在画布区域内,默认开启。针对renderMode:\"html\"有效 */\n confine?: boolean;\n} & BaseComponentProps;\n\nexport const Tooltip = createComponent<TooltipProps>('Tooltip', 'tooltip', undefined, true);\n"]}
@@ -0,0 +1,14 @@
1
+ import type React from 'react';
2
+ export { ListColumn } from './list/list-column';
3
+ export { PivotColumnDimension, PivotRowDimension } from './pivot/pivot-dimension';
4
+ export { PivotIndicator } from './pivot/pivot-indicator';
5
+ export { PivotColumnHeaderTitle, PivotRowHeaderTitle } from './pivot/pivot-header-title';
6
+ export { PivotCorner } from './pivot/pivot-corner';
7
+ export { Menu } from './component/menu';
8
+ export { Tooltip } from './component/tooltip';
9
+ type Props = {
10
+ updateId?: number;
11
+ };
12
+ export interface IMarkElement extends React.ReactElement<Props, React.JSXElementConstructor<Props>> {
13
+ id: string | number;
14
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.Tooltip = exports.Menu = exports.PivotCorner = exports.PivotRowHeaderTitle = exports.PivotColumnHeaderTitle = exports.PivotIndicator = exports.PivotRowDimension = exports.PivotColumnDimension = exports.ListColumn = void 0;
6
+
7
+ var list_column_1 = require("./list/list-column");
8
+
9
+ Object.defineProperty(exports, "ListColumn", {
10
+ enumerable: !0,
11
+ get: function() {
12
+ return list_column_1.ListColumn;
13
+ }
14
+ });
15
+
16
+ var pivot_dimension_1 = require("./pivot/pivot-dimension");
17
+
18
+ Object.defineProperty(exports, "PivotColumnDimension", {
19
+ enumerable: !0,
20
+ get: function() {
21
+ return pivot_dimension_1.PivotColumnDimension;
22
+ }
23
+ }), Object.defineProperty(exports, "PivotRowDimension", {
24
+ enumerable: !0,
25
+ get: function() {
26
+ return pivot_dimension_1.PivotRowDimension;
27
+ }
28
+ });
29
+
30
+ var pivot_indicator_1 = require("./pivot/pivot-indicator");
31
+
32
+ Object.defineProperty(exports, "PivotIndicator", {
33
+ enumerable: !0,
34
+ get: function() {
35
+ return pivot_indicator_1.PivotIndicator;
36
+ }
37
+ });
38
+
39
+ var pivot_header_title_1 = require("./pivot/pivot-header-title");
40
+
41
+ Object.defineProperty(exports, "PivotColumnHeaderTitle", {
42
+ enumerable: !0,
43
+ get: function() {
44
+ return pivot_header_title_1.PivotColumnHeaderTitle;
45
+ }
46
+ }), Object.defineProperty(exports, "PivotRowHeaderTitle", {
47
+ enumerable: !0,
48
+ get: function() {
49
+ return pivot_header_title_1.PivotRowHeaderTitle;
50
+ }
51
+ });
52
+
53
+ var pivot_corner_1 = require("./pivot/pivot-corner");
54
+
55
+ Object.defineProperty(exports, "PivotCorner", {
56
+ enumerable: !0,
57
+ get: function() {
58
+ return pivot_corner_1.PivotCorner;
59
+ }
60
+ });
61
+
62
+ var menu_1 = require("./component/menu");
63
+
64
+ Object.defineProperty(exports, "Menu", {
65
+ enumerable: !0,
66
+ get: function() {
67
+ return menu_1.Menu;
68
+ }
69
+ });
70
+
71
+ var tooltip_1 = require("./component/tooltip");
72
+
73
+ Object.defineProperty(exports, "Tooltip", {
74
+ enumerable: !0,
75
+ get: function() {
76
+ return tooltip_1.Tooltip;
77
+ }
78
+ });
79
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/index.ts"],"names":[],"mappings":";;;AACA,kDAAgD;AAAvC,yGAAA,UAAU,OAAA;AACnB,2DAAkF;AAAzE,uHAAA,oBAAoB,OAAA;AAAE,oHAAA,iBAAiB,OAAA;AAChD,2DAAyD;AAAhD,iHAAA,cAAc,OAAA;AACvB,iEAAyF;AAAhF,4HAAA,sBAAsB,OAAA;AAAE,yHAAA,mBAAmB,OAAA;AACpD,qDAAmD;AAA1C,2GAAA,WAAW,OAAA;AACpB,yCAAwC;AAA/B,4FAAA,IAAI,OAAA;AACb,+CAA8C;AAArC,kGAAA,OAAO,OAAA","file":"index.js","sourcesContent":["import type React from 'react';\nexport { ListColumn } from './list/list-column';\nexport { PivotColumnDimension, PivotRowDimension } from './pivot/pivot-dimension';\nexport { PivotIndicator } from './pivot/pivot-indicator';\nexport { PivotColumnHeaderTitle, PivotRowHeaderTitle } from './pivot/pivot-header-title';\nexport { PivotCorner } from './pivot/pivot-corner';\nexport { Menu } from './component/menu';\nexport { Tooltip } from './component/tooltip';\n\ntype Props = { updateId?: number };\n\nexport interface IMarkElement extends React.ReactElement<Props, React.JSXElementConstructor<Props>> {\n id: string | number;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { BaseComponentProps } from '../base-component';
2
+ import type { ColumnDefine } from './../../../../vtable/src/index.ts';
3
+ export type ListColumnProps = ColumnDefine & BaseComponentProps;
4
+ export declare const ListColumn: import("react").FC<any>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.ListColumn = void 0;
6
+
7
+ const base_component_1 = require("../base-component");
8
+
9
+ exports.ListColumn = (0, base_component_1.createComponent)("ListColumn", "columns");
10
+ //# sourceMappingURL=list-column.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,4 @@
1
+ import type { BaseComponentProps } from '../base-component';
2
+ import type { ICornerDefine } from './../../../../vtable/src/index.ts';
3
+ export type PivotCornerProps = ICornerDefine & BaseComponentProps;
4
+ export declare const PivotCorner: import("react").FC<any>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.PivotCorner = void 0;
6
+
7
+ const base_component_1 = require("../base-component");
8
+
9
+ exports.PivotCorner = (0, base_component_1.createComponent)("PivotCorner", "corner", void 0, !0);
10
+ //# sourceMappingURL=pivot-corner.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,5 @@
1
+ import type { BaseComponentProps } from '../base-component';
2
+ import type { IDimension } from './../../../../vtable/src/index.ts';
3
+ export type PivotDimensionProps = IDimension & BaseComponentProps;
4
+ export declare const PivotColumnDimension: import("react").FC<any>;
5
+ export declare const PivotRowDimension: import("react").FC<any>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.PivotRowDimension = exports.PivotColumnDimension = void 0;
6
+
7
+ const base_component_1 = require("../base-component");
8
+
9
+ exports.PivotColumnDimension = (0, base_component_1.createComponent)("PivotColumnDimension", "columns"),
10
+ exports.PivotRowDimension = (0, base_component_1.createComponent)("PivotRowDimension", "rows");
11
+ //# sourceMappingURL=pivot-dimension.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,5 @@
1
+ import type { BaseComponentProps } from '../base-component';
2
+ import type { ITitleDefine } from './../../../../vtable/src/index.ts';
3
+ export type PivotHeaderTitleProps = ITitleDefine & BaseComponentProps;
4
+ export declare const PivotColumnHeaderTitle: import("react").FC<any>;
5
+ export declare const PivotRowHeaderTitle: import("react").FC<any>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.PivotRowHeaderTitle = exports.PivotColumnHeaderTitle = void 0;
6
+
7
+ const base_component_1 = require("../base-component");
8
+
9
+ exports.PivotColumnHeaderTitle = (0, base_component_1.createComponent)("PivotColumnHeaderTitle", "columnHeaderTitle", void 0, !0),
10
+ exports.PivotRowHeaderTitle = (0, base_component_1.createComponent)("PivotRowHeaderTitle", "rowHeaderTitle", void 0, !0);
11
+ //# sourceMappingURL=pivot-header-title.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,4 @@
1
+ import type { BaseComponentProps } from '../base-component';
2
+ import type { IIndicator } from './../../../../vtable/src/index.ts';
3
+ export type PivotIndicatorProps = IIndicator & BaseComponentProps;
4
+ export declare const PivotIndicator: import("react").FC<any>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.PivotIndicator = void 0;
6
+
7
+ const base_component_1 = require("../base-component");
8
+
9
+ exports.PivotIndicator = (0, base_component_1.createComponent)("PivotIndicator", "indicators");
10
+ //# sourceMappingURL=pivot-indicator.js.map
@@ -0,0 +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"]}
@@ -0,0 +1 @@
1
+ export declare const REACT_PRIVATE_PROPS: string[];
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.REACT_PRIVATE_PROPS = void 0, exports.REACT_PRIVATE_PROPS = [ "children", "hooks", "ref" ];
6
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,mBAAmB,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC","file":"constants.js","sourcesContent":["export const REACT_PRIVATE_PROPS = ['children', 'hooks', 'ref'];\n"]}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface ContainerProps {
3
+ style?: React.CSSProperties;
4
+ className?: string;
5
+ width?: number | string;
6
+ height?: number | string;
7
+ }
8
+ export default function withContainer<Props extends ContainerProps, CompProps>(Comp: typeof React.Component<any, CompProps>, name?: string, getProps?: (props: any) => CompProps): React.ForwardRefExoticComponent<React.PropsWithoutRef<CompProps & Props> & React.RefAttributes<any>>;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
4
+ void 0 === k2 && (k2 = k);
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ desc && !("get" in desc ? !m.__esModule : desc.writable || desc.configurable) || (desc = {
7
+ enumerable: !0,
8
+ get: function() {
9
+ return m[k];
10
+ }
11
+ }), Object.defineProperty(o, k2, desc);
12
+ } : function(o, m, k, k2) {
13
+ void 0 === k2 && (k2 = k), o[k2] = m[k];
14
+ }), __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function(o, v) {
15
+ Object.defineProperty(o, "default", {
16
+ enumerable: !0,
17
+ value: v
18
+ });
19
+ } : function(o, v) {
20
+ o.default = v;
21
+ }), __importStar = this && this.__importStar || function(mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (null != mod) for (var k in mod) "default" !== k && Object.prototype.hasOwnProperty.call(mod, k) && __createBinding(result, mod, k);
25
+ return __setModuleDefault(result, mod), result;
26
+ }, __rest = this && this.__rest || function(s, e) {
27
+ var t = {};
28
+ for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
29
+ if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
30
+ var i = 0;
31
+ for (p = Object.getOwnPropertySymbols(s); i < p.length; i++) e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
32
+ }
33
+ return t;
34
+ };
35
+
36
+ Object.defineProperty(exports, "__esModule", {
37
+ value: !0
38
+ });
39
+
40
+ const react_1 = __importStar(require("react"));
41
+
42
+ function withContainer(Comp, name = "TableContainer", getProps) {
43
+ const Cls = react_1.default.forwardRef(((props, ref) => {
44
+ const container = (0, react_1.useRef)(), [inited, setInited] = (0, react_1.useState)(!1), {className: className, style: style, width: width} = props, options = __rest(props, [ "className", "style", "width" ]);
45
+ return (0, react_1.useLayoutEffect)((() => {
46
+ setInited(!0);
47
+ }), []), react_1.default.createElement("div", {
48
+ ref: container,
49
+ className: className,
50
+ style: Object.assign({
51
+ position: "relative",
52
+ height: props.height || "100%",
53
+ width: props.width || "100%"
54
+ }, style)
55
+ }, inited ? react_1.default.createElement(Comp, Object.assign({
56
+ ref: ref,
57
+ container: container.current
58
+ }, getProps ? getProps(options) : options)) : react_1.default.createElement(react_1.default.Fragment, null));
59
+ }));
60
+ return Cls.displayName = name || Comp.name, Cls;
61
+ }
62
+
63
+ exports.default = withContainer;
64
+ //# sourceMappingURL=withContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["containers/withContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiE;AASjE,SAAwB,aAAa,CACnC,IAA4C,EAC5C,IAAI,GAAG,gBAAgB,EACvB,QAAoC;IAEpC,MAAM,GAAG,GAAG,eAAK,CAAC,UAAU,CAAyB,CAAC,KAAwB,EAAE,GAAG,EAAE,EAAE;QACrF,MAAM,SAAS,GAAG,IAAA,cAAM,GAAE,CAAC;QAC3B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,KAAiB,KAAK,EAAjB,OAAO,UAAK,KAAK,EAA/C,+BAAuC,CAAQ,CAAC;QAEtD,IAAA,uBAAe,EAAC,GAAG,EAAE;YACnB,SAAS,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,CACL,uCACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,SAAS,EACpB,KAAK,kBACH,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,MAAM,EAC9B,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,MAAM,IACzB,KAAK,KAGT,MAAM,CAAC,CAAC,CAAC,CACR,8BAAC,IAAI,kBAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC,OAAO,IAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAE,OAAqB,CAAC,EAAI,CAC9G,CAAC,CAAC,CAAC,CACF,6DAAK,CACN,CACG,CACP,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC;IACpC,OAAO,GAAG,CAAC;AACb,CAAC;AAnCD,gCAmCC","file":"withContainer.js","sourcesContent":["import React, { useRef, useState, useLayoutEffect } from 'react';\n\nexport interface ContainerProps {\n style?: React.CSSProperties;\n className?: string;\n width?: number | string;\n height?: number | string;\n}\n\nexport default function withContainer<Props extends ContainerProps, CompProps>(\n Comp: typeof React.Component<any, CompProps>,\n name = 'TableContainer',\n getProps?: (props: any) => CompProps\n) {\n const Cls = React.forwardRef<any, CompProps & Props>((props: CompProps & Props, ref) => {\n const container = useRef();\n const [inited, setInited] = useState(false);\n const { className, style, width, ...options } = props;\n\n useLayoutEffect(() => {\n setInited(true);\n }, []);\n\n return (\n <div\n ref={container}\n className={className}\n style={{\n position: 'relative',\n height: props.height || '100%',\n width: props.width || '100%',\n ...style\n }}\n >\n {inited ? (\n <Comp ref={ref} container={container.current} {...(getProps ? getProps(options) : (options as CompProps))} />\n ) : (\n <></>\n )}\n </div>\n );\n });\n Cls.displayName = name || Comp.name;\n return Cls;\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { ListTable, PivotTable, PivotChart } from './../../../vtable/src/index.ts';
3
+ export interface TableContextType {
4
+ table?: ListTable | PivotTable | PivotChart;
5
+ optionFromChildren: any;
6
+ isChildrenUpdated?: boolean;
7
+ }
8
+ declare const TableContext: React.Context<TableContextType>;
9
+ export declare function withTableInstance<T>(Component: typeof React.Component): React.ForwardRefExoticComponent<React.PropsWithoutRef<T> & React.RefAttributes<any>>;
10
+ export default TableContext;