feat(flows): 新增流程编辑器基础功能与相关组件
feat(backend): 添加流程模型与服务支持 feat(frontend): 实现流程编辑器UI与交互 feat(assets): 添加流程节点图标资源 feat(plugins): 实现上下文菜单和运行时插件 feat(components): 新增基础节点和侧边栏组件 feat(routes): 添加流程相关路由配置 feat(models): 创建流程和运行日志数据模型 feat(services): 实现流程服务层逻辑 feat(migration): 添加流程相关数据库迁移 feat(config): 更新前端配置支持流程编辑器 feat(utils): 增强axios错误处理和工具函数
This commit is contained in:
7
frontend/src/flows/typings/index.ts
Normal file
7
frontend/src/flows/typings/index.ts
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
export * from './node';
|
||||
export * from './json-schema';
|
||||
9
frontend/src/flows/typings/json-schema.ts
Normal file
9
frontend/src/flows/typings/json-schema.ts
Normal file
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
import type { IJsonSchema, IBasicJsonSchema } from '@flowgram.ai/form-materials';
|
||||
|
||||
export type BasicType = IBasicJsonSchema;
|
||||
export type JsonSchema = IJsonSchema;
|
||||
77
frontend/src/flows/typings/node.ts
Normal file
77
frontend/src/flows/typings/node.ts
Normal file
@ -0,0 +1,77 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
import {
|
||||
WorkflowNodeJSON as FlowNodeJSONDefault,
|
||||
WorkflowNodeRegistry as FlowNodeRegistryDefault,
|
||||
FreeLayoutPluginContext,
|
||||
FlowNodeEntity,
|
||||
type WorkflowEdgeJSON,
|
||||
WorkflowNodeMeta,
|
||||
} from '@flowgram.ai/free-layout-editor';
|
||||
import { IFlowValue } from '@flowgram.ai/form-materials';
|
||||
|
||||
import { type JsonSchema } from './json-schema';
|
||||
import { WorkflowNodeType } from '../nodes';
|
||||
|
||||
/**
|
||||
* You can customize the data of the node, and here you can use JsonSchema to define the input and output of the node
|
||||
* 你可以自定义节点的 data 业务数据, 这里演示 通过 JsonSchema 来定义节点的输入/输出
|
||||
*/
|
||||
export interface FlowNodeJSON extends FlowNodeJSONDefault {
|
||||
data: {
|
||||
/**
|
||||
* Node title
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* Inputs data values
|
||||
*/
|
||||
inputsValues?: Record<string, IFlowValue>;
|
||||
/**
|
||||
* Define the inputs data of the node by JsonSchema
|
||||
*/
|
||||
inputs?: JsonSchema;
|
||||
/**
|
||||
* Define the outputs data of the node by JsonSchema
|
||||
*/
|
||||
outputs?: JsonSchema;
|
||||
/**
|
||||
* Rest properties
|
||||
*/
|
||||
[key: string]: any;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* You can customize your own node meta
|
||||
* 你可以自定义节点的meta
|
||||
*/
|
||||
export interface FlowNodeMeta extends WorkflowNodeMeta {
|
||||
sidebarDisabled?: boolean;
|
||||
nodePanelHidden?: boolean;
|
||||
wrapperStyle?: React.CSSProperties;
|
||||
onlyInContainer?: WorkflowNodeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* You can customize your own node registry
|
||||
* 你可以自定义节点的注册器
|
||||
*/
|
||||
export interface FlowNodeRegistry extends FlowNodeRegistryDefault {
|
||||
meta: FlowNodeMeta;
|
||||
info?: {
|
||||
icon: string;
|
||||
description: string;
|
||||
};
|
||||
canAdd?: (ctx: FreeLayoutPluginContext) => boolean;
|
||||
canDelete?: (ctx: FreeLayoutPluginContext, from: FlowNodeEntity) => boolean;
|
||||
onAdd?: (ctx: FreeLayoutPluginContext) => FlowNodeJSON;
|
||||
}
|
||||
|
||||
export interface FlowDocumentJSON {
|
||||
nodes: FlowNodeJSON[];
|
||||
edges: WorkflowEdgeJSON[];
|
||||
}
|
||||
Reference in New Issue
Block a user