Skip to content

help: drag&drop dynamic|nodes components from sidebar to vFlow draggablezone #106

Answered by acathon
acathon asked this question in Q&A
Discussion options

You must be logged in to vote

thank you so much for your response!

I’ve already implemented a solution, but I’m concerned it might not be as clean or well-structured as it could be. However, it does work, and here's what I’ve done:

private NODE_TYPE_MAP = {
  'SUM': AdditionCustomNodeComponent,
  'MINUS': SubstractionCustomNodeComponent,
  //... Other Custom Components
};

availableNodes = [
  {
    label: 'Operations',
    nodes: [
      { id: 'sum-op', type: 'SUM', data: { text: 'Addition', icon: 'phosphorPlusDuotone' }},
      { id: 'minus-op', type: 'MINUS', data: { text: 'Substraction', icon: 'phosphorMinusDuotone' }},
      // ... others
    ]
  },
];

createNode({ event, data }: DndDropEvent | any) {
  console.…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@acathon
Comment options

Answer selected by artem-mangilev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants