import { IGraph } from './graph'; /** * 【节点实例】属性定义 */ export declare type INodeInstance = ITaskNodeInstance | IStartNodeInstance | IRelationNodeInstance | IEndNodeInstance; export interface IBaseNodeInstance { id: string; dom: HTMLElement; left: number; top: number; select: (isSelect: boolean) => void; graph?: IGraph; update: (data: { title?: string; [key: string]: any; }, parmas?: { bottomPanelForceUpdate?: boolean; }) => void; moveTo: (x: number, y: number) => void; getWidth: () => number; getHeight: () => number; getOutputNum: () => number; getInputNum: () => number; couldOutput: () => boolean; couldInput: () => boolean; connectValidate: ({ sourceNode, targetNode, type, }: { sourceNode: any; targetNode: any; type: 'source' | 'target'; }) => string[]; renderPanelConfig: any; onSaveConfig: ({ onSuccess, onError, }: { onSuccess: any; onError: any; }) => any; } export interface ITaskNodeInstance extends IBaseNodeInstance { options: ITaskNode; } export interface IRelationNodeInstance extends IBaseNodeInstance { options: IRelationNode; } export interface IStartNodeInstance extends IBaseNodeInstance { options: IStartNode; } export interface IEndNodeInstance extends IBaseNodeInstance { options: IEndNode; } /** * 【节点】属性定义 */ export declare type INode = ITaskNode | IRelationNode | IStartNode | IEndNode; export declare type INodeType = 'TASK' | 'START' | 'END' | 'RELATION'; export interface IBaseNode { id: string; type: INodeType; title: string; left: number; top: number; icon?: string; selected?: boolean; unCopyable?: boolean; unRemovable?: boolean; maxOutputNum?: number; maxInputNum?: number; width?: number; height?: number; originKey?: string; [key: string]: any; } export interface ITaskNode extends IBaseNode { type: 'TASK'; runningStatus?: 'RUNNING' | 'ERROR' | 'SUCCESS' | string; icon?: string; /** 右侧面板相关 */ formSchema?: {}; editable?: boolean; formVisible?: boolean; formStatus?: 'COMPLETED' | 'WARNING' | 'ERROR'; properties?: {}; } export interface IRelationNode extends IBaseNode { type: 'RELATION'; relationType: string; icon?: string; outputFormSchema?: {}; outputEditable?: {}; outputLabel?: string; } export interface IStartNode extends IBaseNode { type: 'START'; } export interface IEndNode extends IBaseNode { type: 'END'; } export interface INodeSource { type: INodeType; title: string; icon?: string; favor?: boolean; formSchema?: string; properties?: string; originKey?: string; [key: string]: any; } export interface IEndpointsInstance { dom: HTMLElement; hightLight: () => void; unHightLight: () => void; hide: () => void; unHide: () => void; linkable: () => void; unLinkable: () => void; hoverLinkable: () => void; unHoverLinkable: () => void; nodeId: string; type: 'target' | 'source'; }