import { Show, For } from 'solid-js'; import type { CardData, LayerConfig } from './types'; import { FieldEditor, PropertyForm } from './FieldEditor'; import type { FieldSchema } from './hooks/types'; export interface DataEditorPanelProps { cards: CardData[]; activeTab: number; updateCardData: (key: string, value: string) => void; } export interface PropertiesEditorPanelProps { localSize: string; localGrid: string; localBleed: string; localPadding: string; layerConfigs: LayerConfig[]; editingLayer: string | null; onSizeChange: (value: string) => void; onGridChange: (value: string) => void; onBleedChange: (value: string) => void; onPaddingChange: (value: string) => void; onToggleLayerVisible: (prop: string) => void; onStartEditingLayer: (prop: string) => void; onCopyCode: () => void; } /** * 为 CardData 创建 Schema */ function createCardDataSchema(keys: string[]): FieldSchema[] { return keys.map((key) => ({ key, label: key.charAt(0).toUpperCase() + key.slice(1), type: 'text', rows: 3 })); } /** * 左侧:CSV 数据编辑面板 * 使用通用 FieldEditor 组件渲染 */ export function DataEditorPanel(props: DataEditorPanelProps) { const currentCard = () => props.cards[props.activeTab] || {}; const fieldKeys = () => Object.keys(currentCard()); const schema = () => ({ fields: createCardDataSchema(fieldKeys()) }); const handleChange = (key: string, value: string | number | boolean) => { props.updateCardData(key, String(value)); }; return (

卡牌数据

); } /** * 右侧:卡牌属性编辑面板 */ export function PropertiesEditorPanel(props: PropertiesEditorPanelProps) { return (

卡牌属性

props.onSizeChange(e.target.value)} />
props.onGridChange(e.target.value)} />
props.onBleedChange(e.target.value)} />
props.onPaddingChange(e.target.value)} />

图层

{(layer) => (
props.onToggleLayerVisible(layer.prop)} class="cursor-pointer" /> {layer.prop}
)}

); }