cnhis-design-vue 3.2.4-beta.30 → 3.2.4-beta.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. package/es/components/biunique-chat/index.d.ts +10 -0
  2. package/es/components/biunique-chat/src/Index.vue.d.ts +10 -0
  3. package/es/components/biunique-chat/src/Index.vue2.js +1 -1
  4. package/es/components/biunique-chat/src/components/ChatFooter.vue.d.ts +4 -0
  5. package/es/components/biunique-chat/src/components/ChatFooter.vue2.js +1 -1
  6. package/es/components/biunique-chat/src/components/ChatMain.vue.d.ts +7 -1
  7. package/es/components/biunique-chat/src/components/ChatMain.vue2.js +1 -1
  8. package/es/components/biunique-chat/src/constants/index.d.ts +3 -1
  9. package/es/components/biunique-chat/src/constants/index.js +1 -1
  10. package/es/components/biunique-chat/src/hooks/useSession.js +1 -1
  11. package/es/components/biunique-chat/src/types/index.d.ts +1 -0
  12. package/es/components/biunique-chat/src/utils/index.d.ts +1 -1
  13. package/es/components/biunique-chat/src/utils/index.js +1 -1
  14. package/es/components/biunique-chat/style/index.css +1 -1
  15. package/es/components/callback/src/components/render/popupMaps.d.ts +8 -0
  16. package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
  17. package/es/components/classification/src/index.vue.d.ts +3 -0
  18. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
  19. package/es/components/iho-table/index.d.ts +8 -0
  20. package/es/components/iho-table/src/IhoTable.vue.d.ts +8 -0
  21. package/es/components/iho-table/src/IhoTable.vue2.js +1 -1
  22. package/es/components/iho-table/src/constants/index.d.ts +2 -1
  23. package/es/components/iho-table/src/constants/index.js +1 -1
  24. package/es/components/iho-table/src/plugins/index.js +1 -1
  25. package/es/components/iho-table/src/plugins/pagerScrollPlugin/index.d.ts +1 -0
  26. package/es/components/iho-table/src/plugins/pagerScrollPlugin/index.js +1 -0
  27. package/es/components/iho-table/src/plugins/pagerScrollPlugin/pagerScroll.vue.d.ts +25 -0
  28. package/es/components/iho-table/src/plugins/pagerScrollPlugin/pagerScroll.vue.js +1 -0
  29. package/es/components/iho-table/src/plugins/pagerScrollPlugin/pagerScroll.vue2.js +1 -0
  30. package/es/components/iho-table/src/plugins/pagerScrollPlugin/types.d.ts +16 -0
  31. package/es/components/iho-table/src/plugins/pagerScrollPlugin/types.js +1 -0
  32. package/es/components/iho-table/src/plugins/pagerScrollPlugin/utils.d.ts +51 -0
  33. package/es/components/iho-table/src/plugins/pagerScrollPlugin/utils.js +1 -0
  34. package/es/components/iho-table/src/plugins/verticalTablePlugin/src/hooks/useRowClassName.js +1 -1
  35. package/es/components/iho-table/src/types/index.d.ts +4 -0
  36. package/es/components/iho-table/src/utils/index.d.ts +1 -0
  37. package/es/components/iho-table/src/utils/index.js +1 -1
  38. package/es/components/iho-table/style/index.css +1 -1
  39. package/es/components/index.css +1 -1
  40. package/es/env.d.ts +25 -25
  41. package/es/shared/package.json.js +1 -1
  42. package/package.json +2 -2
@@ -54,6 +54,7 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
54
54
  isChangeSession: boolean;
55
55
  updateSessionItem: import("../../shared/types").AnyObject;
56
56
  isUpdateSession: boolean;
57
+ currentReferenceMsg: import("../../shared/types").AnyObject;
57
58
  };
58
59
  reConnention: number;
59
60
  openSession: (item: import("../../shared/types").AnyObject) => Promise<void>;
@@ -1248,6 +1249,7 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
1248
1249
  needShowTime: (item: import("../../shared/types").AnyObject, index: number) => boolean;
1249
1250
  setScrollToButtom: () => Promise<void>;
1250
1251
  resetInfo: () => void;
1252
+ setReferenceMsg: (msgItem: import("../../shared/types").AnyObject) => void;
1251
1253
  NAvatar: any;
