import { register } from "@antv/x6-react-shape"; import { Graph, Node } from "@antv/x6"; import CustomInput from "../../CustomInput"; import { useSizeHook, useShapeProps } from "../../../hooks"; const component = ({ node }: { node: Node }) => { const { label, text, fill, stroke, opacity, name } = node.getData(); const { size, ref } = useSizeHook(); const { fillContent, defsContent, strokeColor, strokeWidth, strokeDasharray, } = useShapeProps(fill, size, stroke); const { width, height } = size; const circleSize = 4; const handleSetName = (val: string) => { node.setData({ name: val }); }; return ( <>
{/* 包名 */}
{/* 文本 */}
{defsContent}
); }; register({ shape: "custom-react-package", width: 210, height: 150, effect: ["data"], component: component, }); const Package = { name: "包", icon: require("./image/package.png"), node: { shape: "custom-react-package", data: { label: "", // 包名 name: "包名称", text: { textAlign: 'left', } }, }, }; export default Package;