cnhis-design-vue 3.2.7-beta.3 → 3.2.7-beta.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. package/README.md +87 -87
  2. package/es/components/base-search/index.d.ts +2 -0
  3. package/es/components/base-search/src/index.vue.d.ts +2 -0
  4. package/es/components/button-print/index.d.ts +27 -0
  5. package/es/components/button-print/src/ButtonPrint.vue.d.ts +27 -0
  6. package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
  7. package/es/components/button-print/src/components/NewPrintComponent.vue.d.ts +1 -0
  8. package/es/components/button-print/src/components/NewPrintComponent.vue2.js +1 -1
  9. package/es/components/button-print/src/components/OldPrintComponent.vue.d.ts +9 -0
  10. package/es/components/button-print/src/components/OldPrintComponent.vue2.js +1 -1
  11. package/es/components/button-print/style/index.css +1 -1
  12. package/es/components/callback/src/components/render/popupMaps.d.ts +27 -0
  13. package/es/components/classification/index.d.ts +60 -5
  14. package/es/components/classification/src/components/search-filter/index.vue.d.ts +60 -5
  15. package/es/components/classification/src/components/set-classification/index.vue.d.ts +60 -5
  16. package/es/components/classification/src/index.vue.d.ts +60 -5
  17. package/es/components/date-picker/index.d.ts +13 -0
  18. package/es/components/date-picker/src/DatePicker.vue.d.ts +13 -0
  19. package/es/components/date-picker/src/DatePicker.vue2.js +1 -1
  20. package/es/components/fabric-chart/src/constants/index.d.ts +3 -1
  21. package/es/components/fabric-chart/src/constants/index.js +1 -1
  22. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
  23. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.d.ts +8 -3
  24. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
  25. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.d.ts +9 -6
  26. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.js +1 -1
  27. package/es/components/fabric-chart/src/hooks/electrocardiogram/useMeasureInstrument.js +1 -1
  28. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcess.js +1 -1
  29. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcessChart.d.ts +0 -2
  30. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcessChart.js +1 -1
  31. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.d.ts +8 -3
  32. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  33. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  34. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  35. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.d.ts +8 -3
  36. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
  37. package/es/components/fabric-chart/src/hooks/useScaleColumn.d.ts +1 -1
  38. package/es/components/fabric-chart/src/hooks/useScaleColumn.js +1 -1
  39. package/es/components/fabric-chart/src/interface.d.ts +11 -1
  40. package/es/components/field-set/src/FieldColor.vue.d.ts +26 -0
  41. package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
  42. package/es/components/field-set/src/components/condition.vue.d.ts +13 -0
  43. package/es/components/field-set/src/components/edit-dialog.vue.d.ts +26 -0
  44. package/es/components/field-set/src/components/edit-filter.vue.d.ts +13 -0
  45. package/es/components/form-config/index.d.ts +40 -3
  46. package/es/components/form-config/src/FormConfig.vue.d.ts +40 -3
  47. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +14 -0
  48. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +23 -3
  49. package/es/components/form-config/src/components/FormConfigEdit.vue2.js +1 -1
  50. package/es/components/form-render/index.d.ts +14 -0
  51. package/es/components/form-render/src/FormRender.vue.d.ts +14 -0
  52. package/es/components/form-render/src/FormRender.vue2.js +1 -1
  53. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +14 -0
  54. package/es/components/form-render/src/components/renderer/formItem.d.ts +9 -0
  55. package/es/components/form-render/src/components/renderer/formItem.js +1 -1
  56. package/es/components/form-render/src/components/renderer/lineBar/FormCollapse.vue.d.ts +1 -0
  57. package/es/components/form-render/src/components/renderer/lineBar/index.d.ts +1 -0
  58. package/es/components/form-render/src/components/tooltipMessage.vue2.js +1 -1
  59. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  60. package/es/components/form-render/src/hooks/useFieldNormalize.d.ts +2 -0
  61. package/es/components/form-render/src/hooks/useFormValidator.js +1 -1
  62. package/es/components/form-render/src/types/fieldItem.d.ts +3 -1
  63. package/es/components/form-render/src/types/index.d.ts +2 -1
  64. package/es/components/form-render/src/utils/business.js +1 -1
  65. package/es/components/form-render/src/utils/schema.d.ts +1 -1
  66. package/es/components/form-render/src/utils/schema.js +1 -1
  67. package/es/components/iho-chat/index.d.ts +300 -75
  68. package/es/components/iho-chat/src/Index.vue.d.ts +300 -75
  69. package/es/components/iho-chat/src/Index.vue2.js +1 -1
  70. package/es/components/iho-chat/src/components/ChatAdd.vue.d.ts +35 -13
  71. package/es/components/iho-chat/src/components/ChatAdd.vue2.js +1 -1
  72. package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +41 -14
  73. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
  74. package/es/components/iho-chat/src/components/ChatHeader.vue.d.ts +50 -14
  75. package/es/components/iho-chat/src/components/ChatHeader.vue2.js +1 -1
  76. package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +24 -4
  77. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  78. package/es/components/iho-chat/src/components/ChatRecord.vue.d.ts +13 -0
  79. package/es/components/iho-chat/src/components/ChatRecord.vue2.js +1 -1
  80. package/es/components/iho-chat/src/components/ChatSearch.vue.d.ts +60 -11
  81. package/es/components/iho-chat/src/components/ChatSearch.vue2.js +1 -1
  82. package/es/components/iho-chat/src/components/ChatSet.vue2.js +1 -1
  83. package/es/components/iho-chat/src/components/ContextMenu.d.ts +15 -2
  84. package/es/components/iho-chat/src/components/ContextMenu.js +1 -1
  85. package/es/components/iho-chat/src/components/MultipleVideo.vue.d.ts +62 -24
  86. package/es/components/iho-chat/src/components/MultipleVideo.vue2.js +1 -1
  87. package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
  88. package/es/components/iho-chat/src/components/SiderList.vue.d.ts +1 -0
  89. package/es/components/iho-chat/src/components/SiderList.vue2.js +1 -1
  90. package/es/components/iho-chat/src/components/Video.vue.d.ts +14 -2
  91. package/es/components/iho-chat/src/components/Video.vue2.js +1 -1
  92. package/es/components/iho-chat/src/hooks/useScrollLoading.d.ts +1 -1
  93. package/es/components/iho-chat/src/hooks/useScrollLoading.js +1 -1
  94. package/es/components/iho-chat/src/hooks/useSearchUserList.d.ts +11 -0
  95. package/es/components/iho-chat/src/hooks/useSearchUserList.js +1 -0
  96. package/es/components/iho-chat/src/hooks/useSession.js +1 -1
  97. package/es/components/iho-chat/src/hooks/useState.js +1 -1
  98. package/es/components/iho-chat/src/hooks/useVideo.d.ts +11 -0
  99. package/es/components/iho-chat/src/hooks/useVideo.js +1 -1
  100. package/es/components/iho-chat/src/types/index.d.ts +0 -1
  101. package/es/components/iho-chat/src/utils/index.js +1 -1
  102. package/es/components/iho-chat/style/index.css +1 -1
  103. package/es/components/iho-table/index.d.ts +13 -0
  104. package/es/components/iho-table/src/IhoTable.vue.d.ts +13 -0
  105. package/es/components/iho-table/src/IhoTable.vue2.js +1 -1
  106. package/es/components/iho-table/src/plugins/filterDaterangeRenderPlugin/filter.vue.d.ts +13 -0
  107. package/es/components/iho-table/src/plugins/headerPlugin/index.d.ts +1 -0
  108. package/es/components/iho-table/src/plugins/headerPlugin/index.js +1 -0
  109. package/es/components/iho-table/src/plugins/headerPlugin/tooltipMessage.vue.d.ts +13 -0
  110. package/es/components/iho-table/src/plugins/headerPlugin/tooltipMessage.vue.js +1 -0
  111. package/es/components/iho-table/src/plugins/headerPlugin/tooltipMessage.vue2.js +1 -0
  112. package/es/components/iho-table/src/plugins/index.js +1 -1
  113. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/editDate.vue.d.ts +13 -0
  114. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue.d.ts +20 -2
  115. package/es/components/iho-table/src/types/index.d.ts +3 -0
  116. package/es/components/iho-table/src/utils/index.d.ts +0 -1
  117. package/es/components/iho-table/src/utils/index.js +1 -1
  118. package/es/components/index.css +1 -1
  119. package/es/components/info-header/index.d.ts +34 -0
  120. package/es/components/info-header/src/InfoHeader.vue.d.ts +34 -0
  121. package/es/components/info-header/src/components/infoDescription/DescriptionItem.vue.d.ts +2 -0
  122. package/es/components/info-header/src/components/infoDescription/DescriptionItem.vue2.js +1 -1
  123. package/es/components/info-header/src/components/infoDescription/DescriptionList.vue.d.ts +2 -0
  124. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +16 -0
  125. package/es/components/info-header/src/components/infoDescription/index.vue2.js +1 -1
  126. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +14 -0
  127. package/es/components/quick-search/src/index.vue2.js +1 -1
  128. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  129. package/es/components/shortcut-setter/index.d.ts +16 -1
  130. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +16 -1
  131. package/es/components/steps-wheel/index.d.ts +1 -1
  132. package/es/components/steps-wheel/src/StepsWheel.vue.d.ts +1 -1
  133. package/es/components/table-filter/src/components/bi-filter/ValueCfg.vue.d.ts +13 -0
  134. package/es/components/table-filter/src/components/bi-filter/components/Date.vue.d.ts +13 -0
  135. package/es/components/table-filter/src/components/bi-filter/components/index.d.ts +13 -0
  136. package/es/components/table-filter/src/components/bi-filter/index.vue.d.ts +13 -0
  137. package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +47 -5
  138. package/es/components/table-filter/src/components/classify-filter/components/Date.vue.d.ts +13 -0
  139. package/es/components/table-filter/src/components/classify-filter/components/DateRange.vue.d.ts +13 -0
  140. package/es/components/table-filter/src/components/classify-filter/components/SelectDynamic.vue.d.ts +37 -19
  141. package/es/components/table-filter/src/components/classify-filter/components/SelectDynamic.vue2.js +1 -1
  142. package/es/components/table-filter/src/components/classify-filter/components/index.d.ts +47 -5
  143. package/es/components/table-filter/src/components/classify-filter/hooks/useFilterConditions.js +1 -1
  144. package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +47 -5
  145. package/es/components/table-filter/src/components/render-widget/components/DateInner.vue.d.ts +13 -0
  146. package/es/components/table-filter/src/components/render-widget/components/DateOut.vue.d.ts +13 -0
  147. package/es/components/table-filter/src/components/render-widget/components/DateRangeInner.vue.d.ts +13 -0
  148. package/es/components/table-filter/src/components/render-widget/components/DateRangeOut.vue.d.ts +13 -0
  149. package/es/components/table-filter/src/components/render-widget/components/SelectDynamic.vue.d.ts +33 -18
  150. package/es/components/table-filter/src/components/render-widget/components/SelectDynamic.vue2.js +1 -1
  151. package/es/components/table-filter/src/components/render-widget/components/SelectDynamicOption/index.vue.d.ts +13 -0
  152. package/es/components/table-filter/src/components/render-widget/components/SelectDynamicOption/index.vue2.js +1 -1
  153. package/es/components/table-filter/src/components/render-widget/components/index.d.ts +69 -4
  154. package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.d.ts +69 -4
  155. package/es/components/table-filter/src/tool/transformData.js +1 -1
  156. package/es/components/table-filter/src/types/index.d.ts +3 -0
  157. package/es/components/time-line/index.d.ts +4 -4
  158. package/es/components/time-line/src/TimeLine.vue.d.ts +1 -1
  159. package/es/components/time-line/src/TimeLine.vue2.js +1 -1
  160. package/es/components/time-picker/index.d.ts +20 -2
  161. package/es/components/time-picker/src/TimePicker.vue.d.ts +21 -2
  162. package/es/components/time-picker/src/TimePicker.vue2.js +1 -1
  163. package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
  164. package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
  165. package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
  166. package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
  167. package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
  168. package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
  169. package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
  170. package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
  171. package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
  172. package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
  173. package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
  174. package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
  175. package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
  176. package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
  177. package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
  178. package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
  179. package/es/shared/assets/img/failure.png.js +1 -1
  180. package/es/shared/assets/img/no-permission.png.js +1 -1
  181. package/es/shared/assets/img/nodata.png.js +1 -1
  182. package/es/shared/assets/img/notfound.png.js +1 -1
  183. package/es/shared/assets/img/qr.png.js +1 -1
  184. package/es/shared/assets/img/success.png.js +1 -1
  185. package/es/shared/assets/img/table_style_2.png.js +1 -1
  186. package/es/shared/assets/img/video.png.js +1 -1
  187. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  188. package/es/shared/assets/img/xb_big.png.js +1 -1
  189. package/es/shared/assets/img/xb_small.png.js +1 -1
  190. package/es/shared/package.json.js +1 -1
  191. package/es/shared/utils/business.js +1 -1
  192. package/package.json +2 -2
  193. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  194. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  195. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  196. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  197. package/es/components/iho-table/src/plugins/headerPlugin.d.ts +0 -1
  198. package/es/components/iho-table/src/plugins/headerPlugin.js +0 -1
  199. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  200. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  201. package/es/shared/utils/tapable/index.d.ts +0 -139
