refactor(flowEditor): 重构节点编辑器和节点组件结构将 flowEditor 中的节点和节点编辑器相关代码迁移至 components/FlowEditor 目录

master
钟良源 4 months ago
parent b1d7abfebf
commit 5b51f3da1b

@ -1,10 +1,10 @@
import React from 'react'; import React from 'react';
// import styles from '@/pages/flowEditor/node/style/base.module.less'; // import styles from '@/pages/flowEditor/node/style/base.module.less';
import styles from '@/pages/flowEditor/node/style/baseOther.module.less'; import styles from '@/components/FlowEditor/node/style/baseOther.module.less';
import NodeContent from '@/pages/flowEditor/components/nodeContent'; import NodeContent from '@/pages/flowEditor/components/nodeContent';
import NodeContentOther from '@/pages/flowEditor/components/nodeContentOther'; import NodeContentOther from '@/pages/flowEditor/components/nodeContentOther';
import { useStore } from '@xyflow/react'; import { useStore } from '@xyflow/react';
import { defaultNodeTypes } from '@/pages/flowEditor/node/types/defaultType'; import { defaultNodeTypes } from '@/components/FlowEditor/node/types/defaultType';
const BasicNode = ({ data, id }: { data: defaultNodeTypes; id: string }) => { const BasicNode = ({ data, id }: { data: defaultNodeTypes; id: string }) => {

@ -1,9 +1,9 @@
import React from 'react'; import React from 'react';
// import styles from '@/pages/flowEditor/node/style/base.module.less'; // import styles from '@/pages/flowEditor/node/style/base.module.less';
import styles from '@/pages/flowEditor/node/style/baseOther.module.less'; import styles from '@/components/FlowEditor/node/style/baseOther.module.less';
import NodeContent from '@/pages/flowEditor/components/nodeContent'; import NodeContent from '@/pages/flowEditor/components/nodeContent';
import { useStore } from '@xyflow/react'; import { useStore } from '@xyflow/react';
import { defaultNodeTypes } from '@/pages/flowEditor/node/types/defaultType'; import { defaultNodeTypes } from '@/components/FlowEditor/node/types/defaultType';
import NodeContentOther from '@/pages/flowEditor/components/nodeContentOther'; import NodeContentOther from '@/pages/flowEditor/components/nodeContentOther';

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { useStore } from '@xyflow/react'; import { useStore } from '@xyflow/react';
// import styles from '@/pages/flowEditor/node/style/base.module.less'; // import styles from '@/pages/flowEditor/node/style/base.module.less';
import styles from '@/pages/flowEditor/node/style/baseOther.module.less'; import styles from '@/components/FlowEditor/node/style/baseOther.module.less';
import NodeContent from '@/pages/flowEditor/components/nodeContent'; import NodeContent from '@/pages/flowEditor/components/nodeContent';
import DynamicIcon from '@/components/DynamicIcon'; import DynamicIcon from '@/components/DynamicIcon';
import NodeContentOther from '@/pages/flowEditor/components/nodeContentOther'; import NodeContentOther from '@/pages/flowEditor/components/nodeContentOther';

@ -1,9 +1,9 @@
import React from 'react'; import React from 'react';
// import styles from '@/pages/flowEditor/node/style/base.module.less'; // import styles from '@/pages/flowEditor/node/style/base.module.less';
import styles from '@/pages/flowEditor/node/style/baseOther.module.less'; import styles from '@/components/FlowEditor/node/style/baseOther.module.less';
import NodeContent from '@/pages/flowEditor/components/nodeContent'; import NodeContent from '@/pages/flowEditor/components/nodeContent';
import { useStore } from '@xyflow/react'; import { useStore } from '@xyflow/react';
import { defaultNodeTypes } from '@/pages/flowEditor/node/types/defaultType'; import { defaultNodeTypes } from '@/components/FlowEditor/node/types/defaultType';
import NodeContentOther from '@/pages/flowEditor/components/nodeContentOther'; import NodeContentOther from '@/pages/flowEditor/components/nodeContentOther';

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors'; import { NodeEditorProps } from '@/components/FlowEditor/nodeEditors';
import { Typography } from '@arco-design/web-react'; import { Typography } from '@arco-design/web-react';
import { IconUnorderedList } from '@arco-design/web-react/icon'; import { IconUnorderedList } from '@arco-design/web-react/icon';
import ParamsTable from './ParamsTable'; import ParamsTable from './ParamsTable';

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors'; import { NodeEditorProps } from '@/components/FlowEditor/nodeEditors';
import { Typography } from '@arco-design/web-react'; import { Typography } from '@arco-design/web-react';
import { IconUnorderedList } from '@arco-design/web-react/icon'; import { IconUnorderedList } from '@arco-design/web-react/icon';
import ParamsTable from './ParamsTable'; import ParamsTable from './ParamsTable';

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors'; import { NodeEditorProps } from '@/components/FlowEditor/nodeEditors';
import { Typography } from '@arco-design/web-react'; import { Typography } from '@arco-design/web-react';
import { IconUnorderedList } from '@arco-design/web-react/icon'; import { IconUnorderedList } from '@arco-design/web-react/icon';
import ParamsTable from './ParamsTable'; import ParamsTable from './ParamsTable';

@ -1,5 +1,5 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors'; import { NodeEditorProps } from '@/components/FlowEditor/nodeEditors';
import { Typography } from '@arco-design/web-react'; import { Typography } from '@arco-design/web-react';
import { IconUnorderedList } from '@arco-design/web-react/icon'; import { IconUnorderedList } from '@arco-design/web-react/icon';
import ParamsTable from './ParamsTable'; import ParamsTable from './ParamsTable';

@ -1,5 +1,5 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors'; import { NodeEditorProps } from '@/components/FlowEditor/nodeEditors';
import { Typography } from '@arco-design/web-react'; import { Typography } from '@arco-design/web-react';
import { IconUnorderedList } from '@arco-design/web-react/icon'; import { IconUnorderedList } from '@arco-design/web-react/icon';
import EventSelect from './EventSelect'; import EventSelect from './EventSelect';

@ -1,8 +1,8 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors'; import { NodeEditorProps } from '@/components/FlowEditor/nodeEditors';
import { Typography } from '@arco-design/web-react'; import { Typography } from '@arco-design/web-react';
import { IconUnorderedList } from '@arco-design/web-react/icon'; import { IconUnorderedList } from '@arco-design/web-react/icon';
import EventSelect from '@/pages/flowEditor/nodeEditors/components/EventSelect'; import EventSelect from '@/components/FlowEditor/nodeEditors/components/EventSelect';
import { tempEventList } from '@/pages/flowEditor/test/exampleFlowData'; import { tempEventList } from '@/pages/flowEditor/test/exampleFlowData';
const EventSendEditor: React.FC<NodeEditorProps> = ({ nodeData, updateNodeData }) => { const EventSendEditor: React.FC<NodeEditorProps> = ({ nodeData, updateNodeData }) => {

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors'; import { NodeEditorProps } from '@/components/FlowEditor/nodeEditors';
import { Typography } from '@arco-design/web-react'; import { Typography } from '@arco-design/web-react';
import { IconUnorderedList } from '@arco-design/web-react/icon'; import { IconUnorderedList } from '@arco-design/web-react/icon';
import ParamsTable from './ParamsTable'; import ParamsTable from './ParamsTable';

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors'; import { NodeEditorProps } from '@/components/FlowEditor/nodeEditors';
import { Typography } from '@arco-design/web-react'; import { Typography } from '@arco-design/web-react';
import { IconUnorderedList } from '@arco-design/web-react/icon'; import { IconUnorderedList } from '@arco-design/web-react/icon';
import ParamsTable from './ParamsTable'; import ParamsTable from './ParamsTable';

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors'; import { NodeEditorProps } from '@/components/FlowEditor/nodeEditors';
import { Typography } from '@arco-design/web-react'; import { Typography } from '@arco-design/web-react';
import { IconUnorderedList } from '@arco-design/web-react/icon'; import { IconUnorderedList } from '@arco-design/web-react/icon';
import ParamsTable from './ParamsTable'; import ParamsTable from './ParamsTable';

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors'; import { NodeEditorProps } from '@/components/FlowEditor/nodeEditors';
import { Typography } from '@arco-design/web-react'; import { Typography } from '@arco-design/web-react';
import { IconUnorderedList } from '@arco-design/web-react/icon'; import { IconUnorderedList } from '@arco-design/web-react/icon';
import ParamsTable from './ParamsTable'; import ParamsTable from './ParamsTable';

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors'; import { NodeEditorProps } from '@/components/FlowEditor/nodeEditors';
import { Typography } from '@arco-design/web-react'; import { Typography } from '@arco-design/web-react';
import { IconUnorderedList } from '@arco-design/web-react/icon'; import { IconUnorderedList } from '@arco-design/web-react/icon';
import ParamsTable from './ParamsTable'; import ParamsTable from './ParamsTable';

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors'; import { NodeEditorProps } from '@/components/FlowEditor/nodeEditors';
import { Typography } from '@arco-design/web-react'; import { Typography } from '@arco-design/web-react';
import { IconUnorderedList } from '@arco-design/web-react/icon'; import { IconUnorderedList } from '@arco-design/web-react/icon';
import ParamsTable from './ParamsTable'; import ParamsTable from './ParamsTable';

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors'; import { NodeEditorProps } from '@/components/FlowEditor/nodeEditors';
import { Typography } from '@arco-design/web-react'; import { Typography } from '@arco-design/web-react';
import { IconUnorderedList } from '@arco-design/web-react/icon'; import { IconUnorderedList } from '@arco-design/web-react/icon';
import ParamsTable from './ParamsTable'; import ParamsTable from './ParamsTable';

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors'; import { NodeEditorProps } from '@/components/FlowEditor/nodeEditors';
import { Typography } from '@arco-design/web-react'; import { Typography } from '@arco-design/web-react';
import { IconUnorderedList } from '@arco-design/web-react/icon'; import { IconUnorderedList } from '@arco-design/web-react/icon';
import ParamsTable from './ParamsTable'; import ParamsTable from './ParamsTable';

@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors'; import { NodeEditorProps } from '@/components/FlowEditor/nodeEditors';
import { Form, Input, Select } from '@arco-design/web-react'; import { Form, Input, Select } from '@arco-design/web-react';
const { Option } = Select; const { Option } = Select;

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import styles from '@/pages/flowEditor/node/style/base.module.less'; import styles from '@/components/FlowEditor/node/style/base.module.less';
import { Handle, Position, useStore } from '@xyflow/react'; import { Handle, Position, useStore } from '@xyflow/react';
import { isJSON } from '@/utils/common'; import { isJSON } from '@/utils/common';
import cronstrue from 'cronstrue/i18n'; import cronstrue from 'cronstrue/i18n';

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import styles from '@/pages/flowEditor/node/style/baseOther.module.less'; import styles from '@/components/FlowEditor/node/style/baseOther.module.less';
import { Handle, Position, useStore } from '@xyflow/react'; import { Handle, Position, useStore } from '@xyflow/react';
import { isJSON } from '@/utils/common'; import { isJSON } from '@/utils/common';
import cronstrue from 'cronstrue/i18n'; import cronstrue from 'cronstrue/i18n';

@ -1,7 +1,7 @@
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Node } from '@xyflow/react'; import { Node } from '@xyflow/react';
import { Drawer, ResizeBox } from '@arco-design/web-react'; import { Drawer, ResizeBox } from '@arco-design/web-react';
import { getNodeEditorByType } from '../nodeEditors'; import { getNodeEditorByType } from '@/components/FlowEditor/nodeEditors';
interface NodeData { interface NodeData {
type?: string; type?: string;

@ -19,11 +19,11 @@ import {
} from '@xyflow/react'; } from '@xyflow/react';
import '@xyflow/react/dist/style.css'; import '@xyflow/react/dist/style.css';
import { Button, Modal } from '@arco-design/web-react'; import { Button, Modal } from '@arco-design/web-react';
import { nodeTypeMap, nodeTypes, registerNodeType } from './node'; import { nodeTypeMap, nodeTypes, registerNodeType } from '@/components/FlowEditor/node';
import SideBar from './sideBar/sideBar'; import SideBar from './sideBar/sideBar';
import { convertFlowData } from '@/utils/convertFlowData'; import { convertFlowData } from '@/utils/convertFlowData';
import { exampleFlowData } from '@/pages/flowEditor/test/exampleFlowData'; import { exampleFlowData } from '@/pages/flowEditor/test/exampleFlowData';
import LocalNode from '@/pages/flowEditor/node/localNode/LocalNode'; import LocalNode from '@/components/FlowEditor/node/localNode/LocalNode';
import CustomEdge from './components/customEdge'; import CustomEdge from './components/customEdge';
import CustomConnectionLine from './components/customConnectionLine'; import CustomConnectionLine from './components/customConnectionLine';
import NodeContextMenu from './components/nodeContextMenu'; import NodeContextMenu from './components/nodeContextMenu';
@ -32,7 +32,7 @@ import PaneContextMenu from './components/paneContextMenu';
import NodeEditModal from './components/nodeEditModal'; import NodeEditModal from './components/nodeEditModal';
import AddNodeMenu from './components/addNodeMenu'; import AddNodeMenu from './components/addNodeMenu';
import ActionBar from './components/actionBar'; import ActionBar from './components/actionBar';
import { defaultNodeTypes } from '@/pages/flowEditor/node/types/defaultType'; import { defaultNodeTypes } from '@/components/FlowEditor/node/types/defaultType';
import { localNodeData } from '@/pages/flowEditor/sideBar/config/localNodeData'; import { localNodeData } from '@/pages/flowEditor/sideBar/config/localNodeData';
import { useAlignmentGuidelines } from '@/hooks/useAlignmentGuidelines'; import { useAlignmentGuidelines } from '@/hooks/useAlignmentGuidelines';

@ -1,15 +1,15 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import styles from '@/pages/scene/style/cover.module.less'; import styles from '@/pages/scene/style/cover.module.less';
import { Image, Modal, List } from '@arco-design/web-react'; import { Image, Modal, List } from '@arco-design/web-react';
import scene01 from '@/assets/images/scene01.jpg'; import scene01 from '@/public/assets/scene01.png';
import scene02 from '@/assets/images/scene02.jpg'; // import scene02 from '@/public/assets/scene02.jpg';
import scene03 from '@/assets/images/scene03.jpeg'; // import scene03 from '@/public/assets/scene03.png';
import scene04 from '@/assets/images/scene04.png'; import scene04 from '@/public/assets/scene04.png';
import scene07 from '@/assets/images/scene07.png'; import scene07 from '@/public/assets/scene07.png';
import scene08 from '@/assets/images/scene08.jpg'; // import scene08 from '@/public/assets/scene08.png';
import { getImageUrl } from '@/utils/pubUse'; import { getImageUrl } from '@/utils/pubUse';
const imageList = [scene01, scene02, scene03, scene04, scene07, scene08]; const imageList = [scene01, scene04, scene07];
interface CoverProps { interface CoverProps {
defaultImage?: string; defaultImage?: string;

@ -1,13 +1,13 @@
import scene01 from '@/assets/images/scene01.jpg'; import scene01 from '@/public/assets/scene01.png';
import scene02 from '@/assets/images/scene02.jpg'; // import scene02 from '@/public/assets/scene02.jpg';
import scene03 from '@/assets/images/scene03.jpeg'; // import scene03 from '@/public/assets/scene03.png';
import scene04 from '@/assets/images/scene04.png'; import scene04 from '@/public/assets/scene04.png';
import scene05 from '@/assets/images/scene05.jpg'; // import scene05 from '@/public/assets/scene05.png';
import scene06 from '@/assets/images/scene06.png'; import scene06 from '@/public/assets/scene06.png';
import scene07 from '@/assets/images/scene07.png'; import scene07 from '@/public/assets/scene07.png';
import scene08 from '@/assets/images/scene08.jpg'; // import scene08 from '@/public/assets/scene08.png';
const imageList: any[] = [scene01, scene02, scene03, scene04, scene05, scene06, scene07, scene08]; const imageList: any[] = [scene01, scene04, scene06, scene07];
// 获取assets静态资源 // 获取assets静态资源
export function getImageUrl(imageName: string) { export function getImageUrl(imageName: string) {

Loading…
Cancel
Save