condition.ts 803 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import {
  2. NodeConnectionTypes,
  3. type INodeType,
  4. type INodeDataBaseSchema,
  5. type ConditionType
  6. } from '../Interface'
  7. type CaseType = {
  8. id: string
  9. logical_operator: 'and' | 'or'
  10. conditions: ConditionType[]
  11. }
  12. export type ConditionData = INodeDataBaseSchema & {
  13. cases: CaseType[]
  14. }
  15. export const conditionNode: INodeType = {
  16. version: ['1'],
  17. displayName: '条件判断',
  18. name: 'if-else',
  19. description: '根据条件判断',
  20. group: '业务逻辑',
  21. icon: 'lucide:trending-up-down',
  22. iconColor: '#b33be6',
  23. inputs: [NodeConnectionTypes.main],
  24. outputs: () => {
  25. return [NodeConnectionTypes.main]
  26. },
  27. // 业务数据
  28. schema: {
  29. appAgentId: '',
  30. parentId: '',
  31. position: {
  32. x: 20,
  33. y: 30
  34. },
  35. width: 96,
  36. height: 96,
  37. selected: false,
  38. nodeType: 'if-else',
  39. zIndex: 1,
  40. data: {}
  41. }
  42. }