import React from 'react'; import { Box, Typography, Paper, List, ListItem, ListItemText, ListItemIcon, Collapse, Chip, } from '@mui/material'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import ExpandLessIcon from '@mui/icons-material/ExpandLess'; import InputIcon from '@mui/icons-material/Input'; // 字段数据接口 interface FieldData { id: string; fieldType: string; label: string | null; placeholder: string; name: string; value: string; isSelected: boolean; generatedValue: string; } // 字段类型显示名称映射 const FIELD_TYPE_NAMES: Record = { text: '文本', email: '邮箱', phone: '手机号', number: '数字', date: '日期', textarea: '文本域', radio: '单选框', checkbox: '复选框', select: '下拉框', password: '密码', name: '姓名', id_card: '身份证号', unknown: '未知', }; // 字段类型颜色映射 const FIELD_TYPE_COLORS: Record< string, 'default' | 'primary' | 'secondary' | 'error' | 'success' | 'warning' > = { email: 'primary', phone: 'success', number: 'secondary', date: 'warning', password: 'error', name: 'primary', id_card: 'secondary', text: 'default', textarea: 'default', unknown: 'default', }; interface FieldListProps { fields: FieldData[]; showFields: boolean; onToggleShowFields: () => void; } const FieldList: React.FC = ({ fields, showFields, onToggleShowFields }) => { if (fields.length === 0) return null; return ( 已识别字段 ({fields.length}) {showFields ? : } {fields.map((field, index) => ( {field.label || field.name || field.placeholder || `字段 ${index + 1}`} } secondary={field.placeholder || field.name} /> ))} ); }; export default FieldList;