This commit is contained in:
asp_ly 2024-12-13 21:15:56 +08:00
parent fe58ec3759
commit 5c88430ebc
3 changed files with 12 additions and 11 deletions

View File

@ -53,7 +53,8 @@ const categoryConfig: Record<NodeCategory, {
};
interface NodePanelProps {
onNodeDragStart?: (node: NodeDefinition, e: React.DragEvent) => void;
onNodeDragStart?: (node: NodeDefinition, e: React.DragEvent) => void,
nodeDefinitions?: NodeDefinition[]
}
const NodePanel: React.FC<NodePanelProps> = ({onNodeDragStart}) => {
@ -99,14 +100,14 @@ const NodePanel: React.FC<NodePanelProps> = ({onNodeDragStart}) => {
const iconName = node.graphConfig.uiSchema.style.icon;
// 首先尝试使用配置的图标
let IconComponent = iconMap[iconName];
// 如果没有找到对应的图标,使用节点类型对应的默认图标
if (!IconComponent) {
IconComponent = typeIconMap[node.type] || AppstoreOutlined;
}
return (
<IconComponent
<IconComponent
style={{
color: node.graphConfig.uiSchema.style.iconColor || '#1890ff',
fontSize: '16px',
@ -124,7 +125,7 @@ const NodePanel: React.FC<NodePanelProps> = ({onNodeDragStart}) => {
cursor: 'move',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
justifyContent: 'center',
gap: '10px',
background: node.graphConfig.uiSchema.style.fill,
transition: 'all 0.3s',
@ -146,7 +147,7 @@ const NodePanel: React.FC<NodePanelProps> = ({onNodeDragStart}) => {
// 构建折叠面板的 items
const collapseItems = Object.entries(categoryConfig).map(([category, {label, key}]) => ({
key,
label: <span style={{ fontSize: '14px', fontWeight: 500 }}>{label}</span>,
label: <span style={{fontSize: '14px', fontWeight: 500}}>{label}</span>,
children: (
<div style={{
display: 'flex',
@ -159,10 +160,10 @@ const NodePanel: React.FC<NodePanelProps> = ({onNodeDragStart}) => {
key={node.id}
title={
<div>
<div style={{ fontSize: '14px', fontWeight: 500 }}>{node.description}</div>
<div style={{ marginTop: 12 }}>
<div style={{ fontSize: '13px', color: '#8c8c8c' }}></div>
<ul style={{
<div style={{fontSize: '14px', fontWeight: 500}}>{node.description}</div>
<div style={{marginTop: 12}}>
<div style={{fontSize: '13px', color: '#8c8c8c'}}></div>
<ul style={{
paddingLeft: 16,
margin: '8px 0',
fontSize: '13px',
@ -192,7 +193,7 @@ const NodePanel: React.FC<NodePanelProps> = ({onNodeDragStart}) => {
gap: '6px'
}}>
{renderNodeIcon(node)}
<span style={{
<span style={{
fontSize: '13px',
color: '#262626',
overflow: 'hidden',

View File

@ -5,7 +5,7 @@ import {useNavigate} from 'react-router-dom';
import * as service from './service';
import type {WorkflowDefinition, WorkflowDefinitionQuery} from './types';
import {DEFAULT_PAGE_SIZE, DEFAULT_CURRENT} from '@/utils/page';
import EditModal from './components/Edit';
import EditModal from './components/EditModal';
const {confirm} = Modal;