@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,37 @@
|
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
import { classNames } from '../../../../util/classnames';
|
|
3
|
+
import { classPrefix } from '../../../../const/common';
|
|
4
|
+
import './GridPlusItem.scss';
|
|
5
|
+
|
|
6
|
+
interface IGridPlusItemProps {
|
|
7
|
+
index: number;
|
|
8
|
+
className?: string;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
updateFocusItem?: (index?: number) => any;
|
|
11
|
+
children?: any;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function GridPlusItem(props: IGridPlusItemProps) {
|
|
15
|
+
const {
|
|
16
|
+
index, children, className, style, updateFocusItem,
|
|
17
|
+
} = props;
|
|
18
|
+
|
|
19
|
+
const classnames = classNames([
|
|
20
|
+
`${classPrefix}-gridplus-item-container`,
|
|
21
|
+
className,
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
className={classnames}
|
|
27
|
+
onClick={() => updateFocusItem?.(index)}
|
|
28
|
+
style={{ gridArea: `gridplus-item-${index}`, ...style }}
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
GridPlusItem.displayname = 'GridPlusItem';
|
|
36
|
+
|
|
37
|
+
export default GridPlusItem;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
interface IconProps {
|
|
4
|
+
url?: string;
|
|
5
|
+
style?: CSSProperties;
|
|
6
|
+
className?: string;
|
|
7
|
+
onClick?: (e: any) => any;
|
|
8
|
+
}
|
|
9
|
+
export default function Icon(props: IconProps) {
|
|
10
|
+
const {
|
|
11
|
+
url,
|
|
12
|
+
style,
|
|
13
|
+
className,
|
|
14
|
+
onClick = () => null,
|
|
15
|
+
} = props;
|
|
16
|
+
return (
|
|
17
|
+
<img
|
|
18
|
+
className={className}
|
|
19
|
+
style={{ width: '100%', height: '100%', ...style }}
|
|
20
|
+
src={url}
|
|
21
|
+
onClick={onClick}
|
|
22
|
+
alt=''
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { classPrefix } from '../../../../const/common';
|
|
3
|
+
import loadingSrc from '../../../../assets/base/loading-circle.svg';
|
|
4
|
+
import './Circle.scss';
|
|
5
|
+
|
|
6
|
+
interface ICircleProps {
|
|
7
|
+
size?: number | string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default function Circle(props: ICircleProps) {
|
|
11
|
+
const { size } = props;
|
|
12
|
+
return (
|
|
13
|
+
<div
|
|
14
|
+
className={`${classPrefix}-circle-container`}
|
|
15
|
+
style={{ width: size, height: size }}
|
|
16
|
+
>
|
|
17
|
+
<img alt='' style={{ width: '100%', height: '100%' }} className={`${classPrefix}-circle-loading`} src={loadingSrc} />
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@import '../../../../style/common/var.scss';
|
|
2
|
+
|
|
3
|
+
.#{$prefix}-circle-container {
|
|
4
|
+
width: 30px;
|
|
5
|
+
height: 30px;
|
|
6
|
+
margin: 0 auto;
|
|
7
|
+
position: absolute;
|
|
8
|
+
z-index: 1;
|
|
9
|
+
|
|
10
|
+
.#{$prefix}-circle-loading {
|
|
11
|
+
animation: spin 1s linear infinite;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@keyframes spin {
|
|
15
|
+
0% {
|
|
16
|
+
transform: rotate(0deg);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
100% {
|
|
20
|
+
transform: rotate(360deg);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
svg {
|
|
26
|
+
height: 100%;
|
|
27
|
+
width: 100%;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
@use "../../../../style/theme/util" as *;
|
|
2
|
+
@import '../../../../style/common/var.scss';
|
|
3
|
+
|
|
4
|
+
.#{$prefix}-dot-container {
|
|
5
|
+
position: absolute;
|
|
6
|
+
display: flex;
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
align-items: center;
|
|
9
|
+
width: 50px;
|
|
10
|
+
height: 50px;
|
|
11
|
+
margin: 0 auto;
|
|
12
|
+
z-index: 1;
|
|
13
|
+
|
|
14
|
+
& .dot:nth-child(1) {
|
|
15
|
+
opacity: 0;
|
|
16
|
+
animation-duration: 0.8s;
|
|
17
|
+
animation-delay: 0s;
|
|
18
|
+
animation-play-state: running;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
& .dot:nth-child(2) {
|
|
22
|
+
opacity: 0.083;
|
|
23
|
+
animation-duration: 0.8s;
|
|
24
|
+
animation-delay: 0.26666666666666666s;
|
|
25
|
+
animation-play-state: running;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
& .dot:nth-child(3) {
|
|
29
|
+
opacity: 0.1667;
|
|
30
|
+
animation-duration: 0.8s;
|
|
31
|
+
animation-delay: 0.5333333333333333s;
|
|
32
|
+
animation-play-state: running;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.dot {
|
|
36
|
+
width: 20%;
|
|
37
|
+
height: 20%;
|
|
38
|
+
border-radius: 50%;
|
|
39
|
+
background-color: currentColor;
|
|
40
|
+
animation-duration: 1.8s;
|
|
41
|
+
animation-name: dotting;
|
|
42
|
+
animation-timing-function: linear;
|
|
43
|
+
animation-iteration-count: infinite;
|
|
44
|
+
animation-fill-mode: both;
|
|
45
|
+
@include theme() {
|
|
46
|
+
color: get(white-1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@keyframes dotting {
|
|
53
|
+
0% {
|
|
54
|
+
opacity: 0.15;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
1% {
|
|
58
|
+
opacity: 0.8;
|
|
59
|
+
}
|
|
60
|
+
33% {
|
|
61
|
+
opacity: 0.8;
|
|
62
|
+
}
|
|
63
|
+
34% {
|
|
64
|
+
opacity: 0.15;
|
|
65
|
+
}
|
|
66
|
+
100% {
|
|
67
|
+
opacity: 0.15;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { classPrefix } from '../../../../const/common';
|
|
3
|
+
import './Dot.scss';
|
|
4
|
+
|
|
5
|
+
interface IDotProps {
|
|
6
|
+
size?: number | string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default function Dot(props: IDotProps) {
|
|
10
|
+
const { size } = props;
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
className={`${classPrefix}-dot-container`}
|
|
14
|
+
style={{ width: size, height: size }}
|
|
15
|
+
>
|
|
16
|
+
<div className='dot' />
|
|
17
|
+
<div className='dot' />
|
|
18
|
+
<div className='dot' />
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@use "../../../style/theme/util" as *;
|
|
2
|
+
@import '../../../style/common/var.scss';
|
|
3
|
+
|
|
4
|
+
.#{$prefix}-loading-container {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
position: relative;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
background: none;
|
|
13
|
+
|
|
14
|
+
&.#{$prefix}-loading-overlayer{
|
|
15
|
+
position: absolute;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
@include theme() {
|
|
19
|
+
background-color: get(black-4);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { classPrefix } from '../../../const/common';
|
|
3
|
+
import { classNames } from '../../../util/classnames';
|
|
4
|
+
import CircleLoading from './Circle/Cilrcle';
|
|
5
|
+
import DotLoading from './Dot/Dot';
|
|
6
|
+
import Overlayer from '../Overlayer/Overlayer';
|
|
7
|
+
import './Loading.scss';
|
|
8
|
+
|
|
9
|
+
type TObjectFit = 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
|
|
10
|
+
interface ILoadingProps {
|
|
11
|
+
theme?: 'circle' | 'dot';
|
|
12
|
+
size?: number | string;
|
|
13
|
+
showOverlayer?: boolean;
|
|
14
|
+
showLoading?: boolean;
|
|
15
|
+
style?: CSSProperties;
|
|
16
|
+
children?: ReactNode | ReactNode[];
|
|
17
|
+
fit?: TObjectFit;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default function Loading(props: ILoadingProps) {
|
|
21
|
+
const {
|
|
22
|
+
theme = 'circle',
|
|
23
|
+
size,
|
|
24
|
+
showOverlayer = true,
|
|
25
|
+
children,
|
|
26
|
+
style = {},
|
|
27
|
+
showLoading = true,
|
|
28
|
+
fit,
|
|
29
|
+
} = props;
|
|
30
|
+
|
|
31
|
+
const renderContent = () => (theme === 'dot' ? <DotLoading size={size} /> : <CircleLoading size={size} />);
|
|
32
|
+
|
|
33
|
+
const classnames = classNames([
|
|
34
|
+
`${classPrefix}-loading-container`,
|
|
35
|
+
{
|
|
36
|
+
[`${classPrefix}-loading-overlayer`]: showOverlayer,
|
|
37
|
+
},
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<div className={classnames} style={style}>
|
|
42
|
+
{showOverlayer && <Overlayer fit={fit} />}
|
|
43
|
+
{showLoading && renderContent()}
|
|
44
|
+
{children}
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
@use '../../../style/theme/util' as *;
|
|
2
|
+
@import '../../../style/common/var.scss';
|
|
3
|
+
|
|
4
|
+
.#{$prefix}-message-container {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: row;
|
|
7
|
+
align-items: center;
|
|
8
|
+
width: fit-content;
|
|
9
|
+
margin-bottom: 10px;
|
|
10
|
+
border-radius: $radius-default;
|
|
11
|
+
@include theme() {
|
|
12
|
+
box-shadow: 0px 1px 5px get(black-8), 0px 8px 12px get(black-8), 0px 12px 26px get(black-8);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
padding: 10px;
|
|
16
|
+
|
|
17
|
+
@include theme() {
|
|
18
|
+
background-color: get(toast-color-default);
|
|
19
|
+
color: get(text-color-primary);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
svg {
|
|
23
|
+
@include theme() {
|
|
24
|
+
margin-right: 4px;
|
|
25
|
+
fill: get(text-color-primary);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.#{$prefix}-message-plaintext {
|
|
30
|
+
background: none;
|
|
31
|
+
border: 0;
|
|
32
|
+
box-shadow: none;
|
|
33
|
+
margin: 0;
|
|
34
|
+
padding: 0;
|
|
35
|
+
@include theme() {
|
|
36
|
+
color: get(white-1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.#{$prefix}-message-icon {
|
|
41
|
+
width: 1em !important;
|
|
42
|
+
height: 1em !important;
|
|
43
|
+
|
|
44
|
+
&.tip-icon {
|
|
45
|
+
margin-right: 8px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.close-icon {
|
|
49
|
+
margin-left: 24px;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.message-list-container {
|
|
55
|
+
top: 0;
|
|
56
|
+
position: fixed;
|
|
57
|
+
left: 0;
|
|
58
|
+
width: 100%;
|
|
59
|
+
display: flex;
|
|
60
|
+
justify-content: center;
|
|
61
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
CSSProperties, ReactNode, useEffect, useRef,
|
|
3
|
+
} from 'react';
|
|
4
|
+
import { classNames } from '../../../util/classnames';
|
|
5
|
+
import { classPrefix } from '../../../const/common';
|
|
6
|
+
import Icon from '../Icon/Icon';
|
|
7
|
+
import CloseSrc from '../../../assets/base/close.svg';
|
|
8
|
+
import MessageInfoIcon from './MessageIcon/Info';
|
|
9
|
+
import MessageErrorIcon from './MessageIcon/Error';
|
|
10
|
+
import MessageSuccessIcon from './MessageIcon/Success';
|
|
11
|
+
import MessageWarningIcon from './MessageIcon/Warning';
|
|
12
|
+
import './Message.scss';
|
|
13
|
+
|
|
14
|
+
const IconSrcMap = {
|
|
15
|
+
info: <MessageInfoIcon />,
|
|
16
|
+
waring: <MessageWarningIcon />,
|
|
17
|
+
success: <MessageSuccessIcon />,
|
|
18
|
+
error: <MessageErrorIcon />,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export interface IMessageProps {
|
|
22
|
+
icon?: ReactNode;
|
|
23
|
+
showIcon?: boolean;
|
|
24
|
+
duration?: number;
|
|
25
|
+
theme?: 'info' | 'waring' | 'success' | 'error';
|
|
26
|
+
closeBtn?: ReactNode | boolean;
|
|
27
|
+
showCloseBtn?: boolean;
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
className?: string;
|
|
30
|
+
style?: CSSProperties;
|
|
31
|
+
plaintext?: boolean;
|
|
32
|
+
onClose?: () => any;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function Message(props: IMessageProps) {
|
|
36
|
+
const {
|
|
37
|
+
icon,
|
|
38
|
+
showIcon = true,
|
|
39
|
+
duration = 3000,
|
|
40
|
+
theme = 'info',
|
|
41
|
+
style,
|
|
42
|
+
closeBtn,
|
|
43
|
+
showCloseBtn,
|
|
44
|
+
className,
|
|
45
|
+
children,
|
|
46
|
+
plaintext = false,
|
|
47
|
+
onClose = () => null,
|
|
48
|
+
} = props;
|
|
49
|
+
const timer = useRef<any>();
|
|
50
|
+
const classnames = classNames([
|
|
51
|
+
className,
|
|
52
|
+
`${classPrefix}-message-container`,
|
|
53
|
+
{ [`${classPrefix}-message-plaintext`]: plaintext },
|
|
54
|
+
]);
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (timer.current) clearTimeout(timer.current);
|
|
58
|
+
|
|
59
|
+
if (duration > 0) {
|
|
60
|
+
timer.current = setTimeout(() => {
|
|
61
|
+
onClose?.();
|
|
62
|
+
}, duration);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return () => {
|
|
66
|
+
if (timer) clearTimeout(timer.current);
|
|
67
|
+
};
|
|
68
|
+
}, [duration, onClose]);
|
|
69
|
+
|
|
70
|
+
const renderIcon = () => (icon || (
|
|
71
|
+
<>
|
|
72
|
+
{ IconSrcMap[theme] }
|
|
73
|
+
</>
|
|
74
|
+
));
|
|
75
|
+
|
|
76
|
+
const renderCloseIcon = () => (closeBtn || (
|
|
77
|
+
<Icon
|
|
78
|
+
onClick={onClose}
|
|
79
|
+
className={classNames([
|
|
80
|
+
`${classPrefix}-message-icon`,
|
|
81
|
+
'close-icon',
|
|
82
|
+
])}
|
|
83
|
+
url={CloseSrc}
|
|
84
|
+
/>
|
|
85
|
+
));
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<div className={classnames} style={style}>
|
|
89
|
+
{(showIcon && !plaintext) && renderIcon()}
|
|
90
|
+
{children}
|
|
91
|
+
{(showCloseBtn && !plaintext) && renderCloseIcon()}
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export default function MessageInfoSvg() {
|
|
2
|
+
return (
|
|
3
|
+
<svg width="20" height="19" viewBox="0 0 20 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<path fillRule="evenodd" clipRule="evenodd" d="M10.0016 17.0007C14.1438 17.0007 17.5016 13.6428 17.5016 9.50065C17.5016 5.35852 14.1438 2.00065 10.0016 2.00065C5.85949 2.00065 2.50163 5.35852 2.50163 9.50065C2.50163 13.6428 5.85949 17.0007 10.0016 17.0007ZM19.1683 9.50065C19.1683 14.5632 15.0642 18.6673 10.0016 18.6673C4.93902 18.6673 0.834961 14.5632 0.834961 9.50065C0.834961 4.43804 4.93902 0.333984 10.0016 0.333984C15.0642 0.333985 19.1683 4.43804 19.1683 9.50065ZM6.17119 12.1526L8.82313 9.50065L6.17119 6.84872L7.34969 5.67021L10.0016 8.32215L12.653 5.67078L13.8315 6.84929L11.1801 9.50065L13.8315 12.152L12.653 13.3306L10.0016 10.6792L7.34969 13.3311L6.17119 12.1526Z" fill="#E54545"/>
|
|
5
|
+
</svg>
|
|
6
|
+
)
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export default function MessageInfoSvg() {
|
|
2
|
+
return (
|
|
3
|
+
<svg width="20" height="19" viewBox="0 0 20 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<path fillRule="evenodd" clipRule="evenodd" d="M9.99967 16.9987C14.1418 16.9987 17.4997 13.6409 17.4997 9.4987C17.4997 5.35657 14.1418 1.9987 9.99967 1.9987C5.85754 1.9987 2.49967 5.35657 2.49967 9.4987C2.49967 13.6409 5.85754 16.9987 9.99967 16.9987ZM19.1663 9.4987C19.1663 14.5613 15.0623 18.6654 9.99967 18.6654C4.93707 18.6654 0.833008 14.5613 0.833008 9.4987C0.833008 4.43609 4.93707 0.332031 9.99967 0.332031C15.0623 0.332032 19.1663 4.43609 19.1663 9.4987ZM9.16634 14.082V7.83203H10.833V14.082H9.16634ZM10.833 6.58203H9.16309V4.91211H10.833V6.58203Z" fillOpacity="0.9"/>
|
|
5
|
+
</svg>
|
|
6
|
+
)
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default function MessageInfoSvg() {
|
|
2
|
+
return (
|
|
3
|
+
<svg width="20" height="19" viewBox="0 0 20 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<path d="M5.58317 9.57612L9.17951 13.2052L14.6332 7.05264L13.5732 6.16634L8.97764 10.4388L6.42478 8.66748L5.58317 9.57612Z" fill="#0ABF77"/>
|
|
5
|
+
<path fillRule="evenodd" clipRule="evenodd" d="M19.1663 9.49967C19.1663 14.5623 15.0623 18.6663 9.99967 18.6663C4.93706 18.6663 0.833008 14.5623 0.833008 9.49967C0.833008 4.43706 4.93706 0.333008 9.99967 0.333008C15.0623 0.333008 19.1663 4.43706 19.1663 9.49967ZM17.4997 9.49967C17.4997 13.6418 14.1418 16.9997 9.99967 16.9997C5.85754 16.9997 2.49967 13.6418 2.49967 9.49967C2.49967 5.35754 5.85754 1.99967 9.99967 1.99967C14.1418 1.99967 17.4997 5.35754 17.4997 9.49967Z" fill="#0ABF77"/>
|
|
6
|
+
</svg>
|
|
7
|
+
)
|
|
8
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export default function MessageInfoSvg() {
|
|
2
|
+
return (
|
|
3
|
+
<svg width="20" height="19" viewBox="0 0 20 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<path fillRule="evenodd" clipRule="evenodd" d="M9.99967 1.9987C14.1418 1.9987 17.4997 5.35653 17.4997 9.4987C17.4997 13.6408 14.1418 16.9987 9.99967 16.9987C5.85754 16.9987 2.49967 13.6408 2.49967 9.4987C2.49967 5.35653 5.85754 1.9987 9.99967 1.9987ZM19.1663 9.4987C19.1663 4.43612 15.0623 0.332031 9.99967 0.332031C4.93707 0.332031 0.833008 4.43612 0.833008 9.4987C0.833008 14.5613 4.93707 18.6654 9.99967 18.6654C15.0623 18.6654 19.1663 14.5613 19.1663 9.4987ZM9.16634 4.91536V11.1654H10.833V4.91536H9.16634ZM10.833 12.4154H9.16309V14.0853H10.833V12.4154Z" fill="#FF7200"/>
|
|
5
|
+
</svg>
|
|
6
|
+
)
|
|
7
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { render, unmountComponentAtNode } from 'react-dom';
|
|
2
|
+
import React, { CSSProperties, useEffect } from 'react';
|
|
3
|
+
import { IMessageProps, Message } from './Message';
|
|
4
|
+
import { noop } from '../../../../TUICallService/utils/common-utils';
|
|
5
|
+
|
|
6
|
+
let keyIndex = 0;
|
|
7
|
+
const messageList = [];
|
|
8
|
+
|
|
9
|
+
function MessageContainer(props) {
|
|
10
|
+
const {
|
|
11
|
+
children, zIndex, id, renderCallback,
|
|
12
|
+
} = props;
|
|
13
|
+
|
|
14
|
+
const style: CSSProperties = {
|
|
15
|
+
zIndex,
|
|
16
|
+
top: '32px',
|
|
17
|
+
width: '100%',
|
|
18
|
+
position: 'absolute',
|
|
19
|
+
left: 0,
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexDirection: 'column',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
renderCallback?.();
|
|
27
|
+
// eslint-disable-next-line
|
|
28
|
+
}, []);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div style={style} id={id}>
|
|
32
|
+
{children}
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function createContainer(): Promise<Element> {
|
|
38
|
+
return new Promise((resolve) => {
|
|
39
|
+
// The default injection is into the body.
|
|
40
|
+
// If the user has specified a value, it will be used instead.
|
|
41
|
+
const mountedDom = document.body;
|
|
42
|
+
|
|
43
|
+
// The selector finds a container for mounting the message.
|
|
44
|
+
// If it does not exist, it will be created.
|
|
45
|
+
const containerId = 'tdesign-message-container--top';
|
|
46
|
+
const container = Array.from(mountedDom.querySelectorAll(`#${containerId}`));
|
|
47
|
+
if (container.length < 1) {
|
|
48
|
+
const div = document.createElement('div');
|
|
49
|
+
render(
|
|
50
|
+
<MessageContainer
|
|
51
|
+
id={containerId}
|
|
52
|
+
zIndex={1}
|
|
53
|
+
renderCallback={() => {
|
|
54
|
+
mountedDom.appendChild(div);
|
|
55
|
+
const containers = Array.from(mountedDom.querySelectorAll(`#${containerId}`));
|
|
56
|
+
resolve(containers[0]);
|
|
57
|
+
}}
|
|
58
|
+
/>,
|
|
59
|
+
div,
|
|
60
|
+
);
|
|
61
|
+
} else {
|
|
62
|
+
resolve(container[0]);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function createMessage(theme, config): Promise<any> {
|
|
68
|
+
const container = (await createContainer()) as HTMLElement;
|
|
69
|
+
|
|
70
|
+
const { content, offset, onClose = noop } = config;
|
|
71
|
+
const div = document.createElement('div');
|
|
72
|
+
// div.className = 'message-list-container';
|
|
73
|
+
|
|
74
|
+
keyIndex += 1;
|
|
75
|
+
|
|
76
|
+
const message = {
|
|
77
|
+
close: () => {
|
|
78
|
+
unmountComponentAtNode(div);
|
|
79
|
+
div.remove();
|
|
80
|
+
message.closed = true;
|
|
81
|
+
},
|
|
82
|
+
key: keyIndex,
|
|
83
|
+
closed: false,
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
let style: React.CSSProperties = { ...config.style };
|
|
87
|
+
if (Array.isArray(offset) && offset.length === 2) {
|
|
88
|
+
const [left, top] = offset;
|
|
89
|
+
style = {
|
|
90
|
+
left,
|
|
91
|
+
top,
|
|
92
|
+
...style,
|
|
93
|
+
position: 'relative',
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return new Promise((resolve) => {
|
|
98
|
+
// TODO
|
|
99
|
+
// ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot
|
|
100
|
+
// Renders the component.
|
|
101
|
+
render(
|
|
102
|
+
<Message
|
|
103
|
+
key={keyIndex}
|
|
104
|
+
{...config}
|
|
105
|
+
theme={theme}
|
|
106
|
+
style={style}
|
|
107
|
+
onClose={(ctx) => {
|
|
108
|
+
onClose(ctx);
|
|
109
|
+
message.close();
|
|
110
|
+
}}
|
|
111
|
+
>
|
|
112
|
+
{content}
|
|
113
|
+
</Message>,
|
|
114
|
+
div,
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
// Mounts the current rendered message to the specified container.
|
|
118
|
+
container.appendChild(div);
|
|
119
|
+
// Adds the message to the message list.
|
|
120
|
+
messageList.push(message);
|
|
121
|
+
// Returns the message instance to the promise caller through the resolve function.
|
|
122
|
+
resolve(message);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function info(props: IMessageProps) {
|
|
127
|
+
createMessage('info', props);
|
|
128
|
+
}
|
|
129
|
+
function warn(props: IMessageProps) {
|
|
130
|
+
createMessage('warn', props);
|
|
131
|
+
}
|
|
132
|
+
function success(props: IMessageProps) {
|
|
133
|
+
createMessage('success', props);
|
|
134
|
+
}
|
|
135
|
+
function error(props: IMessageProps) {
|
|
136
|
+
createMessage('error', props);
|
|
137
|
+
}
|
|
138
|
+
function closeAll() {
|
|
139
|
+
messageList?.forEach((message) => message.close());
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export const MessagePlugin = {
|
|
143
|
+
info,
|
|
144
|
+
warn,
|
|
145
|
+
success,
|
|
146
|
+
error,
|
|
147
|
+
closeAll,
|
|
148
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@use "../../../style/theme/util" as *;
|
|
2
|
+
@import '../../../style/common/var.scss';
|
|
3
|
+
|
|
4
|
+
.#{$prefix}-overlayer-container {
|
|
5
|
+
position: absolute;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
|
|
9
|
+
.overlay {
|
|
10
|
+
position: absolute;
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 100%;
|
|
13
|
+
@include theme() {
|
|
14
|
+
background-color: get(black-4);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|