refactor: 中间栏三层架构 — useUI 组件体系 + useModelUI Hook
- 新建 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>
This commit is contained in:
22
src/pages/home/components/useUI/SpinBox.tsx
Normal file
22
src/pages/home/components/useUI/SpinBox.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
// ============================================================
|
||||
// SpinBox — spinBox → InputNumber (step=1)
|
||||
// 用于整数输入:混沌、风格化、怪异、时长、音调等
|
||||
// ============================================================
|
||||
|
||||
import { InputNumber } from 'antd';
|
||||
import type { WidgetProps } from './types';
|
||||
|
||||
export function SpinBox({ value, onChange, disabled, config }: WidgetProps) {
|
||||
return (
|
||||
<InputNumber
|
||||
value={value as number}
|
||||
onChange={(v) => onChange?.(v != null ? v : undefined)}
|
||||
disabled={disabled}
|
||||
min={config.minValue as number | undefined}
|
||||
max={config.maxValue as number | undefined}
|
||||
step={1}
|
||||
style={{ width: '100%' }}
|
||||
placeholder={(config.placeholder as string) || undefined}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user