@trtc/calls-uikit-vue 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.
Files changed (483) hide show
  1. package/README-zh_CN.md +83 -0
  2. package/README.md +89 -0
  3. package/debug/GenerateTestUserSig-es.js +26 -0
  4. package/debug/lib-generate-test-usersig-es.min.js +2 -0
  5. package/package.json +42 -0
  6. package/src/Components/TUICallKit.vue +334 -0
  7. package/src/Components/assets/MicrophoneVolume/desktop/mic-off.svg +5 -0
  8. package/src/Components/assets/MicrophoneVolume/desktop/mic-on.svg +5 -0
  9. package/src/Components/assets/base/close.svg +1 -0
  10. package/src/Components/assets/base/error.svg +1 -0
  11. package/src/Components/assets/base/info.svg +1 -0
  12. package/src/Components/assets/base/loading-circle.svg +1 -0
  13. package/src/Components/assets/base/success.svg +1 -0
  14. package/src/Components/assets/base/waring.svg +1 -0
  15. package/src/Components/assets/button/accept.svg +1 -0
  16. package/src/Components/assets/button/background-blur-close.svg +1 -0
  17. package/src/Components/assets/button/background-blur-open.svg +1 -0
  18. package/src/Components/assets/button/camera-close.svg +1 -0
  19. package/src/Components/assets/button/camera-open.svg +1 -0
  20. package/src/Components/assets/button/desktop/arrow.png +0 -0
  21. package/src/Components/assets/button/desktop/fullScreen.svg +4 -0
  22. package/src/Components/assets/button/desktop/inviteUser.svg +1 -0
  23. package/src/Components/assets/button/desktop/minimize.svg +6 -0
  24. package/src/Components/assets/button/hangup.svg +1 -0
  25. package/src/Components/assets/button/microphone-close.svg +1 -0
  26. package/src/Components/assets/button/microphone-open.svg +1 -0
  27. package/src/Components/assets/button/mobile/down.svg +1 -0
  28. package/src/Components/assets/button/mobile/inviteUser.svg +1 -0
  29. package/src/Components/assets/button/mobile/minimize.svg +1 -0
  30. package/src/Components/assets/button/mobile/switch-camera.svg +1 -0
  31. package/src/Components/assets/button/mobile/up.svg +1 -0
  32. package/src/Components/assets/button/speaker-close.svg +1 -0
  33. package/src/Components/assets/button/speaker-open.svg +1 -0
  34. package/src/Components/assets/button/switch-audio.svg +1 -0
  35. package/src/Components/assets/common/arrows.svg +1 -0
  36. package/src/Components/assets/common/call.svg +1 -0
  37. package/src/Components/assets/common/close.svg +1 -0
  38. package/src/Components/assets/common/defaultAvatar.svg +1 -0
  39. package/src/Components/assets/common/loading-audio.svg +1 -0
  40. package/src/Components/assets/common/loading-video.png +0 -0
  41. package/src/Components/assets/common/microphone-volumn-close.svg +1 -0
  42. package/src/Components/assets/desktop/acceptAudio.svg +4 -0
  43. package/src/Components/assets/desktop/acceptVideo.svg +8 -0
  44. package/src/Components/assets/desktop/arrow.png +0 -0
  45. package/src/Components/assets/desktop/camera-false.svg +5 -0
  46. package/src/Components/assets/desktop/camera.svg +6 -0
  47. package/src/Components/assets/desktop/floatCallEnd.svg +3 -0
  48. package/src/Components/assets/desktop/floatFullScreen.svg +3 -0
  49. package/src/Components/assets/desktop/floatMicrophone.svg +4 -0
  50. package/src/Components/assets/desktop/floatMicrophoneClosed.svg +3 -0
  51. package/src/Components/assets/desktop/fullScreen.svg +4 -0
  52. package/src/Components/assets/desktop/hangup.svg +4 -0
  53. package/src/Components/assets/desktop/invite_user.svg +5 -0
  54. package/src/Components/assets/desktop/microphone-false.svg +8 -0
  55. package/src/Components/assets/desktop/microphone.svg +9 -0
  56. package/src/Components/assets/desktop/minimize.svg +6 -0
  57. package/src/Components/assets/desktop/permission/index.ts +11 -0
  58. package/src/Components/assets/desktop/permission/mac/permit-en.jpg +0 -0
  59. package/src/Components/assets/desktop/permission/mac/permit-zh.jpg +0 -0
  60. package/src/Components/assets/desktop/permission/win/permit-en.png +0 -0
  61. package/src/Components/assets/desktop/permission/win/permit-zh.png +0 -0
  62. package/src/Components/assets/desktop/switchScreen.svg +5 -0
  63. package/src/Components/assets/desktop/trans.svg +6 -0
  64. package/src/Components/assets/floatingWindow/desktop/floatCallEnd.svg +3 -0
  65. package/src/Components/assets/floatingWindow/desktop/floatFullScreen.svg +3 -0
  66. package/src/Components/assets/floatingWindow/desktop/floatMicrophone.svg +4 -0
  67. package/src/Components/assets/floatingWindow/desktop/floatMicrophoneClosed.svg +3 -0
  68. package/src/Components/assets/floatingWindow/mobile/camera-close.svg +1 -0
  69. package/src/Components/assets/floatingWindow/mobile/camera-open.svg +1 -0
  70. package/src/Components/assets/floatingWindow/mobile/earphone.svg +1 -0
  71. package/src/Components/assets/floatingWindow/mobile/microphone-close.svg +1 -0
  72. package/src/Components/assets/floatingWindow/mobile/microphone-open.svg +1 -0
  73. package/src/Components/assets/permission/desktop/index.ts +11 -0
  74. package/src/Components/assets/permission/desktop/mac/permit-en.jpg +0 -0
  75. package/src/Components/assets/permission/desktop/mac/permit-zh.jpg +0 -0
  76. package/src/Components/assets/permission/desktop/win/permit-en.png +0 -0
  77. package/src/Components/assets/permission/desktop/win/permit-zh.png +0 -0
  78. package/src/Components/assets/streamInfo/mobile/mic-off-h5.svg +1 -0
  79. package/src/Components/assets/streamInfo/mobile/mic-on-h5.svg +1 -0
  80. package/src/Components/assets/streamInfo/mobile/microphone-close-group.svg +1 -0
  81. package/src/Components/assets/streamInfo/mobile/microphone-close-single.svg +1 -0
  82. package/src/Components/assets/streamInfo/mobile/volumn.svg +1 -0
  83. package/src/Components/assets/streamInfo/networkStatus.png +0 -0
  84. package/src/Components/components/GroupCall/BackGround/BackGround.vue +20 -0
  85. package/src/Components/components/GroupCall/GroupCall.vue +129 -0
  86. package/src/Components/components/GroupCall/MediaContainer/MediaContainer.vue +267 -0
  87. package/src/Components/components/GroupCall/MediaContainer/StreamLoading/StreamLoading.vue +22 -0
  88. package/src/Components/components/SingleCall/MediaContainer/MediaContainer.vue +165 -0
  89. package/src/Components/components/SingleCall/SingleCall.vue +28 -0
  90. package/src/Components/components/SingleCall/hooks/useGetLargeViewName.ts +32 -0
  91. package/src/Components/components/base/Avatar/Avatar.ts +38 -0
  92. package/src/Components/components/base/Avatar/Avatar.vue +53 -0
  93. package/src/Components/components/base/Avatar/style/Avatar.scss +40 -0
  94. package/src/Components/components/base/Button/Button.ts +60 -0
  95. package/src/Components/components/base/Button/Button.vue +61 -0
  96. package/src/Components/components/base/Button/style/Button.scss +42 -0
  97. package/src/Components/components/base/Grid/Grid.ts +26 -0
  98. package/src/Components/components/base/Grid/Grid.vue +40 -0
  99. package/src/Components/components/base/Grid/GridItem/GridItem.vue +81 -0
  100. package/src/Components/components/base/Grid/GridItem/style/GridItem.scss +13 -0
  101. package/src/Components/components/base/Icon/Icon.ts +9 -0
  102. package/src/Components/components/base/Icon/Icon.vue +21 -0
  103. package/src/Components/components/base/Layout/Col/Col.ts +23 -0
  104. package/src/Components/components/base/Layout/Col/Col.vue +46 -0
  105. package/src/Components/components/base/Layout/Col/style/Col.scss +9 -0
  106. package/src/Components/components/base/Layout/Row/Row.ts +23 -0
  107. package/src/Components/components/base/Layout/Row/Row.vue +38 -0
  108. package/src/Components/components/base/Layout/Row/style/Row.scss +10 -0
  109. package/src/Components/components/base/Layout/constant.ts +1 -0
  110. package/src/Components/components/base/Loading/Circle/Circle.ts +13 -0
  111. package/src/Components/components/base/Loading/Circle/Circle.vue +36 -0
  112. package/src/Components/components/base/Loading/Circle/style/Circle.scss +26 -0
  113. package/src/Components/components/base/Loading/Dot/Dot.ts +13 -0
  114. package/src/Components/components/base/Loading/Dot/Dot.vue +44 -0
  115. package/src/Components/components/base/Loading/Dot/style/Dot.scss +61 -0
  116. package/src/Components/components/base/Loading/Loading.ts +29 -0
  117. package/src/Components/components/base/Loading/Loading.vue +36 -0
  118. package/src/Components/components/base/Loading/style/Loading.scss +18 -0
  119. package/src/Components/components/base/Message/Message.ts +117 -0
  120. package/src/Components/components/base/Message/Message.vue +60 -0
  121. package/src/Components/components/base/Message/style/Message.scss +49 -0
  122. package/src/Components/components/base/MessageGroup/MessageGroup.vue +37 -0
  123. package/src/Components/components/base/Overlay/Overlay.ts +46 -0
  124. package/src/Components/components/base/Overlay/Overlay.vue +75 -0
  125. package/src/Components/components/base/Overlay/style/Overlay.scss +40 -0
  126. package/src/Components/components/base/Popover/Popover.ts +36 -0
  127. package/src/Components/components/base/Popover/Popover.vue +40 -0
  128. package/src/Components/components/base/Popover/PopoverWeb/PopoverWeb.vue +110 -0
  129. package/src/Components/components/base/Popover/PopoverWx/PopoverWx.vue +15 -0
  130. package/src/Components/components/base/Popover/style/Popover.scss +30 -0
  131. package/src/Components/components/base/Popover/utils/calculatePosition.ts +50 -0
  132. package/src/Components/components/base/Portal/Portal.ts +14 -0
  133. package/src/Components/components/base/Portal/Portal.vue +22 -0
  134. package/src/Components/components/base/Portal/miniprogram/Portal.vue +20 -0
  135. package/src/Components/components/base/Portal/vue2/Portal.vue +53 -0
  136. package/src/Components/components/base/Portal/vue3/Portal.vue +19 -0
  137. package/src/Components/components/base/TKImage/TKImage.ts +34 -0
  138. package/src/Components/components/base/TKImage/TKImage.vue +77 -0
  139. package/src/Components/components/base/TKImage/style/TKImage.scss +20 -0
  140. package/src/Components/components/base/TKText/TKText.ts +24 -0
  141. package/src/Components/components/base/TKText/TKText.vue +43 -0
  142. package/src/Components/components/base/TKText/style/TKText.scss +19 -0
  143. package/src/Components/components/base/ToggleWindow/ToggleWindow.ts +19 -0
  144. package/src/Components/components/base/ToggleWindow/ToggleWindow.vue +46 -0
  145. package/src/Components/components/base/ToggleWindow/ToggleWindowItem/ToggleWindowItem.ts +5 -0
  146. package/src/Components/components/base/ToggleWindow/ToggleWindowItem/ToggleWindowItem.vue +62 -0
  147. package/src/Components/components/base/ToggleWindow/ToggleWindowItem/style/ToggleWindowItem.scss +38 -0
  148. package/src/Components/components/base/ToggleWindow/constant.ts +1 -0
  149. package/src/Components/components/base/ToggleWindow/style/ToggleWindow.scss +7 -0
  150. package/src/Components/components/base/assets/message/close.svg +5 -0
  151. package/src/Components/components/base/assets/message/error.svg +1 -0
  152. package/src/Components/components/base/assets/message/info.svg +1 -0
  153. package/src/Components/components/base/assets/message/success.svg +1 -0
  154. package/src/Components/components/base/assets/message/warning.svg +1 -0
  155. package/src/Components/components/base/constants/index.ts +8 -0
  156. package/src/Components/components/base/hooks/useListenerEvent.ts +36 -0
  157. package/src/Components/components/base/hooks/useOnClickOutSide.ts +27 -0
  158. package/src/Components/components/base/styles/common.scss +43 -0
  159. package/src/Components/components/base/styles/var.scss +132 -0
  160. package/src/Components/components/base/util/checkEnv.ts +51 -0
  161. package/src/Components/components/base/util/checkVueVersion.ts +11 -0
  162. package/src/Components/components/base/util/classNames.ts +34 -0
  163. package/src/Components/components/base/util/filterObject.ts +11 -0
  164. package/src/Components/components/base/util/index.ts +10 -0
  165. package/src/Components/components/common/AudioStream/AudioStream.ts +29 -0
  166. package/src/Components/components/common/AudioStream/AudioStream.vue +65 -0
  167. package/src/Components/components/common/Button/Accept.vue +66 -0
  168. package/src/Components/components/common/Button/Camera.vue +115 -0
  169. package/src/Components/components/common/Button/FullScreen.vue +32 -0
  170. package/src/Components/components/common/Button/Hangup.vue +57 -0
  171. package/src/Components/components/common/Button/InviteUser.vue +52 -0
  172. package/src/Components/components/common/Button/Microphone.vue +109 -0
  173. package/src/Components/components/common/Button/Minimize.vue +39 -0
  174. package/src/Components/components/common/Button/Reject.vue +52 -0
  175. package/src/Components/components/common/Button/Speaker.vue +98 -0
  176. package/src/Components/components/common/Button/SwitchCamera.vue +58 -0
  177. package/src/Components/components/common/Button/ToggleButtonPanel.vue +44 -0
  178. package/src/Components/components/common/Button/VirtualBackground.vue +76 -0
  179. package/src/Components/components/common/Button/hooks/useConfig.ts +33 -0
  180. package/src/Components/components/common/Button/props/Button.ts +15 -0
  181. package/src/Components/components/common/Button/style/common.scss +5 -0
  182. package/src/Components/components/common/Button/style/desktop.scss +49 -0
  183. package/src/Components/components/common/Button/style/index.scss +2 -0
  184. package/src/Components/components/common/Button/style/mobile.scss +63 -0
  185. package/src/Components/components/common/ButtonPanel/ButtonPanel.vue +238 -0
  186. package/src/Components/components/common/ButtonPanel/config/InitConfig.ts +248 -0
  187. package/src/Components/components/common/ButtonPanel/config/VirtualBackgroundMobileConfig.ts +29 -0
  188. package/src/Components/components/common/ButtonPanel/hooks/useButtonPanelLayout.ts +63 -0
  189. package/src/Components/components/common/DeviceSelect/DeviceSelect.ts +11 -0
  190. package/src/Components/components/common/DeviceSelect/DeviceSelect.vue +158 -0
  191. package/src/Components/components/common/FloatWindow/FloatWindow.vue +64 -0
  192. package/src/Components/components/common/FloatWindow/desktop/FloatWindow.vue +106 -0
  193. package/src/Components/components/common/FloatWindow/mobile/FloatWindow.vue +28 -0
  194. package/src/Components/components/common/FloatWindow/mobile/FloatWindowGroupCall.vue +141 -0
  195. package/src/Components/components/common/FloatWindow/mobile/FloatWindowSingleCall.vue +109 -0
  196. package/src/Components/components/common/JoinGroupCard/JoinGroupCard.vue +51 -0
  197. package/src/Components/components/common/JoinGroupCard/desktop/JoinGroupCard.scss +80 -0
  198. package/src/Components/components/common/JoinGroupCard/desktop/JoinGroupCard.vue +57 -0
  199. package/src/Components/components/common/JoinGroupCard/mobile/JoinGroupCard.scss +60 -0
  200. package/src/Components/components/common/JoinGroupCard/mobile/JoinGroupCard.vue +65 -0
  201. package/src/Components/components/common/MicVolume/MicVolume.vue +37 -0
  202. package/src/Components/components/common/MicVolume/MicVolumeClosed.vue +11 -0
  203. package/src/Components/components/common/MicrophoneVolume/MicrophoneVolume.ts +10 -0
  204. package/src/Components/components/common/MicrophoneVolume/MicrophoneVolume.vue +61 -0
  205. package/src/Components/components/common/OverlayStream/OverlayStream.ts +102 -0
  206. package/src/Components/components/common/OverlayStream/OverlayStream.vue +104 -0
  207. package/src/Components/components/common/OverlayStream/style/OverlayStream.scss +12 -0
  208. package/src/Components/components/common/OverlayStream/style/mobile.scss +32 -0
  209. package/src/Components/components/common/OverlayStream/style/pc.scss +21 -0
  210. package/src/Components/components/common/PermitTip/CloseIcon.vue +3 -0
  211. package/src/Components/components/common/PermitTip/PermitTip.ts +33 -0
  212. package/src/Components/components/common/PermitTip/PermitTip.vue +62 -0
  213. package/src/Components/components/common/PermitTip/SystemPermitTip.vue +160 -0
  214. package/src/Components/components/common/Player/Player.ts +18 -0
  215. package/src/Components/components/common/Player/Player.vue +59 -0
  216. package/src/Components/components/common/Player/WeChatPlayer/WeChatPlayer.vue +101 -0
  217. package/src/Components/components/common/Player/WeChatPlayer/style/index.scss +38 -0
  218. package/src/Components/components/common/Popover/Popover.vue +85 -0
  219. package/src/Components/components/common/Pusher/Pusher.ts +18 -0
  220. package/src/Components/components/common/Pusher/Pusher.vue +78 -0
  221. package/src/Components/components/common/Pusher/WeChatPusher/WeChatPusher.vue +70 -0
  222. package/src/Components/components/common/Pusher/WeChatPusher/style/index.scss +37 -0
  223. package/src/Components/components/common/SelectUser/SelectUser.vue +74 -0
  224. package/src/Components/components/common/SelectUser/components/Dialog/TDialog.vue +94 -0
  225. package/src/Components/components/common/SelectUser/components/Dialog/style/color.css +43 -0
  226. package/src/Components/components/common/SelectUser/components/Dialog/style/dialog.css +3 -0
  227. package/src/Components/components/common/SelectUser/components/Dialog/style/h5.css +49 -0
  228. package/src/Components/components/common/SelectUser/components/Dialog/style/web.css +55 -0
  229. package/src/Components/components/common/SelectUser/components/Icon/TIcon.vue +44 -0
  230. package/src/Components/components/common/SelectUser/components/Icon/style/icon.css +6 -0
  231. package/src/Components/components/common/SelectUser/components/Transfer/TTransfer.vue +304 -0
  232. package/src/Components/components/common/SelectUser/components/Transfer/icon/back.svg +16 -0
  233. package/src/Components/components/common/SelectUser/components/Transfer/icon/cancel.svg +23 -0
  234. package/src/Components/components/common/SelectUser/components/Transfer/icon/selected.svg +27 -0
  235. package/src/Components/components/common/SelectUser/components/Transfer/style/color.css +64 -0
  236. package/src/Components/components/common/SelectUser/components/Transfer/style/h5.css +86 -0
  237. package/src/Components/components/common/SelectUser/components/Transfer/style/transfer.css +17 -0
  238. package/src/Components/components/common/SelectUser/components/Transfer/style/web.css +146 -0
  239. package/src/Components/components/common/SelectUser/index.ts +12 -0
  240. package/src/Components/components/common/Swiper/Swiper.vue +145 -0
  241. package/src/Components/components/common/Swiper/SwiperSlider.vue +55 -0
  242. package/src/Components/components/common/Swiper/index.ts +10 -0
  243. package/src/Components/components/common/Swiper/useSlide.ts +56 -0
  244. package/src/Components/components/common/Swiper/useSwiperSliders.ts +34 -0
  245. package/src/Components/components/common/SwiperWx/Swiper.vue +123 -0
  246. package/src/Components/components/common/SwiperWx/SwiperSlider.vue +87 -0
  247. package/src/Components/components/common/SwiperWx/index.ts +5 -0
  248. package/src/Components/components/common/TKStreamInfo/StreamInfo.ts +34 -0
  249. package/src/Components/components/common/TKStreamInfo/StreamInfoMobile.vue +82 -0
  250. package/src/Components/components/common/TKStreamInfo/StreamInfoPC.vue +58 -0
  251. package/src/Components/components/common/TKStreamInfo/TKStreamInfo.vue +43 -0
  252. package/src/Components/components/common/Timer/Timer.ts +14 -0
  253. package/src/Components/components/common/Timer/Timer.vue +24 -0
  254. package/src/Components/components/common/Tip/Tip.ts +5 -0
  255. package/src/Components/components/common/Tip/Tip.vue +67 -0
  256. package/src/Components/components/common/Toast/Toast.ts +84 -0
  257. package/src/Components/components/common/Toast/Toast.vue +133 -0
  258. package/src/Components/components/common/Toast/index.ts +6 -0
  259. package/src/Components/components/common/Toast/type.ts +16 -0
  260. package/src/Components/components/common/TopBar/TopBar.ts +8 -0
  261. package/src/Components/components/common/TopBar/TopBar.vue +116 -0
  262. package/src/Components/components/common/Waiting/Waiting.vue +126 -0
  263. package/src/Components/components/config/button/ClosedPanelUI.ts +109 -0
  264. package/src/Components/components/config/button/DefaultUI.ts +544 -0
  265. package/src/Components/components/config/button/index.ts +2 -0
  266. package/src/Components/context/ButtonPanelContext.ts +6 -0
  267. package/src/Components/context/CallInfoContext.ts +15 -0
  268. package/src/Components/context/CallerUserInfoContext.ts +9 -0
  269. package/src/Components/context/CustomUIConfigContext.ts +1 -0
  270. package/src/Components/context/FloatWindowContext.ts +5 -0
  271. package/src/Components/context/FocusItemContext.ts +1 -0
  272. package/src/Components/context/IsClickableContext.ts +1 -0
  273. package/src/Components/context/PopoverContext.ts +1 -0
  274. package/src/Components/context/TranslateContext.ts +1 -0
  275. package/src/Components/context/UserInfoContextExcludeVolume.ts +8 -0
  276. package/src/Components/context/index.ts +10 -0
  277. package/src/Components/hooks/index.ts +20 -0
  278. package/src/Components/hooks/useButtonPanelStatus.ts +6 -0
  279. package/src/Components/hooks/useCallDuration.ts +32 -0
  280. package/src/Components/hooks/useCallInfoContext.ts +6 -0
  281. package/src/Components/hooks/useCallerUserInfoContext.ts +6 -0
  282. package/src/Components/hooks/useCustomUI.ts +7 -0
  283. package/src/Components/hooks/useCustomUIButtonConfig.ts +96 -0
  284. package/src/Components/hooks/useDeviceList.ts +51 -0
  285. package/src/Components/hooks/useFloatWindowContext.ts +6 -0
  286. package/src/Components/hooks/useFocusContext.ts +6 -0
  287. package/src/Components/hooks/useGetVolumeMap.ts +59 -0
  288. package/src/Components/hooks/useGroupCallLayout.ts +142 -0
  289. package/src/Components/hooks/useIsClickableContext.ts +6 -0
  290. package/src/Components/hooks/useJoinGroupCall.ts +69 -0
  291. package/src/Components/hooks/useNetWorkStatus.ts +30 -0
  292. package/src/Components/hooks/usePlayer.ts +32 -0
  293. package/src/Components/hooks/usePopover.ts +6 -0
  294. package/src/Components/hooks/useTip.ts +42 -0
  295. package/src/Components/hooks/useTranslate.ts +7 -0
  296. package/src/Components/hooks/useUserInfoContextExcludeVolume.ts +6 -0
  297. package/src/Components/hooks/useViewBackgroundConfig.ts +12 -0
  298. package/src/Components/util/deepClone.ts +15 -0
  299. package/src/Components/util/findValues.ts +21 -0
  300. package/src/Components/util/index.ts +6 -0
  301. package/src/Components/util/isEmpty.ts +15 -0
  302. package/src/Components/util/isEqual.ts +40 -0
  303. package/src/Components/util/isObject.ts +3 -0
  304. package/src/Components/util/stringToPath.ts +78 -0
  305. package/src/Components/util/toggleScreen.ts +10 -0
  306. package/src/Components/util/uiConfig.ts +74 -0
  307. package/src/TUICallService/CallService/UIDesign.ts +174 -0
  308. package/src/TUICallService/CallService/bellContext.ts +88 -0
  309. package/src/TUICallService/CallService/chatCombine.ts +313 -0
  310. package/src/TUICallService/CallService/engineEventHandler.ts +404 -0
  311. package/src/TUICallService/CallService/index.ts +799 -0
  312. package/src/TUICallService/CallService/miniProgram.ts +65 -0
  313. package/src/TUICallService/CallService/utils.ts +281 -0
  314. package/src/TUICallService/TUIGlobal/tuiGlobal.ts +43 -0
  315. package/src/TUICallService/TUIStore/callStore.ts +93 -0
  316. package/src/TUICallService/TUIStore/tuiStore.ts +167 -0
  317. package/src/TUICallService/assets/phone_dialing.mp3 +0 -0
  318. package/src/TUICallService/assets/phone_ringing.mp3 +0 -0
  319. package/src/TUICallService/const/call.ts +157 -0
  320. package/src/TUICallService/const/error.ts +20 -0
  321. package/src/TUICallService/const/index.ts +103 -0
  322. package/src/TUICallService/const/log.ts +9 -0
  323. package/src/TUICallService/index.ts +37 -0
  324. package/src/TUICallService/interface/ICallService.ts +70 -0
  325. package/src/TUICallService/interface/ICallStore.ts +55 -0
  326. package/src/TUICallService/interface/ITUIGlobal.ts +36 -0
  327. package/src/TUICallService/interface/ITUIStore.ts +87 -0
  328. package/src/TUICallService/interface/index.ts +4 -0
  329. package/src/TUICallService/locales/en.ts +135 -0
  330. package/src/TUICallService/locales/index.ts +57 -0
  331. package/src/TUICallService/locales/ja_JP.ts +134 -0
  332. package/src/TUICallService/locales/zh-cn.ts +130 -0
  333. package/src/TUICallService/serve/callManager.ts +109 -0
  334. package/src/TUICallService/utils/common-utils.ts +269 -0
  335. package/src/TUICallService/utils/decorators/promise-retry.ts +51 -0
  336. package/src/TUICallService/utils/env.ts +51 -0
  337. package/src/TUICallService/utils/index.ts +32 -0
  338. package/src/TUICallService/utils/is-empty.ts +31 -0
  339. package/src/TUICallService/utils/retry.ts +88 -0
  340. package/src/TUICallService/utils/timer.ts +162 -0
  341. package/src/TUICallService/utils/validate/avoidRepeatedCall.ts +39 -0
  342. package/src/TUICallService/utils/validate/index.ts +7 -0
  343. package/src/adapter-vue.ts +4 -0
  344. package/src/index.ts +65 -0
  345. package/stats.html +4949 -0
  346. package/tuicall-uikit-vue.es.js +8568 -0
  347. package/tuicall-uikit-vue.umd.js +2 -0
  348. package/types/Components/assets/desktop/permission/index.d.ts +5 -0
  349. package/types/Components/assets/permission/desktop/index.d.ts +5 -0
  350. package/types/Components/components/SingleCall/hooks/useGetLargeViewName.d.ts +2 -0
  351. package/types/Components/components/base/Avatar/Avatar.d.ts +34 -0
  352. package/types/Components/components/base/Button/Button.d.ts +56 -0
  353. package/types/Components/components/base/Grid/Grid.d.ts +23 -0
  354. package/types/Components/components/base/Icon/Icon.d.ts +9 -0
  355. package/types/Components/components/base/Layout/Col/Col.d.ts +20 -0
  356. package/types/Components/components/base/Layout/Row/Row.d.ts +20 -0
  357. package/types/Components/components/base/Layout/constant.d.ts +1 -0
  358. package/types/Components/components/base/Loading/Circle/Circle.d.ts +13 -0
  359. package/types/Components/components/base/Loading/Dot/Dot.d.ts +13 -0
  360. package/types/Components/components/base/Loading/Loading.d.ts +26 -0
  361. package/types/Components/components/base/Message/Message.d.ts +50 -0
  362. package/types/Components/components/base/Overlay/Overlay.d.ts +45 -0
  363. package/types/Components/components/base/Popover/Popover.d.ts +34 -0
  364. package/types/Components/components/base/Popover/utils/calculatePosition.d.ts +4 -0
  365. package/types/Components/components/base/Portal/Portal.d.ts +14 -0
  366. package/types/Components/components/base/TKImage/TKImage.d.ts +33 -0
  367. package/types/Components/components/base/TKText/TKText.d.ts +24 -0
  368. package/types/Components/components/base/ToggleWindow/ToggleWindow.d.ts +18 -0
  369. package/types/Components/components/base/ToggleWindow/ToggleWindowItem/ToggleWindowItem.d.ts +5 -0
  370. package/types/Components/components/base/ToggleWindow/constant.d.ts +1 -0
  371. package/types/Components/components/base/constants/index.d.ts +7 -0
  372. package/types/Components/components/base/hooks/useListenerEvent.d.ts +13 -0
  373. package/types/Components/components/base/hooks/useOnClickOutSide.d.ts +1 -0
  374. package/types/Components/components/base/util/checkEnv.d.ts +10 -0
  375. package/types/Components/components/base/util/checkVueVersion.d.ts +4 -0
  376. package/types/Components/components/base/util/classNames.d.ts +1 -0
  377. package/types/Components/components/base/util/filterObject.d.ts +1 -0
  378. package/types/Components/components/base/util/index.d.ts +5 -0
  379. package/types/Components/components/common/AudioStream/AudioStream.d.ts +29 -0
  380. package/types/Components/components/common/Button/hooks/useConfig.d.ts +2 -0
  381. package/types/Components/components/common/Button/props/Button.d.ts +15 -0
  382. package/types/Components/components/common/ButtonPanel/config/InitConfig.d.ts +89 -0
  383. package/types/Components/components/common/ButtonPanel/config/VirtualBackgroundMobileConfig.d.ts +66 -0
  384. package/types/Components/components/common/ButtonPanel/hooks/useButtonPanelLayout.d.ts +4 -0
  385. package/types/Components/components/common/DeviceSelect/DeviceSelect.d.ts +11 -0
  386. package/types/Components/components/common/MicrophoneVolume/MicrophoneVolume.d.ts +10 -0
  387. package/types/Components/components/common/OverlayStream/OverlayStream.d.ts +92 -0
  388. package/types/Components/components/common/PermitTip/PermitTip.d.ts +3 -0
  389. package/types/Components/components/common/Player/Player.d.ts +18 -0
  390. package/types/Components/components/common/Pusher/Pusher.d.ts +18 -0
  391. package/types/Components/components/common/SelectUser/index.d.ts +6 -0
  392. package/types/Components/components/common/Swiper/index.d.ts +7 -0
  393. package/types/Components/components/common/Swiper/useSlide.d.ts +7 -0
  394. package/types/Components/components/common/Swiper/useSwiperSliders.d.ts +1 -0
  395. package/types/Components/components/common/SwiperWx/index.d.ts +4 -0
  396. package/types/Components/components/common/TKStreamInfo/StreamInfo.d.ts +34 -0
  397. package/types/Components/components/common/Timer/Timer.d.ts +14 -0
  398. package/types/Components/components/common/Tip/Tip.d.ts +5 -0
  399. package/types/Components/components/common/Toast/Toast.d.ts +4 -0
  400. package/types/Components/components/common/Toast/index.d.ts +2 -0
  401. package/types/Components/components/common/Toast/type.d.ts +16 -0
  402. package/types/Components/components/common/TopBar/TopBar.d.ts +8 -0
  403. package/types/Components/components/config/button/ClosedPanelUI.d.ts +3380 -0
  404. package/types/Components/components/config/button/DefaultUI.d.ts +14751 -0
  405. package/types/Components/components/config/button/index.d.ts +2 -0
  406. package/types/Components/context/ButtonPanelContext.d.ts +4 -0
  407. package/types/Components/context/CallInfoContext.d.ts +13 -0
  408. package/types/Components/context/CallerUserInfoContext.d.ts +8 -0
  409. package/types/Components/context/CustomUIConfigContext.d.ts +1 -0
  410. package/types/Components/context/FloatWindowContext.d.ts +4 -0
  411. package/types/Components/context/FocusItemContext.d.ts +1 -0
  412. package/types/Components/context/IsClickableContext.d.ts +1 -0
  413. package/types/Components/context/PopoverContext.d.ts +1 -0
  414. package/types/Components/context/TranslateContext.d.ts +1 -0
  415. package/types/Components/context/UserInfoContextExcludeVolume.d.ts +6 -0
  416. package/types/Components/context/index.d.ts +10 -0
  417. package/types/Components/hooks/index.d.ts +20 -0
  418. package/types/Components/hooks/useButtonPanelStatus.d.ts +2 -0
  419. package/types/Components/hooks/useCallDuration.d.ts +3 -0
  420. package/types/Components/hooks/useCallInfoContext.d.ts +2 -0
  421. package/types/Components/hooks/useCallerUserInfoContext.d.ts +2 -0
  422. package/types/Components/hooks/useCustomUI.d.ts +3 -0
  423. package/types/Components/hooks/useCustomUIButtonConfig.d.ts +1 -0
  424. package/types/Components/hooks/useDeviceList.d.ts +7 -0
  425. package/types/Components/hooks/useFloatWindowContext.d.ts +2 -0
  426. package/types/Components/hooks/useFocusContext.d.ts +1 -0
  427. package/types/Components/hooks/useGetVolumeMap.d.ts +1 -0
  428. package/types/Components/hooks/useGroupCallLayout.d.ts +1 -0
  429. package/types/Components/hooks/useIsClickableContext.d.ts +2 -0
  430. package/types/Components/hooks/useJoinGroupCall.d.ts +9 -0
  431. package/types/Components/hooks/useNetWorkStatus.d.ts +3 -0
  432. package/types/Components/hooks/usePlayer.d.ts +1 -0
  433. package/types/Components/hooks/usePopover.d.ts +2 -0
  434. package/types/Components/hooks/useTip.d.ts +5 -0
  435. package/types/Components/hooks/useTranslate.d.ts +2 -0
  436. package/types/Components/hooks/useUserInfoContextExcludeVolume.d.ts +2 -0
  437. package/types/Components/hooks/useViewBackgroundConfig.d.ts +1 -0
  438. package/types/Components/util/deepClone.d.ts +1 -0
  439. package/types/Components/util/findValues.d.ts +1 -0
  440. package/types/Components/util/index.d.ts +6 -0
  441. package/types/Components/util/isEmpty.d.ts +1 -0
  442. package/types/Components/util/isEqual.d.ts +1 -0
  443. package/types/Components/util/isObject.d.ts +1 -0
  444. package/types/Components/util/stringToPath.d.ts +12 -0
  445. package/types/Components/util/toggleScreen.d.ts +1 -0
  446. package/types/Components/util/uiConfig.d.ts +3 -0
  447. package/types/TUICallService/CallService/UIDesign.d.ts +28 -0
  448. package/types/TUICallService/CallService/bellContext.d.ts +19 -0
  449. package/types/TUICallService/CallService/chatCombine.d.ts +50 -0
  450. package/types/TUICallService/CallService/engineEventHandler.d.ts +35 -0
  451. package/types/TUICallService/CallService/index.d.ts +98 -0
  452. package/types/TUICallService/CallService/miniProgram.d.ts +7 -0
  453. package/types/TUICallService/CallService/utils.d.ts +42 -0
  454. package/types/TUICallService/TUIGlobal/tuiGlobal.d.ts +21 -0
  455. package/types/TUICallService/TUIStore/callStore.d.ts +10 -0
  456. package/types/TUICallService/TUIStore/tuiStore.d.ts +57 -0
  457. package/types/TUICallService/const/call.d.ts +141 -0
  458. package/types/TUICallService/const/error.d.ts +2 -0
  459. package/types/TUICallService/const/index.d.ts +27 -0
  460. package/types/TUICallService/const/log.d.ts +7 -0
  461. package/types/TUICallService/index.d.ts +5 -0
  462. package/types/TUICallService/interface/ICallService.d.ts +69 -0
  463. package/types/TUICallService/interface/ICallStore.d.ts +47 -0
  464. package/types/TUICallService/interface/ITUIGlobal.d.ts +36 -0
  465. package/types/TUICallService/interface/ITUIStore.d.ts +83 -0
  466. package/types/TUICallService/interface/index.d.ts +4 -0
  467. package/types/TUICallService/locales/en.d.ts +128 -0
  468. package/types/TUICallService/locales/index.d.ts +10 -0
  469. package/types/TUICallService/locales/ja_JP.d.ts +127 -0
  470. package/types/TUICallService/locales/zh-cn.d.ts +123 -0
  471. package/types/TUICallService/serve/callManager.d.ts +11 -0
  472. package/types/TUICallService/utils/common-utils.d.ts +62 -0
  473. package/types/TUICallService/utils/decorators/promise-retry.d.ts +32 -0
  474. package/types/TUICallService/utils/env.d.ts +10 -0
  475. package/types/TUICallService/utils/index.d.ts +2 -0
  476. package/types/TUICallService/utils/is-empty.d.ts +2 -0
  477. package/types/TUICallService/utils/retry.d.ts +36 -0
  478. package/types/TUICallService/utils/timer.d.ts +64 -0
  479. package/types/TUICallService/utils/validate/avoidRepeatedCall.d.ts +10 -0
  480. package/types/TUICallService/utils/validate/index.d.ts +2 -0
  481. package/types/adapter-vue.d.ts +4 -0
  482. package/types/index.d.ts +11 -0
  483. package/types/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,165 @@
