cnhis-design-vue 3.2.7-release.0 → 3.2.7-release.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. package/README.md +87 -87
  2. package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
  3. package/es/components/fabric-chart/src/constants/index.d.ts +3 -1
  4. package/es/components/fabric-chart/src/constants/index.js +1 -1
  5. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
  6. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.d.ts +8 -3
  7. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
  8. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.d.ts +9 -6
  9. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.js +1 -1
  10. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcess.js +1 -1
  11. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcessChart.d.ts +0 -2
  12. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcessChart.js +1 -1
  13. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.d.ts +8 -3
  14. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  15. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  16. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  17. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.d.ts +8 -3
  18. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
  19. package/es/components/fabric-chart/src/hooks/useScaleColumn.d.ts +1 -1
  20. package/es/components/fabric-chart/src/hooks/useScaleColumn.js +1 -1
  21. package/es/components/fabric-chart/src/interface.d.ts +11 -1
  22. package/es/components/form-config/index.d.ts +3 -3
  23. package/es/components/form-config/src/FormConfig.vue.d.ts +3 -3
  24. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +3 -3
  25. package/es/components/form-render/src/hooks/useFormValidator.js +1 -1
  26. package/es/components/form-render/src/types/fieldItem.d.ts +2 -1
  27. package/es/components/iho-chat/index.d.ts +51 -2
  28. package/es/components/iho-chat/src/Index.vue.d.ts +51 -2
  29. package/es/components/iho-chat/src/Index.vue2.js +1 -1
  30. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
  31. package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +29 -2
  32. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  33. package/es/components/iho-chat/src/components/ChatRecord.vue2.js +1 -1
  34. package/es/components/iho-chat/src/components/ContextMenu.d.ts +15 -2
  35. package/es/components/iho-chat/src/components/ContextMenu.js +1 -1
  36. package/es/components/iho-chat/src/hooks/useScrollLoading.d.ts +1 -1
  37. package/es/components/iho-chat/src/hooks/useScrollLoading.js +1 -1
  38. package/es/components/iho-chat/style/index.css +1 -1
  39. package/es/components/index.css +1 -1
  40. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  41. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  42. package/es/components/shortcut-setter/index.d.ts +1 -1
  43. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -1
  44. package/es/env.d.ts +25 -25
  45. package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
  46. package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
  47. package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
  48. package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
  49. package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
  50. package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
  51. package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
  52. package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
  53. package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
  54. package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
  55. package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
  56. package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
  57. package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
  58. package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
  59. package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
  60. package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
  61. package/es/shared/assets/img/failure.png.js +1 -1
  62. package/es/shared/assets/img/no-permission.png.js +1 -1
  63. package/es/shared/assets/img/nodata.png.js +1 -1
  64. package/es/shared/assets/img/notfound.png.js +1 -1
  65. package/es/shared/assets/img/qr.png.js +1 -1
  66. package/es/shared/assets/img/success.png.js +1 -1
  67. package/es/shared/assets/img/table_style_2.png.js +1 -1
  68. package/es/shared/assets/img/video.png.js +1 -1
  69. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  70. package/es/shared/assets/img/xb_big.png.js +1 -1
  71. package/es/shared/assets/img/xb_small.png.js +1 -1
  72. package/es/shared/package.json.js +1 -1
  73. package/package.json +2 -2
  74. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  75. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  76. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  77. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  78. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  79. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  80. package/es/shared/utils/tapable/index.d.ts +0 -139
