import { TdAttachmentsProps } from '../attachments'; import { ChatRequestParams } from '../chat-engine'; import { TNode } from '../common'; import { TdAttachmentItem } from '../filecard'; import { TdTextareaProps } from '../textarea'; export type TdChatSenderActionName = 'attachment' | 'send'; export interface TdChatSenderAction { name: string; render: TNode; } export interface TdChatSenderParams { value: string; attachments?: TdAttachmentItem[]; } export interface TdChatSenderProps extends Pick { value?: string; placeholder?: string; disabled?: boolean; defaultValue?: string; actions?: TdChatSenderActionName[] | ((preset: TdChatSenderAction[]) => TdChatSenderAction[]) | boolean; /** 是否加载中 */ loading?: boolean; /** 透传attachment参数 */ attachmentsProps?: TdAttachmentsProps; /** 透传textarea参数 */ textareaProps?: Partial>; /** 透传input-file参数 */ uploadProps?: Omit; onSend?: (e: CustomEvent) => ChatRequestParams | void; onStop?: (e: CustomEvent) => void; onChange?: (e: CustomEvent) => void; onFileSelect?: (e: CustomEvent) => void; onFileRemove?: (e: CustomEvent) => void; onFocus?: (e: CustomEvent) => void; onBlur?: (e: CustomEvent) => void; } export interface TdChatSenderApi { /** 获取焦点 */ focus: (opts?: FocusOptions) => void; /** 取消焦点 */ blur: () => void; }