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

View File

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