import type { Node } from "@xyflow/react"; import { NODE_KINDS } from "./nodeCatalog"; // 右检查器:按选中节点的类型渲染配置表单;空选时显示图级提示。 export function Inspector({ node, onChange, onDelete, }: { node: Node | null; onChange: (id: string, patch: Record) => void; onDelete: (id: string) => void; }) { if (!node) { return (
选中一个节点查看/编辑配置。
从左侧面板添加节点,拖动连线编排。
); } const data = node.data as { kind: string; label?: string; config?: Record }; const k = NODE_KINDS[data.kind] ?? NODE_KINDS.output; const config = data.config ?? {}; const setConfig = (key: string, value: unknown) => onChange(node.id, { config: { ...config, [key]: value } }); return (
{k.label}
{k.fields.map((f) => { const v = config[f.key]; return (