k-react-vtable 1.0.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.
- package/README.md +93 -0
- package/cjs/components/avatar/avatar.d.ts +14 -0
- package/cjs/components/avatar/avatar.js +84 -0
- package/cjs/components/avatar/avatar.js.map +1 -0
- package/cjs/components/button/button.d.ts +27 -0
- package/cjs/components/button/button.js +107 -0
- package/cjs/components/button/button.js.map +1 -0
- package/cjs/components/checkbox/checkbox.d.ts +17 -0
- package/cjs/components/checkbox/checkbox.js +69 -0
- package/cjs/components/checkbox/checkbox.js.map +1 -0
- package/cjs/components/index.d.ts +7 -0
- package/cjs/components/index.js +24 -0
- package/cjs/components/index.js.map +1 -0
- package/cjs/components/link/link.d.ts +30 -0
- package/cjs/components/link/link.js +119 -0
- package/cjs/components/link/link.js.map +1 -0
- package/cjs/components/popover/popover.d.ts +14 -0
- package/cjs/components/popover/popover.js +283 -0
- package/cjs/components/popover/popover.js.map +1 -0
- package/cjs/components/radio/radio.d.ts +15 -0
- package/cjs/components/radio/radio.js +68 -0
- package/cjs/components/radio/radio.js.map +1 -0
- package/cjs/components/tag/tag.d.ts +13 -0
- package/cjs/components/tag/tag.js +47 -0
- package/cjs/components/tag/tag.js.map +1 -0
- package/cjs/components/vrender-components/checkbox.d.ts +4 -0
- package/cjs/components/vrender-components/checkbox.js +6 -0
- package/cjs/components/vrender-components/checkbox.js.map +1 -0
- package/cjs/components/vrender-components/component-creater.d.ts +1 -0
- package/cjs/components/vrender-components/component-creater.js +22 -0
- package/cjs/components/vrender-components/component-creater.js.map +1 -0
- package/cjs/components/vrender-components/radio.d.ts +4 -0
- package/cjs/components/vrender-components/radio.js +6 -0
- package/cjs/components/vrender-components/radio.js.map +1 -0
- package/cjs/components/vrender-components/tag.d.ts +4 -0
- package/cjs/components/vrender-components/tag.js +6 -0
- package/cjs/components/vrender-components/tag.js.map +1 -0
- package/cjs/components/vrender-components/type.d.ts +6 -0
- package/cjs/components/vrender-components/type.js +6 -0
- package/cjs/components/vrender-components/type.js.map +1 -0
- package/cjs/constants.d.ts +1 -0
- package/cjs/constants.js +6 -0
- package/cjs/constants.js.map +1 -0
- package/cjs/containers/withContainer.d.ts +8 -0
- package/cjs/containers/withContainer.js +63 -0
- package/cjs/containers/withContainer.js.map +1 -0
- package/cjs/context/table.d.ts +9 -0
- package/cjs/context/table.js +25 -0
- package/cjs/context/table.js.map +1 -0
- package/cjs/eventsUtils.d.ts +130 -0
- package/cjs/eventsUtils.js +93 -0
- package/cjs/eventsUtils.js.map +1 -0
- package/cjs/index.d.ts +4 -0
- package/cjs/index.js +22 -0
- package/cjs/index.js.map +1 -0
- package/cjs/table-components/base-component.d.ts +12 -0
- package/cjs/table-components/base-component.js +87 -0
- package/cjs/table-components/base-component.js.map +1 -0
- package/cjs/table-components/component/emptyTip.d.ts +20 -0
- package/cjs/table-components/component/emptyTip.js +10 -0
- package/cjs/table-components/component/emptyTip.js.map +1 -0
- package/cjs/table-components/component/menu.d.ts +10 -0
- package/cjs/table-components/component/menu.js +10 -0
- package/cjs/table-components/component/menu.js.map +1 -0
- package/cjs/table-components/component/title.d.ts +4 -0
- package/cjs/table-components/component/title.js +10 -0
- package/cjs/table-components/component/title.js.map +1 -0
- package/cjs/table-components/component/tooltip.d.ts +7 -0
- package/cjs/table-components/component/tooltip.js +10 -0
- package/cjs/table-components/component/tooltip.js.map +1 -0
- package/cjs/table-components/custom/custom-layout.d.ts +11 -0
- package/cjs/table-components/custom/custom-layout.js +107 -0
- package/cjs/table-components/custom/custom-layout.js.map +1 -0
- package/cjs/table-components/custom/graphic.d.ts +19 -0
- package/cjs/table-components/custom/graphic.js +9 -0
- package/cjs/table-components/custom/graphic.js.map +1 -0
- package/cjs/table-components/custom/reconciler.d.ts +2 -0
- package/cjs/table-components/custom/reconciler.js +107 -0
- package/cjs/table-components/custom/reconciler.js.map +1 -0
- package/cjs/table-components/custom/vtable-browser-env-contribution.d.ts +6 -0
- package/cjs/table-components/custom/vtable-browser-env-contribution.js +35 -0
- package/cjs/table-components/custom/vtable-browser-env-contribution.js.map +1 -0
- package/cjs/table-components/custom/vtable-react-attribute-plugin.d.ts +21 -0
- package/cjs/table-components/custom/vtable-react-attribute-plugin.js +135 -0
- package/cjs/table-components/custom/vtable-react-attribute-plugin.js.map +1 -0
- package/cjs/table-components/custom-component.d.ts +17 -0
- package/cjs/table-components/custom-component.js +98 -0
- package/cjs/table-components/custom-component.js.map +1 -0
- package/cjs/table-components/index.d.ts +20 -0
- package/cjs/table-components/index.js +130 -0
- package/cjs/table-components/index.js.map +1 -0
- package/cjs/table-components/list/list-column.d.ts +4 -0
- package/cjs/table-components/list/list-column.js +10 -0
- package/cjs/table-components/list/list-column.js.map +1 -0
- package/cjs/table-components/pivot/pivot-corner.d.ts +4 -0
- package/cjs/table-components/pivot/pivot-corner.js +10 -0
- package/cjs/table-components/pivot/pivot-corner.js.map +1 -0
- package/cjs/table-components/pivot/pivot-dimension.d.ts +6 -0
- package/cjs/table-components/pivot/pivot-dimension.js +11 -0
- package/cjs/table-components/pivot/pivot-dimension.js.map +1 -0
- package/cjs/table-components/pivot/pivot-header-title.d.ts +5 -0
- package/cjs/table-components/pivot/pivot-header-title.js +11 -0
- package/cjs/table-components/pivot/pivot-header-title.js.map +1 -0
- package/cjs/table-components/pivot/pivot-indicator.d.ts +4 -0
- package/cjs/table-components/pivot/pivot-indicator.js +10 -0
- package/cjs/table-components/pivot/pivot-indicator.js.map +1 -0
- package/cjs/tables/base-table.d.ts +23 -0
- package/cjs/tables/base-table.js +199 -0
- package/cjs/tables/base-table.js.map +1 -0
- package/cjs/tables/index.d.ts +6 -0
- package/cjs/tables/index.js +65 -0
- package/cjs/tables/index.js.map +1 -0
- package/cjs/tables/list-table-simple.d.ts +8 -0
- package/cjs/tables/list-table-simple.js +13 -0
- package/cjs/tables/list-table-simple.js.map +1 -0
- package/cjs/tables/list-table.d.ts +8 -0
- package/cjs/tables/list-table.js +13 -0
- package/cjs/tables/list-table.js.map +1 -0
- package/cjs/tables/pivot-chart.d.ts +13 -0
- package/cjs/tables/pivot-chart.js +17 -0
- package/cjs/tables/pivot-chart.js.map +1 -0
- package/cjs/tables/pivot-table-simple.d.ts +8 -0
- package/cjs/tables/pivot-table-simple.js +13 -0
- package/cjs/tables/pivot-table-simple.js.map +1 -0
- package/cjs/tables/pivot-table.d.ts +8 -0
- package/cjs/tables/pivot-table.js +13 -0
- package/cjs/tables/pivot-table.js.map +1 -0
- package/cjs/util.d.ts +8 -0
- package/cjs/util.js +56 -0
- package/cjs/util.js.map +1 -0
- package/cjs/vtable.d.ts +1 -0
- package/cjs/vtable.js +2 -0
- package/cjs/vtable.js.map +1 -0
- package/dist/react-vtable.js +7662 -0
- package/dist/react-vtable.min.js +10 -0
- package/es/components/avatar/avatar.d.ts +14 -0
- package/es/components/avatar/avatar.js +82 -0
- package/es/components/avatar/avatar.js.map +1 -0
- package/es/components/button/button.d.ts +27 -0
- package/es/components/button/button.js +84 -0
- package/es/components/button/button.js.map +1 -0
- package/es/components/checkbox/checkbox.d.ts +17 -0
- package/es/components/checkbox/checkbox.js +48 -0
- package/es/components/checkbox/checkbox.js.map +1 -0
- package/es/components/index.d.ts +7 -0
- package/es/components/index.js +14 -0
- package/es/components/index.js.map +1 -0
- package/es/components/link/link.d.ts +30 -0
- package/es/components/link/link.js +96 -0
- package/es/components/link/link.js.map +1 -0
- package/es/components/popover/popover.d.ts +14 -0
- package/es/components/popover/popover.js +260 -0
- package/es/components/popover/popover.js.map +1 -0
- package/es/components/radio/radio.d.ts +15 -0
- package/es/components/radio/radio.js +47 -0
- package/es/components/radio/radio.js.map +1 -0
- package/es/components/tag/tag.d.ts +13 -0
- package/es/components/tag/tag.js +45 -0
- package/es/components/tag/tag.js.map +1 -0
- package/es/components/vrender-components/checkbox.d.ts +4 -0
- package/es/components/vrender-components/checkbox.js +2 -0
- package/es/components/vrender-components/checkbox.js.map +1 -0
- package/es/components/vrender-components/component-creater.d.ts +1 -0
- package/es/components/vrender-components/component-creater.js +14 -0
- package/es/components/vrender-components/component-creater.js.map +1 -0
- package/es/components/vrender-components/radio.d.ts +4 -0
- package/es/components/vrender-components/radio.js +2 -0
- package/es/components/vrender-components/radio.js.map +1 -0
- package/es/components/vrender-components/tag.d.ts +4 -0
- package/es/components/vrender-components/tag.js +2 -0
- package/es/components/vrender-components/tag.js.map +1 -0
- package/es/components/vrender-components/type.d.ts +6 -0
- package/es/components/vrender-components/type.js +2 -0
- package/es/components/vrender-components/type.js.map +1 -0
- package/es/constants.d.ts +1 -0
- package/es/constants.js +2 -0
- package/es/constants.js.map +1 -0
- package/es/containers/withContainer.d.ts +8 -0
- package/es/containers/withContainer.js +32 -0
- package/es/containers/withContainer.js.map +1 -0
- package/es/context/table.d.ts +9 -0
- package/es/context/table.js +16 -0
- package/es/context/table.js.map +1 -0
- package/es/eventsUtils.d.ts +130 -0
- package/es/eventsUtils.js +86 -0
- package/es/eventsUtils.js.map +1 -0
- package/es/index.d.ts +4 -0
- package/es/index.js +8 -0
- package/es/index.js.map +1 -0
- package/es/table-components/base-component.d.ts +12 -0
- package/es/table-components/base-component.js +60 -0
- package/es/table-components/base-component.js.map +1 -0
- package/es/table-components/component/emptyTip.d.ts +20 -0
- package/es/table-components/component/emptyTip.js +4 -0
- package/es/table-components/component/emptyTip.js.map +1 -0
- package/es/table-components/component/menu.d.ts +10 -0
- package/es/table-components/component/menu.js +4 -0
- package/es/table-components/component/menu.js.map +1 -0
- package/es/table-components/component/title.d.ts +4 -0
- package/es/table-components/component/title.js +4 -0
- package/es/table-components/component/title.js.map +1 -0
- package/es/table-components/component/tooltip.d.ts +7 -0
- package/es/table-components/component/tooltip.js +4 -0
- package/es/table-components/component/tooltip.js.map +1 -0
- package/es/table-components/custom/custom-layout.d.ts +11 -0
- package/es/table-components/custom/custom-layout.js +79 -0
- package/es/table-components/custom/custom-layout.js.map +1 -0
- package/es/table-components/custom/graphic.d.ts +19 -0
- package/es/table-components/custom/graphic.js +22 -0
- package/es/table-components/custom/graphic.js.map +1 -0
- package/es/table-components/custom/reconciler.d.ts +2 -0
- package/es/table-components/custom/reconciler.js +106 -0
- package/es/table-components/custom/reconciler.js.map +1 -0
- package/es/table-components/custom/vtable-browser-env-contribution.d.ts +6 -0
- package/es/table-components/custom/vtable-browser-env-contribution.js +33 -0
- package/es/table-components/custom/vtable-browser-env-contribution.js.map +1 -0
- package/es/table-components/custom/vtable-react-attribute-plugin.d.ts +21 -0
- package/es/table-components/custom/vtable-react-attribute-plugin.js +127 -0
- package/es/table-components/custom/vtable-react-attribute-plugin.js.map +1 -0
- package/es/table-components/custom-component.d.ts +17 -0
- package/es/table-components/custom-component.js +67 -0
- package/es/table-components/custom-component.js.map +1 -0
- package/es/table-components/index.d.ts +20 -0
- package/es/table-components/index.js +26 -0
- package/es/table-components/index.js.map +1 -0
- package/es/table-components/list/list-column.d.ts +4 -0
- package/es/table-components/list/list-column.js +4 -0
- package/es/table-components/list/list-column.js.map +1 -0
- package/es/table-components/pivot/pivot-corner.d.ts +4 -0
- package/es/table-components/pivot/pivot-corner.js +4 -0
- package/es/table-components/pivot/pivot-corner.js.map +1 -0
- package/es/table-components/pivot/pivot-dimension.d.ts +6 -0
- package/es/table-components/pivot/pivot-dimension.js +6 -0
- package/es/table-components/pivot/pivot-dimension.js.map +1 -0
- package/es/table-components/pivot/pivot-header-title.d.ts +5 -0
- package/es/table-components/pivot/pivot-header-title.js +6 -0
- package/es/table-components/pivot/pivot-header-title.js.map +1 -0
- package/es/table-components/pivot/pivot-indicator.d.ts +4 -0
- package/es/table-components/pivot/pivot-indicator.js +4 -0
- package/es/table-components/pivot/pivot-indicator.js.map +1 -0
- package/es/tables/base-table.d.ts +23 -0
- package/es/tables/base-table.js +178 -0
- package/es/tables/base-table.js.map +1 -0
- package/es/tables/index.d.ts +6 -0
- package/es/tables/index.js +12 -0
- package/es/tables/index.js.map +1 -0
- package/es/tables/list-table-simple.d.ts +8 -0
- package/es/tables/list-table-simple.js +9 -0
- package/es/tables/list-table-simple.js.map +1 -0
- package/es/tables/list-table.d.ts +8 -0
- package/es/tables/list-table.js +9 -0
- package/es/tables/list-table.js.map +1 -0
- package/es/tables/pivot-chart.d.ts +13 -0
- package/es/tables/pivot-chart.js +15 -0
- package/es/tables/pivot-chart.js.map +1 -0
- package/es/tables/pivot-table-simple.d.ts +8 -0
- package/es/tables/pivot-table-simple.js +9 -0
- package/es/tables/pivot-table-simple.js.map +1 -0
- package/es/tables/pivot-table.d.ts +8 -0
- package/es/tables/pivot-table.js +9 -0
- package/es/tables/pivot-table.js.map +1 -0
- package/es/util.d.ts +8 -0
- package/es/util.js +35 -0
- package/es/util.js.map +1 -0
- package/es/vtable.d.ts +1 -0
- package/es/vtable.js +2 -0
- package/es/vtable.js.map +1 -0
- package/package.json +104 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { type CSSProperties, type HTMLAttributes, type DetailedHTMLProps } from 'react';
|
|
2
|
+
export interface CustomComponentProps extends Omit<DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>, 'className' | 'ref'> {
|
|
3
|
+
style?: CSSProperties;
|
|
4
|
+
className?: string;
|
|
5
|
+
displayMode: 'position' | 'cell';
|
|
6
|
+
x?: number;
|
|
7
|
+
y?: number;
|
|
8
|
+
width?: number | string;
|
|
9
|
+
height?: number | string;
|
|
10
|
+
row?: number;
|
|
11
|
+
col?: number;
|
|
12
|
+
anchor?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
13
|
+
dx?: number | string;
|
|
14
|
+
dy?: number | string;
|
|
15
|
+
}
|
|
16
|
+
export declare const CustomComponent: React.FC<CustomComponentProps>;
|
|
17
|
+
export default function useMergeProps<PropsType>(componentProps: PropsType, defaultProps: Partial<PropsType>): PropsType;
|
|
@@ -0,0 +1,98 @@
|
|
|
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.CustomComponent = void 0;
|
|
35
|
+
|
|
36
|
+
const react_1 = __importStar(require("react")), table_1 = __importDefault(require("../context/table")), vutils_1 = require("@visactor/vutils"), CustomComponent = baseProps => {
|
|
37
|
+
const context = (0, react_1.useContext)(table_1.default), {table: table} = context, props = useMergeProps(baseProps, {
|
|
38
|
+
style: {
|
|
39
|
+
left: 0,
|
|
40
|
+
top: 0
|
|
41
|
+
},
|
|
42
|
+
className: "vtable-custom-component",
|
|
43
|
+
displayMode: "position",
|
|
44
|
+
x: 0,
|
|
45
|
+
y: 0,
|
|
46
|
+
width: 0,
|
|
47
|
+
height: 0,
|
|
48
|
+
row: 0,
|
|
49
|
+
col: 0,
|
|
50
|
+
anchor: "top-left",
|
|
51
|
+
dx: 0,
|
|
52
|
+
dy: 0
|
|
53
|
+
}), {displayMode: displayMode, x: x, y: y, width: width, height: height, row: row, col: col, anchor: anchor, dx: dx, dy: dy, className: className, children: children, style: style} = props;
|
|
54
|
+
let styleLeft, styleTop, styleWidth, styleHeight;
|
|
55
|
+
if ("position" === displayMode) styleLeft = x + dx + "px", styleTop = y + dy + "px",
|
|
56
|
+
styleWidth = width + "px", styleHeight = height + "px"; else if ("cell" === displayMode) {
|
|
57
|
+
const cellRect = table && col >= 0 && row >= 0 ? null == table ? void 0 : table.getCellRelativeRect(col, row) : {
|
|
58
|
+
width: 0,
|
|
59
|
+
height: 0,
|
|
60
|
+
left: -9999,
|
|
61
|
+
top: -9999
|
|
62
|
+
};
|
|
63
|
+
styleWidth = dealWidthNumber(width, cellRect.width) + "px", styleHeight = dealWidthNumber(height, cellRect.height) + "px",
|
|
64
|
+
"top-left" === anchor ? (styleLeft = cellRect.left + dealWidthNumber(dx, cellRect.width) + "px",
|
|
65
|
+
styleTop = cellRect.top + dealWidthNumber(dy, cellRect.height) + "px") : "top-right" === anchor ? (styleLeft = cellRect.left + dealWidthNumber(dx, cellRect.width) + cellRect.width + "px",
|
|
66
|
+
styleTop = cellRect.top + dealWidthNumber(dy, cellRect.height) + "px") : "bottom-left" === anchor ? (styleLeft = cellRect.left + dealWidthNumber(dx, cellRect.width) + "px",
|
|
67
|
+
styleTop = cellRect.top + dealWidthNumber(dy, cellRect.height) + cellRect.height + "px") : "bottom-right" === anchor && (styleLeft = cellRect.left + dealWidthNumber(dx, cellRect.width) + cellRect.width + "px",
|
|
68
|
+
styleTop = cellRect.top + dealWidthNumber(dy, cellRect.height) + cellRect.height + "px");
|
|
69
|
+
}
|
|
70
|
+
const componentStyle = (0, vutils_1.merge)({}, style, {
|
|
71
|
+
position: "absolute",
|
|
72
|
+
zIndex: 1e3,
|
|
73
|
+
width: styleWidth,
|
|
74
|
+
height: styleHeight,
|
|
75
|
+
left: styleLeft,
|
|
76
|
+
top: styleTop
|
|
77
|
+
});
|
|
78
|
+
return react_1.default.createElement("div", {
|
|
79
|
+
className: className,
|
|
80
|
+
style: componentStyle
|
|
81
|
+
}, react_1.default.Children.map(children, (child => child ? react_1.default.cloneElement(child, {}) : child)));
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
function useMergeProps(componentProps, defaultProps) {
|
|
85
|
+
const _defaultProps = (0, react_1.useMemo)((() => Object.assign({}, defaultProps)), [ defaultProps ]);
|
|
86
|
+
return (0, react_1.useMemo)((() => {
|
|
87
|
+
const mProps = (0, vutils_1.merge)({}, componentProps);
|
|
88
|
+
for (const propName in _defaultProps) void 0 === mProps[propName] && (mProps[propName] = _defaultProps[propName]);
|
|
89
|
+
return mProps;
|
|
90
|
+
}), [ componentProps, _defaultProps ]);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function dealWidthNumber(value, refenceValue) {
|
|
94
|
+
return (0, vutils_1.isNumber)(value) ? value : "string" == typeof value && value.endsWith("%") ? Number(value.slice(0, -1)) / 100 * refenceValue : 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=custom-component.js.map
|
|
98
|
+
exports.CustomComponent = CustomComponent, exports.default = useMergeProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-components/custom-component.tsx"],"names":[],"mappings":"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","file":"custom-component.js","sourcesContent":["import type { ReactElement } from 'react';\nimport React, {\n type CSSProperties,\n type ReactNode,\n type HTMLAttributes,\n type DetailedHTMLProps,\n useContext,\n useMemo\n} from 'react';\nimport RootTableContext from '../context/table';\nimport { isNumber, merge } from '@visactor/vutils';\n\nexport interface CustomComponentProps\n extends Omit<DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>, 'className' | 'ref'> {\n style?: CSSProperties;\n // className?: string | string[];\n className?: string;\n\n // for table\n displayMode: 'position' | 'cell';\n x?: number;\n y?: number;\n width?: number | string;\n height?: number | string;\n // width?: number;\n // height?: number;\n row?: number;\n col?: number;\n anchor?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';\n dx?: number | string;\n dy?: number | string;\n // dx?: number;\n // dy?: number;\n}\n\nexport const CustomComponent: React.FC<CustomComponentProps> = (baseProps: CustomComponentProps) => {\n const context = useContext(RootTableContext);\n const { table } = context;\n\n // if (!table) {\n // return null;\n // }\n\n const props = useMergeProps<CustomComponentProps>(baseProps, {\n style: {\n left: 0,\n top: 0\n },\n className: 'vtable-custom-component',\n displayMode: 'position',\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n row: 0,\n col: 0,\n anchor: 'top-left',\n dx: 0,\n dy: 0\n });\n const { displayMode, x, y, width, height, row, col, anchor, dx, dy, className, children, style } = props;\n\n let styleLeft;\n let styleTop;\n let styleWidth;\n let styleHeight;\n\n if (displayMode === 'position') {\n styleLeft = x + (dx as number) + 'px';\n styleTop = y + (dy as number) + 'px';\n styleWidth = width + 'px';\n styleHeight = height + 'px';\n } else if (displayMode === 'cell') {\n const cellRect =\n table && col >= 0 && row >= 0\n ? table?.getCellRelativeRect(col, row)\n : { width: 0, height: 0, left: -9999, top: -9999 };\n styleWidth = dealWidthNumber(width, cellRect.width) + 'px';\n styleHeight = dealWidthNumber(height, cellRect.height) + 'px';\n if (anchor === 'top-left') {\n styleLeft = cellRect.left + dealWidthNumber(dx, cellRect.width) + 'px';\n styleTop = cellRect.top + dealWidthNumber(dy, cellRect.height) + 'px';\n } else if (anchor === 'top-right') {\n styleLeft = cellRect.left + dealWidthNumber(dx, cellRect.width) + cellRect.width + 'px';\n styleTop = cellRect.top + dealWidthNumber(dy, cellRect.height) + 'px';\n } else if (anchor === 'bottom-left') {\n styleLeft = cellRect.left + dealWidthNumber(dx, cellRect.width) + 'px';\n styleTop = cellRect.top + dealWidthNumber(dy, cellRect.height) + cellRect.height + 'px';\n } else if (anchor === 'bottom-right') {\n styleLeft = cellRect.left + dealWidthNumber(dx, cellRect.width) + cellRect.width + 'px';\n styleTop = cellRect.top + dealWidthNumber(dy, cellRect.height) + cellRect.height + 'px';\n }\n }\n\n const componentStyle = merge({}, style, {\n position: 'absolute',\n zIndex: 1000,\n width: styleWidth,\n height: styleHeight,\n left: styleLeft,\n top: styleTop\n });\n\n return (\n <div className={className} style={componentStyle}>\n {React.Children.map(children, (child: ReactNode) => {\n if (child) {\n return React.cloneElement(child as ReactElement, {});\n }\n return child;\n })}\n </div>\n );\n};\n\n// export const CustomComponent = forwardRef<unknown, CustomComponentProps>(CustomComponent1);\n\nexport default function useMergeProps<PropsType>(\n componentProps: PropsType,\n defaultProps: Partial<PropsType>\n): PropsType {\n const _defaultProps = useMemo(() => {\n return { ...defaultProps };\n }, [defaultProps]);\n\n const props = useMemo(() => {\n const mProps = merge({}, componentProps);\n\n // https://github.com/facebook/react/blob/cae635054e17a6f107a39d328649137b83f25972/packages/react/src/ReactElement.js#L312\n for (const propName in _defaultProps) {\n if (mProps[propName] === undefined) {\n mProps[propName] = _defaultProps[propName];\n }\n }\n\n return mProps;\n }, [componentProps, _defaultProps]);\n\n return props;\n}\n\nfunction dealWidthNumber(value: string | number, refenceValue: number) {\n if (isNumber(value)) {\n return value;\n }\n\n if (typeof value === 'string' && value.endsWith('%')) {\n return (Number(value.slice(0, -1)) / 100) * refenceValue;\n }\n\n return 0;\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
export { EmptyTip } from './component/emptyTip';
|
|
10
|
+
export { Title } from './component/title';
|
|
11
|
+
export { CustomComponent } from './custom-component';
|
|
12
|
+
export { CustomLayout, type CustomLayoutFunctionArg } from './custom/custom-layout';
|
|
13
|
+
export * from './custom/graphic';
|
|
14
|
+
export * from './custom/vtable-react-attribute-plugin';
|
|
15
|
+
type Props = {
|
|
16
|
+
updateId?: number;
|
|
17
|
+
};
|
|
18
|
+
export interface IMarkElement extends React.ReactElement<Props, React.JSXElementConstructor<Props>> {
|
|
19
|
+
id: string | number;
|
|
20
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
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
|
+
}), __exportStar = this && this.__exportStar || function(m, exports) {
|
|
15
|
+
for (var p in m) "default" === p || Object.prototype.hasOwnProperty.call(exports, p) || __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
Object.defineProperty(exports, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), exports.CustomLayout = exports.CustomComponent = exports.Title = exports.EmptyTip = exports.Tooltip = exports.Menu = exports.PivotCorner = exports.PivotRowHeaderTitle = exports.PivotColumnHeaderTitle = exports.PivotIndicator = exports.PivotRowDimension = exports.PivotColumnDimension = exports.ListColumn = void 0;
|
|
21
|
+
|
|
22
|
+
var list_column_1 = require("./list/list-column");
|
|
23
|
+
|
|
24
|
+
Object.defineProperty(exports, "ListColumn", {
|
|
25
|
+
enumerable: !0,
|
|
26
|
+
get: function() {
|
|
27
|
+
return list_column_1.ListColumn;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
var pivot_dimension_1 = require("./pivot/pivot-dimension");
|
|
32
|
+
|
|
33
|
+
Object.defineProperty(exports, "PivotColumnDimension", {
|
|
34
|
+
enumerable: !0,
|
|
35
|
+
get: function() {
|
|
36
|
+
return pivot_dimension_1.PivotColumnDimension;
|
|
37
|
+
}
|
|
38
|
+
}), Object.defineProperty(exports, "PivotRowDimension", {
|
|
39
|
+
enumerable: !0,
|
|
40
|
+
get: function() {
|
|
41
|
+
return pivot_dimension_1.PivotRowDimension;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
var pivot_indicator_1 = require("./pivot/pivot-indicator");
|
|
46
|
+
|
|
47
|
+
Object.defineProperty(exports, "PivotIndicator", {
|
|
48
|
+
enumerable: !0,
|
|
49
|
+
get: function() {
|
|
50
|
+
return pivot_indicator_1.PivotIndicator;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
var pivot_header_title_1 = require("./pivot/pivot-header-title");
|
|
55
|
+
|
|
56
|
+
Object.defineProperty(exports, "PivotColumnHeaderTitle", {
|
|
57
|
+
enumerable: !0,
|
|
58
|
+
get: function() {
|
|
59
|
+
return pivot_header_title_1.PivotColumnHeaderTitle;
|
|
60
|
+
}
|
|
61
|
+
}), Object.defineProperty(exports, "PivotRowHeaderTitle", {
|
|
62
|
+
enumerable: !0,
|
|
63
|
+
get: function() {
|
|
64
|
+
return pivot_header_title_1.PivotRowHeaderTitle;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
var pivot_corner_1 = require("./pivot/pivot-corner");
|
|
69
|
+
|
|
70
|
+
Object.defineProperty(exports, "PivotCorner", {
|
|
71
|
+
enumerable: !0,
|
|
72
|
+
get: function() {
|
|
73
|
+
return pivot_corner_1.PivotCorner;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
var menu_1 = require("./component/menu");
|
|
78
|
+
|
|
79
|
+
Object.defineProperty(exports, "Menu", {
|
|
80
|
+
enumerable: !0,
|
|
81
|
+
get: function() {
|
|
82
|
+
return menu_1.Menu;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
var tooltip_1 = require("./component/tooltip");
|
|
87
|
+
|
|
88
|
+
Object.defineProperty(exports, "Tooltip", {
|
|
89
|
+
enumerable: !0,
|
|
90
|
+
get: function() {
|
|
91
|
+
return tooltip_1.Tooltip;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
var emptyTip_1 = require("./component/emptyTip");
|
|
96
|
+
|
|
97
|
+
Object.defineProperty(exports, "EmptyTip", {
|
|
98
|
+
enumerable: !0,
|
|
99
|
+
get: function() {
|
|
100
|
+
return emptyTip_1.EmptyTip;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
var title_1 = require("./component/title");
|
|
105
|
+
|
|
106
|
+
Object.defineProperty(exports, "Title", {
|
|
107
|
+
enumerable: !0,
|
|
108
|
+
get: function() {
|
|
109
|
+
return title_1.Title;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
var custom_component_1 = require("./custom-component");
|
|
114
|
+
|
|
115
|
+
Object.defineProperty(exports, "CustomComponent", {
|
|
116
|
+
enumerable: !0,
|
|
117
|
+
get: function() {
|
|
118
|
+
return custom_component_1.CustomComponent;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
var custom_layout_1 = require("./custom/custom-layout");
|
|
123
|
+
|
|
124
|
+
Object.defineProperty(exports, "CustomLayout", {
|
|
125
|
+
enumerable: !0,
|
|
126
|
+
get: function() {
|
|
127
|
+
return custom_layout_1.CustomLayout;
|
|
128
|
+
}
|
|
129
|
+
}), __exportStar(require("./custom/graphic"), exports), __exportStar(require("./custom/vtable-react-attribute-plugin"), exports);
|
|
130
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-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;AAChB,iDAAgD;AAAvC,oGAAA,QAAQ,OAAA;AACjB,2CAA0C;AAAjC,8FAAA,KAAK,OAAA;AAEd,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AACxB,wDAAoF;AAA3E,6GAAA,YAAY,OAAA;AACrB,mDAAiC;AAEjC,yEAAuD","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';\nexport { EmptyTip } from './component/emptyTip';\nexport { Title } from './component/title';\n\nexport { CustomComponent } from './custom-component';\nexport { CustomLayout, type CustomLayoutFunctionArg } from './custom/custom-layout';\nexport * from './custom/graphic';\n\nexport * from './custom/vtable-react-attribute-plugin';\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,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":["table-components/list/list-column.tsx"],"names":[],"mappings":";;;AAEA,sDAAoD;AAKvC,QAAA,UAAU,GAAG,IAAA,gCAAe,EAAkB,YAAY,EAAE,SAAS,CAAC,CAAC","file":"list-column.js","sourcesContent":["import type { ReactElement, ReactNode } from 'react';\nimport type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { ColumnDefine } from 'k-vtable';\n\nexport type ListColumnProps = Omit<ColumnDefine, 'columns'> & BaseComponentProps;\n\nexport const ListColumn = createComponent<ListColumnProps>('ListColumn', 'columns');\n"]}
|
|
@@ -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":["table-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 'k-vtable';\n\nexport type PivotCornerProps = ICornerDefine & BaseComponentProps;\n\nexport const PivotCorner = createComponent<PivotCornerProps>('PivotCorner', 'corner', undefined, true);\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BaseComponentProps } from '../base-component';
|
|
2
|
+
import type { IRowDimension, IColumnDimension } from 'k-vtable';
|
|
3
|
+
export type RowPivotDimensionProps = IRowDimension & BaseComponentProps;
|
|
4
|
+
export type ColumnPivotDimensionProps = IColumnDimension & BaseComponentProps;
|
|
5
|
+
export declare const PivotColumnDimension: import("react").FC<any>;
|
|
6
|
+
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":["table-components/pivot/pivot-dimension.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAMvC,QAAA,oBAAoB,GAAG,IAAA,gCAAe,EAA4B,sBAAsB,EAAE,SAAS,CAAC,CAAC;AACrG,QAAA,iBAAiB,GAAG,IAAA,gCAAe,EAAyB,mBAAmB,EAAE,MAAM,CAAC,CAAC","file":"pivot-dimension.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { IRowDimension, IColumnDimension } from 'k-vtable';\n\nexport type RowPivotDimensionProps = IRowDimension & BaseComponentProps;\nexport type ColumnPivotDimensionProps = IColumnDimension & BaseComponentProps;\n\nexport const PivotColumnDimension = createComponent<ColumnPivotDimensionProps>('PivotColumnDimension', 'columns');\nexport const PivotRowDimension = createComponent<RowPivotDimensionProps>('PivotRowDimension', 'rows');\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BaseComponentProps } from '../base-component';
|
|
2
|
+
import type { ITitleDefine } from 'k-vtable';
|
|
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":["table-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 'k-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"]}
|
|
@@ -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":["table-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 'k-vtable';\n\nexport type PivotIndicatorProps = IIndicator & BaseComponentProps;\n\nexport const PivotIndicator = createComponent<PivotIndicatorProps>('PivotIndicator', 'indicators');\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ContainerProps } from '../containers/withContainer';
|
|
3
|
+
import type { EventsProps } from '../eventsUtils';
|
|
4
|
+
import { VTableReactAttributePlugin } from '../table-components/custom/vtable-react-attribute-plugin';
|
|
5
|
+
import type { ListTable, PivotTable, PivotChart, ListTableConstructorOptions, PivotTableConstructorOptions, PivotChartConstructorOptions } from 'k-vtable';
|
|
6
|
+
export type IVTable = ListTable | PivotTable | PivotChart;
|
|
7
|
+
export type IOption = ListTableConstructorOptions | PivotTableConstructorOptions | PivotChartConstructorOptions;
|
|
8
|
+
export type BaseTableProps = EventsProps & IOption & {
|
|
9
|
+
vtableConstrouctor?: any;
|
|
10
|
+
type?: string;
|
|
11
|
+
container?: HTMLDivElement;
|
|
12
|
+
option?: IOption;
|
|
13
|
+
records?: Record<string, unknown>[];
|
|
14
|
+
width?: number | string;
|
|
15
|
+
height?: number | string;
|
|
16
|
+
skipFunctionDiff?: boolean;
|
|
17
|
+
keepColumnWidthChange?: boolean;
|
|
18
|
+
ReactDOM?: any;
|
|
19
|
+
reactAttributePlugin?: VTableReactAttributePlugin;
|
|
20
|
+
onReady?: (instance: IVTable, isInitial: boolean) => void;
|
|
21
|
+
onError?: (err: Error) => void;
|
|
22
|
+
};
|
|
23
|
+
export declare const createTable: <T extends unknown>(componentName: string, defaultProps?: Partial<T>, callback?: (props: T) => T) => React.ForwardRefExoticComponent<React.PropsWithoutRef<T & ContainerProps> & React.RefAttributes<any>>;
|
|
@@ -0,0 +1,199 @@
|
|
|
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.createTable = void 0;
|
|
35
|
+
|
|
36
|
+
const 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"), vtable_react_attribute_plugin_1 = require("../table-components/custom/vtable-react-attribute-plugin"), vtable_browser_env_contribution_1 = require("../table-components/custom/vtable-browser-env-contribution"), vrender_1 = require("k-vtable/es/vrender");
|
|
37
|
+
|
|
38
|
+
(0, vrender_1.isBrowserEnv)() && vrender_1.container.load(vtable_browser_env_contribution_1.reactEnvModule);
|
|
39
|
+
|
|
40
|
+
const notOptionKeys = [ ...constants_1.REACT_PRIVATE_PROPS, ...eventsUtils_1.TABLE_EVENTS_KEYS, "skipFunctionDiff", "onError", "onReady", "option", "records", "container", "vtableConstrouctor" ], getComponentId = (child, index) => `${child && child.type && (child.type.displayName || child.type.name)}-${index}`, parseOptionFromChildren = props => {
|
|
41
|
+
const optionFromChildren = {};
|
|
42
|
+
return (0, util_1.toArray)(props.children).map(((child, index) => {
|
|
43
|
+
const parseOption = child && child.type && child.type.parseOption;
|
|
44
|
+
if (parseOption && child.props) {
|
|
45
|
+
const optionResult = parseOption((0, vutils_1.isNil)(child.props.componentId) ? Object.assign(Object.assign({}, child.props), {
|
|
46
|
+
componentId: getComponentId(child, index)
|
|
47
|
+
}) : child.props);
|
|
48
|
+
child.key && (optionResult.option.key = child.key), optionResult.isSingle ? optionFromChildren[optionResult.optionName] = optionResult.option : (optionFromChildren[optionResult.optionName] || (optionFromChildren[optionResult.optionName] = []),
|
|
49
|
+
optionFromChildren[optionResult.optionName].push(optionResult.option));
|
|
50
|
+
}
|
|
51
|
+
})), optionFromChildren;
|
|
52
|
+
}, BaseTable = react_1.default.forwardRef(((props, ref) => {
|
|
53
|
+
const [updateId, setUpdateId] = (0, react_1.useState)(0), tableContext = (0, react_1.useRef)({});
|
|
54
|
+
(0, react_1.useImperativeHandle)(ref, (() => {
|
|
55
|
+
var _a;
|
|
56
|
+
return null === (_a = tableContext.current) || void 0 === _a ? void 0 : _a.table;
|
|
57
|
+
}));
|
|
58
|
+
const hasOption = !!props.option, hasRecords = !!props.records, isUnmount = (0,
|
|
59
|
+
react_1.useRef)(!1), prevOption = (0, react_1.useRef)((0, vutils_1.pickWithout)(props, notOptionKeys)), optionFromChildren = (0,
|
|
60
|
+
react_1.useRef)(null), prevRecords = (0, react_1.useRef)(props.records), eventsBinded = react_1.default.useRef(null), skipFunctionDiff = !!props.skipFunctionDiff, keepColumnWidthChange = !!props.keepColumnWidthChange, columnWidths = (0,
|
|
61
|
+
react_1.useRef)(new Map), pivotColumnWidths = (0, react_1.useRef)([]), pivotHeaderColumnWidths = (0,
|
|
62
|
+
react_1.useRef)([]), parseOption = (0, react_1.useCallback)((props => hasOption && props.option ? hasRecords && props.records ? Object.assign(Object.assign({}, props.option), {
|
|
63
|
+
clearDOM: !1,
|
|
64
|
+
records: props.records
|
|
65
|
+
}) : Object.assign(Object.assign({}, props.option), {
|
|
66
|
+
clearDOM: !1
|
|
67
|
+
}) : Object.assign(Object.assign(Object.assign({
|
|
68
|
+
records: props.records
|
|
69
|
+
}, prevOption.current), optionFromChildren.current), {
|
|
70
|
+
clearDOM: !1,
|
|
71
|
+
customConfig: Object.assign(Object.assign({}, prevOption.current.customConfig), {
|
|
72
|
+
createReactContainer: !0
|
|
73
|
+
})
|
|
74
|
+
})), [ hasOption, hasRecords ]), createTable = (0, react_1.useCallback)((props => {
|
|
75
|
+
var _a;
|
|
76
|
+
const vtable = new props.vtableConstrouctor(props.container, parseOption(props));
|
|
77
|
+
vtable.scenegraph.stage.reactAttribute = props.ReactDOM, vtable.scenegraph.stage.pluginService.register(null !== (_a = props.reactAttributePlugin) && void 0 !== _a ? _a : new vtable_react_attribute_plugin_1.VTableReactAttributePlugin),
|
|
78
|
+
vtable.scenegraph.stage.params.ReactDOM = props.ReactDOM, tableContext.current = Object.assign(Object.assign({}, tableContext.current), {
|
|
79
|
+
table: vtable
|
|
80
|
+
}), isUnmount.current = !1, columnWidths.current.clear(), pivotColumnWidths.current = [],
|
|
81
|
+
pivotHeaderColumnWidths.current = [], vtable.on("resize_column_end", (args => {
|
|
82
|
+
const table = tableContext.current.table;
|
|
83
|
+
if (!keepColumnWidthChange) return;
|
|
84
|
+
const {col: col, colWidths: colWidths} = args, width = colWidths[col];
|
|
85
|
+
if (vtable.isPivotTable()) {
|
|
86
|
+
const path = table.getCellHeaderPaths(col, table.columnHeaderLevelCount);
|
|
87
|
+
let dimensions;
|
|
88
|
+
dimensions = "rowHeader" === path.cellLocation ? path.rowHeaderPaths : path.colHeaderPaths;
|
|
89
|
+
let found = !1;
|
|
90
|
+
pivotColumnWidths.current.forEach((item => {
|
|
91
|
+
JSON.stringify(item.dimensions) === JSON.stringify(dimensions) && (item.width = width,
|
|
92
|
+
found = !0);
|
|
93
|
+
})), found || pivotColumnWidths.current.push({
|
|
94
|
+
dimensions: dimensions,
|
|
95
|
+
width: width
|
|
96
|
+
});
|
|
97
|
+
} else {
|
|
98
|
+
const define = table.getBodyColumnDefine(col, 0);
|
|
99
|
+
(null == define ? void 0 : define.key) && columnWidths.current.set(define.key, width);
|
|
100
|
+
}
|
|
101
|
+
}));
|
|
102
|
+
}), [ parseOption ]), handleTableRender = (0, react_1.useCallback)((() => {
|
|
103
|
+
if (!isUnmount.current) {
|
|
104
|
+
if (!tableContext.current || !tableContext.current.table) return;
|
|
105
|
+
(0, eventsUtils_1.bindEventsToTable)(tableContext.current.table, props, eventsBinded.current, eventsUtils_1.TABLE_EVENTS),
|
|
106
|
+
setUpdateId(updateId + 1), props.onReady && props.onReady(tableContext.current.table, 0 === updateId);
|
|
107
|
+
}
|
|
108
|
+
}), [ updateId, setUpdateId, props ]), renderTable = (0, react_1.useCallback)((() => {
|
|
109
|
+
tableContext.current.table && (tableContext.current.table.render(), handleTableRender());
|
|
110
|
+
}), [ handleTableRender ]);
|
|
111
|
+
return (0, react_1.useEffect)((() => {
|
|
112
|
+
var _a;
|
|
113
|
+
const newOptionFromChildren = hasOption ? null : parseOptionFromChildren(props);
|
|
114
|
+
if (!(null === (_a = tableContext.current) || void 0 === _a ? void 0 : _a.table)) return hasOption || (optionFromChildren.current = newOptionFromChildren),
|
|
115
|
+
createTable(props), renderTable(), void (eventsBinded.current = props);
|
|
116
|
+
if (hasOption) {
|
|
117
|
+
if ((0, vutils_1.isEqual)(eventsBinded.current.option, props.option, {
|
|
118
|
+
skipFunction: skipFunctionDiff
|
|
119
|
+
})) {
|
|
120
|
+
if (hasRecords && !(0, vutils_1.isEqual)(eventsBinded.current.records, props.records, {
|
|
121
|
+
skipFunction: skipFunctionDiff
|
|
122
|
+
})) {
|
|
123
|
+
if (keepColumnWidthChange) {
|
|
124
|
+
const columnWidthConfig = updateWidthCache(columnWidths.current, pivotColumnWidths.current, tableContext.current.table);
|
|
125
|
+
tableContext.current.table.internalProps.columnWidthConfig = columnWidthConfig,
|
|
126
|
+
tableContext.current.table.internalProps.columnWidthConfigForRowHeader = columnWidthConfig;
|
|
127
|
+
}
|
|
128
|
+
tableContext.current.table.setRecords(props.records), handleTableRender(), eventsBinded.current = props;
|
|
129
|
+
}
|
|
130
|
+
} else {
|
|
131
|
+
const option = parseOption(props);
|
|
132
|
+
if (keepColumnWidthChange) {
|
|
133
|
+
const columnWidthConfig = updateWidthCache(columnWidths.current, pivotColumnWidths.current, tableContext.current.table);
|
|
134
|
+
option.columnWidthConfig = columnWidthConfig, option.columnWidthConfigForRowHeader = columnWidthConfig;
|
|
135
|
+
}
|
|
136
|
+
tableContext.current.table.updateOption(option), handleTableRender(), eventsBinded.current = props;
|
|
137
|
+
}
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const newOption = (0, vutils_1.pickWithout)(props, notOptionKeys);
|
|
141
|
+
if ((0, vutils_1.isEqual)(newOption, prevOption.current, {
|
|
142
|
+
skipFunction: skipFunctionDiff
|
|
143
|
+
}) && (0, vutils_1.isEqual)(newOptionFromChildren, optionFromChildren.current, {
|
|
144
|
+
skipFunction: skipFunctionDiff
|
|
145
|
+
})) {
|
|
146
|
+
if (hasRecords && !(0, vutils_1.isEqual)(props.records, prevRecords.current, {
|
|
147
|
+
skipFunction: skipFunctionDiff
|
|
148
|
+
})) {
|
|
149
|
+
if (prevRecords.current = props.records, keepColumnWidthChange) {
|
|
150
|
+
const columnWidthConfig = updateWidthCache(columnWidths.current, pivotColumnWidths.current, tableContext.current.table);
|
|
151
|
+
tableContext.current.table.internalProps.columnWidthConfig = columnWidthConfig,
|
|
152
|
+
tableContext.current.table.internalProps.columnWidthConfigForRowHeader = columnWidthConfig;
|
|
153
|
+
}
|
|
154
|
+
tableContext.current.table.setRecords(props.records), handleTableRender(), eventsBinded.current = props;
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
prevOption.current = newOption, optionFromChildren.current = newOptionFromChildren;
|
|
158
|
+
const option = parseOption(props);
|
|
159
|
+
if (keepColumnWidthChange) {
|
|
160
|
+
const columnWidthConfig = updateWidthCache(columnWidths.current, pivotColumnWidths.current, tableContext.current.table);
|
|
161
|
+
option.columnWidthConfig = columnWidthConfig, option.columnWidthConfigForRowHeader = columnWidthConfig;
|
|
162
|
+
}
|
|
163
|
+
tableContext.current.table.updateOption(option), handleTableRender(), eventsBinded.current = props;
|
|
164
|
+
}
|
|
165
|
+
}), [ createTable, hasOption, hasRecords, parseOption, handleTableRender, renderTable, skipFunctionDiff, props ]),
|
|
166
|
+
(0, react_1.useEffect)((() => () => {
|
|
167
|
+
tableContext && tableContext.current && tableContext.current.table && (tableContext.current.table.release(),
|
|
168
|
+
tableContext.current = null), eventsBinded.current = null, isUnmount.current = !0;
|
|
169
|
+
}), []), react_1.default.createElement(table_1.default.Provider, {
|
|
170
|
+
value: tableContext.current
|
|
171
|
+
}, (0, util_1.toArray)(props.children).map(((child, index) => {
|
|
172
|
+
if ("string" == typeof child) return;
|
|
173
|
+
const childId = getComponentId(child, index);
|
|
174
|
+
return react_1.default.createElement(react_1.default.Fragment, {
|
|
175
|
+
key: childId
|
|
176
|
+
}, react_1.default.cloneElement(child, {
|
|
177
|
+
updateId: updateId,
|
|
178
|
+
componentId: childId,
|
|
179
|
+
componentIndex: index
|
|
180
|
+
}));
|
|
181
|
+
})));
|
|
182
|
+
})), createTable = (componentName, defaultProps, callback) => {
|
|
183
|
+
const Com = (0, withContainer_1.default)(BaseTable, componentName, (props => defaultProps ? Object.assign(props, defaultProps) : props));
|
|
184
|
+
return Com.displayName = componentName, Com;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
function updateWidthCache(columnWidths, pivotColumnWidths, table) {
|
|
188
|
+
if (table.isPivotTable()) return pivotColumnWidths;
|
|
189
|
+
const columnWidthConfig = [];
|
|
190
|
+
return columnWidths.forEach(((width, key) => {
|
|
191
|
+
columnWidthConfig.push({
|
|
192
|
+
key: key,
|
|
193
|
+
width: width
|
|
194
|
+
});
|
|
195
|
+
})), columnWidthConfig;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
//# sourceMappingURL=base-table.js.map
|
|
199
|
+
exports.createTable = createTable;
|