@@ -20,6 +20,20 @@ declare const _default: import("vue").DefineComponent<{}, {
20
20
  timer: any;
21
21
  seconds: number;
22
22
  };
23
+ installEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: {
24
+ handleError: import("../../../../shared/types").AnyFn;
25
+ handleRemoteUserEnter: import("../../../../shared/types").AnyFn;
26
+ handleRemoteAudioAvailable: import("../../../../shared/types").AnyFn;
27
+ handleRemoteUserExit: import("../../../../shared/types").AnyFn;
28
+ handleRemoteVideoAvailable: import("../../../../shared/types").AnyFn;
29
+ }) => void;
30
+ uninstallEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: {
31
+ handleError: import("../../../../shared/types").AnyFn;
32
+ handleRemoteUserEnter: import("../../../../shared/types").AnyFn;
33
+ handleRemoteAudioAvailable: import("../../../../shared/types").AnyFn;
34
+ handleRemoteUserExit: import("../../../../shared/types").AnyFn;
35
+ handleRemoteVideoAvailable: import("../../../../shared/types").AnyFn;
36
+ }) => void;
23
37
  videoRef: import("vue").Ref<any>;
24
38
  selfVideoRef: import("vue").Ref<any>;
25
39
  isConnect: import("vue").Ref<boolean>;
