Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v10.5.0 #32

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"private": true,
"author": "netease",
"scripts": {
"dev": "umi dev",
"build": "umi build",
"dev": "NODE_OPTIONS=--openssl-legacy-provider && umi dev",
"build": "NODE_OPTIONS=--openssl-legacy-provider && umi dev",
"start": "umi dev"
},
"dependencies": {
"@xkit-yx/call-kit": "^3.0.0",
"@xkit-yx/call-kit-react-ui": "^0.6.0",
"@xkit-yx/im-kit-ui": "^10.x",
"@xkit-yx/im-kit-ui": "^10.5.1",
"react-dom": "^16.8.0",
"umi": "^3.5.40"
},
Expand Down
2 changes: 1 addition & 1 deletion react/src/YXUIKit/im-kit-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xkit-yx/im-kit-ui",
"version": "10.3.3",
"version": "10.5.1",
"description": "云信即时通讯组件",
"license": "MIT",
"main": "lib/index.js",
Expand Down
34 changes: 31 additions & 3 deletions react/src/YXUIKit/im-kit-ui/src/chat/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ import { SettingActionItemProps } from './components/ChatActionBar'
import {
V2NIMConversationType,
V2NIMConversation,
} from 'nim-web-sdk-ng/dist/v2/NIM_BROWSER_SDK/V2NIMConversationService'
} from 'nim-web-sdk-ng/dist/esm/nim/src/V2NIMConversationService'
import { V2NIMMessageForUI } from '@xkit-yx/im-store-v2/dist/types/types'
import sdkPkg from 'nim-web-sdk-ng/package.json'
import { V2NIMConst } from 'nim-web-sdk-ng'
import { V2NIMConst } from 'nim-web-sdk-ng/dist/esm/nim'
import { MAX_UPLOAD_FILE_SIZE } from '../constant'

