Skip to content

Commit

Permalink
Merge pull request #25 from 1eeing/main
Browse files Browse the repository at this point in the history
update 10.0.1
  • Loading branch information
shine2008 authored Jun 3, 2024
2 parents 7a3012a + 3130651 commit 74c826c
Show file tree
Hide file tree
Showing 64 changed files with 2,527 additions and 2,223 deletions.
6 changes: 3 additions & 3 deletions react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"start": "umi dev"
},
"dependencies": {
"@xkit-yx/call-kit": "^2.0.1",
"@xkit-yx/call-kit-react-ui": "^0.4.1",
"@xkit-yx/im-kit-ui": "^9.8.0",
"@xkit-yx/call-kit": "^3.0.0",
"@xkit-yx/call-kit-react-ui": "^0.6.0",
"@xkit-yx/im-kit-ui": "^10.x",
"react-dom": "^16.8.0",
"umi": "^3.5.40"
},
Expand Down
14 changes: 6 additions & 8 deletions 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": "9.8.0",
"version": "10.0.1",
"description": "云信即时通讯组件",
"license": "MIT",
"main": "lib/index.js",
Expand Down Expand Up @@ -33,7 +33,6 @@
"gulp-typescript": "^6.0.0-alpha.1",
"less": "^4.1.1",
"less-plugin-npm-import": "^2.1.0",
"nim-web-sdk-ng": "0.17.0",
"postcss": "^8.3.5",
"postcss-nested": "^5.0.5",
"react": "^16.8.0",
Expand All @@ -46,8 +45,7 @@
"typescript": "^4.6.4"
},
"peerDependencies": {
"@xkit-yx/core-kit": "^0.3.2",
"@xkit-yx/utils": "^0.4.3",
"@xkit-yx/im-store-v2": "^0.0.1",
"antd": "^4.16.3",
"mobx": "^6.6.1",
"mobx-react": "^7.5.2",
Expand All @@ -56,13 +54,13 @@
},
"dependencies": {
"@ant-design/icons": "^5.0.1",
"@xkit-yx/core-kit": "^0.13.0",
"@xkit-yx/im-store": "^0.2.0",
"@xkit-yx/utils": "^0.5.6",
"@xkit-yx/im-store-v2": "^0.1.1",
"@xkit-yx/utils": "^0.6.0",
"antd": "^4.16.3",
"mobx": "^6.6.1",
"mobx-react": "^7.5.2",
"nim-web-sdk-ng": "10.2.700",
"react-string-replace": "^1.1.0"
},
"gitHead": "2460a56b946207f24db9a8d74c10d3776aa5f267"
"gitHead": "4e09464e7bb40f8b578b2704e7931ea1e6928417"
}
81 changes: 48 additions & 33 deletions react/src/YXUIKit/im-kit-ui/src/chat/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@ import React, { ReactNode } from 'react'
import P2pChatContainer from './containers/p2pChatContainer'
import TeamChatContainer from './containers/teamChatContainer'
import { useStateContext, useEventTracking, Welcome, Utils } from '../common'
import {
IMMessage,
TMsgScene,
} from 'nim-web-sdk-ng/dist/NIM_BROWSER_SDK/MsgServiceInterface'
import { RenderP2pCustomMessageOptions } from './components/ChatP2pMessageList'
import { RenderTeamCustomMessageOptions } from './components/ChatTeamMessageList'
import { ChatMessageInputProps } from './components/ChatMessageInput'
import { Session } from 'nim-web-sdk-ng/dist/NIM_BROWSER_SDK/SessionServiceInterface'
import { observer } from 'mobx-react'

import packageJson from '../../package.json'
import { GroupItemProps } from './components/ChatTeamSetting/GroupItem'
import { MenuItem } from './components/ChatMessageItem'
import { SettingActionItemProps } from './components/ChatActionBar'
import {
V2NIMConversationType,
V2NIMConversation,
} from 'nim-web-sdk-ng/dist/v2/NIM_BROWSER_SDK/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'

export interface ActionRenderProps extends ChatMessageInputProps {
scene: TMsgScene
to: string
conversationType: V2NIMConversationType
receiverId: string
}

