From ea10b27c14b507c86a1523400ac26e7595c539a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=A8=E9=9C=96=E9=93=83?= Date: Sat, 6 Jun 2026 10:35:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=AE=80=E5=8C=96=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=8D=A1=E7=89=87=E4=BA=A4=E4=BA=92=20-=20=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E6=89=93=E5=BC=80=E7=BC=96=E8=BE=91=E5=BC=B9?= =?UTF-8?q?=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除字段卡片选中样式 - 点击字段直接打开编辑弹窗 - 简化 FieldItem 组件,移除 isSelected 属性 - 简化 FieldList 接口,onSelect 改为 onEdit fix: 优化字段编辑弹窗 - 去除弹窗描述文字 - 字段名称增加字符计数 (x/20) - 字段描述增加字符计数 (x/50) - 保持 placeholder 提示 fix: 修复弹窗顶部间距问题 - DialogContent 添加 pt-6 避开关闭按钮 - 内容区域移除顶部 padding,改为 pb-6 fix: 增加弹窗顶部间距 (pt-6 → pt-8) fix: 优化弹窗尺寸和按钮间距 - 弹窗最大宽度 360→420px 适配标签页 - 增加按钮 padding (px-2→px-3, py-1→py-1.5) - 添加按钮增加 padding (h-8→h-9, px-3) --- .../components/FieldEditor.tsx | 22 +++++++---- .../components/FieldItem.tsx | 9 +---- .../components/FieldList.tsx | 38 ++++++------------- src/pages/TestDataGenerator/index.tsx | 12 ++---- 4 files changed, 32 insertions(+), 49 deletions(-) diff --git a/src/pages/TestDataGenerator/components/FieldEditor.tsx b/src/pages/TestDataGenerator/components/FieldEditor.tsx index 76f2baa..e074ba0 100644 --- a/src/pages/TestDataGenerator/components/FieldEditor.tsx +++ b/src/pages/TestDataGenerator/components/FieldEditor.tsx @@ -73,9 +73,12 @@ export default function FieldEditor({ field, onChange }: FieldEditorProps) { {/* 基础配置 */}
- +
+ + {field.name.length}/20 +
handleNameChange(e.target.value)} @@ -86,9 +89,14 @@ export default function FieldEditor({ field, onChange }: FieldEditorProps) {
- +
+ + + {(field.description || '').length}/50 + +
handleDescriptionChange(e.target.value)} @@ -132,7 +140,7 @@ export default function FieldEditor({ field, onChange }: FieldEditorProps) {
- +
@@ -300,8 +285,7 @@ export default function FieldList({ handleToggleSelect(index)} + onEdit={() => onEdit(index)} onRemove={() => onRemove(index)} /> ))} @@ -317,7 +301,7 @@ export default function FieldList({
- {}} /> + {}} />
diff --git a/src/pages/TestDataGenerator/index.tsx b/src/pages/TestDataGenerator/index.tsx index 18f2da8..8474cde 100644 --- a/src/pages/TestDataGenerator/index.tsx +++ b/src/pages/TestDataGenerator/index.tsx @@ -9,7 +9,7 @@ import { cn } from '@/lib/utils'; import { useGenerator } from './hooks/useGenerator'; import { getGeneratorById } from '@/lib/generators'; import type { FieldConfig, GenerateResult } from '@/types/testDataGenerator'; -import { Dialog, DialogContent, DialogHeader, DialogDescription } from '@/components/ui/dialog'; +import { Dialog, DialogContent } from '@/components/ui/dialog'; // 生成唯一 ID 的辅助函数 function generateId(): string { @@ -227,8 +227,7 @@ export default function TestDataGeneratorPage() { onUpdate={handleUpdateField} onRemove={handleRemoveField} onAdd={handleAddField} - onSelect={handleOpenEditor} - selectedIndex={selectedIndex} + onEdit={handleOpenEditor} onReorder={handleReorder} /> @@ -303,11 +302,8 @@ export default function TestDataGeneratorPage() { {/* 字段编辑弹窗 */} - - - {t('testDataGenerator_selectFieldToEdit')} - -
+ +
{selectedField && selectedIndex !== null && (