import { CompoundedComponent } from "@/types"; import { register } from "@antv/x6-react-shape"; import { Node } from "@antv/x6"; import { ports, defaultData } from "../data"; import CustomInput from "../CustomInput"; import { useSizeHook, useShapeProps } from "@/hooks"; const component = ({ node }: { node: Node }) => { const { label, text, fill, stroke, opacity } = node.getData(); const { size, ref } = useSizeHook(); const { fillContent, defsContent, strokeColor, strokeWidth, strokeDasharray, } = useShapeProps(fill, size, stroke); const { width: w, height: h } = size; return ( <>
{defsContent}
); }; register({ shape: "custom-react-braces", width: 200, height: 140, effect: ["data"], component: component, }); const braces: CompoundedComponent = { name: "大括号", icon: require("./image/braces.png"), node: { shape: "custom-react-braces", data: { label: "", ...defaultData, }, ports, }, }; export default braces;