@@ -36,8 +50,6 @@ declare const _default: import("vue").DefineComponent<{}, {
36
50
  handleEnter: () => Promise<void>;
37
51
  handleFinish: () => void;
38
52
  handleExit: () => Promise<void>;
39
- installEventHandlers: () => void;
40
- uninstallEventHandlers: () => void;
41
53
  handleRemoteVideoAvailable: (event: any) => Promise<void>;
42
54
  handleRemoteAudioAvailable: (event: any) => void;
43
55
  handleRemoteUserEnter: () => void;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,computed as n,watch as s,openBlock as t,createElementBlock as r,withDirectives as a,createElementVNode as i,vShow as c,createVNode as l,unref as u,toDisplayString as d,Fragment as v,normalizeClass as E,withCtx as m}from"vue";import{NAvatar as f,NButton as p,NIcon as I}from"naive-ui";import{Mic as T,MicOffCircle as V,Call as A}from"@vicons/ionicons5";import"lodash-es";import"date-fns";import{AV_STATUS as R,CHAT_TYPE as g}from"../constants/index.js";import"../utils/emoji.js";import"@vueuse/core";import{avFinishApi as _}from"../api/index.js";import{useVideo as M}from"../hooks/useVideo.js";import y from"trtc-sdk-v5";const N={class:"video-wrapper"},S={class:"user"},w={class:"name"},O={class:"tip"},k={class:"opt-btn"},L={class:"btn"},h=i("span",null,"静音",-1),D=i("span",null,"拒接",-1),C={class:"btn"},b=i("span",null,"挂断",-1),x=i("span",null,"接听",-1);var U=e({__name:"Video",setup(e){const{sendMessage:U,state:j,trtc:z,timing:H,voiceOpen:B,isAudio:F,isCall:X,startTimer:G,resetTimer:J,toggleAudio:P,messageTypeText:$,time:q}=M(),K=o(),Q=o(),W=o(!1);let Y=null;const Z=n((()=>{var e,o,n;return X.value?{avatar:j.currentSessionItem.avatar,name:j.currentSessionItem.name,userId:j.currentSessionItem.receiver}:{avatar:null==(e=j.currentAVMsg.currentMsg)?void 0:e.senderAvatar,name:null==(o=j.currentAVMsg.currentMsg)?void 0:o.senderName,userId:null==(n=j.currentAVMsg.currentMsg)?void 0:n.sender}})),ee=n((()=>W.value?F.value?H.value:"":X.value?"正在呼叫...":`邀请你${$.value}问诊...`)),oe=n((()=>{var e,o;return null==(o=null==(e=j.currentAVMsg.currentMsg)?void 0:e.content)?void 0:o.avStatus}));async function ne(e=R.FINISHED){U({chatType:g.SINGLE,content:{msg:e===R.FINISHED?""+q.seconds:"s",chatMessageType:j.currentAVMsg.chatMessageType,avStatus:e},receiver:Z.value.userId}),await _({recordId:j.currentAVMsg.currentMsg.id,status:e,duration:e===R.FINISHED?q.seconds:0})}async function se(){const e=await y.isSupported();if(!e.result||!e.detail.isH264EncodeSupported||!e.detail.isH264DecodeSupported)return console.log("checkResult :>> ",e),void(j.showVideo=!1);try{if(await z.enterRoom({strRoomId:j.currentAVMsg.strRoomId,sdkAppId:parseInt(j.userInfo.sdkAppID),userId:j.userInfo.id,userSig:j.userInfo.userSig}),X.value||(W.value=!0,G()),function(){if(z.on(y.EVENT.ERROR,ue),z.on(y.EVENT.REMOTE_USER_ENTER,ce),z.on(y.EVENT.REMOTE_AUDIO_AVAILABLE,ie),z.on(y.EVENT.REMOTE_USER_EXIT,le),F.value)return;z.on(y.EVENT.REMOTE_VIDEO_AVAILABLE,ae)}(),await z.startLocalAudio(),F.value)return;await z.startLocalVideo({view:Q.value})}catch(e){console.log("error :>> ",e),j.showVideo=!1}}function te(){X.value&&!W.value?ne(R.CANCELED):ne()}async function re(){try{if(j.showVideo=!1,function(){if(z.off(y.EVENT.ERROR,ue),z.off(y.EVENT.REMOTE_USER_ENTER,ce),z.off(y.EVENT.REMOTE_AUDIO_AVAILABLE,ie),z.off(y.EVENT.REMOTE_USER_EXIT,le),F.value)return;z.off(y.EVENT.REMOTE_VIDEO_AVAILABLE,ae)}(),await z.exitRoom(),await z.stopLocalAudio(),F.value)return;await z.stopLocalVideo()}catch(e){console.log("error :>> ",e)}}async function ae(e){const{userId:o,streamType:n}=e;try{await z.startRemoteVideo({userId:o,streamType:n,view:K.value})}catch(e){console.log("error :>> ",e)}}function ie(e){}function ce(){W.value=!0,G()}function le(e){console.log("event :>> 对方已挂断",e),re()}function ue(e){console.log("error :>> ",e),j.showVideo=!1}return s((()=>oe.value),(e=>{j.showVideo&&(e===R.IN_CALL?async function(){X.value?se():(Y&&clearTimeout(Y),Y=setTimeout((async()=>{W.value||ne(R.NO_RESPONSE)}),6e4))}():re())}),{immediate:!0}),(e,o)=>(t(),r("div",N,[a(i("div",{class:"video-box",ref_key:"videoRef",ref:K},null,512),[[c,W.value]]),a(i("div",{class:"video-box--self",ref_key:"selfVideoRef",ref:Q},null,512),[[c,W.value]]),a(i("div",S,[l(u(f),{size:58,round:"",src:u(Z).avatar},null,8,["src"]),i("span",w,d(u(Z).name),1),i("span",O,d(u(ee)),1)],512),[[c,u(F)||!W.value]]),i("div",k,[i("div",L,[u(X)&&!W.value||W.value?(t(),r(v,{key:0},[l(u(p),{circle:"",onClick:u(P),class:E({bordered:u(B)})},{icon:m((()=>[l(u(I),{size:"30",color:u(B)?"#fff":"#626262",component:u(B)?u(T):u(V)},null,8,["color","component"])])),_:1},8,["onClick","class"]),h],64)):(t(),r(v,{key:1},[l(u(p),{circle:"",color:"#f17568",class:"btn--rotate",onClick:o[0]||(o[0]=()=>ne(u(R).REJECTED))},{icon:m((()=>[l(u(I),{size:"30",component:u(A)},null,8,["component"])])),_:1}),D],64))]),i("div",C,[u(X)&&!W.value||W.value?(t(),r(v,{key:0},[l(u(p),{circle:"",color:"#f17568",class:"btn--rotate",onClick:te},{icon:m((()=>[l(u(I),{size:"30",component:u(A)},null,8,["component"])])),_:1}),b],64)):(t(),r(v,{key:1},[l(u(p),{circle:"",color:"#2ac98b",onClick:se},{icon:m((()=>[l(u(I),{size:"30",component:u(A)},null,8,["component"])])),_:1}),x],64))])])]))}});export{U as default};
