fix(experience-center): 统一图像与视频生成界面并修复参数显示
对齐表单、预览与任务区,跟随系统主题色,修复图片尺寸选择和视频高级参数显示。已通过本地浏览器验收、Lint、UI 审计和单测;未做生产测试。
This commit is contained in:
@@ -15,6 +15,20 @@ import {
|
||||
|
||||
const CUSTOM = '__custom__';
|
||||
|
||||
const formatPreset = ({ width, height, label }) => {
|
||||
const dimensions = `${width}×${height}`;
|
||||
const caption = label
|
||||
.replace(/\s*[((]\s*\d+\s*[x×]\s*\d+\s*[))]\s*$/i, '')
|
||||
.trim();
|
||||
return {
|
||||
dimensions,
|
||||
caption:
|
||||
caption.toLowerCase().replace(/\s/g, '').replace('x', '×') === dimensions
|
||||
? ''
|
||||
: caption,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* 图像尺寸(schema type = 'size'):预设按宽高比图标展示;仅当 schema 下发 custom_size 时
|
||||
* 提供"自定义",宽高输入框失焦 / 回车时按 min / max / step 吸附。
|
||||
@@ -83,7 +97,9 @@ const ImageSizePicker = ({ param, value, onChange }) => {
|
||||
getOptionAriaLabel={(opt) => {
|
||||
if (opt === CUSTOM) return t('自定义尺寸');
|
||||
const p = presets.find((x) => x.value === opt);
|
||||
return p ? `${p.label || ''} ${p.width}×${p.height}`.trim() : opt;
|
||||
if (!p) return opt;
|
||||
const { caption, dimensions } = formatPreset(p);
|
||||
return caption ? `${caption} ${dimensions}` : dimensions;
|
||||
}}
|
||||
renderOption={(opt) => {
|
||||
if (opt === CUSTOM) {
|
||||
@@ -97,16 +113,16 @@ const ImageSizePicker = ({ param, value, onChange }) => {
|
||||
);
|
||||
}
|
||||
const p = presets.find((x) => x.value === opt);
|
||||
if (!p) return opt;
|
||||
const { caption, dimensions } = formatPreset(p);
|
||||
return (
|
||||
<>
|
||||
<RatioShape ratio={`${p.width}:${p.height}`} />
|
||||
<span className='cp-option-label tabular-nums'>
|
||||
{p.label || `${p.width}×${p.height}`}
|
||||
{caption || dimensions}
|
||||
</span>
|
||||
{p.label ? (
|
||||
<span className='igf-size-dims tabular-nums'>
|
||||
{p.width}×{p.height}
|
||||
</span>
|
||||
{caption ? (
|
||||
<span className='igf-size-dims tabular-nums'>{dimensions}</span>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user