@visactor/react-vtable
Version:
The react version of VTable
48 lines (43 loc) • 1.78 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;
}, __importDefault = this && this.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : {
default: mod
};
};
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.Tag = void 0;
const tag_1 = require("../vrender-components/tag"), vutils_1 = require("@visactor/vutils"), react_1 = __importDefault(require("react")), 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 = (0, vutils_1.merge)({}, defaultProps, baseProps), {attribute: attribute, panelStyle: panelStyle, children: children} = props, rest = __rest(props, [ "attribute", "panelStyle", "children" ]);
let tagRef = react_1.default.useRef(null);
return tagRef = ref || tagRef, react_1.default.createElement(tag_1.Tag, Object.assign({
ref: tagRef,
attribute: null != attribute ? attribute : Object.assign({
text: children,
panel: panelStyle
}, rest)
}, rest));
}
exports.Tag = react_1.default.forwardRef(TagComponent), exports.Tag.displayName = "Tag";
//# sourceMappingURL=tag.js.map