1
+ import{defineComponent as e,ref as o,computed as n,watch as t,onBeforeUnmount as s,openBlock as r,createElementBlock as a,withDirectives as l,createElementVNode as i,vShow as c,createVNode as u,unref as d,toDisplayString as v,Fragment as m,normalizeClass as p,withCtx as f}from"vue";import{NAvatar as g,NButton as I,NIcon as h}from"naive-ui";import{Mic as A,MicOffCircle as y,Call as E}from"@vicons/ionicons5";import"lodash-es";import"date-fns";import{AV_STATUS as V,CHAT_TYPE as R}from"../constants/index.js";import"../utils/emoji.js";import"@vueuse/core";import{avFinishApi as w}from"../api/index.js";import{useVideo as k}from"../hooks/useVideo.js";import S from"trtc-sdk-v5";const M={class:"video-wrapper"},b={class:"user"},T={class:"name"},C={class:"tip"},_={class:"opt-btn"},x={class:"btn"},N=i("span",null,"静音",-1),L=i("span",null,"拒接",-1),D={class:"btn"},H=i("span",null,"挂断",-1),j=i("span",null,"接听",-1);var z=e({__name:"Video",setup(e){const{sendMessage:z,state:U,trtc:F,timing:O,voiceOpen:G,isAudio:J,isCall:P,startTimer:$,resetTimer:q,toggleAudio:B,messageTypeText:K,time:Q,installEventHandlers:W,uninstallEventHandlers:X}=k(),Y=o(),Z=o(),ee=o(!1);let oe=null;const ne=n((()=>{var e,o,n;return P.value?{avatar:U.currentSessionItem.avatar,name:U.currentSessionItem.name,userId:U.currentSessionItem.receiver}:{avatar:null==(e=U.currentAVMsg.currentMsg)?void 0:e.senderAvatar,name:null==(o=U.currentAVMsg.currentMsg)?void 0:o.senderName,userId:null==(n=U.currentAVMsg.currentMsg)?void 0:n.sender}})),te=n((()=>ee.value?J.value?O.value:"":P.value?"正在呼叫...":`邀请你${K.value}问诊...`)),se=n((()=>{var e,o;return null==(o=null==(e=U.currentAVMsg.currentMsg)?void 0:e.content)?void 0:o.avStatus}));async function re(e=V.FINISHED){z({chatType:R.SINGLE,content:{msg:e===V.FINISHED?""+Q.seconds:"s",chatMessageType:U.currentAVMsg.chatMessageType,avStatus:e},receiver:ne.value.userId}),await w({recordId:U.currentAVMsg.currentMsg.id,status:e,duration:e===V.FINISHED?Q.seconds:0})}async function ae(){const e=await S.isSupported();if(!e.result||!e.detail.isH264EncodeSupported||!e.detail.isH264DecodeSupported)return console.log("checkResult :>> ",e),void(U.showVideo=!1);try{if(await F.enterRoom({strRoomId:U.currentAVMsg.strRoomId,sdkAppId:parseInt(U.userInfo.sdkAppID),userId:U.userInfo.id,userSig:U.userInfo.userSig}),P.value||(ee.value=!0,$()),W({handleError:me,handleRemoteUserEnter:de,handleRemoteAudioAvailable:ue,handleRemoteUserExit:ve,handleRemoteVideoAvailable:ce}),await F.startLocalAudio(),J.value)return;await F.startLocalVideo({view:Z.value})}catch(e){console.log("error :>> ",e),U.showVideo=!1}}function le(){P.value&&!ee.value?re(V.CANCELED):re()}async function ie(){try{if(U.showVideo=!1,X({handleError:me,handleRemoteUserEnter:de,handleRemoteAudioAvailable:ue,handleRemoteUserExit:ve,handleRemoteVideoAvailable:ce}),await F.exitRoom(),await F.stopLocalAudio(),J.value)return;await F.stopLocalVideo()}catch(e){console.log("error :>> ",e)}}async function ce(e){const{userId:o,streamType:n}=e;try{await F.startRemoteVideo({userId:o,streamType:n,view:Y.value})}catch(e){console.log("error :>> ",e)}}function ue(e){}function de(){ee.value=!0,$()}function ve(e){console.log("event :>> 对方已挂断",e),ie()}function me(e){console.log("error :>> ",e),U.showVideo=!1}return t((()=>se.value),(e=>{U.showVideo&&(e===V.IN_CALL?async function(){P.value?ae():(oe&&clearTimeout(oe),oe=setTimeout((async()=>{ee.value||re(V.NO_RESPONSE)}),6e4))}():ie())}),{immediate:!0}),s((()=>{ie()})),(e,o)=>(r(),a("div",M,[l(i("div",{class:"video-box",ref_key:"videoRef",ref:Y},null,512),[[c,ee.value]]),l(i("div",{class:"video-box--self",ref_key:"selfVideoRef",ref:Z},null,512),[[c,ee.value]]),l(i("div",b,[u(d(g),{size:58,round:"",src:d(ne).avatar},null,8,["src"]),i("span",T,v(d(ne).name),1),i("span",C,v(d(te)),1)],512),[[c,d(J)||!ee.value]]),i("div",_,[i("div",x,[d(P)&&!ee.value||ee.value?(r(),a(m,{key:0},[u(d(I),{circle:"",onClick:d(B),class:p({bordered:d(G)})},{icon:f((()=>[u(d(h),{size:"30",color:d(G)?"#fff":"#626262",component:d(G)?d(A):d(y)},null,8,["color","component"])])),_:1},8,["onClick","class"]),N],64)):(r(),a(m,{key:1},[u(d(I),{circle:"",color:"#f17568",class:"btn--rotate",onClick:o[0]||(o[0]=()=>re(d(V).REJECTED))},{icon:f((()=>[u(d(h),{size:"30",component:d(E)},null,8,["component"])])),_:1}),L],64))]),i("div",D,[d(P)&&!ee.value||ee.value?(r(),a(m,{key:0},[u(d(I),{circle:"",color:"#f17568",class:"btn--rotate",onClick:le},{icon:f((()=>[u(d(h),{size:"30",component:d(E)},null,8,["component"])])),_:1}),H],64)):(r(),a(m,{key:1},[u(d(I),{circle:"",color:"#2ac98b",onClick:ae},{icon:f((()=>[u(d(h),{size:"30",component:d(E)},null,8,["component"])])),_:1}),j],64))])])]))}});export{z as default};
@@ -1,2 +1,2 @@
1
1
  import { Ref } from 'vue';
