新版本流程编辑器

This commit is contained in:
mlogclub
2026-07-27 19:04:15 +08:00
parent d33960961a
commit e072141953
281 changed files with 25145 additions and 3405 deletions
@@ -0,0 +1,36 @@
/**
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
* SPDX-License-Identifier: MIT
*/
import { FormMeta, FormRenderProps } from '@flowgram.ai/free-layout-editor';
import { AssignRows, createInferAssignPlugin, DisplayOutputs } from '@flowgram.ai/form-materials';
import { FormHeader, FormContent } from '../../form-components';
import { VariableNodeJSON } from './types';
import { defaultFormMeta } from '../default-form-meta';
import { useIsSidebar } from '../../hooks';
export const FormRender = ({ form }: FormRenderProps<VariableNodeJSON>) => {
const isSidebar = useIsSidebar();
return (
<>
<FormHeader />
<FormContent>
{isSidebar ? <AssignRows name="assign" /> : <DisplayOutputs displayFromScope />}
</FormContent>
</>
);
};
export const formMeta: FormMeta = {
render: (props) => <FormRender {...props} />,
effect: defaultFormMeta.effect,
plugins: [
createInferAssignPlugin({
assignKey: 'assign',
outputKey: 'outputs',
}),
],
};
@@ -0,0 +1,48 @@
/**
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
* SPDX-License-Identifier: MIT
*/
import { nanoid } from 'nanoid';
import { WorkflowNodeType } from '../constants';
import { FlowNodeRegistry } from '../../typings';
import iconVariable from '../../assets/icon-variable.png';
import { formMeta } from './form-meta';
let index = 0;
export const VariableNodeRegistry: FlowNodeRegistry = {
type: WorkflowNodeType.Variable,
info: {
icon: iconVariable,
description: 'Variable Assign and Declaration',
},
meta: {
size: {
width: 360,
height: 390,
},
},
onAdd() {
return {
id: `variable_${nanoid(5)}`,
type: 'variable',
data: {
title: `Variable_${++index}`,
assign: [
{
operator: 'declare',
left: 'sum',
right: {
type: 'constant',
content: 0,
schema: { type: 'integer' },
},
},
],
},
};
},
formMeta: formMeta,
};
@@ -0,0 +1,15 @@
/**
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
* SPDX-License-Identifier: MIT
*/
import { FlowNodeJSON } from '@flowgram.ai/free-layout-editor';
import { AssignValueType, IJsonSchema } from '@flowgram.ai/form-materials';
export interface VariableNodeJSON extends FlowNodeJSON {
data: {
title: string;
assign: AssignValueType[];
outputs: IJsonSchema<'object'>;
};
}