@visactor/react-vtable 1.6.0-alpha.5 → 1.6.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/cjs/components/avatar/avatar.d.ts +15 -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 -19
- package/cjs/components/index.js +4 -101
- package/cjs/components/index.js.map +1 -1
- package/cjs/components/link/link.d.ts +30 -0
- package/cjs/components/link/link.js +118 -0
- package/cjs/components/link/link.js.map +1 -0
- package/cjs/components/popover/popover.d.ts +13 -0
- package/cjs/components/popover/popover.js +281 -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 +64 -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 +48 -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 +2 -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.js +2 -1
- package/cjs/eventsUtils.d.ts +1 -1
- package/cjs/eventsUtils.js +1 -1
- package/cjs/eventsUtils.js.map +1 -1
- package/cjs/index.d.ts +2 -2
- package/cjs/index.js +2 -2
- package/cjs/index.js.map +1 -1
- package/cjs/{components → table-components}/base-component.js +1 -0
- package/cjs/table-components/base-component.js.map +1 -0
- package/cjs/table-components/component/emptyTip.js.map +1 -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.js.map +1 -0
- package/cjs/{components → table-components}/custom/custom-layout.d.ts +1 -1
- package/cjs/{components → table-components}/custom/custom-layout.js +2 -6
- package/cjs/table-components/custom/custom-layout.js.map +1 -0
- package/{es/components → cjs/table-components}/custom/graphic.d.ts +1 -14
- package/cjs/table-components/custom/graphic.js.map +1 -0
- package/cjs/table-components/custom/reconciler.d.ts +5 -0
- package/cjs/{components → table-components}/custom/reconciler.js +12 -10
- package/cjs/table-components/custom/reconciler.js.map +1 -0
- package/cjs/table-components/custom/vtable-browser-env-contribution.d.ts +7 -0
- package/cjs/{components → table-components}/custom/vtable-browser-env-contribution.js +4 -4
- package/cjs/table-components/custom/vtable-browser-env-contribution.js.map +1 -0
- package/{es/components → cjs/table-components}/custom/vtable-react-attribute-plugin.d.ts +2 -8
- package/cjs/{components → table-components}/custom/vtable-react-attribute-plugin.js +6 -6
- package/cjs/table-components/custom/vtable-react-attribute-plugin.js.map +1 -0
- package/cjs/table-components/custom-component.js.map +1 -0
- package/cjs/table-components/index.d.ts +19 -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.js.map +1 -0
- package/cjs/table-components/pivot/pivot-corner.js.map +1 -0
- package/cjs/table-components/pivot/pivot-dimension.js.map +1 -0
- package/cjs/table-components/pivot/pivot-header-title.js.map +1 -0
- package/cjs/table-components/pivot/pivot-indicator.js.map +1 -0
- package/cjs/tables/base-table.d.ts +5 -4
- package/cjs/tables/base-table.js +7 -12
- package/cjs/tables/base-table.js.map +1 -1
- package/cjs/tables/index.d.ts +2 -0
- package/cjs/tables/index.js +19 -1
- package/cjs/tables/index.js.map +1 -1
- 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 +1 -1
- package/cjs/tables/list-table.js +5 -2
- package/cjs/tables/list-table.js.map +1 -1
- package/cjs/tables/pivot-chart.d.ts +5 -1
- package/cjs/tables/pivot-chart.js +6 -29
- package/cjs/tables/pivot-chart.js.map +1 -1
- 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 +1 -1
- package/cjs/tables/pivot-table.js +5 -2
- package/cjs/tables/pivot-table.js.map +1 -1
- package/cjs/util.js +1 -2
- package/cjs/vtable.d.ts +1 -2
- package/cjs/vtable.js +0 -33
- package/cjs/vtable.js.map +1 -1
- package/es/components/avatar/avatar.d.ts +15 -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 -19
- package/es/components/index.js +7 -17
- package/es/components/index.js.map +1 -1
- package/es/components/link/link.d.ts +30 -0
- package/es/components/link/link.js +95 -0
- package/es/components/link/link.js.map +1 -0
- package/es/components/popover/popover.d.ts +13 -0
- package/es/components/popover/popover.js +258 -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 +43 -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 +46 -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 +2 -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.js +2 -1
- package/es/eventsUtils.d.ts +1 -1
- package/es/eventsUtils.js +2 -2
- package/es/eventsUtils.js.map +1 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +3 -3
- package/es/index.js.map +1 -1
- package/es/{components → table-components}/base-component.js +2 -1
- package/es/table-components/base-component.js.map +1 -0
- package/es/table-components/component/emptyTip.js.map +1 -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.js.map +1 -0
- package/es/{components → table-components}/custom/custom-layout.d.ts +1 -1
- package/es/{components → table-components}/custom/custom-layout.js +1 -7
- package/es/table-components/custom/custom-layout.js.map +1 -0
- package/{cjs/components → es/table-components}/custom/graphic.d.ts +1 -14
- package/es/table-components/custom/graphic.js.map +1 -0
- package/es/table-components/custom/reconciler.d.ts +5 -0
- package/es/{components → table-components}/custom/reconciler.js +9 -8
- package/es/table-components/custom/reconciler.js.map +1 -0
- package/es/table-components/custom/vtable-browser-env-contribution.d.ts +7 -0
- package/es/{components → table-components}/custom/vtable-browser-env-contribution.js +3 -3
- package/es/table-components/custom/vtable-browser-env-contribution.js.map +1 -0
- package/{cjs/components → es/table-components}/custom/vtable-react-attribute-plugin.d.ts +2 -8
- package/es/{components → table-components}/custom/vtable-react-attribute-plugin.js +1 -3
- package/es/table-components/custom/vtable-react-attribute-plugin.js.map +1 -0
- package/es/table-components/custom-component.js.map +1 -0
- package/es/table-components/index.d.ts +19 -0
- package/es/table-components/index.js +24 -0
- package/es/table-components/index.js.map +1 -0
- package/es/table-components/list/list-column.js.map +1 -0
- package/es/table-components/pivot/pivot-corner.js.map +1 -0
- package/es/table-components/pivot/pivot-dimension.js.map +1 -0
- package/es/table-components/pivot/pivot-header-title.js.map +1 -0
- package/es/table-components/pivot/pivot-indicator.js.map +1 -0
- package/es/tables/base-table.d.ts +5 -4
- package/es/tables/base-table.js +8 -15
- package/es/tables/base-table.js.map +1 -1
- package/es/tables/index.d.ts +2 -0
- package/es/tables/index.js +4 -0
- package/es/tables/index.js.map +1 -1
- 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 +1 -1
- package/es/tables/list-table.js +6 -1
- package/es/tables/list-table.js.map +1 -1
- package/es/tables/pivot-chart.d.ts +5 -1
- package/es/tables/pivot-chart.js +8 -3
- package/es/tables/pivot-chart.js.map +1 -1
- 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 +1 -1
- package/es/tables/pivot-table.js +6 -1
- package/es/tables/pivot-table.js.map +1 -1
- package/es/util.js +1 -2
- package/es/vtable.d.ts +1 -2
- package/es/vtable.js +1 -3
- package/es/vtable.js.map +1 -1
- package/package.json +5 -5
- package/cjs/components/base-component.js.map +0 -1
- package/cjs/components/component/emptyTip.js.map +0 -1
- package/cjs/components/component/menu.js.map +0 -1
- package/cjs/components/component/tooltip.js.map +0 -1
- package/cjs/components/custom/component.d.ts +0 -16
- package/cjs/components/custom/component.js +0 -7
- package/cjs/components/custom/component.js.map +0 -1
- package/cjs/components/custom/custom-layout.js.map +0 -1
- package/cjs/components/custom/graphic.js.map +0 -1
- package/cjs/components/custom/reconciler.d.ts +0 -5
- package/cjs/components/custom/reconciler.js.map +0 -1
- package/cjs/components/custom/vtable-browser-env-contribution.d.ts +0 -2
- package/cjs/components/custom/vtable-browser-env-contribution.js.map +0 -1
- package/cjs/components/custom/vtable-react-attribute-plugin.js.map +0 -1
- package/cjs/components/custom-component.js.map +0 -1
- package/cjs/components/list/list-column.js.map +0 -1
- package/cjs/components/pivot/pivot-corner.js.map +0 -1
- package/cjs/components/pivot/pivot-dimension.js.map +0 -1
- package/cjs/components/pivot/pivot-header-title.js.map +0 -1
- package/cjs/components/pivot/pivot-indicator.js.map +0 -1
- package/dist/react-vtable.js +0 -13799
- package/dist/react-vtable.min.js +0 -46
- package/es/components/base-component.js.map +0 -1
- package/es/components/component/emptyTip.js.map +0 -1
- package/es/components/component/menu.js.map +0 -1
- package/es/components/component/tooltip.js.map +0 -1
- package/es/components/custom/component.d.ts +0 -16
- package/es/components/custom/component.js +0 -6
- package/es/components/custom/component.js.map +0 -1
- package/es/components/custom/custom-layout.js.map +0 -1
- package/es/components/custom/graphic.js.map +0 -1
- package/es/components/custom/reconciler.d.ts +0 -5
- package/es/components/custom/reconciler.js.map +0 -1
- package/es/components/custom/vtable-browser-env-contribution.d.ts +0 -2
- package/es/components/custom/vtable-browser-env-contribution.js.map +0 -1
- package/es/components/custom/vtable-react-attribute-plugin.js.map +0 -1
- package/es/components/custom-component.js.map +0 -1
- package/es/components/list/list-column.js.map +0 -1
- package/es/components/pivot/pivot-corner.js.map +0 -1
- package/es/components/pivot/pivot-dimension.js.map +0 -1
- package/es/components/pivot/pivot-header-title.js.map +0 -1
- package/es/components/pivot/pivot-indicator.js.map +0 -1
- /package/cjs/{components → table-components}/base-component.d.ts +0 -0
- /package/cjs/{components → table-components}/component/emptyTip.d.ts +0 -0
- /package/cjs/{components → table-components}/component/emptyTip.js +0 -0
- /package/cjs/{components → table-components}/component/menu.d.ts +0 -0
- /package/cjs/{components → table-components}/component/menu.js +0 -0
- /package/cjs/{components → table-components}/component/tooltip.d.ts +0 -0
- /package/cjs/{components → table-components}/component/tooltip.js +0 -0
- /package/cjs/{components → table-components}/custom/graphic.js +0 -0
- /package/cjs/{components → table-components}/custom-component.d.ts +0 -0
- /package/cjs/{components → table-components}/custom-component.js +0 -0
- /package/cjs/{components → table-components}/list/list-column.d.ts +0 -0
- /package/cjs/{components → table-components}/list/list-column.js +0 -0
- /package/cjs/{components → table-components}/pivot/pivot-corner.d.ts +0 -0
- /package/cjs/{components → table-components}/pivot/pivot-corner.js +0 -0
- /package/cjs/{components → table-components}/pivot/pivot-dimension.d.ts +0 -0
- /package/cjs/{components → table-components}/pivot/pivot-dimension.js +0 -0
- /package/cjs/{components → table-components}/pivot/pivot-header-title.d.ts +0 -0
- /package/cjs/{components → table-components}/pivot/pivot-header-title.js +0 -0
- /package/cjs/{components → table-components}/pivot/pivot-indicator.d.ts +0 -0
- /package/cjs/{components → table-components}/pivot/pivot-indicator.js +0 -0
- /package/es/{components → table-components}/base-component.d.ts +0 -0
- /package/es/{components → table-components}/component/emptyTip.d.ts +0 -0
- /package/es/{components → table-components}/component/emptyTip.js +0 -0
- /package/es/{components → table-components}/component/menu.d.ts +0 -0
- /package/es/{components → table-components}/component/menu.js +0 -0
- /package/es/{components → table-components}/component/tooltip.d.ts +0 -0
- /package/es/{components → table-components}/component/tooltip.js +0 -0
- /package/es/{components → table-components}/custom/graphic.js +0 -0
- /package/es/{components → table-components}/custom-component.d.ts +0 -0
- /package/es/{components → table-components}/custom-component.js +0 -0
- /package/es/{components → table-components}/list/list-column.d.ts +0 -0
- /package/es/{components → table-components}/list/list-column.js +0 -0
- /package/es/{components → table-components}/pivot/pivot-corner.d.ts +0 -0
- /package/es/{components → table-components}/pivot/pivot-corner.js +0 -0
- /package/es/{components → table-components}/pivot/pivot-dimension.d.ts +0 -0
- /package/es/{components → table-components}/pivot/pivot-dimension.js +0 -0
- /package/es/{components → table-components}/pivot/pivot-header-title.d.ts +0 -0
- /package/es/{components → table-components}/pivot/pivot-header-title.js +0 -0
- /package/es/{components → table-components}/pivot/pivot-indicator.d.ts +0 -0
- /package/es/{components → table-components}/pivot/pivot-indicator.js +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
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
|
+
};
|
|
27
|
+
|
|
28
|
+
Object.defineProperty(exports, "__esModule", {
|
|
29
|
+
value: !0
|
|
30
|
+
}), exports.Link = void 0;
|
|
31
|
+
|
|
32
|
+
const tag_1 = require("../vrender-components/tag"), vutils_1 = require("@visactor/vutils"), react_1 = __importStar(require("react")), defaultProps = {
|
|
33
|
+
textStyle: {
|
|
34
|
+
fontSize: 14,
|
|
35
|
+
fontFamily: "sans-serif",
|
|
36
|
+
fill: "rgb(64, 128, 255)"
|
|
37
|
+
},
|
|
38
|
+
panelStyle: {
|
|
39
|
+
visible: !0,
|
|
40
|
+
opacity: 0,
|
|
41
|
+
fill: "rgba(242, 243, 245, 0.5)",
|
|
42
|
+
lineWidth: 1,
|
|
43
|
+
cornerRadius: 2
|
|
44
|
+
},
|
|
45
|
+
padding: 4,
|
|
46
|
+
space: 6,
|
|
47
|
+
state: {
|
|
48
|
+
textStyle: {
|
|
49
|
+
disabled: {
|
|
50
|
+
fill: "rgb(148, 191, 255)"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
panelStyle: {
|
|
54
|
+
hover: {
|
|
55
|
+
opacity: 1
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
function LinkComponent(baseProps, ref) {
|
|
62
|
+
const props = (0, vutils_1.merge)({}, defaultProps, baseProps), {disabled: disabled, href: href, onClick: onClick} = props;
|
|
63
|
+
let linkRef = react_1.default.useRef(null);
|
|
64
|
+
linkRef = ref || linkRef;
|
|
65
|
+
const handleClick = react_1.default.useCallback((event => {
|
|
66
|
+
disabled ? "function" == typeof (null == event ? void 0 : event.preventDefault) && event.preventDefault() : (onClick && onClick(event),
|
|
67
|
+
href && window.open(href));
|
|
68
|
+
}), [ disabled, href, onClick ]), attribute = getTagAttribute(props);
|
|
69
|
+
return (0, react_1.useEffect)((() => {
|
|
70
|
+
linkRef.current.addEventListener("mouseenter", (() => {
|
|
71
|
+
disabled || (linkRef.current.addState("hover", !0, !1), linkRef.current.stage.renderNextFrame());
|
|
72
|
+
})), linkRef.current.addEventListener("mouseleave", (() => {
|
|
73
|
+
disabled || (linkRef.current.removeState("hover", !1), linkRef.current.stage.renderNextFrame());
|
|
74
|
+
}));
|
|
75
|
+
}), []), (0, react_1.useEffect)((() => {
|
|
76
|
+
disabled ? (linkRef.current.removeState("disabled", !1), linkRef.current.addState("disabled", !0, !1)) : linkRef.current.removeState("disabled", !1),
|
|
77
|
+
linkRef.current.stage.renderNextFrame();
|
|
78
|
+
})), react_1.default.createElement(tag_1.Tag, {
|
|
79
|
+
ref: linkRef,
|
|
80
|
+
attribute: attribute,
|
|
81
|
+
onClick: handleClick
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function getTagAttribute(props) {
|
|
86
|
+
var _a, _b, _c, _d;
|
|
87
|
+
const {textStyle: textStyle, padding: padding, space: space, panelStyle: panelStyle, minWidth: minWidth, maxWidth: maxWidth, visible: visible, cursor: cursor, disabled: disabled, icon: icon, state: state, children: children} = props;
|
|
88
|
+
return {
|
|
89
|
+
text: children,
|
|
90
|
+
textStyle: textStyle,
|
|
91
|
+
padding: padding,
|
|
92
|
+
panel: panelStyle,
|
|
93
|
+
minWidth: minWidth,
|
|
94
|
+
maxWidth: maxWidth,
|
|
95
|
+
visible: visible,
|
|
96
|
+
cursor: (null != cursor ? cursor : disabled) ? "not-allowed" : "pointer",
|
|
97
|
+
childrenPickable: !1,
|
|
98
|
+
state: {
|
|
99
|
+
text: {
|
|
100
|
+
hover: null === (_a = null == state ? void 0 : state.textStyle) || void 0 === _a ? void 0 : _a.hover,
|
|
101
|
+
disabled: null === (_b = null == state ? void 0 : state.textStyle) || void 0 === _b ? void 0 : _b.disabled
|
|
102
|
+
},
|
|
103
|
+
panel: {
|
|
104
|
+
hover: null === (_c = null == state ? void 0 : state.panelStyle) || void 0 === _c ? void 0 : _c.hover,
|
|
105
|
+
disabled: null === (_d = null == state ? void 0 : state.panelStyle) || void 0 === _d ? void 0 : _d.disabled
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
space: space,
|
|
109
|
+
shape: {
|
|
110
|
+
visible: !!icon,
|
|
111
|
+
fill: !1,
|
|
112
|
+
stroke: textStyle.fill,
|
|
113
|
+
symbolType: "M -0.2927 -15.4348 L -15.142 -0.5855 C -18.6567 2.9292 -18.6567 8.6277 -15.142 12.1424 V 12.1424 C -11.6273 15.6571 -5.9288 15.6571 -2.4141 12.1424 L 15.2636 -5.5353 C 17.6067 -7.8784 17.6067 -11.6774 15.2636 -14.0206 V -14.0206 C 12.9205 -16.3637 9.1215 -16.3637 6.7783 -14.0206 L -10.8993 3.6571 C -12.0709 4.8287 -12.0709 6.7282 -10.8993 7.8997 V 7.8997 C -9.7278 9.0713 -7.8283 9.0713 -6.6567 7.8997 L 8.1925 -6.9495"
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
exports.Link = react_1.default.forwardRef(LinkComponent), exports.Link.displayName = "Link";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/link/link.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AASA,mDAAwD;AACxD,6CAAyC;AACzC,+CAAyC;AA8BzC,MAAM,YAAY,GAAc;IAC9B,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,YAAY;QACxB,IAAI,EAAE,mBAAmB;KAC1B;IACD,UAAU,EAAE;QACV,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,0BAA0B;QAChC,SAAS,EAAE,CAAC;QACZ,YAAY,EAAE,CAAC;KAChB;IACD,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IAER,KAAK,EAAE;QACL,SAAS,EAAE;YACT,QAAQ,EAAE;gBACR,IAAI,EAAE,oBAAoB;aAC3B;SACF;QACD,UAAU,EAAE;YACV,KAAK,EAAE;gB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,gBAAgB,EAAE,KAAK;QACvB,KAAK,EAAE;YACL,IAAI,EAAE;gBACJ,KAAK,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,0CAAE,KAAK;gBAC9B,QAAQ,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,0CAAE,QAAQ;aACrC;YACD,KAAK,EAAE;gBACL,KAAK,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,KAAK;gBAC/B,QAAQ,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,QAAQ;aACtC;SACF;QACD,KAAK;QACL,KAAK,EAAE;YACL,OAAO,EAAE,CAAC,CAAC,IAAI;YACf,IAAI,EAAE,KAAK;YACX,MAAM,EAAE,SAAS,CAAC,IAAI;YACtB,UAAU,EAER,saAAsa;SACza;KACF,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AAEY,QAAA,IAAI,GAAG,eAAK,CAAC,UAAU,CAAiB,aAAa,CAAC,CAAC;AAEpE,YAAI,CAAC,WAAW,GAAG,MAAM,CAAC","file":"link.js","sourcesContent":["import type {\n BackgroundAttributes,\n Cursor,\n IRectGraphicAttribute,\n ITextGraphicAttribute,\n Padding,\n Tag,\n TagAttributes\n} from '@visactor/vtable/es/vrender';\nimport { Tag as VTag } from '../vrender-components/tag';\nimport { merge } from '@visactor/vutils';\nimport React, { useEffect } from 'react';\n\ninterface LinkStateStyle {\n textStyle?: {\n hover?: Partial<ITextGraphicAttribute>;\n disabled?: Partial<ITextGraphicAttribute>;\n };\n panelStyle?: {\n hover?: Partial<IRectGraphicAttribute>;\n disabled?: Partial<IRectGraphicAttribute>;\n };\n}\n\nexport interface LinkProps {\n children?: string;\n textStyle?: Partial<ITextGraphicAttribute>;\n padding?: Padding;\n space?: number;\n panelStyle?: BackgroundAttributes;\n minWidth?: number;\n maxWidth?: number;\n visible?: boolean;\n state?: LinkStateStyle;\n disabled?: boolean;\n icon?: boolean;\n cursor?: Cursor;\n href?: string;\n onClick?: (e: Event) => void;\n}\n\nconst defaultProps: LinkProps = {\n textStyle: {\n fontSize: 14,\n fontFamily: 'sans-serif',\n fill: 'rgb(64, 128, 255)'\n },\n panelStyle: {\n visible: true,\n opacity: 0,\n fill: 'rgba(242, 243, 245, 0.5)',\n lineWidth: 1,\n cornerRadius: 2\n },\n padding: 4,\n space: 6,\n // cursor: 'pointer',\n state: {\n textStyle: {\n disabled: {\n fill: 'rgb(148, 191, 255)'\n }\n },\n panelStyle: {\n hover: {\n // visible: true\n opacity: 1\n }\n }\n }\n};\n\nfunction LinkComponent(baseProps: LinkProps, ref: React.Ref<Tag>) {\n const props: LinkProps = merge({}, defaultProps, baseProps);\n const { disabled, href, onClick } = props;\n let linkRef = React.useRef<Tag>(null);\n linkRef = ref ? (ref as React.RefObject<Tag>) : linkRef;\n\n const handleClick: React.MouseEventHandler<HTMLElement> = React.useCallback(\n (event: any): void => {\n if (disabled) {\n typeof event?.preventDefault === 'function' && event.preventDefault();\n return;\n }\n onClick && onClick(event);\n if (href) {\n // eslint-disable-next-line no-undef\n window.open(href);\n }\n },\n [disabled, href, onClick]\n );\n\n const attribute: TagAttributes = getTagAttribute(props);\n\n useEffect(() => {\n linkRef.current.addEventListener('mouseenter', () => {\n // console.log('mouseenter', linkRef.current, e.clone());\n if (!disabled) {\n linkRef.current.addState('hover', true, false);\n // linkRef.current._bgRect.addState('hover', true, false);\n // linkRef.current._textShape.addState('hover', true, false);\n linkRef.current.stage.renderNextFrame();\n }\n });\n linkRef.current.addEventListener('mouseleave', () => {\n // console.log('mouseleave', linkRef.current, e.clone());\n if (!disabled) {\n linkRef.current.removeState('hover', false);\n // linkRef.current._bgRect.removeState('hover', false);\n // linkRef.current._textShape.removeState('hover', false);\n linkRef.current.stage.renderNextFrame();\n }\n });\n }, []);\n\n useEffect(() => {\n if (disabled) {\n linkRef.current.removeState('disabled', false);\n // linkRef.current._bgRect.removeState('disabled', false);\n // linkRef.current._textShape.removeState('disabled', false);\n\n linkRef.current.addState('disabled', true, false);\n // linkRef.current._bgRect.addState('disabled', true, false);\n // linkRef.current._textShape.addState('disabled', true, false);\n // console.log('add disable');\n } else {\n linkRef.current.removeState('disabled', false);\n // linkRef.current._bgRect.removeState('disabled', false);\n // linkRef.current._textShape.removeState('disabled', false);\n // console.log('remove disable');\n }\n linkRef.current.stage.renderNextFrame();\n });\n\n return <VTag ref={linkRef} attribute={attribute} onClick={handleClick}></VTag>;\n}\n\nfunction getTagAttribute(props: LinkProps) {\n const {\n textStyle,\n padding,\n space,\n panelStyle,\n minWidth,\n maxWidth,\n visible,\n cursor,\n disabled,\n icon,\n state,\n children\n } = props;\n const attr: TagAttributes = {\n text: children,\n textStyle,\n padding,\n panel: panelStyle,\n minWidth,\n maxWidth,\n visible,\n cursor: cursor ?? disabled ? 'not-allowed' : 'pointer',\n childrenPickable: false,\n state: {\n text: {\n hover: state?.textStyle?.hover,\n disabled: state?.textStyle?.disabled\n },\n panel: {\n hover: state?.panelStyle?.hover,\n disabled: state?.panelStyle?.disabled\n }\n },\n space,\n shape: {\n visible: !!icon,\n fill: false,\n stroke: textStyle.fill,\n symbolType:\n // eslint-disable-next-line max-len\n 'M -0.2927 -15.4348 L -15.142 -0.5855 C -18.6567 2.9292 -18.6567 8.6277 -15.142 12.1424 V 12.1424 C -11.6273 15.6571 -5.9288 15.6571 -2.4141 12.1424 L 15.2636 -5.5353 C 17.6067 -7.8784 17.6067 -11.6774 15.2636 -14.0206 V -14.0206 C 12.9205 -16.3637 9.1215 -16.3637 6.7783 -14.0206 L -10.8993 3.6571 C -12.0709 4.8287 -12.0709 6.7282 -10.8993 7.8997 V 7.8997 C -9.7278 9.0713 -7.8283 9.0713 -6.6567 7.8997 L 8.1925 -6.9495'\n }\n };\n\n return attr;\n}\n\nexport const Link = React.forwardRef<Tag, LinkProps>(LinkComponent);\n\nLink.displayName = 'Link';\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IGroup } from '@visactor/vtable/es/vrender';
|
|
2
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
type Anchor = 'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br' | 'left' | 'lt' | 'lb' | 'right' | 'rt' | 'rb';
|
|
5
|
+
export interface PopoverProps {
|
|
6
|
+
children?: ReactElement;
|
|
7
|
+
defaultPopupVisible?: boolean;
|
|
8
|
+
popupVisible?: boolean;
|
|
9
|
+
position?: Anchor;
|
|
10
|
+
content?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const Popover: React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<IGroup>>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,281 @@
|
|
|
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
|
+
};
|
|
27
|
+
|
|
28
|
+
Object.defineProperty(exports, "__esModule", {
|
|
29
|
+
value: !0
|
|
30
|
+
}), exports.Popover = void 0;
|
|
31
|
+
|
|
32
|
+
const vutils_1 = require("@visactor/vutils"), react_1 = __importStar(require("react")), table_components_1 = require("../../table-components"), defaultProps = {
|
|
33
|
+
defaultPopupVisible: !1,
|
|
34
|
+
position: "top"
|
|
35
|
+
}, poptipPanalStyle = {
|
|
36
|
+
backgroundColor: "rgb(255, 255, 255)",
|
|
37
|
+
boxShadow: "0 4px 10px rgba(0, 0, 0, .1)",
|
|
38
|
+
fontSize: "14px",
|
|
39
|
+
borderRadius: "4px",
|
|
40
|
+
lineHeight: "1.5715",
|
|
41
|
+
boxSizing: "border-box",
|
|
42
|
+
color: "rgb(78, 89, 105)",
|
|
43
|
+
border: "1px solid rgb(229, 230, 235)",
|
|
44
|
+
padding: "12px 16px"
|
|
45
|
+
}, Tooltip = props => {
|
|
46
|
+
const arrowStyle = Object.assign({
|
|
47
|
+
content: "",
|
|
48
|
+
height: "8px",
|
|
49
|
+
width: "8px",
|
|
50
|
+
position: "absolute",
|
|
51
|
+
display: "block",
|
|
52
|
+
boxSizing: "border-box",
|
|
53
|
+
transform: "rotate(45deg)",
|
|
54
|
+
transformOrigin: "50% 50% 0",
|
|
55
|
+
backgroundColor: "rgb(255, 255, 255)",
|
|
56
|
+
border: "1px solid rgb(229, 230, 235)"
|
|
57
|
+
}, getArrowStyle(props.position));
|
|
58
|
+
return props.visible ? react_1.default.createElement(react_1.default.Fragment, null, react_1.default.createElement("div", {
|
|
59
|
+
style: poptipPanalStyle
|
|
60
|
+
}, props.content), react_1.default.createElement("div", {
|
|
61
|
+
style: arrowStyle
|
|
62
|
+
})) : react_1.default.createElement(react_1.default.Fragment, null);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
function PopoverComponent(baseProps, ref) {
|
|
66
|
+
const props = (0, vutils_1.merge)({}, defaultProps, baseProps), {content: content, position: position, popupVisible: popupVisible, defaultPopupVisible: defaultPopupVisible, children: children} = props;
|
|
67
|
+
let popoverRef = react_1.default.useRef(null);
|
|
68
|
+
popoverRef = ref || popoverRef;
|
|
69
|
+
const [popupOpen, setPopupOpen] = (0, react_1.useState)(!1);
|
|
70
|
+
(0, react_1.useEffect)((() => {
|
|
71
|
+
setPopupOpen(!!popupVisible), popoverRef.current.stage.renderNextFrame();
|
|
72
|
+
}), [ popupVisible ]), (0, react_1.useEffect)((() => {
|
|
73
|
+
var _a;
|
|
74
|
+
setPopupOpen(null !== (_a = null != popupVisible ? popupVisible : defaultPopupVisible) && void 0 !== _a && _a);
|
|
75
|
+
}), []);
|
|
76
|
+
const {transform: transform, anchorType: anchorType} = getTransform(position), groupAttribute = {
|
|
77
|
+
react: {
|
|
78
|
+
style: {
|
|
79
|
+
transform: transform
|
|
80
|
+
},
|
|
81
|
+
element: react_1.default.createElement(Tooltip, {
|
|
82
|
+
visible: popupOpen,
|
|
83
|
+
content: content,
|
|
84
|
+
position: position
|
|
85
|
+
}),
|
|
86
|
+
container: null,
|
|
87
|
+
visible: !0,
|
|
88
|
+
pointerEvents: !1,
|
|
89
|
+
anchorType: anchorType
|
|
90
|
+
}
|
|
91
|
+
}, groupMouseEnter = (0, react_1.useCallback)((event => {
|
|
92
|
+
(0, vutils_1.isValid)(popupVisible) || (setPopupOpen(!0), event.currentTarget.stage.renderNextFrame());
|
|
93
|
+
}), []), groupMouseLeave = (0, react_1.useCallback)((event => {
|
|
94
|
+
(0, vutils_1.isValid)(popupVisible) || (setPopupOpen(!1), event.currentTarget.stage.renderNextFrame());
|
|
95
|
+
}), []);
|
|
96
|
+
return react_1.default.createElement(table_components_1.Group, {
|
|
97
|
+
ref: popoverRef,
|
|
98
|
+
attribute: groupAttribute,
|
|
99
|
+
onMouseEnter: groupMouseEnter,
|
|
100
|
+
onMouseLeave: groupMouseLeave
|
|
101
|
+
}, children);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function getTransform(position) {
|
|
105
|
+
switch (position) {
|
|
106
|
+
case "top":
|
|
107
|
+
return {
|
|
108
|
+
anchorType: "top",
|
|
109
|
+
transform: "translate(-50%, calc(-100% - 10px))"
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
case "tl":
|
|
113
|
+
return {
|
|
114
|
+
anchorType: "top-left",
|
|
115
|
+
transform: "translate(0, calc(-100% - 10px))"
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
case "tr":
|
|
119
|
+
return {
|
|
120
|
+
anchorType: "top-right",
|
|
121
|
+
transform: "translate(-100%, calc(-100% - 10px))"
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
case "bottom":
|
|
125
|
+
return {
|
|
126
|
+
anchorType: "bottom",
|
|
127
|
+
transform: "translate(-50%, 10px)"
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
case "bl":
|
|
131
|
+
return {
|
|
132
|
+
anchorType: "bottom-left",
|
|
133
|
+
transform: "translate(0, 10px)"
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
case "br":
|
|
137
|
+
return {
|
|
138
|
+
anchorType: "bottom-right",
|
|
139
|
+
transform: "translate(-100%, 10px)"
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
case "left":
|
|
143
|
+
return {
|
|
144
|
+
anchorType: "left",
|
|
145
|
+
transform: "translate(calc(-100% - 10px), -50%)"
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
case "lt":
|
|
149
|
+
return {
|
|
150
|
+
anchorType: "top-left",
|
|
151
|
+
transform: "translate(calc(-100% - 10px), 0)"
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
case "lb":
|
|
155
|
+
return {
|
|
156
|
+
anchorType: "bottom-left",
|
|
157
|
+
transform: "translate(calc(-100% - 10px), -100%)"
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
case "right":
|
|
161
|
+
return {
|
|
162
|
+
anchorType: "right",
|
|
163
|
+
transform: "translate(10px, -50%)"
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
case "rt":
|
|
167
|
+
return {
|
|
168
|
+
anchorType: "top-right",
|
|
169
|
+
transform: "translate(10px, 0)"
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
case "rb":
|
|
173
|
+
return {
|
|
174
|
+
anchorType: "bottom-right",
|
|
175
|
+
transform: "translate(10px, -100%)"
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function getArrowStyle(position) {
|
|
181
|
+
switch (position) {
|
|
182
|
+
case "top":
|
|
183
|
+
return {
|
|
184
|
+
top: "calc(100% - 5px)",
|
|
185
|
+
left: "calc(50% - 5px)",
|
|
186
|
+
borderTop: "none",
|
|
187
|
+
borderLeft: "none"
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
case "tl":
|
|
191
|
+
return {
|
|
192
|
+
top: "calc(100% - 4px)",
|
|
193
|
+
left: "14px",
|
|
194
|
+
borderTop: "none",
|
|
195
|
+
borderLeft: "none"
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
case "tr":
|
|
199
|
+
return {
|
|
200
|
+
top: "calc(100% - 4px)",
|
|
201
|
+
left: "calc(100% - 24px)",
|
|
202
|
+
borderTop: "none",
|
|
203
|
+
borderLeft: "none"
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
case "bottom":
|
|
207
|
+
return {
|
|
208
|
+
top: "-4px",
|
|
209
|
+
left: "calc(50% - 4px)",
|
|
210
|
+
borderRight: "none",
|
|
211
|
+
borderBottom: "none"
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
case "bl":
|
|
215
|
+
return {
|
|
216
|
+
top: "-4px",
|
|
217
|
+
left: "14px",
|
|
218
|
+
borderRight: "none",
|
|
219
|
+
borderBottom: "none"
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
case "br":
|
|
223
|
+
return {
|
|
224
|
+
top: "-4px",
|
|
225
|
+
left: "calc(100% - 24px)",
|
|
226
|
+
borderRight: "none",
|
|
227
|
+
borderBottom: "none"
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
case "left":
|
|
231
|
+
return {
|
|
232
|
+
top: "calc(50% - 4px)",
|
|
233
|
+
left: "calc(100% - 5px)",
|
|
234
|
+
borderLeft: "none",
|
|
235
|
+
borderBottom: "none"
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
case "lt":
|
|
239
|
+
return {
|
|
240
|
+
top: "14px",
|
|
241
|
+
left: "calc(100% - 5px)",
|
|
242
|
+
borderLeft: "none",
|
|
243
|
+
borderBottom: "none"
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
case "lb":
|
|
247
|
+
return {
|
|
248
|
+
top: "calc(100% - 24px)",
|
|
249
|
+
left: "calc(100% - 5px)",
|
|
250
|
+
borderLeft: "none",
|
|
251
|
+
borderBottom: "none"
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
case "right":
|
|
255
|
+
return {
|
|
256
|
+
top: "calc(50% - 4px)",
|
|
257
|
+
left: "-4px",
|
|
258
|
+
borderRight: "none",
|
|
259
|
+
borderTop: "none"
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
case "rt":
|
|
263
|
+
return {
|
|
264
|
+
top: "14px",
|
|
265
|
+
left: "-4px",
|
|
266
|
+
borderRight: "none",
|
|
267
|
+
borderTop: "none"
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
case "rb":
|
|
271
|
+
return {
|
|
272
|
+
top: "calc(100% - 24px)",
|
|
273
|
+
left: "-4px",
|
|
274
|
+
borderRight: "none",
|
|
275
|
+
borderTop: "none"
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
exports.Popover = react_1.default.forwardRef(PopoverComponent), exports.Popover.displayName = "Popover";
|
|
281
|
+
//# sourceMapping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GAAG,eAAK,CAAC,UAAU,CAAuB,gBAAgB,CAAC,CAAC;AAEhF,eAAO,CAAC,WAAW,GAAG,SAAS,CAAC","file":"popover.js","sourcesContent":["import type {\n BackgroundAttributes,\n Cursor,\n IGroup,\n IGroupGraphicAttribute,\n IRectGraphicAttribute,\n ITextGraphicAttribute,\n Padding,\n Tag,\n TagAttributes\n} from '@visactor/vtable/es/vrender';\nimport { Tag as VTag } from '../vrender-components/tag';\nimport type { BoundsAnchorType } from '@visactor/vutils';\nimport { isValid, merge } from '@visactor/vutils';\nimport type { CSSProperties, ReactElement, ReactNode } from 'react';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport { Group } from '../../table-components';\n\ntype Anchor = 'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br' | 'left' | 'lt' | 'lb' | 'right' | 'rt' | 'rb';\nexport interface PopoverProps {\n children?: ReactElement;\n defaultPopupVisible?: boolean;\n // disabled?: boolean;\n // popupHoverStay?: boolean;\n popupVisible?: boolean;\n // color?: string;\n position?: Anchor;\n content?: ReactNode;\n // onVisibleChange?: (visible: boolean) => void;\n}\n\nconst defaultProps: PopoverProps = {\n defaultPopupVisible: false,\n // popupHoverStay: true,\n // popupVisible: false,\n position: 'top'\n};\n\nconst poptipPanalStyle: CSSProperties = {\n backgroundColor: 'rgb(255, 255, 255)',\n boxShadow: '0 4px 10px rgba(0, 0, 0, .1)',\n fontSize: '14px',\n borderRadius: '4px',\n lineHeight: '1.5715',\n boxSizing: 'border-box',\n color: 'rgb(78, 89, 105)',\n border: '1px solid rgb(229, 230, 235)',\n padding: '12px 16px'\n};\n\nconst Tooltip = (props: { visible: boolean; content: ReactNode; position: Anchor }) => {\n const arrowStyle: CSSProperties = {\n content: '',\n height: '8px',\n width: '8px',\n position: 'absolute',\n display: 'block',\n boxSizing: 'border-box',\n transform: 'rotate(45deg)',\n transformOrigin: '50% 50% 0',\n backgroundColor: 'rgb(255, 255, 255)',\n border: '1px solid rgb(229, 230, 235)',\n ...getArrowStyle(props.position)\n };\n\n return props.visible ? (\n <>\n <div style={poptipPanalStyle}>{props.content}</div>\n <div style={arrowStyle}></div>\n </>\n ) : (\n <></>\n );\n};\n\nfunction PopoverComponent(baseProps: PopoverProps, ref: React.Ref<IGroup>) {\n const props: PopoverProps = merge({}, defaultProps, baseProps);\n const { content, position, popupVisible, defaultPopupVisible, children } = props;\n let popoverRef = React.useRef<IGroup>(null);\n popoverRef = ref ? (ref as React.RefObject<IGroup>) : popoverRef;\n\n const [popupOpen, setPopupOpen] = useState(false);\n\n useEffect(() => {\n if (popupVisible) {\n setPopupOpen(true);\n } else {\n setPopupOpen(false);\n }\n popoverRef.current.stage.renderNextFrame();\n }, [popupVisible]);\n\n useEffect(() => {\n setPopupOpen(popupVisible ?? defaultPopupVisible ?? false);\n }, []);\n\n const { transform, anchorType } = getTransform(position);\n const poptipContainerStyle: CSSProperties = {\n // display: popupOpen ? 'block' : 'none',\n transform: transform\n };\n\n const groupAttribute: IGroupGraphicAttribute = {\n react: {\n // width: 100,\n // height: 100,\n style: poptipContainerStyle,\n element: <Tooltip visible={popupOpen} content={content} position={position} />,\n container: null,\n visible: true,\n pointerEvents: false,\n anchorType: anchorType\n } as IGroupGraphicAttribute['react']\n };\n\n const groupMouseEnter = useCallback((event: any) => {\n if (isValid(popupVisible)) {\n return;\n }\n setPopupOpen(true);\n event.currentTarget.stage.renderNextFrame();\n }, []);\n\n const groupMouseLeave = useCallback((event: any) => {\n if (isValid(popupVisible)) {\n return;\n }\n setPopupOpen(false);\n event.currentTarget.stage.renderNextFrame();\n }, []);\n\n return (\n <Group ref={popoverRef} attribute={groupAttribute} onMouseEnter={groupMouseEnter} onMouseLeave={groupMouseLeave}>\n {children}\n </Group>\n );\n}\n\nfunction getTransform(position: Anchor): { transform: string; anchorType: BoundsAnchorType } {\n switch (position) {\n case 'top':\n return {\n anchorType: 'top',\n transform: 'translate(-50%, calc(-100% - 10px))'\n };\n case 'tl':\n return {\n anchorType: 'top-left',\n transform: 'translate(0, calc(-100% - 10px))'\n };\n case 'tr':\n return {\n anchorType: 'top-right',\n transform: 'translate(-100%, calc(-100% - 10px))'\n };\n case 'bottom':\n return {\n anchorType: 'bottom',\n transform: 'translate(-50%, 10px)'\n };\n case 'bl':\n return {\n anchorType: 'bottom-left',\n transform: 'translate(0, 10px)'\n };\n case 'br':\n return {\n anchorType: 'bottom-right',\n transform: 'translate(-100%, 10px)'\n };\n case 'left':\n return {\n anchorType: 'left',\n transform: 'translate(calc(-100% - 10px), -50%)'\n };\n case 'lt':\n return {\n anchorType: 'top-left',\n transform: 'translate(calc(-100% - 10px), 0)'\n };\n case 'lb':\n return {\n anchorType: 'bottom-left',\n transform: 'translate(calc(-100% - 10px), -100%)'\n };\n case 'right':\n return {\n anchorType: 'right',\n transform: 'translate(10px, -50%)'\n };\n case 'rt':\n return {\n anchorType: 'top-right',\n transform: 'translate(10px, 0)'\n };\n case 'rb':\n return {\n anchorType: 'bottom-right',\n transform: 'translate(10px, -100%)'\n };\n }\n}\n\nfunction getArrowStyle(position: Anchor): CSSProperties {\n switch (position) {\n case 'top':\n return {\n top: 'calc(100% - 5px)',\n left: 'calc(50% - 5px)',\n borderTop: 'none',\n borderLeft: 'none'\n };\n case 'tl':\n return {\n top: 'calc(100% - 4px)',\n left: '14px', // 4(1/2width) + 10(offset)\n borderTop: 'none',\n borderLeft: 'none'\n };\n case 'tr':\n return {\n top: 'calc(100% - 4px)',\n left: 'calc(100% - 24px)', // 10(offset) + 10(width) + 4(1/2width)\n borderTop: 'none',\n borderLeft: 'none'\n };\n case 'bottom':\n return {\n top: '-4px',\n left: 'calc(50% - 4px)',\n borderRight: 'none',\n borderBottom: 'none'\n };\n case 'bl':\n return {\n top: '-4px',\n left: '14px', // 4(1/2width) + 10(offset)\n borderRight: 'none',\n borderBottom: 'none'\n };\n case 'br':\n return {\n top: '-4px',\n left: 'calc(100% - 24px)', // 10(offset) + 10(width) + 4(1/2width)\n borderRight: 'none',\n borderBottom: 'none'\n };\n case 'left':\n return {\n top: 'calc(50% - 4px)',\n left: 'calc(100% - 5px)',\n borderLeft: 'none',\n borderBottom: 'none'\n };\n case 'lt':\n return {\n top: '14px', // 4(1/2width) + 10(offset)\n left: 'calc(100% - 5px)',\n borderLeft: 'none',\n borderBottom: 'none'\n };\n case 'lb':\n return {\n top: 'calc(100% - 24px)', // 10(offset) + 10(width) + 4(1/2width)\n left: 'calc(100% - 5px)',\n borderLeft: 'none',\n borderBottom: 'none'\n };\n case 'right':\n return {\n top: 'calc(50% - 4px)',\n left: '-4px',\n borderRight: 'none',\n borderTop: 'none'\n };\n case 'rt':\n return {\n top: '14px', // 4(1/2width) + 10(offset)\n left: '-4px',\n borderRight: 'none',\n borderTop: 'none'\n };\n case 'rb':\n return {\n top: 'calc(100% - 24px)', // 10(offset) + 10(width) + 4(1/2width)\n left: '-4px',\n borderRight: 'none',\n borderTop: 'none'\n };\n }\n}\n\nexport const Popover = React.forwardRef<IGroup, PopoverProps>(PopoverComponent);\n\nPopover.displayName = 'Popover';\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Cursor, Radio as VRenderRadio, RadioAttributes } from '@visactor/vtable/es/vrender';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface RadioProps {
|
|
4
|
+
children?: string;
|
|
5
|
+
textStyle?: RadioAttributes['text'];
|
|
6
|
+
circleStyle?: RadioAttributes['circle'];
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
interactive?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
disableCursor?: Cursor;
|
|
11
|
+
spaceBetweenTextAndIcon?: number;
|
|
12
|
+
visible?: boolean;
|
|
13
|
+
onChange?: (checked: boolean) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<VRenderRadio>>;
|
|
@@ -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
|
+
}), exports.Radio = void 0;
|
|
39
|
+
|
|
40
|
+
const radio_1 = require("../vrender-components/radio"), vutils_1 = require("@visactor/vutils"), react_1 = __importStar(require("react")), defaultProps = {};
|
|
41
|
+
|
|
42
|
+
function RadioComponent(baseProps, ref) {
|
|
43
|
+
const props = (0, vutils_1.merge)({}, defaultProps, baseProps), {textStyle: textStyle, circleStyle: circleStyle, children: children} = props, rest = __rest(props, [ "textStyle", "circleStyle", "children" ]);
|
|
44
|
+
let radioRef = react_1.default.useRef(null);
|
|
45
|
+
radioRef = ref || radioRef;
|
|
46
|
+
const handleChange = (0, react_1.useCallback)((event => {
|
|
47
|
+
props.onChange && props.onChange(event.target.attribute.checked);
|
|
48
|
+
}), []);
|
|
49
|
+
return (0, react_1.useEffect)((() => (radioRef.current.addEventListener("radio_checked", handleChange),
|
|
50
|
+
() => {
|
|
51
|
+
radioRef.current.removeEventListener("radio_checked", handleChange);
|
|
52
|
+
})), []), react_1.default.createElement(radio_1.Radio, {
|
|
53
|
+
ref: radioRef,
|
|
54
|
+
attribute: Object.assign({
|
|
55
|
+
text: Object.assign(Object.assign({}, textStyle), {
|
|
56
|
+
text: children
|
|
57
|
+
}),
|
|
58
|
+
circle: circleStyle
|
|
59
|
+
}, rest)
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
exports.Radio = react_1.default.forwardRef(RadioComponent), exports.Radio.displayName = "Radio";
|
|
64
|
+
//# sourceMappingURL=radio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/radio/radio.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,uDAA8D;AAC9D,6CAAyC;AACzC,+CAAsD;AAetD,MAAM,YAAY,GAAe,EAAE,CAAC;AAEpC,SAAS,cAAc,CAAC,SAAqB,EAAE,GAA4B;IACzE,MAAM,KAAK,GAAe,IAAA,cAAK,EAAC,EAAE,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAC7D,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAArD,wCAA6C,CAAQ,CAAC;IAC5D,IAAI,QAAQ,GAAG,eAAK,CAAC,MAAM,CAAe,IAAI,CAAC,CAAC;IAChD,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAE,GAAqC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAEnE,MAAM,YAAY,GAAG,IAAA,mBAAW,EAAC,CAAC,KAA+B,EAAE,EAAE;QACnE,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACnE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;QACjE,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;QACtE,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,8BAAC,aAAM,IACL,GAAG,EAAE,QAAQ,EACb,SAAS,kBACP,IAAI,kCACC,SAAS,KACZ,IAAI,EAAE,QAAQ,KAEhB,MAAM,EAAE,WAAW,IAChB,IAAI,IAED,CACX,CAAC;AACJ,CAAC;AAEY,QAAA,KAAK,GAAG,eAAK,CAAC,UAAU,CAA2B,cAAc,CAAC,CAAC;AAEhF,aAAK,CAAC,WAAW,GAAG,OAAO,CAAC","file":"radio.js","sourcesContent":["import type {\n BackgroundAttributes,\n Cursor,\n IRectGraphicAttribute,\n ITextGraphicAttribute,\n Padding,\n Radio as VRenderRadio,\n RadioAttributes\n} from '@visactor/vtable/es/vrender';\nimport { Radio as VRadio } from '../vrender-components/radio';\nimport { merge } from '@visactor/vutils';\nimport React, { useCallback, useEffect } from 'react';\n\nexport interface RadioProps {\n children?: string;\n textStyle?: RadioAttributes['text'];\n circleStyle?: RadioAttributes['circle'];\n checked?: boolean;\n interactive?: boolean;\n disabled?: boolean;\n disableCursor?: Cursor;\n spaceBetweenTextAndIcon?: number;\n visible?: boolean;\n onChange?: (checked: boolean) => void;\n}\n\nconst defaultProps: RadioProps = {};\n\nfunction RadioComponent(baseProps: RadioProps, ref: React.Ref<VRenderRadio>) {\n const props: RadioProps = merge({}, defaultProps, baseProps);\n const { textStyle, circleStyle, children, ...rest } = props;\n let radioRef = React.useRef<VRenderRadio>(null);\n radioRef = ref ? (ref as React.RefObject<VRenderRadio>) : radioRef;\n\n const handleChange = useCallback((event: { target: VRenderRadio }) => {\n props.onChange && props.onChange(event.target.attribute.checked);\n }, []);\n\n useEffect(() => {\n radioRef.current.addEventListener('radio_checked', handleChange);\n return () => {\n radioRef.current.removeEventListener('radio_checked', handleChange);\n };\n }, []);\n\n return (\n <VRadio\n ref={radioRef}\n attribute={{\n text: {\n ...textStyle,\n text: children\n },\n circle: circleStyle,\n ...rest\n }}\n ></VRadio>\n );\n}\n\nexport const Radio = React.forwardRef<VRenderRadio, RadioProps>(RadioComponent);\n\nRadio.displayName = 'Radio';\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IRectGraphicAttribute, ITextGraphicAttribute, Padding, Tag as VRenderTag, TagAttributes } from '@visactor/vtable/es/vrender';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface TagProps {
|
|
4
|
+
attribute?: TagAttributes;
|
|
5
|
+
children?: string;
|
|
6
|
+
textStyle?: Partial<ITextGraphicAttribute>;
|
|
7
|
+
panelStyle?: Partial<IRectGraphicAttribute>;
|
|
8
|
+
padding?: Padding;
|
|
9
|
+
minWidth?: number;
|
|
10
|
+
maxWidth?: number;
|
|
11
|
+
visible?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const Tag: React.ForwardRefExoticComponent<TagProps & React.RefAttributes<VRenderTag>>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __rest = this && this.__rest || function(s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
|
|
6
|
+
if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
|
|
7
|
+
var i = 0;
|
|
8
|
+
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]]);
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
}, __importDefault = this && this.__importDefault || function(mod) {
|
|
12
|
+
return mod && mod.__esModule ? mod : {
|
|
13
|
+
default: mod
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
Object.defineProperty(exports, "__esModule", {
|
|
18
|
+
value: !0
|
|
19
|
+
}), exports.Tag = void 0;
|
|
20
|
+
|
|
21
|
+
const tag_1 = require("../vrender-components/tag"), vutils_1 = require("@visactor/vutils"), react_1 = __importDefault(require("react")), defaultProps = {
|
|
22
|
+
textStyle: {
|
|
23
|
+
fontSize: 14,
|
|
24
|
+
fontFamily: "sans-serif",
|
|
25
|
+
fill: "rgb(51, 101, 238)"
|
|
26
|
+
},
|
|
27
|
+
panelStyle: {
|
|
28
|
+
visible: !0,
|
|
29
|
+
fill: "#e6fffb",
|
|
30
|
+
lineWidth: 1,
|
|
31
|
+
cornerRadius: 4
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
function TagComponent(baseProps, ref) {
|
|
36
|
+
const props = (0, vutils_1.merge)({}, defaultProps, baseProps), {attribute: attribute, panelStyle: panelStyle, children: children} = props, rest = __rest(props, [ "attribute", "panelStyle", "children" ]);
|
|
37
|
+
let tagRef = react_1.default.useRef(null);
|
|
38
|
+
return tagRef = ref || tagRef, react_1.default.createElement(tag_1.Tag, {
|
|
39
|
+
ref: tagRef,
|
|
40
|
+
attribute: null != attribute ? attribute : Object.assign({
|
|
41
|
+
text: children,
|
|
42
|
+
panel: panelStyle
|
|
43
|
+
}, rest)
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
exports.Tag = react_1.default.forwardRef(TagComponent), exports.Tag.displayName = "Tag";
|
|
48
|
+
//# sourceMappingURL=tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/tag/tag.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AASA,mDAAwD;AACxD,6CAAyC;AACzC,kDAAyC;AAazC,MAAM,YAAY,GAAa;IAC7B,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,YAAY;QACxB,IAAI,EAAE,mBAAmB;KAC1B;IAED,UAAU,EAAE;QACV,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,CAAC;QACZ,YAAY,EAAE,CAAC;KAChB;CACF,CAAC;AAEF,SAAS,YAAY,CAAC,SAAmB,EAAE,GAA0B;IACnE,MAAM,KAAK,GAAa,IAAA,cAAK,EAAC,EAAE,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAC3D,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAApD,uCAA4C,CAAQ,CAAC;IAC3D,IAAI,MAAM,GAAG,eAAK,CAAC,MAAM,CAAa,IAAI,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,CAAC,CAAC,CAAE,GAAmC,CAAC,CAAC,CAAC,MAAM,CAAC;IAE7D,OAAO,CACL,8BAAC,SAAI,IACH,GAAG,EAAE,MAAM,EACX,SAAS,EACP,SAAS,aAAT,SAAS,cAAT,SAAS,mBACP,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,UAAiB,IACrB,IAAI,CACR,GAEG,CACT,CAAC;AACJ,CAAC;AAEY,QAAA,GAAG,GAAG,eAAK,CAAC,UAAU,CAAuB,YAAY,CAAC,CAAC;AAExE,WAAG,CAAC,WAAW,GAAG,KAAK,CAAC","file":"tag.js","sourcesContent":["import type {\n BackgroundAttributes,\n Cursor,\n IRectGraphicAttribute,\n ITextGraphicAttribute,\n Padding,\n Tag as VRenderTag,\n TagAttributes\n} from '@visactor/vtable/es/vrender';\nimport { Tag as VTag } from '../vrender-components/tag';\nimport { merge } from '@visactor/vutils';\nimport React, { useEffect } from 'react';\n\nexport interface TagProps {\n attribute?: TagAttributes;\n children?: string;\n textStyle?: Partial<ITextGraphicAttribute>;\n panelStyle?: Partial<IRectGraphicAttribute>;\n padding?: Padding;\n minWidth?: number;\n maxWidth?: number;\n visible?: boolean;\n}\n\nconst defaultProps: TagProps = {\n textStyle: {\n fontSize: 14,\n fontFamily: 'sans-serif',\n fill: 'rgb(51, 101, 238)'\n },\n // padding: [8, 10],\n panelStyle: {\n visible: true,\n fill: '#e6fffb',\n lineWidth: 1,\n cornerRadius: 4\n }\n};\n\nfunction TagComponent(baseProps: TagProps, ref: React.Ref<VRenderTag>) {\n const props: TagProps = merge({}, defaultProps, baseProps);\n const { attribute, panelStyle, children, ...rest } = props;\n let tagRef = React.useRef<VRenderTag>(null);\n tagRef = ref ? (ref as React.RefObject<VRenderTag>) : tagRef;\n\n return (\n <VTag\n ref={tagRef}\n attribute={\n attribute ?? {\n text: children,\n panel: panelStyle as any,\n ...rest\n }\n }\n ></VTag>\n );\n}\n\nexport const Tag = React.forwardRef<VRenderTag, TagProps>(TagComponent);\n\nTag.displayName = 'Tag';\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ReactElement, JSXElementConstructor } from 'react';
|
|
2
|
+
import type { CheckboxAttributes, CheckBox as VCheakbox } from '@visactor/vtable/es/vrender';
|
|
3
|
+
import type { GraphicProps } from './type';
|
|
4
|
+
export declare const Checkbox: (props: GraphicProps<CheckboxAttributes, VCheakbox>) => ReactElement<GraphicProps<CheckboxAttributes, VCheakbox>, JSXElementConstructor<GraphicProps<CheckboxAttributes, VCheakbox>>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/vrender-components/checkbox.tsx"],"names":[],"mappings":";;;AAKa,QAAA,QAAQ,GAKjB,UAAiB,CAAC","file":"checkbox.js","sourcesContent":["import type { ReactElement, JSXElementConstructor } from 'react';\nimport type { CheckboxAttributes, CheckBox as VCheakbox } from '@visactor/vtable/es/vrender';\nimport type { GraphicProps } from './type';\n\n// component from vrender-component\nexport const Checkbox: (\n props: GraphicProps<CheckboxAttributes, VCheakbox>\n) => ReactElement<\n GraphicProps<CheckboxAttributes, VCheakbox>,\n JSXElementConstructor<GraphicProps<CheckboxAttributes, VCheakbox>>\n> = 'checkbox' as any;\n"]}
|