export interface ActionRenderProps extends ChatMessageInputProps {
conversationType: V2NIMConversationType
Expand All @@ -28,7 +29,7 @@ export interface Action {
/**
按钮类型
*/
action: 'emoji' | 'sendImg' | 'sendFile' | string
action: 'emoji' | 'sendImg' | 'sendFile' | 'aiTranslate' | 'sendMsg' | string
/**
是否显示该按钮,自带按钮默认 true,新增自定义按钮默认 false
*/
Expand Down Expand Up @@ -152,6 +153,22 @@ export interface ChatContainerProps {
公共样式前缀
*/
commonPrefix?: string
/**
消息可撤回的最大时间,单位毫秒,默认 2 * 60 * 1000, 最大支持7天内的消息可撤回
*/
msgRecallTime?: number
/**
是否展示陌生人提示
*/
strangerTipVisible?: boolean
/**
上拉加载消息滚动模式,组件在上拉加载消息时,默认会自动滚动到最新的消息,当组件位于可滚动的页面中时,可能会造成滚动异常,设置nearest即可
*/
scrollIntoMode?: 'nearest'
/**
* 最大上传文件大小,单位Mb,默认 100M
*/
maxUploadFileSize?: number
}

export const ChatContainer: React.FC<ChatContainerProps> = observer(
Expand All @@ -161,6 +178,7 @@ export const ChatContainer: React.FC<ChatContainerProps> = observer(
p2pSettingActions,
teamSettingActions,
msgOperMenu,
maxUploadFileSize = MAX_UPLOAD_FILE_SIZE,
onSendText,
afterTransferTeam,
renderEmpty,
Expand All @@ -175,8 +193,11 @@ export const ChatContainer: React.FC<ChatContainerProps> = observer(
renderMessageInnerContent,
renderMessageOuterContent,

msgRecallTime = 2 * 60 * 1000,
prefix = 'chat',
commonPrefix = 'common',
strangerTipVisible = true,
scrollIntoMode,
}) => {
const { store, nim } = useStateContext()

Expand Down Expand Up @@ -205,8 +226,10 @@ export const ChatContainer: React.FC<ChatContainerProps> = observer(
commonPrefix={commonPrefix}
onSendText={onSendText}
actions={actions}
maxUploadFileSize={maxUploadFileSize}
conversationType={conversationType}
receiverId={receiverId}
msgRecallTime={msgRecallTime}
settingActions={p2pSettingActions}
msgOperMenu={msgOperMenu}
renderP2pCustomMessage={renderP2pCustomMessage}
Expand All @@ -216,16 +239,20 @@ export const ChatContainer: React.FC<ChatContainerProps> = observer(
renderMessageName={renderMessageName}
renderMessageInnerContent={renderMessageInnerContent}
renderMessageOuterContent={renderMessageOuterContent}
strangerTipVisible={strangerTipVisible}
scrollIntoMode={scrollIntoMode}
/>
) : conversationType ===
V2NIMConst.V2NIMConversationType.V2NIM_CONVERSATION_TYPE_TEAM ? (
<TeamChatContainer
prefix={prefix}
commonPrefix={commonPrefix}
maxUploadFileSize={maxUploadFileSize}
conversationType={conversationType}
receiverId={receiverId}
onSendText={onSendText}
actions={actions}
msgRecallTime={msgRecallTime}
settingActions={teamSettingActions}
msgOperMenu={msgOperMenu}
afterTransferTeam={afterTransferTeam}
Expand All @@ -237,6 +264,7 @@ export const ChatContainer: React.FC<ChatContainerProps> = observer(
renderMessageName={renderMessageName}
renderMessageInnerContent={renderMessageInnerContent}
renderMessageOuterContent={renderMessageOuterContent}
scrollIntoMode={scrollIntoMode}
/>
) : null
) : renderEmpty ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { observer } from 'mobx-react'
import React, { FC, useState } from 'react'
import { useStateContext, useTranslation } from '../../../common'
import { LoadingOutlined } from '@ant-design/icons'
import { V2NIMAIModelRoleType } from 'nim-web-sdk-ng/dist/v2/NIM_BROWSER_SDK/V2NIMAIService'
import { V2NIMAIModelRoleType } from 'nim-web-sdk-ng/dist/esm/nim/src/V2NIMAIService'
import { getAIErrorMap } from '../../../utils'

export interface ChatAISearchProps {
Expand Down Expand Up @@ -97,7 +97,7 @@ export const ChatAISearch: FC<ChatAISearchProps> = observer(
bordered={true}
className={`${_prefix}-textarea`}
value={inputValue}
onInput={onInputChangeHandler}
onChange={onInputChangeHandler}
onPressEnter={onPressEnterHandler}
autoSize={{ maxRows: 3 }}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
LoadingOutlined,
} from '@ant-design/icons'
import { getAIErrorMap, logger } from '../../../utils'
import { V2NIMError } from 'nim-web-sdk-ng/dist/v2/NIM_BROWSER_SDK/types'
import { V2NIMError } from 'nim-web-sdk-ng/dist/esm/nim/src/types'

export interface ChatAITranslateProps {
inputValue: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const ChatAddMemebers: React.FC<ChatAddMemebersProps> = ({
}) => {
const [selectedAccounts, setSelectedAccounts] =
useState<string[]>(defaultAccounts)
// const [searchText, setSearchText] = useState('')

useEffect(() => {
resetState()
Expand All @@ -52,9 +51,22 @@ const ChatAddMemebers: React.FC<ChatAddMemebersProps> = ({
setSelectedAccounts(defaultAccounts)
}

const handleSelect = useCallback((selectedList: string[]) => {
setSelectedAccounts(selectedList)
}, [])
const handleSelect = useCallback(
(selectedList: string[]) => {
// 去除已入群的成员
function removeCommonElements(arr1, arr2) {
return arr2.filter((item) => !arr1.includes(item))
}

const resultSelectedList = removeCommonElements(
defaultAccounts,
selectedList
)

setSelectedAccounts(resultSelectedList)
},
[defaultAccounts]
)

return (
<Modal
Expand All @@ -68,10 +80,8 @@ const ChatAddMemebers: React.FC<ChatAddMemebersProps> = ({
destroyOnClose={true}
okText={t('addTeamMemberText')}
>
{/* <SearchInput value={searchText} onChange={setSearchText} /> */}
<div style={{ height: 450 }}>
<FriendSelect
max={200}
prefix={commonPrefix}
onSelect={handleSelect}
selectedAccounts={selectedAccounts}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import {
import {
V2NIMCollection,
V2NIMMessage,
} from 'nim-web-sdk-ng/dist/v2/NIM_BROWSER_SDK/V2NIMMessageService'
} from 'nim-web-sdk-ng/dist/esm/nim/src/V2NIMMessageService'
import { Dropdown, Menu } from 'antd'
import { DeleteOutlined } from '@ant-design/icons'
import { formatDate, mergeActions } from '../../../utils'
import { MenuItem } from '../ChatMessageItem'
import { CollectionMenuItem } from '.'
import { V2NIMConst } from 'nim-web-sdk-ng'
import { V2NIMConst } from 'nim-web-sdk-ng/dist/esm/nim'

export interface CollectionItemProps {
collection: V2NIMCollection
Expand Down Expand Up @@ -68,7 +68,7 @@ const CollectionItem: React.FC<CollectionItemProps> = ({
const defaultMenus: MenuItem[] = [
{
show:
msg.messageType ===
msg?.messageType ===
V2NIMConst.V2NIMMessageType.V2NIM_MESSAGE_TYPE_AUDIO
? 0
: 1,
Expand All @@ -89,7 +89,7 @@ const CollectionItem: React.FC<CollectionItemProps> = ({
: defaultMenus

return finalMenus.filter((item) => item.show)
}, [menus, t, msg.messageType])
}, [menus, t, msg?.messageType])

const handleMenuClick = ({ key }: { key: string }) => {
onMenuClick({
Expand All @@ -108,7 +108,7 @@ const CollectionItem: React.FC<CollectionItemProps> = ({
overlayClassName={`${_prefix}-dropdown`}
>
<div className={`${_prefix}-wrap`}>
<ParseSession msg={msg} prefix={commonPrefix} />
{msg && <ParseSession msg={msg} prefix={commonPrefix} />}
<div className={`${_prefix}-info`}>
<span>{collectionData.senderName}</span>
<span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
V2NIMCollection,
V2NIMCollectionOption,
V2NIMMessage,
} from 'nim-web-sdk-ng/dist/v2/NIM_BROWSER_SDK/V2NIMMessageService'
} from 'nim-web-sdk-ng/dist/esm/nim/src/V2NIMMessageService'
import { logger } from '../../../utils'
import { V2NIMError } from 'nim-web-sdk-ng/dist/v2/NIM_BROWSER_SDK/types'
import { V2NIMError } from 'nim-web-sdk-ng/dist/esm/nim/src/types'
import { MenuItem } from '../ChatMessageItem'
import { debounce } from '@xkit-yx/utils'
import ChatForwardModal from '../ChatForwardModal'
Expand Down

This file was deleted.

This file was deleted.

Loading