Files
monkey-ai-web/src/components/creation/params/ParamTextArea.jsx
T
qiubaishen d46926f334 refactor(ui): 将合并引入的 Semi 组件迁移到 Ant Design 适配层
- 创作台、WeyAi 设置、OrgResolver 共 23 个文件改从 @/components/ui 引入
- Popover 改用 open/trigger='click'/onOpenChange,移除 .semi-portal 判定
- Dropdown.Title / Item active 改为 menu group / selectedKeys
- Slider tooltip.formatter、Checkbox.Group、TagInput maxCount、DatePicker 取 Date 参数
- --semi-color-* 改为 --ui-color-*,遮罩色用 antd 默认,.semi-* 选择器改为 .ant-*
- docs/UI_MIGRATION.md 记录组件映射、视觉差异与风险
2026-11-10 12:48:02 +08:00

57 lines
1.9 KiB
React
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import React from 'react';
import { TextArea, Tooltip } from '@/components/ui';
import { useTranslation } from 'react-i18next';
import { paramLabel } from './labels';
import './creation-params.css';
/**
* 多行文本(schema type = 'textarea'),如反向提示词。
* props: { param, value, onChange(string), disabledReason? };param.max_length 限制字数。
*/
const ParamTextArea = ({ param, value, onChange, disabledReason }) => {
const { t } = useTranslation();
const max =
Number(param?.max_length) > 0 ? Number(param.max_length) : undefined;
const area = (
<TextArea
className='cp-textarea app-scrollbar'
value={value ?? ''}
onChange={(v) => onChange && onChange(v)}
maxCount={max}
maxLength={max}
autosize={{ minRows: 2, maxRows: 5 }}
disabled={Boolean(disabledReason)}
aria-label={paramLabel(t, param)}
placeholder={param?.placeholder ? t(param.placeholder) : ''}
/>
);
return disabledReason ? (
<Tooltip content={disabledReason} position='top'>
<span className='cp-inline-trigger cp-inline-trigger--block'>{area}</span>
</Tooltip>
) : (
area
);
};
export default ParamTextArea;