useInputNode.ts 637 Bytes
import { Config as InputConfig } from '../packages/Entry/Input/config';
import { useAddNodes } from './useAddNodes';

export function useInputNode() {
  const getInputNodeConfig = (id?: string) => {
    const { getAddNodesParams } = useAddNodes();

    const newNode = getAddNodesParams(
      { x: 75, y: 50 },
      {
        ...new InputConfig(),
        data: {
          name: '输入',
          description: '规则链的逻辑输入,将传入消息转发到下一个相关规则节点。',
        },
      },
      { id, draggable: false, selectable: false }
    );

    return newNode;
  };

  return { getInputNodeConfig };
}