antvis / XFlow

React component for building interactive diagrams.
https://x6.antv.antgroup.com/xflow/guide/introduction
MIT License
581 stars 238 forks source link

流程图,无法往画图面板上添加自定义图形 #195

Closed MrMengJ closed 2 years ago

MrMengJ commented 2 years ago

Describe the bug

通过 NodeCollapsePanel 组件定义的自定义图形,无法往画图面板上添加

Your Example Website or App

https://codesandbox.io/s/condescending-andras-5bcz4l

Steps to Reproduce the Bug or Issue

无法往画图面板上添加自定义图形

Expected behavior

期望可以往画图面板上添加自定义的图形

Screenshots or Videos

image

报错代码位置 https://github.com/antvis/XFlow/blob/be80d8a0651993ad66e34266aea8f101c6531f72/packages/xflow-core/src/command-contributions/node/node-add.ts#L159

Platform

Additional context

通过调试发现在源代码处,是因为在flowchart-canvas组件里并未注册自定义的图形,导致往画图面板添加图形的时候根据 renderKey 找不到对应 component

https://github.com/antvis/XFlow/blob/be80d8a0651993ad66e34266aea8f101c6531f72/packages/xflow-extension/src/flowchart-canvas/config-graph.tsx#L75

https://github.com/antvis/XFlow/blob/be80d8a0651993ad66e34266aea8f101c6531f72/packages/xflow-extension/src/flowchart-node-panel/utils.tsx#L98

https://github.com/antvis/XFlow/blob/be80d8a0651993ad66e34266aea8f101c6531f72/packages/xflow-core/src/command-contributions/node/node-add.ts#L159

xflow-bot[bot] commented 2 years ago

👋 @MrMengJ

Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

MrMengJ commented 2 years ago

@lifesinger @RaoHai @linhuiw @rockdai

hushaoqing commented 2 years ago

[测试有效] 可以尝试使用 useConfig 注册,代替FlowchartNodePanel https://github.com/antvis/XFlow/blob/be80d8a0651993ad66e34266aea8f101c6531f72/packages/xflow-extension/src/flowchart-canvas/config-graph.tsx#L247

image

MrMengJ commented 2 years ago

[测试有效] 可以尝试使用 useConfig 注册,代替FlowchartNodePanel

https://github.com/antvis/XFlow/blob/be80d8a0651993ad66e34266aea8f101c6531f72/packages/xflow-extension/src/flowchart-canvas/config-graph.tsx#L247

image

谢谢,已经通过别的方式来实现啦

xflow-bot[bot] commented 1 year ago

This thread has been automatically locked because it has not had recent activity.

Please open a new issue for related bugs and link to relevant comments in this thread.