|
@@ -49,35 +49,49 @@ export interface FreeLayoutPluginContext extends EditorPluginContext {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Free layout configuration
|
|
|
* 自由布局配置
|
|
* 自由布局配置
|
|
|
*/
|
|
*/
|
|
|
export interface FreeLayoutProps extends EditorProps<FreeLayoutPluginContext, WorkflowJSON> {
|
|
export interface FreeLayoutProps extends EditorProps<FreeLayoutPluginContext, WorkflowJSON> {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * SelectBox config
|
|
|
|
|
+ * 选择框定义
|
|
|
|
|
+ */
|
|
|
selectBox?: SelectBoxPluginOptions;
|
|
selectBox?: SelectBoxPluginOptions;
|
|
|
/**
|
|
/**
|
|
|
- * 节点定义
|
|
|
|
|
|
|
+ * Node registries
|
|
|
|
|
+ * 节点注册
|
|
|
*/
|
|
*/
|
|
|
nodeRegistries?: WorkflowNodeRegistry[];
|
|
nodeRegistries?: WorkflowNodeRegistry[];
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * By default, all nodes are expanded
|
|
|
* 默认是否展开所有节点
|
|
* 默认是否展开所有节点
|
|
|
*/
|
|
*/
|
|
|
allNodesDefaultExpanded?: boolean;
|
|
allNodesDefaultExpanded?: boolean;
|
|
|
/*
|
|
/*
|
|
|
- * 光标图片
|
|
|
|
|
|
|
+ * Cursor configuration, support svg
|
|
|
|
|
+ * 光标图片, 支持 svg
|
|
|
*/
|
|
*/
|
|
|
cursors?: {
|
|
cursors?: {
|
|
|
grab?: string;
|
|
grab?: string;
|
|
|
grabbing?: string;
|
|
grabbing?: string;
|
|
|
};
|
|
};
|
|
|
|
|
+ /**
|
|
|
|
|
+ * History configuration
|
|
|
|
|
+ */
|
|
|
history?: FreeHistoryPluginOptions<FreeLayoutPluginContext> & { disableShortcuts?: boolean };
|
|
history?: FreeHistoryPluginOptions<FreeLayoutPluginContext> & { disableShortcuts?: boolean };
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Line color configuration
|
|
|
* 线条颜色
|
|
* 线条颜色
|
|
|
*/
|
|
*/
|
|
|
lineColor?: LineColor;
|
|
lineColor?: LineColor;
|
|
|
/**
|
|
/**
|
|
|
- * 画布内容更新
|
|
|
|
|
|
|
+ * Listen for content change
|
|
|
|
|
+ * 监听画布内容更新
|
|
|
*/
|
|
*/
|
|
|
onContentChange?: (ctx: FreeLayoutPluginContext, event: WorkflowContentChangeEvent) => void;
|
|
onContentChange?: (ctx: FreeLayoutPluginContext, event: WorkflowContentChangeEvent) => void;
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Determine whether the line is marked as error
|
|
|
* 判断线条是否标红
|
|
* 判断线条是否标红
|
|
|
* @param ctx
|
|
* @param ctx
|
|
|
* @param fromPort
|
|
* @param fromPort
|
|
@@ -91,54 +105,63 @@ export interface FreeLayoutProps extends EditorProps<FreeLayoutPluginContext, Wo
|
|
|
lines: WorkflowLinesManager
|
|
lines: WorkflowLinesManager
|
|
|
) => boolean;
|
|
) => boolean;
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Determine whether the port is marked as error
|
|
|
* 判断端口是否标红
|
|
* 判断端口是否标红
|
|
|
* @param ctx
|
|
* @param ctx
|
|
|
* @param port
|
|
* @param port
|
|
|
*/
|
|
*/
|
|
|
isErrorPort?: (ctx: FreeLayoutPluginContext, port: WorkflowPortEntity) => boolean;
|
|
isErrorPort?: (ctx: FreeLayoutPluginContext, port: WorkflowPortEntity) => boolean;
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Determine if the port is disabled
|
|
|
* 判断端口是否禁用
|
|
* 判断端口是否禁用
|
|
|
* @param ctx
|
|
* @param ctx
|
|
|
* @param port
|
|
* @param port
|
|
|
*/
|
|
*/
|
|
|
isDisabledPort?: (ctx: FreeLayoutPluginContext, port: WorkflowPortEntity) => boolean;
|
|
isDisabledPort?: (ctx: FreeLayoutPluginContext, port: WorkflowPortEntity) => boolean;
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Determine whether the line arrow is reversed
|
|
|
* 判断线条箭头是否反转
|
|
* 判断线条箭头是否反转
|
|
|
* @param ctx
|
|
* @param ctx
|
|
|
* @param line
|
|
* @param line
|
|
|
*/
|
|
*/
|
|
|
isReverseLine?: (ctx: FreeLayoutPluginContext, line: WorkflowLineEntity) => boolean;
|
|
isReverseLine?: (ctx: FreeLayoutPluginContext, line: WorkflowLineEntity) => boolean;
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Determine if the line hides the arrow
|
|
|
* 判断线条是否隐藏箭头
|
|
* 判断线条是否隐藏箭头
|
|
|
* @param ctx
|
|
* @param ctx
|
|
|
* @param line
|
|
* @param line
|
|
|
*/
|
|
*/
|
|
|
isHideArrowLine?: (ctx: FreeLayoutPluginContext, line: WorkflowLineEntity) => boolean;
|
|
isHideArrowLine?: (ctx: FreeLayoutPluginContext, line: WorkflowLineEntity) => boolean;
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Determine whether the line shows a flow effect
|
|
|
* 判断线条是否展示流动效果
|
|
* 判断线条是否展示流动效果
|
|
|
* @param ctx
|
|
* @param ctx
|
|
|
* @param line
|
|
* @param line
|
|
|
*/
|
|
*/
|
|
|
isFlowingLine?: (ctx: FreeLayoutPluginContext, line: WorkflowLineEntity) => boolean;
|
|
isFlowingLine?: (ctx: FreeLayoutPluginContext, line: WorkflowLineEntity) => boolean;
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Determine if a line is disabled
|
|
|
* 判断线条是否禁用
|
|
* 判断线条是否禁用
|
|
|
* @param ctx
|
|
* @param ctx
|
|
|
* @param line
|
|
* @param line
|
|
|
*/
|
|
*/
|
|
|
isDisabledLine?: (ctx: FreeLayoutPluginContext, line: WorkflowLineEntity) => boolean;
|
|
isDisabledLine?: (ctx: FreeLayoutPluginContext, line: WorkflowLineEntity) => boolean;
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Judge whether the line is vertical
|
|
|
* 判断线条是否竖向
|
|
* 判断线条是否竖向
|
|
|
* @param ctx
|
|
* @param ctx
|
|
|
* @param line
|
|
* @param line
|
|
|
*/
|
|
*/
|
|
|
isVerticalLine?: (ctx: FreeLayoutPluginContext, line: WorkflowLineEntity) => boolean;
|
|
isVerticalLine?: (ctx: FreeLayoutPluginContext, line: WorkflowLineEntity) => boolean;
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Listen for dragging the line to end
|
|
|
* 拖拽线条结束
|
|
* 拖拽线条结束
|
|
|
* @param ctx
|
|
* @param ctx
|
|
|
* @param params
|
|
* @param params
|
|
|
*/
|
|
*/
|
|
|
onDragLineEnd?: (ctx: FreeLayoutPluginContext, params: onDragLineEndParams) => Promise<void>;
|
|
onDragLineEnd?: (ctx: FreeLayoutPluginContext, params: onDragLineEndParams) => Promise<void>;
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Set the line renderer type
|
|
|
* 设置线条渲染器类型
|
|
* 设置线条渲染器类型
|
|
|
* @param ctx
|
|
* @param ctx
|
|
|
* @param line
|
|
* @param line
|
|
@@ -148,16 +171,18 @@ export interface FreeLayoutProps extends EditorProps<FreeLayoutPluginContext, Wo
|
|
|
line: WorkflowLineEntity
|
|
line: WorkflowLineEntity
|
|
|
) => LineRenderType | undefined;
|
|
) => LineRenderType | undefined;
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Set the line className
|
|
|
* 设置线条样式
|
|
* 设置线条样式
|
|
|
* @param ctx
|
|
* @param ctx
|
|
|
* @param line
|
|
* @param line
|
|
|
*/
|
|
*/
|
|
|
setLineClassName?: (ctx: FreeLayoutPluginContext, line: WorkflowLineEntity) => string | undefined;
|
|
setLineClassName?: (ctx: FreeLayoutPluginContext, line: WorkflowLineEntity) => string | undefined;
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Whether to create lines or not
|
|
|
* 是否允许创建线条
|
|
* 是否允许创建线条
|
|
|
* @param ctx
|
|
* @param ctx
|
|
|
- * @param fromPort - 开始点
|
|
|
|
|
- * @param toPort - 目标点
|
|
|
|
|
|
|
+ * @param fromPort - Source port
|
|
|
|
|
+ * @param toPort - Target port
|
|
|
*/
|
|
*/
|
|
|
canAddLine?: (
|
|
canAddLine?: (
|
|
|
ctx: FreeLayoutPluginContext,
|
|
ctx: FreeLayoutPluginContext,
|
|
@@ -167,6 +192,7 @@ export interface FreeLayoutProps extends EditorProps<FreeLayoutPluginContext, Wo
|
|
|
silent?: boolean
|
|
silent?: boolean
|
|
|
) => boolean;
|
|
) => boolean;
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Whether to allow the deletion of nodes
|
|
|
* 是否允许删除节点
|
|
* 是否允许删除节点
|
|
|
* @param ctx
|
|
* @param ctx
|
|
|
* @param node - 目标节点
|
|
* @param node - 目标节点
|
|
@@ -179,11 +205,12 @@ export interface FreeLayoutProps extends EditorProps<FreeLayoutPluginContext, Wo
|
|
|
) => boolean;
|
|
) => boolean;
|
|
|
/**
|
|
/**
|
|
|
*
|
|
*
|
|
|
|
|
+ * Whether to delete lines or not
|
|
|
* 是否允许删除线条
|
|
* 是否允许删除线条
|
|
|
* @param ctx
|
|
* @param ctx
|
|
|
- * @param line - 目标线条
|
|
|
|
|
- * @param newLineInfo - 新的线条信息
|
|
|
|
|
- * @param silent - 如果为false,可以加 toast 弹窗
|
|
|
|
|
|
|
+ * @param line - target line
|
|
|
|
|
+ * @param newLineInfo - new line info
|
|
|
|
|
+ * @param silent - If false, you can add a toast pop-up
|
|
|
*/
|
|
*/
|
|
|
canDeleteLine?: (
|
|
canDeleteLine?: (
|
|
|
ctx: FreeLayoutPluginContext,
|
|
ctx: FreeLayoutPluginContext,
|
|
@@ -192,11 +219,12 @@ export interface FreeLayoutProps extends EditorProps<FreeLayoutPluginContext, Wo
|
|
|
silent?: boolean
|
|
silent?: boolean
|
|
|
) => boolean;
|
|
) => boolean;
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Whether to allow lines to be reset
|
|
|
* 是否允许重置线条
|
|
* 是否允许重置线条
|
|
|
- * @param fromPort - 开始点
|
|
|
|
|
- * @param oldToPort - 旧的连接点
|
|
|
|
|
- * @param newToPort - 新的连接点
|
|
|
|
|
- * @param lines - 线条管理器
|
|
|
|
|
|
|
+ * @param fromPort - source port
|
|
|
|
|
+ * @param oldToPort - old target port
|
|
|
|
|
+ * @param newToPort - new target port
|
|
|
|
|
+ * @param lines - lines manager
|
|
|
*/
|
|
*/
|
|
|
canResetLine?: (
|
|
canResetLine?: (
|
|
|
ctx: FreeLayoutPluginContext,
|
|
ctx: FreeLayoutPluginContext,
|
|
@@ -206,8 +234,8 @@ export interface FreeLayoutProps extends EditorProps<FreeLayoutPluginContext, Wo
|
|
|
lines: WorkflowLinesManager
|
|
lines: WorkflowLinesManager
|
|
|
) => boolean;
|
|
) => boolean;
|
|
|
/**
|
|
/**
|
|
|
- * 是否允许拖入子画布 (loop or group)
|
|
|
|
|
* Whether to allow dragging into the sub-canvas (loop or group)
|
|
* Whether to allow dragging into the sub-canvas (loop or group)
|
|
|
|
|
+ * 是否允许拖入子画布 (loop or group)
|
|
|
* @param params
|
|
* @param params
|
|
|
*/
|
|
*/
|
|
|
canDropToNode?: (
|
|
canDropToNode?: (
|