diff --git a/.gitignore b/.gitignore index f9a87d6f3..705f67bc1 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,8 @@ .yarn .turbo/cookies +.turbo/daemon +.turbo # turbo */*/.turbo diff --git a/.turbo/daemon/9af73f40ad414c73-turbo.log.2024-12-04 b/.turbo/daemon/9af73f40ad414c73-turbo.log.2024-12-04 index 3bb20b60b..6e72915f2 100644 --- a/.turbo/daemon/9af73f40ad414c73-turbo.log.2024-12-04 +++ b/.turbo/daemon/9af73f40ad414c73-turbo.log.2024-12-04 @@ -6,3 +6,98 @@ 2024-12-04T01:57:03.387307Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Root, path: AnchoredSystemPathBuf("") }})) 2024-12-04T01:57:03.489850Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/hooks/useXFlow.ts"), AnchoredSystemPathBuf("packages/x-flow/src/components/CustomNode/index.tsx"), AnchoredSystemPathBuf("docs/xflow/XFlowProvider.md"), AnchoredSystemPathBuf("packages/x-flow/src/hooks/useEdges.ts"), AnchoredSystemPathBuf("packages/x-flow/src/components/CandidateNode/index.tsx"), AnchoredSystemPathBuf("docs/xflow/demo/flow-provider/edges.ts"), AnchoredSystemPathBuf("packages/x-flow/src/components/FlowProvider"), AnchoredSystemPathBuf("docs/xflow/demo/xflow-provider"), AnchoredSystemPathBuf("packages/x-flow/src/hooks/useFlow.ts"), AnchoredSystemPathBuf("packages/x-flow/src/hooks/useTemporalStore.ts"), AnchoredSystemPathBuf("packages/x-flow/src/components/CustomEdge/index.tsx"), AnchoredSystemPathBuf("packages/x-flow/src/components/XFlowProvider"), AnchoredSystemPathBuf("packages/x-flow/src/operator/Control/index.tsx"), AnchoredSystemPathBuf("packages/x-flow/src/hooks/useStore.ts"), AnchoredSystemPathBuf("docs/xflow/demo/flow-provider/nodes.ts"), AnchoredSystemPathBuf("packages/x-flow/src/components/XFlowProvider/index.tsx"), AnchoredSystemPathBuf("packages/x-flow/src/types.ts"), AnchoredSystemPathBuf("packages/x-flow/src/withProvider.tsx"), AnchoredSystemPathBuf("packages/x-flow/src/operator/index.tsx"), AnchoredSystemPathBuf("docs/xflow/demo/flow-provider/index.tsx"), AnchoredSystemPathBuf(".turbo/daemon/58af6c43ce0c4d29-turbo.log.2024-12-04"), AnchoredSystemPathBuf("packages/x-flow/src/components/FlowProvider/index.tsx"), AnchoredSystemPathBuf("packages/x-flow/src/XFlow.tsx"), AnchoredSystemPathBuf("docs/xflow/demo/xflow-provider/index.tsx"), AnchoredSystemPathBuf("packages/x-flow/src/components/PanelContainer/index.tsx"), AnchoredSystemPathBuf("packages/x-flow/src/hooks/useNodes.ts"), AnchoredSystemPathBuf("packages/x-flow/src/models/context.ts"), AnchoredSystemPathBuf("packages/x-flow/package.json"), AnchoredSystemPathBuf("docs/xflow/FlowProvider.md"), AnchoredSystemPathBuf("packages/x-flow/src/models/store.ts"), AnchoredSystemPathBuf("docs/xflow/demo/flow-provider"), AnchoredSystemPathBuf("docs/xflow/demo/flow-provider/setting.tsx"), AnchoredSystemPathBuf(".dumi/theme/slots/Header/Navigation.tsx"), AnchoredSystemPathBuf("packages/x-flow/src/Wrapper.tsx"), AnchoredSystemPathBuf("docs/xflow/demo/xflow-provider/setting.tsx"), AnchoredSystemPathBuf("packages/x-flow/src/index.ts"), AnchoredSystemPathBuf("packages/x-flow/src/components/NodeEditor/index.tsx")} 2024-12-04T01:57:03.489860Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }, WorkspacePackage { name: Root, path: AnchoredSystemPathBuf("") }})) +2024-12-04T02:02:45.185787Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodesMenu/index.tsx")} +2024-12-04T02:02:45.185812Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:02:45.185916Z WARN turborepo_lib::package_changes_watcher: hashes are the same, no need to rerun +2024-12-04T02:02:58.688093Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodesMenu/index.tsx")} +2024-12-04T02:02:58.688105Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:02:58.701161Z WARN turborepo_lib::package_changes_watcher: hashes are the same, no need to rerun +2024-12-04T02:04:17.888788Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/utils/createIconFont.ts")} +2024-12-04T02:04:17.888797Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:04:17.888834Z WARN turborepo_lib::package_changes_watcher: hashes are the same, no need to rerun +2024-12-04T02:05:18.288096Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/utils/createIconFont.ts")} +2024-12-04T02:05:18.288109Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:10:35.384082Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/types.ts")} +2024-12-04T02:10:35.384091Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:11:05.484219Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/withProvider.tsx")} +2024-12-04T02:11:05.484235Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:11:13.484884Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/withProvider.tsx")} +2024-12-04T02:11:13.484902Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:12:29.168302Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodesMenu/index.tsx")} +2024-12-04T02:12:29.168323Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:15:25.664194Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodesMenu/index.tsx")} +2024-12-04T02:15:25.664211Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:15:25.768684Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodesMenu/index.tsx")} +2024-12-04T02:15:25.768692Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:15:25.768718Z WARN turborepo_lib::package_changes_watcher: hashes are the same, no need to rerun +2024-12-04T02:15:43.563383Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodesMenu/index.tsx")} +2024-12-04T02:15:43.563398Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:16:50.062422Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodesMenu/index.tsx")} +2024-12-04T02:16:50.062441Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:16:50.163131Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodesMenu/index.tsx")} +2024-12-04T02:16:50.163149Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:16:50.163218Z WARN turborepo_lib::package_changes_watcher: hashes are the same, no need to rerun +2024-12-04T02:17:39.363527Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodesMenu/index.tsx")} +2024-12-04T02:17:39.363536Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:18:04.062963Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodesMenu/index.tsx")} +2024-12-04T02:18:04.062972Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:18:10.463714Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodesMenu/index.tsx")} +2024-12-04T02:18:10.463726Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:18:49.361743Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodesMenu/index.tsx")} +2024-12-04T02:18:49.361755Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:18:49.363845Z WARN turborepo_lib::package_changes_watcher: hashes are the same, no need to rerun +2024-12-04T02:20:35.659889Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/PanelContainer/index.tsx")} +2024-12-04T02:20:35.659907Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:21:01.061839Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/PanelContainer/index.tsx")} +2024-12-04T02:21:01.061862Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:22:02.660020Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/PanelContainer/index.tsx")} +2024-12-04T02:22:02.660032Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:22:48.064171Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/PanelContainer/index.tsx")} +2024-12-04T02:22:48.064181Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:23:13.661187Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/PanelContainer/index.tsx")} +2024-12-04T02:23:13.661205Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:23:13.672898Z WARN turborepo_lib::package_changes_watcher: hashes are the same, no need to rerun +2024-12-04T02:23:35.863089Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/CustomHtml/index.tsx")} +2024-12-04T02:23:35.863105Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:23:35.888091Z WARN turborepo_lib::package_changes_watcher: hashes are the same, no need to rerun +2024-12-04T02:24:34.258187Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/CustomHtml")} +2024-12-04T02:24:34.258197Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:25:23.459497Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodeContainer/index.tsx")} +2024-12-04T02:25:23.459511Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:25:23.517056Z WARN turborepo_lib::package_changes_watcher: hashes are the same, no need to rerun +2024-12-04T02:26:59.256311Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/nodes/node-common/index.tsx")} +2024-12-04T02:26:59.256326Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:27:14.360435Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/nodes/node-common/index.tsx")} +2024-12-04T02:27:14.360446Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:29:50.318142Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodeContainer/index.tsx")} +2024-12-04T02:29:50.318154Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:30:35.512507Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodeContainer/index.tsx")} +2024-12-04T02:30:35.512518Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:30:47.510591Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodeContainer/index.tsx")} +2024-12-04T02:30:47.510603Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:31:01.212277Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodeContainer/index.tsx")} +2024-12-04T02:31:01.212295Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:31:20.309931Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/nodes/node-common/index.tsx")} +2024-12-04T02:31:20.309941Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:31:52.011763Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/nodes/node-common/index.tsx")} +2024-12-04T02:31:52.011774Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:31:52.020830Z WARN turborepo_lib::package_changes_watcher: hashes are the same, no need to rerun +2024-12-04T02:32:12.310098Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/nodes/node-end/index.tsx")} +2024-12-04T02:32:12.310110Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:32:28.910367Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/nodes/node-start/index.tsx")} +2024-12-04T02:32:28.910376Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:32:41.912347Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/nodes/node-switch/index.tsx")} +2024-12-04T02:32:41.912357Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:32:44.508527Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/nodes/node-switch/index.tsx")} +2024-12-04T02:32:44.508541Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:33:13.607908Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodesMenu/index.tsx")} +2024-12-04T02:33:13.607923Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:33:16.507105Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/NodesMenu/index.tsx")} +2024-12-04T02:33:16.507115Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:33:40.209657Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/components/PanelContainer/index.tsx")} +2024-12-04T02:33:40.209675Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T02:35:40.408984Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf(".gitignore")} +2024-12-04T02:35:40.409001Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Root, path: AnchoredSystemPathBuf("") }})) +2024-12-04T05:45:15.025538Z WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/x-flow/src/operator/ZoomInOut/index.tsx")} +2024-12-04T05:45:15.025565Z WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@xrenders/xflow"), path: AnchoredSystemPathBuf("packages/x-flow") }})) +2024-12-04T05:45:15.034848Z WARN turborepo_lib::package_changes_watcher: hashes are the same, no need to rerun diff --git a/docs/xflow/api.md b/docs/xflow/api.md index d13cbdc56..50c3f5fe6 100644 --- a/docs/xflow/api.md +++ b/docs/xflow/api.md @@ -13,7 +13,9 @@ title: API | layout | 节点布局的方向 | `LR \| TB` | LR | - | | widgets | 自定义组件 | `Record` | - | - | | settings | 节点配置,定义页面中可拖动的节点配置 | ( [TNodeGroup](#tnodegroup) \| [TNodeItem](#tnodeitem) )[ ] | | -| nodeSelector | 节点选择器配置,可控制节点的可搜索性 | `TNodeSelector` | | +| nodeSelector | 节点选择器配置,可控制节点的可搜索性 | `TNodeSelector` +| iconFontUrl | iconfont url,用于配置图标渲染 | `String` | | + | | ### TNodeGroup diff --git a/docs/xflow/demo/basic/setting.tsx b/docs/xflow/demo/basic/setting.tsx index 937413778..49484fbc6 100644 --- a/docs/xflow/demo/basic/setting.tsx +++ b/docs/xflow/demo/basic/setting.tsx @@ -162,7 +162,7 @@ export default [ type: 'Switch', description: '允许你根据 if/else 条件将 workflow 拆分成两个分支', icon: { - type: 'icon-switch', + type: 'icon-fenzhi', bgColor: '#06AED4', }, settingSchema: { diff --git a/docs/xflow/demo/custom-flow/setting.tsx b/docs/xflow/demo/custom-flow/setting.tsx index 282e3dbc7..83276d3ee 100644 --- a/docs/xflow/demo/custom-flow/setting.tsx +++ b/docs/xflow/demo/custom-flow/setting.tsx @@ -74,7 +74,7 @@ export default [ type: 'Switch', description: '允许你根据 if/else 条件将 workflow 拆分成两个分支', icon: { - type: 'icon-switch', + type: 'icon-fenzhi', bgColor: '#06AED4', }, }, diff --git a/docs/xflow/demo/flow-provider/setting.tsx b/docs/xflow/demo/flow-provider/setting.tsx index 72f080f69..97e5a27ac 100644 --- a/docs/xflow/demo/flow-provider/setting.tsx +++ b/docs/xflow/demo/flow-provider/setting.tsx @@ -132,7 +132,7 @@ export default [ type: 'Switch', description: '允许你根据 if/else 条件将 workflow 拆分成两个分支', icon: { - type: 'icon-switch', + type: 'icon-fenzhi', bgColor: '#06AED4', }, }, diff --git a/docs/xflow/demo/layout/LR/setting.tsx b/docs/xflow/demo/layout/LR/setting.tsx index 72f080f69..97e5a27ac 100644 --- a/docs/xflow/demo/layout/LR/setting.tsx +++ b/docs/xflow/demo/layout/LR/setting.tsx @@ -132,7 +132,7 @@ export default [ type: 'Switch', description: '允许你根据 if/else 条件将 workflow 拆分成两个分支', icon: { - type: 'icon-switch', + type: 'icon-fenzhi', bgColor: '#06AED4', }, }, diff --git a/docs/xflow/demo/layout/TB/setting.tsx b/docs/xflow/demo/layout/TB/setting.tsx index 72f080f69..97e5a27ac 100644 --- a/docs/xflow/demo/layout/TB/setting.tsx +++ b/docs/xflow/demo/layout/TB/setting.tsx @@ -132,7 +132,7 @@ export default [ type: 'Switch', description: '允许你根据 if/else 条件将 workflow 拆分成两个分支', icon: { - type: 'icon-switch', + type: 'icon-fenzhi', bgColor: '#06AED4', }, }, diff --git a/docs/xflow/demo/nodeSetting/setting.tsx b/docs/xflow/demo/nodeSetting/setting.tsx index 72f080f69..97e5a27ac 100644 --- a/docs/xflow/demo/nodeSetting/setting.tsx +++ b/docs/xflow/demo/nodeSetting/setting.tsx @@ -132,7 +132,7 @@ export default [ type: 'Switch', description: '允许你根据 if/else 条件将 workflow 拆分成两个分支', icon: { - type: 'icon-switch', + type: 'icon-fenzhi', bgColor: '#06AED4', }, }, diff --git a/docs/xflow/demo/switchNode/customSwitchNode/index.tsx b/docs/xflow/demo/switchNode/customSwitchNode/index.tsx new file mode 100644 index 000000000..04a700cd1 --- /dev/null +++ b/docs/xflow/demo/switchNode/customSwitchNode/index.tsx @@ -0,0 +1,33 @@ +import XFlow from '@xrenders/xflow'; +import settings from './setting'; +import React from 'react'; + +const customWidget = ({ data, key, item }) => { + return

