import React, { useState, useCallback, useRef } from 'react'; import { Cpu, Settings, Anchor, ChevronUp, ChevronDown, Plus, Trash2, Image, Layers, FileText, ChevronRight, RotateCw, Target, Move } from 'lucide-react'; /** * Disassembly Edit/Preview Page * 融合 DisassemblyPages(视觉展示)与 DisassemblyLinkedProductsPage(交互编辑) * * 编辑模式:左侧属性面板 + 点击选中导航组件 + 支持新增/删除/修改名称/代码/图片 * 预览模式:与 DisassemblyPages v7.2.0 一致的工业草稿风格展示 */ const styles = ` @keyframes scanline { 0% { transform: translateY(-100%); } 100% { transform: translateY(100%); } } @keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } } @keyframes node-pulse-kf { 0% { box-shadow: 0 0 0 0px rgba(234, 179, 8, 0.5); } 100% { box-shadow: 0 0 0 10px rgba(234, 179, 8, 0); } } .blueprint-grid { background-color: #ffffff; background-image: linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px); background-size: 30px 30px; } .blueprint-grid::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px); background-size: 10px 10px; pointer-events: none; } .assembly-view { filter: drop-shadow(0 15px 30px rgba(0,0,0,0.1)) contrast(1.05); transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1); } .assembly-view:hover { filter: drop-shadow(0 20px 40px rgba(0,0,0,0.15)) contrast(1.1); } .leader-line-svg { transition: stroke 0.4s ease, stroke-width 0.4s ease; } .text-label-container { transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1); } .scan-effect { position: absolute; top: 0; left: 0; right: 0; height: 100%; background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.01), transparent); animation: scanline 15s linear infinite; pointer-events: none; } .node-selected { animation: node-pulse-kf 2s infinite; outline: 2px solid #eab308; outline-offset: 4px; } .custom-scrollbar::-webkit-scrollbar { width: 4px; } .custom-scrollbar::-webkit-scrollbar-thumb { background: #000; border-radius: 10px; } .part-hover { transition: all 0.35s cubic-bezier(0.23, 1, 0.32, 1); } `; const DEFAULT_PARTS = [ { id: 'p1', name: '环境监控', code: 'ENV-X', img: 'https://images.unsplash.com/photo-1555680202-c86f0e12f086?auto=format&fit=crop&q=80&w=200' }, { id: 'p2', name: '能源模组', code: 'BATT-V8', img: 'https://images.unsplash.com/photo-1619641259501-c88f28c6e355?auto=format&fit=crop&q=80&w=200' }, { id: 'p3', name: '雷达阵列', code: 'LDR-07', img: 'https://images.unsplash.com/photo-1555680202-c86f0e12f086?auto=format&fit=crop&q=80&w=200' }, { id: 'p4', name: '核心总成', code: 'CORE-MAX', img: 'https://images.unsplash.com/photo-1518770660439-4636190af475?auto=format&fit=crop&q=80&w=200' }, { id: 'p5', name: '液压单元', code: 'HYD-02', img: 'https://images.unsplash.com/photo-1635350736475-c8cef4b21906?auto=format&fit=crop&q=80&w=200' }, { id: 'p6', name: '散热单元', code: 'COOL-F2', img: 'https://images.unsplash.com/photo-1635350736475-c8cef4b21906?auto=format&fit=crop&q=80&w=200' }, { id: 'p7', name: '存储阵列', code: 'DATA-2T', img: 'https://images.unsplash.com/photo-1544006659-f0b21f04cb1d?auto=format&fit=crop&q=80&w=200' }, ]; const DEFAULT_ASSEMBLY = 'https://images.unsplash.com/photo-1581092160562-40aa08e78837?auto=format&fit=crop&q=80&w=1600'; const ICON_SIZE = 80; const CENTER_AXIS_Y = 180; const OFFSET_Y = 40; // ─── 单个组件节点(共用于编辑 & 预览)───────────────────────────────────── function PartNode({ part, index, isHovered, isSelected, isEditMode, onHover, onClick }) { const isUp = index % 2 === 0; const boxTop = isUp ? CENTER_AXIS_Y - OFFSET_Y : CENTER_AXIS_Y + OFFSET_Y; const SVG_CENTER_X = 50; const SVG_CENTER_Y = 40; const lineColor = isSelected ? '#eab308' : isHovered ? '#000' : '#f5f5f5'; const lineWidth = isSelected ? '2.5' : isHovered ? '2.5' : '1'; return (
EDIT_PREVIEW_v1.0.0 // VISUAL_ENHANCED