@tencentcloud/chat-uikit-react 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +7 -0
- package/.eslintrc.js +70 -0
- package/README.md +107 -0
- package/dist/cjs/_virtual/DateInput.js +1 -0
- package/dist/cjs/_virtual/DatePicker.js +1 -0
- package/dist/cjs/_virtual/DayInput.js +1 -0
- package/dist/cjs/_virtual/Divider.js +1 -0
- package/dist/cjs/_virtual/Fit.js +1 -0
- package/dist/cjs/_virtual/Input.js +1 -0
- package/dist/cjs/_virtual/MonthInput.js +1 -0
- package/dist/cjs/_virtual/MonthSelect.js +1 -0
- package/dist/cjs/_virtual/NativeInput.js +1 -0
- package/dist/cjs/_virtual/YearInput.js +1 -0
- package/dist/cjs/_virtual/_commonjsHelpers.js +1 -0
- package/dist/cjs/_virtual/clsx.m.js +1 -0
- package/dist/cjs/_virtual/dateFormatter.js +1 -0
- package/dist/cjs/_virtual/dates.js +1 -0
- package/dist/cjs/_virtual/entry.js +1 -0
- package/dist/cjs/_virtual/index.js +1 -0
- package/dist/cjs/_virtual/index10.js +1 -0
- package/dist/cjs/_virtual/index2.js +1 -0
- package/dist/cjs/_virtual/index3.js +1 -0
- package/dist/cjs/_virtual/index4.js +1 -0
- package/dist/cjs/_virtual/index5.js +1 -0
- package/dist/cjs/_virtual/index6.js +1 -0
- package/dist/cjs/_virtual/index7.js +1 -0
- package/dist/cjs/_virtual/index8.js +1 -0
- package/dist/cjs/_virtual/index9.js +1 -0
- package/dist/cjs/_virtual/propTypes.js +1 -0
- package/dist/cjs/_virtual/react-dom.development.js +1 -0
- package/dist/cjs/_virtual/react-dom.production.min.js +1 -0
- package/dist/cjs/_virtual/react-is.development.js +1 -0
- package/dist/cjs/_virtual/react-is.production.min.js +1 -0
- package/dist/cjs/_virtual/scheduler.development.js +1 -0
- package/dist/cjs/_virtual/scheduler.production.min.js +1 -0
- package/dist/cjs/_virtual/tiny-warning.esm.js +1 -0
- package/dist/cjs/_virtual/utils.js +1 -0
- package/dist/cjs/components/Avatar/Avatar.d.ts +22 -0
- package/dist/cjs/components/Avatar/Avatar.js +1 -0
- package/dist/cjs/components/Avatar/default.d.ts +7 -0
- package/dist/cjs/components/Avatar/default.js +1 -0
- package/dist/cjs/components/Checkbox/index.js +1 -0
- package/dist/cjs/components/ConversationCreate/ConversationCreatGroupDetail.js +1 -0
- package/dist/cjs/components/ConversationCreate/ConversationCreate.js +1 -0
- package/dist/cjs/components/ConversationCreate/ConversationCreateSelectView.js +1 -0
- package/dist/cjs/components/ConversationCreate/ConversationCreateUserSelectList.js +1 -0
- package/dist/cjs/components/ConversationCreate/ConversationGroupTypeInfo.js +1 -0
- package/dist/cjs/components/ConversationCreate/hooks/useConversationCreate.js +1 -0
- package/dist/cjs/components/ConversationCreate/static/word.js +1 -0
- package/dist/cjs/components/ConversationPreview/ConversationListContainer.d.ts +10 -0
- package/dist/cjs/components/ConversationPreview/ConversationListContainer.js +1 -0
- package/dist/cjs/components/ConversationPreview/ConversationPreview.d.ts +31 -0
- package/dist/cjs/components/ConversationPreview/ConversationPreview.js +1 -0
- package/dist/cjs/components/ConversationPreview/ConversationPreviewContent.d.ts +7 -0
- package/dist/cjs/components/ConversationPreview/ConversationPreviewContent.js +1 -0
- package/dist/cjs/components/ConversationPreview/utils.js +1 -0
- package/dist/cjs/components/ConversationSearch/ConversationSearchInput.d.ts +5 -0
- package/dist/cjs/components/ConversationSearch/ConversationSearchInput.js +1 -0
- package/dist/cjs/components/ConversationSearch/ConversationSearchResult.d.ts +12 -0
- package/dist/cjs/components/ConversationSearch/ConversationSearchResult.js +1 -0
- package/dist/cjs/components/DivWithEdit/DivWithEdit.js +1 -0
- package/dist/cjs/components/DivWithEdit/WithSelect.js +1 -0
- package/dist/cjs/components/DivWithEdit/WithText.js +1 -0
- package/dist/cjs/components/EmptyStateIndicator/EmptyStateIndicator.d.ts +6 -0
- package/dist/cjs/components/EmptyStateIndicator/EmptyStateIndicator.js +1 -0
- package/dist/cjs/components/Icon/Icon.js +1 -0
- package/dist/cjs/components/Icon/config.js +1 -0
- package/dist/cjs/components/Icon/images/add.png.js +1 -0
- package/dist/cjs/components/Icon/images/arrow-down.png.js +1 -0
- package/dist/cjs/components/Icon/images/arrow-right.png.js +1 -0
- package/dist/cjs/components/Icon/images/back.png.js +1 -0
- package/dist/cjs/components/Icon/images/camera.png.js +1 -0
- package/dist/cjs/components/Icon/images/cancel.png.js +1 -0
- package/dist/cjs/components/Icon/images/clear.png.js +1 -0
- package/dist/cjs/components/Icon/images/close.png.js +1 -0
- package/dist/cjs/components/Icon/images/confirm.png.js +1 -0
- package/dist/cjs/components/Icon/images/copy.png.js +1 -0
- package/dist/cjs/components/Icon/images/create.png.js +1 -0
- package/dist/cjs/components/Icon/images/cry.png.js +1 -0
- package/dist/cjs/components/Icon/images/del.png.js +1 -0
- package/dist/cjs/components/Icon/images/document.png.js +1 -0
- package/dist/cjs/components/Icon/images/edit.png.js +1 -0
- package/dist/cjs/components/Icon/images/effort.png.js +1 -0
- package/dist/cjs/components/Icon/images/ellipse.png.js +1 -0
- package/dist/cjs/components/Icon/images/emoji.png.js +1 -0
- package/dist/cjs/components/Icon/images/file.png.js +1 -0
- package/dist/cjs/components/Icon/images/forward.png.js +1 -0
- package/dist/cjs/components/Icon/images/image.png.js +1 -0
- package/dist/cjs/components/Icon/images/more.png.js +1 -0
- package/dist/cjs/components/Icon/images/progress.png.js +1 -0
- package/dist/cjs/components/Icon/images/quote.png.js +1 -0
- package/dist/cjs/components/Icon/images/reply.png.js +1 -0
- package/dist/cjs/components/Icon/images/revocation.png.js +1 -0
- package/dist/cjs/components/Icon/images/right.png.js +1 -0
- package/dist/cjs/components/Icon/images/search.png.js +1 -0
- package/dist/cjs/components/Icon/images/star.png.js +1 -0
- package/dist/cjs/components/Icon/images/video.png.js +1 -0
- package/dist/cjs/components/Icon/type.js +1 -0
- package/dist/cjs/components/InfiniteScrollPaginator/InfiniteScroll.d.ts +20 -0
- package/dist/cjs/components/InfiniteScrollPaginator/InfiniteScroll.js +1 -0
- package/dist/cjs/components/Input/Input.d.ts +16 -0
- package/dist/cjs/components/Input/Input.js +1 -0
- package/dist/cjs/components/Model/index.js +1 -0
- package/dist/cjs/components/Plugins/hooks/usePluginsElement.js +1 -0
- package/dist/cjs/components/Plugins/index.js +1 -0
- package/dist/cjs/components/Popup/index.js +1 -0
- package/dist/cjs/components/Profile/Profile.js +1 -0
- package/dist/cjs/components/Switch/Switch.js +1 -0
- package/dist/cjs/components/Switch/utils/newId.js +1 -0
- package/dist/cjs/components/TUIChat/TUIChat.d.ts +27 -0
- package/dist/cjs/components/TUIChat/TUIChat.js +1 -0
- package/dist/cjs/components/TUIChat/TUIChatState.js +1 -0
- package/dist/cjs/components/TUIChat/hooks/useCreateMessage.d.ts +31 -0
- package/dist/cjs/components/TUIChat/hooks/useCreateMessage.js +1 -0
- package/dist/cjs/components/TUIChat/hooks/useCreateTUIChatStateContext.js +1 -0
- package/dist/cjs/components/TUIChat/hooks/useHandleMessage.d.ts +7 -0
- package/dist/cjs/components/TUIChat/hooks/useHandleMessage.js +1 -0
- package/dist/cjs/components/TUIChat/hooks/useHandleMessageList.js +1 -0
- package/dist/cjs/components/TUIChat/hooks/useMessageReceviedListener.js +1 -0
- package/dist/cjs/components/TUIChat/unitls.js +1 -0
- package/dist/cjs/components/TUIChatHeader/TUIChatHeader.d.ts +13 -0
- package/dist/cjs/components/TUIChatHeader/TUIChatHeader.js +1 -0
- package/dist/cjs/components/TUIChatHeader/TUIChatHeaderDefault.d.ts +13 -0
- package/dist/cjs/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -0
- package/dist/cjs/components/TUIConversation/TUIConversation.d.ts +10 -0
- package/dist/cjs/components/TUIConversation/TUIConversation.js +1 -0
- package/dist/cjs/components/TUIConversationList/TUIConversationList.d.ts +17 -0
- package/dist/cjs/components/TUIConversationList/TUIConversationList.js +1 -0
- package/dist/cjs/components/TUIConversationList/hooks/useConversationList.js +1 -0
- package/dist/cjs/components/TUIConversationList/hooks/useConversationUpdate.js +1 -0
- package/dist/cjs/components/TUIKit/TUIKit.d.ts +10 -0
- package/dist/cjs/components/TUIKit/TUIKit.js +1 -0
- package/dist/cjs/components/TUIKit/hooks/useCreateTUIKitContext.d.ts +17 -0
- package/dist/cjs/components/TUIKit/hooks/useCreateTUIKitContext.js +1 -0
- package/dist/cjs/components/TUIKit/hooks/useTUIKit.d.ts +17 -0
- package/dist/cjs/components/TUIKit/hooks/useTUIKit.js +1 -0
- package/dist/cjs/components/TUIManage/TUIManage.d.ts +3 -0
- package/dist/cjs/components/TUIManage/TUIManage.js +1 -0
- package/dist/cjs/components/TUIMessage/MessageAudio.js +1 -0
- package/dist/cjs/components/TUIMessage/MessageBubble.js +1 -0
- package/dist/cjs/components/TUIMessage/MessageContext.d.ts +7 -0
- package/dist/cjs/components/TUIMessage/MessageContext.js +1 -0
- package/dist/cjs/components/TUIMessage/MessageCustom.js +1 -0
- package/dist/cjs/components/TUIMessage/MessageFace.js +1 -0
- package/dist/cjs/components/TUIMessage/MessageFile.js +1 -0
- package/dist/cjs/components/TUIMessage/MessageImage.js +1 -0
- package/dist/cjs/components/TUIMessage/MessageLocation.js +1 -0
- package/dist/cjs/components/TUIMessage/MessageMerger.js +1 -0
- package/dist/cjs/components/TUIMessage/MessagePlugins.js +1 -0
- package/dist/cjs/components/TUIMessage/MessageRevoke.js +1 -0
- package/dist/cjs/components/TUIMessage/MessageStatus.js +1 -0
- package/dist/cjs/components/TUIMessage/MessageSystem.js +1 -0
- package/dist/cjs/components/TUIMessage/MessageText.js +1 -0
- package/dist/cjs/components/TUIMessage/MessageTip.js +1 -0
- package/dist/cjs/components/TUIMessage/MessageVideo.js +1 -0
- package/dist/cjs/components/TUIMessage/TUIMessage.d.ts +41 -0
- package/dist/cjs/components/TUIMessage/TUIMessage.js +1 -0
- package/dist/cjs/components/TUIMessage/TUIMessageDefault.js +1 -0
- package/dist/cjs/components/TUIMessage/hooks/useMessageContextHandler.js +1 -0
- package/dist/cjs/components/TUIMessage/hooks/useMessageHandler.js +1 -0
- package/dist/cjs/components/TUIMessage/hooks/useMessagePluginElement.js +1 -0
- package/dist/cjs/components/TUIMessage/hooks/useMessageReply.js +1 -0
- package/dist/cjs/components/TUIMessage/utils/decodeText.js +1 -0
- package/dist/cjs/components/TUIMessage/utils/emojiMap.js +1 -0
- package/dist/cjs/components/TUIMessage/utils/index.js +1 -0
- package/dist/cjs/components/TUIMessageInput/EmojiPicker.js +1 -0
- package/dist/cjs/components/TUIMessageInput/InputPluginsDefalut.d.ts +5 -0
- package/dist/cjs/components/TUIMessageInput/InputPluginsDefalut.js +1 -0
- package/dist/cjs/components/TUIMessageInput/InputQuoteDefalut.js +1 -0
- package/dist/cjs/components/TUIMessageInput/TUIForward.js +1 -0
- package/dist/cjs/components/TUIMessageInput/TUIMessageInput.d.ts +18 -0
- package/dist/cjs/components/TUIMessageInput/TUIMessageInput.js +1 -0
- package/dist/cjs/components/TUIMessageInput/TUIMessageInputDefault.d.ts +5 -0
- package/dist/cjs/components/TUIMessageInput/TUIMessageInputDefault.js +1 -0
- package/dist/cjs/components/TUIMessageInput/hooks/useCreateMessageInputContext.js +1 -0
- package/dist/cjs/components/TUIMessageInput/hooks/useEmojiPicker.d.ts +6 -0
- package/dist/cjs/components/TUIMessageInput/hooks/useEmojiPicker.js +1 -0
- package/dist/cjs/components/TUIMessageInput/hooks/useHandleForwardMessage.js +1 -0
- package/dist/cjs/components/TUIMessageInput/hooks/useHandleQuoteMessage.js +1 -0
- package/dist/cjs/components/TUIMessageInput/hooks/useMessageInputState.d.ts +6 -0
- package/dist/cjs/components/TUIMessageInput/hooks/useMessageInputState.js +1 -0
- package/dist/cjs/components/TUIMessageInput/hooks/useMessageInputText.js +1 -0
- package/dist/cjs/components/TUIMessageInput/hooks/useUploadElement.js +1 -0
- package/dist/cjs/components/TUIMessageInput/hooks/useUploadPicker.d.ts +5 -0
- package/dist/cjs/components/TUIMessageInput/hooks/useUploadPicker.js +1 -0
- package/dist/cjs/components/TUIMessageList/TUIMessageList.d.ts +11 -0
- package/dist/cjs/components/TUIMessageList/TUIMessageList.js +1 -0
- package/dist/cjs/components/TUIMessageList/hooks/useEnrichedMessageList.js +1 -0
- package/dist/cjs/components/TUIMessageList/hooks/useMessageListElement.js +1 -0
- package/dist/cjs/components/TUIProfile/TUIProfile.d.ts +10 -0
- package/dist/cjs/components/TUIProfile/TUIProfile.js +1 -0
- package/dist/cjs/components/TUIProfile/TUIProfileDefault.d.ts +12 -0
- package/dist/cjs/components/TUIProfile/TUIProfileDefault.js +1 -0
- package/dist/cjs/components/TUIProfile/hooks/useMyProfile.d.ts +17 -0
- package/dist/cjs/components/TUIProfile/hooks/useMyProfile.js +1 -0
- package/dist/cjs/components/Toast/index.js +1 -0
- package/dist/cjs/components/untils.js +1 -0
- package/dist/cjs/constants.d.ts +11 -0
- package/dist/cjs/constants.js +1 -0
- package/dist/cjs/context/ComponentContext.d.ts +26 -0
- package/dist/cjs/context/ComponentContext.js +1 -0
- package/dist/cjs/context/TUIChatActionContext.d.ts +27 -0
- package/dist/cjs/context/TUIChatActionContext.js +1 -0
- package/dist/cjs/context/TUIChatStateContext.d.ts +25 -0
- package/dist/cjs/context/TUIChatStateContext.js +1 -0
- package/dist/cjs/context/TUIConversationContext.js +1 -0
- package/dist/cjs/context/TUIKitContext.d.ts +21 -0
- package/dist/cjs/context/TUIKitContext.js +1 -0
- package/dist/cjs/context/TUIMessageContext.d.ts +41 -0
- package/dist/cjs/context/TUIMessageContext.js +1 -0
- package/dist/cjs/context/TUIMessageInputContext.d.ts +37 -0
- package/dist/cjs/context/TUIMessageInputContext.js +1 -0
- package/dist/cjs/hooks/useConversation.d.ts +25 -0
- package/dist/cjs/hooks/useConversation.js +1 -0
- package/dist/cjs/hooks/useProfile.d.ts +5 -0
- package/dist/cjs/hooks/useProfile.js +1 -0
- package/dist/cjs/index.css +1 -0
- package/dist/cjs/index.d.css +1281 -0
- package/dist/cjs/index.d.ts +29 -0
- package/dist/cjs/index.js +1 -0
- package/dist/esm/_virtual/DateInput.js +1 -0
- package/dist/esm/_virtual/DatePicker.js +1 -0
- package/dist/esm/_virtual/DayInput.js +1 -0
- package/dist/esm/_virtual/Divider.js +1 -0
- package/dist/esm/_virtual/Fit.js +1 -0
- package/dist/esm/_virtual/Input.js +1 -0
- package/dist/esm/_virtual/MonthInput.js +1 -0
- package/dist/esm/_virtual/MonthSelect.js +1 -0
- package/dist/esm/_virtual/NativeInput.js +1 -0
- package/dist/esm/_virtual/YearInput.js +1 -0
- package/dist/esm/_virtual/_commonjsHelpers.js +1 -0
- package/dist/esm/_virtual/clsx.m.js +1 -0
- package/dist/esm/_virtual/dateFormatter.js +1 -0
- package/dist/esm/_virtual/dates.js +1 -0
- package/dist/esm/_virtual/entry.js +1 -0
- package/dist/esm/_virtual/index.js +1 -0
- package/dist/esm/_virtual/index10.js +1 -0
- package/dist/esm/_virtual/index2.js +1 -0
- package/dist/esm/_virtual/index3.js +1 -0
- package/dist/esm/_virtual/index4.js +1 -0
- package/dist/esm/_virtual/index5.js +1 -0
- package/dist/esm/_virtual/index6.js +1 -0
- package/dist/esm/_virtual/index7.js +1 -0
- package/dist/esm/_virtual/index8.js +1 -0
- package/dist/esm/_virtual/index9.js +1 -0
- package/dist/esm/_virtual/propTypes.js +1 -0
- package/dist/esm/_virtual/react-dom.development.js +1 -0
- package/dist/esm/_virtual/react-dom.production.min.js +1 -0
- package/dist/esm/_virtual/react-is.development.js +1 -0
- package/dist/esm/_virtual/react-is.production.min.js +1 -0
- package/dist/esm/_virtual/scheduler.development.js +1 -0
- package/dist/esm/_virtual/scheduler.production.min.js +1 -0
- package/dist/esm/_virtual/tiny-warning.esm.js +1 -0
- package/dist/esm/_virtual/utils.js +1 -0
- package/dist/esm/components/Avatar/Avatar.d.ts +22 -0
- package/dist/esm/components/Avatar/Avatar.js +1 -0
- package/dist/esm/components/Avatar/default.d.ts +7 -0
- package/dist/esm/components/Avatar/default.js +1 -0
- package/dist/esm/components/Checkbox/index.js +1 -0
- package/dist/esm/components/ConversationCreate/ConversationCreatGroupDetail.js +1 -0
- package/dist/esm/components/ConversationCreate/ConversationCreate.js +1 -0
- package/dist/esm/components/ConversationCreate/ConversationCreateSelectView.js +1 -0
- package/dist/esm/components/ConversationCreate/ConversationCreateUserSelectList.js +1 -0
- package/dist/esm/components/ConversationCreate/ConversationGroupTypeInfo.js +1 -0
- package/dist/esm/components/ConversationCreate/hooks/useConversationCreate.js +1 -0
- package/dist/esm/components/ConversationCreate/static/word.js +1 -0
- package/dist/esm/components/ConversationPreview/ConversationListContainer.d.ts +10 -0
- package/dist/esm/components/ConversationPreview/ConversationListContainer.js +1 -0
- package/dist/esm/components/ConversationPreview/ConversationPreview.d.ts +31 -0
- package/dist/esm/components/ConversationPreview/ConversationPreview.js +1 -0
- package/dist/esm/components/ConversationPreview/ConversationPreviewContent.d.ts +7 -0
- package/dist/esm/components/ConversationPreview/ConversationPreviewContent.js +1 -0
- package/dist/esm/components/ConversationPreview/utils.js +1 -0
- package/dist/esm/components/ConversationSearch/ConversationSearchInput.d.ts +5 -0
- package/dist/esm/components/ConversationSearch/ConversationSearchInput.js +1 -0
- package/dist/esm/components/ConversationSearch/ConversationSearchResult.d.ts +12 -0
- package/dist/esm/components/ConversationSearch/ConversationSearchResult.js +1 -0
- package/dist/esm/components/DivWithEdit/DivWithEdit.js +1 -0
- package/dist/esm/components/DivWithEdit/WithSelect.js +1 -0
- package/dist/esm/components/DivWithEdit/WithText.js +1 -0
- package/dist/esm/components/EmptyStateIndicator/EmptyStateIndicator.d.ts +6 -0
- package/dist/esm/components/EmptyStateIndicator/EmptyStateIndicator.js +1 -0
- package/dist/esm/components/Icon/Icon.js +1 -0
- package/dist/esm/components/Icon/config.js +1 -0
- package/dist/esm/components/Icon/images/add.png.js +1 -0
- package/dist/esm/components/Icon/images/arrow-down.png.js +1 -0
- package/dist/esm/components/Icon/images/arrow-right.png.js +1 -0
- package/dist/esm/components/Icon/images/back.png.js +1 -0
- package/dist/esm/components/Icon/images/camera.png.js +1 -0
- package/dist/esm/components/Icon/images/cancel.png.js +1 -0
- package/dist/esm/components/Icon/images/clear.png.js +1 -0
- package/dist/esm/components/Icon/images/close.png.js +1 -0
- package/dist/esm/components/Icon/images/confirm.png.js +1 -0
- package/dist/esm/components/Icon/images/copy.png.js +1 -0
- package/dist/esm/components/Icon/images/create.png.js +1 -0
- package/dist/esm/components/Icon/images/cry.png.js +1 -0
- package/dist/esm/components/Icon/images/del.png.js +1 -0
- package/dist/esm/components/Icon/images/document.png.js +1 -0
- package/dist/esm/components/Icon/images/edit.png.js +1 -0
- package/dist/esm/components/Icon/images/effort.png.js +1 -0
- package/dist/esm/components/Icon/images/ellipse.png.js +1 -0
- package/dist/esm/components/Icon/images/emoji.png.js +1 -0
- package/dist/esm/components/Icon/images/file.png.js +1 -0
- package/dist/esm/components/Icon/images/forward.png.js +1 -0
- package/dist/esm/components/Icon/images/image.png.js +1 -0
- package/dist/esm/components/Icon/images/more.png.js +1 -0
- package/dist/esm/components/Icon/images/progress.png.js +1 -0
- package/dist/esm/components/Icon/images/quote.png.js +1 -0
- package/dist/esm/components/Icon/images/reply.png.js +1 -0
- package/dist/esm/components/Icon/images/revocation.png.js +1 -0
- package/dist/esm/components/Icon/images/right.png.js +1 -0
- package/dist/esm/components/Icon/images/search.png.js +1 -0
- package/dist/esm/components/Icon/images/star.png.js +1 -0
- package/dist/esm/components/Icon/images/video.png.js +1 -0
- package/dist/esm/components/Icon/type.js +1 -0
- package/dist/esm/components/InfiniteScrollPaginator/InfiniteScroll.d.ts +20 -0
- package/dist/esm/components/InfiniteScrollPaginator/InfiniteScroll.js +1 -0
- package/dist/esm/components/Input/Input.d.ts +16 -0
- package/dist/esm/components/Input/Input.js +1 -0
- package/dist/esm/components/Model/index.js +1 -0
- package/dist/esm/components/Plugins/hooks/usePluginsElement.js +1 -0
- package/dist/esm/components/Plugins/index.js +1 -0
- package/dist/esm/components/Popup/index.js +1 -0
- package/dist/esm/components/Profile/Profile.js +1 -0
- package/dist/esm/components/Switch/Switch.js +1 -0
- package/dist/esm/components/Switch/utils/newId.js +1 -0
- package/dist/esm/components/TUIChat/TUIChat.d.ts +27 -0
- package/dist/esm/components/TUIChat/TUIChat.js +1 -0
- package/dist/esm/components/TUIChat/TUIChatState.js +1 -0
- package/dist/esm/components/TUIChat/hooks/useCreateMessage.d.ts +31 -0
- package/dist/esm/components/TUIChat/hooks/useCreateMessage.js +1 -0
- package/dist/esm/components/TUIChat/hooks/useCreateTUIChatStateContext.js +1 -0
- package/dist/esm/components/TUIChat/hooks/useHandleMessage.d.ts +7 -0
- package/dist/esm/components/TUIChat/hooks/useHandleMessage.js +1 -0
- package/dist/esm/components/TUIChat/hooks/useHandleMessageList.js +1 -0
- package/dist/esm/components/TUIChat/hooks/useMessageReceviedListener.js +1 -0
- package/dist/esm/components/TUIChat/unitls.js +1 -0
- package/dist/esm/components/TUIChatHeader/TUIChatHeader.d.ts +13 -0
- package/dist/esm/components/TUIChatHeader/TUIChatHeader.js +1 -0
- package/dist/esm/components/TUIChatHeader/TUIChatHeaderDefault.d.ts +13 -0
- package/dist/esm/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -0
- package/dist/esm/components/TUIConversation/TUIConversation.d.ts +10 -0
- package/dist/esm/components/TUIConversation/TUIConversation.js +1 -0
- package/dist/esm/components/TUIConversationList/TUIConversationList.d.ts +17 -0
- package/dist/esm/components/TUIConversationList/TUIConversationList.js +1 -0
- package/dist/esm/components/TUIConversationList/hooks/useConversationList.js +1 -0
- package/dist/esm/components/TUIConversationList/hooks/useConversationUpdate.js +1 -0
- package/dist/esm/components/TUIKit/TUIKit.d.ts +10 -0
- package/dist/esm/components/TUIKit/TUIKit.js +1 -0
- package/dist/esm/components/TUIKit/hooks/useCreateTUIKitContext.d.ts +17 -0
- package/dist/esm/components/TUIKit/hooks/useCreateTUIKitContext.js +1 -0
- package/dist/esm/components/TUIKit/hooks/useTUIKit.d.ts +17 -0
- package/dist/esm/components/TUIKit/hooks/useTUIKit.js +1 -0
- package/dist/esm/components/TUIManage/TUIManage.d.ts +3 -0
- package/dist/esm/components/TUIManage/TUIManage.js +1 -0
- package/dist/esm/components/TUIMessage/MessageAudio.js +1 -0
- package/dist/esm/components/TUIMessage/MessageBubble.js +1 -0
- package/dist/esm/components/TUIMessage/MessageContext.d.ts +7 -0
- package/dist/esm/components/TUIMessage/MessageContext.js +1 -0
- package/dist/esm/components/TUIMessage/MessageCustom.js +1 -0
- package/dist/esm/components/TUIMessage/MessageFace.js +1 -0
- package/dist/esm/components/TUIMessage/MessageFile.js +1 -0
- package/dist/esm/components/TUIMessage/MessageImage.js +1 -0
- package/dist/esm/components/TUIMessage/MessageLocation.js +1 -0
- package/dist/esm/components/TUIMessage/MessageMerger.js +1 -0
- package/dist/esm/components/TUIMessage/MessagePlugins.js +1 -0
- package/dist/esm/components/TUIMessage/MessageRevoke.js +1 -0
- package/dist/esm/components/TUIMessage/MessageStatus.js +1 -0
- package/dist/esm/components/TUIMessage/MessageSystem.js +1 -0
- package/dist/esm/components/TUIMessage/MessageText.js +1 -0
- package/dist/esm/components/TUIMessage/MessageTip.js +1 -0
- package/dist/esm/components/TUIMessage/MessageVideo.js +1 -0
- package/dist/esm/components/TUIMessage/TUIMessage.d.ts +41 -0
- package/dist/esm/components/TUIMessage/TUIMessage.js +1 -0
- package/dist/esm/components/TUIMessage/TUIMessageDefault.js +1 -0
- package/dist/esm/components/TUIMessage/hooks/useMessageContextHandler.js +1 -0
- package/dist/esm/components/TUIMessage/hooks/useMessageHandler.js +1 -0
- package/dist/esm/components/TUIMessage/hooks/useMessagePluginElement.js +1 -0
- package/dist/esm/components/TUIMessage/hooks/useMessageReply.js +1 -0
- package/dist/esm/components/TUIMessage/utils/decodeText.js +1 -0
- package/dist/esm/components/TUIMessage/utils/emojiMap.js +1 -0
- package/dist/esm/components/TUIMessage/utils/index.js +1 -0
- package/dist/esm/components/TUIMessageInput/EmojiPicker.js +1 -0
- package/dist/esm/components/TUIMessageInput/InputPluginsDefalut.d.ts +5 -0
- package/dist/esm/components/TUIMessageInput/InputPluginsDefalut.js +1 -0
- package/dist/esm/components/TUIMessageInput/InputQuoteDefalut.js +1 -0
- package/dist/esm/components/TUIMessageInput/TUIForward.js +1 -0
- package/dist/esm/components/TUIMessageInput/TUIMessageInput.d.ts +18 -0
- package/dist/esm/components/TUIMessageInput/TUIMessageInput.js +1 -0
- package/dist/esm/components/TUIMessageInput/TUIMessageInputDefault.d.ts +5 -0
- package/dist/esm/components/TUIMessageInput/TUIMessageInputDefault.js +1 -0
- package/dist/esm/components/TUIMessageInput/hooks/useCreateMessageInputContext.js +1 -0
- package/dist/esm/components/TUIMessageInput/hooks/useEmojiPicker.d.ts +6 -0
- package/dist/esm/components/TUIMessageInput/hooks/useEmojiPicker.js +1 -0
- package/dist/esm/components/TUIMessageInput/hooks/useHandleForwardMessage.js +1 -0
- package/dist/esm/components/TUIMessageInput/hooks/useHandleQuoteMessage.js +1 -0
- package/dist/esm/components/TUIMessageInput/hooks/useMessageInputState.d.ts +6 -0
- package/dist/esm/components/TUIMessageInput/hooks/useMessageInputState.js +1 -0
- package/dist/esm/components/TUIMessageInput/hooks/useMessageInputText.js +1 -0
- package/dist/esm/components/TUIMessageInput/hooks/useUploadElement.js +1 -0
- package/dist/esm/components/TUIMessageInput/hooks/useUploadPicker.d.ts +5 -0
- package/dist/esm/components/TUIMessageInput/hooks/useUploadPicker.js +1 -0
- package/dist/esm/components/TUIMessageList/TUIMessageList.d.ts +11 -0
- package/dist/esm/components/TUIMessageList/TUIMessageList.js +1 -0
- package/dist/esm/components/TUIMessageList/hooks/useEnrichedMessageList.js +1 -0
- package/dist/esm/components/TUIMessageList/hooks/useMessageListElement.js +1 -0
- package/dist/esm/components/TUIProfile/TUIProfile.d.ts +10 -0
- package/dist/esm/components/TUIProfile/TUIProfile.js +1 -0
- package/dist/esm/components/TUIProfile/TUIProfileDefault.d.ts +12 -0
- package/dist/esm/components/TUIProfile/TUIProfileDefault.js +1 -0
- package/dist/esm/components/TUIProfile/hooks/useMyProfile.d.ts +17 -0
- package/dist/esm/components/TUIProfile/hooks/useMyProfile.js +1 -0
- package/dist/esm/components/Toast/index.js +1 -0
- package/dist/esm/components/untils.js +1 -0
- package/dist/esm/constants.d.ts +11 -0
- package/dist/esm/constants.js +1 -0
- package/dist/esm/context/ComponentContext.d.ts +26 -0
- package/dist/esm/context/ComponentContext.js +1 -0
- package/dist/esm/context/TUIChatActionContext.d.ts +27 -0
- package/dist/esm/context/TUIChatActionContext.js +1 -0
- package/dist/esm/context/TUIChatStateContext.d.ts +25 -0
- package/dist/esm/context/TUIChatStateContext.js +1 -0
- package/dist/esm/context/TUIConversationContext.js +1 -0
- package/dist/esm/context/TUIKitContext.d.ts +21 -0
- package/dist/esm/context/TUIKitContext.js +1 -0
- package/dist/esm/context/TUIMessageContext.d.ts +41 -0
- package/dist/esm/context/TUIMessageContext.js +1 -0
- package/dist/esm/context/TUIMessageInputContext.d.ts +37 -0
- package/dist/esm/context/TUIMessageInputContext.js +1 -0
- package/dist/esm/hooks/useConversation.d.ts +25 -0
- package/dist/esm/hooks/useConversation.js +1 -0
- package/dist/esm/hooks/useProfile.d.ts +5 -0
- package/dist/esm/hooks/useProfile.js +1 -0
- package/dist/esm/index.css +1 -0
- package/dist/esm/index.d.css +1281 -0
- package/dist/esm/index.d.ts +29 -0
- package/dist/esm/index.js +1 -0
- package/package.json +70 -0
- package/rollup.config.js +66 -0
- package/src/@types/images.d.ts +7 -0
- package/src/@types/index.d.ts +1 -0
- package/src/@types/index.js +3 -0
- package/src/components/Avatar/Avatar.tsx +151 -0
- package/src/components/Avatar/default.ts +5 -0
- package/src/components/Avatar/index.ts +2 -0
- package/src/components/Avatar/styles/index.scss +55 -0
- package/src/components/Checkbox/index.tsx +53 -0
- package/src/components/Checkbox/styles/color.scss +11 -0
- package/src/components/Checkbox/styles/index.scss +2 -0
- package/src/components/Checkbox/styles/layout.scss +25 -0
- package/src/components/ConversationCreate/ConversationCreatGroupDetail.tsx +155 -0
- package/src/components/ConversationCreate/ConversationCreate.tsx +74 -0
- package/src/components/ConversationCreate/ConversationCreateSelectView.tsx +46 -0
- package/src/components/ConversationCreate/ConversationCreateUserSelectList.tsx +158 -0
- package/src/components/ConversationCreate/ConversationGroupTypeInfo.tsx +50 -0
- package/src/components/ConversationCreate/hooks/useConversationCreate.tsx +105 -0
- package/src/components/ConversationCreate/index.ts +6 -0
- package/src/components/ConversationCreate/static/word.ts +300 -0
- package/src/components/ConversationCreate/styles/ConversationCreatGroupDetail.scss +58 -0
- package/src/components/ConversationCreate/styles/conversationCreateSelectView.scss +32 -0
- package/src/components/ConversationCreate/styles/conversationGroupTypeInfo.scss +61 -0
- package/src/components/ConversationCreate/styles/index.scss +87 -0
- package/src/components/ConversationPreview/ConversationListContainer.tsx +20 -0
- package/src/components/ConversationPreview/ConversationPreview.tsx +75 -0
- package/src/components/ConversationPreview/ConversationPreviewContent.tsx +136 -0
- package/src/components/ConversationPreview/index.ts +2 -0
- package/src/components/ConversationPreview/styles/index.scss +140 -0
- package/src/components/ConversationPreview/utils.tsx +124 -0
- package/src/components/ConversationSearch/ConversationSearchInput.tsx +25 -0
- package/src/components/ConversationSearch/ConversationSearchResult.tsx +39 -0
- package/src/components/ConversationSearch/index.ts +2 -0
- package/src/components/ConversationSearch/styles/index.scss +19 -0
- package/src/components/DivWithEdit/DivWithEdit.tsx +90 -0
- package/src/components/DivWithEdit/WithSelect.tsx +29 -0
- package/src/components/DivWithEdit/WithText.tsx +42 -0
- package/src/components/DivWithEdit/index.ts +1 -0
- package/src/components/DivWithEdit/styles/index.scss +68 -0
- package/src/components/EmptyStateIndicator/EmptyStateIndicator.tsx +23 -0
- package/src/components/EmptyStateIndicator/index.ts +1 -0
- package/src/components/Icon/Icon.tsx +40 -0
- package/src/components/Icon/config.ts +164 -0
- package/src/components/Icon/images/add.png +0 -0
- package/src/components/Icon/images/arrow-down.png +0 -0
- package/src/components/Icon/images/arrow-right.png +0 -0
- package/src/components/Icon/images/back.png +0 -0
- package/src/components/Icon/images/camera.png +0 -0
- package/src/components/Icon/images/cancel.png +0 -0
- package/src/components/Icon/images/clear.png +0 -0
- package/src/components/Icon/images/close.png +0 -0
- package/src/components/Icon/images/confirm.png +0 -0
- package/src/components/Icon/images/copy.png +0 -0
- package/src/components/Icon/images/create.png +0 -0
- package/src/components/Icon/images/cry.png +0 -0
- package/src/components/Icon/images/del.png +0 -0
- package/src/components/Icon/images/document.png +0 -0
- package/src/components/Icon/images/edit.png +0 -0
- package/src/components/Icon/images/effort.png +0 -0
- package/src/components/Icon/images/ellipse.png +0 -0
- package/src/components/Icon/images/emoji.png +0 -0
- package/src/components/Icon/images/file.png +0 -0
- package/src/components/Icon/images/forward.png +0 -0
- package/src/components/Icon/images/image.png +0 -0
- package/src/components/Icon/images/more.png +0 -0
- package/src/components/Icon/images/progress.png +0 -0
- package/src/components/Icon/images/quote.png +0 -0
- package/src/components/Icon/images/reply.png +0 -0
- package/src/components/Icon/images/revocation.png +0 -0
- package/src/components/Icon/images/right.png +0 -0
- package/src/components/Icon/images/search.png +0 -0
- package/src/components/Icon/images/star.png +0 -0
- package/src/components/Icon/images/video.png +0 -0
- package/src/components/Icon/index.ts +2 -0
- package/src/components/Icon/styles/index.scss +31 -0
- package/src/components/Icon/type.ts +32 -0
- package/src/components/InfiniteScrollPaginator/InfiniteScroll.tsx +115 -0
- package/src/components/InfiniteScrollPaginator/index.ts +1 -0
- package/src/components/Input/Input.tsx +108 -0
- package/src/components/Input/index.ts +1 -0
- package/src/components/Input/styles/index.scss +44 -0
- package/src/components/Model/index.tsx +24 -0
- package/src/components/Model/styles/color.scss +0 -0
- package/src/components/Model/styles/index.scss +2 -0
- package/src/components/Model/styles/layout.scss +12 -0
- package/src/components/Plugins/hooks/index.ts +1 -0
- package/src/components/Plugins/hooks/usePluginsElement.tsx +16 -0
- package/src/components/Plugins/index.tsx +99 -0
- package/src/components/Plugins/styles/color.scss +7 -0
- package/src/components/Plugins/styles/index.scss +2 -0
- package/src/components/Plugins/styles/layout.scss +18 -0
- package/src/components/Popup/index.tsx +76 -0
- package/src/components/Popup/styles/color.scss +0 -0
- package/src/components/Popup/styles/index.scss +2 -0
- package/src/components/Popup/styles/layout.scss +6 -0
- package/src/components/Profile/Profile.tsx +25 -0
- package/src/components/Profile/hooks/useProfile.tsx +28 -0
- package/src/components/Profile/index.ts +2 -0
- package/src/components/Profile/styles/index.scss +17 -0
- package/src/components/Switch/Switch.scss +37 -0
- package/src/components/Switch/Switch.tsx +41 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/Switch/utils/newId.tsx +6 -0
- package/src/components/TUIChat/TUIChat.tsx +276 -0
- package/src/components/TUIChat/TUIChatState.tsx +129 -0
- package/src/components/TUIChat/hooks/useCreateMessage.tsx +117 -0
- package/src/components/TUIChat/hooks/useCreateTUIChatStateContext.tsx +34 -0
- package/src/components/TUIChat/hooks/useHandleMessage.tsx +33 -0
- package/src/components/TUIChat/hooks/useHandleMessageList.tsx +70 -0
- package/src/components/TUIChat/hooks/useIsMounted.ts +14 -0
- package/src/components/TUIChat/hooks/useMessageReceviedListener.tsx +26 -0
- package/src/components/TUIChat/index.ts +2 -0
- package/src/components/TUIChat/styles/index.scss +1 -0
- package/src/components/TUIChat/styles/layout.scss +9 -0
- package/src/components/TUIChat/unitls.ts +55 -0
- package/src/components/TUIChatHeader/TUIChatHeader.tsx +41 -0
- package/src/components/TUIChatHeader/TUIChatHeaderDefault.tsx +97 -0
- package/src/components/TUIChatHeader/index.ts +2 -0
- package/src/components/TUIChatHeader/styles/color.scss +3 -0
- package/src/components/TUIChatHeader/styles/index.scss +2 -0
- package/src/components/TUIChatHeader/styles/layout.scss +32 -0
- package/src/components/TUIConversation/TUIConversation.tsx +44 -0
- package/src/components/TUIConversation/index.ts +1 -0
- package/src/components/TUIConversationList/TUIConversationList.tsx +142 -0
- package/src/components/TUIConversationList/hooks/useConversationList.tsx +41 -0
- package/src/components/TUIConversationList/hooks/useConversationUpdate.tsx +33 -0
- package/src/components/TUIConversationList/index.scss +36 -0
- package/src/components/TUIConversationList/index.ts +2 -0
- package/src/components/TUIKit/TUIKit.tsx +56 -0
- package/src/components/TUIKit/hooks/useCreateTUIKitContext.tsx +40 -0
- package/src/components/TUIKit/hooks/useTUIKit.tsx +40 -0
- package/src/components/TUIKit/index.ts +3 -0
- package/src/components/TUIKit/styles/index.scss +9 -0
- package/src/components/TUIKit/styles/reset.scss +43 -0
- package/src/components/TUIManage/TUIManage.tsx +86 -0
- package/src/components/TUIManage/index.ts +1 -0
- package/src/components/TUIManage/styles/index.scss +67 -0
- package/src/components/TUIMessage/MessageAudio.tsx +28 -0
- package/src/components/TUIMessage/MessageBubble.tsx +99 -0
- package/src/components/TUIMessage/MessageContext.tsx +81 -0
- package/src/components/TUIMessage/MessageCustom.tsx +40 -0
- package/src/components/TUIMessage/MessageFace.tsx +28 -0
- package/src/components/TUIMessage/MessageFile.tsx +35 -0
- package/src/components/TUIMessage/MessageImage.tsx +42 -0
- package/src/components/TUIMessage/MessageLocation.tsx +29 -0
- package/src/components/TUIMessage/MessageMerger.tsx +37 -0
- package/src/components/TUIMessage/MessagePlugins.tsx +149 -0
- package/src/components/TUIMessage/MessageRevoke.tsx +47 -0
- package/src/components/TUIMessage/MessageStatus.tsx +34 -0
- package/src/components/TUIMessage/MessageSystem.tsx +30 -0
- package/src/components/TUIMessage/MessageText.tsx +43 -0
- package/src/components/TUIMessage/MessageTip.tsx +28 -0
- package/src/components/TUIMessage/MessageVideo.tsx +42 -0
- package/src/components/TUIMessage/TUIMessage.tsx +98 -0
- package/src/components/TUIMessage/TUIMessageDefault.tsx +93 -0
- package/src/components/TUIMessage/hooks/index.ts +3 -0
- package/src/components/TUIMessage/hooks/useMessageContextHandler.ts +70 -0
- package/src/components/TUIMessage/hooks/useMessageHandler.ts +142 -0
- package/src/components/TUIMessage/hooks/useMessagePluginElement.tsx +17 -0
- package/src/components/TUIMessage/hooks/useMessageReply.ts +65 -0
- package/src/components/TUIMessage/index.ts +3 -0
- package/src/components/TUIMessage/styles/color.scss +32 -0
- package/src/components/TUIMessage/styles/index.scss +2 -0
- package/src/components/TUIMessage/styles/layout.scss +389 -0
- package/src/components/TUIMessage/utils/decodeText.ts +61 -0
- package/src/components/TUIMessage/utils/emojiMap.ts +311 -0
- package/src/components/TUIMessage/utils/index.ts +463 -0
- package/src/components/TUIMessageInput/EmojiPicker.tsx +71 -0
- package/src/components/TUIMessageInput/InputPluginsDefalut.tsx +69 -0
- package/src/components/TUIMessageInput/InputQuoteDefalut.tsx +41 -0
- package/src/components/TUIMessageInput/TUIForward.tsx +194 -0
- package/src/components/TUIMessageInput/TUIMessageInput.tsx +94 -0
- package/src/components/TUIMessageInput/TUIMessageInputDefault.tsx +75 -0
- package/src/components/TUIMessageInput/hooks/index.ts +6 -0
- package/src/components/TUIMessageInput/hooks/useCreateMessageInputContext.ts +51 -0
- package/src/components/TUIMessageInput/hooks/useEmojiPicker.tsx +42 -0
- package/src/components/TUIMessageInput/hooks/useHandleForwardMessage.tsx +41 -0
- package/src/components/TUIMessageInput/hooks/useHandleQuoteMessage.tsx +63 -0
- package/src/components/TUIMessageInput/hooks/useMessageInputState.tsx +101 -0
- package/src/components/TUIMessageInput/hooks/useMessageInputText.tsx +176 -0
- package/src/components/TUIMessageInput/hooks/usePluginsElement.tsx +24 -0
- package/src/components/TUIMessageInput/hooks/useUploadElement.tsx +35 -0
- package/src/components/TUIMessageInput/hooks/useUploadPicker.tsx +40 -0
- package/src/components/TUIMessageInput/index.ts +3 -0
- package/src/components/TUIMessageInput/styles/color.scss +17 -0
- package/src/components/TUIMessageInput/styles/index.scss +2 -0
- package/src/components/TUIMessageInput/styles/layout.scss +280 -0
- package/src/components/TUIMessageList/TUIMessageList.tsx +106 -0
- package/src/components/TUIMessageList/hooks/useEnrichedMessageList.tsx +16 -0
- package/src/components/TUIMessageList/hooks/useMessageListElement.tsx +24 -0
- package/src/components/TUIMessageList/index.ts +2 -0
- package/src/components/TUIMessageList/styles/color.scss +0 -0
- package/src/components/TUIMessageList/styles/index.scss +2 -0
- package/src/components/TUIMessageList/styles/layout.scss +28 -0
- package/src/components/TUIProfile/TUIProfile.tsx +37 -0
- package/src/components/TUIProfile/TUIProfileDefault.tsx +247 -0
- package/src/components/TUIProfile/hooks/index.ts +1 -0
- package/src/components/TUIProfile/hooks/useMyProfile.tsx +64 -0
- package/src/components/TUIProfile/index.ts +2 -0
- package/src/components/TUIProfile/styles/color.scss +6 -0
- package/src/components/TUIProfile/styles/index.scss +2 -0
- package/src/components/TUIProfile/styles/layout.scss +91 -0
- package/src/components/Toast/index.tsx +44 -0
- package/src/components/Toast/styles/color.scss +11 -0
- package/src/components/Toast/styles/index.scss +2 -0
- package/src/components/Toast/styles/layout.scss +11 -0
- package/src/components/index.ts +12 -0
- package/src/components/untils.ts +72 -0
- package/src/constants.ts +84 -0
- package/src/context/ComponentContext.tsx +46 -0
- package/src/context/TUIChatActionContext.tsx +57 -0
- package/src/context/TUIChatStateContext.tsx +40 -0
- package/src/context/TUIConversationContext.tsx +27 -0
- package/src/context/TUIKitContext.tsx +31 -0
- package/src/context/TUIMessageContext.tsx +36 -0
- package/src/context/TUIMessageInputContext.tsx +56 -0
- package/src/context/index.ts +6 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useConversation.tsx +78 -0
- package/src/hooks/useProfile.tsx +8 -0
- package/src/index.ts +3 -0
- package/tsconfig.json +12 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import TIM, { Message } from 'tim-js-sdk';
|
|
2
|
+
import constant from '../../constants';
|
|
3
|
+
import type { TUIChatStateContextValue } from '../../context';
|
|
4
|
+
import { JSONStringToParse } from '../untils';
|
|
5
|
+
|
|
6
|
+
export const handleMessage = (messageList:Array<Message>):Array<Message> => {
|
|
7
|
+
let customPayloadData = null;
|
|
8
|
+
return messageList.filter((item) => {
|
|
9
|
+
if (item.type === TIM.TYPES.MSG_CUSTOM) {
|
|
10
|
+
customPayloadData = JSONStringToParse(item?.payload?.data);
|
|
11
|
+
}
|
|
12
|
+
if (customPayloadData && customPayloadData?.businessID === constant.TYPE_TYPING) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const handleMessageList = (
|
|
20
|
+
list:Array<Message>,
|
|
21
|
+
state:TUIChatStateContextValue,
|
|
22
|
+
) => {
|
|
23
|
+
const data = {
|
|
24
|
+
messageList: [],
|
|
25
|
+
lastMessageID: '',
|
|
26
|
+
isSameLastMessageID: false,
|
|
27
|
+
};
|
|
28
|
+
data.messageList = list;
|
|
29
|
+
if (data.messageList.length >= 1) {
|
|
30
|
+
data.lastMessageID = data?.messageList[data.messageList.length - 1]?.ID;
|
|
31
|
+
}
|
|
32
|
+
data.messageList = data.messageList.filter((item) => !item?.isDeleted);
|
|
33
|
+
data.isSameLastMessageID = data?.lastMessageID === state?.lastMessageID;
|
|
34
|
+
return data;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const handleEditMessage = (
|
|
38
|
+
messageList: Array<Message>,
|
|
39
|
+
message: Message,
|
|
40
|
+
) => {
|
|
41
|
+
const list = [...messageList];
|
|
42
|
+
const index = list.findIndex((item) => item?.ID === message?.ID);
|
|
43
|
+
list[index] = message;
|
|
44
|
+
return list;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const handleRemoveMessage = (
|
|
48
|
+
messageList: Array<Message>,
|
|
49
|
+
message: Message,
|
|
50
|
+
) => {
|
|
51
|
+
const list = [...messageList];
|
|
52
|
+
const index = list.findIndex((item) => item?.ID === message?.ID);
|
|
53
|
+
list.splice(index, 1);
|
|
54
|
+
return list;
|
|
55
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { Conversation } from 'tim-js-sdk';
|
|
3
|
+
import { useTUIChatStateContext } from '../../context/TUIChatStateContext';
|
|
4
|
+
import type { TUIChatHeaderDefaultProps } from './TUIChatHeaderDefault';
|
|
5
|
+
import { TUIChatHeaderDefault } from './TUIChatHeaderDefault';
|
|
6
|
+
|
|
7
|
+
import './styles/index.scss';
|
|
8
|
+
import { useComponentContext } from '../../context';
|
|
9
|
+
|
|
10
|
+
interface TUIChatHeaderProps {
|
|
11
|
+
title?: string,
|
|
12
|
+
TUIChatHeader?: React.ComponentType<TUIChatHeaderDefaultProps>,
|
|
13
|
+
conversation?: Conversation,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function UnMemoizedTUIChatHeader<T extends TUIChatHeaderProps>(
|
|
17
|
+
props: PropsWithChildren<T>,
|
|
18
|
+
):React.ReactElement {
|
|
19
|
+
const {
|
|
20
|
+
title,
|
|
21
|
+
conversation: propsConversation,
|
|
22
|
+
TUIChatHeader: propTUIChatHeader,
|
|
23
|
+
} = props;
|
|
24
|
+
|
|
25
|
+
const { conversation: contextConversation } = useTUIChatStateContext('TUIChatHeader');
|
|
26
|
+
const { TUIChatHeader: ContextTUIChatHeader } = useComponentContext('TUIChatHeader');
|
|
27
|
+
|
|
28
|
+
const TUIChatHeaderUIComponent = propTUIChatHeader
|
|
29
|
+
|| ContextTUIChatHeader || TUIChatHeaderDefault;
|
|
30
|
+
const conversation = propsConversation || contextConversation;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<TUIChatHeaderUIComponent
|
|
34
|
+
title={title}
|
|
35
|
+
conversation={conversation}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const TUIChatHeader = React.memo(UnMemoizedTUIChatHeader) as
|
|
41
|
+
typeof UnMemoizedTUIChatHeader;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React, { PropsWithChildren, useEffect, useState } from 'react';
|
|
2
|
+
import TIM, { Conversation, Group, Profile } from 'tim-js-sdk';
|
|
3
|
+
import { Avatar } from '../Avatar';
|
|
4
|
+
import { handleDisplayAvatar } from '../untils';
|
|
5
|
+
|
|
6
|
+
import './styles/index.scss';
|
|
7
|
+
import { Icon, IconTypes } from '../Icon';
|
|
8
|
+
import { useTUIKitContext } from '../../context';
|
|
9
|
+
|
|
10
|
+
export interface TUIChatHeaderDefaultProps {
|
|
11
|
+
title?: string,
|
|
12
|
+
avatar?: string,
|
|
13
|
+
isOnline?: boolean,
|
|
14
|
+
conversation?: Conversation,
|
|
15
|
+
pluginComponentList?: Array<React.ComponentType>,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function TUIChatHeaderDefaultWithContext <T extends TUIChatHeaderDefaultProps>(
|
|
19
|
+
props: PropsWithChildren<T>,
|
|
20
|
+
):React.ReactElement {
|
|
21
|
+
const {
|
|
22
|
+
title: propTitle,
|
|
23
|
+
avatar: propAvatar,
|
|
24
|
+
isOnline,
|
|
25
|
+
conversation,
|
|
26
|
+
} = props;
|
|
27
|
+
|
|
28
|
+
const [title, setTitle] = useState('');
|
|
29
|
+
const [avatar, setAvatar] = useState('');
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
setTitle(propTitle);
|
|
33
|
+
setAvatar(propAvatar);
|
|
34
|
+
switch (conversation?.type) {
|
|
35
|
+
case TIM.TYPES.CONV_C2C:
|
|
36
|
+
handleC2C(conversation.userProfile);
|
|
37
|
+
break;
|
|
38
|
+
case TIM.TYPES.CONV_GROUP:
|
|
39
|
+
handleGroup(conversation.groupProfile);
|
|
40
|
+
break;
|
|
41
|
+
case TIM.TYPES.CONV_SYSTEM:
|
|
42
|
+
setTitle('System Notice');
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
setTitle('');
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}, [conversation]);
|
|
49
|
+
|
|
50
|
+
const handleC2C = (userProfile: Profile) => {
|
|
51
|
+
if (!title) {
|
|
52
|
+
setTitle(userProfile?.nick || userProfile?.userID);
|
|
53
|
+
}
|
|
54
|
+
if (!avatar) {
|
|
55
|
+
setAvatar(handleDisplayAvatar(userProfile.avatar));
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const handleGroup = (groupProfile: Group) => {
|
|
60
|
+
if (!title) {
|
|
61
|
+
setTitle(groupProfile?.name || groupProfile?.groupID);
|
|
62
|
+
}
|
|
63
|
+
if (!avatar) {
|
|
64
|
+
setAvatar(handleDisplayAvatar(groupProfile.avatar, TIM.TYPES.CONV_GROUP));
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const { setTUIManageShow } = useTUIKitContext();
|
|
68
|
+
const openTUIManage = () => {
|
|
69
|
+
setTUIManageShow(true);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<header className="tui-chat-header" key={conversation?.conversationID}>
|
|
74
|
+
<div className={`tui-chat-header-left ${conversation?.type === TIM.TYPES.CONV_SYSTEM ? 'system' : ''}`}>
|
|
75
|
+
{conversation?.type !== TIM.TYPES.CONV_SYSTEM && <Avatar size={32} image={avatar} />}
|
|
76
|
+
<div className="header-content">
|
|
77
|
+
<h3 className="title">{title}</h3>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
<div className="tui-chat-header-right">
|
|
81
|
+
<div className="header-handle">
|
|
82
|
+
<Icon className="header-handle-more" onClick={openTUIManage} type={IconTypes.ELLIPSE} width={18} height={5} />
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
</header>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const MemoizedTUIChatHeaderDefault = React.memo(TUIChatHeaderDefaultWithContext) as
|
|
91
|
+
typeof TUIChatHeaderDefaultWithContext;
|
|
92
|
+
|
|
93
|
+
export function TUIChatHeaderDefault(props: TUIChatHeaderDefaultProps)
|
|
94
|
+
:React.ReactElement {
|
|
95
|
+
const options = { ...props };
|
|
96
|
+
return <MemoizedTUIChatHeaderDefault {...options} />;
|
|
97
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.tui-chat-header {
|
|
2
|
+
padding: 16px 20px;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
justify-content: space-between;
|
|
6
|
+
align-items: center;
|
|
7
|
+
&-left {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
.header-content {
|
|
11
|
+
padding: 0 8px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
&-right {
|
|
16
|
+
.header-handle {
|
|
17
|
+
&-more {
|
|
18
|
+
padding: 10px 3px;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
.title {
|
|
23
|
+
font-family: 'SF Pro Text';
|
|
24
|
+
font-style: normal;
|
|
25
|
+
font-weight: 700;
|
|
26
|
+
font-size: 14px;
|
|
27
|
+
line-height: 17px;
|
|
28
|
+
}
|
|
29
|
+
.system {
|
|
30
|
+
height: 32px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { PropsWithChildren, useMemo } from 'react';
|
|
2
|
+
import { TUIConversationProvider, TUIConversationContextValue } from '../../context/TUIConversationContext';
|
|
3
|
+
import { TUIConversationList } from '../TUIConversationList';
|
|
4
|
+
import { TUIProfile } from '../TUIProfile';
|
|
5
|
+
|
|
6
|
+
interface TUIConversationProps {
|
|
7
|
+
createConversation?:(conversationID:string) => Promise<any>,
|
|
8
|
+
deleteConversation?:(conversationID:string) => Promise<any>,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function UnMemoizedTUIConversation<T extends TUIConversationProps>(
|
|
12
|
+
props: PropsWithChildren<T>,
|
|
13
|
+
):React.ReactElement {
|
|
14
|
+
const {
|
|
15
|
+
children,
|
|
16
|
+
createConversation,
|
|
17
|
+
deleteConversation,
|
|
18
|
+
} = props;
|
|
19
|
+
const TUIConversationValue: TUIConversationContextValue = useMemo(
|
|
20
|
+
() => ({
|
|
21
|
+
createConversation,
|
|
22
|
+
deleteConversation,
|
|
23
|
+
}),
|
|
24
|
+
[
|
|
25
|
+
createConversation,
|
|
26
|
+
deleteConversation,
|
|
27
|
+
],
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<TUIConversationProvider value={TUIConversationValue}>
|
|
32
|
+
{children || (
|
|
33
|
+
<>
|
|
34
|
+
<TUIConversationList />
|
|
35
|
+
<TUIProfile />
|
|
36
|
+
</>
|
|
37
|
+
)}
|
|
38
|
+
</TUIConversationProvider>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const TUIConversation = React.memo(
|
|
43
|
+
UnMemoizedTUIConversation,
|
|
44
|
+
)as typeof UnMemoizedTUIConversation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TUIConversation';
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import React, { useRef, useState } from 'react';
|
|
2
|
+
import { Conversation } from 'tim-js-sdk';
|
|
3
|
+
import { useTUIKitContext } from '../../context';
|
|
4
|
+
import useConversationList from './hooks/useConversationList';
|
|
5
|
+
import './index.scss';
|
|
6
|
+
import { ConversationPreview, ConversationPreviewUIComponentProps } from '../ConversationPreview';
|
|
7
|
+
import {
|
|
8
|
+
ConversationListContainer,
|
|
9
|
+
ConversationListContainerProps,
|
|
10
|
+
} from '../ConversationPreview/ConversationListContainer';
|
|
11
|
+
import { Profile } from '../Profile';
|
|
12
|
+
import { ConversationSearchInput, ConversationSearchResult } from '../ConversationSearch';
|
|
13
|
+
import { ConversationCreate } from '../ConversationCreate';
|
|
14
|
+
import { Icon, IconTypes } from '../Icon';
|
|
15
|
+
import { getDisplayTitle } from '../ConversationPreview/utils';
|
|
16
|
+
import { useConversationUpdate } from './hooks/useConversationUpdate';
|
|
17
|
+
|
|
18
|
+
interface Props {
|
|
19
|
+
filters?: object,
|
|
20
|
+
sort?: object,
|
|
21
|
+
options?: object,
|
|
22
|
+
Preview?: React.ComponentType<ConversationPreviewUIComponentProps>,
|
|
23
|
+
Container?: React.ComponentType<ConversationListContainerProps>,
|
|
24
|
+
onConversationListUpdated?: (
|
|
25
|
+
setConversationList: React.Dispatch<React.SetStateAction<Array<Conversation>>>,
|
|
26
|
+
event: () => void
|
|
27
|
+
) => void,
|
|
28
|
+
}
|
|
29
|
+
export function UnMemoTUIConversationList<T extends Props>(props: T):React.ReactElement {
|
|
30
|
+
const {
|
|
31
|
+
Preview,
|
|
32
|
+
Container = ConversationListContainer,
|
|
33
|
+
onConversationListUpdated,
|
|
34
|
+
} = props;
|
|
35
|
+
const {
|
|
36
|
+
tim, customClasses, conversation, setActiveConversation, setTUIProfileShow,
|
|
37
|
+
} = useTUIKitContext('TUIConversationList');
|
|
38
|
+
const [conversationUpdateCount, setConversationUpdateCount] = useState(0);
|
|
39
|
+
const forceUpdate = () => setConversationUpdateCount((count) => count + 1);
|
|
40
|
+
|
|
41
|
+
const activeConversationHandler = (
|
|
42
|
+
conversationList: Array<Conversation>,
|
|
43
|
+
setConversationList: React.Dispatch<React.SetStateAction<Array<Conversation>>>,
|
|
44
|
+
) => {
|
|
45
|
+
if (!conversationList.length) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
setActiveConversation(conversation);
|
|
49
|
+
};
|
|
50
|
+
const {
|
|
51
|
+
conversationList,
|
|
52
|
+
setConversationList,
|
|
53
|
+
} = useConversationList(tim, activeConversationHandler);
|
|
54
|
+
useConversationUpdate(setConversationList, onConversationListUpdated, forceUpdate);
|
|
55
|
+
const [searchValue, setSearchValue] = useState('');
|
|
56
|
+
const [searchResult, setSearchResult] = useState(conversationList);
|
|
57
|
+
const [conversationCreated, setConversationCreated] = useState(false);
|
|
58
|
+
|
|
59
|
+
const handleSearchValueChange = (e) => {
|
|
60
|
+
setSearchValue(e.target?.value);
|
|
61
|
+
if (e.target?.value) {
|
|
62
|
+
const result = conversationList.filter(
|
|
63
|
+
// eslint-disable-next-line max-len
|
|
64
|
+
(item) => (getDisplayTitle(item) as string).toLocaleLowerCase().includes(e.target?.value.toLocaleLowerCase()),
|
|
65
|
+
);
|
|
66
|
+
setSearchResult(result);
|
|
67
|
+
} else {
|
|
68
|
+
setSearchResult([]);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const handleConversationCreate = () => {
|
|
73
|
+
setSearchValue('');
|
|
74
|
+
setConversationCreated(true);
|
|
75
|
+
};
|
|
76
|
+
const { myProfile } = useTUIKitContext();
|
|
77
|
+
const conversationListRef = useRef(null);
|
|
78
|
+
return (
|
|
79
|
+
<div className={`tui-conversation ${customClasses || ''}`} ref={conversationListRef}>
|
|
80
|
+
{
|
|
81
|
+
conversationCreated
|
|
82
|
+
? (
|
|
83
|
+
<ConversationCreate
|
|
84
|
+
conversationList={conversationList}
|
|
85
|
+
setConversationCreated={setConversationCreated}
|
|
86
|
+
/>
|
|
87
|
+
)
|
|
88
|
+
: (
|
|
89
|
+
<>
|
|
90
|
+
<Profile profile={myProfile} handleAvatar={() => { setTUIProfileShow(true); }} />
|
|
91
|
+
<div className="tui-conversation-header">
|
|
92
|
+
<ConversationSearchInput
|
|
93
|
+
value={searchValue}
|
|
94
|
+
clearable
|
|
95
|
+
onChange={handleSearchValueChange}
|
|
96
|
+
/>
|
|
97
|
+
<div className="tui-conversation-create-icon">
|
|
98
|
+
<Icon
|
|
99
|
+
onClick={handleConversationCreate}
|
|
100
|
+
type={IconTypes.CREATE}
|
|
101
|
+
height={24}
|
|
102
|
+
width={24}
|
|
103
|
+
/>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
<Container setConversationList={setConversationList}>
|
|
107
|
+
{/* eslint-disable-next-line no-nested-ternary */}
|
|
108
|
+
{conversationList.length === 0
|
|
109
|
+
? (
|
|
110
|
+
<div className="no-result">
|
|
111
|
+
<Icon className="no-result-icon" type={IconTypes.EFFORT} width={42} height={42} />
|
|
112
|
+
<div className="no-result-message">No conversation</div>
|
|
113
|
+
</div>
|
|
114
|
+
)
|
|
115
|
+
: searchValue
|
|
116
|
+
? (
|
|
117
|
+
<ConversationSearchResult
|
|
118
|
+
Preview={Preview}
|
|
119
|
+
searchValue={searchValue}
|
|
120
|
+
result={searchResult}
|
|
121
|
+
/>
|
|
122
|
+
)
|
|
123
|
+
: conversationList.map((item) => {
|
|
124
|
+
const previewProps = {
|
|
125
|
+
activeConversation: conversation,
|
|
126
|
+
conversation: item,
|
|
127
|
+
setActiveConversation,
|
|
128
|
+
Preview,
|
|
129
|
+
conversationUpdateCount,
|
|
130
|
+
};
|
|
131
|
+
return (
|
|
132
|
+
<ConversationPreview key={item.conversationID} {...previewProps} />
|
|
133
|
+
);
|
|
134
|
+
})}
|
|
135
|
+
</Container>
|
|
136
|
+
</>
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
export const TUIConversationList = React.memo(UnMemoTUIConversationList);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import TIM, { ChatSDK, Conversation } from 'tim-js-sdk';
|
|
3
|
+
|
|
4
|
+
function useConversationList(
|
|
5
|
+
tim: ChatSDK,
|
|
6
|
+
activeConversationHandler?:(
|
|
7
|
+
conversationList: Array<Conversation>,
|
|
8
|
+
setConversationList: React.Dispatch<React.SetStateAction<Array<Conversation>>>,
|
|
9
|
+
) => void,
|
|
10
|
+
) {
|
|
11
|
+
const [conversationList, setConversationList] = useState<Array<Conversation>>([]);
|
|
12
|
+
const queryConversation = async (queryType?: string) => {
|
|
13
|
+
if (queryType === 'reload') {
|
|
14
|
+
setConversationList([]);
|
|
15
|
+
}
|
|
16
|
+
const offset = queryType === 'reload' ? 0 : conversationList.length;
|
|
17
|
+
|
|
18
|
+
const res = await tim?.getConversationList();
|
|
19
|
+
if (res?.code === 0) {
|
|
20
|
+
const resConversationList = res.data.conversationList.filter(
|
|
21
|
+
(item) => item.type !== TIM.TYPES.CONV_SYSTEM,
|
|
22
|
+
);
|
|
23
|
+
const newConversationList = queryType === 'reload'
|
|
24
|
+
? resConversationList
|
|
25
|
+
: [...conversationList, resConversationList];
|
|
26
|
+
setConversationList(newConversationList);
|
|
27
|
+
if (!offset && activeConversationHandler) {
|
|
28
|
+
activeConversationHandler(newConversationList, setConversationList);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
queryConversation('reload');
|
|
34
|
+
}, [tim]);
|
|
35
|
+
return {
|
|
36
|
+
conversationList,
|
|
37
|
+
setConversationList,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default useConversationList;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import TIM, { Conversation } from 'tim-js-sdk';
|
|
3
|
+
import { useTUIKitContext } from '../../../context';
|
|
4
|
+
|
|
5
|
+
export const useConversationUpdate = (
|
|
6
|
+
setConversationList?: React.Dispatch<React.SetStateAction<Array<Conversation>>>,
|
|
7
|
+
customHandler?: (
|
|
8
|
+
setConversationList: React.Dispatch<React.SetStateAction<Array<Conversation>>>,
|
|
9
|
+
event: any
|
|
10
|
+
) => void,
|
|
11
|
+
forceUpdate?: () => void,
|
|
12
|
+
) => {
|
|
13
|
+
const { tim } = useTUIKitContext('useConversationUpdate');
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const onConversationListUpdated = (event:any) => {
|
|
16
|
+
if (setConversationList) {
|
|
17
|
+
setConversationList(event.data.filter(
|
|
18
|
+
(item) => item.type !== TIM.TYPES.CONV_SYSTEM,
|
|
19
|
+
));
|
|
20
|
+
}
|
|
21
|
+
if (forceUpdate) {
|
|
22
|
+
forceUpdate();
|
|
23
|
+
}
|
|
24
|
+
if (customHandler && typeof customHandler === 'function') {
|
|
25
|
+
customHandler(setConversationList, event);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
tim?.on(TIM.EVENT.CONVERSATION_LIST_UPDATED, onConversationListUpdated);
|
|
29
|
+
return () => {
|
|
30
|
+
tim?.off(TIM.EVENT.CONVERSATION_LIST_UPDATED, onConversationListUpdated);
|
|
31
|
+
};
|
|
32
|
+
}, [tim, customHandler]);
|
|
33
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.tui-conversation {
|
|
2
|
+
height: 100%;
|
|
3
|
+
min-width: 360px;
|
|
4
|
+
max-width: 400px;
|
|
5
|
+
width: 30%;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
position: relative;
|
|
9
|
+
border-right: 1px solid #F9FAFB;
|
|
10
|
+
text-align: initial;
|
|
11
|
+
.tui-conversation-header {
|
|
12
|
+
display: flex;
|
|
13
|
+
padding: 10px 20px;
|
|
14
|
+
.tui-conversation-create-icon {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
margin-left: 10px;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
.no-result {
|
|
22
|
+
padding: 0 20px;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
align-items: center;
|
|
26
|
+
&-icon {
|
|
27
|
+
margin: 100px auto 50px;
|
|
28
|
+
}
|
|
29
|
+
&-message {
|
|
30
|
+
color: #999999;
|
|
31
|
+
font-weight: 400;
|
|
32
|
+
font-size: 16px;
|
|
33
|
+
line-height: 22px;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { ChatSDK } from 'tim-js-sdk';
|
|
3
|
+
import { useTUIKit } from './hooks/useTUIKit';
|
|
4
|
+
import { useCreateTUIKitContext } from './hooks/useCreateTUIKitContext';
|
|
5
|
+
import { TUIKitProvider } from '../../context/TUIKitContext';
|
|
6
|
+
import './styles/index.scss';
|
|
7
|
+
import { TUIConversation } from '../TUIConversation';
|
|
8
|
+
import { TUIChat } from '../TUIChat';
|
|
9
|
+
import { TUIManage } from '../TUIManage';
|
|
10
|
+
|
|
11
|
+
export interface ChatProps {
|
|
12
|
+
tim?: ChatSDK | null,
|
|
13
|
+
customClasses?: unknown
|
|
14
|
+
}
|
|
15
|
+
export function TUIKit<
|
|
16
|
+
T extends ChatProps
|
|
17
|
+
>(
|
|
18
|
+
props:PropsWithChildren<T>,
|
|
19
|
+
):React.ReactElement {
|
|
20
|
+
const { children, tim, customClasses } = props;
|
|
21
|
+
(window as any).tencent_cloud_im_csig_react_uikit_23F_xa = true;
|
|
22
|
+
const {
|
|
23
|
+
conversation,
|
|
24
|
+
setActiveConversation,
|
|
25
|
+
myProfile,
|
|
26
|
+
TUIManageShow,
|
|
27
|
+
setTUIManageShow,
|
|
28
|
+
TUIProfileShow,
|
|
29
|
+
setTUIProfileShow,
|
|
30
|
+
} = useTUIKit({ tim });
|
|
31
|
+
const chatContextValue = useCreateTUIKitContext({
|
|
32
|
+
tim,
|
|
33
|
+
conversation,
|
|
34
|
+
setActiveConversation,
|
|
35
|
+
customClasses,
|
|
36
|
+
myProfile,
|
|
37
|
+
TUIManageShow,
|
|
38
|
+
setTUIManageShow,
|
|
39
|
+
TUIProfileShow,
|
|
40
|
+
setTUIProfileShow,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<TUIKitProvider value={chatContextValue}>
|
|
45
|
+
<div className="tui-kit">
|
|
46
|
+
{children || (
|
|
47
|
+
<>
|
|
48
|
+
<TUIConversation />
|
|
49
|
+
<TUIChat />
|
|
50
|
+
<TUIManage />
|
|
51
|
+
</>
|
|
52
|
+
)}
|
|
53
|
+
</div>
|
|
54
|
+
</TUIKitProvider>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { TUIKitContextValue } from '../../../context/TUIKitContext';
|
|
3
|
+
|
|
4
|
+
export const useCreateTUIKitContext = (value:TUIKitContextValue) => {
|
|
5
|
+
const {
|
|
6
|
+
tim,
|
|
7
|
+
conversation,
|
|
8
|
+
customClasses,
|
|
9
|
+
setActiveConversation,
|
|
10
|
+
myProfile,
|
|
11
|
+
TUIManageShow,
|
|
12
|
+
setTUIManageShow,
|
|
13
|
+
TUIProfileShow,
|
|
14
|
+
setTUIProfileShow,
|
|
15
|
+
} = value;
|
|
16
|
+
|
|
17
|
+
const TUIKitContext = useMemo(
|
|
18
|
+
() => ({
|
|
19
|
+
tim,
|
|
20
|
+
conversation,
|
|
21
|
+
customClasses,
|
|
22
|
+
setActiveConversation,
|
|
23
|
+
myProfile,
|
|
24
|
+
TUIManageShow,
|
|
25
|
+
setTUIManageShow,
|
|
26
|
+
TUIProfileShow,
|
|
27
|
+
setTUIProfileShow,
|
|
28
|
+
}),
|
|
29
|
+
[
|
|
30
|
+
conversation,
|
|
31
|
+
customClasses,
|
|
32
|
+
tim,
|
|
33
|
+
TUIManageShow,
|
|
34
|
+
TUIProfileShow,
|
|
35
|
+
setTUIProfileShow,
|
|
36
|
+
myProfile,
|
|
37
|
+
],
|
|
38
|
+
);
|
|
39
|
+
return TUIKitContext;
|
|
40
|
+
};
|