/** * @ant-design/x 类型本地声明 * 从 @ant-design/x 源码提取的公共 API 类型,减少外部依赖 */ import type React from 'react'; import type { UploadFile, MenuProps } from 'antd'; export interface ConversationItemType extends Omit, 'onClick'> { key: string; label?: React.ReactNode; group?: string; icon?: React.ReactNode; disabled?: boolean; [key: string]: any; } export interface DividerItemType { type: 'divider'; key?: string; dashed?: boolean; } export type ItemType = ConversationItemType | DividerItemType; type ConversationsSemanticType = 'root' | 'creation' | 'group' | 'item'; export interface ConversationsProps extends React.HTMLAttributes { items?: ItemType[]; activeKey?: ConversationItemType['key']; defaultActiveKey?: ConversationItemType['key']; onActiveChange?: (value: ConversationItemType['key'], item?: ItemType) => void; menu?: (MenuProps & { trigger?: React.ReactNode | ((conversation: ConversationItemType, info: { originNode: React.ReactNode; }) => React.ReactNode); getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement; }) | ((value: ConversationItemType) => MenuProps & { trigger?: React.ReactNode | ((conversation: ConversationItemType, info: { originNode: React.ReactNode; }) => React.ReactNode); getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement; }); groupable?: boolean | Record; styles?: Partial>; classNames?: Partial>; prefixCls?: string; rootClassName?: string; } type TextareaProps = React.ComponentProps; type SubmitType = 'enter' | 'shiftEnter'; type SenderSemanticType = 'root' | 'prefix' | 'input' | 'suffix' | 'footer' | 'switch' | 'content'; export interface SenderComponents { input?: React.ComponentType; } export type ActionsComponents = { SendButton: React.ComponentType; ClearButton: React.ComponentType; LoadingButton: React.ComponentType; SpeechButton: React.ComponentType; }; export type BaseNode = React.ReactNode | false; export type NodeRender = (oriNode: React.ReactNode, info: { components: ActionsComponents; }) => BaseNode; export interface SenderProps extends Partial> { prefixCls?: string; defaultValue?: string; value?: string; loading?: boolean; readOnly?: boolean; submitType?: SubmitType; disabled?: boolean; onSubmit?: (message: string, ...args: any[]) => void; onChange?: (value: string, ...args: any[]) => void; onCancel?: VoidFunction; onKeyDown?: (event: React.KeyboardEvent) => void | false; onPaste?: React.ClipboardEventHandler; onPasteFile?: (files: FileList) => void; components?: SenderComponents; classNames?: Partial>; styles?: Partial>; rootClassName?: string; style?: React.CSSProperties; className?: string; allowSpeech?: any; prefix?: BaseNode | NodeRender; footer?: BaseNode | NodeRender; suffix?: BaseNode | NodeRender; header?: BaseNode | NodeRender; autoSize?: boolean | { minRows?: number; maxRows?: number; }; slotConfig?: Readonly; skill?: any; } export interface BasePromptsItemType { key: string; icon?: React.ReactNode; label?: React.ReactNode; description?: React.ReactNode; disabled?: boolean; } export interface PromptsItemType extends BasePromptsItemType { children?: BasePromptsItemType[]; } type PromptsSemanticType = 'root' | 'list' | 'item' | 'itemContent' | 'title' | 'subList' | 'subItem'; export interface PromptsProps extends Omit, 'onClick' | 'title'> { items?: PromptsItemType[]; title?: React.ReactNode; onClick?: (info: { data: PromptsItemType; }) => void; styles?: Partial>; classNames?: Partial>; prefixCls?: string; rootClassName?: string; vertical?: boolean; wrap?: boolean; } export interface Attachment extends UploadFile { description?: React.ReactNode; cardType?: 'audio' | 'video' | 'image' | 'file'; } export interface AttachmentsRef { nativeElement?: HTMLDivElement | null; fileNativeElement?: HTMLInputElement | null; upload: (file: File) => void; select: (options?: { accept?: string; multiple?: boolean; }) => void; } type ThinkSemanticType = 'root' | 'header' | 'content' | 'icon'; export interface ThinkProps extends Omit, 'title'> { prefixCls?: string; style?: React.CSSProperties; styles?: Partial>; className?: string; classNames?: Partial>; rootClassName?: string; title?: React.ReactNode; icon?: React.ReactNode; loading?: boolean | React.ReactNode; defaultExpanded?: boolean; expanded?: boolean; onExpand?: (expand: boolean) => void; blink?: boolean; destroyOnHidden?: boolean; } export {};