Sign in

简柏林 / thingskit-front · Files

GitLab

  • Go to dashboard
  • Project
  • Activity
  • Files
  • Commits
  • Builds 0
  • Graphs
  • Milestones
  • Issues 0
  • Merge Requests 0
  • Labels
  • Wiki
  • Network
  • thingskit-front
  • src
  • views
  • rule
  • designer
  • hook
  • useAddNodes.ts
  • feat: 新增规则链设计器
    5e6e9897
    ww authored
    2023-08-10 18:11:50 +0800  
    Browse Files »
useAddNodes.ts 444 Bytes
Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
import { Node } from '@vue-flow/core';
import { NodeTypeEnum } from '../enum';
import { buildUUID } from '/@/utils/uuid';

export const useAddNodes = () => {
  const getAddNodesParams = (
    position: Node['position'],
    data: object,
    options?: Partial<Node>
  ): Node => {
    return {
      id: buildUUID(),
      type: NodeTypeEnum.CUSTOM,
      position,
      data,
      ...options,
    };
  };

  return { getAddNodesParams };
};