index.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. import { nanoid } from 'nanoid';
  6. import { WorkflowNodeType } from '../constants';
  7. import { FlowNodeRegistry } from '../../typings';
  8. import iconNode from '../../assets/icon-{NODE_NAME}.svg'; // TODO: 准备图标文件
  9. import { formMeta } from './form-meta';
  10. let index = 0;
  11. export const {NODE_NAME}NodeRegistry: FlowNodeRegistry = {
  12. type: WorkflowNodeType.{NODE_TYPE}, // TODO: 在 constants.ts 中定义
  13. info: {
  14. icon: iconNode,
  15. description: '{节点功能描述}', // TODO: 修改描述
  16. },
  17. meta: {
  18. size: {
  19. width: 360,
  20. height: 390,
  21. },
  22. },
  23. onAdd() {
  24. return {
  25. id: `{node_name}_${nanoid(5)}`, // TODO: 修改前缀
  26. type: '{node_type}', // TODO: 与 WorkflowNodeType 保持一致
  27. data: {
  28. title: `{NODE_NAME}_${++index}`, // TODO: 修改标题前缀
  29. // TODO: 根据实际需求定义自定义字段
  30. customConfig: {
  31. key: 'value',
  32. },
  33. // 节点输出数据的 JSON Schema
  34. outputs: {
  35. type: 'object',
  36. properties: {
  37. // TODO: 定义节点执行后的输出结构
  38. result: { type: 'string' },
  39. status: { type: 'number' },
  40. },
  41. },
  42. },
  43. };
  44. },
  45. formMeta: formMeta, // 引入自定义表单
  46. };