2
- export declare function useScrollLoading(wrapperEl: Ref<HTMLElement | undefined | null>, callback: () => void, direction?: 'top' | 'bottom' | undefined): void;
2
+ export declare function useScrollLoading(wrapperEl: Ref<HTMLElement | undefined | null>, callback: () => void, direction?: 'top' | 'bottom' | undefined, afterScroll?: () => void): void;
@@ -1 +1 @@
1
- import{useThrottleFn as o,useEventListener as t}from"@vueuse/core";const e=o((({target:o},t,e)=>{const{clientHeight:r,scrollTop:c,scrollHeight:l}=o;if("top"===e){if(0===c)return;r-c>=l-5&&t()}else r+c>=l-10&&t()}),500);function r(o,r,c="bottom"){t(o,"scroll",(o=>e(o,r,c)),!0)}export{r as useScrollLoading};
1
+ import{useThrottleFn as o,useEventListener as t}from"@vueuse/core";const e=o((({target:o},t,e,l)=>{null==l||l();const{clientHeight:r,scrollTop:c,scrollHeight:i}=o;if("top"===e){if(0===c)return;r-c>=i-5&&t()}else r+c>=i-10&&t()}),500);function l(o,l,r="bottom",c){t(o,"scroll",(o=>e(o,l,r,c)),!0)}export{l as useScrollLoading};
@@ -0,0 +1,11 @@
1
+ import { Ref } from 'vue';
2
+ import { AnyFn, AnyObject } from '../../../../shared/types';
3
+ export declare function useSearchUserList({ wrapperRef, keywordRef, before, after }: {
4
+ wrapperRef: Ref<HTMLElement>;
5
+ keywordRef: Ref<string>;
6
+ before?: AnyFn;
7
+ after?: AnyFn;
8
+ }): {
9
+ userList: Ref<AnyObject[]>;
10
+ handleInput: () => void;
11
+ };
@@ -0,0 +1 @@
1
+ import{ref as e}from"vue";import{isArray as o}from"lodash-es";import{listUserApi as r}from"../api/index.js";import{useDebounceFn as t}from"@vueuse/core";import{useScrollLoading as a}from"./useScrollLoading.js";import{useState as s}from"./useState.js";import"date-fns";import"../utils/emoji.js";import"trtc-sdk-v5";function i({wrapperRef:i,keywordRef:n,before:p,after:u}){const l={page:0,hasMore:!0},{state:c}=s(),f=e([]),g=t((function(){Object.assign(l,{page:0,hasMore:!0}),m()}),300);async function m(){const e=(n.value||"").replace(/^\s+|\s+$/g,"");if(!e)return void(p?p():f.value=[]);if(!l.hasMore)return;l.page++,1==l.page&&(f.value=[]);const t=await r({orgId:c.orgId,keyword:e,page:l.page,pageSize:10});o(t.records)&&f.value.length<=+t.total&&(f.value=l.page>1?f.value.concat(t.records):t.records,null==u||u(),f.value.length>=+t.total&&(l.hasMore=!1,console.log("没有更多消息了")))}return a(i,(()=>{m()})),{userList:f,handleInput:g}}export{i as useSearchUserList};
@@ -1 +1 @@
1
- import{computed as e}from"vue";import{simplifyMessage as s}from"../utils/index.js";import{cloneDeep as t,isArray as n,uniqBy as i}from"lodash-es";import{CHAT_TYPE as o}from"../constants/index.js";import{groupUserApi as r}from"../api/index.js";function u(e){return e.chatType===o.GROUP}function a(e){const{lastMessage:t,lastSenderName:n=""}=e,i=s(t);return u(e)&&n?n+": "+i:i}function c(s){const o=e((()=>s.sessionList.reduce(((e,s)=>e+ +s.unreadNum),0))),c=e((()=>u(s.currentSessionItem)));function m(e){Object.assign(s.currentSessionItem,e,{lastMessageContent:e.lastMessage?a({...e,chatType:e.chatType||s.currentSessionItem.chatType}):s.currentSessionItem.lastMessageContent}),s.isChangeSession=!0,s.id!==s.currentSessionItem.id&&(s.msgList=[],s.id=s.currentSessionItem.id)}return{openSession:async function(e){const i=s.currentSessionItem.sessionKey;if(m(e),i!==s.currentSessionItem.sessionKey)if(c.value){const t=await r({id:e.receiver});s.currentGroupUser=n(t)?t:[]}else s.currentGroupUser=[s.userInfo,{...t(e),id:e.receiver}]},closeSession:function(){if(!s.id)return null;const{currentSessionItem:e}=s;return s.currentSessionItem={},s.msgList=[],s.id="",e},getCurrentSession:function(){return s.id?s.currentSessionItem:null},setCurrentSessionItem:m,setUpdateSessionItem:function(e){const n=s.sessionList.find((s=>s.sessionKey===e.sessionKey)),i={...e,lastMessageContent:a({...e,chatType:e.chatType||(null==n?void 0:n.chatType)})};s.updateSessionItem=n?{...t(n),...i}:i,s.isUpdateSession=!0},unreadTotal:o,setSessionList:function(e){s.sessionList=i(e,"id").map((e=>({...e,lastMessageContent:Reflect.has(e,"lastMessageContent")?e.lastMessageContent:a(e)})))},isGroupChat:c}}export{c as useSession};
1
+ import{computed as e}from"vue";import{simplifyMessage as s}from"../utils/index.js";import{cloneDeep as t,isArray as n,uniqBy as i}from"lodash-es";import{CHAT_TYPE as o}from"../constants/index.js";import{groupUserApi as r}from"../api/index.js";function a(e){return e.chatType===o.GROUP}function c(e){const{lastMessage:t,lastSenderName:n=""}=e,i=s(t)||"";return a(e)&&n?n+": "+i:i}function u(s){const u=e((()=>s.sessionList.reduce(((e,s)=>e+ +s.unreadNum),0))),m=e((()=>a(s.currentSessionItem)));function l(e){Object.assign(s.currentSessionItem,e,{lastMessageContent:Reflect.has(e,"lastMessageContent")?e.lastMessageContent:Reflect.has(e,"lastMessage")?c({...e,chatType:e.chatType||s.currentSessionItem.chatType}):s.currentSessionItem.lastMessageContent}),s.isChangeSession=!0,s.id!==s.currentSessionItem.id&&(s.msgList=[],s.id=s.currentSessionItem.id)}return{openSession:async function(e){const i=s.currentSessionItem.sessionKey;if(l(e),i!==s.currentSessionItem.sessionKey)if(m.value){const t=await r({id:e.receiver});s.currentGroupUser=n(t)?t:[]}else s.currentGroupUser=[s.userInfo,{...t(e),id:e.receiver}]},closeSession:function(){if(!s.id)return null;const{currentSessionItem:e}=s;return s.currentSessionItem={},s.msgList=[],s.id="",e},getCurrentSession:function(){return s.id?s.currentSessionItem:null},setCurrentSessionItem:l,setUpdateSessionItem:function(e){const n=s.sessionList.find((s=>s.sessionKey===e.sessionKey)),i={...e,lastMessageContent:c({...e,chatType:e.chatType||(null==n?void 0:n.chatType)})};s.updateSessionItem=n?{...t(n),...i}:i,s.isUpdateSession=!0},unreadTotal:u,setSessionList:function(e){s.sessionList=t(i(e,"id")),s.sessionList.forEach((e=>{Object.assign(e,{lastMessageContent:Reflect.has(e,"lastMessageContent")?e.lastMessageContent:c(e)}),e.chatType!==o.GROUP||e.name||r({id:e.receiver}).then((s=>{n(s)&&(e.name=s.map((e=>e.name)).join(","))}))}))},isGroupChat:m}}export{u as useSession};
@@ -1 +1 @@
1
- import{inject as e}from"vue";import{cloneDeep as t}from"lodash-es";import{formatTime as s,transformMessage as n}from"../utils/index.js";import{InjectionIChatState as i,InjectionIChatStompClient as m,InjectionIChatEmits as o}from"../types/index.js";import{MESSAGE_TYPE as r}from"../constants/index.js";import{useIntervalFn as c}from"@vueuse/core";function a(){const a=e(i),T=e(m),d=e(o),{pause:u,resume:g,isActive:p}=c((()=>{const e=t(a.msgList);e.some((e=>{const{sendTime:t}=e;return!(Date.now()-new Date(t).getTime()>=36e5)&&(e.__sendTime=s(t).recordTime,!0)})),a.msgList=e,l()||u()}),6e4,{immediate:!1});function l(){return!!a.msgList.length&&a.msgList.some((e=>Date.now()-new Date(e.sendTime).getTime()<36e5))}return{state:a,setMsgList:function(e=[]){u(),a.msgList=e.map((e=>{var t,i,m;return Object.assign(e,{__time:s(e.sendTime).msgTime,__content:(m=e.content.chatMessageType,[r.TEXT,r.TEXT].includes(m)?n(null==(t=e.content)?void 0:t.msg):null==(i=e.content)?void 0:i.msg),__sendTime:s(e.sendTime).recordTime}),e})).sort(((e,t)=>new Date(t.sendTime).getTime()-new Date(e.sendTime).getTime())),l()&&g()},stompClient:T,emit:d,sendMessage:async function(e){try{T.value.send("/app/chat/send",{},JSON.stringify({chatType:a.currentSessionItem.chatType,receiver:a.currentSessionItem.receiver,...e}))}catch(e){console.log("error :>> ",e)}}}}export{a as useState};
1
+ import{inject as e}from"vue";import{cloneDeep as t}from"lodash-es";import{formatTime as s,transformMessage as n,getFileSize as i}from"../utils/index.js";import{InjectionIChatState as m,InjectionIChatStompClient as o,InjectionIChatEmits as r}from"../types/index.js";import{MESSAGE_TYPE as c}from"../constants/index.js";import{useIntervalFn as a}from"@vueuse/core";function T(){const T=e(m),d=e(o),g=e(r),{pause:u,resume:p,isActive:l}=a((()=>{const e=t(T.msgList);e.some((e=>{const{sendTime:t}=e;return!(Date.now()-new Date(t).getTime()>=36e5)&&(e.__sendTime=s(t).recordTime,!0)})),T.msgList=e,f()||u()}),6e4,{immediate:!1});function f(){return!!T.msgList.length&&T.msgList.some((e=>Date.now()-new Date(e.sendTime).getTime()<36e5))}return{state:T,setMsgList:function(e=[]){u(),T.msgList=t(e).sort(((e,t)=>new Date(t.sendTime).getTime()-new Date(e.sendTime).getTime())),T.msgList.forEach((e=>{var t,m,o;Object.assign(e,{__time:s(e.sendTime).msgTime,__content:(o=e.content.chatMessageType,[c.TEXT,c.TEXT].includes(o)?n(null==(t=e.content)?void 0:t.msg):null==(m=e.content)?void 0:m.msg),__sendTime:s(e.sendTime).recordTime}),e.content.chatMessageType!==c.FILE||e.__size||i(e.content.fileUrl).then((t=>{e.__size=t}))})),f()&&p()},stompClient:d,emit:g,sendMessage:async function(e){try{d.value.send("/app/chat/send",{},JSON.stringify({chatType:T.currentSessionItem.chatType,receiver:T.currentSessionItem.receiver,...e}))}catch(e){console.log("error :>> ",e)}}}}export{T as useState};
@@ -1,4 +1,12 @@
1
1
  import TRTC from 'trtc-sdk-v5';