1252
1254
  NImageGroup: import("vue").DefineComponent<{
1253
1255
  showToolbar: {
@@ -1449,6 +1451,7 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
1449
1451
  showToolbarTooltip: boolean;
1450
1452
  }>;
1451
1453
  NImage: any;
1454
+ NIcon: any;
1452
1455
  PersonProfile: import("vue").DefineComponent<{
1453
1456
  userId: {
1454
1457
  type: StringConstructor;
@@ -1594,7 +1597,11 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
1594
1597
  images: import("vue").Ref<any[]>;
1595
1598
  formatTime: typeof import("./src/utils").formatTime;
1596
1599
  downloadFile: typeof import("./src/utils").downloadFile;
1600
+ simplifyMessage: typeof import("./src/utils").simplifyMessage;
1597
1601
  MESSAGE_TYPE: typeof import("./src/constants").MESSAGE_TYPE;
1602
+ AddCircleOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1603
+ ChatbubbleEllipsesOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1604
+ EllipsisHorizontal: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1598
1605
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1599
1606
  ChatFooter: import("vue").DefineComponent<{}, {
1600
1607
  inputRef: import("vue").Ref<HTMLDivElement | undefined>;
@@ -1626,9 +1633,12 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
1626
1633
  }>>, {
1627
1634
  abstract: boolean;
1628
1635
  }>;
1636
+ NIcon: any;
1629
1637
  images: import("vue").Ref<any[]>;
1630
1638
  alt: string[];
1631
1639
  MESSAGE_TYPE: typeof import("./src/constants").MESSAGE_TYPE;
1640
+ CloseCircleOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1641
+ simplifyMessage: typeof import("./src/utils").simplifyMessage;
1632
1642
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1633
1643
  ChatSearch: import("vue").DefineComponent<{}, {
1634
1644
  cssVars: import("vue").ComputedRef<import("vue").CSSProperties>;
@@ -57,6 +57,7 @@ declare const _default: import("vue").DefineComponent<{
57
57
  isChangeSession: boolean;
58
58
  updateSessionItem: AnyObject;
59
59
  isUpdateSession: boolean;
60
+ currentReferenceMsg: AnyObject;
60
61
  };
61
62
  reConnention: number;
62
63
  openSession: (item: AnyObject) => Promise<void>;
@@ -1251,6 +1252,7 @@ declare const _default: import("vue").DefineComponent<{
1251
1252
  needShowTime: (item: AnyObject, index: number) => boolean;
1252
1253
  setScrollToButtom: () => Promise<void>;
1253
1254
  resetInfo: () => void;
1255
+ setReferenceMsg: (msgItem: AnyObject) => void;
1254
1256
  NAvatar: any;
1255
1257
  NImageGroup: import("vue").DefineComponent<{
1256
1258
  showToolbar: {
@@ -1452,6 +1454,7 @@ declare const _default: import("vue").DefineComponent<{
1452
1454
  showToolbarTooltip: boolean;
1453
1455
  }>;
1454
1456
  NImage: any;
1457
+ NIcon: any;
1455
1458
  PersonProfile: import("vue").DefineComponent<{
1456
1459
  userId: {
1457
1460
  type: StringConstructor;
@@ -1597,7 +1600,11 @@ declare const _default: import("vue").DefineComponent<{
1597
1600
  images: import("vue").Ref<any[]>;
1598
1601
  formatTime: typeof import("./utils").formatTime;
1599
1602
  downloadFile: typeof import("./utils").downloadFile;
1603
+ simplifyMessage: typeof import("./utils").simplifyMessage;
1600
1604
  MESSAGE_TYPE: typeof import("./constants").MESSAGE_TYPE;
1605
+ AddCircleOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1606
+ ChatbubbleEllipsesOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1607
+ EllipsisHorizontal: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1601
1608
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1602
1609
  ChatFooter: import("vue").DefineComponent<{}, {
1603
1610
  inputRef: import("vue").Ref<HTMLDivElement | undefined>;
@@ -1629,9 +1636,12 @@ declare const _default: import("vue").DefineComponent<{
1629
1636
  }>>, {
1630
1637
  abstract: boolean;
1631
1638
  }>;
1639
+ NIcon: any;
1632
1640
  images: import("vue").Ref<any[]>;
1633
1641
  alt: string[];
1634
1642
  MESSAGE_TYPE: typeof import("./constants").MESSAGE_TYPE;
1643
+ CloseCircleOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1644
+ simplifyMessage: typeof import("./utils").simplifyMessage;
1635
1645
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1636
1646
  ChatSearch: import("vue").DefineComponent<{}, {
1637
1647
  cssVars: import("vue").ComputedRef<import("vue").CSSProperties>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as s,reactive as o,provide as t,onBeforeUnmount as r,openBlock as n,createElementBlock as i,normalizeStyle as a,unref as c,createVNode as u,withCtx as d,createBlock as m,Fragment as p,createElementVNode as l,renderSlot as h}from"vue";import{NConfigProvider as f,NSpin as S,NLayout as g,NLayoutContent as v}from"naive-ui";import b from"./components/SiderList.vue.js";import I from"./components/ChatHeader.vue.js";import y from"./components/ChatMain.vue.js";import j from"./components/ChatFooter.vue.js";import k from"./components/ChatSearch.vue.js";import{ChatSock as _}from"./utils/chatSock.js";import{instanceAxios as C,readMessageApi as L}from"./api/index.js";import{useTheme as N}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isNumber as x}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{SUBSCRIBE_MESSAGE_TYPE as M}from"./constants/index.js";import{InjectionIChatState as U,InjectionIChatStompClient as q,InjectionIChatEmits as T}from"./types/index.js";import"./utils/emoji.js";import{useSession as A}from"./hooks/useSession.js";const E={class:"c-biunique-chat__header"},O={class:"toolbar"};var w=e({__name:"Index",props:{token:{type:String,required:!0},orgId:{type:[String,Number],required:!0},userId:{type:String,required:!0},baseURL:{type:String,default:"/fdp-chat"}},emits:["template-click","unread-message-update"],setup(e,{expose:w,emit:V}){const J=e;C.defaults.baseURL=J.baseURL,C.defaults.headers.Authorization="bearer "+J.token;const R=N(),F=s(!1),G=s(),H=o({orgId:J.orgId,currentSessionItem:{},id:"",userInfo:{id:J.userId},msgList:[],currentMsg:{},isAppendMsg:!1,sessionList:[],isChangeSession:!1,updateSessionItem:{},isUpdateSession:!1});t(U,H),t(q,G),t(T,V);const{openSession:$,closeSession:z,getCurrentSession:D,setSessionList:W,setUpdateSessionItem:B}=A(H);function K(){const e={headers:{AccessToken:J.token,UserId:J.userId},heartbeatFn(){try{G.value.send("test")}catch(e){G.value.disconnect(),K()}},connectCb(){console.log("连接成功"),G.value.subscribe("/user/topic/single",(async({body:e})=>{try{console.log(JSON.parse(e),"订阅新增消息");const s=JSON.parse(e),{messageVo:o,sessionVo:t}=s;switch(s.event){case M.MESSAGE:{if(s.messageVo.sender===H.userInfo.id)return;const e={receiver:o.sender,lastMessageSendTime:o.sendTime,sortTime:o.sendTime,lastMessage:o.content};o.sender===H.currentSessionItem.receiver&&(H.currentMsg=o,H.isAppendMsg=!0,await L({chatType:"SINGLE",messageIdSet:o.id,receiver:H.userInfo.id,sender:o.sender}),e.unreadNum=0),B(e);break}case M.NEW_SESSION:B(t)}}catch(e){console.log(e)}})),G.value.subscribe("/app/sessionList",(({body:e})=>{try{const s=JSON.parse(e),{currentUser:o,sessionVos:t}=s;if(console.log("body",s),Object.assign(H.userInfo,o),!(null==t?void 0:t.length))return;W(t)}catch(e){console.log(e)}}))},errorCb(e,s){console.log("断线了,正在重连...")}};G.value=new _("/fdp-chat/websocket",e)}return async function(){K()}(),r((()=>{var e;null==(e=G.value)||e.disconnect()})),w({getUnreadData:function(){return H.sessionList.filter((e=>x(e.unreadNum)&&e.unreadNum>0))},openSession:$,closeSession:z,getCurrentSession:D}),(e,s)=>(n(),i("div",{class:"c-biunique-chat",style:a(c(R))},[u(c(f),{abstract:"",namespace:"c-biunique-chat__popover"},{default:d((()=>[F.value?(n(),m(c(S),{key:0,stroke:"#5585f5"})):(n(),i(p,{key:1},[l("div",E,[u(k),l("div",O,[h(e.$slots,"toolbar")])]),u(c(g),{class:"c-biunique-chat__body","has-sider":""},{default:d((()=>[u(b),u(c(v),{class:"chat-content"},{default:d((()=>[u(I),u(y),u(j)])),_:1}),h(e.$slots,"external")])),_:3})],64))])),_:3})],4))}});export{w as default};
1
+ import{defineComponent as e,ref as s,reactive as o,provide as t,onBeforeUnmount as r,openBlock as n,createElementBlock as i,normalizeStyle as a,unref as c,createVNode as u,withCtx as d,createBlock as m,Fragment as p,createElementVNode as l,renderSlot as h}from"vue";import{NConfigProvider as f,NSpin as S,NLayout as g,NLayoutContent as v}from"naive-ui";import b from"./components/SiderList.vue.js";import I from"./components/ChatHeader.vue.js";import y from"./components/ChatMain.vue.js";import j from"./components/ChatFooter.vue.js";import k from"./components/ChatSearch.vue.js";import{ChatSock as _}from"./utils/chatSock.js";import{instanceAxios as C,readMessageApi as L}from"./api/index.js";import{useTheme as N}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isNumber as M}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{SUBSCRIBE_MESSAGE_TYPE as x}from"./constants/index.js";import{InjectionIChatState as U,InjectionIChatStompClient as q,InjectionIChatEmits as T}from"./types/index.js";import"./utils/emoji.js";import{useSession as A}from"./hooks/useSession.js";const E={class:"c-biunique-chat__header"},O={class:"toolbar"};var w=e({__name:"Index",props:{token:{type:String,required:!0},orgId:{type:[String,Number],required:!0},userId:{type:String,required:!0},baseURL:{type:String,default:"/fdp-chat"}},emits:["template-click","unread-message-update"],setup(e,{expose:w,emit:R}){const V=e;C.defaults.baseURL=V.baseURL,C.defaults.headers.Authorization="bearer "+V.token;const J=N(),F=s(!1),G=s(),H=o({orgId:V.orgId,currentSessionItem:{},id:"",userInfo:{id:V.userId},msgList:[],currentMsg:{},isAppendMsg:!1,sessionList:[],isChangeSession:!1,updateSessionItem:{},isUpdateSession:!1,currentReferenceMsg:{}});t(U,H),t(q,G),t(T,R);const{openSession:$,closeSession:z,getCurrentSession:D,setSessionList:W,setUpdateSessionItem:B}=A(H);function K(){const e={headers:{AccessToken:V.token,UserId:V.userId},heartbeatFn(){try{G.value.send("test")}catch(e){G.value.disconnect(),K()}},connectCb(){console.log("连接成功"),G.value.subscribe("/user/topic/single",(async({body:e})=>{try{console.log(JSON.parse(e),"订阅新增消息");const s=JSON.parse(e),{messageVo:o,sessionVo:t}=s;switch(s.event){case x.MESSAGE:{if(s.messageVo.sender===H.userInfo.id)return;const e={receiver:o.sender,lastMessageSendTime:o.sendTime,sortTime:o.sendTime,lastMessage:o.content};o.sender===H.currentSessionItem.receiver&&(H.currentMsg=o,H.isAppendMsg=!0,await L({chatType:"SINGLE",messageIdSet:o.id,receiver:H.userInfo.id,sender:o.sender}),e.unreadNum=0),B(e);break}case x.NEW_SESSION:B(t)}}catch(e){console.log(e)}})),G.value.subscribe("/app/sessionList",(({body:e})=>{try{const s=JSON.parse(e),{currentUser:o,sessionVos:t}=s;if(console.log("body",s),Object.assign(H.userInfo,o),!(null==t?void 0:t.length))return;W(t)}catch(e){console.log(e)}}))},errorCb(e,s){console.log("断线了,正在重连...")}};G.value=new _("/fdp-chat/websocket",e)}return async function(){K()}(),r((()=>{var e;null==(e=G.value)||e.disconnect()})),w({getUnreadData:function(){return H.sessionList.filter((e=>M(e.unreadNum)&&e.unreadNum>0))},openSession:$,closeSession:z,getCurrentSession:D}),(e,s)=>(n(),i("div",{class:"c-biunique-chat",style:a(c(J))},[u(c(f),{abstract:"",namespace:"c-biunique-chat__popover"},{default:d((()=>[F.value?(n(),m(c(S),{key:0,stroke:"#5585f5"})):(n(),i(p,{key:1},[l("div",E,[u(k),l("div",O,[h(e.$slots,"toolbar")])]),u(c(g),{class:"c-biunique-chat__body","has-sider":""},{default:d((()=>[u(b),u(c(v),{class:"chat-content"},{default:d((()=>[u(I),u(y),u(j)])),_:1}),h(e.$slots,"external")])),_:3})],64))])),_:3})],4))}});export{w as default};
@@ -1,6 +1,7 @@
1
1
  import { UploadFileInfo } from 'naive-ui';
2
2
  import { AnyObject } from '../../../../shared/types';
3
3
  import { MESSAGE_TYPE } from '../constants';
4
+ import { simplifyMessage } from '../utils';
4
5
  declare const _default: import("vue").DefineComponent<{}, {
5
6
  inputRef: import("vue").Ref<HTMLDivElement | undefined>;
6
7
  content: import("vue").Ref<string>;
@@ -31,8 +32,11 @@ declare const _default: import("vue").DefineComponent<{}, {
31
32
  }>>, {
32
33
  abstract: boolean;
33
34
  }>;
35
+ NIcon: any;
34
36
  images: import("vue").Ref<any[]>;
35
37
  alt: string[];
36
38
  MESSAGE_TYPE: typeof MESSAGE_TYPE;
39
+ CloseCircleOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
40
+ simplifyMessage: typeof simplifyMessage;
37
41
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
38
42
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as t,ref as e,withDirectives as n,openBlock as s,createElementBlock as i,normalizeStyle as a,unref as o,createElementVNode as l,createVNode as c,withCtx as r,createCommentVNode as u,Fragment as d,renderList as f,createBlock as p,createTextVNode as m,toDisplayString as g,vShow as h}from"vue";import{NPopover as v,NTooltip as y,NUpload as M,NUploadTrigger as k,NButton as x}from"naive-ui";import{format as C}from"date-fns";import{useState as T}from"../hooks/useState.js";import{useSession as b}from"../hooks/useSession.js";import{images as w,alt as E}from"../utils/emoji.js";import{MESSAGE_TYPE as I}from"../constants/index.js";import{uploadFileApi as _}from"../api/index.js";const S={class:"tool-box"},j=l("span",null,[l("i",{class:"chat--iconfont chat--icon-face"})],-1),L={class:"emoji-box"},F=l("span",null,"默认表情",-1),K={class:"list-box"},D=["onClick"],H=["src"],J=[l("i",{class:"chat--iconfont chat--icon-good"},null,-1)],N=["onClick"],O=[l("i",{class:"chat--iconfont chat--icon-image"},null,-1)],A=["onClick"],G=[l("i",{class:"chat--iconfont chat--icon-folder"},null,-1)],U={class:"btn-box"},X=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var z=t({__name:"ChatFooter",setup(t){const z=e(),B=e(""),{state:R,stompClient:q}=T(),{setCurrentSessionItem:P}=b(R),Q=e(!1);function V(t){["Enter"].includes(t.key)&&(function(t){return t.altKey||t.ctrlKey||t.metaKey||t.shiftKey}(t)||(t.preventDefault(),Z()))}function W(){var t,e;B.value=(null==(e=null==(t=z.value)?void 0:t.innerText)?void 0:e.trim())||""}async function Y(t,e){const{file:n,name:s}=t.file,i=new FormData;i.append("sender",R.userInfo.id),i.append("file",n);const a=await _(i);if(!a)return console.log("上传失败");$({chatMessageType:e,msg:e===I.FILE?s:a,url:a})}function Z(){if(!(B.value.length>2e3))return B.value?void $({msg:B.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function $(t){const{chatMessageType:e=I.TEXT,msg:n,url:s}=t,i={msg:n,chatMessageType:e};e===I.FILE&&(i.fileUrl=s),[I.TEXT,I.BLEND].includes(e)&&(z.value.innerHTML="",B.value="");const a=C(new Date,"yyyy-MM-dd HH:mm:ss");R.currentMsg={content:i,sender:R.userInfo.id,id:"",sendTime:a,sending:!0,fail:!1},R.isAppendMsg=!0,P({lastMessageSendTime:a,lastMessage:i,sortTime:a});try{q.value.send("/app/chat/send",{},JSON.stringify({chatType:"SINGLE",content:i,receiver:R.currentSessionItem.receiver})),R.currentMsg={...R.currentMsg,fail:!1}}catch(t){R.currentMsg={...R.currentMsg,fail:!0}}finally{R.currentMsg={...R.currentMsg,sending:!1}}}return(t,e)=>n((s(),i("section",{class:"chat-footer",style:a({cursor:o(R).id?"default":"not-allowed"})},[l("div",S,[c(o(v),{show:Q.value,"onUpdate:show":e[0]||(e[0]=t=>Q.value=t),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:r((()=>[j])),default:r((()=>[l("div",L,[u(' <span>最近使用</span>\n\t\t\t\t\t<div class="list-box">\n\t\t\t\t\t\t<template v-for="(img, index) in images" :key="index">\n\t\t\t\t\t\t\t<i>\n\t\t\t\t\t\t\t\t<img :src="img" />\n\t\t\t\t\t\t\t</i>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</div> '),F,l("div",K,[(s(!0),i(d,null,f(o(w),((t,e)=>(s(),i(d,{key:e},[e>0?(s(),p(o(y),{key:0,"show-arrow":!1,trigger:"hover"},{trigger:r((()=>[l("i",{onClick:()=>function(t){Q.value=!1,$({chatMessageType:I.EMOJI,msg:t})}(e)},[l("img",{src:t},null,8,H)],8,D)])),default:r((()=>[m(" "+g(o(E)[e-1]||"微笑"),1)])),_:2},1024)):u("v-if",!0)],64)))),128))])])])),_:1},8,["show"]),l("span",{onClick:e[1]||(e[1]=()=>$({chatMessageType:o(I).EMOJI,msg:0}))},J),c(o(M),{abstract:"",multiple:"",accept:"image/*",onChange:e[2]||(e[2]=t=>Y(t,o(I).IMAGE))},{default:r((()=>[c(o(k),{abstract:""},{default:r((({handleClick:t})=>[l("span",{onClick:t},O,8,N)])),_:1})])),_:1}),c(o(M),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:e[3]||(e[3]=t=>Y(t,o(I).FILE))},{default:r((()=>[c(o(k),{abstract:""},{default:r((({handleClick:t})=>[l("span",{onClick:t},G,8,A)])),_:1})])),_:1})]),n(l("div",{ref_key:"inputRef",ref:z,class:"input-box",contenteditable:"",onKeydown:V,onInput:W},null,544),[[h,o(R).id]]),l("div",U,[X,c(o(x),{type:"primary",round:"",disabled:!B.value,onClick:Z},{default:r((()=>[m("发送")])),_:1},8,["disabled"])])],4)),[[h,o(R).id]])}});export{z as default};
1
+ import{defineComponent as e,ref as t,watch as n,withDirectives as s,openBlock as i,createElementBlock as r,normalizeStyle as o,unref as a,createElementVNode as c,toDisplayString as l,createVNode as u,createCommentVNode as d,withCtx as f,Fragment as p,renderList as m,createBlock as g,createTextVNode as v,vShow as h}from"vue";import{NIcon as y,NPopover as M,NTooltip as k,NUpload as x,NUploadTrigger as C,NButton as T}from"naive-ui";import{format as b}from"date-fns";import{useState as w}from"../hooks/useState.js";import{useSession as E}from"../hooks/useSession.js";import{images as I,alt as _}from"../utils/emoji.js";import{MESSAGE_TYPE as R}from"../constants/index.js";import{uploadFileApi as j}from"../api/index.js";import{CloseCircleOutline as L}from"@vicons/ionicons5";import{cloneDeep as S}from"lodash-es";import{simplifyMessage as F}from"../utils/index.js";const H={key:0,class:"reference-content-box"},K={class:"reference-content"},D=["innerHTML"],N={class:"tool-box"},J=c("span",null,[c("i",{class:"chat--iconfont chat--icon-face"})],-1),O={class:"emoji-box"},A=c("span",null,"默认表情",-1),G={class:"list-box"},U=["onClick"],X=["src"],z=[c("i",{class:"chat--iconfont chat--icon-good"},null,-1)],B=["onClick"],q=[c("i",{class:"chat--iconfont chat--icon-image"},null,-1)],P=["onClick"],Q=[c("i",{class:"chat--iconfont chat--icon-folder"},null,-1)],V={class:"btn-box"},W=c("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var Y=e({__name:"ChatFooter",setup(e){const Y=t(),Z=t(""),{state:$,stompClient:ee}=w(),{setCurrentSessionItem:te}=E($),ne=t(!1);function se(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),oe()))}function ie(){var e,t;Z.value=(null==(t=null==(e=Y.value)?void 0:e.innerText)?void 0:t.trim())||""}async function re(e,t){const{file:n,name:s}=e.file,i=new FormData;i.append("sender",$.userInfo.id),i.append("file",n);const r=await j(i);if(!r)return console.log("上传失败");ae({chatMessageType:t,msg:t===R.FILE?s:r,url:r})}function oe(){if(!(Z.value.length>2e3))return Z.value?void ae({msg:Z.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function ae(e){const{chatMessageType:t=R.TEXT,msg:n,url:s}=e,i={msg:n,chatMessageType:t};t===R.FILE&&(i.fileUrl=s),[R.TEXT,R.BLEND].includes(t)&&(Y.value.innerHTML="",Z.value=""),$.currentReferenceMsg.id&&(i.referenceContent=S($.currentReferenceMsg),$.currentReferenceMsg.id="");const r=b(new Date,"yyyy-MM-dd HH:mm:ss");$.currentMsg={content:i,sender:$.userInfo.id,id:"",sendTime:r,sending:!0,fail:!1},$.isAppendMsg=!0,te({lastMessageSendTime:r,lastMessage:i,sortTime:r});try{ee.value.send("/app/chat/send",{},JSON.stringify({chatType:"SINGLE",content:i,receiver:$.currentSessionItem.receiver})),$.currentMsg={...$.currentMsg,fail:!1}}catch(e){$.currentMsg={...$.currentMsg,fail:!0}}finally{$.currentMsg={...$.currentMsg,sending:!1}}}return n((()=>$.currentReferenceMsg.id),(e=>{var t;e&&(null==(t=Y.value)||t.focus())})),(e,t)=>s((i(),r("section",{class:"chat-footer",style:o({cursor:a($).id?"default":"not-allowed"})},[a($).currentReferenceMsg.id?(i(),r("div",H,[c("div",K,[c("span",null,l(a($).currentReferenceMsg.senderName)+":",1),c("pre",{innerHTML:a(F)(a($).currentReferenceMsg.content)},null,8,D)]),u(a(y),{component:a(L),onClick:t[0]||(t[0]=()=>a($).currentReferenceMsg.id="")},null,8,["component"])])):d("v-if",!0),c("div",N,[u(a(M),{show:ne.value,"onUpdate:show":t[1]||(t[1]=e=>ne.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:f((()=>[J])),default:f((()=>[c("div",O,[d(' <span>最近使用</span>\r\n\t\t\t\t\t<div class="list-box">\r\n\t\t\t\t\t\t<template v-for="(img, index) in images" :key="index">\r\n\t\t\t\t\t\t\t<i>\r\n\t\t\t\t\t\t\t\t<img :src="img" />\r\n\t\t\t\t\t\t\t</i>\r\n\t\t\t\t\t\t</template>\r\n\t\t\t\t\t</div> '),A,c("div",G,[(i(!0),r(p,null,m(a(I),((e,t)=>(i(),r(p,{key:t},[t>0?(i(),g(a(k),{key:0,"show-arrow":!1,trigger:"hover"},{trigger:f((()=>[c("i",{onClick:()=>function(e){ne.value=!1,ae({chatMessageType:R.EMOJI,msg:e})}(t)},[c("img",{src:e},null,8,X)],8,U)])),default:f((()=>[v(" "+l(a(_)[t-1]||"微笑"),1)])),_:2},1024)):d("v-if",!0)],64)))),128))])])])),_:1},8,["show"]),c("span",{onClick:t[2]||(t[2]=()=>ae({chatMessageType:a(R).EMOJI,msg:0}))},z),u(a(x),{abstract:"",multiple:"",accept:"image/*",onChange:t[3]||(t[3]=e=>re(e,a(R).IMAGE))},{default:f((()=>[u(a(C),{abstract:""},{default:f((({handleClick:e})=>[c("span",{onClick:e},q,8,B)])),_:1})])),_:1}),u(a(x),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:t[4]||(t[4]=e=>re(e,a(R).FILE))},{default:f((()=>[u(a(C),{abstract:""},{default:f((({handleClick:e})=>[c("span",{onClick:e},Q,8,P)])),_:1})])),_:1})]),s(c("div",{ref_key:"inputRef",ref:Y,class:"input-box",contenteditable:"",onKeydown:se,onInput:ie},null,544),[[h,a($).id]]),c("div",V,[W,u(a(T),{type:"primary",round:"",disabled:!Z.value,onClick:oe},{default:f((()=>[v("发送")])),_:1},8,["disabled"])])],4)),[[h,a($).id]])}});export{Y as default};
@@ -1,5 +1,5 @@
1
1
  import { AnyObject } from '../../../../shared/types';
2
- import { formatTime, downloadFile } from '../utils';
2
+ import { formatTime, downloadFile, simplifyMessage } from '../utils';
3
3
  import { MESSAGE_TYPE } from '../constants';
4
4
  declare const _default: import("vue").DefineComponent<{}, {
5
5
  chatMainRef: import("vue").Ref<HTMLElement | undefined>;
@@ -18,6 +18,7 @@ declare const _default: import("vue").DefineComponent<{}, {
18
18
  needShowTime: (item: AnyObject, index: number) => boolean;
19
19
  setScrollToButtom: () => Promise<void>;
20
20
  resetInfo: () => void;
21
+ setReferenceMsg: (msgItem: AnyObject) => void;
21
22
  NAvatar: any;
22
23
  NImageGroup: import("vue").DefineComponent<{
23
24
  showToolbar: {
@@ -219,6 +220,7 @@ declare const _default: import("vue").DefineComponent<{}, {
219
220
  showToolbarTooltip: boolean;
220
221
  }>;
221
222
  NImage: any;
223
+ NIcon: any;
222
224
  PersonProfile: import("vue").DefineComponent<{
223
225
  userId: {
224
226
  type: StringConstructor;
@@ -364,6 +366,10 @@ declare const _default: import("vue").DefineComponent<{}, {
364
366
  images: import("vue").Ref<any[]>;
365
367
  formatTime: typeof formatTime;
366
368
  downloadFile: typeof downloadFile;
369
+ simplifyMessage: typeof simplifyMessage;
367
370
  MESSAGE_TYPE: typeof MESSAGE_TYPE;
371
+ AddCircleOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
372
+ ChatbubbleEllipsesOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
373
+ EllipsisHorizontal: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
368
374
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
369
375
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,watch as s,openBlock as n,createElementBlock as i,normalizeClass as o,unref as a,createVNode as r,withCtx as m,Fragment as l,renderList as c,toDisplayString as d,createCommentVNode as u,createBlock as p,withModifiers as g}from"vue";import{NImageGroup as f,NAvatar as y,NImage as T}from"naive-ui";import{format as v}from"date-fns";import{getHistoryRecordApi as M,readMessageApi as h}from"../api/index.js";import{useState as k}from"../hooks/useState.js";import{useSession as _}from"../hooks/useSession.js";import{first as E,last as L,isNumber as S}from"lodash-es";import j from"./PersonProfile.vue.js";import I from"./MessageTemplate.vue.js";import{images as A}from"../utils/emoji.js";import{formatTime as H,downloadFile as w}from"../utils/index.js";import{MESSAGE_TYPE as P}from"../constants/index.js";import{useScrollLoading as b}from"../hooks/useScrollLoading.js";const x={key:0,class:"time"},C={key:2,class:"message-box"},D=["data-time"],N=["innerHTML"],O=["src"],G=["href","onClick"];var J=e({__name:"ChatMain",setup(e){const J=t(),{state:K,setMsgList:U}=k(),{setCurrentSessionItem:z}=_(K),F={page:0,hasMore:!0,lastSendTime:v(new Date,"yyyy-MM-dd HH:mm:ss")};async function R(){try{if(!F.hasMore)return;F.page++;const e=await M({sessionKey:K.currentSessionItem.sessionKey,page:F.page,lastSendTime:F.lastSendTime});if(!Array.isArray(e)||0===e.length)return F.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=E(e).id;F.lastSendTime=L(e).sendTime,U(F.page>1?[...e,...K.msgList]:e),1===F.page&&K.currentSessionItem.unreadNum&&(await h({chatType:"SINGLE",messageIdSet:[t],receiver:K.userInfo.id,sender:K.currentSessionItem.receiver}),z({unreadNum:0}))}catch(e){console.log(e)}}function X(e){const{chatMessageType:t,messageTemplate:s}=e.content;return t!==P.TEMPLATE||!!s}function q(e,t){var s,n;const{chatMessageType:i,messageTemplate:o}=e.content;if(i===P.TEMPLATE)return"system"===t?2==(null==(s=null==o?void 0:o.setting)?void 0:s.style.id):2!=(null==(n=null==o?void 0:o.setting)?void 0:n.style.id)}function B(e){var t,s;const{chatMessageType:n,messageTemplate:i}=e;return n===P.TEMPLATE&&3==(null==(s=null==(t=null==i?void 0:i.setting)?void 0:t.style)?void 0:s.id)}function Q(e,t){var s;const n=S(e.sendTime)?e.sendTime:Date.parse(e.sendTime),i=null==(s=K.msgList[t-1])?void 0:s.sendTime;return n-(0===t?0:S(i)?i:Date.parse(i))>3e5}return b(J,(()=>{R()}),"top"),s((()=>K.id),(e=>{e&&(Object.assign(F,{page:0,hasMore:!0,lastSendTime:v(new Date,"yyyy-MM-dd HH:mm:ss")}),R())}),{immediate:!0}),s((()=>K.isAppendMsg),(e=>{e&&(U([...K.msgList,K.currentMsg]),K.isAppendMsg=!1,async function(){var e,t,s;const n=null!=(t=null==(e=J.value)?void 0:e.scrollHeight)?t:0;null==(s=J.value)||s.scrollTo({top:n,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(n(),i("div",{class:o(["chat-main",{"home-bg":!a(K).id}]),ref_key:"chatMainRef",ref:J},[r(a(f),{"show-toolbar-tooltip":""},{default:m((()=>[(n(!0),i(l,null,c(a(K).msgList,((e,t)=>(n(),i(l,{key:t},[X(e)?(n(),i("div",{key:0,class:o(["message-item",{"message-item--mine":e.sender==a(K).userInfo.id}])},[Q(e,t)?(n(),i("p",x,d(a(H)(e.sendTime).recordTime),1)):u("v-if",!0),q(e,"system")?(n(),p(I,{key:1,data:e},null,8,["data"])):(n(),i("div",C,[r(j,{"user-id":e.sender},{trigger:m((()=>[r(a(y),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id"]),e.content?(n(),i("div",{key:0,class:o(["content",{emoji:e.content.chatMessageType===a(P).EMOJI,template:e.content.chatMessageType===a(P).TEMPLATE,"template--3":B(e.content)}]),"data-time":e.__time},[e.content.chatMessageType===a(P).TEXT?(n(),i("pre",{key:0,innerHTML:e.__content},null,8,N)):u("v-if",!0),e.content.chatMessageType===a(P).EMOJI?(n(),i("img",{key:1,src:a(A)[e.__content]},null,8,O)):u("v-if",!0),q(e,"template")?(n(),p(I,{key:2,data:e},null,8,["data"])):u("v-if",!0),e.content.chatMessageType===a(P).IMAGE?(n(),p(a(T),{key:3,width:"240",src:e.__content},null,8,["src"])):u("v-if",!0),e.content.chatMessageType===a(P).FILE?(n(),i("a",{key:4,href:e.content.fileUrl,onClick:g((()=>a(w)(e.content.fileUrl,e.__content)),["prevent"])},d(e.__content),9,G)):u("v-if",!0)],10,D)):u("v-if",!0)]))],2)):u("v-if",!0)],64)))),128))])),_:1})],2))}});export{J as default};
1
+ import{defineComponent as e,ref as t,watch as n,openBlock as s,createElementBlock as o,normalizeClass as r,unref as i,createVNode as a,withCtx as c,Fragment as m,renderList as l,toDisplayString as u,createCommentVNode as d,createBlock as p,createElementVNode as f,withModifiers as v}from"vue";import{NImageGroup as g,NAvatar as y,NImage as T,NIcon as M}from"naive-ui";import{format as h}from"date-fns";import{getHistoryRecordApi as k,readMessageApi as S}from"../api/index.js";import{useState as L}from"../hooks/useState.js";import{useSession as _}from"../hooks/useSession.js";import{first as I,last as E,isNumber as j}from"lodash-es";import A from"./PersonProfile.vue.js";import C from"./MessageTemplate.vue.js";import{images as H}from"../utils/emoji.js";import{formatTime as b,simplifyMessage as w,downloadFile as N}from"../utils/index.js";import{MESSAGE_TYPE as P}from"../constants/index.js";import{useScrollLoading as x}from"../hooks/useScrollLoading.js";import{AddCircleOutline as D,ChatbubbleEllipsesOutline as O,EllipsisHorizontal as G}from"@vicons/ionicons5";const R={key:0,class:"time"},J={key:2,class:"message-box"},K=["data-time"],U={key:0,class:"reference-content"},q=["innerHTML"],z=["innerHTML"],F=["src"],X=["href","onClick"],B={class:"quick-menu"};var Q=e({__name:"ChatMain",setup(e){const Q=t(),{state:V,setMsgList:W}=L(),{setCurrentSessionItem:Y}=_(V),Z={page:0,hasMore:!0,lastSendTime:h(new Date,"yyyy-MM-dd HH:mm:ss")};async function $(){try{if(!Z.hasMore)return;Z.page++;const e=await k({sessionKey:V.currentSessionItem.sessionKey,page:Z.page,lastSendTime:Z.lastSendTime});if(!Array.isArray(e)||0===e.length)return Z.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=I(e).id;Z.lastSendTime=E(e).sendTime,W(Z.page>1?[...e,...V.msgList]:e),1===Z.page&&V.currentSessionItem.unreadNum&&(await S({chatType:"SINGLE",messageIdSet:[t],receiver:V.userInfo.id,sender:V.currentSessionItem.receiver}),Y({unreadNum:0}))}catch(e){console.log(e)}}function ee(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==P.TEMPLATE||!!n}function te(e,t){var n,s;const{chatMessageType:o,messageTemplate:r}=e.content;if(o===P.TEMPLATE)return"system"===t?2==(null==(n=null==r?void 0:r.setting)?void 0:n.style.id):2!=(null==(s=null==r?void 0:r.setting)?void 0:s.style.id)}function ne(e){var t,n;const{chatMessageType:s,messageTemplate:o}=e;return s===P.TEMPLATE&&3==(null==(n=null==(t=null==o?void 0:o.setting)?void 0:t.style)?void 0:n.id)}function se(e,t){var n;const s=j(e.sendTime)?e.sendTime:Date.parse(e.sendTime),o=null==(n=V.msgList[t-1])?void 0:n.sendTime;return s-(0===t?0:j(o)?o:Date.parse(o))>3e5}return x(Q,(()=>{$()}),"top"),n((()=>V.id),(e=>{e&&(Object.assign(Z,{page:0,hasMore:!0,lastSendTime:h(new Date,"yyyy-MM-dd HH:mm:ss")}),$())}),{immediate:!0}),n((()=>V.isAppendMsg),(e=>{e&&(W([...V.msgList,V.currentMsg]),V.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=Q.value)?void 0:e.scrollHeight)?t:0;null==(n=Q.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(s(),o("div",{class:r(["chat-main",{"home-bg":!i(V).id}]),ref_key:"chatMainRef",ref:Q},[a(i(g),{"show-toolbar-tooltip":""},{default:c((()=>[(s(!0),o(m,null,l(i(V).msgList,((e,t)=>(s(),o(m,{key:t},[ee(e)?(s(),o("div",{key:0,class:r(["message-item",{"message-item--mine":e.sender==i(V).userInfo.id}])},[se(e,t)?(s(),o("p",R,u(i(b)(e.sendTime).recordTime),1)):d("v-if",!0),te(e,"system")?(s(),p(C,{key:1,data:e},null,8,["data"])):(s(),o("div",J,[a(A,{"user-id":e.sender},{trigger:c((()=>[a(i(y),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id"]),e.content?(s(),o("div",{key:0,class:r(["content",{emoji:e.content.chatMessageType===i(P).EMOJI,template:e.content.chatMessageType===i(P).TEMPLATE,"template--3":ne(e.content)}]),"data-time":e.__time},[e.content.chatMessageType===i(P).TEXT?(s(),o(m,{key:0},[e.content.referenceContent?(s(),o("div",U,[f("span",null,u(e.content.referenceContent.senderName)+":",1),f("pre",{innerHTML:i(w)(e.content.referenceContent.content)},null,8,q)])):d("v-if",!0),f("pre",{innerHTML:e.__content},null,8,z)],64)):d("v-if",!0),e.content.chatMessageType===i(P).EMOJI?(s(),o("img",{key:1,src:i(H)[e.__content]},null,8,F)):d("v-if",!0),te(e,"template")?(s(),p(C,{key:2,data:e},null,8,["data"])):d("v-if",!0),e.content.chatMessageType===i(P).IMAGE?(s(),p(i(T),{key:3,width:"240",src:e.__content},null,8,["src"])):d("v-if",!0),e.content.chatMessageType===i(P).FILE?(s(),o("a",{key:4,href:e.content.fileUrl,onClick:v((()=>i(N)(e.content.fileUrl,e.__content)),["prevent"])},u(e.__content),9,X)):d("v-if",!0),f("div",B,[a(i(M),{component:i(D)},null,8,["component"]),a(i(M),{component:i(O),onClick:()=>{return t=e,V.currentReferenceMsg=t,void Object.assign(V.currentReferenceMsg,{chatType:"SINGLE",receiver:V.currentSessionItem.receiver,receiverAvatar:V.currentSessionItem.avatar,receiverName:V.currentSessionItem.name});var t}},null,8,["component","onClick"]),a(i(M),{component:i(G)},null,8,["component"])])],10,K)):d("v-if",!0)]))],2)):d("v-if",!0)],64)))),128))])),_:1})],2))}});export{Q as default};
@@ -7,7 +7,9 @@ export declare enum MESSAGE_TYPE {
7
7
  EMOJI = "EMOJI",
8
8
  IMAGE = "IMAGE",
9
9
  TEMPLATE = "TEMPLATE",
10
- BLEND = "BLEND"
10
+ BLEND = "BLEND",
11
+ FORWARD = "FORWARD",
12
+ QUICK_REPLY = "QUICK_REPLY"
11
13
  }
12
14
  /**
13
15
  * 订阅消息类别
@@ -1 +1 @@
1
- var E=(E=>(E.TEXT="TEXT",E.FILE="FILE",E.EMOJI="EMOJI",E.IMAGE="IMAGE",E.TEMPLATE="TEMPLATE",E.BLEND="BLEND",E))(E||{}),I=(E=>(E.JOIN="JOIN",E.LEAVE="LEAVE",E.NEW_SESSION="NEW_SESSION",E.MESSAGE="MESSAGE",E))(I||{});export{E as MESSAGE_TYPE,I as SUBSCRIBE_MESSAGE_TYPE};
1
+ var E=(E=>(E.TEXT="TEXT",E.FILE="FILE",E.EMOJI="EMOJI",E.IMAGE="IMAGE",E.TEMPLATE="TEMPLATE",E.BLEND="BLEND",E.FORWARD="FORWARD",E.QUICK_REPLY="QUICK_REPLY",E))(E||{}),I=(E=>(E.JOIN="JOIN",E.LEAVE="LEAVE",E.NEW_SESSION="NEW_SESSION",E.MESSAGE="MESSAGE",E))(I||{});export{E as MESSAGE_TYPE,I as SUBSCRIBE_MESSAGE_TYPE};
@@ -1 +1 @@
1
- import{computed as s}from"vue";import{transformLastMessage as e}from"../utils/index.js";import{uniqBy as t}from"lodash-es";function n(n){function i(s){Object.assign(n.currentSessionItem,s,{lastMessageContent:s.lastMessage?e(s.lastMessage):n.currentSessionItem.lastMessageContent||""}),n.isChangeSession=!0,n.id!==n.currentSessionItem.id&&(n.msgList=[],n.id=n.currentSessionItem.id)}return{openSession:async function(s){i(s)},closeSession:function(){if(!n.id)return null;const{currentSessionItem:s}=n;return n.currentSessionItem={},n.msgList=[],n.id="",s},getCurrentSession:function(){return n.id?n.currentSessionItem:null},setCurrentSessionItem:i,setUpdateSessionItem:function(s){Object.assign(n.updateSessionItem,s,{lastMessageContent:s.lastMessage?e(s.lastMessage):""}),n.isUpdateSession=!0},unreadTotal:s((()=>n.sessionList.reduce(((s,e)=>s+ +e.unreadNum),0))),setSessionList:function(s){n.sessionList=t(s.map((s=>{const{lastMessage:t}=s;return{...s,lastMessageContent:Reflect.has(s,"lastMessageContent")?s.lastMessageContent:t?e(t):""}})),"id")}}}export{n as useSession};
1
+ import{computed as s}from"vue";import{simplifyMessage as e}from"../utils/index.js";import{uniqBy as t}from"lodash-es";function n(n){function i(s){Object.assign(n.currentSessionItem,s,{lastMessageContent:s.lastMessage?e(s.lastMessage):n.currentSessionItem.lastMessageContent||""}),n.isChangeSession=!0,n.id!==n.currentSessionItem.id&&(n.msgList=[],n.id=n.currentSessionItem.id)}return{openSession:async function(s){i(s)},closeSession:function(){if(!n.id)return null;const{currentSessionItem:s}=n;return n.currentSessionItem={},n.msgList=[],n.id="",s},getCurrentSession:function(){return n.id?n.currentSessionItem:null},setCurrentSessionItem:i,setUpdateSessionItem:function(s){Object.assign(n.updateSessionItem,s,{lastMessageContent:s.lastMessage?e(s.lastMessage):""}),n.isUpdateSession=!0},unreadTotal:s((()=>n.sessionList.reduce(((s,e)=>s+ +e.unreadNum),0))),setSessionList:function(s){n.sessionList=t(s.map((s=>{const{lastMessage:t}=s;return{...s,lastMessageContent:Reflect.has(s,"lastMessageContent")?s.lastMessageContent:t?e(t):""}})),"id")}}}export{n as useSession};
@@ -13,6 +13,7 @@ export declare type IState = {
13
13
  isChangeSession: boolean;
14
14
  updateSessionItem: AnyObject;
15
15
  isUpdateSession: boolean;
16
+ currentReferenceMsg: AnyObject;
16
17
  };
17
18
  export declare const InjectionIChatState: InjectionKey<IState>;
18
19
  export declare const InjectionIChatStompClient: InjectionKey<Ref<ChatSock>>;
@@ -6,6 +6,6 @@ export declare function formatTime(dateStr: string): {
6
6
  };
7
7
  export declare function listSort(list: AnyObject[]): AnyObject[];
8
8
  export declare function transformMessage(content: string): string;
9
- export declare function transformLastMessage(lastMessage: AnyObject): any;
9
+ export declare function simplifyMessage(lastMessage: AnyObject): any;
10
10
  export declare function downloadFile(url: string, filename: string): void;
11
11
  export declare function getFileSize(url: string): Promise<unknown>;
@@ -1 +1 @@
1
- import{isToday as e,format as t,isYesterday as n}from"date-fns";import{cloneDeep as r}from"lodash-es";import{MESSAGE_TYPE as o}from"../constants/index.js";import{images as a}from"./emoji.js";function s(r){const o=new Date(r);let a,s;if(e(o))a=s=t(o,"HH:mm");else{a=n(o)?"昨天":t(o,"MM-dd");const e=o.getFullYear(),r=(new Date).getFullYear();s=t(o,e<r?"yyyy年M月d日 HH:mm":"M月d日 HH:mm")}return{siderMsgTime:a,msgTime:s,recordTime:function(r){const o=new Date(r),a=Date.now()-o.getTime();if(a<6e4)return"刚刚";if(a<36e5)return Math.ceil(a/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 i(e){return r(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 c(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 l(e){var t;const{chatMessageType:n,msg:r,messageTemplate:s}=e;switch(n){case o.TEXT:return c(r);case o.IMAGE:return"[图片]";case o.FILE:return"[文件]";case o.EMOJI:return`<img alt=${r} src=${a.value[r]}>`;case o.TEMPLATE:return null==(t=null==s?void 0:s.setting)?void 0:t.title;default:return"其他消息"}}function u(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 m(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()}))}export{u as downloadFile,s as formatTime,m as getFileSize,i as listSort,l as transformLastMessage,c as transformMessage};
1
+ import{isToday as e,format as t,isYesterday as n}from"date-fns";import{cloneDeep as r}from"lodash-es";import{MESSAGE_TYPE as o}from"../constants/index.js";import{images as a}from"./emoji.js";function s(r){const o=new Date(r);let a,s;if(e(o))a=s=t(o,"HH:mm");else{a=n(o)?"昨天":t(o,"MM-dd");const e=o.getFullYear(),r=(new Date).getFullYear();s=t(o,e<r?"yyyy年M月d日 HH:mm":"M月d日 HH:mm")}return{siderMsgTime:a,msgTime:s,recordTime:function(r){const o=new Date(r),a=Date.now()-o.getTime();if(a<6e4)return"刚刚";if(a<36e5)return Math.ceil(a/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 i(e){return r(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 c(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 l(e){var t;const{chatMessageType:n,msg:r,messageTemplate:s}=e;switch(n){case o.TEXT:return c(r);case o.IMAGE:return"[图片]";case o.FILE:return"[文件]";case o.EMOJI:return`<img alt=${r} src=${a.value[r]}>`;case o.TEMPLATE:return null==(t=null==s?void 0:s.setting)?void 0:t.title;default:return"其他消息"}}function u(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 m(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()}))}export{u as downloadFile,s as formatTime,m as getFileSize,i as listSort,l as simplifyMessage,c as transformMessage};