1
+ <template>
2
+ <Portal id="source" :disabled="!isFloatWindow" source="#source" to="body">
3
+ <FloatWindow>
4
+ <div :class="singleMediaContainerClassName">
5
+ <ToggleWindow
6
+ :big-window="largeViewName"
7
+ :show-small-window="showSmallWindow"
8
+ @toggle="handleToggle"
9
+ >
10
+ <ToggleWindowItem :value="ViewName.LOCAL" :key="ViewName.LOCAL">
11
+ <Pusher
12
+ :domId="localUserInfoExcludeVolume.domId"
13
+ :show-audio-stream="!localUserInfoExcludeVolume.isVideoAvailable"
14
+ >
15
+ <template v-slot:audio-stream>
16
+ <AudioStream
17
+ :userId="localUserInfoExcludeVolume.userId"
18
+ :username="localUserInfoExcludeVolume.displayUserInfo"
19
+ :avatar="localUserInfoExcludeVolume.avatar"
20
+ :is-video-available="localUserInfoExcludeVolume.isVideoAvailable"
21
+ :is-small-window="!(largeViewName === ViewName.LOCAL)"
22
+ :is-muted="!localUserInfoExcludeVolume.isAudioAvailable"
23
+ :volume="volumeMap && volumeMap[localUserInfoExcludeVolume.domId]"
24
+ />
25
+ </template>
26
+ <template v-slot:stream-info>
27
+ <TKStreamInfo
28
+ v-if="callType === CallMediaType.VIDEO"
29
+ :nick-name="localUserInfoExcludeVolume.displayUserInfo"
30
+ :is-self="true"
31
+ :is-muted="!localUserInfoExcludeVolume.isAudioAvailable"
32
+ :volume="volumeMap && volumeMap[localUserInfoExcludeVolume.domId]"
33
+ />
34
+ </template>
35
+ </Pusher>
36
+ </ToggleWindowItem>
37
+ <ToggleWindowItem :value="ViewName.REMOTE" :key="ViewName.REMOTE">
38
+ <Player
39
+ :dom-id="playerDomId"
40
+ :show-audio-stream="!isPusherVideoAvailable"
41
+ >
42
+ <template v-slot:audio-stream>
43
+ <AudioStream
44
+ :userId="remoteUserListExcludeVolume[0] && remoteUserListExcludeVolume[0].userId"
45
+ :username="remoteUserListExcludeVolume[0] && remoteUserListExcludeVolume[0].displayUserInfo"
46
+ :avatar="remoteUserListExcludeVolume[0] && remoteUserListExcludeVolume[0].avatar"
47
+ :is-video-available="isPusherVideoAvailable"
48
+ :is-small-window="!(largeViewName === ViewName.REMOTE)"
49
+ :is-muted="remoteUserListExcludeVolume[0] && !remoteUserListExcludeVolume[0].isAudioAvailable"
50
+ :volume="remoteStreamVolume"
51
+ />
52
+ </template>
53
+ <template v-slot:stream-info>
54
+ <TKStreamInfo
55
+ v-if="callType === CallMediaType.VIDEO"
56
+ :nick-name="remoteUserListExcludeVolume[0] && remoteUserListExcludeVolume[0].displayUserInfo"
57
+ :is-muted="remoteUserListExcludeVolume[0] && !remoteUserListExcludeVolume[0].isAudioAvailable"
58
+ :volume="remoteStreamVolume"
59
+ />
60
+ </template>
61
+ </Player>
62
+ </ToggleWindowItem>
63
+ </ToggleWindow>
64
+ </div>
65
+ </FloatWindow>
66
+ </Portal>
67
+ </template>
68
+
69
+ <script lang="ts">
70
+ export default {
71
+ options: {
72
+ virtualHost: true,
73
+ },
74
+ };
75
+ </script>
76
+
77
+ <script setup lang="ts">
78
+ import { ref, watch, toRefs, computed } from '../../../../adapter-vue';
79
+ import { CallMediaType, CallStatus, TUIGlobal } from '../../../../TUICallService';
80
+ import ToggleWindow from '../../base/ToggleWindow/ToggleWindow.vue';
81
+ import Portal from '../../base/Portal/Portal.vue';
82
+ import ToggleWindowItem from '../../base/ToggleWindow/ToggleWindowItem/ToggleWindowItem.vue';
83
+ import TKStreamInfo from '../../common/TKStreamInfo/TKStreamInfo.vue';
84
+ import Pusher from '../../common/Pusher/Pusher.vue';
85
+ import Player from '../../common/Player/Player.vue';
86
+ import AudioStream from '../../common/AudioStream/AudioStream.vue';
87
+ import FloatWindow from '../../common/FloatWindow/FloatWindow.vue';
88
+ import {
89
+ useUserInfoExcludeVolumeContext,
90
+ useCallInfoContext,
91
+ useGetVolumeMap,
92
+ usePlayer,
93
+ useFloatWindowContext,
94
+ } from '../../../hooks';
95
+ import { useGetLargeViewName } from '../hooks/useGetLargeViewName';
96
+ import { classNames } from '../../base/util';
97
+ import { ViewName } from '../../../../TUICallService/const/index';
98
+
99
+ const largeViewName = useGetLargeViewName();
100
+ const showSmallWindow = ref(true);
101
+ const { isFloatWindow } = toRefs(useFloatWindowContext());
102
+ function toggle() {
103
+ isFloatWindow.value = !isFloatWindow.value;
104
+ }
105
+ const { localUserInfoExcludeVolume, remoteUserListExcludeVolume } = toRefs(useUserInfoExcludeVolumeContext());
106
+ const volumeMap = useGetVolumeMap();
107
+ const { callType, callStatus } = toRefs(useCallInfoContext());
108
+ const wxPlayer = usePlayer();
109
+
110
+ const isPusherVideoAvailable = computed(() => remoteUserListExcludeVolume.value?.[0]?.isVideoAvailable);
111
+
112
+ const playerDomId = computed(() => remoteUserListExcludeVolume.value?.[0]?.domId);
113
+ const remoteStreamVolume = computed(() => volumeMap.value?.[remoteUserListExcludeVolume.value?.[0]?.domId]);
114
+
115
+ watch([callType, callStatus], () => {
116
+ if (callType.value === CallMediaType.AUDIO || callStatus.value === CallStatus.CALLING) {
117
+ showSmallWindow.value = false;
118
+ } else {
119
+ showSmallWindow.value = true;
120
+ }
121
+ }, {
122
+ immediate: true,
123
+ });
124
+
125
+ const singleMediaContainerClassName = computed(() => classNames([
126
+ 'singlecall-media-container',
127
+ {
128
+ mobile: !TUIGlobal.isPC,
129
+ pc: TUIGlobal.isPC,
130
+ float: isFloatWindow.value,
131
+ }
132
+ ]));
133
+
134
+ function handleToggle(value) {
135
+ largeViewName.value = value;
136
+ }
137
+ </script>
138
+
139
+ <style lang="scss" scoped>
140
+ .singlecall-media-container {
141
+ width: 100%;
142
+ height: 100%;
143
+ position: absolute;
144
+ z-index: 0;
145
+ -webkit-user-select: none;
146
+ -moz-user-select: none;
147
+ -ms-user-select: none;
148
+ user-select: none;
149
+
150
+ &.float {
151
+ position: relative;
152
+ }
153
+
154
+ &.pc {
155
+ border-radius: 12px;
156
+ overflow: hidden;
157
+ }
158
+ }
159
+ .roggle-btn {
160
+ position: absolute;
161
+ left: 100px;
162
+ z-index: 100;
163
+ top: 0;
164
+ }
165
+ </style>
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <div class="singlecall-container">
3
+ <TopBar />
4
+ <Waiting v-if="callStatus === CallStatus.CALLING" />
5
+ <MediaContainer />
6
+ <Tip />
7
+ <ButtonPanel />
8
+ </div>
9
+ </template>
10
+
11
+ <script setup lang="ts">
12
+ import { toRefs } from '../../../adapter-vue';
13
+ import { CallStatus } from '../../../TUICallService';
14
+ import TopBar from '../common/TopBar/TopBar.vue';
15
+ import Waiting from '../common/Waiting/Waiting.vue';
16
+ import MediaContainer from './MediaContainer/MediaContainer.vue';
17
+ import Tip from '../common/Tip/Tip.vue';
18
+ import ButtonPanel from '../common/ButtonPanel/ButtonPanel.vue';
19
+ import { useCallInfoContext } from '../../hooks';
20
+
21
+ const { callStatus } = toRefs(useCallInfoContext());
22
+ </script>
23
+
24
+ <style lang="scss" scoped>
25
+ .singlecall-container {
26
+ height: 100%;
27
+ }
28
+ </style>
@@ -0,0 +1,32 @@
1
+ import { CallStatus, LayoutMode, ViewName } from '../../../../TUICallService/const';
2
+ import { ref, watch, toRefs } from '../../../../adapter-vue';
3
+ import { useCallInfoContext, useCustomUI, useUserInfoExcludeVolumeContext } from '../../../hooks';
4
+
5
+ export function useGetLargeViewName() {
6
+ const config = useCustomUI();
7
+ const { callStatus } = toRefs(useCallInfoContext());
8
+ const largeViewName = ref(ViewName.LOCAL);
9
+ const { remoteUserListExcludeVolume } = toRefs(useUserInfoExcludeVolumeContext());
10
+
11
+ watch([remoteUserListExcludeVolume, config, callStatus], () => {
12
+ if (callStatus.value === CallStatus.CALLING) {
13
+ return;
14
+ }
15
+
16
+ const c2cLayoutModes = [LayoutMode.RemoteInLargeView, LayoutMode.LocalInLargeView];
17
+ const customLayoutMode = config.value?.layoutMode;
18
+ if (c2cLayoutModes.includes(customLayoutMode)) {
19
+ // @ts-ignore
20
+ largeViewName.value = config.value?.layoutMode;
21
+ return;
22
+ }
23
+
24
+ if (remoteUserListExcludeVolume.value?.[0]?.isEnter) {
25
+ largeViewName.value = ViewName.REMOTE;
26
+ }
27
+ }, {
28
+ immediate: true,
29
+ });
30
+
31
+ return largeViewName;
32
+ }
@@ -0,0 +1,38 @@
1
+ const Fit = ['fill', 'contain', 'cover'] as const;
2
+ const Shape = ['circle', 'square'] as const;
3
+
4
+ export const AvatarProps = {
5
+ icon: {
6
+ type: String,
7
+ },
8
+ size: {
9
+ type: [Number, String],
10
+ default: 100,
11
+ },
12
+ shape: {
13
+ type: String,
14
+ values: Shape,
15
+ default: 'square',
16
+ },
17
+ src: {
18
+ type: String,
19
+ },
20
+ defaultSrc: {
21
+ type: String,
22
+ },
23
+ text: {
24
+ type: String,
25
+ },
26
+ fit: {
27
+ type: String,
28
+ values: Fit,
29
+ default: 'cover',
30
+ },
31
+ customClass: {
32
+ type: String,
33
+ },
34
+ } as const;
35
+
36
+ export const avatarEmits = {
37
+ error: (evt) => evt,
38
+ };
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <div :class="classname" :style="[avatarStyle]">
3
+ <TKImage v-if="avatarSrc" :fit="fit" :width="width" :height="height" :src="avatarSrc" @error="handleError" />
4
+ <slot v-else />
5
+ </div>
6
+ </template>
7
+
8
+ <script lang="ts">
9
+ export default {
10
+ options: {
11
+ virtualHost: true,
12
+ }
13
+ }
14
+ </script>
15
+
16
+ <script setup lang="ts">
17
+ import { computed, ref, watch } from '../../../../adapter-vue';
18
+ import TKImage from '../TKImage/TKImage.vue';
19
+ import { classNames } from '../util';
20
+ import { AvatarProps } from './Avatar';
21
+ import { PREFIX } from '../constants/index';
22
+
23
+ const props = defineProps(AvatarProps);
24
+
25
+ const avatarSrc = ref('');
26
+
27
+ watch(() => props.src, () => {
28
+ avatarSrc.value = props.src;
29
+ }, {
30
+ immediate: true,
31
+ });
32
+
33
+ const classname = computed(() => classNames([
34
+ `${PREFIX}-avatar`,
35
+ `${PREFIX}-avatar--${props.shape}`,
36
+ `${PREFIX}-avatar--${props.size}`,
37
+ props.customClass,
38
+ ]));
39
+ const width = computed(() => typeof props.size === 'number' ? `${props.size}px` : props.size);
40
+ const height = computed(() => typeof props.size === 'number' ? `${props.size}px` : props.size);
41
+ const avatarStyle = computed(() => ({ width: width.value, height: height.value }));
42
+
43
+ function handleError(e) {
44
+ console.error(e);
45
+ if (props.defaultSrc) {
46
+ avatarSrc.value = props.defaultSrc;
47
+ }
48
+ }
49
+ </script>
50
+
51
+ <style lang="scss">
52
+ @import './style/Avatar.scss';
53
+ </style>
@@ -0,0 +1,40 @@
1
+ @import '../../styles/var.scss';
2
+ @import '../../styles/common.scss';
3
+
4
+ $--tk-avatar-text-color: $--tk-color-white;
5
+ $--tk-avatar-bg-color: $--tk-text-color-disabled;
6
+ $--tk-avatar-text-size: 14px;
7
+ $--tk-avatar-icon-size: 18px;
8
+ $--tk-avatar-border-radius: $--tk-border-radius-base;
9
+ $--tk-avatar-size-large: 56px;
10
+ $--tk-avatar-size-small: 24px;
11
+ $--tk-avatar-size: 40px;
12
+
13
+ .#{$PREFIX}-avatar {
14
+ display: inline-flex;
15
+ justify-content: center;
16
+ align-items: center;
17
+ box-sizing: border-box;
18
+ text-align: center;
19
+ overflow: hidden;
20
+ color: $--tk-avatar-text-color;
21
+ background: $--tk-avatar-bg-color;
22
+ width: $--tk-avatar-size;
23
+ height: $--tk-avatar-size;
24
+ font-size: $--tk-avatar-text-size;
25
+
26
+ &.#{$PREFIX}-avatar--square {
27
+ border-radius: $--tk-avatar-border-radius;
28
+ }
29
+ &.#{$PREFIX}-avatar--circle {
30
+ border-radius: $--tk-border-radius-circle;
31
+ }
32
+ .#{$PREFIX}-avatar_img {
33
+ width: 100%;
34
+ height: 100%;
35
+ }
36
+ .#{$PREFIX}-avatar_image {
37
+ width: 100%;
38
+ height: 100%;
39
+ }
40
+ }
@@ -0,0 +1,60 @@
1
+ const Size = ['small','middle','large'] as const;
2
+ const Direction = ['row','column'] as const;
3
+ const Shape = ['circle','round'] as const;
4
+
5
+ export const ButtonProps = {
6
+ iconSrc: {
7
+ type: String,
8
+ },
9
+ iconSize: {
10
+ type: Number,
11
+ },
12
+ text: {
13
+ type: String,
14
+ },
15
+ loading: {
16
+ type: Boolean,
17
+ default: false,
18
+ },
19
+ loadingColor: {
20
+ type: String,
21
+ default: '#fff',
22
+ },
23
+ loadingWidth: {
24
+ type: String,
25
+ default: '40px',
26
+ },
27
+ loadingHeight: {
28
+ type: String,
29
+ default: '40px',
30
+ },
31
+ size: {
32
+ type: String,
33
+ values: Size,
34
+ default: 'middle',
35
+ },
36
+ width: {
37
+ type: String,
38
+ },
39
+ height: {
40
+ type: String,
41
+ },
42
+ color: {
43
+ type: String,
44
+ },
45
+ direction: {
46
+ type: String,
47
+ values: Direction,
48
+ default: 'row',
49
+ },
50
+ shape: {
51
+ type: String,
52
+ values: Shape,
53
+ },
54
+ buttonStyle: {
55
+ type: Object,
56
+ },
57
+ buttonTextStyle: {
58
+ type: Object,
59
+ },
60
+ };
@@ -0,0 +1,61 @@
1
+ <template>
2
+ <div :style="[style]" :class="buttonClassName" @click="handleClick">
3
+ <Loading
4
+ v-if="loading"
5
+ :loadingWidth="loadingWidth"
6
+ :loadingHeight="loadingHeight"
7
+ :color="loadingColor"
8
+ />
9
+ <Icon v-if="iconSrc && !loading" :size="iconSize" :src="iconSrc"></Icon>
10
+ <div
11
+ v-if="text"
12
+ :style="[buttonTextStyle]"
13
+ :class="buttonTextClassName"
14
+ >
15
+ {{ text }}
16
+ </div>
17
+ </div>
18
+ </template>
19
+
20
+ <script lang="ts">
21
+ export default {
22
+ options: {
23
+ virtualHost: true,
24
+ },
25
+ };
26
+ </script>
27
+
28
+ <script setup lang="ts">
29
+ import { computed } from '../../../../adapter-vue';
30
+ import Loading from '../Loading/Loading.vue';
31
+ import Icon from '../Icon/Icon.vue';
32
+ import { classNames, IS_PC } from '../util';
33
+ import { ButtonProps } from './Button';
34
+ import { PREFIX } from '../constants/index';
35
+
36
+ const props = defineProps(ButtonProps);
37
+ const buttonTextClassName = `${PREFIX}-button--content`;
38
+ const style = computed(() => ({
39
+ width: props.width,
40
+ height: props.height,
41
+ backgroundColor: props.color,
42
+ flexDirection: props.direction,
43
+ cursor: IS_PC ? 'pointer' : 'auto',
44
+ ...props.buttonStyle,
45
+ }));
46
+
47
+ const buttonClassName = classNames([
48
+ `${PREFIX}-button`,
49
+ {[`${PREFIX}-${props.shape}`]: props.shape},
50
+ `${PREFIX}-button--${props.size}`
51
+ ]);
52
+
53
+ const emit = defineEmits(['click']);
54
+ const handleClick = (event) => {
55
+ !props.loading && emit('click', event);
56
+ };
57
+ </script>
58
+
59
+ <style lang="scss">
60
+ @import './style/Button.scss';
61
+ </style>
@@ -0,0 +1,42 @@
1
+ @import '../../styles/var.scss';
2
+ @import '../../styles/common.scss';
3
+
4
+ $--tk-button-size-default: $--tk-button-size-middle;
5
+
6
+ .#{$PREFIX}-button {
7
+ display: inline-flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+
11
+ &.#{$PREFIX}-button--small {
12
+ height: $--tk-button-size-small;
13
+ }
14
+
15
+ &.#{$PREFIX}-button--middle {
16
+ height: $--tk-button-size-middle;
17
+ }
18
+
19
+ &.#{$PREFIX}-button--large {
20
+ height: $--tk-button-size-large;
21
+ }
22
+
23
+ .#{$PREFIX}-button--content {
24
+ color: $--tk-text-color-regular;
25
+ font-size: $--tk-font-size-base;
26
+ font-weight: $--tk-font-weight-primary;
27
+ }
28
+
29
+ &.#{$PREFIX}-circle {
30
+ &.#{$PREFIX}-button--small {
31
+ width: $--tk-button-size-small;
32
+ }
33
+
34
+ &.#{$PREFIX}-button--default {
35
+ width: $--tk-button-size-default;
36
+ }
37
+
38
+ &.#{$PREFIX}-button--large {
39
+ width: $--tk-button-size-large;
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,26 @@
1
+ const Unit = ['%', 'vw'];
2
+
3
+ export const GridProps = {
4
+ length: {
5
+ type: Number,
6
+ default: 0,
7
+ },
8
+ unit: {
9
+ type: String,
10
+ values: Unit,
11
+ default: '%',
12
+ },
13
+ enableFocus: {
14
+ type: Boolean,
15
+ default: false,
16
+ },
17
+ layout: {
18
+ type: Array,
19
+ },
20
+ focus: {
21
+ type: [String, Number],
22
+ },
23
+ } as const;
24
+
25
+ export const ChangeFocusEmits = ['change', 'toggle'];
26
+ export const GridContextKey = 'GridContextKey';
@@ -0,0 +1,40 @@
1
+ <template>
2
+ <div :style="{ height: '100%'}">
3
+ <slot />
4
+ </div>
5
+ </template>
6
+
7
+ <script lang="ts">
8
+ export default {
9
+ options: {
10
+ virtualHost: true
11
+ }
12
+ }
13
+ </script>
14
+
15
+ <script setup lang="ts">
16
+ import { provide, watch, ref } from '../../../../adapter-vue';
17
+ import { ChangeFocusEmits, GridContextKey, GridProps } from './Grid';
18
+
19
+ const props = defineProps(GridProps);
20
+ const focus = ref(props.focus);
21
+ const layout = ref(props.layout);
22
+ const unit = ref(props.unit);
23
+ const emit = defineEmits(ChangeFocusEmits);
24
+
25
+ function handleFocusChange(value) {
26
+ emit('toggle', value);
27
+ }
28
+
29
+ watch(() => props.focus, () => focus.value = props.focus);
30
+ watch(() => props.layout, () => layout.value = props.layout);
31
+ watch(() => props.unit, () => unit.value = props.unit);
32
+
33
+ provide(GridContextKey, {
34
+ layout,
35
+ enableFocus: props.enableFocus,
36
+ handleFocusChange,
37
+ focus,
38
+ unit,
39
+ });
40
+ </script>
@@ -0,0 +1,81 @@
1
+ <template>
2
+ <div
3
+ v-if="show"
4
+ :class="gridItemClassName"
5
+ :style="[style]"
6
+ @click="handleClick"
7
+ >
8
+ <slot />
9
+ </div>
10
+ </template>
11
+
12
+ <script lang="ts">
13
+ export default {
14
+ options: {
15
+ virtualHost: true
16
+ }
17
+ }
18
+ </script>
19
+
20
+ <script setup lang="ts">
21
+ import { inject, computed, ref, watchEffect, watch, onUnmounted } from '../../../../../adapter-vue';
22
+ import { GridContextKey } from '../Grid';
23
+ import { PREFIX } from '../../constants/index';
24
+ import { IS_PC, IS_H5, classNames, findTarget } from '../../util';
25
+
26
+ const props = defineProps(['index', 'height', 'customStyle']);
27
+ const {
28
+ layout,
29
+ enableFocus,
30
+ handleFocusChange,
31
+ focus,
32
+ unit,
33
+ } = inject(GridContextKey);
34
+
35
+ const colWidth = 100 / 12;
36
+ const rowHeight = colWidth;
37
+ const style = ref({});
38
+ const gridItemClassName = classNames([
39
+ `${PREFIX}-grid-item`,
40
+ {
41
+ pc: IS_PC,
42
+ mobile: !IS_PC,
43
+ h5: IS_H5,
44
+ },
45
+ ]);
46
+
47
+ const handleClick = () => {
48
+ const value = String(props.index) === String(focus.value) ? null : props.index;
49
+ enableFocus && handleFocusChange(value);
50
+ };
51
+
52
+ const show = computed(() => !!findTarget(layout.value, { key: 'i', value: props.index}));
53
+
54
+ watchEffect(() => {
55
+ const target = findTarget(layout.value, { key: 'i', value: props.index});
56
+
57
+ if (!target) return;
58
+
59
+ const { x, y, w, h, customStyle, customProps } = target;
60
+ style.value = {
61
+ width: w * colWidth + unit.value,
62
+ height: props.height || h * rowHeight + unit.value,
63
+ left: x * colWidth + unit.value,
64
+ top: y * rowHeight + unit.value,
65
+ position: 'absolute',
66
+ visibility: customProps?.show === false ? 'hidden' : '',
67
+ ...props.customStyle,
68
+ ...customStyle,
69
+ };
70
+ });
71
+
72
+ onUnmounted(() => {
73
+ if (String(props.index) === String(focus.value)) {
74
+ enableFocus && handleFocusChange(null);
75
+ }
76
+ });
77
+ </script>
78
+
79
+ <style lang="scss">
80
+ @import './style/GridItem.scss';
81
+ </style>
@@ -0,0 +1,13 @@
1
+ @import '../../../styles/common.scss';
2
+ @import '../../../styles/var.scss';
3
+
4
+ .#{$PREFIX}-grid-item {
5
+ display: flex;
6
+ justify-content: center;
7
+
8
+ &.h5 {
9
+ transition-property: width,height,left,top;
10
+ transition-duration: 0.3s;
11
+ transition-timing-function: ease-in;
12
+ }
13
+ }