feat(变量节点): 添加变量赋值类型定义并优化节点菜单
refactor: 简化json-schema类型导入 chore: 更新依赖并调整tsconfig配置
This commit is contained in:
@ -12,13 +12,13 @@
|
|||||||
"@ant-design/icons": "^5.4.0",
|
"@ant-design/icons": "^5.4.0",
|
||||||
"@douyinfe/semi-icons": "^2.80.0",
|
"@douyinfe/semi-icons": "^2.80.0",
|
||||||
"@douyinfe/semi-ui": "^2.80.0",
|
"@douyinfe/semi-ui": "^2.80.0",
|
||||||
|
"@flowgram.ai/form-materials": "^0.4.7",
|
||||||
"@flowgram.ai/free-container-plugin": "^0.4.7",
|
"@flowgram.ai/free-container-plugin": "^0.4.7",
|
||||||
"@flowgram.ai/free-group-plugin": "^0.4.7",
|
"@flowgram.ai/free-group-plugin": "^0.4.7",
|
||||||
"@flowgram.ai/free-layout-editor": "^0.4.7",
|
"@flowgram.ai/free-layout-editor": "^0.4.7",
|
||||||
"@flowgram.ai/free-lines-plugin": "^0.4.7",
|
"@flowgram.ai/free-lines-plugin": "^0.4.7",
|
||||||
"@flowgram.ai/free-node-panel-plugin": "^0.4.7",
|
"@flowgram.ai/free-node-panel-plugin": "^0.4.7",
|
||||||
"@flowgram.ai/free-snap-plugin": "^0.4.7",
|
"@flowgram.ai/free-snap-plugin": "^0.4.7",
|
||||||
"@flowgram.ai/form-materials": "^0.4.7",
|
|
||||||
"@flowgram.ai/minimap-plugin": "^0.4.7",
|
"@flowgram.ai/minimap-plugin": "^0.4.7",
|
||||||
"@flowgram.ai/runtime-interface": "^0.4.7",
|
"@flowgram.ai/runtime-interface": "^0.4.7",
|
||||||
"@flowgram.ai/runtime-js": "^0.4.7",
|
"@flowgram.ai/runtime-js": "^0.4.7",
|
||||||
@ -36,12 +36,17 @@
|
|||||||
"styled-components": "^5.3.11"
|
"styled-components": "^5.3.11"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
||||||
|
"@babel/plugin-proposal-decorators": "^7.28.0",
|
||||||
|
"@babel/plugin-proposal-private-methods": "^7.18.6",
|
||||||
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
||||||
"@types/js-yaml": "^4.0.9",
|
"@types/js-yaml": "^4.0.9",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/react": "^18.3.24",
|
"@types/react": "^18.3.24",
|
||||||
"@types/react-dom": "^18.3.7",
|
"@types/react-dom": "^18.3.7",
|
||||||
"@types/styled-components": "^5.1.34",
|
"@types/styled-components": "^5.1.34",
|
||||||
"@vitejs/plugin-react": "^4.2.0",
|
"@vitejs/plugin-react": "^4.2.0",
|
||||||
|
"babel-plugin-transform-typescript-metadata": "^0.3.2",
|
||||||
"less": "^4.2.0",
|
"less": "^4.2.0",
|
||||||
"typescript": "^5.4.0",
|
"typescript": "^5.4.0",
|
||||||
"vite": "^5.2.0"
|
"vite": "^5.2.0"
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import { CopyShortcut } from '../../shortcuts/copy';
|
|||||||
|
|
||||||
interface NodeMenuProps {
|
interface NodeMenuProps {
|
||||||
node: WorkflowNodeEntity;
|
node: WorkflowNodeEntity;
|
||||||
updateTitleEdit: (setEditing: boolean) => void;
|
updateTitleEdit?: (setEditing: boolean) => void;
|
||||||
deleteNode: () => void;
|
deleteNode: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ export const NodeMenu: FC<NodeMenuProps> = ({ node, deleteNode, updateTitleEdit
|
|||||||
[clientContext, node]
|
[clientContext, node]
|
||||||
);
|
);
|
||||||
const handleEditTitle = useCallback(() => {
|
const handleEditTitle = useCallback(() => {
|
||||||
updateTitleEdit(true);
|
updateTitleEdit?.(true);
|
||||||
}, [updateTitleEdit]);
|
}, [updateTitleEdit]);
|
||||||
|
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
@ -97,7 +97,9 @@ export const NodeMenu: FC<NodeMenuProps> = ({ node, deleteNode, updateTitleEdit
|
|||||||
position="bottomRight"
|
position="bottomRight"
|
||||||
render={
|
render={
|
||||||
<Dropdown.Menu>
|
<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>}
|
{canMoveOut && <Dropdown.Item onClick={handleMoveOut}>{I18n.t('Move out')}</Dropdown.Item>}
|
||||||
<Dropdown.Item onClick={handleCopy}>{I18n.t('Create Copy')}</Dropdown.Item>
|
<Dropdown.Item onClick={handleCopy}>{I18n.t('Create Copy')}</Dropdown.Item>
|
||||||
<Dropdown.Item type="danger" onClick={handleDelete}>{I18n.t('Delete')}</Dropdown.Item>
|
<Dropdown.Item type="danger" onClick={handleDelete}>{I18n.t('Delete')}</Dropdown.Item>
|
||||||
|
|||||||
@ -6,6 +6,20 @@
|
|||||||
import { FlowNodeJSON } from '@flowgram.ai/free-layout-editor';
|
import { FlowNodeJSON } from '@flowgram.ai/free-layout-editor';
|
||||||
import { IFlowValue, IJsonSchema } from '@flowgram.ai/form-materials';
|
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 {
|
export interface VariableNodeJSON extends FlowNodeJSON {
|
||||||
data: {
|
data: {
|
||||||
title: string;
|
title: string;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* 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;
|
export type JsonSchema = IJsonSchema;
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "react-jsx",
|
"jsx": "react-jsx",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
"strictPropertyInitialization": false,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"baseUrl": "."
|
"baseUrl": "."
|
||||||
},
|
},
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user