@visactor/react-vtable
Version:
The react version of VTable
46 lines (39 loc) • 1.48 kB
JavaScript
var __rest = this && this.__rest || function(s, e) {
var t = {};
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
var i = 0;
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]]);
}
return t;
};
import { Tag as VTag } from "../vrender-components/tag";
import { merge } from "@visactor/vutils";
import React from "react";
const defaultProps = {
textStyle: {
fontSize: 14,
fontFamily: "sans-serif",
fill: "rgb(51, 101, 238)"
},
panelStyle: {
visible: !0,
fill: "#e6fffb",
lineWidth: 1,
cornerRadius: 4
}
};
function TagComponent(baseProps, ref) {
const props = merge({}, defaultProps, baseProps), {attribute: attribute, panelStyle: panelStyle, children: children} = props, rest = __rest(props, [ "attribute", "panelStyle", "children" ]);
let tagRef = React.useRef(null);
return tagRef = ref || tagRef, React.createElement(VTag, Object.assign({
ref: tagRef,
attribute: null != attribute ? attribute : Object.assign({
text: children,
panel: panelStyle
}, rest)
}, rest));
}
export const Tag = React.forwardRef(TagComponent);
Tag.displayName = "Tag";
//# sourceMappingURL=tag.js.map