export interface Action {
Expand All @@ -38,7 +40,7 @@ export interface Action {
}

export interface MsgOperMenuItem extends MenuItem {
onClick?: (msg: IMMessage) => void
onClick?: (msg: V2NIMMessageForUI) => void
}

export interface ChatSettingActionItem extends SettingActionItemProps {
Expand All @@ -47,9 +49,9 @@ export interface ChatSettingActionItem extends SettingActionItemProps {

export interface ChatContainerProps {
/**
自定义选中的会话 sessionId。一般不用传,内部会处理好选中逻辑
自定义选中的会话 conversationId。一般不用传,内部会处理好选中逻辑
*/
selectedSession?: string
selectedConversation?: string
/**
消息发送按钮组配置,不传使用默认的配置
*/
Expand All @@ -71,8 +73,8 @@ export interface ChatContainerProps {
*/
onSendText?: (data: {
value: string
scene: TMsgScene
to: string
conversationType: V2NIMConversationType
receiverId: string
}) => Promise<void>
/**
转让群主后的回调
Expand All @@ -97,16 +99,16 @@ export interface ChatContainerProps {
/**
自定义渲染 header
*/
renderHeader?: (session: Session) => JSX.Element
renderHeader?: (conversation: V2NIMConversation) => JSX.Element
/**
自定义渲染 p2p 聊天输入框 placeholder
*/
renderP2pInputPlaceHolder?: (session: Session) => string
renderP2pInputPlaceHolder?: (conversation: V2NIMConversation) => string
/**
自定义渲染群组聊天输入框 placeholder
*/
renderTeamInputPlaceHolder?: (params: {
session: Session
conversation: V2NIMConversation
mute: boolean
}) => string
/**
Expand All @@ -118,19 +120,25 @@ export interface ChatContainerProps {
/**
自定义渲染消息头像
*/
renderMessageAvatar?: (msg: IMMessage) => JSX.Element | null | undefined
renderMessageAvatar?: (
msg: V2NIMMessageForUI
) => JSX.Element | null | undefined
/**
自定义渲染消息昵称
*/
renderMessageName?: (msg: IMMessage) => JSX.Element | null | undefined
renderMessageName?: (msg: V2NIMMessageForUI) => JSX.Element | null | undefined
/**
自定义渲染消息内容,气泡样式也需要自定义
*/
renderMessageOuterContent?: (msg: IMMessage) => JSX.Element | null | undefined
renderMessageOuterContent?: (
msg: V2NIMMessageForUI
) => JSX.Element | null | undefined
/**
自定义渲染消息内容,气泡样式不需要自定义
*/
renderMessageInnerContent?: (msg: IMMessage) => JSX.Element | null | undefined
renderMessageInnerContent?: (
msg: V2NIMMessageForUI
) => JSX.Element | null | undefined

/**
样式前缀
Expand All @@ -144,7 +152,7 @@ export interface ChatContainerProps {

export const ChatContainer: React.FC<ChatContainerProps> = observer(
({
selectedSession,
selectedConversation,
actions,
p2pSettingActions,
teamSettingActions,
Expand All @@ -166,29 +174,35 @@ export const ChatContainer: React.FC<ChatContainerProps> = observer(
prefix = 'chat',
commonPrefix = 'common',
}) => {
const { store, nim, initOptions } = useStateContext()
const { store, nim } = useStateContext()

const finalSelectedSession =
selectedSession || store.uiStore.selectedSession || ''
const finalSelectedConversation =
selectedConversation || store.uiStore.selectedConversation || ''

const { scene, to } = Utils.parseSessionId(finalSelectedSession)
const receiverId = nim.V2NIMConversationIdUtil.parseConversationTargetId(
finalSelectedConversation
)
const conversationType = nim.V2NIMConversationIdUtil.parseConversationType(
finalSelectedConversation
)

useEventTracking({
appkey: initOptions.appkey,
appkey: nim.options.appkey,
version: packageJson.version,
component: 'ChatUIKit',
imVersion: nim.version,
imVersion: sdkPkg.version,
})

return finalSelectedSession ? (
scene === 'p2p' ? (
return finalSelectedConversation ? (
conversationType ===
V2NIMConst.V2NIMConversationType.V2NIM_CONVERSATION_TYPE_P2P ? (
<P2pChatContainer
prefix={prefix}
commonPrefix={commonPrefix}
scene={scene}
to={to}
onSendText={onSendText}
actions={actions}
conversationType={conversationType}
receiverId={receiverId}
settingActions={p2pSettingActions}
msgOperMenu={msgOperMenu}
renderP2pCustomMessage={renderP2pCustomMessage}
Expand All @@ -199,12 +213,13 @@ export const ChatContainer: React.FC<ChatContainerProps> = observer(
renderMessageInnerContent={renderMessageInnerContent}
renderMessageOuterContent={renderMessageOuterContent}
/>
) : scene === 'team' ? (
) : conversationType ===
V2NIMConst.V2NIMConversationType.V2NIM_CONVERSATION_TYPE_TEAM ? (
<TeamChatContainer
prefix={prefix}
commonPrefix={commonPrefix}
scene={scene}
to={to}
conversationType={conversationType}
receiverId={receiverId}
onSendText={onSendText}
actions={actions}
settingActions={teamSettingActions}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ const ChatAddMemebers: React.FC<ChatAddMemebersProps> = ({
<div style={{ height: 450 }}>
<FriendSelectContainer
prefix={commonPrefix}
onSelect={(selectedList) =>
setSelectedAccounts(selectedList.map((item) => item.account))
}
onSelect={(selectedList) => setSelectedAccounts(selectedList)}
selectedAccounts={selectedAccounts}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ const GroupCreate: React.FC<GroupCreateProps> = ({
<div style={{ height: 450 }}>
<FriendSelectContainer
prefix={commonPrefix}
onSelect={(accounts) =>
setSelectedAccounts(accounts.map((item) => item.account))
}
onSelect={(accounts) => setSelectedAccounts(accounts)}
selectedAccounts={selectedAccounts}
/>
</div>
Expand Down
Loading

0 comments on commit 74c826c

Please sign in to comment.