UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

1 lines 2.47 kB
{"version":3,"file":"ChatList.mjs","names":["HistoryDivider","ChatListItem"],"sources":["../../../src/chat/ChatList/ChatList.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { Fragment, memo } from 'react';\n\nimport ChatListItem from './components/ChatListItem';\nimport HistoryDivider from './components/HistoryDivider';\nimport { styles } from './style';\nimport type { ChatListProps } from './type';\n\nconst ChatList = memo<ChatListProps>(\n ({\n onActionsClick,\n onAvatarsClick,\n renderMessagesExtra,\n className,\n data,\n variant = 'bubble',\n text,\n showTitle,\n onMessageChange,\n renderMessages,\n renderErrorMessages,\n loadingId,\n renderItems,\n enableHistoryCount,\n renderActions,\n historyCount = 0,\n showAvatar,\n ...rest\n }) => {\n return (\n <div className={cx(styles.container, className)} {...rest}>\n {data.map((item, index) => {\n const itemProps = {\n loading: loadingId === item.id,\n onActionsClick,\n onAvatarsClick,\n onMessageChange,\n renderActions,\n renderErrorMessages,\n renderItems,\n renderMessages,\n renderMessagesExtra,\n showAvatar,\n showTitle,\n text,\n variant,\n };\n\n const historyLength = data.length;\n const enableHistoryDivider =\n enableHistoryCount &&\n historyLength > historyCount &&\n historyCount === historyLength - index + 1;\n\n return (\n <Fragment key={item.id}>\n <HistoryDivider enable={enableHistoryDivider} text={text?.history} />\n <ChatListItem {...itemProps} {...item} />\n </Fragment>\n );\n })}\n </div>\n );\n },\n);\n\nexport default ChatList;\n"],"mappings":";;;;;;;;;;AAUA,MAAM,WAAW,MACd,EACC,gBACA,gBACA,qBACA,WACA,MACA,UAAU,UACV,MACA,WACA,iBACA,gBACA,qBACA,WACA,aACA,oBACA,eACA,eAAe,GACf,YACA,GAAG,WACC;AACJ,QACE,oBAAC;EAAI,WAAW,GAAG,OAAO,WAAW,UAAU;EAAE,GAAI;YAClD,KAAK,KAAK,MAAM,UAAU;GACzB,MAAM,YAAY;IAChB,SAAS,cAAc,KAAK;IAC5B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD;GAED,MAAM,gBAAgB,KAAK;AAM3B,UACE,qBAAC,uBACC,oBAACA;IAAe,QANlB,sBACA,gBAAgB,gBAChB,iBAAiB,gBAAgB,QAAQ;IAIO,MAAM,MAAM;KAAW,EACrE,oBAACC;IAAa,GAAI;IAAW,GAAI;KAAQ,KAF5B,KAAK,GAGT;IAEb;GACE;EAGX;AAED,uBAAe"}