|
|
|
@ -2,6 +2,60 @@ 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 NodeContent from '@/pages/flowEditor/components/nodeContent';
|
|
|
|
import NodeContent from '@/pages/flowEditor/components/nodeContent';
|
|
|
|
|
|
|
|
import DynamicIcon from '@/components/DynamicIcon';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const setIcon = (nodeType: string) => {
|
|
|
|
|
|
|
|
let type = 'IconApps';
|
|
|
|
|
|
|
|
switch (nodeType) {
|
|
|
|
|
|
|
|
case 'CONDITION':
|
|
|
|
|
|
|
|
type = 'IconBranch';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'AND':
|
|
|
|
|
|
|
|
type = 'IconShareAlt';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'OR':
|
|
|
|
|
|
|
|
type = 'IconPause';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'WAIT':
|
|
|
|
|
|
|
|
type = 'IconClockCircle';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'LOOP':
|
|
|
|
|
|
|
|
type = 'IconSync';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'CYCLE':
|
|
|
|
|
|
|
|
type = 'IconSchedule';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'EVENTLISTENE':
|
|
|
|
|
|
|
|
type = 'IconImport';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'EVENTSEND':
|
|
|
|
|
|
|
|
type = 'IconExport';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'JSON2STR':
|
|
|
|
|
|
|
|
type = 'IconCodeBlock';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'STR2JSON':
|
|
|
|
|
|
|
|
type = 'IconCodeSquare';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'JSONCONVERT':
|
|
|
|
|
|
|
|
type = 'IconTranslate';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'RESULT':
|
|
|
|
|
|
|
|
type = 'IconInteraction';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'IMAGE':
|
|
|
|
|
|
|
|
type = 'IconImage';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'CODE':
|
|
|
|
|
|
|
|
type = 'IconCode';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'REST':
|
|
|
|
|
|
|
|
type = 'IconCloudDownload';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return <DynamicIcon type={type} style={{ fontSize: '16px', marginRight: '5px' }} />;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const LocalNode = ({ data, id }: { data: any; id: string }) => {
|
|
|
|
const LocalNode = ({ data, id }: { data: any; id: string }) => {
|
|
|
|
const title = data.title || '系统组件';
|
|
|
|
const title = data.title || '系统组件';
|
|
|
|
@ -14,9 +68,9 @@ const LocalNode = ({ data, id }: { data: any; id: string }) => {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className={`${styles['node-container']} ${isSelected ? styles.selected : ''}`}>
|
|
|
|
<div className={`${styles['node-container']} ${isSelected ? styles.selected : ''}`}>
|
|
|
|
<div className={styles['node-header']} style={{ backgroundColor: '#1890ff' }}>
|
|
|
|
<div className={styles['node-header']} style={{ backgroundColor: '#1890ff' }}>
|
|
|
|
|
|
|
|
{setIcon(data.type)}
|
|
|
|
{title}
|
|
|
|
{title}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<NodeContent data={data} />
|
|
|
|
<NodeContent data={data} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|