2
+ import { AnyFn } from '../../../../shared/types';
3
+ type EventHandlers = {
4
+ handleError: AnyFn;
5
+ handleRemoteUserEnter: AnyFn;
6
+ handleRemoteAudioAvailable: AnyFn;
7
+ handleRemoteUserExit: AnyFn;
8
+ handleRemoteVideoAvailable: AnyFn;
9
+ };
2
10
  export declare function useVideo(): {
3
11
  state: import("../types").IState;
4
12
  sendMessage: (message: {
@@ -21,4 +29,7 @@ export declare function useVideo(): {
21
29
  timer: any;
22
30
  seconds: number;
23
31
  };
32
+ installEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: EventHandlers) => void;
33
+ uninstallEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: EventHandlers) => void;
24
34
  };
35
+ export {};
@@ -1 +1 @@
1
- import{ref as e,computed as t,onBeforeUnmount as s}from"vue";import{useState as a}from"./useState.js";import{MESSAGE_TYPE as i}from"../constants/index.js";import o from"trtc-sdk-v5";import{formatSeconds as n}from"../utils/index.js";function r(){const r={timer:null,seconds:0},{state:u,sendMessage:l}=a(),c=e(""),m=e(!0),d=e(!0),v=t((()=>u.currentAVMsg.chatMessageType===i.AUDIO)),p=t((()=>"call"===u.currentAVMsg.callMode)),g=t((()=>v.value?"语音":"视频")),f=o.create();function A(){c.value="00:00:00",r.timer&&clearInterval(r.timer),r.timer=null,r.seconds=0}return s((()=>{A()})),{state:u,sendMessage:l,trtc:f,timing:c,voiceOpen:m,videocamOpen:d,isAudio:v,isCall:p,startTimer:function(){A(),r.timer=setInterval((()=>{r.seconds++,c.value=n(r.seconds)}),1e3)},resetTimer:A,toggleAudio:async function(){await f.updateLocalAudio({mute:!m.value}),m.value=!m.value},toggleVideo:async function(){await f.updateLocalVideo({mute:!d.value}),d.value=!d.value},messageTypeText:g,time:r}}export{r as useVideo};
1
+ import{ref as e,computed as t,onBeforeUnmount as E}from"vue";import{useState as a}from"./useState.js";import{MESSAGE_TYPE as n}from"../constants/index.js";import o from"trtc-sdk-v5";import{formatSeconds as l}from"../utils/index.js";function i(){const i={timer:null,seconds:0},{state:r,sendMessage:s}=a(),u=e(""),d=e(!0),m=e(!0),c=t((()=>r.currentAVMsg.chatMessageType===n.AUDIO)),R=t((()=>"call"===r.currentAVMsg.callMode)),T=t((()=>c.value?"语音":"视频")),A=o.create();function v(){u.value="00:00:00",i.timer&&clearInterval(i.timer),i.timer=null,i.seconds=0}return E((()=>{v()})),{state:r,sendMessage:s,trtc:A,timing:u,voiceOpen:d,videocamOpen:m,isAudio:c,isCall:R,startTimer:function(){v(),i.timer=setInterval((()=>{i.seconds++,u.value=l(i.seconds)}),1e3)},resetTimer:v,toggleAudio:async function(){await A.updateLocalAudio({mute:!d.value}),d.value=!d.value},toggleVideo:async function(){await A.updateLocalVideo({mute:!m.value}),m.value=!m.value},messageTypeText:T,time:i,installEventHandlers:function({handleError:e,handleRemoteUserEnter:t,handleRemoteAudioAvailable:E,handleRemoteUserExit:a,handleRemoteVideoAvailable:n}){A.on(o.EVENT.ERROR,e),A.on(o.EVENT.REMOTE_USER_ENTER,t),A.on(o.EVENT.REMOTE_AUDIO_AVAILABLE,E),A.on(o.EVENT.REMOTE_USER_EXIT,a),c.value||A.on(o.EVENT.REMOTE_VIDEO_AVAILABLE,n)},uninstallEventHandlers:function({handleError:e,handleRemoteUserEnter:t,handleRemoteAudioAvailable:E,handleRemoteUserExit:a,handleRemoteVideoAvailable:n}){A.off(o.EVENT.ERROR,e),A.off(o.EVENT.REMOTE_USER_ENTER,t),A.off(o.EVENT.REMOTE_AUDIO_AVAILABLE,E),A.off(o.EVENT.REMOTE_USER_EXIT,a),c.value||A.off(o.EVENT.REMOTE_VIDEO_AVAILABLE,n)}}}export{i as useVideo};
@@ -16,7 +16,6 @@ export type IState = {
16
16
  currentReferenceMsg: null | AnyObject;
17
17
  showVideo: boolean;
18
18
  currentAVMsg: AnyObject;
19
- userList: AnyObject[];
20
19
  currentGroupUser: AnyObject[];
21
20
  showMultipleVideo: boolean;
22
21
  };