{item?.value}

; +}; + +export default () => { + const nodes = [ + { + type: 'Switch', + id: '2', + position: { x: 171.25, y: 218.75 }, + data: { switchData:[{value:"条件1"}]} + }, + ]; + + const edges = []; + + return ( +
+ +
+ ); +}; diff --git a/docs/xflow/demo/switchNode/customSwitchNode/setting.tsx b/docs/xflow/demo/switchNode/customSwitchNode/setting.tsx new file mode 100644 index 000000000..cd49f7d86 --- /dev/null +++ b/docs/xflow/demo/switchNode/customSwitchNode/setting.tsx @@ -0,0 +1,151 @@ +export default [ + { + title: 'Switch', + type: 'Switch', + description: '允许你根据 if/else 条件将 workflow 拆分成两个分支', + icon: { + type: 'icon-fenzhi', + bgColor: '#06AED4', + }, + nodeWidget: "customWidget" // 自定义节点面板渲染 + }, + { + title: '开始', + type: 'Start', + hidden: true, + targetHandleHidden: true, + icon: { + type: 'icon-start', + bgColor: '#17B26A', + }, + settingSchema: { + type: 'object', + properties: { + input: { + title: '变量一', + type: 'string', + widget: 'input', + }, + select: { + title: '变量二', + type: 'string', + widget: 'select', + props: { + options: [ + { label: 'a', value: 'a' }, + { label: 'b', value: 'b' }, + { label: 'c', value: 'c' }, + ], + }, + }, + radio1: { + title: '点击单选', + type: 'string', + widget: 'radio', + props: { + options: [ + { label: '早', value: 'a' }, + { label: '中', value: 'b' }, + { label: '晚', value: 'c' } + ] + } + }, + textarea1: { + title: '长文本', + type: 'string', + widget: 'textArea' + }, + date1: { + title: '日期选择', + type: 'string', + widget: 'datePicker' + }, + dateRange1: { + title: '日期范围', + type: 'range', + widget: 'dateRange' + }, + time1: { + title: '时间选择', + type: 'string', + widget: 'timePicker' + }, + timeRange1: { + title: '时间范围', + type: 'range', + widget: 'timeRange' + }, + }, + }, + }, + { + title: '结束', + type: 'End', + hidden: true, + sourceHandleHidden: true, + icon: { + type: 'icon-end', + bgColor: '#F79009', + }, + settingSchema: { + type: "object", + properties: { + input: { + title: '变量一', + type: 'string', + widget: 'input', + }, + select: { + title: '变量二', + type: 'string', + widget: 'select', + props: { + options: [ + { label: 'a', value: 'a' }, + { label: 'b', value: 'b' }, + { label: 'c', value: 'c' }, + ], + }, + }, + } + } + }, + { + title: 'Prompt', + type: 'Prompt', + description: '通过精心设计提示词,提升大语言模型回答效果', + icon: { + type: 'icon-prompt', + bgColor: '#17B26A', + }, + settingSchema: { + type: "object", + properties: { + input: { + title: '提示词', + type: 'string', + widget: 'textArea', + }, + } + }, + }, + { + title: '知识库', + type: 'knowledge', + description: '允许你从知识库中查询与用户问题相关的文本内容', + icon: { + type: 'icon-knowledge', + bgColor: '#6172F3', + }, + settingSchema: { + type: "object", + properties: { + input: { + title: '知识库', + type: 'string', + widget: 'textArea', + }, + } + }, + }, +]; diff --git a/docs/xflow/demo/switchNode/index.tsx b/docs/xflow/demo/switchNode/index.tsx index 5a9c47fdd..0ade042e5 100644 --- a/docs/xflow/demo/switchNode/index.tsx +++ b/docs/xflow/demo/switchNode/index.tsx @@ -1,13 +1,66 @@ -import React from 'react'; import XFlow from '@xrenders/xflow'; import settings from './setting'; export default () => { const nodes = [ - { id: '1', type: 'Switch', data: { input: '开始节点', select: "b" }, position: { x: 40, y: 240 } }, + { + type: 'Start', + id: '1', + position: { x: -130, y: 290 }, + }, + { + type: 'Switch', + id: '2', + position: { x: 171.25, y: 218.75 }, + data: { switchData: [{ value: '条件1' }] }, + }, + { + type: 'End', + id: '3', + position: { x: 915, y: 287.5 }, + }, + { + id: 'g29rz9ol4ugqz8m8', + type: 'Prompt', + position: { x: 525, y: 210 }, + }, + { + id: 'swqutt73ihfa9lkb', + type: 'knowledge', + position: { x: 522.5, y: 472.5 }, + }, ]; - const edges = [] + const edges = [ + { + source: '1', + target: '2', + id: 'xy-edge__1-2', + }, + { + source: '2', + sourceHandle: 'id_0', + target: 'g29rz9ol4ugqz8m8', + id: 'xy-edge__2id_0-g29rz9ol4ugqz8m8', + }, + { id: 'w6vmrun9sos4t6ds', target: 'swqutt73ihfa9lkb' }, + { + source: '2', + sourceHandle: 'id_else', + target: 'swqutt73ihfa9lkb', + id: 'xy-edge__2id_else-swqutt73ihfa9lkb', + }, + { + source: 'g29rz9ol4ugqz8m8', + target: '3', + id: 'xy-edge__g29rz9ol4ugqz8m8-3', + }, + { + source: 'swqutt73ihfa9lkb', + target: '3', + id: 'xy-edge__swqutt73ihfa9lkb-3', + }, + ]; return (
@@ -20,4 +73,4 @@ export default () => { />
); -} +}; diff --git a/docs/xflow/demo/switchNode/setting.tsx b/docs/xflow/demo/switchNode/setting.tsx index 1c790f4ef..4dd929e62 100644 --- a/docs/xflow/demo/switchNode/setting.tsx +++ b/docs/xflow/demo/switchNode/setting.tsx @@ -4,10 +4,111 @@ export default [ type: 'Switch', description: '允许你根据 if/else 条件将 workflow 拆分成两个分支', icon: { - type: 'icon-switch', + type: 'icon-fenzhi', bgColor: '#06AED4', }, }, + { + title: '开始', + type: 'Start', + hidden: true, + targetHandleHidden: true, + icon: { + type: 'icon-start', + bgColor: '#17B26A', + }, + settingSchema: { + type: 'object', + properties: { + input: { + title: '变量一', + type: 'string', + widget: 'input', + }, + select: { + title: '变量二', + type: 'string', + widget: 'select', + props: { + options: [ + { label: 'a', value: 'a' }, + { label: 'b', value: 'b' }, + { label: 'c', value: 'c' }, + ], + }, + }, + radio1: { + title: '点击单选', + type: 'string', + widget: 'radio', + props: { + options: [ + { label: '早', value: 'a' }, + { label: '中', value: 'b' }, + { label: '晚', value: 'c' } + ] + } + }, + textarea1: { + title: '长文本', + type: 'string', + widget: 'textArea' + }, + date1: { + title: '日期选择', + type: 'string', + widget: 'datePicker' + }, + dateRange1: { + title: '日期范围', + type: 'range', + widget: 'dateRange' + }, + time1: { + title: '时间选择', + type: 'string', + widget: 'timePicker' + }, + timeRange1: { + title: '时间范围', + type: 'range', + widget: 'timeRange' + }, + }, + }, + }, + { + title: '结束', + type: 'End', + hidden: true, + sourceHandleHidden: true, + icon: { + type: 'icon-end', + bgColor: '#F79009', + }, + settingSchema: { + type: "object", + properties: { + input: { + title: '变量一', + type: 'string', + widget: 'input', + }, + select: { + title: '变量二', + type: 'string', + widget: 'select', + props: { + options: [ + { label: 'a', value: 'a' }, + { label: 'b', value: 'b' }, + { label: 'c', value: 'c' }, + ], + }, + }, + } + } + }, { title: 'Prompt', type: 'Prompt', @@ -16,6 +117,16 @@ export default [ type: 'icon-prompt', bgColor: '#17B26A', }, + settingSchema: { + type: "object", + properties: { + input: { + title: '提示词', + type: 'string', + widget: 'textArea', + }, + } + }, }, { title: '知识库', @@ -25,5 +136,15 @@ export default [ type: 'icon-knowledge', bgColor: '#6172F3', }, + settingSchema: { + type: "object", + properties: { + input: { + title: '知识库', + type: 'string', + widget: 'textArea', + }, + } + }, }, ]; diff --git a/docs/xflow/nodeBuildIn.md b/docs/xflow/nodeBuildIn.md index 0df7c0a19..127d9109b 100644 --- a/docs/xflow/nodeBuildIn.md +++ b/docs/xflow/nodeBuildIn.md @@ -4,10 +4,17 @@ title: '内置节点' mobile: false group: title: 最佳展示 - order: 2 + order: --- # 内置节点 ## 条件内置节点 -SwitchNode +内置条件节点,可以直接设置type为`Switch`使用,条件节点的数据格式为` switchData:[{value:"条件1"}]` + + + +## 自定义条件节点 + 可以通过`nodeWidget`自定义节点面板的渲染,也可以通过`settingSchema`和`settingWidget`自定义在弹窗中展示的业务配置组件。 + + diff --git a/docs/xflow/schema/custom-settings.ts b/docs/xflow/schema/custom-settings.ts index 58e00b49c..e6461213f 100644 --- a/docs/xflow/schema/custom-settings.ts +++ b/docs/xflow/schema/custom-settings.ts @@ -83,7 +83,7 @@ export default [ type: 'Switch', description: '允许你根据 if/else 条件将 workflow 拆分成两个分支', icon: { - type: 'icon-switch', + type: 'icon-fenzhi', bgColor: '#06AED4', }, }, diff --git a/docs/xflow/schema/settings.ts b/docs/xflow/schema/settings.ts index 72f080f69..97e5a27ac 100644 --- a/docs/xflow/schema/settings.ts +++ b/docs/xflow/schema/settings.ts @@ -132,7 +132,7 @@ export default [ type: 'Switch', description: '允许你根据 if/else 条件将 workflow 拆分成两个分支', icon: { - type: 'icon-switch', + type: 'icon-fenzhi', bgColor: '#06AED4', }, }, diff --git a/packages/x-flow/.fatherrc.js b/packages/x-flow/.fatherrc.js index 4d442af1f..54e4c410c 100644 --- a/packages/x-flow/.fatherrc.js +++ b/packages/x-flow/.fatherrc.js @@ -22,14 +22,5 @@ export default { }, 'antd', ], - [ - 'import', - { - libraryName: '@ant-design/icons', - libraryDirectory: 'lib/icons', - camel2DashComponentName: false, - }, - '@ant-design/icons', - ], ], }; diff --git a/packages/x-flow/package.json b/packages/x-flow/package.json index 77aaf6a0d..2c44e7349 100644 --- a/packages/x-flow/package.json +++ b/packages/x-flow/package.json @@ -1,6 +1,6 @@ { "name": "@xrenders/xflow", - "version": "1.0.0-beta.2", + "version": "1.0.0-beta.4", "description": "一款功能强大、易用灵活的流程编辑器框架,帮助你轻松构建复杂的工作流和流程产品", "keywords": [ "xflow" @@ -52,7 +52,6 @@ "ahooks": "^3.7.5", "zustand": "^4.5.4", "@xyflow/react": "^12.3.2", - "@remixicon/react": "^4.2.0", "@dagrejs/dagre": "^1.1.3", "zundo": "^2.1.0", "use-context-selector": "^1.4.1", diff --git a/packages/x-flow/src/components/CustomHtml/index.tsx b/packages/x-flow/src/components/CustomHtml/index.tsx deleted file mode 100644 index 64eda1582..000000000 --- a/packages/x-flow/src/components/CustomHtml/index.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import React from 'react'; -import { Tooltip, Typography } from 'antd'; -import _ from 'lodash'; -import IconView from '../IconView'; - -const { Text } = Typography; - -export default (props: any) => { - const { value, config, showEllipsis, width } = props; - const item = config?.[value]; - - if (showEllipsis && width) { - return ( - - {value} - - ); - } - - if (config?.requiredByValue && props.addons.schemaPath.includes('[]')) { - // 根据当前行的数据判断是否必填 - const values = props.addons.getValues(); - const dataPath = props.addons.dataPath; - const record = _.get(values, dataPath.slice(0, dataPath.lastIndexOf('.'))); - const pathName = dataPath.slice(dataPath.lastIndexOf('.') + 1); - // console.log('🚀 ~ record:', record, pathName); - // 获取当前行的数据 - - return ( - - {record?.required && config?.[pathName] === 'required' ? ( - * - ) : ( - '' - )} - {value} - - ); - } - - if (!item) { - return value; - } - const { required, tooltip } = item; - - return ( - - {required && ( - * - )} - {item?.label || value} - {!!tooltip && ( - - - - )} - - ); -}; diff --git a/packages/x-flow/src/components/CustomNode/index.tsx b/packages/x-flow/src/components/CustomNode/index.tsx index bbff9b7fb..a712fc9c9 100644 --- a/packages/x-flow/src/components/CustomNode/index.tsx +++ b/packages/x-flow/src/components/CustomNode/index.tsx @@ -1,6 +1,5 @@ import { Handle, Position, useReactFlow } from '@xyflow/react'; import classNames from 'classnames'; -import produce from 'immer'; import React, { memo, useContext, useState } from 'react'; import { shallow } from 'zustand/shallow'; import { useStore } from '../../hooks/useStore'; @@ -9,25 +8,6 @@ import { capitalize, uuid } from '../../utils'; import './index.less'; import SourceHandle from './sourceHandle'; -const generateRandomArray = (x: number, type?: string) => { - const randomArray = []; - for (let i = 0; i < x; i++) { - const id = `id_${i}`; - if (type === 'Switch') { - if (i === 0) { - randomArray.push({ id, switchTitle: 'IF' }); - } else if (i === x - 1) { - randomArray.push({ id, switchTitle: 'ELSE' }); - } else { - randomArray.push({ id, switchTitle: 'ELIF' }); - } - } else { - randomArray.push({ id }); - } - } - return randomArray; -}; - export default memo((props: any) => { const { id, type, data, layout, isConnectable, selected, onClick } = props; const { widgets, settingMap } = useContext(ConfigContext); @@ -35,28 +15,18 @@ export default memo((props: any) => { widgets[`${capitalize(type)}Node`] || widgets['CommonNode']; const [isHovered, setIsHovered] = useState(false); const reactflow = useReactFlow(); - const { edges, nodes, setNodes, setEdges, mousePosition } = useStore( + const { addNodes, addEdges, mousePosition,nodes,edges } = useStore( (state: any) => ({ nodes: state.nodes, edges: state.edges, mousePosition: state.mousePosition, - setNodes: state.setNodes, - setEdges: state.setEdges, + addNodes: state.addNodes, + addEdges: state.addEdges, onEdgesChange: state.onEdgesChange, }), shallow ); - // data中的switchData的长度,即:if和if else 的数量,条件数量 - const switchDataLength = - data?.switchData?.length >= 1 ? Number(data?.switchData?.length + 1) : 2; - const nodeHeight = 45; // 每次增长的节点高度 - // 1.switch节点 if,else数量 - const sourceHandleNum = - type === 'Switch' - ? generateRandomArray(switchDataLength, 'Switch') - : generateRandomArray(1); - const nodeMinHeight = - type === 'Switch' ? Number(switchDataLength * nodeHeight) : undefined; + const isSwitchNode = type === 'Switch'; // 增加节点并进行联系 const handleAddNode = (data: any) => { @@ -67,23 +37,19 @@ export default memo((props: any) => { }); const targetId = uuid(); - const newNodes = produce(nodes, (draft: any) => { - draft.push({ - id: targetId, - type: 'custom', - data, - position: { x, y }, - }); - }); - const newEdges = produce(edges, (draft: any) => { - draft.push({ - id: uuid(), - source: id, - target: targetId, - }); - }); - setNodes(newNodes); - setEdges(newEdges); + const newNodes = { + id: targetId, + type: 'custom', + data, + position: { x, y }, + }; + const newEdges = { + id: uuid(), + source: id, + target: targetId, + }; + addNodes(newNodes); + addEdges(newEdges); }; let targetPosition = Position.Left; @@ -92,7 +58,7 @@ export default memo((props: any) => { targetPosition = Position.Top; sourcePosition = Position.Bottom; } - + console.log("1", JSON.stringify(nodes), '=====',JSON.stringify(edges)) return (
{ type={type} data={data} onClick={() => onClick(data)} - nodeMinHeight={nodeMinHeight} + position={sourcePosition} + isConnectable={isConnectable} + selected={selected} + isHovered={isHovered} + handleAddNode={handleAddNode} /> - {!settingMap?.[type]?.sourceHandleHidden && ( + {!settingMap?.[type]?.sourceHandleHidden && !isSwitchNode && ( <> - {(sourceHandleNum || [])?.map((item, key) => ( - - ))} + )}
diff --git a/packages/x-flow/src/components/CustomNode/sourceHandle.tsx b/packages/x-flow/src/components/CustomNode/sourceHandle.tsx index 9202b000b..8dd53a1ea 100644 --- a/packages/x-flow/src/components/CustomNode/sourceHandle.tsx +++ b/packages/x-flow/src/components/CustomNode/sourceHandle.tsx @@ -11,7 +11,6 @@ export default memo((props: any) => { selected, isHovered, handleAddNode, - id, switchTitle, ...rest } = props; @@ -32,12 +31,13 @@ export default memo((props: any) => { setIsShowTooltip(false); setOpenNodeSelectPopover(true); }} - id={id} {...rest} > {(selected || isHovered || openNodeSelectPopover) && ( <> - {switchTitle &&
{switchTitle}
} + {switchTitle && ( +
{switchTitle}
+ )}
{ - const { className, onClick, children, icon, title, desc, hideDesc, NodeWidget, nodeMinHeight } = props; + const { className, onClick, children, icon, title, desc, hideDesc, NodeWidget, iconFontUrl } = props; + const IconBox = useMemo(() => createIconFont(iconFontUrl), [iconFontUrl]); return (
{ [className]: !!className, })} onClick={onClick} - style={nodeMinHeight ? { minHeight: nodeMinHeight } : {}} > -
- - +
+ + - {/* {title} */} {
{children}
- {/* {!hideDesc && !!desc &&
{desc}
} */} { NodeWidget &&
{NodeWidget} @@ -42,7 +40,7 @@ export default memo((props: any) => { rows: 2, tooltip: { title: desc, placement: 'topRight' }, }} - className="node-desc" + className='node-desc' > {desc} diff --git a/packages/x-flow/src/components/NodesMenu/index.tsx b/packages/x-flow/src/components/NodesMenu/index.tsx index d0281eff8..f090506a9 100644 --- a/packages/x-flow/src/components/NodesMenu/index.tsx +++ b/packages/x-flow/src/components/NodesMenu/index.tsx @@ -1,9 +1,9 @@ - -import React, { forwardRef, Ref } from 'react'; +import React, { forwardRef, Ref, useContext, useMemo } from 'react'; import { Popover, Input } from 'antd'; import { SearchOutlined } from '@ant-design/icons'; +import { ConfigContext } from '../../models/context'; import { useSet } from '../../utils/hooks'; -import IconView from '../IconView'; +import createIconFont from '../../utils/createIconFont'; import { TNodeMenu } from '../../types'; import './index.less'; @@ -36,11 +36,13 @@ const searchNodeList = (query: string, list: any[]) => { }; // 悬浮菜单项详细描述 -const MenuTooltip = ({ icon, title, description }: any) => { +const MenuTooltip = ({ icon, title, description, iconFontUrl }: any) => { + const IconBox = useMemo(() => createIconFont(iconFontUrl), [iconFontUrl]); + return (
- +
{title} @@ -54,7 +56,9 @@ const MenuTooltip = ({ icon, title, description }: any) => { // 节点菜单项 const MenuItem = (props: any) => { - const { title, type, icon, onClick } = props; + const { title, type, icon, onClick, iconFontUrl } = props; + const IconBox = useMemo(() => createIconFont(iconFontUrl), [iconFontUrl]); + return ( { onClick={onClick(type)} > - @@ -90,6 +94,7 @@ const filterHiddenMenu = (list: any) => { */ const NodesMenu = (props: TNodeMenu, ref: Ref) => { const { items, showSearch, onClick } = props; + const { iconFontUrl } = useContext(ConfigContext); const [state, setState] = useSet({ menuList: [...items] @@ -122,12 +127,21 @@ const NodesMenu = (props: TNodeMenu, ref: Ref) => {
{item.title}
{filterHiddenMenu(item.items).map((data: any, index: number) => ( - + ))}
) : (
- +
))}
diff --git a/packages/x-flow/src/components/PanelContainer/index.tsx b/packages/x-flow/src/components/PanelContainer/index.tsx index bc9778c59..6c39484ce 100644 --- a/packages/x-flow/src/components/PanelContainer/index.tsx +++ b/packages/x-flow/src/components/PanelContainer/index.tsx @@ -1,10 +1,11 @@ import { Divider, Drawer, Input, Space } from 'antd'; import produce from 'immer'; import { debounce } from 'lodash'; -import React, { FC, useContext, useEffect, useState } from 'react'; +import React, { FC, useContext, useEffect, useState, useMemo } from 'react'; import { shallow } from 'zustand/shallow'; import { useStore } from '../../hooks/useStore'; import { ConfigContext } from '../../models/context'; +import createIconFont from '../../utils/createIconFont'; import IconView from '../IconView'; import './index.less'; @@ -19,22 +20,12 @@ interface IPanelProps { data: any; // data值 } -const getDescription = (nodeType: string, description: string) => { - if (nodeType === 'Input') { - return '工作流的起始节点,用于设定启动工作流入参信息'; - } - if (nodeType === 'Output') { - return '工作流的最终节点,用于返回工作流运行后的出参信息'; - } - return description || ''; -}; - -const Panel: FC = (props: any) => { +const Panel: FC = (props: IPanelProps) => { // disabled属性取的地方可能不对------to do const { onClose, children, nodeType, disabled, node, description, id, data } = props; // 1.获取节点配置信息 - const { settingMap } = useContext(ConfigContext); + const { settingMap, iconFontUrl } = useContext(ConfigContext); const nodeSetting = settingMap[nodeType] || {}; const { nodes, setNodes } = useStore( (state: any) => ({ @@ -73,22 +64,24 @@ const Panel: FC = (props: any) => { setTitleVal(data?.title || nodeSetting?.title); }, [JSON.stringify(data), id]); + const Icon = useMemo(() => createIconFont(iconFontUrl), [iconFontUrl]); + return ( -
+
- @@ -107,29 +100,29 @@ const Panel: FC = (props: any) => { /> )}
-
+
{!isDisabled && ( <> - - + + )} {/* */}
-
+
{isDisabled ? ( description ) : ( { const { type, onClick, data } = props; - const { settingMap, widgets } = useContext(ConfigContext); + const { settingMap, widgets, iconFontUrl } = useContext(ConfigContext); const nodeSetting = settingMap[type] || {}; const NodeWidget = widgets[nodeSetting?.nodeWidget] || undefined; return ( { hideDesc={nodeSetting?.hideDesc || !data?.desc} desc={data?.desc} NodeWidget={NodeWidget ? : undefined} + iconFontUrl={iconFontUrl} /> ); }); diff --git a/packages/x-flow/src/nodes/node-end/index.tsx b/packages/x-flow/src/nodes/node-end/index.tsx index 890357a49..a22708088 100644 --- a/packages/x-flow/src/nodes/node-end/index.tsx +++ b/packages/x-flow/src/nodes/node-end/index.tsx @@ -4,7 +4,7 @@ import { ConfigContext } from '../../models/context'; export default memo((props: any) => { const { onClick, type, data } = props; - const { settingMap,widgets } = useContext(ConfigContext); + const { settingMap,widgets, iconFontUrl } = useContext(ConfigContext); const nodeSetting = settingMap[type] || {}; const NodeWidget = widgets[nodeSetting?.nodeWidget] || undefined; @@ -21,6 +21,7 @@ export default memo((props: any) => { hideDesc={nodeSetting?.hideDesc || !data?.desc} desc={data?.desc} NodeWidget={NodeWidget ? : undefined} + iconFontUrl={iconFontUrl} /> ); }); diff --git a/packages/x-flow/src/nodes/node-start/index.tsx b/packages/x-flow/src/nodes/node-start/index.tsx index 923cadfd9..180808eca 100644 --- a/packages/x-flow/src/nodes/node-start/index.tsx +++ b/packages/x-flow/src/nodes/node-start/index.tsx @@ -4,7 +4,7 @@ import { ConfigContext } from '../../models/context'; export default memo((props: any) => { const { onClick, type, data } = props; - const { settingMap, widgets } = useContext(ConfigContext); + const { settingMap, widgets, iconFontUrl } = useContext(ConfigContext); const nodeSetting = settingMap[type] || {}; const NodeWidget = widgets[nodeSetting?.nodeWidget] || undefined; @@ -21,6 +21,7 @@ export default memo((props: any) => { hideDesc={nodeSetting?.hideDesc || !data?.desc} desc={data?.desc} NodeWidget={NodeWidget ? : undefined} + iconFontUrl={iconFontUrl} /> ); }); diff --git a/packages/x-flow/src/nodes/node-switch/SwitchBuildInNodeWidget.tsx b/packages/x-flow/src/nodes/node-switch/SwitchBuildInNodeWidget.tsx index e6efb73fa..339934868 100644 --- a/packages/x-flow/src/nodes/node-switch/SwitchBuildInNodeWidget.tsx +++ b/packages/x-flow/src/nodes/node-switch/SwitchBuildInNodeWidget.tsx @@ -1,11 +1,62 @@ -import { Space,Typography } from 'antd'; +import { Flex } from 'antd'; import React, { memo } from 'react'; +import SourceHandle from '../../components/CustomNode/sourceHandle'; +import './index.less'; export default memo((props: any) => { - const { data } = props; - return - {(data?.switchData || [])?.map(item => - {item?.value} - )} - + const { + data, + position, + isConnectable, + selected, + isHovered, + handleAddNode, + CustomNodeWidget, + } = props; + + return ( + + {(data?.switchData || [{}])?.map((item, index) => ( +
+
+
{index === 0 ? 'IF' : 'ELIF'}
+ +
+
+ {CustomNodeWidget ? ( + + ) : ( + <> + {item?.value && ( +
{item?.value}
+ )} + + )} +
+
+ ))} +
+
+
ELSE
+ +
+
+
+ ); }); diff --git a/packages/x-flow/src/nodes/node-switch/index.less b/packages/x-flow/src/nodes/node-switch/index.less index 5a2c37ce3..4bc4064ad 100644 --- a/packages/x-flow/src/nodes/node-switch/index.less +++ b/packages/x-flow/src/nodes/node-switch/index.less @@ -8,6 +8,7 @@ display: flex; height: 50px; align-items: center; + span { font-weight: bold; margin-left: 8px; @@ -15,8 +16,41 @@ } } -.custom-node-switch-setting{ - .fr-list-simple,.ant-form-item,.fr-panel,.fr-inline-container{ +.custom-node-switch-setting { + + .fr-list-simple, + .ant-form-item, + .fr-panel, + .fr-inline-container { width: 100%; } } + +.node-switch-widget { + + .item-header { + position: relative; + + .item-title { + text-align: right; + font-weight: 600; + } + + .item-handle { + right: -16px; + } + } + + .item-content { + margin: 5px 0; + + .item-content-in { + background-color: #f2f4f7; + border-radius: 0.375rem; + padding: 0.25rem; + word-wrap: break-word; + text-align: justify; + } + + } +} diff --git a/packages/x-flow/src/nodes/node-switch/index.tsx b/packages/x-flow/src/nodes/node-switch/index.tsx index 53824f8de..ca6643820 100644 --- a/packages/x-flow/src/nodes/node-switch/index.tsx +++ b/packages/x-flow/src/nodes/node-switch/index.tsx @@ -8,15 +8,19 @@ export default memo((props: any) => { onClick, type, data, - nodeMinHeight + position, + isConnectable, + selected, + isHovered, + handleAddNode, } = props; - const { settingMap, widgets } = useContext(ConfigContext); + const { settingMap, widgets, iconFontUrl } = useContext(ConfigContext); const nodeSetting = settingMap[type] || {}; const NodeWidget = widgets[nodeSetting?.nodeWidget] || undefined; return ( { onClick={onClick} hideDesc={nodeSetting?.hideDesc || !data?.desc} desc={data?.desc} - NodeWidget={NodeWidget ? : } - nodeMinHeight={nodeMinHeight} + iconFontUrl={iconFontUrl} + NodeWidget={ + + } /> ); }); diff --git a/packages/x-flow/src/nodes/node-switch/setting/index.tsx b/packages/x-flow/src/nodes/node-switch/setting/index.tsx index c4e3f9e01..46ee2b7a6 100644 --- a/packages/x-flow/src/nodes/node-switch/setting/index.tsx +++ b/packages/x-flow/src/nodes/node-switch/setting/index.tsx @@ -1,6 +1,6 @@ import FormRender, { Schema, useForm } from 'form-render'; -import React, { memo } from 'react'; -import '../index.less' +import React, { memo, useEffect } from 'react'; +import '../index.less'; interface INodeSwitchSettingPorps { onChange: (val: any) => void; @@ -10,12 +10,12 @@ interface INodeSwitchSettingPorps { const schema: Schema = { type: 'object', span: 24, - displayType: "row", + displayType: 'row', properties: { switchData: { type: 'array', widget: 'simpleList', - display:"block", + display: 'block', props: { hideCopy: true, hideMove: true, @@ -44,16 +44,18 @@ export default memo((props: INodeSwitchSettingPorps) => { }, }; + useEffect(() => { + form.resetFields(); + form.setValues(value || {}); + }, [JSON.stringify(value)]); + return ( { - form.setValues(value || {}); - }} - className='custom-node-switch-setting' + className="custom-node-switch-setting" /> ); }); diff --git a/packages/x-flow/src/operator/Control/index.less b/packages/x-flow/src/operator/Control/index.less index bf99b50e9..48986c4ea 100644 --- a/packages/x-flow/src/operator/Control/index.less +++ b/packages/x-flow/src/operator/Control/index.less @@ -35,11 +35,6 @@ } } -.icon { - width: 1rem; - height: 1rem; -} - .separator { margin: 0 0.75rem; width: 1px; diff --git a/packages/x-flow/src/operator/Control/index.tsx b/packages/x-flow/src/operator/Control/index.tsx index cb8d9da65..bd39552aa 100644 --- a/packages/x-flow/src/operator/Control/index.tsx +++ b/packages/x-flow/src/operator/Control/index.tsx @@ -1,16 +1,10 @@ +import { Button, Tooltip } from 'antd'; import type { MouseEvent } from 'react'; import React, { memo } from 'react'; -import { - RiCursorLine, - RiFunctionAddLine, - RiHand, - RiStickyNoteAddLine, -} from '@remixicon/react'; -import { Tooltip, Button } from 'antd'; import IconView from '../../components/IconView'; -import { useEventEmitterContextContext } from '../../models/event-emitter'; import NodeSelectPopover from '../../components/NodesPopover'; -import { useStoreApi, useStore } from '../../hooks/useStore'; +import { useStore, useStoreApi } from '../../hooks/useStore'; +import { useEventEmitterContextContext } from '../../models/event-emitter'; import './index.less'; @@ -23,57 +17,68 @@ const Control = (props: any) => { const storeApi = useStoreApi(); const panOnDrag = useStore(s => s.panOnDrag); - const { eventEmitter } = useEventEmitterContextContext() + const { eventEmitter } = useEventEmitterContextContext(); - const handleInteractionModeChange = (panOnDrag) => { - storeApi.setState({ panOnDrag }) - } + const handleInteractionModeChange = panOnDrag => { + storeApi.setState({ panOnDrag }); + }; return ( -
+
- +
- ) + ); }; export default memo(Control); diff --git a/packages/x-flow/src/operator/UndoRedo/index.tsx b/packages/x-flow/src/operator/UndoRedo/index.tsx index 2404b01b4..392cf27ac 100644 --- a/packages/x-flow/src/operator/UndoRedo/index.tsx +++ b/packages/x-flow/src/operator/UndoRedo/index.tsx @@ -16,7 +16,7 @@ export default memo(({ handleUndo, handleRedo, pastStates, futureStates }: UndoR
- ) + ); }; export default memo(ZoomInOut); diff --git a/packages/x-flow/src/operator/index.less b/packages/x-flow/src/operator/index.less index d2cc387c0..74a471c34 100644 --- a/packages/x-flow/src/operator/index.less +++ b/packages/x-flow/src/operator/index.less @@ -24,3 +24,11 @@ z-index: 9; } } + + +.icon { + width: 1rem; + height: 1rem; + color: #666F83; + font-size: 20; +} diff --git a/packages/x-flow/src/types.ts b/packages/x-flow/src/types.ts index c23c315bc..493ad9216 100644 --- a/packages/x-flow/src/types.ts +++ b/packages/x-flow/src/types.ts @@ -41,6 +41,7 @@ export interface FlowProps { widgets: any; // 自定义组件 settings: (TNodeGroup | TNodeItem)[]; // 节点配置 nodeSelector: TNodeSelector; + iconFontUrl: string; } export default FlowProps; diff --git a/packages/x-flow/src/utils/createIconFont.ts b/packages/x-flow/src/utils/createIconFont.ts index f11184a35..24ae1bcdc 100644 --- a/packages/x-flow/src/utils/createIconFont.ts +++ b/packages/x-flow/src/utils/createIconFont.ts @@ -2,6 +2,7 @@ import { createFromIconfontCN } from '@ant-design/icons'; export default (url?: string) => { return createFromIconfontCN({ - scriptUrl: url || '//at.alicdn.com/t/a/font_2750617_sax751jyfjl.js', + // scriptUrl: url || '//at.alicdn.com/t/a/font_4201076_frx3c9x07if.js', + scriptUrl: url || '//at.alicdn.com/t/a/font_4069358_ihlwbi6uipk.js', }); -}; \ No newline at end of file +}; diff --git a/packages/x-flow/src/withProvider.tsx b/packages/x-flow/src/withProvider.tsx index 2f5b4a9c2..32baa4002 100644 --- a/packages/x-flow/src/withProvider.tsx +++ b/packages/x-flow/src/withProvider.tsx @@ -25,6 +25,7 @@ export default function withProvider( nodeSelector, settings, initialValues, + iconFontUrl, ...restProps } = props; @@ -47,6 +48,7 @@ export default function withProvider( nodeSelector, settings, settingMap, + iconFontUrl, widgets: { ...defaultWidgets, ...widgets,