- 新建 useUI/ 目录:12 个文件,10 个 Qt 控件 → antd 组件封装 + 类型 + 注册表 - 新建 useModelUI Hook:param_schema → UIFieldConfig[] 自动映射 - ModelInputForm 瘦身 ~160 行:删除 buildParamDescriptors/renderParamControl/文件状态管理 - WIDGET_MAP: Record<string, ComponentType<WidgetProps>> — 零 any,完全类型安全 - 新增控件只需两步:创建组件文件 + 在 WIDGET_MAP 加一行 - 删除旧 widgets/ 目录 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
24 lines
776 B
TypeScript
24 lines
776 B
TypeScript
// ============================================================
|
|
// TextInput — textEdit → Input.TextArea
|
|
// 用于提示词、文本合成等长文本输入场景
|
|
// ============================================================
|
|
|
|
import { Input } from 'antd';
|
|
import type { WidgetProps } from './types';
|
|
|
|
const { TextArea } = Input;
|
|
|
|
export function TextInput({ value, onChange, disabled, config }: WidgetProps) {
|
|
return (
|
|
<TextArea
|
|
rows={4}
|
|
value={value as string}
|
|
onChange={(e) => onChange?.(e.target.value)}
|
|
disabled={disabled}
|
|
placeholder={(config.placeholder as string) || '请输入'}
|
|
maxLength={config.maxLength as number | undefined}
|
|
showCount={config.maxLength !== undefined}
|
|
/>
|
|
);
|
|
}
|