@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,107 @@
|
|
|
1
|
+
import React, { CSSProperties, ReactNode, forwardRef } from 'react';
|
|
2
|
+
import { classNames } from '../../../util/classnames';
|
|
3
|
+
import { classPrefix } from '../../../const/common';
|
|
4
|
+
import Loading from '../Loading/Loading';
|
|
5
|
+
import './Button.scss';
|
|
6
|
+
|
|
7
|
+
interface IButtonProps {
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
danger?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
icon?: ReactNode;
|
|
12
|
+
showText?: boolean;
|
|
13
|
+
ghost?: boolean;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
content?: string;
|
|
16
|
+
shape?: 'default' | 'cicle' | 'round';
|
|
17
|
+
size?: 'large' | 'middle' | 'small';
|
|
18
|
+
iconSize?: string;
|
|
19
|
+
type?: 'primary' | 'dashed' | 'link' | 'text' | 'default';
|
|
20
|
+
direction?: 'horizontal' | 'vertical';
|
|
21
|
+
className?: string;
|
|
22
|
+
iconClassName?: string;
|
|
23
|
+
isMobile?: boolean;
|
|
24
|
+
style?: CSSProperties;
|
|
25
|
+
isStopPropagation?: boolean;
|
|
26
|
+
onClick?: (event?: any) => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const Button = forwardRef((props: IButtonProps, ref: React.ForwardedRef<any>) => {
|
|
30
|
+
const {
|
|
31
|
+
icon,
|
|
32
|
+
iconSize,
|
|
33
|
+
content,
|
|
34
|
+
loading,
|
|
35
|
+
children,
|
|
36
|
+
showText = true,
|
|
37
|
+
ghost = false,
|
|
38
|
+
onClick = (event?: any) => null,
|
|
39
|
+
isStopPropagation = false,
|
|
40
|
+
size = 'middle',
|
|
41
|
+
direction = 'vertical',
|
|
42
|
+
className = '',
|
|
43
|
+
iconClassName = '',
|
|
44
|
+
isMobile = false,
|
|
45
|
+
style,
|
|
46
|
+
...rest
|
|
47
|
+
} = props;
|
|
48
|
+
|
|
49
|
+
const handleClick = (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
|
|
50
|
+
if (isStopPropagation) {
|
|
51
|
+
event.stopPropagation();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// eslint-disable-next-line no-unused-expressions
|
|
55
|
+
!loading && onClick?.(event);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const renderIconNode = () => {
|
|
59
|
+
const classnames = classNames([
|
|
60
|
+
`${classPrefix}-icon`,
|
|
61
|
+
iconClassName,
|
|
62
|
+
{
|
|
63
|
+
[`${classPrefix}-size-s`]: size === 'small',
|
|
64
|
+
[`${classPrefix}-size-m`]: size === 'middle',
|
|
65
|
+
[`${classPrefix}-size-l`]: size === 'large',
|
|
66
|
+
},
|
|
67
|
+
]);
|
|
68
|
+
const iconStyle = iconSize ? { width: iconSize, height: iconSize } : {};
|
|
69
|
+
return (
|
|
70
|
+
<div
|
|
71
|
+
className={classnames}
|
|
72
|
+
onClick={handleClick}
|
|
73
|
+
style={iconStyle}
|
|
74
|
+
>
|
|
75
|
+
{loading ? <Loading showOverlayer={false} /> : icon}
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
const renderChildren = () => showText && <div className={`${classPrefix}-content`}>{content || children}</div>;
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<div
|
|
83
|
+
ref={ref}
|
|
84
|
+
style={style}
|
|
85
|
+
className={classNames([
|
|
86
|
+
className,
|
|
87
|
+
`${classPrefix}-btn-container`,
|
|
88
|
+
{
|
|
89
|
+
mobile: isMobile,
|
|
90
|
+
pc: !isMobile,
|
|
91
|
+
[`${classPrefix}-flex-vertical`]: direction === 'vertical',
|
|
92
|
+
[`${classPrefix}-flex-horizontal`]: direction === 'horizontal',
|
|
93
|
+
[`${classPrefix}-size-s`]: size === 'small',
|
|
94
|
+
[`${classPrefix}-size-m`]: size === 'middle',
|
|
95
|
+
[`${classPrefix}-size-l`]: size === 'large',
|
|
96
|
+
[`${classPrefix}-ghost`]: ghost === true,
|
|
97
|
+
},
|
|
98
|
+
])}
|
|
99
|
+
{...rest}
|
|
100
|
+
>
|
|
101
|
+
{icon && renderIconNode()}
|
|
102
|
+
{renderChildren()}
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export default Button;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import React, { CSSProperties, MutableRefObject, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { TUIGlobal } from '../../../../TUICallService';
|
|
3
|
+
|
|
4
|
+
type TPosition = Pick<CSSProperties, 'left' | 'top' | 'right' | 'bottom'>;
|
|
5
|
+
interface IDraggableProps {
|
|
6
|
+
nodeRef?: MutableRefObject<HTMLElement>;
|
|
7
|
+
disable?: boolean;
|
|
8
|
+
initialPosition?: TPosition;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
onMoveStart?: () => void;
|
|
11
|
+
onMoveEnd?: () => void;
|
|
12
|
+
onPositionChange?: (params: TPosition) => void;
|
|
13
|
+
children?: any;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const EventsFor = {
|
|
17
|
+
touch: {
|
|
18
|
+
start: 'onTouchStart',
|
|
19
|
+
move: 'touchmove',
|
|
20
|
+
stop: 'touchend',
|
|
21
|
+
},
|
|
22
|
+
mouse: {
|
|
23
|
+
start: 'onMouseDown',
|
|
24
|
+
move: 'mousemove',
|
|
25
|
+
stop: 'mouseup',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
const pointerEvents = EventsFor[TUIGlobal.isH5 ? 'touch' : 'mouse'];
|
|
29
|
+
|
|
30
|
+
function getClientXY(e) {
|
|
31
|
+
if (TUIGlobal.isH5) {
|
|
32
|
+
e = e.touches[0];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return { clientX: e.clientX, clientY: e.clientY };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default function Draggable(props: IDraggableProps) {
|
|
39
|
+
const {
|
|
40
|
+
nodeRef,
|
|
41
|
+
children,
|
|
42
|
+
onMoveStart,
|
|
43
|
+
onMoveEnd,
|
|
44
|
+
onPositionChange,
|
|
45
|
+
initialPosition = { left: '0px', top: '0px' },
|
|
46
|
+
} = props;
|
|
47
|
+
const isMoving = useRef(false);
|
|
48
|
+
const boundSize = useRef<any>({});
|
|
49
|
+
const positionRef = useRef({ left: 0, top: 0 });
|
|
50
|
+
const [position, setPosition] = useState(initialPosition);
|
|
51
|
+
const [currentPosition, setCurrentPosition] = useState<TPosition>();
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
return () => {
|
|
54
|
+
if (nodeRef.current) {
|
|
55
|
+
nodeRef.current.ownerDocument.removeEventListener(pointerEvents.move, onMove);
|
|
56
|
+
nodeRef.current.ownerDocument.removeEventListener(pointerEvents.stop, onStop);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}, [nodeRef.current]);
|
|
60
|
+
|
|
61
|
+
const getBoundSize = (e) => {
|
|
62
|
+
const { clientX, clientY } = getClientXY(e);
|
|
63
|
+
const oW = clientX - nodeRef.current?.getBoundingClientRect().left;
|
|
64
|
+
const oH = clientY - nodeRef.current?.getBoundingClientRect().top;
|
|
65
|
+
const htmlWidth = document.documentElement.clientWidth;
|
|
66
|
+
const htmlHeight = document.documentElement.clientHeight;
|
|
67
|
+
const bWidth = nodeRef.current.offsetWidth;
|
|
68
|
+
const bHeight = nodeRef.current.offsetHeight;
|
|
69
|
+
|
|
70
|
+
return { oW, oH, htmlWidth, htmlHeight, bWidth, bHeight };
|
|
71
|
+
};
|
|
72
|
+
const getPosition = (e) => {
|
|
73
|
+
const { clientX, clientY } = getClientXY(e);
|
|
74
|
+
const left = clientX - boundSize.current.oW;
|
|
75
|
+
const top = clientY - boundSize.current.oH;
|
|
76
|
+
|
|
77
|
+
return { left, top };
|
|
78
|
+
};
|
|
79
|
+
const onStart = (e) => {
|
|
80
|
+
isMoving.current = true;
|
|
81
|
+
boundSize.current = getBoundSize(e);
|
|
82
|
+
positionRef.current = getPosition(e);
|
|
83
|
+
setPosition({ left: '0px', top: '0px' });
|
|
84
|
+
|
|
85
|
+
nodeRef.current.ownerDocument.addEventListener(pointerEvents.move, onMove);
|
|
86
|
+
nodeRef.current.ownerDocument.addEventListener(pointerEvents.stop, onStop);
|
|
87
|
+
};
|
|
88
|
+
const onDragMove = (e) => {
|
|
89
|
+
onMoveStart?.();
|
|
90
|
+
let { left, top } = getPosition(e);
|
|
91
|
+
|
|
92
|
+
if (left < 0) {
|
|
93
|
+
left = 0;
|
|
94
|
+
} else if (left > boundSize.current.htmlWidth - boundSize.current.bWidth) {
|
|
95
|
+
left = boundSize.current.htmlWidth - boundSize.current.bWidth;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (top < 0) {
|
|
99
|
+
top = 0;
|
|
100
|
+
} else if (top > boundSize.current.htmlHeight - boundSize.current.bHeight) {
|
|
101
|
+
top = boundSize.current.htmlHeight - boundSize.current.bHeight;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
positionRef.current = { left, top };
|
|
105
|
+
onPositionChange?.({ left, top });
|
|
106
|
+
setCurrentPosition({ left, top });
|
|
107
|
+
};
|
|
108
|
+
const onMove = (e) => {
|
|
109
|
+
isMoving.current && onDragMove(e)
|
|
110
|
+
};
|
|
111
|
+
const onStop = (e) => {
|
|
112
|
+
isMoving.current = false;
|
|
113
|
+
let left = positionRef.current.left;
|
|
114
|
+
// @ts-ignore
|
|
115
|
+
if (left < (boundSize.current.htmlWidth - boundSize.current.bWidth) / 2) {
|
|
116
|
+
left = 0;
|
|
117
|
+
} else {
|
|
118
|
+
left = boundSize.current.htmlWidth - boundSize.current.bWidth;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
positionRef.current = TUIGlobal.isH5 ? { left, top: positionRef.current.top } : { left: positionRef.current.left, top: positionRef.current.top };
|
|
122
|
+
|
|
123
|
+
setTimeout(() => {
|
|
124
|
+
onMoveEnd?.();
|
|
125
|
+
}, 0);
|
|
126
|
+
|
|
127
|
+
nodeRef.current.ownerDocument.removeEventListener(pointerEvents.move, onMove);
|
|
128
|
+
nodeRef.current.ownerDocument.removeEventListener(pointerEvents.stop, onStop);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const transform = useMemo(() =>
|
|
132
|
+
`translate(${positionRef.current.left}px, ${positionRef.current.top}px)`,
|
|
133
|
+
[positionRef.current],
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<>
|
|
138
|
+
{
|
|
139
|
+
React.cloneElement(children, {
|
|
140
|
+
style: {
|
|
141
|
+
...(children?.props?.style || {}),
|
|
142
|
+
position: 'absolute',
|
|
143
|
+
zIndex: 999,
|
|
144
|
+
touchAction: 'none',
|
|
145
|
+
...position,
|
|
146
|
+
transform,
|
|
147
|
+
userSelect: 'none',
|
|
148
|
+
WebkitUserSelect: 'none',
|
|
149
|
+
},
|
|
150
|
+
[pointerEvents.start]: onStart,
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
</>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@import '../../../../style/common/var.scss';
|
|
2
|
+
@import '../style/mixin.scss';
|
|
3
|
+
|
|
4
|
+
.#{$prefix}-col-container {
|
|
5
|
+
display: flex;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
align-items: center;
|
|
9
|
+
|
|
10
|
+
&.#{$prefix}-col-justify-content-start {
|
|
11
|
+
justify-content: flex-start;
|
|
12
|
+
}
|
|
13
|
+
&.#{$prefix}-col-justify-content-center {
|
|
14
|
+
justify-content: center;
|
|
15
|
+
}
|
|
16
|
+
&.#{$prefix}-col-justify-content-end {
|
|
17
|
+
justify-content: flex-end;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&.#{$prefix}-col-align-items-start {
|
|
21
|
+
align-items: flex-start;
|
|
22
|
+
}
|
|
23
|
+
&.#{$prefix}-col-align-items-center {
|
|
24
|
+
align-items: center;
|
|
25
|
+
}
|
|
26
|
+
&.#{$prefix}-col-align-items-end {
|
|
27
|
+
align-items: flex-end;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@include gen-grid();
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { CSSProperties, ReactNode, useContext } from 'react';
|
|
2
|
+
import { classNames } from '../../../../util/classnames';
|
|
3
|
+
import { RowContext } from '../Row';
|
|
4
|
+
import { classPrefix } from '../../../../const/common';
|
|
5
|
+
import './Col.scss';
|
|
6
|
+
|
|
7
|
+
interface IColProps {
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
span?: number;
|
|
10
|
+
align?: 'start' | 'center' | 'end';
|
|
11
|
+
justify?: 'start' | 'center' | 'end';
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
}
|
|
14
|
+
export default function Col(props: IColProps) {
|
|
15
|
+
const {
|
|
16
|
+
span = 12,
|
|
17
|
+
children,
|
|
18
|
+
style = {},
|
|
19
|
+
justify = 'center',
|
|
20
|
+
align = 'start',
|
|
21
|
+
} = props;
|
|
22
|
+
const { gutter } = useContext(RowContext);
|
|
23
|
+
|
|
24
|
+
const classnames = classNames([
|
|
25
|
+
`${classPrefix}-col-container`,
|
|
26
|
+
`${classPrefix}-col-${span}`,
|
|
27
|
+
`${classPrefix}-col-justify-content-${justify}`,
|
|
28
|
+
`${classPrefix}-col-align-items-${align}`,
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
const calcColStyle = () => {
|
|
32
|
+
if (typeof gutter === 'number') {
|
|
33
|
+
return {
|
|
34
|
+
paddingLeft: `${gutter / 2}px`,
|
|
35
|
+
paddingRight: `${gutter / 2}px`,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const colStyle = calcColStyle();
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
className={classnames}
|
|
45
|
+
style={{ ...colStyle, ...style }}
|
|
46
|
+
>
|
|
47
|
+
{children}
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
Col.displayName = 'Col';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@import '../../../../style/common/var.scss';
|
|
2
|
+
|
|
3
|
+
.#{$prefix}-row-container {
|
|
4
|
+
display: flex;
|
|
5
|
+
width: 100%;
|
|
6
|
+
// height: 100%;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
margin: 0;
|
|
9
|
+
padding: 0;
|
|
10
|
+
list-style: none;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-flow: row wrap;
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
flex-wrap: nowrap;
|
|
15
|
+
|
|
16
|
+
&.#{$prefix}-row-justify-left {
|
|
17
|
+
justify-content: flex-start;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&.#{$prefix}-row-justify-center {
|
|
21
|
+
justify-content: center;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.#{$prefix}-row-justify-right {
|
|
25
|
+
justify-content: flex-end;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { CSSProperties, createContext, useMemo } from 'react';
|
|
2
|
+
import { classNames } from '../../../../util/classnames';
|
|
3
|
+
import { classPrefix } from '../../../../const/common';
|
|
4
|
+
import './Row.scss';
|
|
5
|
+
|
|
6
|
+
interface IRowProps {
|
|
7
|
+
className?: string;
|
|
8
|
+
children?: any;
|
|
9
|
+
gutter?: number | Array<number>;
|
|
10
|
+
justify?: 'left' | 'center' | 'right';
|
|
11
|
+
style?: CSSProperties;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const RowContext = createContext<{ gutter?: number | number[] }>({ gutter: undefined });
|
|
15
|
+
|
|
16
|
+
export default function Row(props: IRowProps) {
|
|
17
|
+
const {
|
|
18
|
+
className = '',
|
|
19
|
+
children = [],
|
|
20
|
+
gutter,
|
|
21
|
+
style,
|
|
22
|
+
justify = 'center',
|
|
23
|
+
} = props;
|
|
24
|
+
|
|
25
|
+
const RowContextValue = useMemo(() => ({ gutter }), [gutter]);
|
|
26
|
+
|
|
27
|
+
const classnames = classNames([
|
|
28
|
+
`${classPrefix}-row-container`,
|
|
29
|
+
`${classPrefix}-row-justify-${justify}`,
|
|
30
|
+
className,
|
|
31
|
+
]);
|
|
32
|
+
|
|
33
|
+
const renderCols = () => {
|
|
34
|
+
const childrenLen = children?.length || 0;
|
|
35
|
+
|
|
36
|
+
if (childrenLen < 2) {
|
|
37
|
+
return children;
|
|
38
|
+
}
|
|
39
|
+
return React.Children.map(children, (child) => {
|
|
40
|
+
if (child?.type?.displayName === 'Col') {
|
|
41
|
+
return child;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div className={classnames} style={style}>
|
|
48
|
+
<RowContext.Provider value={RowContextValue}>{renderCols()}</RowContext.Provider>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
@import '../../../../style/common/var.scss';
|
|
3
|
+
|
|
4
|
+
@mixin gen-grid-columns($index, $class) {
|
|
5
|
+
@if $index > 0 {
|
|
6
|
+
.#{$prefix}-col#{$class}-#{$index} {
|
|
7
|
+
flex: 0 0 math.percentage(calc($index / $grid-columns));
|
|
8
|
+
max-width: math.percentage(calc($index / $grid-columns));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.#{$prefix}-col#{$class}-push-#{$index} {
|
|
12
|
+
left: math.percentage(calc($index / $grid-columns));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.#{$prefix}-col#{$class}-pull-#{$index} {
|
|
16
|
+
right: math.percentage(calc($index / $grid-columns));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.#{$prefix}-col#{$class}-offset-#{$index} {
|
|
20
|
+
margin-left: math.percentage(calc($index / $grid-columns));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.#{$prefix}-col#{$class}-order-#{$index} {
|
|
24
|
+
order: $index;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@include gen-grid-columns($index - 1, $class);
|
|
28
|
+
} @else {
|
|
29
|
+
.#{$prefix}-col#{$class}-#{$index} {
|
|
30
|
+
display: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.#{$prefix}-col-push-#{$index} {
|
|
34
|
+
left: auto;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.#{$prefix}-col-pull-#{$index} {
|
|
38
|
+
right: auto;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.#{$prefix}-col#{$class}-push-#{$index} {
|
|
42
|
+
left: auto;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.#{$prefix}-col#{$class}-pull-#{$index} {
|
|
46
|
+
right: auto;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.#{$prefix}-col#{$class}-offset-#{$index} {
|
|
50
|
+
margin-left: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.#{$prefix}-col#{$class}-order-#{$index} {
|
|
54
|
+
order: 0;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@mixin gen-grid($class: '') {
|
|
60
|
+
@include gen-grid-columns($grid-columns, $class);
|
|
61
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
useState,
|
|
3
|
+
useMemo,
|
|
4
|
+
useContext,
|
|
5
|
+
} from 'react';
|
|
6
|
+
import { CallInfoContext } from '../../../context';
|
|
7
|
+
|
|
8
|
+
interface IGridLayoutPRops {
|
|
9
|
+
rowHeight?: number;
|
|
10
|
+
children?: any;
|
|
11
|
+
unit?: 'vw' | '%';
|
|
12
|
+
className?: string;
|
|
13
|
+
enableFocus?: boolean;
|
|
14
|
+
isMobile?: boolean;
|
|
15
|
+
onHandleFocusChange?: (params?: any) => any;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function GridLayout(props: IGridLayoutPRops) {
|
|
19
|
+
const { isFloat } = useContext(CallInfoContext);
|
|
20
|
+
const width = 100;
|
|
21
|
+
let {
|
|
22
|
+
// eslint-disable-next-line prefer-const
|
|
23
|
+
rowHeight, unit = '%', className, isMobile, onHandleFocusChange, enableFocus = false, children,
|
|
24
|
+
} = props;
|
|
25
|
+
const [focus, setFocus] = useState(null);
|
|
26
|
+
const defaultLayout = useMemo(() => {
|
|
27
|
+
const len = children.length;
|
|
28
|
+
if (len <= 3) {
|
|
29
|
+
return [{
|
|
30
|
+
x: 0, y: 0, w: 6, h: 6,
|
|
31
|
+
}, {
|
|
32
|
+
x: 6, y: 0, w: 6, h: 6,
|
|
33
|
+
}, {
|
|
34
|
+
x: 3, y: 6, w: 6, h: 6,
|
|
35
|
+
}];
|
|
36
|
+
}
|
|
37
|
+
if (len === 4) {
|
|
38
|
+
return [{
|
|
39
|
+
x: 0, y: 0, w: 6, h: 6,
|
|
40
|
+
}, {
|
|
41
|
+
x: 6, y: 0, w: 6, h: 6,
|
|
42
|
+
}, {
|
|
43
|
+
x: 0, y: 6, w: 6, h: 6,
|
|
44
|
+
}, {
|
|
45
|
+
x: 6, y: 6, w: 6, h: 6,
|
|
46
|
+
}];
|
|
47
|
+
}
|
|
48
|
+
const layoutArr = [{
|
|
49
|
+
x: 0, y: 0, w: 4, h: 4,
|
|
50
|
+
}];
|
|
51
|
+
for (let i = 1; i < len; i++) {
|
|
52
|
+
const isWrap = layoutArr[i - 1].x + 4 === 12;
|
|
53
|
+
layoutArr[i] = {
|
|
54
|
+
x: layoutArr[i - 1].x + 4 === 12 ? 0 : layoutArr[i - 1].x + 4,
|
|
55
|
+
y: layoutArr[i - 1].y + (isWrap ? 4 : 0),
|
|
56
|
+
w: 4,
|
|
57
|
+
h: 4,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (!isMobile) {
|
|
62
|
+
if (len % 3 === 1) {
|
|
63
|
+
layoutArr[len - 1].x += 2;
|
|
64
|
+
}
|
|
65
|
+
if (len % 3 === 2) {
|
|
66
|
+
layoutArr[len - 1].x += 2;
|
|
67
|
+
layoutArr[len - 2].x += 2;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return layoutArr;
|
|
72
|
+
}, [children, isMobile]);
|
|
73
|
+
function handleClick(index) {
|
|
74
|
+
if (index === focus) {
|
|
75
|
+
setFocus(null);
|
|
76
|
+
onHandleFocusChange?.(null);
|
|
77
|
+
} else {
|
|
78
|
+
setFocus(index);
|
|
79
|
+
onHandleFocusChange?.(index);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const colWidth = width / 12;
|
|
83
|
+
rowHeight = colWidth;
|
|
84
|
+
const arr = Object.keys(Array.from({ length: defaultLayout.length }));
|
|
85
|
+
const newLayout = useMemo(() => {
|
|
86
|
+
const defaultLayout1 = JSON.parse(JSON.stringify(defaultLayout));
|
|
87
|
+
let colIndex;
|
|
88
|
+
let rowIndex;
|
|
89
|
+
if (focus != null) {
|
|
90
|
+
if (arr.length < 5) {
|
|
91
|
+
const newArr = arr.concat();
|
|
92
|
+
newArr.splice(focus, 1);
|
|
93
|
+
newArr.unshift(focus);
|
|
94
|
+
} else {
|
|
95
|
+
rowIndex = focus % 3;
|
|
96
|
+
colIndex = Math.floor(focus / 3);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (arr.length < 5) {
|
|
100
|
+
for (let i = 0; i < defaultLayout1.length; i++) {
|
|
101
|
+
const item = defaultLayout1[i];
|
|
102
|
+
if (i === 0) {
|
|
103
|
+
item.w += 6;
|
|
104
|
+
item.h += 6;
|
|
105
|
+
} else {
|
|
106
|
+
item.x = (i - 1) * 4;
|
|
107
|
+
item.y = 12;
|
|
108
|
+
item.w = 4;
|
|
109
|
+
item.h = 4;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const rs = defaultLayout1.shift();
|
|
113
|
+
defaultLayout1.splice(focus, 0, rs);
|
|
114
|
+
} else {
|
|
115
|
+
let focusStyle;
|
|
116
|
+
if (rowIndex === 0) {
|
|
117
|
+
if (defaultLayout1[focus + 1]) defaultLayout1[focus + 1].x += 4;
|
|
118
|
+
if (defaultLayout1[focus + 2]) defaultLayout1[focus + 2].y += 4;
|
|
119
|
+
focusStyle = {
|
|
120
|
+
x: 0,
|
|
121
|
+
y: colIndex * 4,
|
|
122
|
+
w: 8,
|
|
123
|
+
h: 8,
|
|
124
|
+
};
|
|
125
|
+
} else if (rowIndex === 2) {
|
|
126
|
+
focusStyle = {
|
|
127
|
+
x: 4,
|
|
128
|
+
y: colIndex * 4,
|
|
129
|
+
w: 8,
|
|
130
|
+
h: 8,
|
|
131
|
+
};
|
|
132
|
+
defaultLayout1[focus - 1].x = 0;
|
|
133
|
+
defaultLayout1[focus - 1].y += 4;
|
|
134
|
+
} else if (rowIndex === 1) {
|
|
135
|
+
focusStyle = {
|
|
136
|
+
x: 4,
|
|
137
|
+
y: colIndex * 4,
|
|
138
|
+
w: 8,
|
|
139
|
+
h: 8,
|
|
140
|
+
};
|
|
141
|
+
if (defaultLayout1[focus + 1]) {
|
|
142
|
+
defaultLayout1[focus + 1].x = 0;
|
|
143
|
+
defaultLayout1[focus + 1].y += 4;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const start = 3 - rowIndex;
|
|
147
|
+
for (let i = focus + start; i < defaultLayout1.length; i++) {
|
|
148
|
+
const item = defaultLayout1[i];
|
|
149
|
+
item.y += 4;
|
|
150
|
+
}
|
|
151
|
+
defaultLayout1[focus] = focusStyle;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return defaultLayout1;
|
|
155
|
+
}
|
|
156
|
+
return defaultLayout1;
|
|
157
|
+
}, [focus, defaultLayout]);
|
|
158
|
+
return (
|
|
159
|
+
<div className={className}>
|
|
160
|
+
{children?.map((child, index) => {
|
|
161
|
+
const {
|
|
162
|
+
x, y, w, h,
|
|
163
|
+
} = newLayout[index];
|
|
164
|
+
let style = {
|
|
165
|
+
width: w * colWidth + unit,
|
|
166
|
+
height: h * rowHeight + unit,
|
|
167
|
+
left: (x) * colWidth + unit,
|
|
168
|
+
top: (y) * rowHeight + unit,
|
|
169
|
+
position: 'absolute',
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
if (isFloat) {
|
|
173
|
+
style = {
|
|
174
|
+
width: '100%',
|
|
175
|
+
height: '100%',
|
|
176
|
+
left: '0px',
|
|
177
|
+
top: '0px',
|
|
178
|
+
position: 'absolute',
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return React.cloneElement(
|
|
183
|
+
child,
|
|
184
|
+
{ style, updateFocusItem: () => enableFocus && handleClick(index) },
|
|
185
|
+
);
|
|
186
|
+
})}
|
|
187
|
+
</div>
|
|
188
|
+
);
|
|
189
|
+
}
|