Files
Genarrative/src/components/image-editor/ImageCanvasGenerationAssetNameField.tsx
T
kdletters ed8be38287 统一画布生成资源命名
新增所有生成面板的资源名称输入并统一80字符边界
贯通画布标题、项目资源、素材库与生成请求的名称传播
为图标图集和角色动作补齐命名契约及中间产物后缀
补充前后端回归测试、OpenAPI与编辑器文档
2026-07-14 10:27:25 +08:00

47 lines
1.4 KiB
TypeScript

import { PlatformFieldLabel } from '../common/PlatformFieldLabel';
import { PlatformTextField } from '../common/PlatformTextField';
import { EDITOR_GENERATED_ASSET_LABEL_MAX_CHARS } from './ImageCanvasGenerationSubmissionModel';
export const IMAGE_CANVAS_GENERATION_ASSET_NAME_MAX_LENGTH =
EDITOR_GENERATED_ASSET_LABEL_MAX_CHARS;
type ImageCanvasGenerationAssetNameFieldProps = {
value?: string | null;
disabled?: boolean;
onChange: (value: string) => void;
};
export function ImageCanvasGenerationAssetNameField({
value,
disabled = false,
onChange,
}: ImageCanvasGenerationAssetNameFieldProps) {
return (
<label className="image-canvas-editor__generation-asset-name-field">
<PlatformFieldLabel
variant="form"
className="image-canvas-editor__field-title"
>
资源名称
</PlatformFieldLabel>
<PlatformTextField
aria-label="资源名称"
value={value ?? ''}
maxLength={IMAGE_CANVAS_GENERATION_ASSET_NAME_MAX_LENGTH}
disabled={disabled}
placeholder="例如:勇者立绘"
size="sm"
density="compact"
className="image-canvas-editor__generation-asset-name-input"
onChange={(event) =>
onChange(
Array.from(event.target.value)
.slice(0, IMAGE_CANVAS_GENERATION_ASSET_NAME_MAX_LENGTH)
.join(''),
)
}
/>
</label>
);
}