feat(变量节点): 添加变量赋值类型定义并优化节点菜单

refactor: 简化json-schema类型导入
chore: 更新依赖并调整tsconfig配置
This commit is contained in:
2025-09-15 01:07:54 +08:00
parent b0963e5e37
commit 17de176609
6 changed files with 29 additions and 7 deletions

View File

@ -23,7 +23,7 @@ import { CopyShortcut } from '../../shortcuts/copy';
interface NodeMenuProps {
node: WorkflowNodeEntity;
updateTitleEdit: (setEditing: boolean) => void;
updateTitleEdit?: (setEditing: boolean) => void;
deleteNode: () => void;
}
@ -84,7 +84,7 @@ export const NodeMenu: FC<NodeMenuProps> = ({ node, deleteNode, updateTitleEdit
[clientContext, node]
);
const handleEditTitle = useCallback(() => {
updateTitleEdit(true);
updateTitleEdit?.(true);
}, [updateTitleEdit]);
if (!visible) {
@ -97,7 +97,9 @@ export const NodeMenu: FC<NodeMenuProps> = ({ node, deleteNode, updateTitleEdit
position="bottomRight"
render={
<Dropdown.Menu>
<Dropdown.Item onClick={handleEditTitle}>{I18n.t('Edit Title')}</Dropdown.Item>
{updateTitleEdit && (
<Dropdown.Item onClick={handleEditTitle}>{I18n.t('Edit Title')}</Dropdown.Item>
)}
{canMoveOut && <Dropdown.Item onClick={handleMoveOut}>{I18n.t('Move out')}</Dropdown.Item>}
<Dropdown.Item onClick={handleCopy}>{I18n.t('Create Copy')}</Dropdown.Item>
<Dropdown.Item type="danger" onClick={handleDelete}>{I18n.t('Delete')}</Dropdown.Item>

View File

@ -6,6 +6,20 @@
import { FlowNodeJSON } from '@flowgram.ai/free-layout-editor';
import { IFlowValue, IJsonSchema } from '@flowgram.ai/form-materials';
// Minimal assign value type for variable node, inferred from initial data in registry
// 两类操作declare声明变量与 assign赋值已有变量
export type AssignValueType =
| {
operator: 'declare';
left: string; // variable name - 变量名
right: IFlowValue; // value - 值
}
| {
operator: 'assign';
left: string; // existing variable - 已有变量
right: IFlowValue; // value - 值
};
export interface VariableNodeJSON extends FlowNodeJSON {
data: {
title: string;

View File

@ -3,7 +3,7 @@
* SPDX-License-Identifier: MIT
*/
import type { IJsonSchema, IBasicJsonSchema } from '@flowgram.ai/form-materials';
import type { IJsonSchema } from '@flowgram.ai/form-materials';
export type BasicType = IBasicJsonSchema;
export type BasicType = IJsonSchema;
export type JsonSchema = IJsonSchema;