@tencentcloud/chat-uikit-react 2.2.7 → 2.2.9
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/CHANGELOG.md +6 -0
- package/dist/cjs/components/Avatar/Avatar.d.ts +1 -1
- package/dist/cjs/components/{TUIChat/TUIChat.d.ts → Chat/Chat.d.ts} +8 -8
- package/dist/cjs/components/Chat/Chat.js +1 -0
- package/dist/cjs/components/Chat/index.js +1 -0
- package/dist/cjs/components/{TUIChatHeader/TUIChatHeader.d.ts → ChatHeader/ChatHeader.d.ts} +3 -3
- package/dist/cjs/components/ChatHeader/ChatHeader.js +1 -0
- package/dist/cjs/components/{TUIChatHeader/TUIChatHeaderDefault.d.ts → ChatHeader/ChatHeaderDefault.d.ts} +2 -2
- package/dist/cjs/components/ChatHeader/ChatHeaderDefault.js +1 -0
- package/dist/cjs/components/ChatSetting/ChatSetting.d.ts +6 -0
- package/dist/cjs/components/ChatSetting/ChatSetting.js +1 -0
- package/dist/cjs/components/Contact/Contact.d.ts +6 -0
- package/dist/cjs/components/Contact/Contact.js +1 -0
- package/dist/cjs/components/Contact/ContactInfo/ContactInfo.d.ts +10 -0
- package/dist/cjs/components/Contact/ContactInfo/ContactInfo.js +1 -0
- package/dist/cjs/components/Contact/ContactInfo/basicInfo.js +1 -0
- package/dist/cjs/components/Contact/ContactInfo/blockInfo.js +1 -0
- package/dist/cjs/components/Contact/ContactInfo/friendApplication.js +1 -0
- package/dist/cjs/components/Contact/ContactInfo/friendInfo.js +1 -0
- package/dist/cjs/components/Contact/ContactInfo/groupInfo.js +1 -0
- package/dist/cjs/components/Contact/ContactInfo/hooks/useContactInfo.js +1 -0
- package/dist/cjs/components/Contact/ContactList/ContactList.d.ts +6 -0
- package/dist/cjs/components/Contact/ContactList/ContactList.js +1 -0
- package/dist/cjs/components/Contact/hooks/useTUIContact.js +1 -0
- package/dist/cjs/components/ContactSearch/ContactSearch.js +1 -0
- package/dist/cjs/components/ContactSearch/hooks/useContactSearch.js +1 -0
- package/dist/cjs/components/ConversationActions/ConversationActions.d.ts +52 -0
- package/dist/cjs/components/ConversationActions/ConversationActions.js +1 -0
- package/dist/cjs/components/ConversationCreate/ConversationCreate.d.ts +21 -0
- package/dist/cjs/components/ConversationCreate/ConversationCreate.js +1 -1
- package/dist/cjs/components/ConversationCreate/ConversationCreateButton.d.ts +13 -0
- package/dist/cjs/components/ConversationCreate/ConversationCreateButton.js +1 -0
- package/dist/cjs/components/ConversationCreate/ConversationCreateGroupDetail.d.ts +16 -0
- package/dist/cjs/components/ConversationCreate/ConversationCreateGroupDetail.js +1 -0
- package/dist/cjs/components/ConversationCreate/ConversationCreateSelectView.d.ts +15 -0
- package/dist/cjs/components/ConversationCreate/ConversationCreateUserSelectList.d.ts +18 -0
- package/dist/cjs/components/ConversationCreate/ConversationCreateUserSelectList.js +1 -1
- package/dist/cjs/components/ConversationCreate/ConversationGroupTypeInfo.d.ts +24 -0
- package/dist/cjs/components/ConversationCreate/ConversationGroupTypeInfo.js +1 -1
- package/dist/cjs/components/ConversationCreate/hooks/useConversationCreate.d.ts +14 -0
- package/dist/cjs/components/ConversationCreate/hooks/useConversationCreate.js +1 -1
- package/dist/cjs/components/ConversationList/ConversationList.d.ts +57 -0
- package/dist/cjs/components/ConversationList/ConversationList.js +1 -0
- package/dist/cjs/components/ConversationList/ConversationListContent/ConversationListContent.d.ts +23 -0
- package/dist/cjs/components/ConversationList/ConversationListContent/ConversationListContent.js +1 -0
- package/dist/cjs/components/ConversationList/ConversationListHeader/ConversationListHeader.d.ts +15 -0
- package/dist/cjs/components/ConversationList/ConversationListHeader/ConversationListHeader.js +1 -0
- package/dist/cjs/components/ConversationPreview/ConversationPreview.d.ts +39 -27
- package/dist/cjs/components/ConversationPreview/ConversationPreview.js +1 -1
- package/dist/cjs/components/ConversationPreview/utils.js +1 -1
- package/dist/cjs/components/ConversationSearch/ConversationSearch.d.ts +39 -0
- package/dist/cjs/components/ConversationSearch/ConversationSearch.js +1 -0
- package/dist/cjs/components/ConversationSearch/ConversationSearchInput/ConversationSearchInput.d.ts +7 -0
- package/dist/cjs/components/ConversationSearch/ConversationSearchInput/ConversationSearchInput.js +1 -0
- package/dist/cjs/components/ConversationSearch/ConversationSearchResult/ConversationSearchResult.d.ts +29 -0
- package/dist/cjs/components/ConversationSearch/ConversationSearchResult/ConversationSearchResult.js +1 -0
- package/dist/cjs/components/Icon/Icon.js +1 -1
- package/dist/cjs/components/Icon/config.js +1 -1
- package/dist/cjs/components/Icon/images/mute.svg.js +1 -0
- package/dist/cjs/components/Icon/type.d.ts +2 -0
- package/dist/cjs/components/Icon/type.js +1 -1
- package/dist/cjs/components/Input/Input.d.ts +5 -2
- package/dist/cjs/components/Input/Input.js +1 -1
- package/dist/{esm/components/TUIMessage/TUIMessage.d.ts → cjs/components/MessageElement/Message.d.ts} +1 -1
- package/dist/cjs/components/MessageElement/Message.js +1 -0
- package/dist/cjs/components/MessageElement/MessageAudio.js +1 -0
- package/dist/cjs/components/MessageElement/MessageAvatar.js +1 -0
- package/dist/cjs/components/MessageElement/MessageBubble.js +1 -0
- package/dist/cjs/components/MessageElement/MessageContext.js +1 -0
- package/dist/cjs/components/MessageElement/MessageCustom.js +1 -0
- package/dist/cjs/components/MessageElement/MessageDefault.js +1 -0
- package/dist/cjs/components/MessageElement/MessageName.js +1 -0
- package/dist/cjs/components/MessageElement/MessagePlugins.js +1 -0
- package/dist/cjs/components/MessageElement/MessageProgress.js +1 -0
- package/dist/cjs/components/MessageElement/MessageRevoke.js +1 -0
- package/dist/cjs/components/MessageElement/MessageStatus.js +1 -0
- package/dist/cjs/components/MessageElement/MessageSystem.js +1 -0
- package/dist/cjs/components/MessageElement/MessageText.js +1 -0
- package/dist/cjs/components/MessageElement/MessageTip.js +1 -0
- package/dist/cjs/components/MessageElement/hooks/useMessageHandler.js +1 -0
- package/dist/cjs/components/MessageElement/hooks/useMessageReply.js +1 -0
- package/dist/cjs/components/MessageInput/EmojiPicker.js +1 -0
- package/dist/cjs/components/MessageInput/Forward.js +1 -0
- package/dist/cjs/components/MessageInput/InputPluginsDefalut.js +1 -0
- package/dist/cjs/components/MessageInput/InputQuoteDefalut.js +1 -0
- package/dist/cjs/components/{TUIMessageInput/TUIMessageInput.d.ts → MessageInput/MessageInput.d.ts} +4 -4
- package/dist/cjs/components/MessageInput/MessageInput.js +1 -0
- package/dist/cjs/components/MessageInput/MessageInputDefault.js +1 -0
- package/dist/cjs/components/MessageInput/Transmitter.js +1 -0
- package/dist/cjs/components/MessageInput/hooks/useEmojiPicker.js +1 -0
- package/dist/cjs/components/MessageInput/hooks/useHandleForwardMessage.js +1 -0
- package/dist/cjs/components/MessageInput/hooks/useHandleQuoteMessage.js +1 -0
- package/dist/cjs/components/MessageInput/hooks/useMessageInputText.js +1 -0
- package/dist/cjs/components/MessageInput/hooks/useUploadPicker.js +1 -0
- package/dist/cjs/components/{TUIMessageList/TUIMessageList.d.ts → MessageList/MessageList.d.ts} +3 -3
- package/dist/cjs/components/MessageList/MessageList.js +1 -0
- package/dist/cjs/components/MessageList/hooks/useMessageListElement.js +1 -0
- package/dist/cjs/components/PlaceHolder/index.d.ts +34 -0
- package/dist/cjs/components/PlaceHolder/index.js +1 -0
- package/dist/cjs/components/Plugins/index.d.ts +5 -2
- package/dist/cjs/components/Profile/Profile.d.ts +10 -0
- package/dist/cjs/components/Profile/Profile.js +1 -1
- package/dist/cjs/components/Profile/ProfileDefault.js +1 -0
- package/dist/cjs/components/Profile/myProfile/MyProfile.js +1 -0
- package/dist/cjs/context/{TUIChatActionContext.d.ts → ChatActionContext.d.ts} +1 -1
- package/dist/cjs/context/{TUIChatStateContext.d.ts → ChatStateContext.d.ts} +6 -6
- package/dist/cjs/context/ComponentContext.d.ts +3 -3
- package/dist/cjs/context/{TUIContactContext.d.ts → ContactContext.d.ts} +4 -4
- package/dist/cjs/context/ConversationListContext.d.ts +22 -0
- package/dist/cjs/context/ConversationListContext.js +1 -0
- package/dist/{esm/context/TUIMessageContext.d.ts → cjs/context/MessageContext.d.ts} +1 -1
- package/dist/{esm/context/TUIMessageInputContext.d.ts → cjs/context/MessageInputContext.d.ts} +4 -4
- package/dist/cjs/hooks/useConversation.d.ts +4 -23
- package/dist/cjs/hooks/useConversation.js +1 -1
- package/dist/cjs/hooks/useLongPress.d.ts +3 -0
- package/dist/cjs/hooks/useLongPress.js +1 -0
- package/dist/cjs/hooks/useMouseHover.js +1 -0
- package/dist/cjs/index.css +2 -1
- package/dist/cjs/index.d.css +885 -407
- package/dist/cjs/index.d.ts +41 -29
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/locales/en-US/TUIConversation.js +1 -1
- package/dist/cjs/locales/index.js +1 -1
- package/dist/cjs/locales/ja-JP/TUIConversation.js +1 -1
- package/dist/cjs/locales/ko-KR/TUIConversation.js +1 -1
- package/dist/cjs/locales/zh-CN/TUIConversation.js +1 -1
- package/dist/cjs/locales/zh-TW/TUIConversation.js +1 -1
- package/dist/esm/components/Avatar/Avatar.d.ts +1 -1
- package/dist/esm/components/{TUIChat/TUIChat.d.ts → Chat/Chat.d.ts} +8 -8
- package/dist/esm/components/Chat/Chat.js +1 -0
- package/dist/esm/components/Chat/index.js +1 -0
- package/dist/esm/components/{TUIChatHeader/TUIChatHeader.d.ts → ChatHeader/ChatHeader.d.ts} +3 -3
- package/dist/esm/components/ChatHeader/ChatHeader.js +1 -0
- package/dist/esm/components/{TUIChatHeader/TUIChatHeaderDefault.d.ts → ChatHeader/ChatHeaderDefault.d.ts} +2 -2
- package/dist/esm/components/ChatHeader/ChatHeaderDefault.js +1 -0
- package/dist/esm/components/ChatSetting/ChatSetting.d.ts +6 -0
- package/dist/esm/components/ChatSetting/ChatSetting.js +1 -0
- package/dist/esm/components/Contact/Contact.d.ts +6 -0
- package/dist/esm/components/Contact/Contact.js +1 -0
- package/dist/esm/components/Contact/ContactInfo/ContactInfo.d.ts +10 -0
- package/dist/esm/components/Contact/ContactInfo/ContactInfo.js +1 -0
- package/dist/esm/components/Contact/ContactInfo/basicInfo.js +1 -0
- package/dist/esm/components/Contact/ContactInfo/blockInfo.js +1 -0
- package/dist/esm/components/Contact/ContactInfo/friendApplication.js +1 -0
- package/dist/esm/components/Contact/ContactInfo/friendInfo.js +1 -0
- package/dist/esm/components/Contact/ContactInfo/groupInfo.js +1 -0
- package/dist/esm/components/Contact/ContactInfo/hooks/useContactInfo.js +1 -0
- package/dist/esm/components/Contact/ContactList/ContactList.d.ts +6 -0
- package/dist/esm/components/Contact/ContactList/ContactList.js +1 -0
- package/dist/esm/components/Contact/hooks/useTUIContact.js +1 -0
- package/dist/esm/components/ContactSearch/ContactSearch.js +1 -0
- package/dist/esm/components/ContactSearch/hooks/useContactSearch.js +1 -0
- package/dist/esm/components/ConversationActions/ConversationActions.d.ts +52 -0
- package/dist/esm/components/ConversationActions/ConversationActions.js +1 -0
- package/dist/esm/components/ConversationCreate/ConversationCreate.d.ts +21 -0
- package/dist/esm/components/ConversationCreate/ConversationCreate.js +1 -1
- package/dist/esm/components/ConversationCreate/ConversationCreateButton.d.ts +13 -0
- package/dist/esm/components/ConversationCreate/ConversationCreateButton.js +1 -0
- package/dist/esm/components/ConversationCreate/ConversationCreateGroupDetail.d.ts +16 -0
- package/dist/esm/components/ConversationCreate/ConversationCreateGroupDetail.js +1 -0
- package/dist/esm/components/ConversationCreate/ConversationCreateSelectView.d.ts +15 -0
- package/dist/esm/components/ConversationCreate/ConversationCreateUserSelectList.d.ts +18 -0
- package/dist/esm/components/ConversationCreate/ConversationCreateUserSelectList.js +1 -1
- package/dist/esm/components/ConversationCreate/ConversationGroupTypeInfo.d.ts +24 -0
- package/dist/esm/components/ConversationCreate/ConversationGroupTypeInfo.js +1 -1
- package/dist/esm/components/ConversationCreate/hooks/useConversationCreate.d.ts +14 -0
- package/dist/esm/components/ConversationCreate/hooks/useConversationCreate.js +1 -1
- package/dist/esm/components/ConversationList/ConversationList.d.ts +57 -0
- package/dist/esm/components/ConversationList/ConversationList.js +1 -0
- package/dist/esm/components/ConversationList/ConversationListContent/ConversationListContent.d.ts +23 -0
- package/dist/esm/components/ConversationList/ConversationListContent/ConversationListContent.js +1 -0
- package/dist/esm/components/ConversationList/ConversationListHeader/ConversationListHeader.d.ts +15 -0
- package/dist/esm/components/ConversationList/ConversationListHeader/ConversationListHeader.js +1 -0
- package/dist/esm/components/ConversationPreview/ConversationPreview.d.ts +39 -27
- package/dist/esm/components/ConversationPreview/ConversationPreview.js +1 -1
- package/dist/esm/components/ConversationPreview/utils.js +1 -1
- package/dist/esm/components/ConversationSearch/ConversationSearch.d.ts +39 -0
- package/dist/esm/components/ConversationSearch/ConversationSearch.js +1 -0
- package/dist/esm/components/ConversationSearch/ConversationSearchInput/ConversationSearchInput.d.ts +7 -0
- package/dist/esm/components/ConversationSearch/ConversationSearchInput/ConversationSearchInput.js +1 -0
- package/dist/esm/components/ConversationSearch/ConversationSearchResult/ConversationSearchResult.d.ts +29 -0
- package/dist/esm/components/ConversationSearch/ConversationSearchResult/ConversationSearchResult.js +1 -0
- package/dist/esm/components/Icon/Icon.js +1 -1
- package/dist/esm/components/Icon/config.js +1 -1
- package/dist/esm/components/Icon/images/mute.svg.js +1 -0
- package/dist/esm/components/Icon/type.d.ts +2 -0
- package/dist/esm/components/Icon/type.js +1 -1
- package/dist/esm/components/Input/Input.d.ts +5 -2
- package/dist/esm/components/Input/Input.js +1 -1
- package/dist/{cjs/components/TUIMessage/TUIMessage.d.ts → esm/components/MessageElement/Message.d.ts} +1 -1
- package/dist/esm/components/MessageElement/Message.js +1 -0
- package/dist/esm/components/MessageElement/MessageAudio.js +1 -0
- package/dist/esm/components/MessageElement/MessageAvatar.js +1 -0
- package/dist/esm/components/MessageElement/MessageBubble.js +1 -0
- package/dist/esm/components/MessageElement/MessageContext.js +1 -0
- package/dist/esm/components/MessageElement/MessageCustom.js +1 -0
- package/dist/esm/components/MessageElement/MessageDefault.js +1 -0
- package/dist/esm/components/MessageElement/MessageName.js +1 -0
- package/dist/esm/components/MessageElement/MessagePlugins.js +1 -0
- package/dist/esm/components/MessageElement/MessageProgress.js +1 -0
- package/dist/esm/components/MessageElement/MessageRevoke.js +1 -0
- package/dist/esm/components/MessageElement/MessageStatus.js +1 -0
- package/dist/esm/components/MessageElement/MessageSystem.js +1 -0
- package/dist/esm/components/MessageElement/MessageText.js +1 -0
- package/dist/esm/components/MessageElement/MessageTip.js +1 -0
- package/dist/esm/components/MessageElement/hooks/useMessageHandler.js +1 -0
- package/dist/esm/components/MessageElement/hooks/useMessageReply.js +1 -0
- package/dist/esm/components/MessageInput/EmojiPicker.js +1 -0
- package/dist/esm/components/MessageInput/Forward.js +1 -0
- package/dist/esm/components/MessageInput/InputPluginsDefalut.js +1 -0
- package/dist/esm/components/MessageInput/InputQuoteDefalut.js +1 -0
- package/dist/esm/components/{TUIMessageInput/TUIMessageInput.d.ts → MessageInput/MessageInput.d.ts} +4 -4
- package/dist/esm/components/MessageInput/MessageInput.js +1 -0
- package/dist/esm/components/MessageInput/MessageInputDefault.js +1 -0
- package/dist/esm/components/MessageInput/Transmitter.js +1 -0
- package/dist/esm/components/MessageInput/hooks/useEmojiPicker.js +1 -0
- package/dist/esm/components/MessageInput/hooks/useHandleForwardMessage.js +1 -0
- package/dist/esm/components/MessageInput/hooks/useHandleQuoteMessage.js +1 -0
- package/dist/esm/components/MessageInput/hooks/useMessageInputText.js +1 -0
- package/dist/esm/components/MessageInput/hooks/useUploadPicker.js +1 -0
- package/dist/esm/components/{TUIMessageList/TUIMessageList.d.ts → MessageList/MessageList.d.ts} +3 -3
- package/dist/esm/components/MessageList/MessageList.js +1 -0
- package/dist/esm/components/MessageList/hooks/useMessageListElement.js +1 -0
- package/dist/esm/components/PlaceHolder/index.d.ts +34 -0
- package/dist/esm/components/PlaceHolder/index.js +1 -0
- package/dist/esm/components/Plugins/index.d.ts +5 -2
- package/dist/esm/components/Profile/Profile.d.ts +10 -0
- package/dist/esm/components/Profile/Profile.js +1 -1
- package/dist/esm/components/Profile/ProfileDefault.js +1 -0
- package/dist/esm/components/Profile/myProfile/MyProfile.js +1 -0
- package/dist/esm/context/{TUIChatActionContext.d.ts → ChatActionContext.d.ts} +1 -1
- package/dist/esm/context/{TUIChatStateContext.d.ts → ChatStateContext.d.ts} +6 -6
- package/dist/esm/context/ComponentContext.d.ts +3 -3
- package/dist/esm/context/{TUIContactContext.d.ts → ContactContext.d.ts} +4 -4
- package/dist/esm/context/ConversationListContext.d.ts +22 -0
- package/dist/esm/context/ConversationListContext.js +1 -0
- package/dist/{cjs/context/TUIMessageContext.d.ts → esm/context/MessageContext.d.ts} +1 -1
- package/dist/{cjs/context/TUIMessageInputContext.d.ts → esm/context/MessageInputContext.d.ts} +4 -4
- package/dist/esm/hooks/useConversation.d.ts +4 -23
- package/dist/esm/hooks/useConversation.js +1 -1
- package/dist/esm/hooks/useLongPress.d.ts +3 -0
- package/dist/esm/hooks/useLongPress.js +1 -0
- package/dist/esm/hooks/useMouseHover.js +1 -0
- package/dist/esm/index.css +2 -1
- package/dist/esm/index.d.css +885 -407
- package/dist/esm/index.d.ts +41 -29
- package/dist/esm/index.js +1 -1
- package/dist/esm/locales/en-US/TUIConversation.js +1 -1
- package/dist/esm/locales/index.js +1 -1
- package/dist/esm/locales/ja-JP/TUIConversation.js +1 -1
- package/dist/esm/locales/ko-KR/TUIConversation.js +1 -1
- package/dist/esm/locales/zh-CN/TUIConversation.js +1 -1
- package/dist/esm/locales/zh-TW/TUIConversation.js +1 -1
- package/package.json +2 -1
- package/rollup.config.js +1 -1
- package/src/components/Avatar/Avatar.tsx +33 -31
- package/src/components/{TUIChat/TUIChat.tsx → Chat/Chat.tsx} +15 -15
- package/src/components/{TUIChat → Chat}/hooks/useHandleMessage.tsx +1 -1
- package/src/components/{TUIChat → Chat}/hooks/useHandleMessageList.tsx +1 -1
- package/src/components/{TUIChat → Chat}/index.ts +1 -1
- package/src/components/{TUIChatHeader/TUIChatHeader.tsx → ChatHeader/ChatHeader.tsx} +5 -5
- package/src/components/{TUIChatHeader/TUIChatHeaderDefault.tsx → ChatHeader/ChatHeaderDefault.tsx} +2 -2
- package/src/components/ChatHeader/index.ts +2 -0
- package/src/components/{TUIChatHeader → ChatHeader}/styles/layout.scss +0 -8
- package/src/components/{TUIManage/TUIManage.tsx → ChatSetting/ChatSetting.tsx} +17 -20
- package/src/components/ChatSetting/index.ts +1 -0
- package/src/components/{TUIManage → ChatSetting}/styles/index.scss +4 -2
- package/src/components/Checkbox/index.tsx +9 -9
- package/src/components/{TUIContact/TUIContact.tsx → Contact/Contact.tsx} +35 -35
- package/src/components/{TUIContact/TUIContactInfo/TUIContactInfo.tsx → Contact/ContactInfo/ContactInfo.tsx} +4 -4
- package/src/components/{TUIContact/TUIContactList/TUIContactList.tsx → Contact/ContactList/ContactList.tsx} +3 -3
- package/src/components/Contact/index.ts +3 -0
- package/src/components/{TUIContactSearch/TUIContactSearch.tsx → ContactSearch/ContactSearch.tsx} +8 -7
- package/src/components/ConversationActions/ConversationActions.scss +45 -0
- package/src/components/ConversationActions/ConversationActions.tsx +172 -0
- package/src/components/ConversationActions/index.ts +1 -0
- package/src/components/ConversationCreate/ConversationCreate.tsx +104 -49
- package/src/components/ConversationCreate/ConversationCreateButton.tsx +46 -0
- package/src/components/ConversationCreate/ConversationCreateGroupDetail.tsx +179 -0
- package/src/components/ConversationCreate/ConversationCreateSelectView.tsx +7 -7
- package/src/components/ConversationCreate/ConversationCreateUserSelectList.tsx +31 -29
- package/src/components/ConversationCreate/ConversationGroupTypeInfo.tsx +19 -19
- package/src/components/ConversationCreate/hooks/useConversationCreate.tsx +36 -29
- package/src/components/ConversationCreate/index.ts +2 -1
- package/src/components/ConversationCreate/styles/{ConversationCreatGroupDetail.scss → ConversationCreateGroupDetail.scss} +6 -1
- package/src/components/ConversationCreate/styles/conversationCreateButton.scss +5 -0
- package/src/components/ConversationCreate/styles/index.scss +34 -2
- package/src/components/ConversationList/ConversationList.scss +29 -0
- package/src/components/ConversationList/ConversationList.tsx +155 -0
- package/src/components/ConversationList/ConversationListContent/ConversationListContent.scss +16 -0
- package/src/components/ConversationList/ConversationListContent/ConversationListContent.tsx +63 -0
- package/src/components/ConversationList/ConversationListContent/index.ts +1 -0
- package/src/components/ConversationList/ConversationListHeader/ConversationListHeader.scss +28 -0
- package/src/components/ConversationList/ConversationListHeader/ConversationListHeader.tsx +43 -0
- package/src/components/ConversationList/ConversationListHeader/index.ts +1 -0
- package/src/components/ConversationList/index.ts +3 -0
- package/src/components/ConversationPreview/ConversationPreview.scss +137 -0
- package/src/components/ConversationPreview/ConversationPreview.tsx +245 -63
- package/src/components/ConversationPreview/index.ts +0 -1
- package/src/components/ConversationPreview/utils.tsx +78 -60
- package/src/components/ConversationSearch/ConversationSearch.scss +22 -0
- package/src/components/ConversationSearch/ConversationSearch.tsx +125 -0
- package/src/components/ConversationSearch/ConversationSearchInput/ConversationSearchInput.scss +13 -0
- package/src/components/ConversationSearch/ConversationSearchInput/ConversationSearchInput.tsx +42 -0
- package/src/components/ConversationSearch/ConversationSearchInput/index.ts +1 -0
- package/src/components/ConversationSearch/ConversationSearchResult/ConversationSearchResult.scss +15 -0
- package/src/components/ConversationSearch/ConversationSearchResult/ConversationSearchResult.tsx +72 -0
- package/src/components/ConversationSearch/ConversationSearchResult/index.ts +1 -0
- package/src/components/ConversationSearch/index.ts +3 -2
- package/src/components/EmptyStateIndicator/EmptyStateIndicator.tsx +2 -3
- package/src/components/Icon/Icon.tsx +8 -8
- package/src/components/Icon/config.ts +9 -0
- package/src/components/Icon/images/mute.svg +8 -0
- package/src/components/Icon/styles/index.scss +41 -6
- package/src/components/Icon/type.ts +2 -0
- package/src/components/Input/Input.tsx +24 -23
- package/src/components/{TUIMessage/TUIMessage.tsx → MessageElement/Message.tsx} +33 -33
- package/src/components/{TUIMessage → MessageElement}/MessageCustom.tsx +1 -1
- package/src/components/{TUIMessage/TUIMessageDefault.tsx → MessageElement/MessageDefault.tsx} +24 -24
- package/src/components/{TUIMessage → MessageElement}/MessagePlugins.tsx +18 -18
- package/src/components/{TUIMessage → MessageElement}/index.ts +1 -1
- package/src/components/{TUIMessage → MessageElement}/styles/layout.scss +1 -1
- package/src/components/{TUIMessageInput → MessageInput}/EmojiPicker.tsx +2 -2
- package/src/components/{TUIMessageInput/TUIForward.tsx → MessageInput/Forward.tsx} +41 -36
- package/src/components/{TUIMessageInput → MessageInput}/InputPluginsDefalut.tsx +2 -2
- package/src/components/{TUIMessageInput → MessageInput}/InputQuoteDefalut.tsx +1 -1
- package/src/components/{TUIMessageInput/TUIMessageInput.tsx → MessageInput/MessageInput.tsx} +25 -27
- package/src/components/{TUIMessageInput/TUIMessageInputDefault.tsx → MessageInput/MessageInputDefault.tsx} +14 -14
- package/src/components/{TUIMessageInput → MessageInput}/Transmitter.tsx +2 -2
- package/src/components/{TUIMessageInput → MessageInput}/hooks/useEmojiPicker.tsx +1 -1
- package/src/components/{TUIMessageInput → MessageInput}/hooks/useMessageInputState.tsx +1 -1
- package/src/components/{TUIMessageInput → MessageInput}/hooks/useMessageInputText.tsx +2 -2
- package/src/components/MessageInput/index.ts +3 -0
- package/src/components/{TUIMessageInput → MessageInput}/styles/color.scss +1 -1
- package/src/components/{TUIMessageList/TUIMessageList.tsx → MessageList/MessageList.tsx} +5 -5
- package/src/components/{TUIMessageList → MessageList}/hooks/useMessageListElement.tsx +1 -1
- package/src/components/MessageList/index.ts +1 -0
- package/src/components/PlaceHolder/index.tsx +79 -0
- package/src/components/PlaceHolder/styles/index.scss +36 -0
- package/src/components/Plugins/index.tsx +49 -45
- package/src/components/Profile/Profile.tsx +46 -21
- package/src/components/Profile/index.ts +2 -1
- package/src/components/Profile/myProfile/MyProfile.tsx +25 -0
- package/src/components/Profile/myProfile/index.ts +1 -0
- package/src/components/Profile/myProfile/styles/index.scss +32 -0
- package/src/components/Profile/styles/index.scss +2 -32
- package/src/components/{TUIProfile → Profile}/styles/layout.scss +1 -0
- package/src/components/index.ts +13 -11
- package/src/context/{TUIChatActionContext.tsx → ChatActionContext.tsx} +1 -1
- package/src/context/ChatStateContext.tsx +49 -0
- package/src/context/ComponentContext.tsx +13 -13
- package/src/context/{TUIContactContext.tsx → ContactContext.tsx} +10 -11
- package/src/context/ConversationListContext.tsx +113 -0
- package/src/context/LanguageContext.tsx +1 -0
- package/src/context/MessageContext.tsx +55 -0
- package/src/context/MessageInputContext.tsx +54 -0
- package/src/context/index.ts +6 -5
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useConversation.tsx +26 -74
- package/src/hooks/useLongPress.tsx +117 -0
- package/src/hooks/useMouseHover.tsx +21 -0
- package/src/locales/en-US/TUIConversation.ts +4 -0
- package/src/locales/index.ts +10 -0
- package/src/locales/ja-JP/TUIConversation.ts +4 -0
- package/src/locales/ko-KR/TUIConversation.ts +4 -0
- package/src/locales/zh-CN/TUIConversation.ts +4 -0
- package/src/locales/zh-TW/TUIConversation.ts +4 -0
- package/dist/cjs/components/ConversationCreate/ConversationCreatGroupDetail.js +0 -1
- package/dist/cjs/components/ConversationPreview/ConversationListContainer.d.ts +0 -10
- package/dist/cjs/components/ConversationPreview/ConversationListContainer.js +0 -1
- package/dist/cjs/components/ConversationPreview/ConversationPreviewContent.d.ts +0 -10
- package/dist/cjs/components/ConversationPreview/ConversationPreviewContent.js +0 -1
- package/dist/cjs/components/ConversationSearch/ConversationSearchInput.d.ts +0 -6
- package/dist/cjs/components/ConversationSearch/ConversationSearchInput.js +0 -1
- package/dist/cjs/components/ConversationSearch/ConversationSearchResult.d.ts +0 -12
- package/dist/cjs/components/ConversationSearch/ConversationSearchResult.js +0 -1
- package/dist/cjs/components/TUIChat/TUIChat.js +0 -1
- package/dist/cjs/components/TUIChat/index.js +0 -1
- package/dist/cjs/components/TUIChatHeader/TUIChatHeader.js +0 -1
- package/dist/cjs/components/TUIChatHeader/TUIChatHeaderDefault.js +0 -1
- package/dist/cjs/components/TUIContact/TUIContact.d.ts +0 -6
- package/dist/cjs/components/TUIContact/TUIContact.js +0 -1
- package/dist/cjs/components/TUIContact/TUIContactInfo/TUIContactInfo.d.ts +0 -10
- package/dist/cjs/components/TUIContact/TUIContactInfo/TUIContactInfo.js +0 -1
- package/dist/cjs/components/TUIContact/TUIContactInfo/basicInfo.js +0 -1
- package/dist/cjs/components/TUIContact/TUIContactInfo/blockInfo.js +0 -1
- package/dist/cjs/components/TUIContact/TUIContactInfo/friendApplication.js +0 -1
- package/dist/cjs/components/TUIContact/TUIContactInfo/friendInfo.js +0 -1
- package/dist/cjs/components/TUIContact/TUIContactInfo/groupInfo.js +0 -1
- package/dist/cjs/components/TUIContact/TUIContactInfo/hooks/useContactInfo.js +0 -1
- package/dist/cjs/components/TUIContact/TUIContactList/TUIContactList.d.ts +0 -6
- package/dist/cjs/components/TUIContact/TUIContactList/TUIContactList.js +0 -1
- package/dist/cjs/components/TUIContact/hooks/useTUIContact.js +0 -1
- package/dist/cjs/components/TUIContactSearch/TUIContactSearch.js +0 -1
- package/dist/cjs/components/TUIContactSearch/hooks/useContactSearch.js +0 -1
- package/dist/cjs/components/TUIConversation/TUIConversation.d.ts +0 -12
- package/dist/cjs/components/TUIConversation/TUIConversation.js +0 -1
- package/dist/cjs/components/TUIConversationList/TUIConversationList.d.ts +0 -19
- package/dist/cjs/components/TUIConversationList/TUIConversationList.js +0 -1
- package/dist/cjs/components/TUIConversationList/hooks/useConversationList.js +0 -1
- package/dist/cjs/components/TUIConversationList/hooks/useConversationUpdate.js +0 -1
- package/dist/cjs/components/TUIManage/TUIManage.d.ts +0 -6
- package/dist/cjs/components/TUIManage/TUIManage.js +0 -1
- package/dist/cjs/components/TUIMessage/MessageAudio.js +0 -1
- package/dist/cjs/components/TUIMessage/MessageAvatar.js +0 -1
- package/dist/cjs/components/TUIMessage/MessageBubble.js +0 -1
- package/dist/cjs/components/TUIMessage/MessageContext.js +0 -1
- package/dist/cjs/components/TUIMessage/MessageCustom.js +0 -1
- package/dist/cjs/components/TUIMessage/MessageName.js +0 -1
- package/dist/cjs/components/TUIMessage/MessagePlugins.js +0 -1
- package/dist/cjs/components/TUIMessage/MessageProgress.js +0 -1
- package/dist/cjs/components/TUIMessage/MessageRevoke.js +0 -1
- package/dist/cjs/components/TUIMessage/MessageStatus.js +0 -1
- package/dist/cjs/components/TUIMessage/MessageSystem.js +0 -1
- package/dist/cjs/components/TUIMessage/MessageText.js +0 -1
- package/dist/cjs/components/TUIMessage/MessageTip.js +0 -1
- package/dist/cjs/components/TUIMessage/TUIMessage.js +0 -1
- package/dist/cjs/components/TUIMessage/TUIMessageDefault.js +0 -1
- package/dist/cjs/components/TUIMessage/hooks/useMessageHandler.js +0 -1
- package/dist/cjs/components/TUIMessage/hooks/useMessageReply.js +0 -1
- package/dist/cjs/components/TUIMessageInput/EmojiPicker.js +0 -1
- package/dist/cjs/components/TUIMessageInput/InputPluginsDefalut.js +0 -1
- package/dist/cjs/components/TUIMessageInput/InputQuoteDefalut.js +0 -1
- package/dist/cjs/components/TUIMessageInput/TUIForward.js +0 -1
- package/dist/cjs/components/TUIMessageInput/TUIMessageInput.js +0 -1
- package/dist/cjs/components/TUIMessageInput/TUIMessageInputDefault.js +0 -1
- package/dist/cjs/components/TUIMessageInput/Transmitter.js +0 -1
- package/dist/cjs/components/TUIMessageInput/hooks/useEmojiPicker.js +0 -1
- package/dist/cjs/components/TUIMessageInput/hooks/useHandleForwardMessage.js +0 -1
- package/dist/cjs/components/TUIMessageInput/hooks/useHandleQuoteMessage.js +0 -1
- package/dist/cjs/components/TUIMessageInput/hooks/useMessageInputText.js +0 -1
- package/dist/cjs/components/TUIMessageInput/hooks/useUploadPicker.js +0 -1
- package/dist/cjs/components/TUIMessageList/TUIMessageList.js +0 -1
- package/dist/cjs/components/TUIMessageList/hooks/useMessageListElement.js +0 -1
- package/dist/cjs/components/TUIProfile/TUIProfile.d.ts +0 -10
- package/dist/cjs/components/TUIProfile/TUIProfile.js +0 -1
- package/dist/cjs/components/TUIProfile/TUIProfileDefault.js +0 -1
- package/dist/cjs/context/TUIConversationContext.js +0 -1
- package/dist/esm/components/ConversationCreate/ConversationCreatGroupDetail.js +0 -1
- package/dist/esm/components/ConversationPreview/ConversationListContainer.d.ts +0 -10
- package/dist/esm/components/ConversationPreview/ConversationListContainer.js +0 -1
- package/dist/esm/components/ConversationPreview/ConversationPreviewContent.d.ts +0 -10
- package/dist/esm/components/ConversationPreview/ConversationPreviewContent.js +0 -1
- package/dist/esm/components/ConversationSearch/ConversationSearchInput.d.ts +0 -6
- package/dist/esm/components/ConversationSearch/ConversationSearchInput.js +0 -1
- package/dist/esm/components/ConversationSearch/ConversationSearchResult.d.ts +0 -12
- package/dist/esm/components/ConversationSearch/ConversationSearchResult.js +0 -1
- package/dist/esm/components/TUIChat/TUIChat.js +0 -1
- package/dist/esm/components/TUIChat/index.js +0 -1
- package/dist/esm/components/TUIChatHeader/TUIChatHeader.js +0 -1
- package/dist/esm/components/TUIChatHeader/TUIChatHeaderDefault.js +0 -1
- package/dist/esm/components/TUIContact/TUIContact.d.ts +0 -6
- package/dist/esm/components/TUIContact/TUIContact.js +0 -1
- package/dist/esm/components/TUIContact/TUIContactInfo/TUIContactInfo.d.ts +0 -10
- package/dist/esm/components/TUIContact/TUIContactInfo/TUIContactInfo.js +0 -1
- package/dist/esm/components/TUIContact/TUIContactInfo/basicInfo.js +0 -1
- package/dist/esm/components/TUIContact/TUIContactInfo/blockInfo.js +0 -1
- package/dist/esm/components/TUIContact/TUIContactInfo/friendApplication.js +0 -1
- package/dist/esm/components/TUIContact/TUIContactInfo/friendInfo.js +0 -1
- package/dist/esm/components/TUIContact/TUIContactInfo/groupInfo.js +0 -1
- package/dist/esm/components/TUIContact/TUIContactInfo/hooks/useContactInfo.js +0 -1
- package/dist/esm/components/TUIContact/TUIContactList/TUIContactList.d.ts +0 -6
- package/dist/esm/components/TUIContact/TUIContactList/TUIContactList.js +0 -1
- package/dist/esm/components/TUIContact/hooks/useTUIContact.js +0 -1
- package/dist/esm/components/TUIContactSearch/TUIContactSearch.js +0 -1
- package/dist/esm/components/TUIContactSearch/hooks/useContactSearch.js +0 -1
- package/dist/esm/components/TUIConversation/TUIConversation.d.ts +0 -12
- package/dist/esm/components/TUIConversation/TUIConversation.js +0 -1
- package/dist/esm/components/TUIConversationList/TUIConversationList.d.ts +0 -19
- package/dist/esm/components/TUIConversationList/TUIConversationList.js +0 -1
- package/dist/esm/components/TUIConversationList/hooks/useConversationList.js +0 -1
- package/dist/esm/components/TUIConversationList/hooks/useConversationUpdate.js +0 -1
- package/dist/esm/components/TUIManage/TUIManage.d.ts +0 -6
- package/dist/esm/components/TUIManage/TUIManage.js +0 -1
- package/dist/esm/components/TUIMessage/MessageAudio.js +0 -1
- package/dist/esm/components/TUIMessage/MessageAvatar.js +0 -1
- package/dist/esm/components/TUIMessage/MessageBubble.js +0 -1
- package/dist/esm/components/TUIMessage/MessageContext.js +0 -1
- package/dist/esm/components/TUIMessage/MessageCustom.js +0 -1
- package/dist/esm/components/TUIMessage/MessageName.js +0 -1
- package/dist/esm/components/TUIMessage/MessagePlugins.js +0 -1
- package/dist/esm/components/TUIMessage/MessageProgress.js +0 -1
- package/dist/esm/components/TUIMessage/MessageRevoke.js +0 -1
- package/dist/esm/components/TUIMessage/MessageStatus.js +0 -1
- package/dist/esm/components/TUIMessage/MessageSystem.js +0 -1
- package/dist/esm/components/TUIMessage/MessageText.js +0 -1
- package/dist/esm/components/TUIMessage/MessageTip.js +0 -1
- package/dist/esm/components/TUIMessage/TUIMessage.js +0 -1
- package/dist/esm/components/TUIMessage/TUIMessageDefault.js +0 -1
- package/dist/esm/components/TUIMessage/hooks/useMessageHandler.js +0 -1
- package/dist/esm/components/TUIMessage/hooks/useMessageReply.js +0 -1
- package/dist/esm/components/TUIMessageInput/EmojiPicker.js +0 -1
- package/dist/esm/components/TUIMessageInput/InputPluginsDefalut.js +0 -1
- package/dist/esm/components/TUIMessageInput/InputQuoteDefalut.js +0 -1
- package/dist/esm/components/TUIMessageInput/TUIForward.js +0 -1
- package/dist/esm/components/TUIMessageInput/TUIMessageInput.js +0 -1
- package/dist/esm/components/TUIMessageInput/TUIMessageInputDefault.js +0 -1
- package/dist/esm/components/TUIMessageInput/Transmitter.js +0 -1
- package/dist/esm/components/TUIMessageInput/hooks/useEmojiPicker.js +0 -1
- package/dist/esm/components/TUIMessageInput/hooks/useHandleForwardMessage.js +0 -1
- package/dist/esm/components/TUIMessageInput/hooks/useHandleQuoteMessage.js +0 -1
- package/dist/esm/components/TUIMessageInput/hooks/useMessageInputText.js +0 -1
- package/dist/esm/components/TUIMessageInput/hooks/useUploadPicker.js +0 -1
- package/dist/esm/components/TUIMessageList/TUIMessageList.js +0 -1
- package/dist/esm/components/TUIMessageList/hooks/useMessageListElement.js +0 -1
- package/dist/esm/components/TUIProfile/TUIProfile.d.ts +0 -10
- package/dist/esm/components/TUIProfile/TUIProfile.js +0 -1
- package/dist/esm/components/TUIProfile/TUIProfileDefault.js +0 -1
- package/dist/esm/context/TUIConversationContext.js +0 -1
- package/src/components/ConversationCreate/ConversationCreatGroupDetail.tsx +0 -170
- package/src/components/ConversationPreview/ConversationListContainer.tsx +0 -20
- package/src/components/ConversationPreview/ConversationPreviewContent.tsx +0 -191
- package/src/components/ConversationPreview/styles/index.scss +0 -171
- package/src/components/ConversationSearch/ConversationSearchInput.tsx +0 -27
- package/src/components/ConversationSearch/ConversationSearchResult.tsx +0 -39
- package/src/components/ConversationSearch/styles/index.scss +0 -20
- package/src/components/TUIChatHeader/index.ts +0 -2
- package/src/components/TUIContact/index.ts +0 -3
- package/src/components/TUIConversation/TUIConversation.tsx +0 -46
- package/src/components/TUIConversation/index.ts +0 -1
- package/src/components/TUIConversationList/TUIConversationList.tsx +0 -178
- package/src/components/TUIConversationList/hooks/useConversationList.tsx +0 -42
- package/src/components/TUIConversationList/hooks/useConversationUpdate.tsx +0 -38
- package/src/components/TUIConversationList/index.scss +0 -58
- package/src/components/TUIConversationList/index.ts +0 -2
- package/src/components/TUIManage/index.ts +0 -1
- package/src/components/TUIMessageInput/index.ts +0 -3
- package/src/components/TUIMessageList/index.ts +0 -1
- package/src/components/TUIProfile/TUIProfile.tsx +0 -50
- package/src/components/TUIProfile/index.ts +0 -2
- package/src/components/TUIProfile/styles/index.scss +0 -2
- package/src/context/TUIChatStateContext.tsx +0 -50
- package/src/context/TUIConversationContext.tsx +0 -29
- package/src/context/TUIMessageContext.tsx +0 -56
- package/src/context/TUIMessageInputContext.tsx +0 -55
- /package/dist/cjs/components/{TUIChat/TUIChatState.js → Chat/ChatState.js} +0 -0
- /package/dist/cjs/components/{TUIChat → Chat}/hooks/useCreateTUIChatStateContext.js +0 -0
- /package/dist/cjs/components/{TUIChat → Chat}/hooks/useHandleMessage.d.ts +0 -0
- /package/dist/cjs/components/{TUIChat → Chat}/hooks/useHandleMessage.js +0 -0
- /package/dist/cjs/components/{TUIChat → Chat}/hooks/useHandleMessageList.js +0 -0
- /package/dist/cjs/components/{TUIChat → Chat}/server.js +0 -0
- /package/dist/cjs/components/{TUIChat → Chat}/utils.js +0 -0
- /package/dist/cjs/components/{TUIContact/TUIContactInfo → Contact/ContactInfo}/addFriendInfo.js +0 -0
- /package/dist/cjs/components/{TUIMessage → MessageElement}/MessageContext.d.ts +0 -0
- /package/dist/cjs/components/{TUIMessage → MessageElement}/MessageFace.js +0 -0
- /package/dist/cjs/components/{TUIMessage → MessageElement}/MessageFile.js +0 -0
- /package/dist/cjs/components/{TUIMessage → MessageElement}/MessageImage.js +0 -0
- /package/dist/cjs/components/{TUIMessage → MessageElement}/MessageLocation.js +0 -0
- /package/dist/cjs/components/{TUIMessage → MessageElement}/MessageMerger.js +0 -0
- /package/dist/cjs/components/{TUIMessage → MessageElement}/MessagePlugins.d.ts +0 -0
- /package/dist/cjs/components/{TUIMessage → MessageElement}/MessageVideo.js +0 -0
- /package/dist/cjs/components/{TUIMessage → MessageElement}/hooks/useMessageContextHandler.js +0 -0
- /package/dist/cjs/components/{TUIMessage → MessageElement}/hooks/useMessagePluginElement.js +0 -0
- /package/dist/cjs/components/{TUIMessage → MessageElement}/utils/decodeText.js +0 -0
- /package/dist/cjs/components/{TUIMessage → MessageElement}/utils/emojiMap.js +0 -0
- /package/dist/cjs/components/{TUIMessage → MessageElement}/utils/index.js +0 -0
- /package/dist/cjs/components/{TUIMessageInput → MessageInput}/InputPluginsDefalut.d.ts +0 -0
- /package/dist/cjs/components/{TUIMessageInput/TUIMessageInputDefault.d.ts → MessageInput/MessageInputDefault.d.ts} +0 -0
- /package/dist/cjs/components/{TUIMessageInput → MessageInput}/hooks/useCreateMessageInputContext.js +0 -0
- /package/dist/cjs/components/{TUIMessageInput → MessageInput}/hooks/useEmojiPicker.d.ts +0 -0
- /package/dist/cjs/components/{TUIMessageInput → MessageInput}/hooks/useMessageInputState.d.ts +0 -0
- /package/dist/cjs/components/{TUIMessageInput → MessageInput}/hooks/useMessageInputState.js +0 -0
- /package/dist/cjs/components/{TUIMessageInput → MessageInput}/hooks/useUploadElement.js +0 -0
- /package/dist/cjs/components/{TUIMessageInput → MessageInput}/hooks/useUploadPicker.d.ts +0 -0
- /package/dist/cjs/components/{TUIProfile/TUIProfileDefault.d.ts → Profile/ProfileDefault.d.ts} +0 -0
- /package/dist/cjs/components/{TUIProfile → Profile}/hooks/useMyProfile.js +0 -0
- /package/dist/cjs/context/{TUIChatActionContext.js → ChatActionContext.js} +0 -0
- /package/dist/cjs/context/{TUIChatStateContext.js → ChatStateContext.js} +0 -0
- /package/dist/cjs/context/{TUIContactContext.js → ContactContext.js} +0 -0
- /package/dist/cjs/context/{TUIMessageContext.js → MessageContext.js} +0 -0
- /package/dist/cjs/context/{TUIMessageInputContext.js → MessageInputContext.js} +0 -0
- /package/dist/esm/components/{TUIChat/TUIChatState.js → Chat/ChatState.js} +0 -0
- /package/dist/esm/components/{TUIChat → Chat}/hooks/useCreateTUIChatStateContext.js +0 -0
- /package/dist/esm/components/{TUIChat → Chat}/hooks/useHandleMessage.d.ts +0 -0
- /package/dist/esm/components/{TUIChat → Chat}/hooks/useHandleMessage.js +0 -0
- /package/dist/esm/components/{TUIChat → Chat}/hooks/useHandleMessageList.js +0 -0
- /package/dist/esm/components/{TUIChat → Chat}/server.js +0 -0
- /package/dist/esm/components/{TUIChat → Chat}/utils.js +0 -0
- /package/dist/esm/components/{TUIContact/TUIContactInfo → Contact/ContactInfo}/addFriendInfo.js +0 -0
- /package/dist/esm/components/{TUIMessage → MessageElement}/MessageContext.d.ts +0 -0
- /package/dist/esm/components/{TUIMessage → MessageElement}/MessageFace.js +0 -0
- /package/dist/esm/components/{TUIMessage → MessageElement}/MessageFile.js +0 -0
- /package/dist/esm/components/{TUIMessage → MessageElement}/MessageImage.js +0 -0
- /package/dist/esm/components/{TUIMessage → MessageElement}/MessageLocation.js +0 -0
- /package/dist/esm/components/{TUIMessage → MessageElement}/MessageMerger.js +0 -0
- /package/dist/esm/components/{TUIMessage → MessageElement}/MessagePlugins.d.ts +0 -0
- /package/dist/esm/components/{TUIMessage → MessageElement}/MessageVideo.js +0 -0
- /package/dist/esm/components/{TUIMessage → MessageElement}/hooks/useMessageContextHandler.js +0 -0
- /package/dist/esm/components/{TUIMessage → MessageElement}/hooks/useMessagePluginElement.js +0 -0
- /package/dist/esm/components/{TUIMessage → MessageElement}/utils/decodeText.js +0 -0
- /package/dist/esm/components/{TUIMessage → MessageElement}/utils/emojiMap.js +0 -0
- /package/dist/esm/components/{TUIMessage → MessageElement}/utils/index.js +0 -0
- /package/dist/esm/components/{TUIMessageInput → MessageInput}/InputPluginsDefalut.d.ts +0 -0
- /package/dist/esm/components/{TUIMessageInput/TUIMessageInputDefault.d.ts → MessageInput/MessageInputDefault.d.ts} +0 -0
- /package/dist/esm/components/{TUIMessageInput → MessageInput}/hooks/useCreateMessageInputContext.js +0 -0
- /package/dist/esm/components/{TUIMessageInput → MessageInput}/hooks/useEmojiPicker.d.ts +0 -0
- /package/dist/esm/components/{TUIMessageInput → MessageInput}/hooks/useMessageInputState.d.ts +0 -0
- /package/dist/esm/components/{TUIMessageInput → MessageInput}/hooks/useMessageInputState.js +0 -0
- /package/dist/esm/components/{TUIMessageInput → MessageInput}/hooks/useUploadElement.js +0 -0
- /package/dist/esm/components/{TUIMessageInput → MessageInput}/hooks/useUploadPicker.d.ts +0 -0
- /package/dist/esm/components/{TUIProfile/TUIProfileDefault.d.ts → Profile/ProfileDefault.d.ts} +0 -0
- /package/dist/esm/components/{TUIProfile → Profile}/hooks/useMyProfile.js +0 -0
- /package/dist/esm/context/{TUIChatActionContext.js → ChatActionContext.js} +0 -0
- /package/dist/esm/context/{TUIChatStateContext.js → ChatStateContext.js} +0 -0
- /package/dist/esm/context/{TUIContactContext.js → ContactContext.js} +0 -0
- /package/dist/esm/context/{TUIMessageContext.js → MessageContext.js} +0 -0
- /package/dist/esm/context/{TUIMessageInputContext.js → MessageInputContext.js} +0 -0
- /package/src/components/{TUIChat/TUIChatState.tsx → Chat/ChatState.tsx} +0 -0
- /package/src/components/{TUIChat → Chat}/hooks/useCreateTUIChatStateContext.tsx +0 -0
- /package/src/components/{TUIChat → Chat}/hooks/useIsMounted.ts +0 -0
- /package/src/components/{TUIChat → Chat}/server.ts +0 -0
- /package/src/components/{TUIChat → Chat}/styles/index.scss +0 -0
- /package/src/components/{TUIChat → Chat}/styles/layout.scss +0 -0
- /package/src/components/{TUIChat → Chat}/utils.ts +0 -0
- /package/src/components/{TUIChatHeader → ChatHeader}/styles/color.scss +0 -0
- /package/src/components/{TUIChatHeader → ChatHeader}/styles/index.scss +0 -0
- /package/src/components/{TUIContact/TUIContactInfo → Contact/ContactInfo}/addFriendInfo.tsx +0 -0
- /package/src/components/{TUIContact/TUIContactInfo → Contact/ContactInfo}/basicInfo.tsx +0 -0
- /package/src/components/{TUIContact/TUIContactInfo → Contact/ContactInfo}/blockInfo.tsx +0 -0
- /package/src/components/{TUIContact/TUIContactInfo → Contact/ContactInfo}/friendApplication.tsx +0 -0
- /package/src/components/{TUIContact/TUIContactInfo → Contact/ContactInfo}/friendInfo.tsx +0 -0
- /package/src/components/{TUIContact/TUIContactInfo → Contact/ContactInfo}/groupInfo.tsx +0 -0
- /package/src/components/{TUIContact/TUIContactInfo → Contact/ContactInfo}/hooks/useContactInfo.tsx +0 -0
- /package/src/components/{TUIContact/TUIContactInfo → Contact/ContactInfo}/index.scss +0 -0
- /package/src/components/{TUIContact/TUIContactList → Contact/ContactList}/index.scss +0 -0
- /package/src/components/{TUIContact → Contact}/hooks/useTUIContact.tsx +0 -0
- /package/src/components/{TUIContact → Contact}/index.scss +0 -0
- /package/src/components/{TUIContactSearch → ContactSearch}/hooks/useContactSearch.tsx +0 -0
- /package/src/components/{TUIContactSearch → ContactSearch}/index.scss +0 -0
- /package/src/components/{TUIMessage → MessageElement}/MessageAudio.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/MessageAvatar.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/MessageBubble.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/MessageContext.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/MessageFace.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/MessageFile.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/MessageImage.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/MessageLocation.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/MessageMerger.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/MessageName.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/MessageProgress.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/MessageRevoke.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/MessageStatus.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/MessageSystem.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/MessageText.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/MessageTip.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/MessageVideo.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/hooks/index.ts +0 -0
- /package/src/components/{TUIMessage → MessageElement}/hooks/useMessageContextHandler.ts +0 -0
- /package/src/components/{TUIMessage → MessageElement}/hooks/useMessageHandler.ts +0 -0
- /package/src/components/{TUIMessage → MessageElement}/hooks/useMessagePluginElement.tsx +0 -0
- /package/src/components/{TUIMessage → MessageElement}/hooks/useMessageReply.ts +0 -0
- /package/src/components/{TUIMessage → MessageElement}/styles/color.scss +0 -0
- /package/src/components/{TUIMessage → MessageElement}/styles/index.scss +0 -0
- /package/src/components/{TUIMessage → MessageElement}/utils/decodeText.ts +0 -0
- /package/src/components/{TUIMessage → MessageElement}/utils/emojiMap.ts +0 -0
- /package/src/components/{TUIMessage → MessageElement}/utils/index.ts +0 -0
- /package/src/components/{TUIMessageInput → MessageInput}/hooks/index.ts +0 -0
- /package/src/components/{TUIMessageInput → MessageInput}/hooks/useCreateMessageInputContext.ts +0 -0
- /package/src/components/{TUIMessageInput → MessageInput}/hooks/useHandleForwardMessage.tsx +0 -0
- /package/src/components/{TUIMessageInput → MessageInput}/hooks/useHandleQuoteMessage.tsx +0 -0
- /package/src/components/{TUIMessageInput → MessageInput}/hooks/usePluginsElement.tsx +0 -0
- /package/src/components/{TUIMessageInput → MessageInput}/hooks/useUploadElement.tsx +0 -0
- /package/src/components/{TUIMessageInput → MessageInput}/hooks/useUploadPicker.tsx +0 -0
- /package/src/components/{TUIMessageInput → MessageInput}/styles/index.scss +0 -0
- /package/src/components/{TUIMessageInput → MessageInput}/styles/layout.scss +0 -0
- /package/src/components/{TUIMessageList → MessageList}/styles/color.scss +0 -0
- /package/src/components/{TUIMessageList → MessageList}/styles/index.scss +0 -0
- /package/src/components/{TUIMessageList → MessageList}/styles/layout.scss +0 -0
- /package/src/components/{TUIProfile/TUIProfileDefault.tsx → Profile/ProfileDefault.tsx} +0 -0
- /package/src/components/{TUIProfile → Profile}/hooks/index.ts +0 -0
- /package/src/components/{TUIProfile → Profile}/hooks/useMyProfile.tsx +0 -0
- /package/src/components/{TUIProfile → Profile}/styles/color.scss +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import React, { PropsWithChildren, useContext, useEffect, useState } from 'react';
|
|
2
|
+
import TUIChatEngine, { IConversationModel, StoreName, TUIConversationService, TUIStore } from '@tencentcloud/chat-uikit-engine';
|
|
3
|
+
|
|
4
|
+
interface ConversationListProviderProps {
|
|
5
|
+
/** Specifies a function to filter conversations in the conversation list. */
|
|
6
|
+
filter?: (conversationList: IConversationModel[]) => IConversationModel[];
|
|
7
|
+
/** Specifies a function to sort conversations in the conversation list. */
|
|
8
|
+
sort?: (conversationList: IConversationModel[]) => IConversationModel[];
|
|
9
|
+
}
|
|
10
|
+
interface ConversationListContextType {
|
|
11
|
+
conversationList: IConversationModel[];
|
|
12
|
+
filteredAndSortedConversationList: IConversationModel[];
|
|
13
|
+
currentConversation: IConversationModel | undefined;
|
|
14
|
+
setCurrentConversation: (conversation: IConversationModel) => void;
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
isLoadError: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const ConversationListContext = React.createContext<ConversationListContextType | null>(null);
|
|
20
|
+
|
|
21
|
+
function ConversationListProvider(props: PropsWithChildren<Partial<ConversationListProviderProps>>) {
|
|
22
|
+
const {
|
|
23
|
+
filter,
|
|
24
|
+
sort,
|
|
25
|
+
children,
|
|
26
|
+
} = props;
|
|
27
|
+
|
|
28
|
+
const [conversationList, setConversationList] = useState<IConversationModel[]>([]);
|
|
29
|
+
|
|
30
|
+
const [currentConversation, _setCurrentConversation] = useState<IConversationModel | undefined>(undefined);
|
|
31
|
+
|
|
32
|
+
const [filteredAndSortedConversationList, setFilteredAndSortedConversationList] = useState<IConversationModel[]>([]);
|
|
33
|
+
|
|
34
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
35
|
+
const [isLoadError, setIsLoadError] = useState(false);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
TUIStore.watch(StoreName.CONV, {
|
|
39
|
+
conversationList: onConversationListUpdated,
|
|
40
|
+
currentConversation: onCurrentConversationUpdated,
|
|
41
|
+
});
|
|
42
|
+
TUIStore.watch(StoreName.USER, {
|
|
43
|
+
netStateChange: onNetStateChange,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return () => {
|
|
47
|
+
TUIStore.unwatch(StoreName.CONV, {
|
|
48
|
+
conversationList: onConversationListUpdated,
|
|
49
|
+
currentConversation: onCurrentConversationUpdated,
|
|
50
|
+
});
|
|
51
|
+
TUIStore.unwatch(StoreName.USER, {
|
|
52
|
+
netStateChange: onNetStateChange,
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
}, []);
|
|
56
|
+
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
// filter & sort conversationList
|
|
59
|
+
let _conversationList = conversationList;
|
|
60
|
+
filter && (_conversationList = filter(_conversationList));
|
|
61
|
+
sort && (_conversationList = sort(_conversationList));
|
|
62
|
+
setFilteredAndSortedConversationList(_conversationList);
|
|
63
|
+
}, [conversationList, sort, filter]);
|
|
64
|
+
|
|
65
|
+
function onConversationListUpdated(list: IConversationModel[]) {
|
|
66
|
+
// original conversationList
|
|
67
|
+
setConversationList(list);
|
|
68
|
+
if (isLoading) {
|
|
69
|
+
setIsLoading(false);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function onCurrentConversationUpdated(conversation: IConversationModel) {
|
|
74
|
+
_setCurrentConversation(conversation);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function onNetStateChange(netState: string) {
|
|
78
|
+
if (netState === TUIChatEngine.TYPES.NET_STATE_DISCONNECTED) {
|
|
79
|
+
setIsLoadError(true);
|
|
80
|
+
} else {
|
|
81
|
+
setIsLoadError(false);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function setCurrentConversation(conversation: IConversationModel) {
|
|
86
|
+
TUIConversationService.switchConversation(conversation?.conversationID);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const value = {
|
|
90
|
+
conversationList,
|
|
91
|
+
filteredAndSortedConversationList,
|
|
92
|
+
currentConversation,
|
|
93
|
+
setCurrentConversation,
|
|
94
|
+
isLoading,
|
|
95
|
+
isLoadError,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<ConversationListContext.Provider value={value}>
|
|
100
|
+
{children}
|
|
101
|
+
</ConversationListContext.Provider>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function useConversationList() {
|
|
106
|
+
const context = useContext(ConversationListContext);
|
|
107
|
+
if (!context) {
|
|
108
|
+
throw new Error('useConversationList must be used within a useConversationList');
|
|
109
|
+
}
|
|
110
|
+
return context;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export { useConversationList, ConversationListProvider, ConversationListContextType, ConversationListProviderProps };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { PropsWithChildren, ReactEventHandler, useContext } from 'react';
|
|
2
|
+
import { Message } from '@tencentcloud/chat';
|
|
3
|
+
import { MessagePluginsProps } from '../components';
|
|
4
|
+
|
|
5
|
+
export enum messageShowType {
|
|
6
|
+
IN = 'in',
|
|
7
|
+
OUT = 'out',
|
|
8
|
+
ALL = 'all',
|
|
9
|
+
NONE = 'none',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface TUIMessageContextValue {
|
|
13
|
+
message?: Message;
|
|
14
|
+
handleDelete?: ReactEventHandler;
|
|
15
|
+
CustemElement?: React.ComponentType<{ message: Message }>;
|
|
16
|
+
TextElement?: React.ComponentType<{ message: Message }>;
|
|
17
|
+
ImageElement?: React.ComponentType<{ message: Message }>;
|
|
18
|
+
VideoElement?: React.ComponentType<{ message: Message }>;
|
|
19
|
+
AudioElement?: React.ComponentType<{ message: Message }>;
|
|
20
|
+
FileElement?: React.ComponentType<{ message: Message }>;
|
|
21
|
+
MergerElement?: React.ComponentType<{ message: Message }>;
|
|
22
|
+
LocationElement?: React.ComponentType<{ message: Message }>;
|
|
23
|
+
FaceElement?: React.ComponentType<{ message: Message }>;
|
|
24
|
+
filter?: (data: Message) => void;
|
|
25
|
+
isShowTime?: boolean;
|
|
26
|
+
isShowRead?: boolean;
|
|
27
|
+
plugin?: MessagePluginsProps;
|
|
28
|
+
prefix?: React.ReactElement | string;
|
|
29
|
+
suffix?: React.ReactElement | string;
|
|
30
|
+
customName?: React.ReactElement;
|
|
31
|
+
showAvatar?: messageShowType;
|
|
32
|
+
showName?: messageShowType;
|
|
33
|
+
customAvatar?: React.ReactElement;
|
|
34
|
+
isShowProgress?: boolean;
|
|
35
|
+
Progress?: React.ComponentType<{ message: Message }>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const TUIMessageContext = React.createContext<TUIMessageContextValue>({});
|
|
39
|
+
export function TUIMessageContextProvider({ children, value }: PropsWithChildren<{
|
|
40
|
+
value: TUIMessageContextValue;
|
|
41
|
+
}>): React.ReactElement {
|
|
42
|
+
return (
|
|
43
|
+
<TUIMessageContext.Provider value={value}>
|
|
44
|
+
{children}
|
|
45
|
+
</TUIMessageContext.Provider>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function useTUIMessageContext(componentName?: string): TUIMessageContextValue {
|
|
50
|
+
const contextValue = useContext(TUIMessageContext);
|
|
51
|
+
if (!contextValue && componentName) {
|
|
52
|
+
return {} as TUIMessageContextValue;
|
|
53
|
+
}
|
|
54
|
+
return (contextValue as unknown) as TUIMessageContextValue;
|
|
55
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
PropsWithChildren,
|
|
3
|
+
ChangeEventHandler,
|
|
4
|
+
useContext,
|
|
5
|
+
KeyboardEventHandler,
|
|
6
|
+
MutableRefObject,
|
|
7
|
+
} from 'react';
|
|
8
|
+
import { PluginConfigProps } from '../components';
|
|
9
|
+
import type { ICursorPos } from '../components/MessageInput/hooks';
|
|
10
|
+
import type { EmojiData } from '../components/MessageInput/hooks/useEmojiPicker';
|
|
11
|
+
import type { filesData } from '../components/MessageInput/hooks/useUploadPicker';
|
|
12
|
+
import type { MESSAGE_TYPE_NAME } from '../constants';
|
|
13
|
+
|
|
14
|
+
interface dispatchParams {
|
|
15
|
+
type: string;
|
|
16
|
+
value?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface TUIMessageInputContextValue {
|
|
19
|
+
text?: string;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
dispatch?: (params: dispatchParams) => void;
|
|
22
|
+
handleChange?: ChangeEventHandler<HTMLTextAreaElement>;
|
|
23
|
+
handleSubmit?: (event: React.BaseSyntheticEvent) => void;
|
|
24
|
+
handleKeyDown?: KeyboardEventHandler<HTMLTextAreaElement>;
|
|
25
|
+
textareaRef?: MutableRefObject<HTMLTextAreaElement | undefined>;
|
|
26
|
+
onSelectEmoji?: (emoji: EmojiData) => void;
|
|
27
|
+
sendFaceMessage?: (emoji: EmojiData) => void;
|
|
28
|
+
sendUploadMessage?: (file: filesData, type: MESSAGE_TYPE_NAME) => void;
|
|
29
|
+
insertText?: (textToInsert: string) => void;
|
|
30
|
+
setText?: (textToInsert: string) => void;
|
|
31
|
+
focus?: boolean;
|
|
32
|
+
handlePasete?: (e: ClipboardEvent) => void;
|
|
33
|
+
setCursorPos?: (e: ICursorPos) => void;
|
|
34
|
+
pluginConfig?: PluginConfigProps;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const TUIMessageInputContext = React.createContext<TUIMessageInputContextValue>({});
|
|
38
|
+
export function TUIMessageInputContextProvider({ children, value }: PropsWithChildren<{
|
|
39
|
+
value: TUIMessageInputContextValue;
|
|
40
|
+
}>): React.ReactElement {
|
|
41
|
+
return (
|
|
42
|
+
<TUIMessageInputContext.Provider value={value}>
|
|
43
|
+
{children}
|
|
44
|
+
</TUIMessageInputContext.Provider>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function useTUIMessageInputContext(componentName?: string): TUIMessageInputContextValue {
|
|
49
|
+
const contextValue = useContext(TUIMessageInputContext);
|
|
50
|
+
if (!contextValue && componentName) {
|
|
51
|
+
return {} as TUIMessageInputContextValue;
|
|
52
|
+
}
|
|
53
|
+
return (contextValue as unknown) as TUIMessageInputContextValue;
|
|
54
|
+
}
|
package/src/context/index.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export * from './UIKitContext';
|
|
2
2
|
export * from './UIManagerContext';
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
3
|
+
export * from './ChatStateContext';
|
|
4
|
+
export * from './ChatActionContext';
|
|
5
|
+
export * from './MessageContext';
|
|
6
6
|
export * from './ComponentContext';
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
7
|
+
export * from './MessageInputContext';
|
|
8
|
+
export * from './ContactContext';
|
|
9
|
+
export * from './ConversationListContext';
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,78 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import TencentCloudChat from '@tencentcloud/chat';
|
|
3
|
-
import { useTUIConversationContext } from '../context/TUIConversationContext';
|
|
1
|
+
import TUIChatEngine, { TUIGroupService, TUIConversationService, IConversationModel, CreateGroupParams } from '@tencentcloud/chat-uikit-engine';
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
groupID?: string;
|
|
9
|
-
introduction?: string;
|
|
10
|
-
notification?: string;
|
|
11
|
-
avatar?: string;
|
|
12
|
-
maxMemberNum?: number;
|
|
13
|
-
joinOption?: string;
|
|
14
|
-
memberList?: Array<object>;
|
|
15
|
-
groupCustomField?: Array<object>;
|
|
16
|
-
isSupportTopic?: boolean;
|
|
3
|
+
async function createC2CConversation(userID: string): Promise<IConversationModel> {
|
|
4
|
+
const response = await TUIConversationService.getConversationProfile(`C2C${userID}`);
|
|
5
|
+
return response.data.conversation;
|
|
17
6
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// create group conversation
|
|
32
|
-
const {
|
|
33
|
-
name,
|
|
34
|
-
type,
|
|
35
|
-
groupID,
|
|
36
|
-
introduction,
|
|
37
|
-
notification,
|
|
38
|
-
avatar,
|
|
39
|
-
maxMemberNum,
|
|
40
|
-
joinOption,
|
|
41
|
-
memberList = [],
|
|
42
|
-
groupCustomField = [],
|
|
43
|
-
isSupportTopic,
|
|
44
|
-
} = params;
|
|
45
|
-
const res = await chat.createGroup({
|
|
46
|
-
name,
|
|
47
|
-
type,
|
|
48
|
-
groupID,
|
|
49
|
-
introduction,
|
|
50
|
-
notification,
|
|
51
|
-
avatar,
|
|
52
|
-
maxMemberNum,
|
|
53
|
-
joinOption,
|
|
54
|
-
memberList,
|
|
55
|
-
groupCustomField,
|
|
56
|
-
isSupportTopic,
|
|
7
|
+
|
|
8
|
+
async function createGroupConversation(groupParams: CreateGroupParams): Promise<IConversationModel> {
|
|
9
|
+
if (groupParams.type === TUIChatEngine.TYPES.GRP_COMMUNITY) {
|
|
10
|
+
delete groupParams.groupID;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const res = await TUIGroupService.createGroup(groupParams);
|
|
14
|
+
const { type } = res.data.group;
|
|
15
|
+
|
|
16
|
+
if (type === TUIChatEngine.TYPES.GRP_AVCHATROOM) {
|
|
17
|
+
await TUIGroupService.joinGroup({
|
|
18
|
+
groupID: res.data.group.groupID,
|
|
19
|
+
applyMessage: '',
|
|
57
20
|
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
};
|
|
68
|
-
const pinConversation = (options: {
|
|
69
|
-
conversationID: string;
|
|
70
|
-
isPinned: boolean;
|
|
71
|
-
}) => chat.pinConversation(options);
|
|
72
|
-
const deleteConversation = (conversationID: string) => chat.deleteConversation(conversationID);
|
|
73
|
-
return {
|
|
74
|
-
createConversation: contextCreateConversation || createConversation,
|
|
75
|
-
pinConversation,
|
|
76
|
-
deleteConversation: contextDeleteConversation || deleteConversation,
|
|
77
|
-
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const response = await TUIConversationService.getConversationProfile(`GROUP${res.data.group.groupID}`);
|
|
24
|
+
return response.data.conversation;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
createC2CConversation,
|
|
29
|
+
createGroupConversation,
|
|
78
30
|
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
useState,
|
|
3
|
+
useRef,
|
|
4
|
+
useCallback,
|
|
5
|
+
} from 'react';
|
|
6
|
+
import { isH5 } from '../utils/env';
|
|
7
|
+
|
|
8
|
+
const DEFAULT_DURATION = 300;
|
|
9
|
+
|
|
10
|
+
function preventDefault(e: Event) {
|
|
11
|
+
if (!isTouchEvent(e)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (e.touches.length < 2 && e.preventDefault) {
|
|
16
|
+
e.preventDefault();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function isTouchEvent(e: Event): e is TouchEvent {
|
|
21
|
+
return e && 'touches' in e;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface PressHandlers<T> {
|
|
25
|
+
onLongPress?: (e: React.MouseEvent<T> | React.TouchEvent<T>) => void;
|
|
26
|
+
onClick?: (e: React.MouseEvent<T> | React.TouchEvent<T>) => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface Options {
|
|
30
|
+
delay?: number;
|
|
31
|
+
shouldPreventDefault?: boolean;
|
|
32
|
+
shouldStopPropagation?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface UseLongPressType<T> {
|
|
36
|
+
isLongPressing: boolean;
|
|
37
|
+
onTouchMove: (e: React.TouchEvent<T>) => void;
|
|
38
|
+
onMouseDown: (e: React.MouseEvent<T>) => void;
|
|
39
|
+
onTouchStart: (e: React.TouchEvent<T>) => void;
|
|
40
|
+
onMouseUp: (e: React.MouseEvent<T>) => void;
|
|
41
|
+
onMouseLeave: (e: React.MouseEvent<T>) => void;
|
|
42
|
+
onTouchEnd: (e: React.TouchEvent<T>) => void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default function useLongPress<T>({
|
|
46
|
+
onLongPress,
|
|
47
|
+
onClick,
|
|
48
|
+
}: PressHandlers<T>, {
|
|
49
|
+
delay = DEFAULT_DURATION,
|
|
50
|
+
shouldPreventDefault = true,
|
|
51
|
+
shouldStopPropagation = false,
|
|
52
|
+
}: Options = {}): UseLongPressType<T> {
|
|
53
|
+
const [longPressTriggered, setLongPressTriggered] = useState(false);
|
|
54
|
+
const [dragTriggered, setDragTriggered] = useState(false);
|
|
55
|
+
const timeout = useRef<ReturnType<typeof setTimeout>>();
|
|
56
|
+
const target = useRef<EventTarget>();
|
|
57
|
+
|
|
58
|
+
const start = useCallback((e: React.MouseEvent<T> | React.TouchEvent<T>) => {
|
|
59
|
+
e.persist();
|
|
60
|
+
const clonedEvent = {
|
|
61
|
+
...e,
|
|
62
|
+
};
|
|
63
|
+
setDragTriggered(false);
|
|
64
|
+
if (shouldStopPropagation) {
|
|
65
|
+
e.stopPropagation();
|
|
66
|
+
}
|
|
67
|
+
if (shouldPreventDefault && e.target) {
|
|
68
|
+
e.target.addEventListener(
|
|
69
|
+
'touchend',
|
|
70
|
+
preventDefault,
|
|
71
|
+
{
|
|
72
|
+
passive: false,
|
|
73
|
+
},
|
|
74
|
+
);
|
|
75
|
+
target.current = e.target;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
timeout.current = setTimeout(() => {
|
|
79
|
+
onLongPress?.(clonedEvent);
|
|
80
|
+
setLongPressTriggered(true);
|
|
81
|
+
}, delay);
|
|
82
|
+
}, [onLongPress, delay, shouldPreventDefault, shouldStopPropagation, isH5]);
|
|
83
|
+
|
|
84
|
+
const clear = useCallback((
|
|
85
|
+
e: React.MouseEvent<T> | React.TouchEvent<T>,
|
|
86
|
+
shouldTriggerClick = true,
|
|
87
|
+
onDrag = false,
|
|
88
|
+
) => {
|
|
89
|
+
if (onDrag) {
|
|
90
|
+
setDragTriggered(true);
|
|
91
|
+
} else {
|
|
92
|
+
setDragTriggered(false);
|
|
93
|
+
}
|
|
94
|
+
if (timeout?.current) {
|
|
95
|
+
clearTimeout(timeout.current);
|
|
96
|
+
}
|
|
97
|
+
if (shouldTriggerClick && !longPressTriggered && !dragTriggered) {
|
|
98
|
+
onClick?.(e);
|
|
99
|
+
}
|
|
100
|
+
setLongPressTriggered(false);
|
|
101
|
+
if (shouldPreventDefault && target.current) {
|
|
102
|
+
target.current.removeEventListener('touchend', preventDefault);
|
|
103
|
+
}
|
|
104
|
+
}, [shouldPreventDefault, onClick, longPressTriggered, dragTriggered]);
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
isLongPressing: longPressTriggered,
|
|
108
|
+
onMouseDown: (e: React.MouseEvent<T>) => start(e),
|
|
109
|
+
onMouseUp: (e: React.MouseEvent<T>) => clear(e),
|
|
110
|
+
onMouseLeave: (e: React.MouseEvent<T>) => clear(e, false),
|
|
111
|
+
onTouchStart: (e: React.TouchEvent<T>) => start(e),
|
|
112
|
+
// setDragTriggered as true on touchmove, so that next onTouchEnd is ignored
|
|
113
|
+
// if we dont do it, onClick?.(e) will be triggred, see inside clear()
|
|
114
|
+
onTouchMove: (e: React.TouchEvent<T>) => clear(e, false, true),
|
|
115
|
+
onTouchEnd: (e: React.TouchEvent<T>) => clear(e),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { RefObject } from 'react';
|
|
4
|
+
|
|
5
|
+
export default function useHover<T extends HTMLElement = HTMLElement>(
|
|
6
|
+
elementRef: RefObject<T>,
|
|
7
|
+
): boolean {
|
|
8
|
+
const [value, setValue] = useState<boolean>(false);
|
|
9
|
+
|
|
10
|
+
const handleMouseEnter = () => {
|
|
11
|
+
setValue(true);
|
|
12
|
+
};
|
|
13
|
+
const handleMouseLeave = () => {
|
|
14
|
+
setValue(false);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
elementRef.current?.addEventListener('mouseenter', handleMouseEnter);
|
|
18
|
+
elementRef.current?.addEventListener('mouseleave', handleMouseLeave);
|
|
19
|
+
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
@@ -8,6 +8,8 @@ const TUIConversation = {
|
|
|
8
8
|
'Conversation Information': 'Conversation Information',
|
|
9
9
|
'Pin': 'Pin',
|
|
10
10
|
'Unpin': 'Unpin',
|
|
11
|
+
'Mute': 'Mute',
|
|
12
|
+
'Unmute': 'Unmute',
|
|
11
13
|
'Search': 'Search',
|
|
12
14
|
'Add Participants': 'Add Participants',
|
|
13
15
|
'No conversation': 'No conversation',
|
|
@@ -19,6 +21,8 @@ const TUIConversation = {
|
|
|
19
21
|
'Create': 'Create',
|
|
20
22
|
'Details': 'Details',
|
|
21
23
|
'Work': 'Work',
|
|
24
|
+
'Private': 'Work',
|
|
25
|
+
'ChatRoom': 'Meeting',
|
|
22
26
|
'Public': 'Public',
|
|
23
27
|
'Meeting': 'Meeting',
|
|
24
28
|
'AVChatRoom': 'AVChatRoom',
|
package/src/locales/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import i18next from 'i18next';
|
|
2
2
|
import { initReactI18next } from 'react-i18next';
|
|
3
|
+
import { TUITranslateService } from '@tencentcloud/chat-uikit-engine';
|
|
3
4
|
import { message as enMessage } from './en-US/index';
|
|
4
5
|
import { message as zhMessage } from './zh-CN/index';
|
|
5
6
|
import { message as jaMessage } from './ja-JP/index';
|
|
@@ -32,5 +33,14 @@ i18next.use(initReactI18next).init({
|
|
|
32
33
|
},
|
|
33
34
|
});
|
|
34
35
|
|
|
36
|
+
const engineLocaleResources = {
|
|
37
|
+
'en-US': enMessage,
|
|
38
|
+
'zh-CN': zhMessage,
|
|
39
|
+
'ja-JP': jaMessage,
|
|
40
|
+
'ko-KR': koMessage,
|
|
41
|
+
};
|
|
42
|
+
TUITranslateService.provideLanguages(engineLocaleResources);
|
|
43
|
+
TUITranslateService.useI18n('en-US');
|
|
44
|
+
|
|
35
45
|
const { t } = i18next;
|
|
36
46
|
export { i18next, t };
|
|
@@ -6,6 +6,8 @@ const TUIConversation = {
|
|
|
6
6
|
'Delete': 'チャットを削除',
|
|
7
7
|
'Pin': 'チャットをトップに固定',
|
|
8
8
|
'Unpin': 'トップ固定を解除',
|
|
9
|
+
'Mute': 'ミュート',
|
|
10
|
+
'Unmute': 'ミュート解除',
|
|
9
11
|
'Conversation Information': 'チャット情報',
|
|
10
12
|
'Search': '検索',
|
|
11
13
|
'Add Participants': 'グループチャットを作成',
|
|
@@ -18,6 +20,8 @@ const TUIConversation = {
|
|
|
18
20
|
'Create': '作成',
|
|
19
21
|
'Details': '詳細',
|
|
20
22
|
'Work': '友達の仕事グループ(Work)',
|
|
23
|
+
'Private': '友達の仕事グループ(Work)',
|
|
24
|
+
'ChatRoom': '一時的な会議グループ(Meeting)',
|
|
21
25
|
'Public': '見知らぬ人の社交グループ(Public)',
|
|
22
26
|
'Meeting': '一時的な会議グループ(Meeting)',
|
|
23
27
|
'AVChatRoom': 'ライブチャットルーム(AVChatroom)',
|
|
@@ -6,6 +6,8 @@ const TUIConversation = {
|
|
|
6
6
|
'Delete': '채팅 삭제',
|
|
7
7
|
'Pin': '채팅 고정',
|
|
8
8
|
'Unpin': '채팅 고정 해제',
|
|
9
|
+
'Mute': '음소거',
|
|
10
|
+
'Unmute': '음소거 해제',
|
|
9
11
|
'Conversation Information': '채팅 정보',
|
|
10
12
|
'Search': '검색',
|
|
11
13
|
'Add Participants': '그룹 채팅 생성',
|
|
@@ -18,6 +20,8 @@ const TUIConversation = {
|
|
|
18
20
|
'Create': '생성',
|
|
19
21
|
'Details': '상세',
|
|
20
22
|
'Work': '친구 작업 그룹(Work)',
|
|
23
|
+
'Private': '친구 작업 그룹(Work)',
|
|
24
|
+
'ChatRoom': '임시 회의 그룹(Meeting)',
|
|
21
25
|
'Public': '낯선 사람 소셜 그룹(Public)',
|
|
22
26
|
'Meeting': '임시 회의 그룹(Meeting)',
|
|
23
27
|
'AVChatRoom': '라이브 방송 그룹(AVChatroom)',
|
|
@@ -6,6 +6,8 @@ const TUIConversation = {
|
|
|
6
6
|
'Delete': '删除会话',
|
|
7
7
|
'Pin': '置顶会话',
|
|
8
8
|
'Unpin': '取消置顶',
|
|
9
|
+
'Mute': '消息免打扰',
|
|
10
|
+
'Unmute': '取消免打扰',
|
|
9
11
|
'Conversation Information': '会话信息',
|
|
10
12
|
'Search': '搜索',
|
|
11
13
|
'Add Participants': '创建群聊',
|
|
@@ -18,6 +20,8 @@ const TUIConversation = {
|
|
|
18
20
|
'Create': '创建',
|
|
19
21
|
'Details': '详情',
|
|
20
22
|
'Work': '好友工作群(Work)',
|
|
23
|
+
'Private': '好友工作群(Work)',
|
|
24
|
+
'ChatRoom': '临时会议群(Meeting)',
|
|
21
25
|
'Public': '陌生人社交群(Public)',
|
|
22
26
|
'Meeting': '临时会议群(Meeting)',
|
|
23
27
|
'AVChatRoom': '直播群(AVChatroom)',
|
|
@@ -6,6 +6,8 @@ const TUIConversation = {
|
|
|
6
6
|
'Delete': '刪除會話',
|
|
7
7
|
'Pin': '置頂會話',
|
|
8
8
|
'Unpin': '取消置頂',
|
|
9
|
+
'Mute': '訊息免幹擾',
|
|
10
|
+
'Unmute': '取消免幹擾',
|
|
9
11
|
'Conversation Information': '會話資訊',
|
|
10
12
|
'Search': '搜尋',
|
|
11
13
|
'Add Participants': '創建群聊',
|
|
@@ -18,6 +20,8 @@ const TUIConversation = {
|
|
|
18
20
|
'Create': '創建',
|
|
19
21
|
'Details': '詳情',
|
|
20
22
|
'Work': '好友工作群(Work)',
|
|
23
|
+
'Private': '好友工作群(Work)',
|
|
24
|
+
'ChatRoom': '臨時會議群(Meeting)',
|
|
21
25
|
'Public': '陌生人社交群(Public)',
|
|
22
26
|
'Meeting': '臨時會議群(Meeting)',
|
|
23
27
|
'AVChatRoom': '直播群(AVChatroom)',
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),r=require("react"),a=require("react-i18next"),n=require("@tencentcloud/chat-uikit-engine"),s=require("../Input/Input.js"),i=require("../Icon/Icon.js"),o=require("../Icon/type.js"),u=require("../Avatar/Avatar.js"),c=require("../Avatar/default.js"),p=require("./ConversationCreate.js"),l=require("./ConversationGroupTypeInfo.js");require("@tencentcloud/tui-core");var v=require("../../context/UIManagerContext.js");require("../../context/TUIMessageContext.js"),exports.ConversationCreatGroupDetail=function(d){var g=this,m=d.profileList,x=d.pageState,_=d.setPageState,f=d.createConversation,h=d.setConversationCreated,I=a.useTranslation().t,j=v.useUIManager(),C=j.setActiveConversation,y=j.myProfile,T=e.__spreadArray([],m,!0);y&&T.unshift(y);var b=T.map((function(e){return e.nick||e.userID})).toString(),N=r.useState(b.length>=15?"".concat(b.slice(0,12),"..."):b),q=N[0],G=N[1],A=r.useState(""),U=A[0],P=A[1],k=r.useState("Work"),S=k[0],D=k[1],R=function(e,t){var r=e.target.value;switch(t){case"name":G(r);break;case"id":P(r);break;case"type":D(r)}},w=function(){_(p.PageStateTypes.GROUP_TYPE)};return x!==p.PageStateTypes.GROUP_TYPE?t.jsxs(t.Fragment,{children:[t.jsxs("div",e.__assign({className:"tui-conversation-create-group-detail"},{children:[t.jsx("div",e.__assign({className:"create-group-box create-group-name"},{children:t.jsx(s.Input,{maxLength:15,value:q,onChange:function(e){R(e,"name")},border:"bottom",customClassName:"input-group-name",clearable:!0,prefix:t.jsx("div",e.__assign({className:"input-group-title"},{children:I("TUIConversation.Group Name")}))})})),t.jsx("div",e.__assign({className:"create-group-box create-group-id"},{children:t.jsx(s.Input,{border:"bottom",customClassName:"input-group-text",clearable:!0,value:U,onChange:function(e){R(e,"id")},prefix:t.jsx("div",e.__assign({className:"input-group-title"},{children:I("TUIConversation.Group ID")}))})})),t.jsx("div",e.__assign({className:"create-group-box create-group-type",onClick:w},{children:t.jsx(s.Input,{readOnly:!0,border:"bottom",customClassName:"input-group-text",prefix:t.jsx("div",e.__assign({className:"input-group-title"},{children:I("TUIConversation.Group Type")})),suffix:t.jsx(i.Icon,{onClick:w,type:o.IconTypes.ARROW_RIGHT,width:7,height:12}),value:I("TUIConversation.".concat(S)),onChange:function(e){R(e,"type")}})})),t.jsx("div",e.__assign({className:"create-group-illustrate"},{children:I("TUIConversation.".concat(null===l.typeInfoList||void 0===l.typeInfoList?void 0:l.typeInfoList.find((function(e){return e.type===S})).des))})),t.jsxs("div",e.__assign({className:"create-group-portrait"},{children:[t.jsx("div",e.__assign({className:"create-group-portrait-title"},{children:I("TUIConversation.Participants")})),t.jsx("div",e.__assign({className:"create-group-portrait-info-container"},{children:m.map((function(r){var a=r.avatar,n=r.userID,s=r.nick;return t.jsxs("div",e.__assign({className:"create-group-portrait-info"},{children:[t.jsx(u.Avatar,{shape:"square",size:50,image:a||c.defaultUserAvatar}),t.jsx("div",e.__assign({className:"create-group-portrait-info-nick"},{children:s}))]}),n)}))}))]}))]})),t.jsx("div",e.__assign({className:"tui-conversation-create-next-container"},{children:t.jsx("div",e.__assign({role:"presentation",className:"tui-conversation-create-next",onClick:function(){return e.__awaiter(g,void 0,void 0,(function(){var t,r,a;return e.__generator(this,(function(e){switch(e.label){case 0:return t=m.map((function(e){return{userID:e.userID}})),r=function(e){switch(e){case"Work":return c.defaultGroupAvatarWork;case"Public":return c.defaultGroupAvatarPublic;case"Meeting":return c.defaultGroupAvatarMeeting;case"AVChatRoom":return c.defaultGroupAvatarAVChatRoom;default:return""}}(S),[4,f({name:q,type:l.GroupType[S],groupID:U,avatar:r,memberList:t})];case 1:return a=e.sent(),C(a),n.TUIConversationService.switchConversation(null==a?void 0:a.conversationID),h(!1),[2]}}))}))}},{children:I("TUIConversation.Create")}))}))]}):t.jsx(l.ConversationGroupTypeInfo,{groupType:S,setGroupType:D,setPageState:_})};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { Conversation } from '@tencentcloud/chat';
|
|
3
|
-
|
|
4
|
-
interface ConversationListContainerProps {
|
|
5
|
-
error?: Error | null;
|
|
6
|
-
loading?: boolean;
|
|
7
|
-
setConversationList?: React__default.Dispatch<React__default.SetStateAction<Array<Conversation>>>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { ConversationListContainerProps };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime");exports.ConversationListContainer=function(i){var t=i.children;return r.jsx("div",e.__assign({className:"conversation-list-container"},{children:t}))};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { ConversationPreviewUIComponentProps } from './ConversationPreview.js';
|
|
3
|
-
|
|
4
|
-
interface IPluginsRef {
|
|
5
|
-
closeMore?: () => void;
|
|
6
|
-
}
|
|
7
|
-
declare function unMemoConversationPreviewContent<T extends ConversationPreviewUIComponentProps>(props: T): React__default.ReactElement;
|
|
8
|
-
declare const ConversationPreviewContent: typeof unMemoConversationPreviewContent;
|
|
9
|
-
|
|
10
|
-
export { ConversationPreviewContent, IPluginsRef, unMemoConversationPreviewContent };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),t=require("react-i18next"),s=require("@tencentcloud/chat-uikit-engine"),o=require("../../utils/env.js"),r=require("../Avatar/Avatar.js"),a=require("../Icon/Icon.js"),c=require("../Icon/type.js"),u=require("../Plugins/index.js"),l=require("../../hooks/useConversation.js"),v=require("../../context/UIKitContext.js"),d=require("../../context/UIManagerContext.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function h(m){var h,x=m.conversation,p=m.Avatar,j=void 0===p?r.Avatar:p,f=m.displayImage,I=m.displayTitle,g=m.displayMessage,C=m.displayTime,_=m.unread,T=m.active,q=m.activeConversationID,N=m.setActiveConversationID,M=m.setActiveConversation,P=t.useTranslation().t,w=i.useRef(null),b=v.useUIKit().chat,y=d.useUIManager().conversation,D=l.useConversation(b),U=D.pinConversation,k=D.deleteConversation,A=T?"conversation-preview-content--active":"",E=_&&_>=1?"conversation-preview-content--unread":"",R=x.isPinned?"conversation-preview-content--pin":"",S=i.useState(!1),K=S[0],O=S[1],z=i.useRef(null);i.useEffect((function(){q!==x.conversationID&&O(!1)}),[q]);var L=function(e){if(!o.isPC){var n=x.conversationID;switch(N&&N(n),e){case"touchstart":h=setTimeout(i,500);break;case"touchend":clearTimeout(h),setTimeout((function(){}),200)}}function i(){clearTimeout(h),O(!0)}},B=function(e,n){var i,t=x.conversationID,s=x.isPinned;switch(e.stopPropagation(),O(!1),(null===(i=null==z?void 0:z.current)||void 0===i?void 0:i.closeMore)&&z.current.closeMore(),n){case"pin":U({conversationID:t,isPinned:!s});break;case"delete":k(t),M&&t===(null==y?void 0:y.conversationID)&&M(void 0)}};return n.jsxs("button",e.__assign({type:"button","aria-selected":T,role:"option",className:"conversation-preview-container ".concat(A," ").concat(E," ").concat(R),onClick:function(){s.TUIConversationService.switchConversation(null==x?void 0:x.conversationID),M&&M(x),(null==w?void 0:w.current)&&w.current.blur()},onMouseEnter:function(){O(!0)},onMouseLeave:function(){O(!1)},onTouchStart:function(){return L("touchstart")},onTouchEnd:function(){return L("touchend")},ref:w,id:x.conversationID},{children:[n.jsx("div",e.__assign({className:"avatar"},{children:n.jsx(j,{image:f,name:I,size:40})})),n.jsxs("div",e.__assign({className:"content"},{children:[n.jsx("div",e.__assign({className:"title text-ellipsis"},{children:I})),n.jsx("div",e.__assign({className:"message"},{children:g}))]})),n.jsxs("div",e.__assign({className:"external"},{children:[_?n.jsx("div",e.__assign({className:"unread"},{children:_<=99?_:"99+"})):n.jsx("div",{className:"unread"}),K?n.jsx("div",e.__assign({className:"".concat(K?"more--hover":"more")},{children:n.jsx(u.Plugins,{customClass:"more-handle-box",ref:z,plugins:[n.jsx("div",e.__assign({role:"presentation",className:"more-handle-item",onClick:function(e){B(e,"pin")}},{children:P(x.isPinned?"TUIConversation.Unpin":"TUIConversation.Pin")})),n.jsx("div",e.__assign({className:"more-handle-item delete",onClick:function(e){B(e,"delete")},role:"presentation"},{children:P("TUIConversation.Delete")}))],showNumber:0,MoreIcon:n.jsx(a.Icon,{className:"icon-more",width:16,height:16,type:c.IconTypes.MORE})})})):n.jsx("div",e.__assign({className:"time"},{children:C}))]}))]}))}require("../../context/TUIMessageContext.js");var x=m(i).default.memo(h);exports.ConversationPreviewContent=x,exports.unMemoConversationPreviewContent=h;
|