@@ -1 +1 @@
1
- import{isToday as e,format as t,isYesterday as n,startOfDay as r}from"date-fns";import{cloneDeep as o,isNumber as s,isNaN as a}from"lodash-es";import{MESSAGE_TYPE as i}from"../constants/index.js";import{emojis as c}from"./emoji.js";function u(r){const o=new Date(r);let s,a;if(e(o))s=a=t(o,"HH:mm");else{s=n(o)?"昨天":t(o,"MM-dd");const e=o.getFullYear(),r=(new Date).getFullYear();a=t(o,e<r?"yyyy年M月d日 HH:mm":"M月d日 HH:mm")}return{siderMsgTime:s,msgTime:a,recordTime:function(r){const o=new Date(r),s=Date.now()-o.getTime();if(s<6e4)return"刚刚";if(s<36e5)return Math.ceil(s/1e3/60)+"分钟前";if(e(o))return"今天 "+t(o,"HH:mm");if(n(o))return"昨天 "+t(o,"HH:mm");{const e=o.getFullYear(),n=(new Date).getFullYear();return t(o,e<n?"yyyy年M月d日 HH:mm":"M月d日 HH:mm")}}(r)}}function l(e){return o(e).sort(((e,t)=>e.topping&&!t.topping?-1:!e.topping&&t.topping?1:new Date(t.sortTime).getTime()-new Date(e.sortTime).getTime()))}function m(e){if(!e)return"";const t=e=>new RegExp("\\n*\\["+(e||"")+"(code|pre|div|span|p|table|thead|th|tbody|tr|td|ul|li|ol|li|dl|dt|dd|h2|h3|h4|h5)([\\s\\S]*?)]\\n*","g");return e=e.toString().replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/@(\S+)(\s+?|$)/g,'@<a href="javascript:;">$1</a>$2').replace(t(),"<$1 $2>").replace(t("/"),"</$1>").replace(/\n/g,"<br>")}function p(e){if(e&&s(+e)&&!a(+e)){const t=w(+e),n=t.split(":");let r=t;return 3===n.length&&"00"===n[0]&&(r=`${n[1]}:${n[2]}`),"通话时长 "+r}return"已取消"}function d(e){var t;if(!e)return"";const{chatMessageType:n,msg:r,messageTemplate:o}=e,s=H(e)?p(r):"";switch(n){case i.TEXT:return m(r);case i.IMAGE:return"[图片]";case i.FILE:return"[文件]";case i.EMOJI:return`<img alt=${r} src=${c.findEmoji(r)}>`;case i.TEMPLATE:return null==(t=null==o?void 0:o.setting)?void 0:t.title;case i.VIDEO:return`[视频通话]${s}`;case i.AUDIO:return`[语音通话]${s}`;default:return"其他消息"}}function g(e,t){const n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="blob",n.onload=function(r){if(200===n.status){const r=window.URL.createObjectURL(n.response),o=document.createElement("a");o.href=r,o.download=t,o.dispatchEvent(new MouseEvent("click")),window.URL.revokeObjectURL(e)}},n.send()}function f(e){return new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open("HEAD",e,!0),r.onreadystatechange=()=>{var e;if(4===r.readyState&&200===r.status){let n=null!=(e=r.getResponseHeader("Content-Length"))?e:0;const o=+n;o>1048576?n=(o/1048576).toFixed(2)+"M":o>1024?n=(o/1024).toFixed(2)+"K":n+="B",t(n)}},r.send()}))}function H(e){return e&&[i.AUDIO,i.VIDEO].includes(e.chatMessageType)}function w(e){const n=r(new Date);return n.setSeconds(e),t(n,"HH:mm:ss")}export{g as downloadFile,w as formatSeconds,u as formatTime,p as getAVTime,f as getFileSize,H as isAudioOrVideoMessage,l as listSort,d as simplifyMessage,m as transformMessage};
1
+ import{isToday as e,format as t,isYesterday as n,startOfDay as r}from"date-fns";import{cloneDeep as o,isNumber as s,isNaN as a}from"lodash-es";import{MESSAGE_TYPE as i}from"../constants/index.js";import{emojis as c}from"./emoji.js";function u(r){const o=new Date(r);let s,a;if(e(o))s=a=t(o,"HH:mm");else{s=n(o)?"昨天":t(o,"MM-dd");const e=o.getFullYear(),r=(new Date).getFullYear();a=t(o,e<r?"yyyy年M月d日 HH:mm":"M月d日 HH:mm")}return{siderMsgTime:s,msgTime:a,recordTime:function(r){const o=new Date(r),s=Date.now()-o.getTime();if(s<6e4)return"刚刚";if(s<36e5)return Math.ceil(s/1e3/60)+"分钟前";if(e(o))return"今天 "+t(o,"HH:mm");if(n(o))return"昨天 "+t(o,"HH:mm");{const e=o.getFullYear(),n=(new Date).getFullYear();return t(o,e<n?"yyyy年M月d日 HH:mm":"M月d日 HH:mm")}}(r)}}function l(e){return o(e).sort(((e,t)=>e.topping&&!t.topping?-1:!e.topping&&t.topping?1:new Date(t.sortTime).getTime()-new Date(e.sortTime).getTime()))}function m(e){if(!e)return"";const t=e=>new RegExp("\\n*\\["+(e||"")+"(code|pre|div|span|p|table|thead|th|tbody|tr|td|ul|li|ol|li|dl|dt|dd|h2|h3|h4|h5)([\\s\\S]*?)]\\n*","g");return e=e.toString().replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/@(\S+)(\s+?|$)/g,'@<a href="javascript:;">$1</a>$2').replace(t(),"<$1 $2>").replace(t("/"),"</$1>").replace(/\n/g,"<br>")}function p(e){if(e&&s(+e)&&!a(+e)){const t=w(+e),n=t.split(":");let r=t;return 3===n.length&&"00"===n[0]&&(r=`${n[1]}:${n[2]}`),"通话时长 "+r}return"已取消"}function d(e){var t;if(!e)return"";const{chatMessageType:n,msg:r,messageTemplate:o}=e,s=H(e)?p(r):"";switch(n){case i.TEXT:return m(r);case i.IMAGE:return"[图片]";case i.FILE:return"[文件]";case i.EMOJI:return`<img alt=${r} src=${c.findEmoji(r)}>`;case i.TEMPLATE:return null==(t=null==o?void 0:o.setting)?void 0:t.title;case i.VIDEO:return`[视频通话]${s}`;case i.AUDIO:return`[语音通话]${s}`;default:return"[消息]"}}function g(e,t){const n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="blob",n.onload=function(r){if(200===n.status){const r=window.URL.createObjectURL(n.response),o=document.createElement("a");o.href=r,o.download=t,o.dispatchEvent(new MouseEvent("click")),window.URL.revokeObjectURL(e)}},n.send()}function f(e){return new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open("HEAD",e,!0),r.onreadystatechange=()=>{var e;if(4===r.readyState&&200===r.status){let n=null!=(e=r.getResponseHeader("Content-Length"))?e:0;const o=+n;o>1048576?n=(o/1048576).toFixed(2)+"M":o>1024?n=(o/1024).toFixed(2)+"K":n+="B",t(n)}},r.send()}))}function H(e){return e&&[i.AUDIO,i.VIDEO].includes(e.chatMessageType)}function w(e){const n=r(new Date);return n.setSeconds(e),t(n,"HH:mm:ss")}export{g as downloadFile,w as formatSeconds,u as formatTime,p as getAVTime,f as getFileSize,H as isAudioOrVideoMessage,l as listSort,d as simplifyMessage,m as transformMessage};