import React from 'react'; import { useXFlowApp } from './app-context'; import type { FrontendApplication as IApplication } from '../application'; import { useXflowPrefixCls } from './global-config-context'; import { XFlowAppExtensionModule } from './app-extension-module'; import { ExtensionRegistry } from './extension-registry'; /** graph */ import { XFlowCanvas } from './canvas'; import type { GraphConfig } from '../graph'; import type { ModelServiceConfig } from '../../model-service'; import type { CommandConfig } from '../../command-contributions'; import type { HookConfig } from '../../hooks'; import type { NsGraph } from '../../interface'; import type { NsGraphCmd } from '../../command-contributions'; export interface IProps { /** XFlow 工作台组件元信息, 会储存在全局Model中并在调用Service时作为额外的参数传入 */ meta?: { flowId?: string; [key: string]: any; }; /** 画布的配置,用于配置X6的 Graph.Options 和绑定 Graph 的事件 */ graphConfig?: GraphConfig; /** 画布数据 */ graphData?: NsGraph.IGraphData; /** 布局配置项 */ graphLayout?: NsGraphCmd.GraphLayout.IArgs; /** app 初始化成功的回调 */ onLoad?: IAppLoad; /** 画布是否自动居中 */ isAutoCenter?: boolean; /** 核心模块钩子函数,可以配置额外的业务逻辑包括以下4个hook: * 1. graphOptions: 在实例化X6之前执行 * 2. afterGraphInit: 在实例化X6后执行 * 3. x6Events: 在实例化X6后绑定事件 * 4. beforeGraphDestroy: 在X6实例销毁前执行 */ hookConfig?: HookConfig; /** 可以在这里扩展工作台全局状态 */ modelServiceConfig?: ModelServiceConfig; /** 在这里配置命令的hook */ commandConfig?: CommandConfig; /** xflow app 销毁前的回调 */ onAppDestroy?: IAppDestroy; /** xflow app 初始化后的回调 */ onAppConfigReady?: IAppConfigReady; /** app container style */ style?: React.CSSProperties; /** app container classname */ className?: string; /** xflow less文件中的prefix变量 */ xflowPrefixCls?: string; } export declare type IAppLoad = (app: IApplication, registry?: ExtensionRegistry) => void; export declare type IAppDestroy = (app: IApplication) => void; export declare type IAppConfigReady = (registry: ExtensionRegistry) => void; export declare const XFlow: React.FC; export default XFlow; export { useXFlowApp, useXflowPrefixCls, XFlowCanvas, XFlowAppExtensionModule as XFlowAppExtension, ExtensionRegistry, };