import { ReactNode } from 'react'; import { ButtonProps } from '../Button'; import { PopoverProps } from '../Popover'; /** * @title PopInput */ export interface PopInputProps { /** * @zh 点击确认后回调,参数为当前输入框文本 * @en Callback when confirm is clicked, receives the current textarea value */ onSubmit: (value: string) => void; /** * @zh 触发按钮文案 * @en Text of the trigger button */ buttonText?: string; /** * @zh 触发按钮参数,会与默认配置(含 `IconEdit`)合并;传入字段可覆盖对应默认值 * @en Props for the trigger button, merged with defaults (including `IconEdit`); passed fields override defaults */ buttonProps?: ButtonProps; /** * @zh 气泡层参数,可传入 `Popover` 的全部属性,例如 `position`、`getPopupContainer`、`style` * @en Props passed to `Popover`, e.g. `position`, `getPopupContainer`, `style` */ popoverProps?: PopoverProps; /** * @zh 输入框为空时,在输入区域上展示的自定义占位内容(React 节点,非原生 placeholder) * @en Custom empty-state overlay shown when the value is empty (React node, not the native placeholder) */ placeholder?: ReactNode; /** * @zh 文本域行数 * @en Number of rows of the textarea * @defaultValue 10 */ rows?: number; /** * @zh 最大输入长度;设置后会显示字数统计 * @en Max length; when set, a character counter is shown */ maxLength?: number; /** * @zh 输入值(受控),等价于内部 `Input.TextArea` 的 `value` * @en Controlled input value, equivalent to `Input.TextArea` `value` */ inputValue?: string; /** * @zh 非受控初始值;每次**非受控**模式下打开弹层时会重置为该值。受控模式(传入 `inputValue`)下打开弹层不会自动重置,需由父组件自行处理 * @en Default value in uncontrolled mode; reset to this when the popup opens. In controlled mode (`inputValue` is set), opening does not reset—handle in the parent if needed * @defaultValue */ defaultValue?: string; /** * @zh 输入值变化回调(受控时必用) * @en Called when the input value changes; use with `inputValue` for controlled mode */ onInputValueChange?: (value: string) => void; /** * @zh 点击弹层外部等区域时是否自动关闭弹层。为 `false` 时仅能通过内部「取消」「确定」或再次点击触发按钮关闭 * @en Whether clicking outside closes the popup. When `false`, close only via inner actions or clicking the trigger again * @defaultValue true */ autoClose?: boolean; /** * @zh 是否禁用:禁用触发按钮且无法打开弹层 * @en Whether disabled: disables the trigger and prevents opening the popup * @defaultValue false */ disabled?: boolean; /** * @zh 打开弹层后是否自动聚焦文本域,并将光标置于文本末尾 * @en Whether to focus the textarea when opened, with caret at end of text * @defaultValue true */ autoFocus?: boolean; /** * @zh 文本域原生 `placeholder` 属性(字符串) * @en Native `placeholder` on the textarea */ inputPlaceholder?: string; /** * @zh 弹层显隐变化回调 * @en Callback when popup visibility changes */ onVisibleChange?: (visible: boolean) => void; }