@trtc/calls-uikit-react 4.1.0
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/README-zh_CN.md +97 -0
- package/README.md +104 -0
- package/debug/GenerateTestUserSig-es.js +26 -0
- package/debug/lib-generate-test-usersig-es.min.js +2 -0
- package/package.json +42 -0
- package/src/Components/TUICallKit/TUICallKit.module.scss +21 -0
- package/src/Components/TUICallKit/TUICallKit.tsx +267 -0
- package/src/Components/TUICallKit/index.ts +3 -0
- package/src/Components/assets/base/close.svg +1 -0
- package/src/Components/assets/base/error.svg +1 -0
- package/src/Components/assets/base/info.svg +1 -0
- package/src/Components/assets/base/loading-circle.svg +1 -0
- package/src/Components/assets/base/success.svg +1 -0
- package/src/Components/assets/base/waring.svg +1 -0
- package/src/Components/assets/button/accept.svg +10 -0
- package/src/Components/assets/button/backgroundBlurClose.svg +3 -0
- package/src/Components/assets/button/backgroundBlurOpen.svg +3 -0
- package/src/Components/assets/button/camera-close.svg +8 -0
- package/src/Components/assets/button/camera-open.svg +3 -0
- package/src/Components/assets/button/desktop/arrow.png +0 -0
- package/src/Components/assets/button/desktop/fullScreen.svg +4 -0
- package/src/Components/assets/button/desktop/minimize.svg +6 -0
- package/src/Components/assets/button/hangup.svg +3 -0
- package/src/Components/assets/button/microphone-close.svg +4 -0
- package/src/Components/assets/button/microphone-open.svg +4 -0
- package/src/Components/assets/button/mobile/down.svg +4 -0
- package/src/Components/assets/button/mobile/minimize.svg +4 -0
- package/src/Components/assets/button/mobile/switch-camera.svg +3 -0
- package/src/Components/assets/button/mobile/up.svg +4 -0
- package/src/Components/assets/button/speaker-close.svg +4 -0
- package/src/Components/assets/button/speaker-open.svg +3 -0
- package/src/Components/assets/button/switch-audio.svg +3 -0
- package/src/Components/assets/callMessage/audioCall.svg +3 -0
- package/src/Components/assets/callMessage/videoCall.svg +3 -0
- package/src/Components/assets/common/defaultAvatar.svg +11 -0
- package/src/Components/assets/common/microphone-volumn-close.svg +9 -0
- package/src/Components/assets/floatingWindow/desktop/floatCallEnd.svg +3 -0
- package/src/Components/assets/floatingWindow/desktop/floatFullScreen.svg +3 -0
- package/src/Components/assets/floatingWindow/desktop/floatMicrophone.svg +4 -0
- package/src/Components/assets/floatingWindow/desktop/floatMicrophoneClosed.svg +3 -0
- package/src/Components/assets/floatingWindow/mobile/camera-close.svg +14 -0
- package/src/Components/assets/floatingWindow/mobile/camera-open.svg +14 -0
- package/src/Components/assets/floatingWindow/mobile/earphone.svg +3 -0
- package/src/Components/assets/floatingWindow/mobile/microphone-close.svg +4 -0
- package/src/Components/assets/floatingWindow/mobile/microphone-open.svg +4 -0
- package/src/Components/assets/permission/desktop/index.ts +11 -0
- package/src/Components/assets/permission/desktop/mac/permit-en.jpg +0 -0
- package/src/Components/assets/permission/desktop/mac/permit-zh.jpg +0 -0
- package/src/Components/assets/permission/desktop/win/permit-en.png +0 -0
- package/src/Components/assets/permission/desktop/win/permit-zh.png +0 -0
- package/src/Components/assets/streamInfo/mobile/microphone-close-group.svg +19 -0
- package/src/Components/assets/streamInfo/mobile/microphone-close-single.svg +6 -0
- package/src/Components/assets/streamInfo/mobile/volumn.svg +20 -0
- package/src/Components/assets/streamInfo/networkStatus.svg +22 -0
- package/src/Components/components/GroupCall/GroupCall.module.scss +13 -0
- package/src/Components/components/GroupCall/GroupCall.tsx +82 -0
- package/src/Components/components/GroupCall/MediaContainer/AudioStream/AudioStream.tsx +41 -0
- package/src/Components/components/GroupCall/MediaContainer/MediaContainer.module.scss +74 -0
- package/src/Components/components/GroupCall/MediaContainer/MediaContainer.tsx +138 -0
- package/src/Components/components/GroupCall/MediaContainer/StreamLoading/StreamLoading.tsx +48 -0
- package/src/Components/components/GroupCall/MediaContainer/index.ts +3 -0
- package/src/Components/components/GroupCall/Waiting/Waiting.module.scss +44 -0
- package/src/Components/components/GroupCall/Waiting/Waiting.tsx +89 -0
- package/src/Components/components/SingleCall/MediaContainer/AudioStream/AudioStream.tsx +86 -0
- package/src/Components/components/SingleCall/MediaContainer/MediaContainer.module.scss +33 -0
- package/src/Components/components/SingleCall/MediaContainer/MediaContainer.tsx +121 -0
- package/src/Components/components/SingleCall/MediaContainer/hooks/useGetLargeViewName.ts +29 -0
- package/src/Components/components/SingleCall/MediaContainer/index.ts +3 -0
- package/src/Components/components/SingleCall/SingleCall.module.scss +28 -0
- package/src/Components/components/SingleCall/SingleCall.tsx +54 -0
- package/src/Components/components/SingleCall/Waiting/Waiting.module.scss +3 -0
- package/src/Components/components/SingleCall/Waiting/Waiting.tsx +45 -0
- package/src/Components/components/base/Avatar/Avatar.scss +28 -0
- package/src/Components/components/base/Avatar/Avatar.tsx +52 -0
- package/src/Components/components/base/Avatar/index.ts +3 -0
- package/src/Components/components/base/Button/Button.scss +122 -0
- package/src/Components/components/base/Button/Button.tsx +107 -0
- package/src/Components/components/base/Button/index.ts +3 -0
- package/src/Components/components/base/Drag/Drag.tsx +155 -0
- package/src/Components/components/base/Drag/index.tsx +3 -0
- package/src/Components/components/base/Grid/Col/Col.scss +31 -0
- package/src/Components/components/base/Grid/Col/Col.tsx +52 -0
- package/src/Components/components/base/Grid/Col/index.ts +3 -0
- package/src/Components/components/base/Grid/Row/Row.scss +27 -0
- package/src/Components/components/base/Grid/Row/Row.tsx +51 -0
- package/src/Components/components/base/Grid/Row/index.ts +5 -0
- package/src/Components/components/base/Grid/style/mixin.scss +61 -0
- package/src/Components/components/base/GridLayout/GridLayout.tsx +189 -0
- package/src/Components/components/base/GridLayout/GridPlusItem/GridPlusItem.scss +11 -0
- package/src/Components/components/base/GridLayout/GridPlusItem/GridPlusItem.tsx +37 -0
- package/src/Components/components/base/GridLayout/index.ts +7 -0
- package/src/Components/components/base/Icon/Icon.tsx +25 -0
- package/src/Components/components/base/Loading/Circle/Cilrcle.tsx +20 -0
- package/src/Components/components/base/Loading/Circle/Circle.scss +29 -0
- package/src/Components/components/base/Loading/Dot/Dot.scss +69 -0
- package/src/Components/components/base/Loading/Dot/Dot.tsx +21 -0
- package/src/Components/components/base/Loading/Loading.scss +22 -0
- package/src/Components/components/base/Loading/Loading.tsx +47 -0
- package/src/Components/components/base/Loading/index.ts +3 -0
- package/src/Components/components/base/Message/Message.scss +61 -0
- package/src/Components/components/base/Message/Message.tsx +94 -0
- package/src/Components/components/base/Message/MessageIcon/Error.tsx +7 -0
- package/src/Components/components/base/Message/MessageIcon/Info.tsx +7 -0
- package/src/Components/components/base/Message/MessageIcon/Success.tsx +8 -0
- package/src/Components/components/base/Message/MessageIcon/Warning.tsx +7 -0
- package/src/Components/components/base/Message/MessagePlugin.tsx +148 -0
- package/src/Components/components/base/Overlayer/Overlayer.scss +17 -0
- package/src/Components/components/base/Overlayer/Overlayer.tsx +49 -0
- package/src/Components/components/base/Popup/Popup.scss +34 -0
- package/src/Components/components/base/Popup/Popup.tsx +91 -0
- package/src/Components/components/base/Popup/hooks/useTrigger.tsx +67 -0
- package/src/Components/components/base/Portal/Portal.tsx +74 -0
- package/src/Components/components/base/Text/Text.scss +15 -0
- package/src/Components/components/base/Text/Text.tsx +30 -0
- package/src/Components/components/base/Time/Time.scss +14 -0
- package/src/Components/components/base/Time/Time.tsx +13 -0
- package/src/Components/components/base/ToggleWindow/ToggleWindow.scss +9 -0
- package/src/Components/components/base/ToggleWindow/ToggleWindow.tsx +83 -0
- package/src/Components/components/base/ToggleWindow/ToggleWindowItem/ToggleWindowItem.scss +51 -0
- package/src/Components/components/base/ToggleWindow/ToggleWindowItem/ToggleWindowItem.tsx +50 -0
- package/src/Components/components/base/ToggleWindow/index.ts +7 -0
- package/src/Components/components/base/common.ts +13 -0
- package/src/Components/components/base/hooks/useControlled.ts +31 -0
- package/src/Components/components/base/hooks/useDrag.ts +96 -0
- package/src/Components/components/base/hooks/useListenerEvent.ts +37 -0
- package/src/Components/components/base/hooks/useMutationObserver.ts +38 -0
- package/src/Components/components/base/hooks/useOnClickOutSide.ts +24 -0
- package/src/Components/components/base/util/index.ts +26 -0
- package/src/Components/components/common/ButtonPanel/ButtonPanel.tsx +127 -0
- package/src/Components/components/common/ButtonPanel/ButtonPanelH5/ButtonPanelH5.module.scss +67 -0
- package/src/Components/components/common/ButtonPanel/ButtonPanelH5/ButtonPanelH5.tsx +153 -0
- package/src/Components/components/common/ButtonPanel/ButtonPanelPC/ButtonPanelPC.module.scss +9 -0
- package/src/Components/components/common/ButtonPanel/ButtonPanelPC/ButtonPanelPC.tsx +32 -0
- package/src/Components/components/common/ButtonPanel/button/Accept/Accept.module.scss +7 -0
- package/src/Components/components/common/ButtonPanel/button/Accept/Accept.tsx +39 -0
- package/src/Components/components/common/ButtonPanel/button/Accept/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/BackgroundBlur/BackgroundBlur.module.scss +15 -0
- package/src/Components/components/common/ButtonPanel/button/BackgroundBlur/BackgroundBlur.tsx +46 -0
- package/src/Components/components/common/ButtonPanel/button/BackgroundBlur/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/Camera.tsx +81 -0
- package/src/Components/components/common/ButtonPanel/button/FullScreen/FullScreen.module.scss +13 -0
- package/src/Components/components/common/ButtonPanel/button/FullScreen/FullScreen.tsx +26 -0
- package/src/Components/components/common/ButtonPanel/button/FullScreen/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/Hangup/Hangup.module.scss +7 -0
- package/src/Components/components/common/ButtonPanel/button/Hangup/Hangup.tsx +42 -0
- package/src/Components/components/common/ButtonPanel/button/Hangup/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/Microphone.tsx +78 -0
- package/src/Components/components/common/ButtonPanel/button/Minimize/Minimize.module.scss +23 -0
- package/src/Components/components/common/ButtonPanel/button/Minimize/Minimize.tsx +35 -0
- package/src/Components/components/common/ButtonPanel/button/Minimize/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/Reject/Reject.module.scss +7 -0
- package/src/Components/components/common/ButtonPanel/button/Reject/Reject.tsx +39 -0
- package/src/Components/components/common/ButtonPanel/button/Reject/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/Speaker.tsx +75 -0
- package/src/Components/components/common/ButtonPanel/button/SwitchAudioCall.tsx +32 -0
- package/src/Components/components/common/ButtonPanel/button/SwitchCamera.tsx +19 -0
- package/src/Components/components/common/ButtonPanel/button/common.module.scss +51 -0
- package/src/Components/components/common/ButtonPanel/config.ts +505 -0
- package/src/Components/components/common/ButtonPanel/index.ts +3 -0
- package/src/Components/components/common/CallMessage/CallMessage.tsx +18 -0
- package/src/Components/components/common/CallMessage/CallMessageC2C/CallMessageC2C.module.scss +19 -0
- package/src/Components/components/common/CallMessage/CallMessageC2C/CallMessageC2C.tsx +84 -0
- package/src/Components/components/common/CallMessage/CallMessageGroup/CallMessageGroup.module.scss +5 -0
- package/src/Components/components/common/CallMessage/CallMessageGroup/CallMessageGroup.tsx +37 -0
- package/src/Components/components/common/CallMessage/index.ts +3 -0
- package/src/Components/components/common/DeviceSelector/DeviceSelector.module.scss +62 -0
- package/src/Components/components/common/DeviceSelector/DeviceSelector.tsx +105 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindow.tsx +37 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowGroupCall/FloatingWindowGroupCall.tsx +97 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowGroupCall/style/FloatingWindowGroupCall.module.scss +2 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowGroupCall/style/mobile.module.scss +126 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowGroupCall/style/pc.module.scss +126 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowSingleCall/FloatingWindowSingleCall.tsx +75 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowSingleCall/style/FloatingWindowSingleCall.module.scss +2 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowSingleCall/style/mobile.module.scss +117 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowSingleCall/style/pc.module.scss +123 -0
- package/src/Components/components/common/FloatingWindow/index.ts +3 -0
- package/src/Components/components/common/MicrophoneVolumn/MicrophoneVolumn.module.scss +9 -0
- package/src/Components/components/common/MicrophoneVolumn/MicrophoneVolumn.tsx +50 -0
- package/src/Components/components/common/OverlayStream/OverlayStream.module.scss +165 -0
- package/src/Components/components/common/OverlayStream/OverlayStream.tsx +119 -0
- package/src/Components/components/common/Player/Player.module.scss +11 -0
- package/src/Components/components/common/Player/Player.tsx +75 -0
- package/src/Components/components/common/Pusher/Pusher.module.scss +10 -0
- package/src/Components/components/common/Pusher/Pusher.tsx +96 -0
- package/src/Components/components/common/StreamInfo/StreamInfo.tsx +10 -0
- package/src/Components/components/common/StreamInfo/StreamInfoH5/StreamInfoH5.module.scss +21 -0
- package/src/Components/components/common/StreamInfo/StreamInfoH5/StreamInfoH5.tsx +95 -0
- package/src/Components/components/common/StreamInfo/StreamInfoPC/StreamInfoPC.module.scss +38 -0
- package/src/Components/components/common/StreamInfo/StreamInfoPC/StreamInfoPC.tsx +35 -0
- package/src/Components/components/common/StreamInfo/index.ts +3 -0
- package/src/Components/components/common/Tip/Tip.tsx +68 -0
- package/src/Components/components/common/TopBar/TopBar.tsx +17 -0
- package/src/Components/components/common/TopBar/h5/TopBarH5.module.scss +12 -0
- package/src/Components/components/common/TopBar/h5/TopBarH5.tsx +40 -0
- package/src/Components/components/common/TopBar/pc/TopBarPC.module.scss +8 -0
- package/src/Components/components/common/TopBar/pc/TopBarPC.tsx +36 -0
- package/src/Components/const/common.ts +15 -0
- package/src/Components/context/CallUserInfoContext.ts +21 -0
- package/src/Components/context/CallerUserInfoContext.ts +11 -0
- package/src/Components/context/CustomUIConfigContext.ts +6 -0
- package/src/Components/context/FocusItemContext.ts +13 -0
- package/src/Components/context/IsClickableContext.ts +5 -0
- package/src/Components/context/TranslateContext.ts +6 -0
- package/src/Components/context/UserInfoContext.ts +9 -0
- package/src/Components/context/index.ts +17 -0
- package/src/Components/hooks/index.ts +9 -0
- package/src/Components/hooks/useCallDuration.ts +34 -0
- package/src/Components/hooks/useCustomButtonUIConfig.ts +27 -0
- package/src/Components/hooks/useDeviceList.ts +53 -0
- package/src/Components/hooks/useGetSpeakers.ts +69 -0
- package/src/Components/hooks/useGetVolumeMap.ts +67 -0
- package/src/Components/hooks/useNetWorkStatus.ts +34 -0
- package/src/Components/hooks/useTranslate.ts +7 -0
- package/src/Components/hooks/useViewBackgroundConfig.ts +8 -0
- package/src/Components/style/common/mixin.scss +22 -0
- package/src/Components/style/common/var.scss +21 -0
- package/src/Components/style/index.scss +5 -0
- package/src/Components/style/theme/_dark.scss +56 -0
- package/src/Components/style/theme/_light.scss +56 -0
- package/src/Components/style/theme/_util.scss +79 -0
- package/src/Components/style/theme/color.scss +23 -0
- package/src/Components/util/classnames.ts +35 -0
- package/src/Components/util/index.ts +138 -0
- package/src/Components/util/uiDesign.ts +45 -0
- package/src/TUICallService/CallService/UIDesign.ts +174 -0
- package/src/TUICallService/CallService/bellContext.ts +88 -0
- package/src/TUICallService/CallService/chatCombine.ts +313 -0
- package/src/TUICallService/CallService/engineEventHandler.ts +404 -0
- package/src/TUICallService/CallService/index.ts +797 -0
- package/src/TUICallService/CallService/miniProgram.ts +65 -0
- package/src/TUICallService/CallService/utils.ts +281 -0
- package/src/TUICallService/TUIGlobal/tuiGlobal.ts +43 -0
- package/src/TUICallService/TUIStore/callStore.ts +93 -0
- package/src/TUICallService/TUIStore/tuiStore.ts +167 -0
- package/src/TUICallService/assets/phone_dialing.mp3 +0 -0
- package/src/TUICallService/assets/phone_ringing.mp3 +0 -0
- package/src/TUICallService/const/call.ts +157 -0
- package/src/TUICallService/const/error.ts +20 -0
- package/src/TUICallService/const/index.ts +103 -0
- package/src/TUICallService/const/log.ts +9 -0
- package/src/TUICallService/index.ts +37 -0
- package/src/TUICallService/interface/ICallService.ts +70 -0
- package/src/TUICallService/interface/ICallStore.ts +55 -0
- package/src/TUICallService/interface/ITUIGlobal.ts +36 -0
- package/src/TUICallService/interface/ITUIStore.ts +87 -0
- package/src/TUICallService/interface/index.ts +4 -0
- package/src/TUICallService/locales/en.ts +135 -0
- package/src/TUICallService/locales/index.ts +61 -0
- package/src/TUICallService/locales/ja_JP.ts +134 -0
- package/src/TUICallService/locales/zh-cn.ts +130 -0
- package/src/TUICallService/serve/callManager.ts +109 -0
- package/src/TUICallService/utils/common-utils.ts +269 -0
- package/src/TUICallService/utils/decorators/promise-retry.ts +51 -0
- package/src/TUICallService/utils/env.ts +51 -0
- package/src/TUICallService/utils/index.ts +32 -0
- package/src/TUICallService/utils/is-empty.ts +31 -0
- package/src/TUICallService/utils/retry.ts +88 -0
- package/src/TUICallService/utils/timer.ts +162 -0
- package/src/TUICallService/utils/validate/avoidRepeatedCall.ts +39 -0
- package/src/TUICallService/utils/validate/index.ts +7 -0
- package/src/TUICallService/utils/validate/validateConfig.ts +188 -0
- package/src/TUICallService/utils/validate/validateParams.ts +88 -0
- package/src/TUICallService/utils/validate/validateStatus.ts +26 -0
- package/src/image.d.ts +8 -0
- package/src/index.ts +63 -0
- package/src/style.d.ts +1 -0
- package/tuicall-uikit-react.es.js +13177 -0
- package/tuicall-uikit-react.umd.js +133 -0
- package/types/Components/TUICallKit/TUICallKit.d.ts +15 -0
- package/types/Components/TUICallKit/index.d.ts +2 -0
- package/types/Components/assets/permission/desktop/index.d.ts +5 -0
- package/types/Components/components/GroupCall/GroupCall.d.ts +1 -0
- package/types/Components/components/GroupCall/MediaContainer/AudioStream/AudioStream.d.ts +10 -0
- package/types/Components/components/GroupCall/MediaContainer/MediaContainer.d.ts +1 -0
- package/types/Components/components/GroupCall/MediaContainer/StreamLoading/StreamLoading.d.ts +7 -0
- package/types/Components/components/GroupCall/MediaContainer/index.d.ts +2 -0
- package/types/Components/components/GroupCall/Waiting/Waiting.d.ts +8 -0
- package/types/Components/components/SingleCall/MediaContainer/AudioStream/AudioStream.d.ts +11 -0
- package/types/Components/components/SingleCall/MediaContainer/MediaContainer.d.ts +1 -0
- package/types/Components/components/SingleCall/MediaContainer/hooks/useGetLargeViewName.d.ts +3 -0
- package/types/Components/components/SingleCall/MediaContainer/index.d.ts +2 -0
- package/types/Components/components/SingleCall/SingleCall.d.ts +3 -0
- package/types/Components/components/SingleCall/Waiting/Waiting.d.ts +9 -0
- package/types/Components/components/base/Avatar/Avatar.d.ts +12 -0
- package/types/Components/components/base/Avatar/index.d.ts +2 -0
- package/types/Components/components/base/Button/Button.d.ts +25 -0
- package/types/Components/components/base/Button/index.d.ts +2 -0
- package/types/Components/components/base/Drag/Drag.d.ts +14 -0
- package/types/Components/components/base/Drag/index.d.ts +2 -0
- package/types/Components/components/base/Grid/Col/Col.d.ts +14 -0
- package/types/Components/components/base/Grid/Col/index.d.ts +2 -0
- package/types/Components/components/base/Grid/Row/Row.d.ts +14 -0
- package/types/Components/components/base/Grid/Row/index.d.ts +3 -0
- package/types/Components/components/base/GridLayout/GridLayout.d.ts +11 -0
- package/types/Components/components/base/GridLayout/GridPlusItem/GridPlusItem.d.ts +14 -0
- package/types/Components/components/base/GridLayout/index.d.ts +3 -0
- package/types/Components/components/base/Icon/Icon.d.ts +9 -0
- package/types/Components/components/base/Loading/Circle/Cilrcle.d.ts +6 -0
- package/types/Components/components/base/Loading/Dot/Dot.d.ts +6 -0
- package/types/Components/components/base/Loading/Loading.d.ts +14 -0
- package/types/Components/components/base/Loading/index.d.ts +2 -0
- package/types/Components/components/base/Message/Message.d.ts +16 -0
- package/types/Components/components/base/Message/MessageIcon/Error.d.ts +1 -0
- package/types/Components/components/base/Message/MessageIcon/Info.d.ts +1 -0
- package/types/Components/components/base/Message/MessageIcon/Success.d.ts +1 -0
- package/types/Components/components/base/Message/MessageIcon/Warning.d.ts +1 -0
- package/types/Components/components/base/Message/MessagePlugin.d.ts +14 -0
- package/types/Components/components/base/Overlayer/Overlayer.d.ts +14 -0
- package/types/Components/components/base/Popup/Popup.d.ts +13 -0
- package/types/Components/components/base/Popup/hooks/useTrigger.d.ts +10 -0
- package/types/Components/components/base/Portal/Portal.d.ts +19 -0
- package/types/Components/components/base/Text/Text.d.ts +10 -0
- package/types/Components/components/base/Time/Time.d.ts +7 -0
- package/types/Components/components/base/ToggleWindow/ToggleWindow.d.ts +15 -0
- package/types/Components/components/base/ToggleWindow/ToggleWindowItem/ToggleWindowItem.d.ts +14 -0
- package/types/Components/components/base/ToggleWindow/index.d.ts +3 -0
- package/types/Components/components/base/common.d.ts +7 -0
- package/types/Components/components/base/hooks/useControlled.d.ts +8 -0
- package/types/Components/components/base/hooks/useDrag.d.ts +6 -0
- package/types/Components/components/base/hooks/useListenerEvent.d.ts +13 -0
- package/types/Components/components/base/hooks/useMutationObserver.d.ts +4 -0
- package/types/Components/components/base/hooks/useOnClickOutSide.d.ts +1 -0
- package/types/Components/components/base/util/index.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/ButtonPanel.d.ts +1 -0
- package/types/Components/components/common/ButtonPanel/ButtonPanelH5/ButtonPanelH5.d.ts +8 -0
- package/types/Components/components/common/ButtonPanel/ButtonPanelPC/ButtonPanelPC.d.ts +6 -0
- package/types/Components/components/common/ButtonPanel/button/Accept/Accept.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/Accept/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/BackgroundBlur/BackgroundBlur.d.ts +1 -0
- package/types/Components/components/common/ButtonPanel/button/BackgroundBlur/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/Camera.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/FullScreen/FullScreen.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/FullScreen/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/Hangup/Hangup.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/Hangup/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/Microphone.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/Minimize/Minimize.d.ts +1 -0
- package/types/Components/components/common/ButtonPanel/button/Minimize/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/Reject/Reject.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/Reject/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/Speaker.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/SwitchAudioCall.d.ts +1 -0
- package/types/Components/components/common/ButtonPanel/button/SwitchCamera.d.ts +1 -0
- package/types/Components/components/common/ButtonPanel/config.d.ts +254 -0
- package/types/Components/components/common/ButtonPanel/index.d.ts +2 -0
- package/types/Components/components/common/CallMessage/CallMessage.d.ts +10 -0
- package/types/Components/components/common/CallMessage/CallMessageC2C/CallMessageC2C.d.ts +2 -0
- package/types/Components/components/common/CallMessage/CallMessageGroup/CallMessageGroup.d.ts +2 -0
- package/types/Components/components/common/CallMessage/index.d.ts +2 -0
- package/types/Components/components/common/DeviceSelector/DeviceSelector.d.ts +7 -0
- package/types/Components/components/common/FloatingWindow/FloatingWindow.d.ts +10 -0
- package/types/Components/components/common/FloatingWindow/FloatingWindowGroupCall/FloatingWindowGroupCall.d.ts +9 -0
- package/types/Components/components/common/FloatingWindow/FloatingWindowSingleCall/FloatingWindowSingleCall.d.ts +10 -0
- package/types/Components/components/common/FloatingWindow/index.d.ts +2 -0
- package/types/Components/components/common/MicrophoneVolumn/MicrophoneVolumn.d.ts +8 -0
- package/types/Components/components/common/OverlayStream/OverlayStream.d.ts +28 -0
- package/types/Components/components/common/Player/Player.d.ts +15 -0
- package/types/Components/components/common/Pusher/Pusher.d.ts +13 -0
- package/types/Components/components/common/StreamInfo/StreamInfo.d.ts +1 -0
- package/types/Components/components/common/StreamInfo/StreamInfoH5/StreamInfoH5.d.ts +10 -0
- package/types/Components/components/common/StreamInfo/StreamInfoPC/StreamInfoPC.d.ts +9 -0
- package/types/Components/components/common/StreamInfo/index.d.ts +2 -0
- package/types/Components/components/common/Tip/Tip.d.ts +7 -0
- package/types/Components/components/common/TopBar/TopBar.d.ts +1 -0
- package/types/Components/components/common/TopBar/h5/TopBarH5.d.ts +5 -0
- package/types/Components/components/common/TopBar/pc/TopBarPC.d.ts +5 -0
- package/types/Components/const/common.d.ts +11 -0
- package/types/Components/context/CallUserInfoContext.d.ts +17 -0
- package/types/Components/context/CallerUserInfoContext.d.ts +7 -0
- package/types/Components/context/CustomUIConfigContext.d.ts +3 -0
- package/types/Components/context/FocusItemContext.d.ts +8 -0
- package/types/Components/context/IsClickableContext.d.ts +2 -0
- package/types/Components/context/TranslateContext.d.ts +4 -0
- package/types/Components/context/UserInfoContext.d.ts +6 -0
- package/types/Components/context/index.d.ts +8 -0
- package/types/Components/hooks/index.d.ts +4 -0
- package/types/Components/hooks/useCallDuration.d.ts +1 -0
- package/types/Components/hooks/useCustomButtonUIConfig.d.ts +1 -0
- package/types/Components/hooks/useDeviceList.d.ts +8 -0
- package/types/Components/hooks/useGetSpeakers.d.ts +1 -0
- package/types/Components/hooks/useGetVolumeMap.d.ts +3 -0
- package/types/Components/hooks/useNetWorkStatus.d.ts +1 -0
- package/types/Components/hooks/useTranslate.d.ts +3 -0
- package/types/Components/hooks/useViewBackgroundConfig.d.ts +1 -0
- package/types/Components/util/classnames.d.ts +1 -0
- package/types/Components/util/index.d.ts +15 -0
- package/types/Components/util/uiDesign.d.ts +2 -0
- package/types/TUICallService/CallService/UIDesign.d.ts +28 -0
- package/types/TUICallService/CallService/bellContext.d.ts +19 -0
- package/types/TUICallService/CallService/chatCombine.d.ts +50 -0
- package/types/TUICallService/CallService/engineEventHandler.d.ts +35 -0
- package/types/TUICallService/CallService/index.d.ts +98 -0
- package/types/TUICallService/CallService/miniProgram.d.ts +7 -0
- package/types/TUICallService/CallService/utils.d.ts +42 -0
- package/types/TUICallService/TUIGlobal/tuiGlobal.d.ts +21 -0
- package/types/TUICallService/TUIStore/callStore.d.ts +10 -0
- package/types/TUICallService/TUIStore/tuiStore.d.ts +57 -0
- package/types/TUICallService/const/call.d.ts +141 -0
- package/types/TUICallService/const/error.d.ts +2 -0
- package/types/TUICallService/const/index.d.ts +27 -0
- package/types/TUICallService/const/log.d.ts +7 -0
- package/types/TUICallService/index.d.ts +5 -0
- package/types/TUICallService/interface/ICallService.d.ts +69 -0
- package/types/TUICallService/interface/ICallStore.d.ts +47 -0
- package/types/TUICallService/interface/ITUIGlobal.d.ts +36 -0
- package/types/TUICallService/interface/ITUIStore.d.ts +83 -0
- package/types/TUICallService/interface/index.d.ts +4 -0
- package/types/TUICallService/locales/en.d.ts +128 -0
- package/types/TUICallService/locales/index.d.ts +10 -0
- package/types/TUICallService/locales/ja_JP.d.ts +127 -0
- package/types/TUICallService/locales/zh-cn.d.ts +123 -0
- package/types/TUICallService/serve/callManager.d.ts +11 -0
- package/types/TUICallService/utils/common-utils.d.ts +62 -0
- package/types/TUICallService/utils/decorators/promise-retry.d.ts +32 -0
- package/types/TUICallService/utils/env.d.ts +10 -0
- package/types/TUICallService/utils/index.d.ts +2 -0
- package/types/TUICallService/utils/is-empty.d.ts +2 -0
- package/types/TUICallService/utils/retry.d.ts +36 -0
- package/types/TUICallService/utils/timer.d.ts +63 -0
- package/types/TUICallService/utils/validate/avoidRepeatedCall.d.ts +10 -0
- package/types/TUICallService/utils/validate/index.d.ts +2 -0
- package/types/TUICallService/utils/validate/validateConfig.d.ts +173 -0
- package/types/TUICallService/utils/validate/validateParams.d.ts +1 -0
- package/types/TUICallService/utils/validate/validateStatus.d.ts +5 -0
- package/types/index.d.ts +11 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/* eslint-disable no-param-reassign */
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
/*
|
|
5
|
+
* @drag: 添加拖拽事件的元素(支持传入元素的drager,id,class等)必填参数
|
|
6
|
+
* @draggerBox: 被拖拽的整体元素(支持传入元素的dragger,id,class等)可选参数
|
|
7
|
+
* @container: 可拖拽的区域(支持传入元素的dragger,id,class等)可选参数
|
|
8
|
+
* @maring: 离外部元素的间隔 可选参数
|
|
9
|
+
*/
|
|
10
|
+
export default function useDrag({
|
|
11
|
+
dragger, draggerBox = dragger, container = document.body, maring = [0, 0, 0, 0],
|
|
12
|
+
}) {
|
|
13
|
+
const [translateX, setTranslateX] = useState(0); // 水平方向偏移量
|
|
14
|
+
const [translateY, setTranslateY] = useState(0); // 垂直方向偏移量
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (!dragger) return;
|
|
18
|
+
if (!draggerBox) return;
|
|
19
|
+
if (!container) return;
|
|
20
|
+
dragger = typeof dragger === 'string' ? document.querySelector(dragger) : dragger; // 根据传入的值类型,去查找使用元素
|
|
21
|
+
draggerBox = typeof draggerBox === 'string' ? document.querySelector(draggerBox) : draggerBox;
|
|
22
|
+
container = typeof container === 'string' ? document.querySelector(container) : container;
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
left: containerL,
|
|
26
|
+
top: containerT,
|
|
27
|
+
right: containerR,
|
|
28
|
+
bottom: containerB,
|
|
29
|
+
} = container.getBoundingClientRect(); // 获取可拖拽区域边界位置
|
|
30
|
+
|
|
31
|
+
const onMouseDown = (event) => {
|
|
32
|
+
const initMouseX = event.clientX; // 元素初始水平坐标值
|
|
33
|
+
const initMouseY = event.clientY;// 元素初始垂直坐标
|
|
34
|
+
|
|
35
|
+
const {
|
|
36
|
+
left: boxL,
|
|
37
|
+
top: boxT,
|
|
38
|
+
right: boxR,
|
|
39
|
+
bottom: boxB,
|
|
40
|
+
} = draggerBox.getBoundingClientRect(); // 获取拖拽实体的位置
|
|
41
|
+
|
|
42
|
+
let deltaMouseX; // 实际水平偏移量
|
|
43
|
+
let deltaMouseY; // 实际垂直增量值
|
|
44
|
+
|
|
45
|
+
const onMouseMove = (e: MouseEvent) => {
|
|
46
|
+
const moveMouseX = e.clientX; // 元素移动后水平坐标值
|
|
47
|
+
const moveMouseY = e.clientY; // 元素移动后垂直坐标值
|
|
48
|
+
|
|
49
|
+
let deltaX = moveMouseX - initMouseX; // 当前移动水平相对移动距离
|
|
50
|
+
let deltaY = moveMouseY - initMouseY; // 当前移动垂直相对移动距离
|
|
51
|
+
|
|
52
|
+
if (boxL + deltaX < containerL + maring[0]) {
|
|
53
|
+
// 当元素左边框+水平相对移动距离 < 可拖拽区域左边界+左边距时 (说明元素已经超出左侧边界)
|
|
54
|
+
|
|
55
|
+
deltaX = containerL + maring[0] - boxL;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (boxR + deltaX > containerR - maring[1]) {
|
|
59
|
+
// 当元素右边框+水平相对移动距离 > 可拖拽区域右边界+右边距时 (说明元素已经超出右侧边界)
|
|
60
|
+
deltaX = containerR - maring[1] - boxR;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (boxB + deltaY > containerB - maring[2]) {
|
|
64
|
+
// 当元素下边框+垂直相对移动距离 > 可拖拽区域下边界+下边距时 (说明元素已经超出下侧边界)
|
|
65
|
+
deltaY = containerB - maring[2] - boxB;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (boxT + deltaY < containerT + maring[3]) {
|
|
69
|
+
// 当元素上边框+垂直相对移动距离 < 可拖拽区域上边界+上边距时 (说明元素已经超出上侧边界)
|
|
70
|
+
deltaY = containerT + maring[3] - boxT;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
deltaMouseX = deltaX + translateX; // 实际水平偏移量
|
|
74
|
+
deltaMouseY = deltaY + translateY; // 实际垂直偏移量
|
|
75
|
+
|
|
76
|
+
dragger.style.top = '100px';
|
|
77
|
+
dragger.style.transform = `translate(${deltaMouseX}px, ${deltaMouseY}px)`;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const onMouseUp = () => {
|
|
81
|
+
setTranslateX(deltaMouseX); // 保存上次水平偏移量
|
|
82
|
+
setTranslateY(deltaMouseY); // 保存上次垂直偏移量
|
|
83
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
84
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
85
|
+
};
|
|
86
|
+
window.addEventListener('mousemove', onMouseMove);
|
|
87
|
+
window.addEventListener('mouseup', onMouseUp);
|
|
88
|
+
window.addEventListener('touchmove', onMouseMove);
|
|
89
|
+
window.addEventListener('touchup', onMouseUp);
|
|
90
|
+
};
|
|
91
|
+
dragger.addEventListener('touchstart', onMouseDown);
|
|
92
|
+
|
|
93
|
+
// eslint-disable-next-line consistent-return
|
|
94
|
+
return () => dragger.removeEventListener('mouseup', onMouseDown);
|
|
95
|
+
}, [dragger, draggerBox, container, maring]);
|
|
96
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @function Add an event listener to the target element
|
|
3
|
+
* @description Add an event listener to the target element
|
|
4
|
+
* @param {HTMLElement} The element that needs to be monitored, if empty, defaults to window.document
|
|
5
|
+
* @param {String} event name
|
|
6
|
+
* @param {Function} Callback
|
|
7
|
+
* @param {Object} Options for listening to events
|
|
8
|
+
* @return {void} Returns the function to stop listening
|
|
9
|
+
* @example
|
|
10
|
+
* useListenEvent(btnEl, 'click', () => { console.log('click btn');});
|
|
11
|
+
*/
|
|
12
|
+
export function useListenEvent(event: string, handler: Function, options: object): () => any;
|
|
13
|
+
export function useListenEvent(
|
|
14
|
+
target: HTMLElement, event: string, handler: Function, options: object,
|
|
15
|
+
): () => any;
|
|
16
|
+
export function useListenEvent(...args: any[]) {
|
|
17
|
+
let target = window?.document;
|
|
18
|
+
let event = '';
|
|
19
|
+
let handler = () => {};
|
|
20
|
+
let options = {};
|
|
21
|
+
|
|
22
|
+
if (typeof args[0] === 'string') {
|
|
23
|
+
[event, handler, options] = args;
|
|
24
|
+
} else {
|
|
25
|
+
[target, event, handler, options] = args;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!target) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
target?.addEventListener(event, handler, options);
|
|
33
|
+
|
|
34
|
+
return () => {
|
|
35
|
+
target?.removeEventListener(event, handler, options);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useRef, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_OPTIONS = {
|
|
4
|
+
debounceTime: 0,
|
|
5
|
+
config: {
|
|
6
|
+
attributes: true,
|
|
7
|
+
childList: true,
|
|
8
|
+
characterData: true,
|
|
9
|
+
subtree: true,
|
|
10
|
+
} as MutationObserverInit,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default function useMutationObservable(
|
|
14
|
+
targetEl: HTMLElement | null,
|
|
15
|
+
cb: MutationCallback,
|
|
16
|
+
options = DEFAULT_OPTIONS,
|
|
17
|
+
) {
|
|
18
|
+
const observeRef = useRef(null);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (!cb || typeof cb !== 'function') return;
|
|
21
|
+
const { debounceTime } = options;
|
|
22
|
+
observeRef.current = new MutationObserver(cb);
|
|
23
|
+
}, [cb, options]);
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!targetEl || !targetEl?.nodeType) return;
|
|
27
|
+
const { config } = options;
|
|
28
|
+
try {
|
|
29
|
+
observeRef.current.observe(targetEl, config);
|
|
30
|
+
} catch (e) {
|
|
31
|
+
console.error(e);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return () => {
|
|
35
|
+
observeRef.current.disconnect();
|
|
36
|
+
};
|
|
37
|
+
}, [targetEl, options]);
|
|
38
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useListenEvent } from './useListenerEvent';
|
|
3
|
+
|
|
4
|
+
export default function useOnClickOutSide(targetEls: any[], handler: () => any) {
|
|
5
|
+
let stop = () => {};
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const listener = (event: Event) => {
|
|
9
|
+
const targets = targetEls.map((targetEl) => targetEl?.current);
|
|
10
|
+
const paths = event.composedPath();
|
|
11
|
+
const rs = [];
|
|
12
|
+
for (let i = 0; i < targets.length; i++) {
|
|
13
|
+
rs[i] = paths.includes(targets[i]);
|
|
14
|
+
}
|
|
15
|
+
if (rs.every((item) => !item)) {
|
|
16
|
+
handler();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
stop = useListenEvent('click', listener, { passive: true });
|
|
20
|
+
return () => {
|
|
21
|
+
stop?.();
|
|
22
|
+
};
|
|
23
|
+
}, [targetEls, handler]);
|
|
24
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
// Used to determine whether dom can be used
|
|
4
|
+
export const canUseDocument = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
5
|
+
|
|
6
|
+
export function getRefDom(domRef: React.RefObject<any>) {
|
|
7
|
+
if (domRef?.current && typeof domRef.current === 'object' && 'currentElement' in domRef.current) {
|
|
8
|
+
return domRef.current.currentElement;
|
|
9
|
+
}
|
|
10
|
+
return domRef?.current;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function toggleScreen(domID: string) {
|
|
14
|
+
const elem = document.getElementById(domID) as HTMLElement;
|
|
15
|
+
if (!document.fullscreenElement && elem) {
|
|
16
|
+
elem.requestFullscreen().catch((err) => {
|
|
17
|
+
console.error(
|
|
18
|
+
`Error attempting to enable fullscreen mode: ${err.message} (${err.name})`,
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
} else {
|
|
22
|
+
document.exitFullscreen();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function noop() {}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
useMemo,
|
|
3
|
+
useContext,
|
|
4
|
+
useState,
|
|
5
|
+
useEffect,
|
|
6
|
+
} from 'react';
|
|
7
|
+
import {
|
|
8
|
+
CallRole,
|
|
9
|
+
CallStatus,
|
|
10
|
+
CallMediaType,
|
|
11
|
+
TUIGlobal,
|
|
12
|
+
TUIStore,
|
|
13
|
+
StoreName,
|
|
14
|
+
NAME,
|
|
15
|
+
} from '../../../../TUICallService';
|
|
16
|
+
import { ButtonPanelConfig } from './config';
|
|
17
|
+
import ButtonPanelH5 from './ButtonPanelH5/ButtonPanelH5';
|
|
18
|
+
import ButtonPanelPC from './ButtonPanelPC/ButtonPanelPC';
|
|
19
|
+
import BackgroundBlur from './button/BackgroundBlur';
|
|
20
|
+
import { CallInfoContext, IsClickableContext, UserInfoContext } from '../../../context';
|
|
21
|
+
import { deepClone } from '../../../util';
|
|
22
|
+
import useCustomButtonUIConfig from '../../../hooks/useCustomButtonUIConfig';
|
|
23
|
+
import { modify, add } from '../../../util/uiDesign';
|
|
24
|
+
|
|
25
|
+
const isMobile = !TUIGlobal.isPC;
|
|
26
|
+
|
|
27
|
+
export default function ButtonPanel() {
|
|
28
|
+
const {
|
|
29
|
+
callStatus, isGroupCall, callRole, callType, isShowEnableVirtualBackground,
|
|
30
|
+
} = useContext(CallInfoContext);
|
|
31
|
+
const { localUserInfo } = useContext(UserInfoContext);
|
|
32
|
+
const customButtonUIConfig = useCustomButtonUIConfig();
|
|
33
|
+
const [
|
|
34
|
+
isClickable,
|
|
35
|
+
setIsClickable,
|
|
36
|
+
] = useState(TUIStore.getData(StoreName.CALL, NAME.IS_CLICKABLE));
|
|
37
|
+
const IsClickableContextValue = useMemo(() => isClickable, [isClickable]);
|
|
38
|
+
const handleIsClickableChange = (value) => {
|
|
39
|
+
setIsClickable(value);
|
|
40
|
+
};
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
TUIStore.watch(
|
|
43
|
+
StoreName.CALL,
|
|
44
|
+
{ [NAME.IS_CLICKABLE]: handleIsClickableChange },
|
|
45
|
+
{ notifyRangeWhenWatch: NAME.MYSELF },
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
return () => {
|
|
49
|
+
TUIStore.unwatch(
|
|
50
|
+
StoreName.CALL,
|
|
51
|
+
{ [NAME.IS_CLICKABLE]: handleIsClickableChange },
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
}, []);
|
|
55
|
+
const setVirtualBackgroundConfig = (config) => {
|
|
56
|
+
const newButtonPanelConfig = deepClone(config);
|
|
57
|
+
add(newButtonPanelConfig, 'pc.singleCall.video.calling[0][2]', { component: BackgroundBlur, props: {} });
|
|
58
|
+
add(newButtonPanelConfig, 'pc.singleCall.video.accept[0][1]', { component: BackgroundBlur, props: {} });
|
|
59
|
+
add(newButtonPanelConfig, 'pc.singleCall.video.connected[0][3]', { component: BackgroundBlur, props: {} });
|
|
60
|
+
add(newButtonPanelConfig, 'pc.groupCall.video.calling[0][2]', { component: BackgroundBlur, props: {} });
|
|
61
|
+
add(newButtonPanelConfig, 'pc.groupCall.video.connected[0][2]', { component: BackgroundBlur, props: {} });
|
|
62
|
+
return newButtonPanelConfig;
|
|
63
|
+
};
|
|
64
|
+
const setCloseCameraConfig = (config, isVideoAvailable, isShowVirtualBackgroundIcon) => {
|
|
65
|
+
const newConfig = deepClone(config);
|
|
66
|
+
if (isVideoAvailable) {
|
|
67
|
+
modify(newConfig, 'h5.singleCall.video.connected[1][2].props.show', true);
|
|
68
|
+
if (isShowVirtualBackgroundIcon) {
|
|
69
|
+
setVirtualBackgroundConfig(newConfig);
|
|
70
|
+
}
|
|
71
|
+
} else {
|
|
72
|
+
modify(newConfig, 'h5.singleCall.video.connected[1][2].props.show', false);
|
|
73
|
+
if (isShowVirtualBackgroundIcon) {
|
|
74
|
+
modify(newConfig, 'pc.singleCall.video.connected[0][3].props.show', false);
|
|
75
|
+
modify(newConfig, 'pc.groupCall.video.connected[0][2].props.show', false);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return newConfig;
|
|
79
|
+
};
|
|
80
|
+
const buttons = useMemo(() => {
|
|
81
|
+
let newButtonPanelConfig = deepClone(ButtonPanelConfig);
|
|
82
|
+
|
|
83
|
+
if (isShowEnableVirtualBackground) {
|
|
84
|
+
newButtonPanelConfig = setVirtualBackgroundConfig(ButtonPanelConfig);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (callStatus === CallStatus.CONNECTED) {
|
|
88
|
+
newButtonPanelConfig = setCloseCameraConfig(
|
|
89
|
+
newButtonPanelConfig,
|
|
90
|
+
localUserInfo?.isVideoAvailable,
|
|
91
|
+
isShowEnableVirtualBackground,
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
customButtonUIConfig?.forEach((item) => {
|
|
96
|
+
const { path, value } = item;
|
|
97
|
+
modify(newButtonPanelConfig, path, value);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const platform = TUIGlobal.isPC ? 'pc' : 'h5';
|
|
101
|
+
const callScene = isGroupCall ? 'groupCall' : 'singleCall';
|
|
102
|
+
const mediaType = callType === CallMediaType.AUDIO ? 'audio' : 'video';
|
|
103
|
+
const status = callStatus === CallStatus.CALLING
|
|
104
|
+
? callRole === CallRole.CALLER ? 'calling' : 'accept'
|
|
105
|
+
: callStatus;
|
|
106
|
+
const rs = newButtonPanelConfig?.[platform]?.[callScene]?.[mediaType]?.[status] || [];
|
|
107
|
+
if (rs.length === 1) {
|
|
108
|
+
rs.unshift([]);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return rs;
|
|
112
|
+
}, [
|
|
113
|
+
isGroupCall,
|
|
114
|
+
callType,
|
|
115
|
+
callStatus,
|
|
116
|
+
callRole,
|
|
117
|
+
isShowEnableVirtualBackground,
|
|
118
|
+
customButtonUIConfig,
|
|
119
|
+
localUserInfo?.isVideoAvailable,
|
|
120
|
+
]);
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<IsClickableContext.Provider value={IsClickableContextValue}>
|
|
124
|
+
{isMobile ? <ButtonPanelH5 buttons={buttons} /> : <ButtonPanelPC buttons={buttons} />}
|
|
125
|
+
</IsClickableContext.Provider>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
@use "../../../../style/theme/util" as *;
|
|
2
|
+
@import '../../../../style/common/var.scss';
|
|
3
|
+
|
|
4
|
+
.button-panel-h5-container {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
align-items: center;
|
|
8
|
+
position: absolute;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
bottom: 0;
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 14%;
|
|
13
|
+
border-radius: 10px 10px 0 0;
|
|
14
|
+
z-index: 5;
|
|
15
|
+
transition-property: width,height,left,top;
|
|
16
|
+
transition-duration: 0.3s;
|
|
17
|
+
transition-timing-function: ease-in;
|
|
18
|
+
|
|
19
|
+
&.groupcall {
|
|
20
|
+
background: none;
|
|
21
|
+
&.show-panel-background {
|
|
22
|
+
@include theme() {
|
|
23
|
+
background-color: get(gray-dark-3);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&.open {
|
|
29
|
+
height: 27%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.singlecall-panel {
|
|
33
|
+
width: 72%;
|
|
34
|
+
max-width: 400px;
|
|
35
|
+
position: absolute;
|
|
36
|
+
bottom: 6vh;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.groupcall-panel {
|
|
40
|
+
width: 72%;
|
|
41
|
+
position: absolute;
|
|
42
|
+
top: 6%;
|
|
43
|
+
|
|
44
|
+
&.close {
|
|
45
|
+
top: 27%;
|
|
46
|
+
margin-left: 9.3vw;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.toggle-panel-btn {
|
|
51
|
+
position: absolute;
|
|
52
|
+
left: 8.2vw;
|
|
53
|
+
bottom: 6vh;
|
|
54
|
+
z-index: 1;
|
|
55
|
+
|
|
56
|
+
&.close {
|
|
57
|
+
width: 8vw !important;
|
|
58
|
+
height: 8vw !important;
|
|
59
|
+
top: 32%;
|
|
60
|
+
|
|
61
|
+
:global(.#{prefix}-icon) {
|
|
62
|
+
width: 8vw !important;
|
|
63
|
+
height: 8vw !important;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/* eslint-disable react/destructuring-assignment */
|
|
2
|
+
/* eslint-disable no-nested-ternary */
|
|
3
|
+
/* eslint-disable react/no-array-index-key */
|
|
4
|
+
import React, {
|
|
5
|
+
CSSProperties, useContext, useEffect, useState,
|
|
6
|
+
} from 'react';
|
|
7
|
+
import Button from '../../../base/Button';
|
|
8
|
+
import Col from '../../../base/Grid/Col';
|
|
9
|
+
import Row from '../../../base/Grid/Row';
|
|
10
|
+
import Icon from '../../../base/Icon/Icon';
|
|
11
|
+
import { classNames } from '../../../../util/classnames';
|
|
12
|
+
import { clearPropsValues } from '../../../../util/index';
|
|
13
|
+
import { CallInfoContext, FocusItemContext } from '../../../../context';
|
|
14
|
+
import { TButtons } from '../../../../const/common';
|
|
15
|
+
import UpSrc from '../../../../assets/button/mobile/up.svg';
|
|
16
|
+
import DownSrc from '../../../../assets/button/mobile/down.svg';
|
|
17
|
+
import buttonPanelH5Style from './ButtonPanelH5.module.scss';
|
|
18
|
+
|
|
19
|
+
interface IButtonPanelH5Props {
|
|
20
|
+
buttons?: TButtons;
|
|
21
|
+
style?: CSSProperties;
|
|
22
|
+
}
|
|
23
|
+
export default function ButtonPanelH5(props: IButtonPanelH5Props) {
|
|
24
|
+
const { buttons = [] } = props;
|
|
25
|
+
const { isGroupCall } = useContext(CallInfoContext);
|
|
26
|
+
const { focusItem } = useContext(FocusItemContext);
|
|
27
|
+
const [isPanelOpen, setIsPanelOpen] = useState(true);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
setIsPanelOpen(focusItem === null);
|
|
30
|
+
}, [focusItem, setIsPanelOpen]);
|
|
31
|
+
const [showBtnPanelBackground, setShowBtnPanelBackground] = useState(false);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (focusItem !== null && !showBtnPanelBackground) {
|
|
34
|
+
setShowBtnPanelBackground(true);
|
|
35
|
+
}
|
|
36
|
+
}, [focusItem, showBtnPanelBackground]);
|
|
37
|
+
const classnames = classNames([
|
|
38
|
+
buttonPanelH5Style['button-panel-h5-container'],
|
|
39
|
+
{
|
|
40
|
+
[buttonPanelH5Style.open]: isPanelOpen,
|
|
41
|
+
[buttonPanelH5Style.groupcall]: isGroupCall,
|
|
42
|
+
[buttonPanelH5Style['show-panel-background']]: showBtnPanelBackground,
|
|
43
|
+
},
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
const renderOpenButtonPanel = () => buttons.map((itemArr, rowIndex) => {
|
|
47
|
+
const filterItemArr = rowIndex === 0
|
|
48
|
+
? itemArr.filter((item) => item?.props?.show !== false)
|
|
49
|
+
: itemArr;
|
|
50
|
+
const renderButtonPanelCol = () => filterItemArr.map((item, index) => {
|
|
51
|
+
const justify = filterItemArr.length > 2
|
|
52
|
+
? index === 0 ? 'start' : index === filterItemArr.length - 1 ? 'end' : 'center'
|
|
53
|
+
: 'center';
|
|
54
|
+
// eslint-disable-next-line no-shadow
|
|
55
|
+
const { component, props } = item;
|
|
56
|
+
const customStyle: { visibility?: any} = {};
|
|
57
|
+
if (props?.show === false) {
|
|
58
|
+
if (rowIndex === 0) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
customStyle.visibility = 'hidden';
|
|
62
|
+
}
|
|
63
|
+
const size = 12 / filterItemArr.length;
|
|
64
|
+
const newProps = clearPropsValues(props, 'show');
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
const ButtonComp = React.createElement(component, { isMobile: true, ...newProps });
|
|
67
|
+
return (
|
|
68
|
+
<Col
|
|
69
|
+
key={`col-${index}`}
|
|
70
|
+
style={{ overflow: 'visible', ...props?.style, ...customStyle }}
|
|
71
|
+
span={size}
|
|
72
|
+
justify={justify}
|
|
73
|
+
>
|
|
74
|
+
{ButtonComp}
|
|
75
|
+
</Col>
|
|
76
|
+
);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<Row
|
|
81
|
+
key={`row-${rowIndex}`}
|
|
82
|
+
style={{ marginTop: rowIndex === 1 ? '2.4vh' : 0 }}
|
|
83
|
+
>
|
|
84
|
+
{renderButtonPanelCol()}
|
|
85
|
+
</Row>
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
const toggleBtnPanel = () => {
|
|
89
|
+
setIsPanelOpen(!isPanelOpen);
|
|
90
|
+
};
|
|
91
|
+
const renderTogglePanelBtn = () => {
|
|
92
|
+
const toggleBtnPanelIcon = isPanelOpen
|
|
93
|
+
? <Icon url={DownSrc} />
|
|
94
|
+
: <Icon url={UpSrc} />;
|
|
95
|
+
return (
|
|
96
|
+
<Button
|
|
97
|
+
className={classNames([
|
|
98
|
+
buttonPanelH5Style['toggle-panel-btn'],
|
|
99
|
+
{ [buttonPanelH5Style.close]: !isPanelOpen },
|
|
100
|
+
])}
|
|
101
|
+
icon={toggleBtnPanelIcon}
|
|
102
|
+
onClick={toggleBtnPanel}
|
|
103
|
+
/>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
const renderCloseButtonPanel = () => {
|
|
107
|
+
const rs = buttons.flat();
|
|
108
|
+
const renderButtonPanelCol = () => rs.map((item, index) => {
|
|
109
|
+
const { component, props: buttonProps } = item;
|
|
110
|
+
if (buttonProps?.show === false) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
// @ts-ignore
|
|
114
|
+
const ButtonComp = React.createElement(component, { isMobile: true, size: 'small', showText: false });
|
|
115
|
+
const size = 12 / rs.length;
|
|
116
|
+
return (
|
|
117
|
+
<Col
|
|
118
|
+
key={index}
|
|
119
|
+
style={{ overflow: 'visible' }}
|
|
120
|
+
span={size}
|
|
121
|
+
>
|
|
122
|
+
{ButtonComp}
|
|
123
|
+
</Col>
|
|
124
|
+
);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
return <Row>{renderButtonPanelCol()}</Row>;
|
|
128
|
+
};
|
|
129
|
+
const renderButtonPanel = () => {
|
|
130
|
+
if (isGroupCall && !isPanelOpen) {
|
|
131
|
+
return renderCloseButtonPanel();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return renderOpenButtonPanel();
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
return (
|
|
138
|
+
<div className={classnames}>
|
|
139
|
+
{showBtnPanelBackground && renderTogglePanelBtn()}
|
|
140
|
+
<div
|
|
141
|
+
className={classNames([
|
|
142
|
+
{
|
|
143
|
+
[buttonPanelH5Style['groupcall-panel']]: isGroupCall,
|
|
144
|
+
[buttonPanelH5Style['singlecall-panel']]: !isGroupCall,
|
|
145
|
+
[buttonPanelH5Style.close]: !isPanelOpen,
|
|
146
|
+
},
|
|
147
|
+
])}
|
|
148
|
+
>
|
|
149
|
+
{renderButtonPanel()}
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* eslint-disable react/no-array-index-key */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Col from '../../../base/Grid/Col';
|
|
4
|
+
import Row from '../../../base/Grid/Row';
|
|
5
|
+
import { TButtons } from '../../../../const/common';
|
|
6
|
+
import { clearPropsValues } from '../../../../util/index';
|
|
7
|
+
import buttonPanelPCStyle from './ButtonPanelPC.module.scss';
|
|
8
|
+
|
|
9
|
+
interface IButtonPanelPCProps {
|
|
10
|
+
buttons?: TButtons;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default function ButtonPanelPC(props: IButtonPanelPCProps) {
|
|
14
|
+
const { buttons = [] } = props;
|
|
15
|
+
|
|
16
|
+
const renderButtonPanel = () => buttons.map((itemArr, rowIndex) => {
|
|
17
|
+
const renderButtonPanelCol = () => itemArr.map((item, index) => {
|
|
18
|
+
const { component, props: buttonProps } = item;
|
|
19
|
+
if (buttonProps?.show === false) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const newProps = clearPropsValues(props, 'show');
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
const ButtonComp = React.createElement(component, { ...newProps });
|
|
25
|
+
const size = Math.floor(12 / itemArr.length);
|
|
26
|
+
return <Col key={index} style={{ justifyContent: 'center' }} span={size}>{ButtonComp}</Col>;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return <Row key={rowIndex}>{renderButtonPanelCol()}</Row>;
|
|
30
|
+
});
|
|
31
|
+
return <div className={buttonPanelPCStyle['button-panel-pc-container']}>{renderButtonPanel()}</div>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Button from '../../../../base/Button';
|
|
3
|
+
import { TUICallKitAPI, TUIGlobal } from '../../../../../../TUICallService';
|
|
4
|
+
import Icon from '../../../../base/Icon/Icon';
|
|
5
|
+
import useTranslate from '../../../../../hooks/useTranslate';
|
|
6
|
+
import { classNames } from '../../../../../util/classnames';
|
|
7
|
+
import AcceptSrc from '../../../../../assets/button/accept.svg';
|
|
8
|
+
import { classPrefix } from '../../../../base/common';
|
|
9
|
+
import commonStyle from '../common.module.scss';
|
|
10
|
+
import acceptStyle from './Accept.module.scss';
|
|
11
|
+
|
|
12
|
+
interface IAcceptProps {
|
|
13
|
+
isMobile?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default function Accept(props: IAcceptProps) {
|
|
17
|
+
const { t } = useTranslate();
|
|
18
|
+
const handleClick = () => TUICallKitAPI.accept();
|
|
19
|
+
const iconClassName = classNames([
|
|
20
|
+
commonStyle['btn-icon-container'],
|
|
21
|
+
acceptStyle['accept-icon-container'],
|
|
22
|
+
{
|
|
23
|
+
mobile: !TUIGlobal.isPC,
|
|
24
|
+
pc: TUIGlobal.isPC,
|
|
25
|
+
},
|
|
26
|
+
]);
|
|
27
|
+
const AcceptIcon = <Icon className={commonStyle['btn-icon']} url={AcceptSrc} />;
|
|
28
|
+
return (
|
|
29
|
+
<Button
|
|
30
|
+
className={commonStyle[`${classPrefix}-btn`]}
|
|
31
|
+
icon={AcceptIcon}
|
|
32
|
+
iconClassName={iconClassName}
|
|
33
|
+
onClick={handleClick}
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
{t('accept')}
|
|
37
|
+
</Button>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@use "../../../../../style/theme/util" as *;
|
|
2
|
+
@import "../../../../../style/common/var.scss";
|
|
3
|
+
|
|
4
|
+
.background-blur-icon-container {
|
|
5
|
+
|
|
6
|
+
@include theme() {
|
|
7
|
+
background-color: get(white-1);
|
|
8
|
+
}
|
|
9
|
+
&.close {
|
|
10
|
+
|
|
11
|
+
@include theme() {
|
|
12
|
+
background-color: get(black-5);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|