@@ -1 +1 @@
1
- import{ref as e,computed as a,reactive as t,watch as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as i}from"../useCumputedPoint.js";import{useCanvasEvent as n}from"../useEvent.js";import{setOtherType as r,getFloorNumber as o}from"../../utils/index.js";import{flatten as v}from"lodash-es";import{format as s,addDays as d}from"date-fns";import"naive-ui";import"@vueuse/core";import{useTop as c}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useRight as h}from"./useRight.js";import{useCenter as g}from"./useCenter.js";import{useBottom as m}from"./useBottom.js";import{useOther as f}from"./useOther.js";function y(y,S,Y,b,w,C){const x=15,D=e(),j=e(),V=e(),H=a((()=>{const{painSurplusCell:e=[0,0]}=S.data.grid||{};return~_.value?e:[0,0]})),X=a((()=>{var e,a;const t=(null==(a=null==(e=S.data.grid)?void 0:e.surplusCell)?void 0:a.slice())||[0,0,0,0];return 0===_.value?t[0]=t[0]+H.value[1]:_.value>0&&(t[2]=t[2]+H.value[0]),t})),L=a((()=>0===_.value?[H.value[0],X.value[1],X.value[2],X.value[3]]:_.value>0?[X.value[0],X.value[1],H.value[1],X.value[3]]:X.value)),P=a((()=>{const{top:e}=S.data;return e.date.show&&(e.date.height||x)||0})),I=a((()=>{var e;const{top:a}=S.data;return(null==(e=a.hospitalDays)?void 0:e.show)&&(a.hospitalDays.height||x)||0})),M=a((()=>{var e;const{top:a}=S.data;return(null==(e=a.operationDays)?void 0:e.show)&&(a.operationDays.height||x)||0})),N=a((()=>{var e,a,t;const{top:l}=S.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||x)||0)+((null==(a=l.xScalevalue)?void 0:a.show)&&null!=(t=l.dayHeight)?t:0)})),O=a((()=>{var e;const{bottom:a}=S.data;return(null==(e=null==a?void 0:a.breathing)?void 0:e.show)&&(a.breathing.height||30)||0})),R=a((()=>{const{grid:e}=S.data;return e.mainXCell*e.subXCell+X.value[1]+X.value[3]})),W=a((()=>{const{grid:e}=S.data,a=_.value>0?H.value[1]:H.value[0];return e.mainYCell*e.subYCell+X.value[0]+X.value[2]+a})),$=a((()=>{var e;const{width:a,right:t=null,top:l}=S.data;if(!t)return a;return a-(null!=(e=t.width)?e:0)})),k=a((()=>$.value-X.value[1]*T.value)),G=a((()=>{const{top:e,left:a}=S.data;return e.titleWidth+B.value})),q=a((()=>{const{bottom:e=null,height:a}=S.data;if(!e)return a;return a-(e.height||30)})),z=a((()=>{var e;const{top:a}=S.data,t=a.xScalevalue.show&&(null!=(e=a.dayHeight)?e:0)||0,l=a.xScalevalue.show&&(a.xScalevalue.height||x)||0;return P.value+t+l+I.value+M.value})),T=a((()=>($.value-G.value)/R.value)),A=a((()=>(q.value-z.value)/W.value)),B=a((()=>{var e,a;const{left:t}=S.data;return(null==(e=t.icons)?void 0:e.show)&&((null==(a=t.icons)?void 0:a.width)||100)||0})),E=a((()=>{var e,a;const{top:t,grid:l}=S.data,u=(null==(a=null==(e=t.date.list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],i=t.xScalevalue.times;let n=G.value-T.value;const r=t.date.startDate||s(new Date,"yyyy-MM-dd"),o=u.reduce(((e,a,t)=>0===t?e.concat(r):e.concat(s(d(new Date(r.replace(/-/g,"/")),t),"yyyy-MM-dd"))),[]).map((e=>i.map((a=>{n+=T.value;const t=Date.parse(`${e} ${a.start}`),l=Date.parse(`${e} ${a.end}`);return{start:t,end:l,left:n,center:n+T.value/2,scaleCell:(l-t)/T.value}}))));return v(o)})),F=a((()=>ne("breathe"))),J=a((()=>ne("pulse"))),K=a((()=>ne("temperature"))),Q=a((()=>ne("pain"))),U=a((()=>{var e;return(null==(e=S.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),Z=a((()=>{const{left:e}=S.data;return v(e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((a,t)=>({...a,bigType:r(a.title,e.type),unit:e.unit,dataIndex:t}))))))})),_=a((()=>{var e,a;const{left:t}=S.data,l=t.yScaleValue.findIndex((e=>"pain"===e.type));return l>-1&&(null==(a=null==(e=t.yScaleValue[l].dataList)?void 0:e[0])?void 0:a.show)?l:-1})),ee=a((()=>{const{grid:e}=S.data;return-1===_.value?0:A.value*e.subYCell})),ae=a((()=>{const{left:e}=S.data,a={originY:z.value+H.value[0]*A.value,endY:q.value-H.value[1]*A.value};return 0===_.value&&e.yScaleValue.length>1?a.endY=a.originY+ee.value:_.value===e.yScaleValue.length-1&&(a.originY=a.endY-ee.value),a})),te=a((()=>{const{left:e}=S.data,a={originY:z.value+X.value[0]*A.value,endY:q.value-X.value[2]*A.value};return 0===_.value&&e.yScaleValue.length>1?a.originY=ae.value.endY+X.value[0]*A.value:_.value===e.yScaleValue.length-1&&(a.endY=ae.value.originY-X.value[2]*A.value),a})),le=a((()=>{var e,a;const{top:t,grid:l}=S.data,u=[];for(const i in t)t[i].show&&u.push({...t[i],list:(null==(a=null==(e=t[i].list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,a)=>e.seq-a.seq))})),ue=a((()=>{var e;const{left:a,right:t}=S.data,l=a.yScaleValue.find((e=>"temperature"===e.type)),u=(null==t?void 0:t.yScaleValue)||{};if(null==(e=null==l?void 0:l.list)?void 0:e.length){const e=(null==u?void 0:u.showdetailedScale)?l.list.reduce((e=>{const a=e[e.length-1];return a?e.concat([a+1,a+2]):e.concat([92])}),[]):[],a=l.list.map((e=>o(1.8*e+32)));Object.assign(u,{list:a,detailedList:e,spaceGridNumber:l.spaceGridNumber})}return u})),ie=t({canvasWidth:S.data.width,canvasHeight:S.data.height,borderStyle:{...u,...S.data.borderStyle||{}},selectionStyle:S.data.selectionStyle||{},dateHeight:P.value,hospitalDaysHeight:I.value,operationDaysHeight:M.value,xScalevalueHeight:N.value,topList:le.value,breathingHeight:O.value,hospitalizationDate:S.data.hospitalizationDate,grid:S.data.grid,top:S.data.top,left:S.data.left,right:S.data.right,bottom:S.data.bottom,other:S.data.other,painIndex:_.value,painHeight:ee.value,painOriginY:ae.value,vitalSignsOriginY:te.value,gridXNumber:R.value,gridYNumber:W.value,iconsWidth:B.value,originX:G.value,originY:z.value,endX:$.value,endXLimit:k.value,endY:q.value,xCellWidth:T.value,yCellHeight:A.value,xScaleList:E.value,breatheYCell:F.value,pulseYCell:J.value,temperatureYCell:K.value,painYCell:Q.value,event:U.value,itemList:Z.value,getRightInfo:ue.value,config:S.data.config||{},surplusCell:X.value,painSurplusCell:H.value,mainSurplusCell:L.value});function ne(e){const{yScaleValue:a}=S.data.left,t=a.find((a=>a.type===e)),l=(null==t?void 0:t.list)||[];return l.length?A.value/((l[1]-l[0])/t.spaceGridNumber):0}const{computedX:re,computedY:oe,getXValue:ve,getYValue:se}=i(ie);return l((()=>y.value),(e=>{e&&function(){c(y,ie);const{setPopup:e,isAddPoint:a,updateData:t,redrawPoints:l,clickMenu:u,gridPoints:i,fixedNoRisePoints:r}=g(y,ie,Y,re,oe,ve,se,S.addRenderItem,w,C);j.value=l,V.value=u;const{drawScaleValue:o}=p(y,ie,Y,e,w,re,oe,ve,se,a,t,i);h(y,ie,o),m(y,ie),f(y,ie,Y,re,oe,r);const{select:v}=n(y,ie,Y);D.value=v}()}),{immediate:!0}),{propItems:ie,redrawPoints:j,select:D,clickMenu:V}}export{y as useTemperatureChart};
1
+ import{reactive as e,computed as a,watch as t,toRefs as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as i}from"../useCumputedPoint.js";import{useCanvasEvent as n}from"../useEvent.js";import{setOtherType as r,getFloorNumber as o}from"../../utils/index.js";import{flatten as v}from"lodash-es";import{format as s,addDays as d}from"date-fns";import"naive-ui";import"@vueuse/core";import{useTop as c}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useRight as h}from"./useRight.js";import{useCenter as g}from"./useCenter.js";import{useBottom as m}from"./useBottom.js";import{useOther as f}from"./useOther.js";function y(y,S,Y,w,b,C){const x=15,D=e({select:null,redrawPoints:null,clickMenu:null}),j=a((()=>{const{painSurplusCell:e=[0,0]}=S.data.grid||{};return~U.value?e:[0,0]})),V=a((()=>{var e,a;const t=(null==(a=null==(e=S.data.grid)?void 0:e.surplusCell)?void 0:a.slice())||[0,0,0,0];return 0===U.value?t[0]=t[0]+j.value[1]:U.value>0&&(t[2]=t[2]+j.value[0]),t})),H=a((()=>0===U.value?[j.value[0],V.value[1],V.value[2],V.value[3]]:U.value>0?[V.value[0],V.value[1],j.value[1],V.value[3]]:V.value)),X=a((()=>{const{top:e}=S.data;return e.date.show&&(e.date.height||x)||0})),L=a((()=>{var e;const{top:a}=S.data;return(null==(e=a.hospitalDays)?void 0:e.show)&&(a.hospitalDays.height||x)||0})),P=a((()=>{var e;const{top:a}=S.data;return(null==(e=a.operationDays)?void 0:e.show)&&(a.operationDays.height||x)||0})),M=a((()=>{var e,a,t;const{top:l}=S.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||x)||0)+((null==(a=l.xScalevalue)?void 0:a.show)&&null!=(t=l.dayHeight)?t:0)})),I=a((()=>{var e;const{bottom:a}=S.data;return(null==(e=null==a?void 0:a.breathing)?void 0:e.show)&&(a.breathing.height||30)||0})),N=a((()=>{const{grid:e}=S.data;return e.mainXCell*e.subXCell+V.value[1]+V.value[3]})),k=a((()=>{const{grid:e}=S.data,a=U.value>0?j.value[1]:j.value[0];return e.mainYCell*e.subYCell+V.value[0]+V.value[2]+a})),O=a((()=>{var e;const{width:a,right:t=null,top:l}=S.data;if(!t)return a;return a-(null!=(e=t.width)?e:0)})),R=a((()=>O.value-V.value[1]*q.value)),W=a((()=>{const{top:e,left:a}=S.data;return e.titleWidth+T.value})),$=a((()=>{const{bottom:e=null,height:a}=S.data;if(!e)return a;return a-(e.height||30)})),G=a((()=>{var e;const{top:a}=S.data,t=a.xScalevalue.show&&(null!=(e=a.dayHeight)?e:0)||0,l=a.xScalevalue.show&&(a.xScalevalue.height||x)||0;return X.value+t+l+L.value+P.value})),q=a((()=>(O.value-W.value)/N.value)),z=a((()=>($.value-G.value)/k.value)),T=a((()=>{var e,a;const{left:t}=S.data;return(null==(e=t.icons)?void 0:e.show)&&((null==(a=t.icons)?void 0:a.width)||100)||0})),A=a((()=>{var e,a;const{top:t,grid:l}=S.data,u=(null==(a=null==(e=t.date.list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],i=t.xScalevalue.times;let n=W.value-q.value;const r=t.date.startDate||s(new Date,"yyyy-MM-dd"),o=u.reduce(((e,a,t)=>0===t?e.concat(r):e.concat(s(d(new Date(r.replace(/-/g,"/")),t),"yyyy-MM-dd"))),[]).map((e=>i.map((a=>{n+=q.value;const t=Date.parse(`${e} ${a.start}`),l=Date.parse(`${e} ${a.end}`);return{start:t,end:l,left:n,center:n+q.value/2,scaleCell:(l-t)/q.value}}))));return v(o)})),B=a((()=>ue("breathe"))),E=a((()=>ue("pulse"))),F=a((()=>ue("temperature"))),J=a((()=>ue("pain"))),K=a((()=>{var e;return(null==(e=S.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),Q=a((()=>{const{left:e}=S.data;return v(e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((a,t)=>({...a,bigType:r(a.title,e.type),unit:e.unit,dataIndex:t}))))))})),U=a((()=>{var e,a;const{left:t}=S.data,l=t.yScaleValue.findIndex((e=>"pain"===e.type));return l>-1&&(null==(a=null==(e=t.yScaleValue[l].dataList)?void 0:e[0])?void 0:a.show)?l:-1})),Z=a((()=>{const{grid:e}=S.data;return-1===U.value?0:z.value*e.subYCell})),_=a((()=>{const{left:e}=S.data,a={originY:G.value+j.value[0]*z.value,endY:$.value-j.value[1]*z.value};return 0===U.value&&e.yScaleValue.length>1?a.endY=a.originY+Z.value:U.value===e.yScaleValue.length-1&&(a.originY=a.endY-Z.value),a})),ee=a((()=>{const{left:e}=S.data,a={originY:G.value+V.value[0]*z.value,endY:$.value-V.value[2]*z.value};return 0===U.value&&e.yScaleValue.length>1?a.originY=_.value.endY+V.value[0]*z.value:U.value===e.yScaleValue.length-1&&(a.endY=_.value.originY-V.value[2]*z.value),a})),ae=a((()=>{var e,a;const{top:t,grid:l}=S.data,u=[];for(const i in t)t[i].show&&u.push({...t[i],list:(null==(a=null==(e=t[i].list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,a)=>e.seq-a.seq))})),te=a((()=>{var e;const{left:a,right:t}=S.data,l=a.yScaleValue.find((e=>"temperature"===e.type)),u=(null==t?void 0:t.yScaleValue)||{};if(null==(e=null==l?void 0:l.list)?void 0:e.length){const e=(null==u?void 0:u.showdetailedScale)?l.list.reduce((e=>{const a=e[e.length-1];return a?e.concat([a+1,a+2]):e.concat([92])}),[]):[],a=l.list.map((e=>o(1.8*e+32)));Object.assign(u,{list:a,detailedList:e,spaceGridNumber:l.spaceGridNumber})}return u})),le=e({canvasWidth:S.data.width,canvasHeight:S.data.height,borderStyle:{...u,...S.data.borderStyle||{}},selectionStyle:S.data.selectionStyle||{},dateHeight:X.value,hospitalDaysHeight:L.value,operationDaysHeight:P.value,xScalevalueHeight:M.value,topList:ae.value,breathingHeight:I.value,hospitalizationDate:S.data.hospitalizationDate,grid:S.data.grid,top:S.data.top,left:S.data.left,right:S.data.right,bottom:S.data.bottom,other:S.data.other,painIndex:U.value,painHeight:Z.value,painOriginY:_.value,vitalSignsOriginY:ee.value,gridXNumber:N.value,gridYNumber:k.value,iconsWidth:T.value,originX:W.value,originY:G.value,endX:O.value,endXLimit:R.value,endY:$.value,xCellWidth:q.value,yCellHeight:z.value,xScaleList:A.value,breatheYCell:B.value,pulseYCell:E.value,temperatureYCell:F.value,painYCell:J.value,event:K.value,itemList:Q.value,getRightInfo:te.value,config:S.data.config||{},surplusCell:V.value,painSurplusCell:j.value,mainSurplusCell:H.value});function ue(e){const{yScaleValue:a}=S.data.left,t=a.find((a=>a.type===e)),l=(null==t?void 0:t.list)||[];return l.length?z.value/((l[1]-l[0])/t.spaceGridNumber):0}const{computedX:ie,computedY:ne,getXValue:re,getYValue:oe}=i(le);return t((()=>y.value),(e=>{e&&function(){c(y,le);const{setPopup:e,isAddPoint:a,updateData:t,redrawPoints:l,clickMenu:u,gridPoints:i,fixedNoRisePoints:r}=g(y,le,Y,ie,ne,re,oe,S.addRenderItem,b,C);D.redrawPoints=l,D.clickMenu=u;const{drawScaleValue:o}=p(y,le,Y,e,b,ie,ne,re,oe,a,t,i);h(y,le,o),m(y,le),f(y,le,Y,ie,ne,r);const{select:v}=n(y,le,Y);D.select=v}()}),{immediate:!0}),{propItems:le,...l(D)}}export{y as useTemperatureChart};
@@ -13,4 +13,4 @@ export declare function getScaleInfo(position: string | undefined, x: number, wi
13
13
  textLeft: number;
14
14
  };
15
15
  export declare function drawScaleNumber(text: string | number, item: AnyObject, left: number, top: number): fabric.Text;
16
- export declare function drawScaleLine(item: AnyObject, i: number, lineXMain: number[], lineXSub: number[], baseTop: number, yCellHeight: number, originY: number, _listLen?: number): Array<fabric.Object | fabric.Line>;
16
+ export declare function drawScaleLine(item: AnyObject, i: number, lineXMain: number[], lineXSub: number[], baseTop: number, yCellHeight: number, originY: number, _listLen?: number, _spaceGridNumber?: number): Array<fabric.Object | fabric.Line>;
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";import{defaultTextStyle as t,defaultBorderStyle as n}from"./useDraw.js";function i(e="center",t,n){let i=t+n/2,r=[i-4.5,i+4.5],l=[i-2.5,i+2.5],o=i;return"right"===e&&(i=t,r=[i,i+9],l=[i,i+5],o=r[1]),"left"===e&&(i=t+n,r=[i-9,i],l=[i-5,i],o=r[0]),{lineXMain:r,lineXSub:l,textLeft:o}}function r(n,i,r,l){const{position:o,style:s,scaleNumberStyle:c}=i;return new e.Text(String(n),{...t,originX:"left"==o?"right":"right"==o?"left":"center",left:r,top:l,...s||c||{}})}function l(t,i,r){const l=new e.Line(i,{...n,...t.style||t.scaleLineStyle||{}});r.push(l)}function o(e,t,n,i,r,o,s,c){var u,f;const a=[],h=c||(e.showdetailedScale?2*(null==(u=e.list)?void 0:u.length)-1:null==(f=e.list)?void 0:f.length),d=e.position||"center",p=((e.showdetailedScale?e.spaceGridNumber/2:e.spaceGridNumber)||(c?1:5))*o/5;if(e.showScale&&t!==h-1)for(let o=0;o<5;o++)if(o>0||!e.showNumber||"center"!==d){const c=0==o?n[0]:i[0],u=0==o?n[1]:i[1],f=r-o*p;f>s&&(l(e,[c,f,u,f],a),t==h-2&&4==o&&l(e,[n[0],f-p,n[1],f-p],a))}return a}export{o as drawScaleLine,r as drawScaleNumber,i as getScaleInfo};
1
+ import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";import{defaultTextStyle as t,defaultBorderStyle as n}from"./useDraw.js";function i(e="center",t,n){let i=t+n/2,r=[i-4.5,i+4.5],l=[i-2.5,i+2.5],o=i;return"right"===e&&(i=t,r=[i,i+9],l=[i,i+5],o=r[1]),"left"===e&&(i=t+n,r=[i-9,i],l=[i-5,i],o=r[0]),{lineXMain:r,lineXSub:l,textLeft:o}}function r(n,i,r,l){const{position:o,style:s,scaleNumberStyle:c}=i;return new e.Text(String(n),{...t,originX:"left"==o?"right":"right"==o?"left":"center",left:r,top:l,...s||c||{}})}function l(t,i,r){const l=new e.Line(i,{...n,...t.style||t.scaleLineStyle||{}});r.push(l)}function o(e,t,n,i,r,o,s,c,u){var f,a;const h=[],d=c||(e.showdetailedScale?2*(null==(f=e.list)?void 0:f.length)-1:null==(a=e.list)?void 0:a.length),p=e.position||"center",m=((e.showdetailedScale?e.spaceGridNumber/2:e.spaceGridNumber)||u||5)*o/5;if(e.showScale&&t!==d-1)for(let o=0;o<5;o++)if(o>0||!e.showNumber||"center"!==p){const c=0==o?n[0]:i[0],u=0==o?n[1]:i[1],f=r-o*m;f>s&&(l(e,[c,f,u,f],h),t==d-2&&4==o&&l(e,[n[0],f-m,n[1],f-m],h))}return h}export{o as drawScaleLine,r as drawScaleNumber,i as getScaleInfo};
@@ -1,6 +1,6 @@
1
1
  import { type Ref } from 'vue';
2
2
  import { fabric } from '../../../shared/utils/fabricjs';
3
- import { AnyObject } from '../../../shared/types';
3
+ import { AnyObject, AnyFn } from '../../../shared/types';
4
4
  export type IType = 'temperature' | 'birthProcess' | 'surgicalAnesthesia' | 'electrocardiogram' | 'newBirthProcess' | undefined;
5
5
  export type ILineCoordinate = [number, number, number, number];
6
6
  interface IEvent {
@@ -180,4 +180,14 @@ export type IPointMenuProps = Pick<IPointTipProps, 'show' | 'point'> & {
180
180
  };
181
181
  export type IFabricChartMainParam = [Ref<fabric.Canvas>, any, any, Ref<any>, IPointTipProps, IPointMenuProps];
182
182
  export type IPointer = [number, number];
183
+ export type IexposeMethods = Partial<{
184
+ select: AnyFn | null;
185
+ redrawPoints: AnyFn | null;
186
+ clickMenu: AnyFn | null;
187
+ updatePolyline: AnyFn | null;
188
+ useMeasureRuler: AnyFn | null;
189
+ useCaliper: AnyFn | null;
190
+ useCaliperRuler: AnyFn | null;
191
+ useRectRuler: AnyFn | null;
192
+ }>;
183
193
  export {};
@@ -1911,7 +1911,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
1911
1911
  wrapperStyle?: Record<string, string> | undefined;
1912
1912
  childFieldStrategy?: "checked" | "all" | undefined;
1913
1913
  childWidthMode?: "inner" | "outer" | undefined;
1914
- validator?: ((value: unknown, fieldItem: import("..").FieldItem) => string | void) | undefined;
1914
+ validator?: ((value: unknown, fieldItem: import("..").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
1915
1915
  reactions?: {
1916
1916
  [x: string]: any;
1917
1917
  dependencies?: string[] | undefined;
@@ -2158,7 +2158,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
2158
2158
  wrapperStyle?: Record<string, string> | undefined;
2159
2159
  childFieldStrategy?: "checked" | "all" | undefined;
2160
2160
  childWidthMode?: "inner" | "outer" | undefined;
2161
- validator?: ((value: unknown, fieldItem: import("..").FieldItem) => string | void) | undefined;
2161
+ validator?: ((value: unknown, fieldItem: import("..").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
2162
2162
  reactions?: {
2163
2163
  [x: string]: any;
2164
2164
  dependencies?: string[] | undefined;
@@ -2376,7 +2376,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
2376
2376
  wrapperStyle?: Record<string, string> | undefined;
2377
2377
  childFieldStrategy?: "checked" | "all" | undefined;
2378
2378
  childWidthMode?: "inner" | "outer" | undefined;
2379
- validator?: ((value: unknown, fieldItem: import("..").FieldItem) => string | void) | undefined;
2379
+ validator?: ((value: unknown, fieldItem: import("..").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
2380
2380
  reactions?: {
2381
2381
  [x: string]: any;
2382
2382
  dependencies?: string[] | undefined;
@@ -1914,7 +1914,7 @@ declare const _default: import("vue").DefineComponent<{
1914
1914
  wrapperStyle?: Record<string, string> | undefined;
1915
1915
  childFieldStrategy?: "checked" | "all" | undefined;
1916
1916
  childWidthMode?: "inner" | "outer" | undefined;
1917
- validator?: ((value: unknown, fieldItem: import("../../../components/form-render").FieldItem) => string | void) | undefined;
1917
+ validator?: ((value: unknown, fieldItem: import("../../../components/form-render").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
1918
1918
  reactions?: {
1919
1919
  [x: string]: any;
1920
1920
  dependencies?: string[] | undefined;
@@ -2161,7 +2161,7 @@ declare const _default: import("vue").DefineComponent<{
2161
2161
  wrapperStyle?: Record<string, string> | undefined;
2162
2162
  childFieldStrategy?: "checked" | "all" | undefined;
2163
2163
  childWidthMode?: "inner" | "outer" | undefined;
2164
- validator?: ((value: unknown, fieldItem: import("../../../components/form-render").FieldItem) => string | void) | undefined;
2164
+ validator?: ((value: unknown, fieldItem: import("../../../components/form-render").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
2165
2165
  reactions?: {
2166
2166
  [x: string]: any;
2167
2167
  dependencies?: string[] | undefined;
@@ -2379,7 +2379,7 @@ declare const _default: import("vue").DefineComponent<{
2379
2379
  wrapperStyle?: Record<string, string> | undefined;
2380
2380
  childFieldStrategy?: "checked" | "all" | undefined;
2381
2381
  childWidthMode?: "inner" | "outer" | undefined;
2382
- validator?: ((value: unknown, fieldItem: import("../../../components/form-render").FieldItem) => string | void) | undefined;
2382
+ validator?: ((value: unknown, fieldItem: import("../../../components/form-render").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
2383
2383
  reactions?: {
2384
2384
  [x: string]: any;
2385
2385
  dependencies?: string[] | undefined;
@@ -417,7 +417,7 @@ declare const _default: import("vue").DefineComponent<{
417
417
  wrapperStyle?: Record<string, string> | undefined;
418
418
  childFieldStrategy?: "checked" | "all" | undefined;
419
419
  childWidthMode?: "inner" | "outer" | undefined;
420
- validator?: ((value: unknown, fieldItem: FieldItem) => string | void) | undefined;
420
+ validator?: ((value: unknown, fieldItem: FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
421
421
  reactions?: {
422
422
  [x: string]: any;
423
423
  dependencies?: string[] | undefined;
@@ -664,7 +664,7 @@ declare const _default: import("vue").DefineComponent<{
664
664
  wrapperStyle?: Record<string, string> | undefined;
665
665
  childFieldStrategy?: "checked" | "all" | undefined;
666
666
  childWidthMode?: "inner" | "outer" | undefined;
667
- validator?: ((value: unknown, fieldItem: FieldItem) => string | void) | undefined;
667
+ validator?: ((value: unknown, fieldItem: FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
668
668
  reactions?: {
669
669
  [x: string]: any;
670
670
  dependencies?: string[] | undefined;
@@ -882,7 +882,7 @@ declare const _default: import("vue").DefineComponent<{
882
882
  wrapperStyle?: Record<string, string> | undefined;
883
883
  childFieldStrategy?: "checked" | "all" | undefined;
884
884
  childWidthMode?: "inner" | "outer" | undefined;
885
- validator?: ((value: unknown, fieldItem: FieldItem) => string | void) | undefined;
885
+ validator?: ((value: unknown, fieldItem: FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
886
886
  reactions?: {
887
887
  [x: string]: any;
888
888
  dependencies?: string[] | undefined;
@@ -1 +1 @@
1
- import{arrayed as e}from"../../../../shared/utils/index.js";import{once as a,isNumber as i,isString as m}from"lodash-es";import"vue";import{registerValidateLocale as r,registerValidateRules as s}from"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import{isFunction as l}from"@vueuse/core";import"naive-ui";import{isIdCard as u}from"../utils/business.js";function n(){const a=new Map([["mobile",({validate:e})=>({format:"phone",message:null==e?void 0:e.message})],["integer",({validate:e})=>({format:"integer",message:null==e?void 0:e.message})],["number",({validate:e})=>({format:"number",message:null==e?void 0:e.message})],["id_card",({validate:e})=>({validator(a){var i;if(null!=a&&""!==a)return m(a)&&u(a)?void 0:null!=(i=null==e?void 0:e.message)?i:"该字段不是合法的身份证格式"}})],["regular",({validate:e,regular_expression:a,regular_error_tip:i})=>({pattern:a||(null==e?void 0:e.regular_expression)||"",message:i||(null==e?void 0:e.regular_error_tip)||(null==e?void 0:e.message)||"格式错误"})]]),i={triggerType:"onBlur"};return{createValidatorSchema:function(m){const r=[],{validate:{vali_obj:s,max_length:u,min_length:n,message:o,max_value:t,min_value:g,decimal_length:v}={},validator:d}=m;if(d&&e(d).forEach((e=>{l(e)&&r.push({validator:a=>e(a,m)})})),u&&r.push({max:u,message:o}),n&&r.push({min:n,message:o}),t&&r.push({maximum:t,message:o}),g&&r.push({minimum:g,message:o}),null!=v&&r.push(((e,a)=>{const i=null!=a?a:`小数位数最多${e}位`;return{validator(a){var m;return(null==(m=String(a).split(".")[1])?void 0:m.length)>e?i:""}}})(+v,o)),s){const e=a.get(s)||(({validate:e})=>({format:s,message:null==e?void 0:e.message}));r.push(Object.assign({},i,e(m)))}return r}}}const o=a((()=>{r({"zh-CN":{required:"${alias||name}为必填"}}),s({maximum:(e,a)=>i(Number(a.maximum))&&null!=e&&""!==e&&"/"!==e?(m(e)&&(e=+e),!i(e)||isNaN(e)?"":e>Number(a.maximum)&&a.message||""):"",minimum:(e,a)=>i(Number(a.minimum))&&null!=e&&""!==e&&"/"!==e?(m(e)&&(e=+e),!i(e)||isNaN(e)?"":e<Number(a.minimum)&&a.message||""):""})}));export{n as useFormValidator,o as validateMessageLocale};
1
+ import{arrayed as e}from"../../../../shared/utils/index.js";import{once as a,isNumber as i,isString as m}from"lodash-es";import"vue";import{registerValidateLocale as r,registerValidateRules as s}from"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import{isFunction as l}from"@vueuse/core";import"naive-ui";import{isIdCard as u}from"../utils/business.js";function n(){const a=new Map([["mobile",({validate:e})=>({format:"phone",message:null==e?void 0:e.message})],["integer",({validate:e})=>({format:"integer",message:null==e?void 0:e.message})],["number",({validate:e})=>({format:"number",message:null==e?void 0:e.message})],["id_card",({validate:e})=>({validator(a){var i;if(null!=a&&""!==a)return m(a)&&u(a)?void 0:null!=(i=null==e?void 0:e.message)?i:"该字段不是合法的身份证格式"}})],["regular",({validate:e,regular_expression:a,regular_error_tip:i})=>({pattern:a||(null==e?void 0:e.regular_expression)||"",message:i||(null==e?void 0:e.regular_error_tip)||(null==e?void 0:e.message)||"格式错误"})]]),i={triggerType:"onBlur"};return{createValidatorSchema:function(m){const r=[],{validate:{vali_obj:s,max_length:u,min_length:n,message:o,max_value:t,min_value:g,decimal_length:v}={},validator:d}=m;if(d&&e(d).forEach((e=>{l(e)&&r.push({validator:(a,i,r)=>e(a,m,r)})})),u&&r.push({max:u,message:o}),n&&r.push({min:n,message:o}),t&&r.push({maximum:t,message:o}),g&&r.push({minimum:g,message:o}),null!=v&&r.push(((e,a)=>{const i=null!=a?a:`小数位数最多${e}位`;return{validator(a){var m;return(null==(m=String(a).split(".")[1])?void 0:m.length)>e?i:""}}})(+v,o)),s){const e=a.get(s)||(({validate:e})=>({format:s,message:null==e?void 0:e.message}));r.push(Object.assign({},i,e(m)))}return r}}}const o=a((()=>{r({"zh-CN":{required:"${alias||name}为必填"}}),s({maximum:(e,a)=>i(Number(a.maximum))&&null!=e&&""!==e&&"/"!==e?(m(e)&&(e=+e),!i(e)||isNaN(e)?"":e>Number(a.maximum)&&a.message||""):"",minimum:(e,a)=>i(Number(a.minimum))&&null!=e&&""!==e&&"/"!==e?(m(e)&&(e=+e),!i(e)||isNaN(e)?"":e<Number(a.minimum)&&a.message||""):""})}));export{n as useFormValidator,o as validateMessageLocale};
@@ -1,5 +1,6 @@
1
1
  import { FormRequestDefine } from '../../../../shared/hooks';
2
2
  import { AnyObject, ArrayAble, LowCodeTypes } from '../../../../shared/types';
3
+ import { Field } from '@formily/core';
3
4
  import { SchemaEffectTypes, SchemaTypes } from '@formily/vue';
4
5
  import { VNode } from 'vue';
5
6
  import { DependKeyType, FormCommonState } from '../../../../components/form-render';
@@ -158,7 +159,7 @@ export type FieldItem = {
158
159
  * @param fieldItem 配置参数
159
160
  * @return {void|string} 返回校验信息
160
161
  */
161
- validator: (value: unknown, fieldItem: FieldItem) => void | string;
162
+ validator: (value: unknown, fieldItem: FieldItem, field: Field) => void | string;
162
163
  reactions: ArrayAble<ReactionType>;
163
164
  [key: string]: any;
164
165
  }>;
@@ -16,6 +16,13 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
16
16
  type: StringConstructor;
17
17
  default: string;
18
18
  };
19
+ chatBox: {
20
+ type: BooleanConstructor;
21
+ default: boolean;
22
+ };
23
+ defaultSessionKey: {
24
+ type: StringConstructor;
25
+ };
19
26
  }, {
20
27
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
21
28
  token: {
@@ -34,6 +41,13 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
34
41
  type: StringConstructor;
35
42
  default: string;
36
43
  };
44
+ chatBox: {
45
+ type: BooleanConstructor;
46
+ default: boolean;
47
+ };
48
+ defaultSessionKey: {
49
+ type: StringConstructor;
50
+ };
37
51
  }>> & {
38
52
  "onTemplate-click"?: ((...args: any[]) => any) | undefined;
39
53
  "onUnread-message-update"?: ((...args: any[]) => any) | undefined;
@@ -73,6 +87,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
73
87
  handleUserSearch: () => Promise<void>;
74
88
  initWebSocket: () => void;
75
89
  subscribeSessionList: () => void;
90
+ handleDefaultSession: () => void;
76
91
  subscribeGroupMessage: () => void;
77
92
  subscribeMessage: () => void;
78
93
  handleMessage: (messageVo: import("../../shared/types").AnyObject, chatType: string) => Promise<void>;
@@ -582,7 +597,9 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
582
597
  setMsgList: (list?: import("../../shared/types").AnyObject[]) => void;
583
598
  setCurrentSessionItem: (item: import("../../shared/types").AnyObject) => void;
584
599
  isGroupChat: import("vue").ComputedRef<boolean>;
600
+ contextmenuRef: import("vue").Ref<any>;
585
601
  showMenu: import("vue").Ref<boolean>;
602
+ contextmenuPosition: any;
586
603
  pageInfo: {
587
604
  page: number;
588
605
  hasMore: boolean;
@@ -592,7 +609,19 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
592
609
  '--c-tip-top': string;
593
610
  '--c-tip-gap': string;
594
611
  }>;
612
+ chatMainBounding: import("vue").ComputedRef<{
613
+ height: import("vue").Ref<number>;
614
+ bottom: import("vue").Ref<number>;
615
+ left: import("vue").Ref<number>;
616
+ right: import("vue").Ref<number>;
617
+ top: import("vue").Ref<number>;
618
+ width: import("vue").Ref<number>;
619
+ x: import("vue").Ref<number>;
620
+ y: import("vue").Ref<number>;
621
+ update: () => void;
622
+ }>;
595
623
  getHistoryRecord: () => Promise<void>;
624
+ handleContextmenu: (event: MouseEvent) => Promise<void>;
596
625
  showMessage: (item: import("../../shared/types").AnyObject) => boolean;
597
626
  showTemplateMsg: (item: import("../../shared/types").AnyObject, type: "template" | "system") => boolean | undefined;
598
627
  isTemplate3: (content: import("../../shared/types").AnyObject) => boolean;
@@ -763,13 +792,25 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
763
792
  type: BooleanConstructor;
764
793
  default: boolean;
765
794
  };
766
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("clickMenu" | "update:show")[], "clickMenu" | "update:show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
795
+ position: {
796
+ type: import("vue").PropType<import("vue").CSSProperties>;
797
+ };
798
+ exclude: {
799
+ type: import("vue").PropType<string[]>;
800
+ };
801
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show")[], "select" | "update:show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
767
802
  show: {
768
803
  type: BooleanConstructor;
769
804
  default: boolean;
770
805
  };
806
+ position: {
807
+ type: import("vue").PropType<import("vue").CSSProperties>;
808
+ };
809
+ exclude: {
810
+ type: import("vue").PropType<string[]>;
811
+ };
771
812
  }>> & {
772
- onClickMenu?: ((...args: any[]) => any) | undefined;
813
+ onSelect?: ((...args: any[]) => any) | undefined;
773
814
  "onUpdate:show"?: ((...args: any[]) => any) | undefined;
774
815
  }, {
775
816
  show: boolean;
@@ -1217,10 +1258,18 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
1217
1258
  type: StringConstructor;
1218
1259
  default: string;
1219
1260
  };
1261
+ chatBox: {
1262
+ type: BooleanConstructor;
1263
+ default: boolean;
1264
+ };
1265
+ defaultSessionKey: {
1266
+ type: StringConstructor;
1267
+ };
1220
1268
  }>> & {
1221
1269
  "onTemplate-click"?: ((...args: any[]) => any) | undefined;
1222
1270
  "onUnread-message-update"?: ((...args: any[]) => any) | undefined;
1223
1271
  }, {
1224
1272
  baseURL: string;
1273
+ chatBox: boolean;
1225
1274
  }>>;
1226
1275
  export default IhoChat;
@@ -21,6 +21,13 @@ declare const _default: import("vue").DefineComponent<{
21
21
  type: StringConstructor;
22
22
  default: string;
23
23
  };
24
+ chatBox: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ defaultSessionKey: {
29
+ type: StringConstructor;
30
+ };
24
31
  }, {
25
32
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
26
33
  token: {
@@ -39,6 +46,13 @@ declare const _default: import("vue").DefineComponent<{
39
46
  type: StringConstructor;
40
47
  default: string;
41
48
  };
49
+ chatBox: {
50
+ type: BooleanConstructor;
51
+ default: boolean;
52
+ };
53
+ defaultSessionKey: {
54
+ type: StringConstructor;
55
+ };
42
56
  }>> & {
43
57
  "onTemplate-click"?: ((...args: any[]) => any) | undefined;
44
58
  "onUnread-message-update"?: ((...args: any[]) => any) | undefined;
@@ -78,6 +92,7 @@ declare const _default: import("vue").DefineComponent<{
78
92
  handleUserSearch: () => Promise<void>;
79
93
  initWebSocket: () => void;
80
94
  subscribeSessionList: () => void;
95
+ handleDefaultSession: () => void;
81
96
  subscribeGroupMessage: () => void;
82
97
  subscribeMessage: () => void;
83
98
  handleMessage: (messageVo: AnyObject, chatType: string) => Promise<void>;
@@ -587,7 +602,9 @@ declare const _default: import("vue").DefineComponent<{
587
602
  setMsgList: (list?: AnyObject[]) => void;
588
603
  setCurrentSessionItem: (item: AnyObject) => void;
589
604
  isGroupChat: import("vue").ComputedRef<boolean>;
605
+ contextmenuRef: import("vue").Ref<any>;
590
606
  showMenu: import("vue").Ref<boolean>;
607
+ contextmenuPosition: any;
591
608
  pageInfo: {
592
609
  page: number;
593
610
  hasMore: boolean;
@@ -597,7 +614,19 @@ declare const _default: import("vue").DefineComponent<{
597
614
  '--c-tip-top': string;
598
615
  '--c-tip-gap': string;
599
616
  }>;
617
+ chatMainBounding: import("vue").ComputedRef<{
618
+ height: import("vue").Ref<number>;
619
+ bottom: import("vue").Ref<number>;
620
+ left: import("vue").Ref<number>;
621
+ right: import("vue").Ref<number>;
622
+ top: import("vue").Ref<number>;
623
+ width: import("vue").Ref<number>;
624
+ x: import("vue").Ref<number>;
625
+ y: import("vue").Ref<number>;
626
+ update: () => void;
627
+ }>;
600
628
  getHistoryRecord: () => Promise<void>;
629
+ handleContextmenu: (event: MouseEvent) => Promise<void>;
601
630
  showMessage: (item: AnyObject) => boolean;
602
631
  showTemplateMsg: (item: AnyObject, type: "template" | "system") => boolean | undefined;
603
632
  isTemplate3: (content: AnyObject) => boolean;
@@ -768,13 +797,25 @@ declare const _default: import("vue").DefineComponent<{
768
797
  type: BooleanConstructor;
769
798
  default: boolean;
770
799
  };
771
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("clickMenu" | "update:show")[], "clickMenu" | "update:show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
800
+ position: {
801
+ type: PropType<import("vue").CSSProperties>;
802
+ };
803
+ exclude: {
804
+ type: PropType<string[]>;
805
+ };
806
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show")[], "select" | "update:show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
772
807
  show: {
773
808
  type: BooleanConstructor;
774
809
  default: boolean;
775
810
  };
811
+ position: {
812
+ type: PropType<import("vue").CSSProperties>;
813
+ };
814
+ exclude: {
815
+ type: PropType<string[]>;
816
+ };
776
817
  }>> & {
777
- onClickMenu?: ((...args: any[]) => any) | undefined;
818
+ onSelect?: ((...args: any[]) => any) | undefined;
778
819
  "onUpdate:show"?: ((...args: any[]) => any) | undefined;
779
820
  }, {
780
821
  show: boolean;
@@ -1222,10 +1263,18 @@ declare const _default: import("vue").DefineComponent<{
1222
1263
  type: StringConstructor;
1223
1264
  default: string;
1224
1265
  };
1266
+ chatBox: {
1267
+ type: BooleanConstructor;
1268
+ default: boolean;
1269
+ };
1270
+ defaultSessionKey: {
1271
+ type: StringConstructor;
1272
+ };
1225
1273
  }>> & {
1226
1274
  "onTemplate-click"?: ((...args: any[]) => any) | undefined;
1227
1275
  "onUnread-message-update"?: ((...args: any[]) => any) | undefined;
1228
1276
  }, {
1229
1277
  baseURL: string;
1278
+ chatBox: boolean;
1230
1279
  }>;
1231
1280
  export default _default;
@@ -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 d,withCtx as u,createBlock as l,Fragment as p,createElementVNode as m,renderSlot as h,createCommentVNode as f}from"vue";import{NConfigProvider as g,NSpin as v,NLayout as S,NLayoutContent as y}from"naive-ui";import b from"./components/SiderList.vue.js";import I from"./components/ChatHeader.vue.js";import M from"./components/ChatMain.vue.js";import T from"./components/ChatFooter.vue.js";import k from"./components/ChatSearch.vue.js";import V from"./components/ChatAdd.vue.js";import j from"./components/Video.vue.js";import w from"./components/MultipleVideo.vue.js";import{ChatSock as N}from"./utils/chatSock.js";import{instanceAxios as L,listUserApi as U,readMessageApi as _}from"./api/index.js";import{useTheme as A}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isArray as C,isNumber as O}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{CHAT_TYPE as R,SUBSCRIBE_MESSAGE_TYPE as x,AV_STATUS as G}from"./constants/index.js";import{InjectionIChatState as E,InjectionIChatStompClient as J,InjectionIChatEmits as K}from"./types/index.js";import{isAudioOrVideoMessage as P}from"./utils/index.js";import{useSession as $}from"./hooks/useSession.js";import"trtc-sdk-v5";const q={class:"iho-chat__header"},z={class:"toolbar"};var F=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:F,emit:H}){const B=e;L.defaults.baseURL=B.baseURL,L.defaults.headers.Authorization="bearer "+B.token;const D=A(),W=s(!1),Y=s(),Q=o({orgId:B.orgId,currentSessionItem:{},id:"",userInfo:{id:B.userId},msgList:[],currentMsg:{},isAppendMsg:!1,sessionList:[],isChangeSession:!1,updateSessionItem:{},isUpdateSession:!1,currentReferenceMsg:null,showVideo:!1,currentAVMsg:{},userList:[],currentGroupUser:[],showMultipleVideo:!1});t(E,Q),t(J,Y),t(K,H);const{openSession:X,closeSession:Z,getCurrentSession:ee,setSessionList:se,setUpdateSessionItem:oe,setCurrentSessionItem:te}=$(Q),re=[];function ne(){const e={headers:{AccessToken:B.token,UserId:B.userId},heartbeatFn(){try{Y.value.send("test")}catch(e){Y.value.disconnect(),ne()}},connectCb(){console.log("连接成功"),Y.value.subscribe("/user/topic/single",(({body:e})=>ae({body:e,chatType:R.SINGLE}))),Y.value.subscribe("/app/sessionList",(({body:e})=>{try{const s=JSON.parse(e),{authentication:o,currentUser:t,sessionVos:r}=s;if(console.log("body",s),Object.assign(Q.userInfo,t,o),!(null==r?void 0:r.length))return;se(r),re.splice(0,re.length),re.push(...r.filter((e=>e.chatType===R.GROUP))),re.forEach((e=>{Y.value.subscribe(`/topic/group/${e.receiver}`,(({body:e})=>ae({body:e,chatType:R.GROUP})))}))}catch(e){console.log(e)}}))},errorCb(e,s){console.log("断线了,正在重连...")}};Y.value=new N("/fdp-chat/websocket",e)}async function ie(e,s){if(Q.currentMsg=e,e.sessionKey===Q.currentSessionItem.sessionKey)return Q.isAppendMsg=!0,e.sender!==Q.userInfo.id&&await _({chatType:s,messageIdSet:[e.id],receiver:Q.userInfo.id,sender:e.sender}),void te({lastMessageSendTime:e.sendTime,lastMessage:e.content,sortTime:e.sendTime,unreadNum:0,lastSenderName:e.senderName});const o={lastMessageSendTime:e.sendTime,sortTime:e.sendTime,lastMessage:e.content,sessionKey:e.sessionKey,lastSenderName:e.senderName};oe(o)}async function ae({body:e,chatType:s}){try{console.log(JSON.parse(e),"订阅新增消息");const o=JSON.parse(e),{messageVo:t,sessionVo:r,chatAvStatusVo:n}=o;switch(o.event){case x.MESSAGE:P(t.content)?!Q.showVideo&&!Q.showMultipleVideo||t.content.avStatus!==G.IN_CALL?(Q.currentMsg=t,Object.assign(Q.currentAVMsg,{strRoomId:t.sessionKey,chatMessageType:t.content.chatMessageType,callMode:t.sender===Q.userInfo.id?"call":"invite",currentMsg:t}),Q.showVideo||Q.showMultipleVideo?ie(t,s):Q.showVideo=!0):(Y.value.send("/app/chat/send",{},JSON.stringify({chatType:R.SINGLE,receiver:t.sender,content:{chatMessageType:t.content.chatMessageType,avStatus:G.CALL_BUSY}})),console.log("用户忙!")):ie(t,s);break;case x.AV_STATUS:Object.assign(Q.currentAVMsg,n,{callMode:n.sender===Q.userInfo.id?"call":"invite",checkedIds:[]}),Q.showVideo||Q.showMultipleVideo?console.log("用户忙!"):Q.showMultipleVideo=!0;break;case x.NEW_SESSION:if(s===R.GROUP)return;oe(r);break;case x.JOIN:if(s===R.GROUP)return;oe(r),Y.value.subscribe(`/topic/group/${r.receiver}`,(({body:e})=>ae({body:e,chatType:R.GROUP})))}}catch(e){console.log(e)}}return async function(){ne(),async function(){const e=await U({orgId:Q.orgId,keyword:"",page:1,pageSize:1e4});if(!C(e.records))return;Q.userList=e.records}()}(),r((()=>{var e;null==(e=Y.value)||e.disconnect()})),F({getUnreadData:function(){return Q.sessionList.filter((e=>O(e.unreadNum)&&e.unreadNum>0))},openSession:X,closeSession:Z,getCurrentSession:ee}),(e,s)=>(n(),i("div",{class:"iho-chat",style:a(c(D))},[d(c(g),{abstract:"",namespace:"iho-chat__popover"},{default:u((()=>[W.value?(n(),l(c(v),{key:0,stroke:"#5585f5"})):(n(),i(p,{key:1},[m("div",q,[d(k),d(V,{title:"发起群聊",mode:"create","default-value":[Q.userInfo.id]},null,8,["default-value"]),m("div",z,[h(e.$slots,"toolbar")])]),d(c(S),{class:"iho-chat__body","has-sider":""},{default:u((()=>[d(b),d(c(y),{class:"chat-content"},{default:u((()=>[d(I),d(M),d(T)])),_:1}),h(e.$slots,"external")])),_:3}),Q.showVideo?(n(),l(j,{key:0})):f("v-if",!0),Q.showMultipleVideo?(n(),l(w,{key:1})):f("v-if",!0)],64))])),_:3})],4))}});export{F as default};
1
+ import{defineComponent as e,ref as s,reactive as o,provide as t,onBeforeUnmount as n,openBlock as r,createElementBlock as i,normalizeStyle as a,unref as c,createVNode as d,withCtx as u,createBlock as l,Fragment as p,createElementVNode as m,renderSlot as h,createCommentVNode as f}from"vue";import{NConfigProvider as g,NSpin as y,NLayout as v,NLayoutContent as S}from"naive-ui";import b from"./components/SiderList.vue.js";import I from"./components/ChatHeader.vue.js";import M from"./components/ChatMain.vue.js";import k from"./components/ChatFooter.vue.js";import T from"./components/ChatSearch.vue.js";import V from"./components/ChatAdd.vue.js";import j from"./components/Video.vue.js";import w from"./components/MultipleVideo.vue.js";import{ChatSock as L}from"./utils/chatSock.js";import{instanceAxios as N,listUserApi as U,readMessageApi as _}from"./api/index.js";import{useTheme as A}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isArray as C,isNumber as O}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{CHAT_TYPE as x,SUBSCRIBE_MESSAGE_TYPE as R,AV_STATUS as G}from"./constants/index.js";import{InjectionIChatState as K,InjectionIChatStompClient as E,InjectionIChatEmits as B}from"./types/index.js";import{isAudioOrVideoMessage as J}from"./utils/index.js";import{useSession as P}from"./hooks/useSession.js";import"trtc-sdk-v5";const $={key:0,class:"iho-chat__header"},q={class:"toolbar"};var z=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"},chatBox:{type:Boolean,default:!1},defaultSessionKey:{type:String}},emits:["template-click","unread-message-update"],setup(e,{expose:z,emit:F}){const H=e;N.defaults.baseURL=H.baseURL,N.defaults.headers.Authorization="bearer "+H.token;const D=A(),W=s(!1),Y=s(),Q=o({orgId:H.orgId,currentSessionItem:{},id:"",userInfo:{id:H.userId},msgList:[],currentMsg:{},isAppendMsg:!1,sessionList:[],isChangeSession:!1,updateSessionItem:{},isUpdateSession:!1,currentReferenceMsg:null,showVideo:!1,currentAVMsg:{},userList:[],currentGroupUser:[],showMultipleVideo:!1});t(K,Q),t(E,Y),t(B,F);const{openSession:X,closeSession:Z,getCurrentSession:ee,setSessionList:se,setUpdateSessionItem:oe,setCurrentSessionItem:te}=P(Q),ne=[];function re(){const e={headers:{AccessToken:H.token,UserId:H.userId},heartbeatFn(){try{Y.value.send("test")}catch(e){Y.value.disconnect(),re()}},connectCb(){console.log("连接成功"),Y.value.subscribe("/user/topic/single",(({body:e})=>ae({body:e,chatType:x.SINGLE}))),Y.value.subscribe("/app/sessionList",(({body:e})=>{try{const s=JSON.parse(e),{authentication:o,currentUser:t,sessionVos:n}=s;if(console.log("body",s),Object.assign(Q.userInfo,t,o),!(null==n?void 0:n.length))return;se(n),ne.splice(0,ne.length),ne.push(...n.filter((e=>e.chatType===x.GROUP))),ne.forEach((e=>{Y.value.subscribe(`/topic/group/${e.receiver}`,(({body:e})=>ae({body:e,chatType:x.GROUP})))})),function(){const e=Q.sessionList.find((e=>e.sessionKey===H.defaultSessionKey));e&&X(e)}()}catch(e){console.log(e)}}))},errorCb(e,s){console.log("断线了,正在重连...")}};Y.value=new L("/fdp-chat/websocket",e)}async function ie(e,s){if(Q.currentMsg=e,e.sessionKey===Q.currentSessionItem.sessionKey)return Q.isAppendMsg=!0,e.sender!==Q.userInfo.id&&await _({chatType:s,messageIdSet:[e.id],receiver:Q.userInfo.id,sender:e.sender}),void te({lastMessageSendTime:e.sendTime,lastMessage:e.content,sortTime:e.sendTime,unreadNum:0,lastSenderName:e.senderName});const o={lastMessageSendTime:e.sendTime,sortTime:e.sendTime,lastMessage:e.content,sessionKey:e.sessionKey,lastSenderName:e.senderName};oe(o)}async function ae({body:e,chatType:s}){try{console.log(JSON.parse(e),"订阅新增消息");const o=JSON.parse(e),{messageVo:t,sessionVo:n,chatAvStatusVo:r}=o;switch(o.event){case R.MESSAGE:J(t.content)?!Q.showVideo&&!Q.showMultipleVideo||t.content.avStatus!==G.IN_CALL?(Q.currentMsg=t,Object.assign(Q.currentAVMsg,{strRoomId:t.sessionKey,chatMessageType:t.content.chatMessageType,callMode:t.sender===Q.userInfo.id?"call":"invite",currentMsg:t}),Q.showVideo||Q.showMultipleVideo?ie(t,s):Q.showVideo=!0):(Y.value.send("/app/chat/send",{},JSON.stringify({chatType:x.SINGLE,receiver:t.sender,content:{chatMessageType:t.content.chatMessageType,avStatus:G.CALL_BUSY}})),console.log("用户忙!")):ie(t,s);break;case R.AV_STATUS:Object.assign(Q.currentAVMsg,r,{callMode:r.sender===Q.userInfo.id?"call":"invite",checkedIds:[]}),Q.showVideo||Q.showMultipleVideo?console.log("用户忙!"):Q.showMultipleVideo=!0;break;case R.NEW_SESSION:if(s===x.GROUP)return;oe(n);break;case R.JOIN:if(s===x.GROUP)return;oe(n),Y.value.subscribe(`/topic/group/${n.receiver}`,(({body:e})=>ae({body:e,chatType:x.GROUP})))}}catch(e){console.log(e)}}return async function(){re(),async function(){const e=await U({orgId:Q.orgId,keyword:"",page:1,pageSize:50});if(!C(e.records))return;Q.userList=e.records}()}(),n((()=>{var e;null==(e=Y.value)||e.disconnect()})),z({getUnreadData:function(){return Q.sessionList.filter((e=>O(e.unreadNum)&&e.unreadNum>0))},openSession:X,closeSession:Z,getCurrentSession:ee}),(s,o)=>(r(),i("div",{class:"iho-chat",style:a(c(D))},[d(c(g),{abstract:"",namespace:"iho-chat__popover"},{default:u((()=>[W.value?(r(),l(c(y),{key:0,stroke:"#5585f5"})):(r(),i(p,{key:1},[e.chatBox?f("v-if",!0):(r(),i("div",$,[d(T),d(V,{title:"发起群聊",mode:"create","default-value":[Q.userInfo.id]},null,8,["default-value"]),m("div",q,[h(s.$slots,"toolbar")])])),d(c(v),{class:"iho-chat__body","has-sider":""},{default:u((()=>[e.chatBox?f("v-if",!0):(r(),l(b,{key:0})),d(c(S),{class:"chat-content"},{default:u((()=>[d(I),d(M),d(k)])),_:1}),h(s.$slots,"external")])),_:3}),Q.showVideo?(r(),l(j,{key:1})):f("v-if",!0),Q.showMultipleVideo?(r(),l(w,{key:2})):f("v-if",!0)],64))])),_:3})],4))}});export{z as default};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,watch as n,withDirectives as o,openBlock as i,createElementBlock as s,normalizeStyle as r,unref as a,createElementVNode as l,toDisplayString as c,createVNode as u,createCommentVNode as d,withCtx as f,Fragment as p,renderList as m,createBlock as g,createTextVNode as y,vShow as h}from"vue";import{NIcon as v,NPopover as M,NButton as k,NTooltip as C,NUpload as _,NUploadTrigger as x}from"naive-ui";import I from"./ChatAdd.vue.js";import{useState as b}from"../hooks/useState.js";import{useSession as w}from"../hooks/useSession.js";import{MESSAGE_TYPE as T,AV_STATUS as z}from"../constants/index.js";import"trtc-sdk-v5";import{simplifyMessage as E}from"../utils/index.js";import{emojis as j}from"../utils/emoji.js";import{uploadFileApi as R}from"../api/index.js";import{CloseCircleOutline as q,CallOutline as L,VideocamOutline as D}from"@vicons/ionicons5";import{xor as O,cloneDeep as A}from"lodash-es";import{uuidGenerator as U}from"../../../../shared/utils/index.js";const V={key:0,class:"reference-content-box"},F={class:"reference-content"},K=["innerHTML"],G={class:"tool-box"},S=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),H={class:"emoji-box"},N=l("span",null,"默认表情",-1),J={class:"list-box"},X=["src"],B=l("i",{class:"chat--iconfont chat--icon-good"},null,-1),P=l("i",{class:"chat--iconfont chat--icon-image"},null,-1),Q=l("i",{class:"chat--iconfont chat--icon-folder"},null,-1),W={class:"btn-box"},Y=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var Z=e({__name:"ChatFooter",setup(e){const Z=t(),$=t(""),{state:ee,sendMessage:te}=b(),{isGroupChat:ne}=w(ee),oe=t(!1);function ie(e,t=[]){const n=U(),o=[],i=t.length>0;ee.showVideo||ee.showMultipleVideo||(i?(o.push(...O(t,[ee.userInfo.id])),Object.assign(ee.currentAVMsg,{callMode:"call",checkedIds:o,strRoomId:n,chatMessageType:e}),ee.showMultipleVideo=!0):te({content:{chatMessageType:e,msg:"",avStatus:z.IN_CALL}}))}function se(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),le()))}function re(){var e,t;$.value=(null==(t=null==(e=Z.value)?void 0:e.innerText)?void 0:t.trim())||""}async function ae(e,t){const{file:n,name:o}=e.file,i=new FormData;i.append("sender",ee.userInfo.id),i.append("file",n);const s=await R(i);if(!s)return console.log("上传失败");ce({chatMessageType:t,msg:t===T.FILE?o:s,url:s})}function le(){if(!($.value.length>2e3))return $.value?void ce({msg:$.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function ce(e){const{chatMessageType:t=T.TEXT,msg:n,url:o}=e,i={msg:n,chatMessageType:t};t===T.FILE&&(i.fileUrl=o),[T.TEXT,T.BLEND].includes(t)&&(Z.value.innerHTML="",$.value=""),ee.currentReferenceMsg&&(i.referenceContent=A(ee.currentReferenceMsg),ee.currentReferenceMsg=null),te({content:i})}return n((()=>ee.currentReferenceMsg),(e=>{var t;e&&(null==(t=Z.value)||t.focus())})),(e,t)=>o((i(),s("section",{class:"chat-footer",style:r({cursor:a(ee).id?"default":"not-allowed"})},[a(ee).currentReferenceMsg?(i(),s("div",V,[l("div",F,[l("span",null,c(a(ee).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:a(E)(a(ee).currentReferenceMsg.content)},null,8,K)]),u(a(v),{component:a(q),onClick:t[0]||(t[0]=()=>a(ee).currentReferenceMsg=null)},null,8,["component"])])):d("v-if",!0),l("div",G,[u(a(M),{show:oe.value,"onUpdate:show":t[1]||(t[1]=e=>oe.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[S])),_:1})])),default:f((()=>[l("div",H,[d(' <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> '),N,l("div",J,[(i(!0),s(p,null,m(a(j).default,(([e,t])=>(i(),g(a(C),{key:e,"show-arrow":!1,trigger:"hover"},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny",onClick:()=>function(e){oe.value=!1,ce({chatMessageType:T.EMOJI,msg:e})}(e)},{icon:f((()=>[l("img",{src:t},null,8,X)])),_:2},1032,["onClick"])])),default:f((()=>[y(" "+c(e),1)])),_:2},1024)))),128))])])])),_:1},8,["show"]),u(a(k),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>ce({chatMessageType:a(T).EMOJI,msg:0}))},{icon:f((()=>[B])),_:1}),u(a(_),{abstract:"",multiple:"",accept:"image/*",onChange:t[3]||(t[3]=e=>ae(e,a(T).IMAGE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[P])),_:2},1032,["onClick"])])),_:1})])),_:1}),u(a(_),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:t[4]||(t[4]=e=>ae(e,a(T).FILE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[Q])),_:2},1032,["onClick"])])),_:1})])),_:1}),a(ne)?(i(),s(p,{key:0},[u(I,{options:a(ee).currentGroupUser,"default-value":[a(ee).userInfo.id],onComfirm:t[5]||(t[5]=e=>ie(a(T).AUDIO,e))},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[u(a(v),{size:"18",component:a(L)},null,8,["component"])])),_:1})])),_:1},8,["options","default-value"]),u(I,{options:a(ee).currentGroupUser,"default-value":[a(ee).userInfo.id],onComfirm:t[6]||(t[6]=e=>ie(a(T).VIDEO,e))},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[u(a(v),{size:"20",component:a(D)},null,8,["component"])])),_:1})])),_:1},8,["options","default-value"])],64)):(i(),s(p,{key:1},[u(a(k),{quaternary:"",size:"tiny",onClick:t[7]||(t[7]=()=>ie(a(T).AUDIO))},{icon:f((()=>[u(a(v),{size:"18",component:a(L)},null,8,["component"])])),_:1}),u(a(k),{quaternary:"",size:"tiny",onClick:t[8]||(t[8]=()=>ie(a(T).VIDEO))},{icon:f((()=>[u(a(v),{size:"20",component:a(D)},null,8,["component"])])),_:1})],64))]),o(l("div",{ref_key:"inputRef",ref:Z,class:"input-box",contenteditable:"",onKeydown:se,onInput:re},null,544),[[h,a(ee).id]]),l("div",W,[Y,u(a(k),{type:"primary",round:"",disabled:!$.value,onClick:le},{default:f((()=>[y("发送")])),_:1},8,["disabled"])])],4)),[[h,a(ee).id]])}});export{Z as default};
1
+ import{defineComponent as e,ref as t,watch as n,withDirectives as o,openBlock as i,createElementBlock as s,normalizeStyle as r,unref as a,createElementVNode as l,toDisplayString as c,createVNode as u,createCommentVNode as d,withCtx as f,Fragment as p,renderList as m,createBlock as g,createTextVNode as y,vShow as h}from"vue";import{NIcon as v,NPopover as M,NButton as k,NTooltip as C,NUpload as _,NUploadTrigger as x}from"naive-ui";import I from"./ChatAdd.vue.js";import{useState as b}from"../hooks/useState.js";import{useSession as w}from"../hooks/useSession.js";import{MESSAGE_TYPE as T,AV_STATUS as z}from"../constants/index.js";import"trtc-sdk-v5";import{simplifyMessage as E}from"../utils/index.js";import{emojis as j}from"../utils/emoji.js";import{uploadFileApi as R}from"../api/index.js";import{CloseCircleOutline as q,CallOutline as L,VideocamOutline as D}from"@vicons/ionicons5";import{xor as O,cloneDeep as A}from"lodash-es";import{uuidGenerator as U}from"../../../../shared/utils/index.js";const V={key:0,class:"reference-content-box"},F={class:"reference-content"},K=["innerHTML"],G={class:"tool-box"},S=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),H={class:"emoji-box"},N=l("span",null,"默认表情",-1),J={class:"list-box"},X=["src"],B=l("i",{class:"chat--iconfont chat--icon-good"},null,-1),P=l("i",{class:"chat--iconfont chat--icon-image"},null,-1),Q=l("i",{class:"chat--iconfont chat--icon-folder"},null,-1),W={class:"btn-box"},Y=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var Z=e({__name:"ChatFooter",setup(e){const Z=t(),$=t(""),{state:ee,sendMessage:te}=b(),{isGroupChat:ne}=w(ee),oe=t(!1);function ie(e,t=[]){const n=U(),o=[],i=t.length>0;ee.showVideo||ee.showMultipleVideo||(i?(o.push(...O(t,[ee.userInfo.id])),Object.assign(ee.currentAVMsg,{callMode:"call",checkedIds:o,strRoomId:n,chatMessageType:e}),ee.showMultipleVideo=!0):te({content:{chatMessageType:e,msg:"",avStatus:z.IN_CALL}}))}function se(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),le()))}function re(){var e,t;$.value=(null==(t=null==(e=Z.value)?void 0:e.innerText)?void 0:t.trim())||""}async function ae(e,t){const{file:n,name:o}=e.file,i=new FormData;i.append("sender",ee.userInfo.id),i.append("file",n);const s=await R(i);if(!s)return console.log("上传失败");ce({chatMessageType:t,msg:t===T.FILE?o:s,url:s})}function le(){if(!($.value.length>2e3))return $.value?void ce({msg:$.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function ce(e){const{chatMessageType:t=T.TEXT,msg:n,url:o}=e,i={msg:n,chatMessageType:t};t===T.FILE&&(i.fileUrl=o),[T.TEXT,T.BLEND].includes(t)&&(Z.value.innerHTML="",$.value=""),ee.currentReferenceMsg&&(i.referenceContent=A(ee.currentReferenceMsg),ee.currentReferenceMsg=null),te({content:i})}return n((()=>ee.currentReferenceMsg),(e=>{var t;e&&(null==(t=Z.value)||t.focus())})),(e,t)=>o((i(),s("section",{class:"chat-footer",style:r({cursor:a(ee).id?"default":"not-allowed"})},[a(ee).currentReferenceMsg?(i(),s("div",V,[l("div",F,[l("span",null,c(a(ee).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:a(E)(a(ee).currentReferenceMsg.content)},null,8,K)]),u(a(v),{component:a(q),onClick:t[0]||(t[0]=()=>a(ee).currentReferenceMsg=null)},null,8,["component"])])):d("v-if",!0),l("div",G,[u(a(M),{show:oe.value,"onUpdate:show":t[1]||(t[1]=e=>oe.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[S])),_:1})])),default:f((()=>[l("div",H,[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> '),N,l("div",J,[(i(!0),s(p,null,m(a(j).default,(([e,t])=>(i(),g(a(C),{key:e,"show-arrow":!1,trigger:"hover"},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny",onClick:()=>function(e){oe.value=!1,ce({chatMessageType:T.EMOJI,msg:e})}(e)},{icon:f((()=>[l("img",{src:t},null,8,X)])),_:2},1032,["onClick"])])),default:f((()=>[y(" "+c(e),1)])),_:2},1024)))),128))])])])),_:1},8,["show"]),u(a(k),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>ce({chatMessageType:a(T).EMOJI,msg:0}))},{icon:f((()=>[B])),_:1}),u(a(_),{abstract:"",multiple:"",accept:"image/*",onChange:t[3]||(t[3]=e=>ae(e,a(T).IMAGE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[P])),_:2},1032,["onClick"])])),_:1})])),_:1}),u(a(_),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:t[4]||(t[4]=e=>ae(e,a(T).FILE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[Q])),_:2},1032,["onClick"])])),_:1})])),_:1}),a(ne)?(i(),s(p,{key:0},[u(I,{options:a(ee).currentGroupUser,"default-value":[a(ee).userInfo.id],onComfirm:t[5]||(t[5]=e=>ie(a(T).AUDIO,e))},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[u(a(v),{size:"18",component:a(L)},null,8,["component"])])),_:1})])),_:1},8,["options","default-value"]),u(I,{options:a(ee).currentGroupUser,"default-value":[a(ee).userInfo.id],onComfirm:t[6]||(t[6]=e=>ie(a(T).VIDEO,e))},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[u(a(v),{size:"20",component:a(D)},null,8,["component"])])),_:1})])),_:1},8,["options","default-value"])],64)):(i(),s(p,{key:1},[u(a(k),{quaternary:"",size:"tiny",onClick:t[7]||(t[7]=()=>ie(a(T).AUDIO))},{icon:f((()=>[u(a(v),{size:"18",component:a(L)},null,8,["component"])])),_:1}),u(a(k),{quaternary:"",size:"tiny",onClick:t[8]||(t[8]=()=>ie(a(T).VIDEO))},{icon:f((()=>[u(a(v),{size:"20",component:a(D)},null,8,["component"])])),_:1})],64))]),o(l("div",{ref_key:"inputRef",ref:Z,class:"input-box",contenteditable:"",onKeydown:se,onInput:re},null,544),[[h,a(ee).id]]),l("div",W,[Y,u(a(k),{type:"primary",round:"",disabled:!$.value,onClick:le},{default:f((()=>[y("发送")])),_:1},8,["disabled"])])],4)),[[h,a(ee).id]])}});export{Z as default};
@@ -1,3 +1,4 @@
1
+ import { CSSProperties } from 'vue';
1
2
  import { AnyObject } from '../../../../shared/types';
2
3
  import { downloadFile, simplifyMessage, isAudioOrVideoMessage, getAVTime } from '../utils';
3
4
  import { MESSAGE_TYPE } from '../constants';
@@ -7,7 +8,9 @@ declare const _default: import("vue").DefineComponent<{}, {
7
8
  setMsgList: (list?: AnyObject[]) => void;
8
9
  setCurrentSessionItem: (item: AnyObject) => void;
9
10
  isGroupChat: import("vue").ComputedRef<boolean>;
11
+ contextmenuRef: import("vue").Ref<any>;
10
12
  showMenu: import("vue").Ref<boolean>;
13
+ contextmenuPosition: any;
11
14
  pageInfo: {
12
15
  page: number;
13
16
  hasMore: boolean;
@@ -17,7 +20,19 @@ declare const _default: import("vue").DefineComponent<{}, {
17
20
  '--c-tip-top': string;
18
21
  '--c-tip-gap': string;
19
22
  }>;
23
+ chatMainBounding: import("vue").ComputedRef<{
24
+ height: import("vue").Ref<number>;
25
+ bottom: import("vue").Ref<number>;
26
+ left: import("vue").Ref<number>;
27
+ right: import("vue").Ref<number>;
28
+ top: import("vue").Ref<number>;
29
+ width: import("vue").Ref<number>;
30
+ x: import("vue").Ref<number>;
31
+ y: import("vue").Ref<number>;
32
+ update: () => void;
33
+ }>;
20
34
  getHistoryRecord: () => Promise<void>;
35
+ handleContextmenu: (event: MouseEvent) => Promise<void>;
21
36
  showMessage: (item: AnyObject) => boolean;
22
37
  showTemplateMsg: (item: AnyObject, type: 'system' | 'template') => boolean | undefined;
23
38
  isTemplate3: (content: AnyObject) => boolean;
@@ -188,13 +203,25 @@ declare const _default: import("vue").DefineComponent<{}, {
188
203
  type: BooleanConstructor;
189
204
  default: boolean;
190
205
  };
191
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("clickMenu" | "update:show")[], "clickMenu" | "update:show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
206
+ position: {
207
+ type: import("vue").PropType<CSSProperties>;
208
+ };
209
+ exclude: {
210
+ type: import("vue").PropType<string[]>;
211
+ };
212
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show")[], "select" | "update:show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
192
213
  show: {
193
214
  type: BooleanConstructor;
194
215
  default: boolean;
195
216
  };
217
+ position: {
218
+ type: import("vue").PropType<CSSProperties>;
219
+ };
220
+ exclude: {
221
+ type: import("vue").PropType<string[]>;
222
+ };
196
223
  }>> & {
197
- onClickMenu?: ((...args: any[]) => any) | undefined;
224
+ onSelect?: ((...args: any[]) => any) | undefined;
198
225
  "onUpdate:show"?: ((...args: any[]) => any) | undefined;
199
226
  }, {
200
227
  show: boolean;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as i,createElementBlock as o,normalizeClass as a,unref as r,normalizeStyle as c,createVNode as l,withCtx as m,Fragment as u,renderList as p,toDisplayString as d,createCommentVNode as v,createBlock as f,createElementVNode as y,withModifiers as g}from"vue";import{NImageGroup as T,NAvatar as h,NImage as M,NIcon as k,NButtonGroup as _,NButton as I}from"naive-ui";import{format as S}from"date-fns";import{getHistoryRecordApi as E,readMessageApi as j}from"../api/index.js";import{useState as L}from"../hooks/useState.js";import{useSession as x}from"../hooks/useSession.js";import{MESSAGE_TYPE as A}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as C,simplifyMessage as b,getAVTime as w,downloadFile as H}from"../utils/index.js";import{first as O,last as z}from"lodash-es";import D from"./PersonProfile.vue.js";import P from"./MessageTemplate.vue.js";import{emojis as q}from"../utils/emoji.js";import N from"./ContextMenu.js";import{useScrollLoading as U}from"../hooks/useScrollLoading.js";import{CallOutline as R,VideocamOutline as G,ChatbubbleEllipsesOutline as J,EllipsisHorizontal as K}from"@vicons/ionicons5";const F={key:0,class:"time"},X={key:2,class:"message-box"},B={key:0,class:"content-box"},Q={class:"name-box"},V=["data-time"],W={key:0,class:"reference-content"},Y=["innerHTML"],Z=["innerHTML"],$=["src"],ee={style:{"margin-left":"8px"}},te=["href","onClick"],ne=y("i",{class:"chat--iconfont chat--icon-face"},null,-1);var se=e({__name:"ChatMain",setup(e){const se=t(),{state:ie,setMsgList:oe}=L(),{setCurrentSessionItem:ae,isGroupChat:re}=x(ie),ce=t(!1),le={page:0,hasMore:!0,lastSendTime:S(new Date,"yyyy-MM-dd HH:mm:ss")},me=n((()=>({"--c-tip-top":re.value?"1px":"-20px","--c-tip-gap":re.value?"10px":"0px"})));async function ue(){try{if(!le.hasMore)return;le.page++;const e=await E({sessionKey:ie.currentSessionItem.sessionKey,page:le.page,lastSendTime:le.lastSendTime});if(!Array.isArray(e)||0===e.length)return le.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=O(e).id;le.lastSendTime=z(e).sendTime,oe(le.page>1?[...e,...ie.msgList]:e),1===le.page&&ie.currentSessionItem.unreadNum&&(await j({chatType:ie.currentSessionItem.chatType,messageIdSet:[t],receiver:ie.userInfo.id,sender:ie.currentSessionItem.receiver}),ae({unreadNum:0}))}catch(e){console.log(e)}}function pe(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==A.TEMPLATE||!!n}function de(e,t){var n,s;const{chatMessageType:i,messageTemplate:o}=e.content;if(i===A.TEMPLATE)return"system"===t?2==(null==(n=null==o?void 0:o.setting)?void 0:n.style.id):2!=(null==(s=null==o?void 0:o.setting)?void 0:s.style.id)}function ve(e){var t,n;const{chatMessageType:s,messageTemplate:i}=e;return s===A.TEMPLATE&&3==(null==(n=null==(t=null==i?void 0:i.setting)?void 0:t.style)?void 0:n.id)}function fe(e,t){var n;const s=new Date(e.sendTime).getTime(),i=null==(n=ie.msgList[t+1])?void 0:n.sendTime;if(i){return s-new Date(i).getTime()>3e5}return!0}return U(se,(()=>{ue()}),"top"),s((()=>ie.id),(e=>{e&&(Object.assign(le,{page:0,hasMore:!0,lastSendTime:S(new Date,"yyyy-MM-dd HH:mm:ss")}),ue())}),{immediate:!0}),s((()=>ie.isAppendMsg),(e=>{e&&(oe([...ie.msgList,ie.currentMsg]),ie.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=se.value)?void 0:e.scrollHeight)?t:0;null==(n=se.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(i(),o("div",{class:a(["chat-main",{"home-bg":!r(ie).id}]),ref_key:"chatMainRef",ref:se,style:c(r(me))},[l(r(T),{"show-toolbar-tooltip":""},{default:m((()=>[(i(!0),o(u,null,p(r(ie).msgList,((e,n)=>(i(),o(u,{key:e.id},[pe(e)?(i(),o("div",{key:0,class:a(["message-item",{"message-item--mine":e.sender==r(ie).userInfo.id}])},[fe(e,n)?(i(),o("p",F,d(e.__sendTime),1)):v("v-if",!0),de(e,"system")?(i(),f(P,{key:1,data:e},null,8,["data"])):(i(),o("div",X,[l(D,{"user-id":e.sender},{trigger:m((()=>[l(r(h),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id"]),e.content?(i(),o("div",B,[y("div",Q,[y("span",{class:"name","data-time":e.__time},d(r(re)?e.senderName:""),9,V)]),y("div",{class:a(["content",{emoji:e.content.chatMessageType===r(A).EMOJI,template:e.content.chatMessageType===r(A).TEMPLATE,"template--3":ve(e.content),"audio-video":r(C)(e.content)}]),onContextmenu:t[0]||(t[0]=g((e=>ce.value=!0),["prevent"]))},[e.content.chatMessageType===r(A).TEXT?(i(),o(u,{key:0},[e.content.referenceContent?(i(),o("div",W,[y("span",null,d(e.content.referenceContent.senderName)+":",1),y("pre",{innerHTML:r(b)(e.content.referenceContent.content)},null,8,Y)])):v("v-if",!0),y("pre",{innerHTML:e.__content},null,8,Z)],64)):v("v-if",!0),e.content.chatMessageType===r(A).EMOJI?(i(),o("img",{key:1,src:r(q).findEmoji(e.__content)},null,8,$)):v("v-if",!0),de(e,"template")?(i(),f(P,{key:2,data:e},null,8,["data"])):v("v-if",!0),e.content.chatMessageType===r(A).IMAGE?(i(),f(r(M),{key:3,width:"240",src:e.__content},null,8,["src"])):v("v-if",!0),r(C)(e.content)?(i(),o(u,{key:4},[l(r(k),{class:a({"is-audio":e.content.chatMessageType===r(A).AUDIO}),component:e.content.chatMessageType===r(A).AUDIO?r(R):r(G)},null,8,["class","component"]),y("span",ee,d(r(w)(e.__content)),1)],64)):v("v-if",!0),e.content.chatMessageType===r(A).FILE?(i(),o("a",{key:5,href:e.content.fileUrl,onClick:g((()=>r(H)(e.content.fileUrl,e.__content)),["prevent"])},d(e.__content),9,te)):v("v-if",!0),v(' <div class="quick-menu">\n\t\t\t\t\t\t\t\t\t<n-icon :component="AddCircleOutline" />\n\t\t\t\t\t\t\t\t\t<n-icon :component="ChatbubbleEllipsesOutline" @click="() => setReferenceMsg(item)" />\n\t\t\t\t\t\t\t\t\t<n-icon :component="EllipsisHorizontal" />\n\t\t\t\t\t\t\t\t</div> '),l(r(_),{class:"quick-menu"},{default:m((()=>[l(r(I),{quaternary:"",size:"tiny"},{icon:m((()=>[ne])),_:1}),l(r(I),{quaternary:"",size:"tiny",onClick:()=>{return t=e,ie.currentReferenceMsg=t,void Object.assign(ie.currentReferenceMsg,{chatType:ie.currentSessionItem.chatType,receiver:ie.currentSessionItem.receiver,receiverAvatar:ie.currentSessionItem.avatar,receiverName:ie.currentSessionItem.name});var t}},{icon:m((()=>[l(r(k),{size:"17",component:r(J)},null,8,["component"])])),_:2},1032,["onClick"]),l(r(I),{quaternary:"",size:"tiny"},{icon:m((()=>[l(r(k),{component:r(K)},null,8,["component"])])),_:1})])),_:2},1024)],34)])):v("v-if",!0)]))],2)):v("v-if",!0)],64)))),128))])),_:1}),l(r(N),{show:ce.value,"onUpdate:show":t[1]||(t[1]=e=>ce.value=e)},null,8,["show"])],6))}});export{se as default};
1
+ import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as o,createElementBlock as i,normalizeClass as a,unref as r,normalizeStyle as l,createVNode as c,withCtx as u,Fragment as m,renderList as p,toDisplayString as d,createCommentVNode as v,createBlock as f,createElementVNode as g,withModifiers as y,nextTick as h}from"vue";import{NImageGroup as T,NAvatar as M,NImage as _,NIcon as k,NButtonGroup as x,NButton as I}from"naive-ui";import{useElementBounding as S}from"@vueuse/core";import{format as j}from"date-fns";import{getHistoryRecordApi as L,readMessageApi as C}from"../api/index.js";import{useState as E}from"../hooks/useState.js";import{useSession as w}from"../hooks/useSession.js";import{MESSAGE_TYPE as A}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as b,simplifyMessage as H,getAVTime as D,downloadFile as O}from"../utils/index.js";import{first as P,last as z}from"lodash-es";import N from"./PersonProfile.vue.js";import R from"./MessageTemplate.vue.js";import{emojis as U}from"../utils/emoji.js";import q from"./ContextMenu.js";import{useScrollLoading as G}from"../hooks/useScrollLoading.js";import{CallOutline as J,VideocamOutline as K,ChatbubbleEllipsesOutline as X,EllipsisHorizontal as B}from"@vicons/ionicons5";const F={key:0,class:"time"},Y={key:2,class:"message-box"},$={key:0,class:"content-box"},Q={class:"name-box"},V=["data-time"],W=["onContextmenu"],Z={key:0,class:"reference-content"},ee=["innerHTML"],te=["innerHTML"],ne=["src"],se={style:{"margin-left":"8px"}},oe=["href","onClick"],ie=g("i",{class:"chat--iconfont chat--icon-face"},null,-1);var ae=e({__name:"ChatMain",setup(e){const ae=t(),{state:re,setMsgList:le}=E(),{setCurrentSessionItem:ce,isGroupChat:ue}=w(re),me=t(),pe=t(!1),de=t({left:0,top:0}),ve={page:0,hasMore:!0,lastSendTime:j(new Date,"yyyy-MM-dd HH:mm:ss")},fe=n((()=>({"--c-tip-top":ue.value?"1px":"-20px","--c-tip-gap":ue.value?"10px":"0px"}))),ge=n((()=>S(ae.value)));async function ye(){try{if(!ve.hasMore)return;ve.page++;const e=await L({sessionKey:re.currentSessionItem.sessionKey,page:ve.page,lastSendTime:ve.lastSendTime});if(!Array.isArray(e)||0===e.length)return ve.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=P(e).id;ve.lastSendTime=z(e).sendTime,le(ve.page>1?[...e,...re.msgList]:e),1===ve.page&&re.currentSessionItem.unreadNum&&(await C({chatType:re.currentSessionItem.chatType,messageIdSet:[t],receiver:re.userInfo.id,sender:re.currentSessionItem.receiver}),ce({unreadNum:0}))}catch(e){console.log(e)}}async function he(e){var t,n,s,o,i;pe.value=!0,await h();const{clientX:a,clientY:r}=e,{width:l,height:c,left:u,top:m}=ge.value,p=null!=(s=null==(n=null==(t=me.value)?void 0:t.$el)?void 0:n.getBoundingClientRect().height)?s:220,d=null!=(i=null==(o=ae.value)?void 0:o.scrollTop)?i:0,v={};a<=u.value+l.value/2?v.left=a-u.value+5+"px":v.right=u.value+l.value-a-5+"px",r-m.value<p/2?v.top=d+5+"px":m.value+c.value-r<=p/2?v.bottom=Math.abs(d)+5+"px":v.top=d+r-m.value-p/2+"px",de.value=v}function Te(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==A.TEMPLATE||!!n}function Me(e,t){var n,s;const{chatMessageType:o,messageTemplate:i}=e.content;if(o===A.TEMPLATE)return"system"===t?2==(null==(n=null==i?void 0:i.setting)?void 0:n.style.id):2!=(null==(s=null==i?void 0:i.setting)?void 0:s.style.id)}function _e(e){var t,n;const{chatMessageType:s,messageTemplate:o}=e;return s===A.TEMPLATE&&3==(null==(n=null==(t=null==o?void 0:o.setting)?void 0:t.style)?void 0:n.id)}function ke(e,t){var n;const s=new Date(e.sendTime).getTime(),o=null==(n=re.msgList[t+1])?void 0:n.sendTime;if(o){return s-new Date(o).getTime()>3e5}return!0}return G(ae,(()=>{ye()}),"top",(()=>{pe.value=!1})),s((()=>re.id),(e=>{e&&(Object.assign(ve,{page:0,hasMore:!0,lastSendTime:j(new Date,"yyyy-MM-dd HH:mm:ss")}),ye())}),{immediate:!0}),s((()=>re.isAppendMsg),(e=>{e&&(le([...re.msgList,re.currentMsg]),re.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=ae.value)?void 0:e.scrollHeight)?t:0;null==(n=ae.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(o(),i("div",{class:a(["chat-main",{"home-bg":!r(re).id}]),ref_key:"chatMainRef",ref:ae,style:l(r(fe))},[c(r(T),{"show-toolbar-tooltip":""},{default:u((()=>[(o(!0),i(m,null,p(r(re).msgList,((e,t)=>(o(),i(m,{key:e.id},[Te(e)?(o(),i("div",{key:0,class:a(["message-item",{"message-item--mine":e.sender==r(re).userInfo.id}])},[ke(e,t)?(o(),i("p",F,d(e.__sendTime),1)):v("v-if",!0),Me(e,"system")?(o(),f(R,{key:1,data:e},null,8,["data"])):(o(),i("div",Y,[c(N,{"user-id":e.sender},{trigger:u((()=>[c(r(M),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id"]),e.content?(o(),i("div",$,[g("div",Q,[g("span",{class:"name","data-time":e.__time},d(r(ue)?e.senderName:""),9,V)]),g("div",{class:a(["content",{emoji:e.content.chatMessageType===r(A).EMOJI,template:e.content.chatMessageType===r(A).TEMPLATE,"template--3":_e(e.content),"audio-video":r(b)(e.content)}]),onContextmenu:y(he,["prevent"])},[e.content.chatMessageType===r(A).TEXT?(o(),i(m,{key:0},[e.content.referenceContent?(o(),i("div",Z,[g("span",null,d(e.content.referenceContent.senderName)+":",1),g("pre",{innerHTML:r(H)(e.content.referenceContent.content)},null,8,ee)])):v("v-if",!0),g("pre",{innerHTML:e.__content},null,8,te)],64)):v("v-if",!0),e.content.chatMessageType===r(A).EMOJI?(o(),i("img",{key:1,src:r(U).findEmoji(e.__content)},null,8,ne)):v("v-if",!0),Me(e,"template")?(o(),f(R,{key:2,data:e},null,8,["data"])):v("v-if",!0),e.content.chatMessageType===r(A).IMAGE?(o(),f(r(_),{key:3,width:"240",src:e.__content},null,8,["src"])):v("v-if",!0),r(b)(e.content)?(o(),i(m,{key:4},[c(r(k),{class:a({"is-audio":e.content.chatMessageType===r(A).AUDIO}),component:e.content.chatMessageType===r(A).AUDIO?r(J):r(K)},null,8,["class","component"]),g("span",se,d(r(D)(e.__content)),1)],64)):v("v-if",!0),e.content.chatMessageType===r(A).FILE?(o(),i("a",{key:5,href:e.content.fileUrl,onClick:y((()=>r(O)(e.content.fileUrl,e.__content)),["prevent"])},d(e.__content),9,oe)):v("v-if",!0),c(r(x),{class:"quick-menu"},{default:u((()=>[c(r(I),{quaternary:"",size:"tiny"},{icon:u((()=>[ie])),_:1}),c(r(I),{quaternary:"",size:"tiny",onClick:()=>{return t=e,re.currentReferenceMsg=t,void Object.assign(re.currentReferenceMsg,{chatType:re.currentSessionItem.chatType,receiver:re.currentSessionItem.receiver,receiverAvatar:re.currentSessionItem.avatar,receiverName:re.currentSessionItem.name});var t}},{icon:u((()=>[c(r(k),{size:"17",component:r(X)},null,8,["component"])])),_:2},1032,["onClick"]),c(r(I),{quaternary:"",size:"tiny"},{icon:u((()=>[c(r(k),{component:r(B)},null,8,["component"])])),_:1})])),_:2},1024)],42,W)])):v("v-if",!0)]))],2)):v("v-if",!0)],64)))),128))])),_:1}),c(r(q),{ref_key:"contextmenuRef",ref:me,show:pe.value,"onUpdate:show":t[0]||(t[0]=e=>pe.value=e),position:de.value},null,8,["show","position"])],6))}});export{ae as default};