cnhis-design-vue 3.2.6-beta.1 → 3.2.6-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -175,6 +175,9 @@ declare const _default: import("vue").DefineComponent<{
175
175
  modelValue: unknown[];
176
176
  componentData: Record<string, any>;
177
177
  } & {
178
+ /**
179
+ * 改变弹窗大小
180
+ */
178
181
  itemKey?: string | Function | undefined;
179
182
  }>, {
180
183
  move: Function;
@@ -90,6 +90,7 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
90
90
  useMeasureRuler: any;
91
91
  useCaliper: any;
92
92
  useCaliperRuler: any;
93
+ useRectRuler: any;
93
94
  updatePolyline: any;
94
95
  getGridInfo: any;
95
96
  init: () => import("../../shared/types").AnyObject;
@@ -84,6 +84,7 @@ declare const _default: import("vue").DefineComponent<{
84
84
  useMeasureRuler: any;
85
85
  useCaliper: any;
86
86
  useCaliperRuler: any;
87
+ useRectRuler: any;
87
88
  updatePolyline: any;
88
89
  getGridInfo: any;
89
90
  init: () => AnyObject;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as r,reactive as t,computed as o,onMounted as s,onBeforeUnmount as a,openBlock as i,createElementBlock as p,normalizeStyle as l,unref as n,createElementVNode as u,Fragment as c,createVNode as h,mergeProps as d,createCommentVNode as m}from"vue";import{fabric as f}from"../../../shared/utils/fabricjs/index.js";import v from"./components/PopupTip.vue.js";import g from"./components/PopupMenu.js";import"./hooks/useDraw.js";import"date-fns";import"lodash-es";import"./hooks/useEvent.js";import{useBirthProcessChart as w}from"./hooks/birthProcess/useBirthProcessChart.js";import{useTemperatureChart as C}from"./hooks/temperature/useTemperatureChart.js";import{useSurgicalAnesthesiaChart as k}from"./hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js";import{useElectrocardiogramChart as y}from"./hooks/electrocardiogram/useElectrocardiogramChart.js";import{useNewBirthProcessChart as j}from"./hooks/newBirthProcess/useNewBirthProcessChart.js";var P=e({__name:"FabricChart",props:{type:{type:String,default:"temperature"},data:{type:Object,required:!0},popupTipRender:{type:Function},addRenderItem:{type:Function}},emits:["change","add","remove","select","add:prevent","click:grid","eventClick"],setup(e,{expose:P,emit:R}){const b=e,x=r(null),I=r(),T=t({show:!1,point:{x:0,y:0},list:[],movable:!1,sourceData:[],isTarget:!1}),M=t({show:!1,point:{x:0,y:0},list:[],target:null}),B=o((()=>{var e;return null==(e=I.value)?void 0:e.wrapperEl})),A=o((()=>({width:`${b.data.width||800}px`,height:`${b.data.height||500}px`}))),{propItems:E,redrawPoints:F,select:S,clickMenu:_,useMeasureRuler:D,useCaliper:G,useCaliperRuler:$,updatePolyline:q,getGridInfo:H}=function(){const e=[I,b,R,x,T,M];switch(b.type){case"birthProcess":return w(...e);case"surgicalAnesthesia":return k(...e,!!b.popupTipRender);case"electrocardiogram":return y(...e);case"newBirthProcess":return j(...e);default:return C(...e)}}();return s((()=>{I.value=new f.Canvas(x.value,{width:E.canvasWidth,height:E.canvasHeight,backgroundColor:"#fff",selection:!1,stopContextMenu:!0,fireRightClick:!0,allowTouchScrolling:!0})})),a((()=>{var e,r,t,o;null==(r=null==(e=I.value)?void 0:e.off)||r.call(e),null==(o=null==(t=I.value)?void 0:t.clear)||o.call(t)})),P({redrawPoints:F,select:S,canvas:I,useMeasureRuler:D,useCaliper:G,useCaliperRuler:$,updatePolyline:q,getGridInfo:H}),(r,t)=>(i(),p("div",{class:"c-fabric-chart",style:l(n(A))},[u("canvas",{ref_key:"canvasRef",ref:x},null,512),n(B)?(i(),p(c,{key:0},[h(v,d({popupTipRender:e.popupTipRender,...T},{propItems:n(E)}),null,16,["propItems"]),h(n(g),d({propItems:n(E)},M,{show:M.show,"onUpdate:show":t[0]||(t[0]=e=>M.show=e),onClickMenu:n(_)}),null,16,["propItems","show","onClickMenu"])],64)):m("v-if",!0)],4))}});export{P as default};
1
+ import{defineComponent as e,ref as r,reactive as t,computed as o,onMounted as s,onBeforeUnmount as a,openBlock as i,createElementBlock as u,normalizeStyle as l,unref as p,createElementVNode as n,Fragment as c,createVNode as h,mergeProps as d,createCommentVNode as m}from"vue";import{fabric as f}from"../../../shared/utils/fabricjs/index.js";import v from"./components/PopupTip.vue.js";import g from"./components/PopupMenu.js";import"./hooks/useDraw.js";import"date-fns";import"lodash-es";import"./hooks/useEvent.js";import{useBirthProcessChart as w}from"./hooks/birthProcess/useBirthProcessChart.js";import{useTemperatureChart as C}from"./hooks/temperature/useTemperatureChart.js";import{useSurgicalAnesthesiaChart as k}from"./hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js";import{useElectrocardiogramChart as R}from"./hooks/electrocardiogram/useElectrocardiogramChart.js";import{useNewBirthProcessChart as y}from"./hooks/newBirthProcess/useNewBirthProcessChart.js";var j=e({__name:"FabricChart",props:{type:{type:String,default:"temperature"},data:{type:Object,required:!0},popupTipRender:{type:Function},addRenderItem:{type:Function}},emits:["change","add","remove","select","add:prevent","click:grid","eventClick"],setup(e,{expose:j,emit:P}){const b=e,x=r(null),I=r(),T=t({show:!1,point:{x:0,y:0},list:[],movable:!1,sourceData:[],isTarget:!1}),M=t({show:!1,point:{x:0,y:0},list:[],target:null}),B=o((()=>{var e;return null==(e=I.value)?void 0:e.wrapperEl})),A=o((()=>({width:`${b.data.width||800}px`,height:`${b.data.height||500}px`}))),{propItems:E,redrawPoints:F,select:S,clickMenu:_,useMeasureRuler:D,useCaliper:G,useCaliperRuler:$,useRectRuler:q,updatePolyline:H,getGridInfo:N}=function(){const e=[I,b,P,x,T,M];switch(b.type){case"birthProcess":return w(...e);case"surgicalAnesthesia":return k(...e,!!b.popupTipRender);case"electrocardiogram":return R(...e);case"newBirthProcess":return y(...e);default:return C(...e)}}();return s((()=>{I.value=new f.Canvas(x.value,{width:E.canvasWidth,height:E.canvasHeight,backgroundColor:"#fff",selection:!1,stopContextMenu:!0,fireRightClick:!0,allowTouchScrolling:!0})})),a((()=>{var e,r,t,o;null==(r=null==(e=I.value)?void 0:e.off)||r.call(e),null==(o=null==(t=I.value)?void 0:t.clear)||o.call(t)})),j({redrawPoints:F,select:S,canvas:I,useMeasureRuler:D,useCaliper:G,useCaliperRuler:$,useRectRuler:q,updatePolyline:H,getGridInfo:N}),(r,t)=>(i(),u("div",{class:"c-fabric-chart",style:l(p(A))},[n("canvas",{ref_key:"canvasRef",ref:x},null,512),p(B)?(i(),u(c,{key:0},[h(v,d({popupTipRender:e.popupTipRender,...T},{propItems:p(E)}),null,16,["propItems"]),h(p(g),d({propItems:p(E)},M,{show:M.show,"onUpdate:show":t[0]||(t[0]=e=>M.show=e),onClickMenu:p(_)}),null,16,["propItems","show","onClickMenu"])],64)):m("v-if",!0)],4))}});export{j as default};
@@ -9,6 +9,7 @@ export declare function useElectrocardiogramChart(canvas: Ref<fabric.Canvas>, pr
9
9
  useMeasureRuler: Ref<any>;
10
10
  useCaliper: Ref<any>;
11
11
  useCaliperRuler: Ref<any>;
12
+ useRectRuler: Ref<any>;
12
13
  getGridInfo: () => {
13
14
  cellWidth: number;
14
15
  cellHeight: number;
@@ -1 +1 @@
1
- import{ref as e,computed as a,reactive as t,unref as u,watch as r}from"vue";import{defaultBorderStyle as l,defaultLineStyle as i,defaultTextStyle as n}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{cloneDeep as o,isNumber as d,last as v}from"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import{ECG as m}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import{useElectrocardiogram as s}from"./useElectrocardiogram.js";import{useMeasureInstrument as c}from"./useMeasureInstrument.js";function g(g,h,f,p,N,b){const M=e(),y=e(),L=e(),x=e(),C=a((()=>h.data.width)),S=a((()=>h.data.height)),w=a((()=>{const{dataList:e=[],config:a={}}=h.data,t=o(e),u=t.find((e=>a.lastDataKey&&e.key===a.lastDataKey));return u?[...t,u]:t})),E=a((()=>(C.value-0)/Y.value)),X=a((()=>(S.value-0)/j.value)),Y=a((()=>{var e,a,t;const{config:u,grid:r}=h.data;if(d(r.gridXNumber))return r.gridXNumber;const l=(null!=(t=null==(a=null==(e=v(w.value))?void 0:e.data)?void 0:a.length)?t:0)/u.hz;return Math.ceil(l/u.mainXCellValue)})),j=a((()=>{const{config:e,grid:a}=h.data;if(d(a.gridYNumber))return a.gridYNumber;const t=w.value.length;return Math.ceil(R.value*t*2/e.mainYCellValue)})),R=a((()=>{var e;const{config:a}=h.data,t=null==(e=v(w.value))?void 0:e.data,u=Math.max(...t)-Math.min(...t);return"uv"===a.valueUnit?.001*u:"v"===a.valueUnit?1e3*u:u})),I=a((()=>{var e;return(null==(e=h.data.grid)?void 0:e.event)||{selectable:!0,evented:!0}})),U=a((()=>{const{mode:e="2-6"}=h.data,[a,t]=e.split("-").map((e=>+e));return{columnNumber:a,rowNumber:t}})),A=a((()=>{const{rowNumber:e}=U.value,a=w.value.length;return Math.round(j.value/(e+(a===m.MAXLINENUMBER?1:0)))})),B=a((()=>{const{width:e,config:a,grid:t}=h.data,{columnNumber:u,rowNumber:r}=U.value,l=e/u,i=w.value.length,n=Math.ceil(A.value/2),o=function(){const{valueUnit:e,mainYCellValue:t}=a,r=w.value[0].data,l=o(Math.max(...r));if(2!==u)return l;const i=w.value[6].data,n=o(Math.max(...i));return Math.max(l,n);function o(a){return("uv"===e?.001*a:"v"===e?1e3*a:a)/t*X.value}}(),d=X.value*n,v=1===u||d<o?X.value*Math.ceil(o/X.value):d,s=4===u?0:E.value;return w.value.map(((e,a)=>{const t=m.MAXLINENUMBER===i&&a===i-1?r:a%r;return{...e,origin:{x:(m.MAXLINENUMBER===i&&a===i-1?0:Math.floor(a/r))*l+s,y:t*(X.value*A.value)+v,rowIdx:t}}}))})),H=a((()=>{var e;const{calibrationLineGridYNumber:a,mainYCellValue:t}=(null==(e=h.data)?void 0:e.config)||{};return a?X.value*a:t?X.value/t:X.value})),V=t({canvasWidth:h.data.width,canvasHeight:h.data.height,borderStyle:{...l,...h.data.borderStyle},lineStyle:{...i,...h.data.lineStyle},titleStyle:{...n,...h.data.titleStyle},measureLineStyle:{...i,...h.data.measureLineStyle},measureTextStyle:{...n,...h.data.measureTextStyle},grid:h.data.grid,originX:0,endX:C.value,originY:0,endY:S.value,xCellWidth:E.value,yCellHeight:X.value,gridXNumber:Y.value,gridYNumber:j.value,event:I.value,dataList:B.value,columnNumber:u(U).columnNumber,rowNumber:u(U).rowNumber,config:h.data.config,calibrationLineHeight:u(H)});return r((()=>g.value),(e=>{e&&function(){const{useMeasureRuler:e,flag:a,useCaliper:t,useCaliperRuler:u}=c(g,V),{updatePolyline:r}=s(g,V,a);y.value=e,L.value=t,x.value=u,M.value=r}()}),{immediate:!0}),{propItems:V,updatePolyline:M,useMeasureRuler:y,useCaliper:L,useCaliperRuler:x,getGridInfo:function(){return{cellWidth:E.value,cellHeight:X.value,smallCellNumber:m.SMALLCELLNUMBER}}}}export{g as useElectrocardiogramChart};
1
+ import{ref as e,computed as a,reactive as t,unref as u,watch as r}from"vue";import{defaultBorderStyle as l,defaultLineStyle as i,defaultTextStyle as n}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{cloneDeep as o,isNumber as d,last as v}from"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import{ECG as s}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import{useElectrocardiogram as m}from"./useElectrocardiogram.js";import{useMeasureInstrument as c}from"./useMeasureInstrument.js";function g(g,h,f,p,N,b){const M=e(),y=e(),L=e(),x=e(),C=e(),R=a((()=>h.data.width)),S=a((()=>h.data.height)),w=a((()=>{const{dataList:e=[],config:a={}}=h.data,t=o(e),u=t.find((e=>a.lastDataKey&&e.key===a.lastDataKey));return u?[...t,u]:t})),E=a((()=>(R.value-0)/Y.value)),X=a((()=>(S.value-0)/j.value)),Y=a((()=>{var e,a,t;const{config:u,grid:r}=h.data;if(d(r.gridXNumber))return r.gridXNumber;const l=(null!=(t=null==(a=null==(e=v(w.value))?void 0:e.data)?void 0:a.length)?t:0)/u.hz;return Math.ceil(l/u.mainXCellValue)})),j=a((()=>{const{config:e,grid:a}=h.data;if(d(a.gridYNumber))return a.gridYNumber;const t=w.value.length;return Math.ceil(I.value*t*2/e.mainYCellValue)})),I=a((()=>{var e;const{config:a}=h.data,t=null==(e=v(w.value))?void 0:e.data,u=Math.max(...t)-Math.min(...t);return"uv"===a.valueUnit?.001*u:"v"===a.valueUnit?1e3*u:u})),U=a((()=>{var e;return(null==(e=h.data.grid)?void 0:e.event)||{selectable:!0,evented:!0}})),A=a((()=>{const{mode:e="2-6"}=h.data,[a,t]=e.split("-").map((e=>+e));return{columnNumber:a,rowNumber:t}})),B=a((()=>{const{rowNumber:e}=A.value,a=w.value.length;return Math.round(j.value/(e+(a===s.MAXLINENUMBER?1:0)))})),H=a((()=>{const{width:e,config:a,grid:t}=h.data,{columnNumber:u,rowNumber:r}=A.value,l=e/u,i=w.value.length,n=Math.ceil(B.value/2),o=function(){const{valueUnit:e,mainYCellValue:t}=a,r=w.value[0].data,l=o(Math.max(...r));if(2!==u)return l;const i=w.value[6].data,n=o(Math.max(...i));return Math.max(l,n);function o(a){return("uv"===e?.001*a:"v"===e?1e3*a:a)/t*X.value}}(),d=X.value*n,v=1===u||d<o?X.value*Math.ceil(o/X.value):d,m=4===u?0:E.value;return w.value.map(((e,a)=>{const t=s.MAXLINENUMBER===i&&a===i-1?r:a%r;return{...e,origin:{x:(s.MAXLINENUMBER===i&&a===i-1?0:Math.floor(a/r))*l+m,y:t*(X.value*B.value)+v,rowIdx:t}}}))})),V=a((()=>{var e;const{calibrationLineGridYNumber:a,mainYCellValue:t}=(null==(e=h.data)?void 0:e.config)||{};return a?X.value*a:t?X.value/t:X.value})),D=t({canvasWidth:h.data.width,canvasHeight:h.data.height,borderStyle:{...l,...h.data.borderStyle},lineStyle:{...i,...h.data.lineStyle},titleStyle:{...n,...h.data.titleStyle},measureLineStyle:{...i,...h.data.measureLineStyle},measureTextStyle:{...n,...h.data.measureTextStyle},grid:h.data.grid,originX:0,endX:R.value,originY:0,endY:S.value,xCellWidth:E.value,yCellHeight:X.value,gridXNumber:Y.value,gridYNumber:j.value,event:U.value,dataList:H.value,columnNumber:u(A).columnNumber,rowNumber:u(A).rowNumber,config:h.data.config,calibrationLineHeight:u(V)});return r((()=>g.value),(e=>{e&&function(){const{useMeasureRuler:e,flag:a,useCaliper:t,useCaliperRuler:u,useRectRuler:r}=c(g,D),{updatePolyline:l}=m(g,D,a);y.value=e,L.value=t,x.value=u,M.value=l,C.value=r}()}),{immediate:!0}),{propItems:D,updatePolyline:M,useMeasureRuler:y,useCaliper:L,useCaliperRuler:x,useRectRuler:C,getGridInfo:function(){return{cellWidth:E.value,cellHeight:X.value,smallCellNumber:s.SMALLCELLNUMBER}}}}export{g as useElectrocardiogramChart};
@@ -6,4 +6,5 @@ export declare function useMeasureInstrument(canvas: Ref<fabric.Canvas>, propIte
6
6
  useMeasureRuler: () => void;
7
7
  useCaliper: () => void;
8
8
  useCaliperRuler: () => void;
9
+ useRectRuler: () => void;
9
10
  };
@@ -1 +1 @@
1
- import{ref as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as o,drawText as r}from"../useDraw.js";import{useElectrocardiogramCumputedPoint as i}from"../useCumputedPoint.js";import"../useEvent.js";import"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function n(n,l){const{getXValue:s,getYValue:u}=i(l),{yCellHeight:a,xCellWidth:c,measureLineStyle:f,measureTextStyle:h}=l,d=e(!1),v={origin:{x:0,y:0},line:null,rendering:!1},p={origin:{x:300,y:0},caliper:{width:4*c,height:60,rect:null},caliperRuler:{width:6*c,height:120,rect:null}};function m(e){C();const{width:o,height:i,rect:l}=p[e];if(l)return;const{x:s,y:u}=p.origin,a=p.caliper.height;p[e].rect=new t.Rect({left:s,top:u,width:o,height:i,strokeWidth:0,fill:"transparent",hasControls:!1,hasBorders:!1,hoverCursor:"move"});const c={...f,hasControls:!1,hasBorders:!1,hoverCursor:"e-resize",strokeWidth:2,__type:e,evented:!0,selectable:!0},d=new t.Line([s,u,s,i],{...c,lockMovementY:!0,originX:"center"}),v=new t.Line([s+o,u,s+o,i],{...c,lockMovementY:!0,originX:"center"}),m=new t.Line([s,a,s+o,a],{...c,lockMovementX:!0,evented:"caliper"===e,hoverCursor:"caliper"===e?"n-resize":"default",originY:"center"}),y=r([s,m.top+10],{value:x(m.x1,m.x2),...h,originX:"left",originY:"top"});d.rect=p[e].rect,v.rect=p[e].rect,m.rect=p[e].rect,Object.assign(p[e].rect,{leftLine:d,rightLine:v,horizontalLine:m,text:y}),function(e,t){e.on("moving",(()=>{const{leftLine:o,rightLine:r,horizontalLine:i,text:n}=e;null==o||o.setCoords().set({x1:e.left,y1:e.top,x2:e.left,y2:e.top+e.height}),null==r||r.setCoords().set({x1:e.left+e.width,y1:e.top,x2:e.left+e.width,y2:e.top+e.height});const l="caliper"===t?e.top+e.height:e.top+e.height/2;null==i||i.setCoords().set({x1:e.left,y1:l,x2:e.left+e.width,y2:l}),n.setCoords().set({left:e.left,top:l+10})})),e.on("mouseup",(t=>{1===t.button&&(n.value.discardActiveObject(),e.leftLine.bringToFront(),e.rightLine.bringToFront(),e.horizontalLine.bringToFront())}))}(p[e].rect,e),g(d,"left"),g(v,"right"),"caliper"===e&&g(m,"horizontal"),n.value.add(p[e].rect,d,v,m,y)}function x(e,t){return`${1e3*s(t-e)}ms`}function g(e,t){e.on("moving",(()=>{const{rect:o}=e;if(!o)return;const{leftLine:r,rightLine:i,horizontalLine:n,text:l}=o;if("horizontal"===t)return e.top<=o.top?e.setCoords().set({y1:o.top,y2:o.top}):e.setCoords().set({y1:e.top,y2:e.top}),o.setCoords().set({height:e.top-o.top}),null==r||r.setCoords().set({y2:e.top}),null==i||i.setCoords().set({y2:e.top}),void l.setCoords().set({top:e.top+10});"left"===t&&(e.left>=i.left?e.setCoords().set({x1:i.left,x2:i.left}):e.setCoords().set({x1:e.left,x2:e.left}),o.setCoords().set({left:e.left,width:i.left-e.left}),n.setCoords().set({x1:e.left}),l.setCoords().set({left:e.left})),"right"===t&&(e.left<=r.left?e.setCoords().set({x1:r.left,x2:r.left}):e.setCoords().set({x1:e.left,x2:e.left}),o.setCoords().set({width:e.left-r.left}),n.setCoords().set({x2:e.left})),l.set("text",x(n.x1,n.x2))}))}function C(){Object.values(p).forEach((e=>{const{rect:t}=e;t&&(n.value.remove(t),n.value.remove(t.leftLine),n.value.remove(t.rightLine),n.value.remove(t.horizontalLine),n.value.remove(t.text),e.rect=null)})),v.line&&(n.value.remove(v.line),v.line.text&&n.value.remove(v.line.text),v.line=null)}return n.value.on("mouse:down",(e=>{if(1===e.button&&d.value){const{x:t=0,y:o=0}=e.pointer||{};v.origin={x:t,y:o},v.rendering=!0}})),n.value.on("mouse:up",(e=>{const{button:t}=e;1===t&&d.value&&setTimeout((()=>{d.value=!1,v.rendering=!1})),3===t&&C()})),n.value.on("mouse:move",(e=>{var t;if(1===e.button&&d.value&&v.rendering){const{x:i=0,y:l=0}=e.pointer||{};v.line&&n.value.remove(v.line),(null==(t=v.line)?void 0:t.text)&&n.value.remove(v.line.text);const{x:c,y:d}=v.origin;v.line=o([c,d,i,l],f);const p=-u(l-d).toFixed(2),m=1e3*s(i-c),x=r([i,l+2*a],{value:`${p}mv\n${m}ms`,...h});v.line.text=x,n.value.add(v.line,x)}})),{flag:d,useMeasureRuler:function(){d.value||(d.value=!0)},useCaliper:function(){m("caliper")},useCaliperRuler:function(){m("caliperRuler")}}}export{n as useMeasureInstrument};
1
+ import{ref as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as o,drawText as r}from"../useDraw.js";import{useElectrocardiogramCumputedPoint as l}from"../useCumputedPoint.js";import"../useEvent.js";import{isNumber as n}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function i(i,s){const{getXValue:u,getYValue:c}=l(s),{yCellHeight:a,xCellWidth:d,measureLineStyle:h,measureTextStyle:f}=s,p=e(!1),v={origin:{x:0,y:0},line:null,rendering:!1},x={origin:{x:300,y:10},caliper:{width:4*d,height:60,rect:null},caliperRuler:{width:6*d,height:120,rect:null},rectRuler:{width:12*d,height:120,rect:null}};function m(e){C();const{width:o,height:l,rect:n}=x[e];if(n)return;let s;const{x:u,y:c}=x.origin,a=c+x.caliper.height,d=["caliper","rectRuler"].includes(e);x[e].rect=new t.Rect({left:u,top:c,width:o,height:l,strokeWidth:0,fill:"transparent",hasControls:!1,hasBorders:!1,hoverCursor:"move"});const p={...h,hasControls:!1,hasBorders:!1,hoverCursor:"e-resize",strokeWidth:2,__type:e,evented:!0,selectable:!0},v=new t.Line([u,c,u,c+l],{...p,lockMovementY:!0,originX:"center"}),m=new t.Line([u+o,c,u+o,c+l],{...p,lockMovementY:!0,originX:"center"}),L=new t.Line([u,a,u+o,a],{...p,lockMovementX:!0,evented:d,hoverCursor:d?"n-resize":"default",originY:"center"});let b=g({x1:L.x1,x2:L.x2}).millisecond;if("rectRuler"===e){const{millivolt:e,millisecond:r,bpm:n}=g({x1:u+o,x2:u,y1:c+l,y2:c});b=`测量幅度:${e}\n测试时间:${r}\n瞬时心率:${n}`,L.set({y1:c,y2:c}),s=new t.Line([u,c+l,u+o,c+l],{...p,lockMovementX:!0,evented:!0,hoverCursor:"n-resize",originY:"center"})}const w=r([u,("rectRuler"===e?s.top:L.top)+10],{value:b,...f,originX:"left",originY:"top",backgroundColor:"#fff"});v.rect=x[e].rect,m.rect=x[e].rect,L.rect=x[e].rect,s&&(s.rect=x[e].rect),Object.assign(x[e].rect,{leftLine:v,rightLine:m,horizontalLine:L,horizontalLine2:s,text:w}),function(e,t){e.on("moving",(()=>{const{leftLine:o,rightLine:r,horizontalLine:l,horizontalLine2:n,text:i}=e;null==o||o.setCoords().set({x1:e.left,y1:e.top,x2:e.left,y2:e.top+e.height}),null==r||r.setCoords().set({x1:e.left+e.width,y1:e.top,x2:e.left+e.width,y2:e.top+e.height});const s=["caliper","rectRuler"].includes(t)?e.top+e.height:e.top+e.height/2;i.setCoords().set({left:e.left,top:s+10}),"rectRuler"===t?(null==l||l.setCoords().set({x1:e.left,x2:e.left+e.width,y1:e.top,y2:e.top}),null==n||n.setCoords().set({x1:e.left,y1:s,x2:e.left+e.width,y2:s})):null==l||l.setCoords().set({x1:e.left,y1:s,x2:e.left+e.width,y2:s})})),e.on("mouseup",(t=>{var o;1===t.button&&(i.value.discardActiveObject(),e.leftLine.bringToFront(),e.rightLine.bringToFront(),e.horizontalLine.bringToFront(),null==(o=e.horizontalLine2)||o.bringToFront())}))}(x[e].rect,e),y(v,"left"),y(m,"right"),d&&y(L,"horizontal"),s&&y(s,"horizontal2");const z=[x[e].rect,v,m,L,s,w].filter((e=>!!e));i.value.add(...z)}function g({x1:e,x2:t,y1:o,y2:r}){const l=(1e3*u(Math.abs(t-e))).toFixed(3);return{millisecond:`${l}ms`,millivolt:`${n(o)&&n(r)?c(Math.abs(r-o)).toFixed(3):0}mv`,bpm:`${(6e4/+l).toFixed(3)}bpm`}}function y(e,t){e.on("moving",(()=>{const{rect:o}=e;if(!o)return;const{leftLine:r,rightLine:l,horizontalLine:n,horizontalLine2:i,text:s}=o;if(("horizontal"===t&&!i||"horizontal2"===t)&&(e.top<=o.top?e.setCoords().set({y1:o.top,y2:o.top}):e.setCoords().set({y1:e.top,y2:e.top}),o.setCoords().set({height:e.top-o.top}),null==r||r.setCoords().set({y2:e.top}),null==l||l.setCoords().set({y2:e.top}),s.setCoords().set({top:e.top+10}),!i))return;"horizontal"===t&&i&&(e.top>=i.top?e.setCoords().set({y1:i.top,y2:i.top}):e.setCoords().set({y1:e.top,y2:e.top}),o.setCoords().set({top:e.top,height:i.top-e.top}),null==r||r.setCoords().set({y1:e.top}),null==l||l.setCoords().set({y1:e.top}),s.setCoords().set({top:i.top+10})),"left"===t&&(e.left>=l.left?e.setCoords().set({x1:l.left,x2:l.left}):e.setCoords().set({x1:e.left,x2:e.left}),o.setCoords().set({left:e.left,width:l.left-e.left}),n.setCoords().set({x1:e.left}),null==i||i.setCoords().set({x1:e.left}),s.setCoords().set({left:e.left})),"right"===t&&(e.left<=r.left?e.setCoords().set({x1:r.left,x2:r.left}):e.setCoords().set({x1:e.left,x2:e.left}),o.setCoords().set({width:e.left-r.left}),n.setCoords().set({x2:e.left}),null==i||i.setCoords().set({x2:e.left}));const{millivolt:u,millisecond:c,bpm:a}=g({x1:n.x1,x2:n.x2,y1:r.y1,y2:r.y2}),d=i?`测量幅度:${u}\n测试时间:${c}\n瞬时心率:${a}`:c;s.set("text",d)}))}function C(){Object.values(x).forEach((e=>{const{rect:t}=e;t&&(i.value.remove(t),t.leftLine&&i.value.remove(t.leftLine),t.rightLine&&i.value.remove(t.rightLine),t.horizontalLine&&i.value.remove(t.horizontalLine),t.horizontalLine2&&i.value.remove(t.horizontalLine2),t.text&&i.value.remove(t.text),e.rect=null)})),v.line&&(i.value.remove(v.line),v.line.text&&i.value.remove(v.line.text),v.line=null)}return i.value.on("mouse:down",(e=>{if(1===e.button&&p.value){const{x:t=0,y:o=0}=e.pointer||{};v.origin={x:t,y:o},v.rendering=!0}})),i.value.on("mouse:up",(e=>{const{button:t}=e;1===t&&p.value&&setTimeout((()=>{p.value=!1,v.rendering=!1})),3===t&&C()})),i.value.on("mouse:move",(e=>{var t;if(1===e.button&&p.value&&v.rendering){const{x:l=0,y:n=0}=e.pointer||{};v.line&&i.value.remove(v.line),(null==(t=v.line)?void 0:t.text)&&i.value.remove(v.line.text);const{x:s,y:u}=v.origin;v.line=o([s,u,l,n],h);const{millivolt:c,millisecond:d}=g({x1:s,x2:l,y1:u,y2:n}),p=r([l,n+2*a],{value:`${c}\n${d}`,...f});v.line.text=p,i.value.add(v.line,p)}})),{flag:p,useMeasureRuler:function(){p.value||(p.value=!0)},useCaliper:function(){m("caliper")},useCaliperRuler:function(){m("caliperRuler")},useRectRuler:function(){m("rectRuler")}}}export{i as useMeasureInstrument};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,watch as n,withDirectives as i,openBlock as o,createElementBlock as s,normalizeStyle as a,unref as r,createElementVNode as l,toDisplayString as c,createVNode as u,createCommentVNode as d,withCtx as f,Fragment as m,renderList as p,createBlock as g,createTextVNode as v,vShow as y}from"vue";import{NIcon as h,NPopover as M,NButton as k,NTooltip as E,NUpload as C,NUploadTrigger as b}from"naive-ui";import{format as T}from"date-fns";import{useState as x}from"../hooks/useState.js";import{useSession as I}from"../hooks/useSession.js";import{emojis as w}from"../utils/emoji.js";import{MESSAGE_TYPE as _}from"../constants/index.js";import{uploadFileApi as S}from"../api/index.js";import{CloseCircleOutline as z}from"@vicons/ionicons5";import{cloneDeep as A}from"lodash-es";import{simplifyMessage as O}from"../utils/index.js";const R={key:0,class:"reference-content-box"},j={class:"reference-content"},D=["innerHTML"],L={class:"tool-box"},q=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),F={class:"emoji-box"},H=l("span",null,"默认表情",-1),K={class:"list-box"},N=["src"],V=l("i",{class:"chat--iconfont chat--icon-good"},null,-1),G=l("i",{class:"chat--iconfont chat--icon-image"},null,-1),U=l("i",{class:"chat--iconfont chat--icon-folder"},null,-1),J={class:"btn-box"},B=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var P=e({__name:"ChatFooter",props:{showAv:{type:Boolean,default:!1}},setup(e){const P=e,X=t(),Y=t(""),{state:Q,stompClient:W}=x(),{setCurrentSessionItem:Z}=I(Q),$=t(!1),ee=t(!1);function te(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),oe()))}function ne(){var e,t;Y.value=(null==(t=null==(e=X.value)?void 0:e.innerText)?void 0:t.trim())||""}async function ie(e,t){const{file:n,name:i}=e.file,o=new FormData;o.append("sender",Q.userInfo.id),o.append("file",n);const s=await S(o);if(!s)return console.log("上传失败");se({chatMessageType:t,msg:t===_.FILE?i:s,url:s})}function oe(){if(!(Y.value.length>2e3))return Y.value?void se({msg:Y.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function se(e){const{chatMessageType:t=_.TEXT,msg:n,url:i}=e,o={msg:n,chatMessageType:t};t===_.FILE&&(o.fileUrl=i),[_.TEXT,_.BLEND].includes(t)&&(X.value.innerHTML="",Y.value=""),Q.currentReferenceMsg&&(o.referenceContent=A(Q.currentReferenceMsg),Q.currentReferenceMsg=null);const s=T(new Date,"yyyy-MM-dd HH:mm:ss");Q.currentMsg={content:o,sender:Q.userInfo.id,senderName:Q.userInfo.name,senderAvatar:Q.userInfo.avatar,id:"",sendTime:s,sending:!0,fail:!1},[_.AUDIO,_.VIDEO].includes(t)||(Q.isAppendMsg=!0),Z({lastMessageSendTime:s,lastMessage:o,sortTime:s});try{W.value.send("/app/chat/send",{},JSON.stringify({chatType:"SINGLE",content:o,receiver:Q.currentSessionItem.receiver})),Q.currentMsg={...Q.currentMsg,fail:!1}}catch(e){Q.currentMsg={...Q.currentMsg,fail:!0}}finally{Q.currentMsg={...Q.currentMsg,sending:!1}}}return t(""),n((()=>Q.currentReferenceMsg),(e=>{var t;e&&(null==(t=X.value)||t.focus())})),n((()=>P.showAv),(e=>{e&&(ee.value=!0)})),(e,t)=>i((o(),s("section",{class:"chat-footer",style:a({cursor:r(Q).id?"default":"not-allowed"})},[r(Q).currentReferenceMsg?(o(),s("div",R,[l("div",j,[l("span",null,c(r(Q).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:r(O)(r(Q).currentReferenceMsg.content)},null,8,D)]),u(r(h),{component:r(z),onClick:t[0]||(t[0]=()=>r(Q).currentReferenceMsg=null)},null,8,["component"])])):d("v-if",!0),l("div",L,[u(r(M),{show:$.value,"onUpdate:show":t[1]||(t[1]=e=>$.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:f((()=>[u(r(k),{quaternary:"",size:"tiny"},{icon:f((()=>[q])),_:1})])),default:f((()=>[l("div",F,[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> '),H,l("div",K,[(o(!0),s(m,null,p(r(w).default,(([e,t])=>(o(),g(r(E),{key:e,"show-arrow":!1,trigger:"hover"},{trigger:f((()=>[u(r(k),{quaternary:"",size:"tiny",onClick:()=>function(e){$.value=!1,se({chatMessageType:_.EMOJI,msg:e})}(e)},{icon:f((()=>[l("img",{src:t},null,8,N)])),_:2},1032,["onClick"])])),default:f((()=>[v(" "+c(e),1)])),_:2},1024)))),128))])])])),_:1},8,["show"]),u(r(k),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>se({chatMessageType:r(_).EMOJI,msg:0}))},{icon:f((()=>[V])),_:1}),u(r(C),{abstract:"",multiple:"",accept:"image/*",onChange:t[3]||(t[3]=e=>ie(e,r(_).IMAGE))},{default:f((()=>[u(r(b),{abstract:""},{default:f((({handleClick:e})=>[u(r(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[G])),_:2},1032,["onClick"])])),_:1})])),_:1}),u(r(C),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:t[4]||(t[4]=e=>ie(e,r(_).FILE))},{default:f((()=>[u(r(b),{abstract:""},{default:f((({handleClick:e})=>[u(r(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[U])),_:2},1032,["onClick"])])),_:1})])),_:1}),d(' <n-button quaternary size="tiny" @click="() => handleCall(MESSAGE_TYPE.AUDIO)">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<n-icon size="18" :component="CallOutline" />\n\t\t\t\t</template>\n\t\t\t</n-button>\n\t\t\t<n-button quaternary size="tiny" @click="() => handleCall(MESSAGE_TYPE.VIDEO)">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<n-icon size="20" :component="VideocamOutline" />\n\t\t\t\t</template>\n\t\t\t</n-button> ')]),i(l("div",{ref_key:"inputRef",ref:X,class:"input-box",contenteditable:"",onKeydown:te,onInput:ne},null,544),[[y,r(Q).id]]),l("div",J,[B,u(r(k),{type:"primary",round:"",disabled:!Y.value,onClick:oe},{default:f((()=>[v("发送")])),_:1},8,["disabled"])]),d(' <Video v-model:show="showVideo" :call-mode="callMode" /> ')],4)),[[y,r(Q).id]])}});export{P as default};
1
+ import{defineComponent as e,ref as t,watch as n,withDirectives as r,openBlock as i,createElementBlock as o,normalizeStyle as s,unref as a,createElementVNode as l,toDisplayString as c,createVNode as u,createCommentVNode as d,withCtx as f,Fragment as m,renderList as p,createBlock as g,createTextVNode as v,vShow as y}from"vue";import{NIcon as h,NPopover as M,NButton as k,NTooltip as E,NUpload as C,NUploadTrigger as b}from"naive-ui";import{format as T}from"date-fns";import{useState as x}from"../hooks/useState.js";import{useSession as I}from"../hooks/useSession.js";import{emojis as w}from"../utils/emoji.js";import{MESSAGE_TYPE as _}from"../constants/index.js";import{uploadFileApi as S}from"../api/index.js";import{CloseCircleOutline as z}from"@vicons/ionicons5";import{cloneDeep as A}from"lodash-es";import{simplifyMessage as O}from"../utils/index.js";const R={key:0,class:"reference-content-box"},j={class:"reference-content"},D=["innerHTML"],L={class:"tool-box"},q=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),F={class:"emoji-box"},H=l("span",null,"默认表情",-1),K={class:"list-box"},N=["src"],V=l("i",{class:"chat--iconfont chat--icon-good"},null,-1),G=l("i",{class:"chat--iconfont chat--icon-image"},null,-1),U=l("i",{class:"chat--iconfont chat--icon-folder"},null,-1),J={class:"btn-box"},B=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var P=e({__name:"ChatFooter",props:{showAv:{type:Boolean,default:!1}},setup(e){const P=e,X=t(),Y=t(""),{state:Q,stompClient:W}=x(),{setCurrentSessionItem:Z}=I(Q),$=t(!1),ee=t(!1);function te(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),ie()))}function ne(){var e,t;Y.value=(null==(t=null==(e=X.value)?void 0:e.innerText)?void 0:t.trim())||""}async function re(e,t){const{file:n,name:r}=e.file,i=new FormData;i.append("sender",Q.userInfo.id),i.append("file",n);const o=await S(i);if(!o)return console.log("上传失败");oe({chatMessageType:t,msg:t===_.FILE?r:o,url:o})}function ie(){if(!(Y.value.length>2e3))return Y.value?void oe({msg:Y.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function oe(e){const{chatMessageType:t=_.TEXT,msg:n,url:r}=e,i={msg:n,chatMessageType:t};t===_.FILE&&(i.fileUrl=r),[_.TEXT,_.BLEND].includes(t)&&(X.value.innerHTML="",Y.value=""),Q.currentReferenceMsg&&(i.referenceContent=A(Q.currentReferenceMsg),Q.currentReferenceMsg=null);const o=T(new Date,"yyyy-MM-dd HH:mm:ss");Q.currentMsg={content:i,sender:Q.userInfo.id,senderName:Q.userInfo.name,senderAvatar:Q.userInfo.avatar,id:"",sendTime:o,sending:!0,fail:!1},[_.AUDIO,_.VIDEO].includes(t)||(Q.isAppendMsg=!0),Z({lastMessageSendTime:o,lastMessage:i,sortTime:o});try{W.value.send("/app/chat/send",{},JSON.stringify({chatType:"SINGLE",content:i,receiver:Q.currentSessionItem.receiver})),Q.currentMsg={...Q.currentMsg,fail:!1}}catch(e){Q.currentMsg={...Q.currentMsg,fail:!0}}finally{Q.currentMsg={...Q.currentMsg,sending:!1}}}return t(""),n((()=>Q.currentReferenceMsg),(e=>{var t;e&&(null==(t=X.value)||t.focus())})),n((()=>P.showAv),(e=>{e&&(ee.value=!0)})),(e,t)=>r((i(),o("section",{class:"chat-footer",style:s({cursor:a(Q).id?"default":"not-allowed"})},[a(Q).currentReferenceMsg?(i(),o("div",R,[l("div",j,[l("span",null,c(a(Q).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:a(O)(a(Q).currentReferenceMsg.content)},null,8,D)]),u(a(h),{component:a(z),onClick:t[0]||(t[0]=()=>a(Q).currentReferenceMsg=null)},null,8,["component"])])):d("v-if",!0),l("div",L,[u(a(M),{show:$.value,"onUpdate:show":t[1]||(t[1]=e=>$.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[q])),_:1})])),default:f((()=>[l("div",F,[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> '),H,l("div",K,[(i(!0),o(m,null,p(a(w).default,(([e,t])=>(i(),g(a(E),{key:e,"show-arrow":!1,trigger:"hover"},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny",onClick:()=>function(e){$.value=!1,oe({chatMessageType:_.EMOJI,msg:e})}(e)},{icon:f((()=>[l("img",{src:t},null,8,N)])),_:2},1032,["onClick"])])),default:f((()=>[v(" "+c(e),1)])),_:2},1024)))),128))])])])),_:1},8,["show"]),u(a(k),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>oe({chatMessageType:a(_).EMOJI,msg:0}))},{icon:f((()=>[V])),_:1}),u(a(C),{abstract:"",multiple:"",accept:"image/*",onChange:t[3]||(t[3]=e=>re(e,a(_).IMAGE))},{default:f((()=>[u(a(b),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[G])),_:2},1032,["onClick"])])),_:1})])),_:1}),u(a(C),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:t[4]||(t[4]=e=>re(e,a(_).FILE))},{default:f((()=>[u(a(b),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[U])),_:2},1032,["onClick"])])),_:1})])),_:1}),d(' <n-button quaternary size="tiny" @click="() => handleCall(MESSAGE_TYPE.AUDIO)">\r\n\t\t\t\t<template #icon>\r\n\t\t\t\t\t<n-icon size="18" :component="CallOutline" />\r\n\t\t\t\t</template>\r\n\t\t\t</n-button>\r\n\t\t\t<n-button quaternary size="tiny" @click="() => handleCall(MESSAGE_TYPE.VIDEO)">\r\n\t\t\t\t<template #icon>\r\n\t\t\t\t\t<n-icon size="20" :component="VideocamOutline" />\r\n\t\t\t\t</template>\r\n\t\t\t</n-button> ')]),r(l("div",{ref_key:"inputRef",ref:X,class:"input-box",contenteditable:"",onKeydown:te,onInput:ne},null,544),[[y,a(Q).id]]),l("div",J,[B,u(a(k),{type:"primary",round:"",disabled:!Y.value,onClick:ie},{default:f((()=>[v("发送")])),_:1},8,["disabled"])]),d(' <Video v-model:show="showVideo" :call-mode="callMode" /> ')],4)),[[y,a(Q).id]])}});export{P as default};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,openBlock as a,createElementBlock as i,Fragment as o,unref as s,createElementVNode as n,createVNode as c,withCtx as l,toDisplayString as r,createCommentVNode as u}from"vue";import{NAvatar as h,NButton as v}from"naive-ui";import{useState as f}from"../hooks/useState.js";import m from"./PersonProfile.vue.js";import d from"./ChatSet.vue.js";import p from"./ChatFile.vue.js";import w from"./ChatRecord.vue.js";const y={key:0,class:"chat-header box-shadow"},C={class:"chat-header__left"},_={class:"name"},k={class:"chat-header__right"},g=n("i",{class:"chat--iconfont chat--icon-image"},null,-1),S=n("i",{class:"chat--iconfont chat--icon-folder"},null,-1),b=n("i",{class:"chat--iconfont chat--icon-list-search"},null,-1),j=n("i",{class:"chat--iconfont chat--icon-set"},null,-1);var z=e({__name:"ChatHeader",setup(e){const{state:z}=f(),q=t(!1),I=t(!1),U=t("image"),x=t(!1);function F(e){U.value=e,I.value=!0}return(e,t)=>(a(),i(o,null,[s(z).id?(a(),i("section",y,[n("div",C,[c(m,{"user-id":s(z).currentSessionItem.receiver},{trigger:l((()=>[c(s(h),{round:"",size:30,src:s(z).currentSessionItem.avatar},null,8,["src"])])),_:1},8,["user-id"]),n("span",_,r(s(z).currentSessionItem.name),1)]),n("div",k,[c(s(v),{quaternary:"",size:"tiny",onClick:t[0]||(t[0]=()=>F("image"))},{icon:l((()=>[g])),_:1}),c(s(v),{quaternary:"",size:"tiny",onClick:t[1]||(t[1]=()=>F("file"))},{icon:l((()=>[S])),_:1}),c(s(v),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>x.value=!0)},{icon:l((()=>[b])),_:1}),c(s(v),{quaternary:"",size:"tiny",onClick:t[3]||(t[3]=()=>q.value=!0)},{icon:l((()=>[j])),_:1}),u(' <i class="chat--iconfont chat--icon-folder" @click="() => handleOpenChatFile(\'file\')" />\n\t\t\t<i class="chat--iconfont chat--icon-list-search" @click="showChatRecord = true" />\n\t\t\t<i class="chat--iconfont chat--icon-set" @click="showChatSet = true" /> ')])])):u("v-if",!0),c(d,{show:q.value,"onUpdate:show":t[4]||(t[4]=e=>q.value=e)},null,8,["show"]),c(p,{show:I.value,"onUpdate:show":t[5]||(t[5]=e=>I.value=e),type:U.value,visible:I.value},null,8,["show","type","visible"]),c(w,{show:x.value,"onUpdate:show":t[6]||(t[6]=e=>x.value=e),visible:x.value},null,8,["show","visible"])],64))}});export{z as default};
1
+ import{defineComponent as e,ref as t,openBlock as a,createElementBlock as i,Fragment as o,unref as s,createElementVNode as n,createVNode as c,withCtx as l,toDisplayString as r,createCommentVNode as u}from"vue";import{NAvatar as h,NButton as v}from"naive-ui";import{useState as f}from"../hooks/useState.js";import m from"./PersonProfile.vue.js";import d from"./ChatSet.vue.js";import p from"./ChatFile.vue.js";import w from"./ChatRecord.vue.js";const y={key:0,class:"chat-header box-shadow"},C={class:"chat-header__left"},_={class:"name"},k={class:"chat-header__right"},g=n("i",{class:"chat--iconfont chat--icon-image"},null,-1),S=n("i",{class:"chat--iconfont chat--icon-folder"},null,-1),b=n("i",{class:"chat--iconfont chat--icon-list-search"},null,-1),j=n("i",{class:"chat--iconfont chat--icon-set"},null,-1);var z=e({__name:"ChatHeader",setup(e){const{state:z}=f(),q=t(!1),I=t(!1),U=t("image"),x=t(!1);function F(e){U.value=e,I.value=!0}return(e,t)=>(a(),i(o,null,[s(z).id?(a(),i("section",y,[n("div",C,[c(m,{"user-id":s(z).currentSessionItem.receiver},{trigger:l((()=>[c(s(h),{round:"",size:30,src:s(z).currentSessionItem.avatar},null,8,["src"])])),_:1},8,["user-id"]),n("span",_,r(s(z).currentSessionItem.name),1)]),n("div",k,[c(s(v),{quaternary:"",size:"tiny",onClick:t[0]||(t[0]=()=>F("image"))},{icon:l((()=>[g])),_:1}),c(s(v),{quaternary:"",size:"tiny",onClick:t[1]||(t[1]=()=>F("file"))},{icon:l((()=>[S])),_:1}),c(s(v),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>x.value=!0)},{icon:l((()=>[b])),_:1}),c(s(v),{quaternary:"",size:"tiny",onClick:t[3]||(t[3]=()=>q.value=!0)},{icon:l((()=>[j])),_:1}),u(' <i class="chat--iconfont chat--icon-folder" @click="() => handleOpenChatFile(\'file\')" />\r\n\t\t\t<i class="chat--iconfont chat--icon-list-search" @click="showChatRecord = true" />\r\n\t\t\t<i class="chat--iconfont chat--icon-set" @click="showChatSet = true" /> ')])])):u("v-if",!0),c(d,{show:q.value,"onUpdate:show":t[4]||(t[4]=e=>q.value=e)},null,8,["show"]),c(p,{show:I.value,"onUpdate:show":t[5]||(t[5]=e=>I.value=e),type:U.value,visible:I.value},null,8,["show","type","visible"]),c(w,{show:x.value,"onUpdate:show":t[6]||(t[6]=e=>x.value=e),visible:x.value},null,8,["show","visible"])],64))}});export{z as default};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,watch as n,openBlock as s,createElementBlock as i,normalizeClass as o,unref as r,createVNode as a,withCtx as c,Fragment as l,renderList as m,toDisplayString as u,createCommentVNode as d,createBlock as p,withModifiers as f,createElementVNode as v}from"vue";import{NImageGroup as y,NAvatar as g,NImage as T,NButtonGroup as M,NButton as h,NIcon as k}from"naive-ui";import{format as _}from"date-fns";import{getHistoryRecordApi as E,readMessageApi as S}from"../api/index.js";import{useState as L}from"../hooks/useState.js";import{useSession as I}from"../hooks/useSession.js";import{first as j,last as C,isNumber as A}from"lodash-es";import H from"./PersonProfile.vue.js";import b from"./MessageTemplate.vue.js";import{emojis as w}from"../utils/emoji.js";import x from"./ContextMenu.js";import{formatTime as z,simplifyMessage as N,downloadFile as O}from"../utils/index.js";import{MESSAGE_TYPE as P}from"../constants/index.js";import{useScrollLoading as q}from"../hooks/useScrollLoading.js";import{ChatbubbleEllipsesOutline as D,EllipsisHorizontal as R}from"@vicons/ionicons5";const G={key:0,class:"time"},U={key:2,class:"message-box"},J=["data-time"],K={key:0,class:"reference-content"},F=["innerHTML"],X=["innerHTML"],B=["src"],Q=["href","onClick"],V=v("i",{class:"chat--iconfont chat--icon-face"},null,-1);var W=e({__name:"ChatMain",setup(e){const W=t(),{state:Y,setMsgList:Z}=L(),{setCurrentSessionItem:$}=I(Y),ee=t(!1),te={page:0,hasMore:!0,lastSendTime:_(new Date,"yyyy-MM-dd HH:mm:ss")};async function ne(){try{if(!te.hasMore)return;te.page++;const e=await E({sessionKey:Y.currentSessionItem.sessionKey,page:te.page,lastSendTime:te.lastSendTime});if(!Array.isArray(e)||0===e.length)return te.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=j(e).id;te.lastSendTime=C(e).sendTime,Z(te.page>1?[...e,...Y.msgList]:e),1===te.page&&Y.currentSessionItem.unreadNum&&(await S({chatType:"SINGLE",messageIdSet:[t],receiver:Y.userInfo.id,sender:Y.currentSessionItem.receiver}),$({unreadNum:0}))}catch(e){console.log(e)}}function se(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==P.TEMPLATE||!!n}function ie(e,t){var n,s;const{chatMessageType:i,messageTemplate:o}=e.content;if(i===P.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 oe(e){var t,n;const{chatMessageType:s,messageTemplate:i}=e;return s===P.TEMPLATE&&3==(null==(n=null==(t=null==i?void 0:i.setting)?void 0:t.style)?void 0:n.id)}function re(e,t){var n;const s=A(e.sendTime)?e.sendTime:Date.parse(e.sendTime),i=null==(n=Y.msgList[t-1])?void 0:n.sendTime;return s-(0===t?0:A(i)?i:Date.parse(i))>3e5}return q(W,(()=>{ne()}),"top"),n((()=>Y.id),(e=>{e&&(Object.assign(te,{page:0,hasMore:!0,lastSendTime:_(new Date,"yyyy-MM-dd HH:mm:ss")}),ne())}),{immediate:!0}),n((()=>Y.isAppendMsg),(e=>{e&&(Z([...Y.msgList,Y.currentMsg]),Y.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=W.value)?void 0:e.scrollHeight)?t:0;null==(n=W.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(s(),i("div",{class:o(["chat-main",{"home-bg":!r(Y).id}]),ref_key:"chatMainRef",ref:W},[a(r(y),{"show-toolbar-tooltip":""},{default:c((()=>[(s(!0),i(l,null,m(r(Y).msgList,((e,n)=>(s(),i(l,{key:n},[se(e)?(s(),i("div",{key:0,class:o(["message-item",{"message-item--mine":e.sender==r(Y).userInfo.id}])},[re(e,n)?(s(),i("p",G,u(r(z)(e.sendTime).recordTime),1)):d("v-if",!0),ie(e,"system")?(s(),p(b,{key:1,data:e},null,8,["data"])):(s(),i("div",U,[a(H,{"user-id":e.sender},{trigger:c((()=>[a(r(g),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id"]),e.content?(s(),i("div",{key:0,class:o(["content",{emoji:e.content.chatMessageType===r(P).EMOJI,template:e.content.chatMessageType===r(P).TEMPLATE,"template--3":oe(e.content)}]),"data-time":e.__time,onContextmenu:t[0]||(t[0]=f((e=>ee.value=!0),["prevent"]))},[e.content.chatMessageType===r(P).TEXT?(s(),i(l,{key:0},[e.content.referenceContent?(s(),i("div",K,[v("span",null,u(e.content.referenceContent.senderName)+":",1),v("pre",{innerHTML:r(N)(e.content.referenceContent.content)},null,8,F)])):d("v-if",!0),v("pre",{innerHTML:e.__content},null,8,X)],64)):d("v-if",!0),e.content.chatMessageType===r(P).EMOJI?(s(),i("img",{key:1,src:r(w).findEmoji(e.__content)},null,8,B)):d("v-if",!0),ie(e,"template")?(s(),p(b,{key:2,data:e},null,8,["data"])):d("v-if",!0),e.content.chatMessageType===r(P).IMAGE?(s(),p(r(T),{key:3,width:"240",src:e.__content},null,8,["src"])):d("v-if",!0),e.content.chatMessageType===r(P).FILE?(s(),i("a",{key:4,href:e.content.fileUrl,onClick:f((()=>r(O)(e.content.fileUrl,e.__content)),["prevent"])},u(e.__content),9,Q)):d("v-if",!0),d(' <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> '),a(r(M),{class:"quick-menu"},{default:c((()=>[a(r(h),{quaternary:"",size:"tiny"},{icon:c((()=>[V])),_:1}),a(r(h),{quaternary:"",size:"tiny",onClick:()=>{return t=e,Y.currentReferenceMsg=t,void Object.assign(Y.currentReferenceMsg,{chatType:"SINGLE",receiver:Y.currentSessionItem.receiver,receiverAvatar:Y.currentSessionItem.avatar,receiverName:Y.currentSessionItem.name});var t}},{icon:c((()=>[a(r(k),{size:"17",component:r(D)},null,8,["component"])])),_:2},1032,["onClick"]),a(r(h),{quaternary:"",size:"tiny"},{icon:c((()=>[a(r(k),{component:r(R)},null,8,["component"])])),_:1})])),_:2},1024)],42,J)):d("v-if",!0)]))],2)):d("v-if",!0)],64)))),128))])),_:1}),a(r(x),{show:ee.value,"onUpdate:show":t[1]||(t[1]=e=>ee.value=e)},null,8,["show"])],2))}});export{W as default};
1
+ import{defineComponent as e,ref as t,watch as n,openBlock as s,createElementBlock as i,normalizeClass as o,unref as r,createVNode as a,withCtx as c,Fragment as l,renderList as m,toDisplayString as u,createCommentVNode as d,createBlock as p,withModifiers as f,createElementVNode as v}from"vue";import{NImageGroup as y,NAvatar as g,NImage as T,NButtonGroup as M,NButton as h,NIcon as k}from"naive-ui";import{format as _}from"date-fns";import{getHistoryRecordApi as E,readMessageApi as S}from"../api/index.js";import{useState as L}from"../hooks/useState.js";import{useSession as I}from"../hooks/useSession.js";import{first as j,last as C,isNumber as A}from"lodash-es";import H from"./PersonProfile.vue.js";import b from"./MessageTemplate.vue.js";import{emojis as w}from"../utils/emoji.js";import x from"./ContextMenu.js";import{formatTime as z,simplifyMessage as N,downloadFile as O}from"../utils/index.js";import{MESSAGE_TYPE as P}from"../constants/index.js";import{useScrollLoading as q}from"../hooks/useScrollLoading.js";import{ChatbubbleEllipsesOutline as D,EllipsisHorizontal as R}from"@vicons/ionicons5";const G={key:0,class:"time"},U={key:2,class:"message-box"},J=["data-time"],K={key:0,class:"reference-content"},F=["innerHTML"],X=["innerHTML"],B=["src"],Q=["href","onClick"],V=v("i",{class:"chat--iconfont chat--icon-face"},null,-1);var W=e({__name:"ChatMain",setup(e){const W=t(),{state:Y,setMsgList:Z}=L(),{setCurrentSessionItem:$}=I(Y),ee=t(!1),te={page:0,hasMore:!0,lastSendTime:_(new Date,"yyyy-MM-dd HH:mm:ss")};async function ne(){try{if(!te.hasMore)return;te.page++;const e=await E({sessionKey:Y.currentSessionItem.sessionKey,page:te.page,lastSendTime:te.lastSendTime});if(!Array.isArray(e)||0===e.length)return te.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=j(e).id;te.lastSendTime=C(e).sendTime,Z(te.page>1?[...e,...Y.msgList]:e),1===te.page&&Y.currentSessionItem.unreadNum&&(await S({chatType:"SINGLE",messageIdSet:[t],receiver:Y.userInfo.id,sender:Y.currentSessionItem.receiver}),$({unreadNum:0}))}catch(e){console.log(e)}}function se(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==P.TEMPLATE||!!n}function ie(e,t){var n,s;const{chatMessageType:i,messageTemplate:o}=e.content;if(i===P.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 oe(e){var t,n;const{chatMessageType:s,messageTemplate:i}=e;return s===P.TEMPLATE&&3==(null==(n=null==(t=null==i?void 0:i.setting)?void 0:t.style)?void 0:n.id)}function re(e,t){var n;const s=A(e.sendTime)?e.sendTime:Date.parse(e.sendTime),i=null==(n=Y.msgList[t-1])?void 0:n.sendTime;return s-(0===t?0:A(i)?i:Date.parse(i))>3e5}return q(W,(()=>{ne()}),"top"),n((()=>Y.id),(e=>{e&&(Object.assign(te,{page:0,hasMore:!0,lastSendTime:_(new Date,"yyyy-MM-dd HH:mm:ss")}),ne())}),{immediate:!0}),n((()=>Y.isAppendMsg),(e=>{e&&(Z([...Y.msgList,Y.currentMsg]),Y.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=W.value)?void 0:e.scrollHeight)?t:0;null==(n=W.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(s(),i("div",{class:o(["chat-main",{"home-bg":!r(Y).id}]),ref_key:"chatMainRef",ref:W},[a(r(y),{"show-toolbar-tooltip":""},{default:c((()=>[(s(!0),i(l,null,m(r(Y).msgList,((e,n)=>(s(),i(l,{key:n},[se(e)?(s(),i("div",{key:0,class:o(["message-item",{"message-item--mine":e.sender==r(Y).userInfo.id}])},[re(e,n)?(s(),i("p",G,u(r(z)(e.sendTime).recordTime),1)):d("v-if",!0),ie(e,"system")?(s(),p(b,{key:1,data:e},null,8,["data"])):(s(),i("div",U,[a(H,{"user-id":e.sender},{trigger:c((()=>[a(r(g),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id"]),e.content?(s(),i("div",{key:0,class:o(["content",{emoji:e.content.chatMessageType===r(P).EMOJI,template:e.content.chatMessageType===r(P).TEMPLATE,"template--3":oe(e.content)}]),"data-time":e.__time,onContextmenu:t[0]||(t[0]=f((e=>ee.value=!0),["prevent"]))},[e.content.chatMessageType===r(P).TEXT?(s(),i(l,{key:0},[e.content.referenceContent?(s(),i("div",K,[v("span",null,u(e.content.referenceContent.senderName)+":",1),v("pre",{innerHTML:r(N)(e.content.referenceContent.content)},null,8,F)])):d("v-if",!0),v("pre",{innerHTML:e.__content},null,8,X)],64)):d("v-if",!0),e.content.chatMessageType===r(P).EMOJI?(s(),i("img",{key:1,src:r(w).findEmoji(e.__content)},null,8,B)):d("v-if",!0),ie(e,"template")?(s(),p(b,{key:2,data:e},null,8,["data"])):d("v-if",!0),e.content.chatMessageType===r(P).IMAGE?(s(),p(r(T),{key:3,width:"240",src:e.__content},null,8,["src"])):d("v-if",!0),e.content.chatMessageType===r(P).FILE?(s(),i("a",{key:4,href:e.content.fileUrl,onClick:f((()=>r(O)(e.content.fileUrl,e.__content)),["prevent"])},u(e.__content),9,Q)):d("v-if",!0),d(' <div class="quick-menu">\r\n\t\t\t\t\t\t\t\t\t<n-icon :component="AddCircleOutline" />\r\n\t\t\t\t\t\t\t\t\t<n-icon :component="ChatbubbleEllipsesOutline" @click="() => setReferenceMsg(item)" />\r\n\t\t\t\t\t\t\t\t\t<n-icon :component="EllipsisHorizontal" />\r\n\t\t\t\t\t\t\t\t</div> '),a(r(M),{class:"quick-menu"},{default:c((()=>[a(r(h),{quaternary:"",size:"tiny"},{icon:c((()=>[V])),_:1}),a(r(h),{quaternary:"",size:"tiny",onClick:()=>{return t=e,Y.currentReferenceMsg=t,void Object.assign(Y.currentReferenceMsg,{chatType:"SINGLE",receiver:Y.currentSessionItem.receiver,receiverAvatar:Y.currentSessionItem.avatar,receiverName:Y.currentSessionItem.name});var t}},{icon:c((()=>[a(r(k),{size:"17",component:r(D)},null,8,["component"])])),_:2},1032,["onClick"]),a(r(h),{quaternary:"",size:"tiny"},{icon:c((()=>[a(r(k),{component:r(R)},null,8,["component"])])),_:1})])),_:2},1024)],42,J)):d("v-if",!0)]))],2)):d("v-if",!0)],64)))),128))])),_:1}),a(r(x),{show:ee.value,"onUpdate:show":t[1]||(t[1]=e=>ee.value=e)},null,8,["show"])],2))}});export{W as default};
@@ -1,3 +1,4 @@
1
+ import TRTC from 'trtc-sdk-v5';
1
2
  declare const _default: import("vue").DefineComponent<{
2
3
  show: {
3
4
  type: BooleanConstructor;
@@ -16,7 +17,7 @@ declare const _default: import("vue").DefineComponent<{
16
17
  state: import("../types").IState;
17
18
  videoRef: import("vue").Ref<any>;
18
19
  selfVideoRef: import("vue").Ref<any>;
19
- trtc: any;
20
+ trtc: TRTC;
20
21
  handleEnter: () => Promise<void>;
21
22
  installEventHandlers: () => void;
22
23
  NButton: any;
package/es/env.d.ts CHANGED
@@ -1,25 +1,25 @@
1
- /// <reference types="vite/client" />
2
-
3
- interface ImportMetaEnv {
4
- readonly VITE_APP_TYPE: string;
5
- // 更多环境变量...
6
- }
7
-
8
- interface ImportMeta {
9
- readonly env: ImportMetaEnv;
10
- }
11
-
12
- declare module '*.vue' {
13
- // @ts-ignore
14
- import type { App, defineComponent } from 'vue';
15
- // // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
16
- // // const component: DefineComponent<{}, {}, any>
17
- const component: ReturnType<typeof defineComponent> & {
18
- install(app: App): void;
19
- };
20
- // @ts-ignore
21
- export default component;
22
- }
23
-
24
- declare module '*.js';
25
-
1
+ /// <reference types="vite/client" />
2
+
3
+ interface ImportMetaEnv {
4
+ readonly VITE_APP_TYPE: string;
5
+ // 更多环境变量...
6
+ }
7
+
8
+ interface ImportMeta {
9
+ readonly env: ImportMetaEnv;
10
+ }
11
+
12
+ declare module '*.vue' {
13
+ // @ts-ignore
14
+ import type { App, defineComponent } from 'vue';
15
+ // // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
16
+ // // const component: DefineComponent<{}, {}, any>
17
+ const component: ReturnType<typeof defineComponent> & {
18
+ install(app: App): void;
19
+ };
20
+ // @ts-ignore
21
+ export default component;
22
+ }
23
+
24
+ declare module '*.js';
25
+
@@ -1 +1 @@
1
- var e="@cnhis-design-vue/shared",i="3.2.6-beta.1",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.2.6-beta.1",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
1
+ var e="@cnhis-design-vue/shared",i="3.2.6-beta.2",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.2.6-beta.2",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.2.6-beta.1",
3
+ "version": "3.2.6-beta.2",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -72,5 +72,5 @@
72
72
  "iOS 7",
73
73
  "last 3 iOS versions"
74
74
  ],
75
- "gitHead": "cf61ebb153101afde4429cf0701a7c5ce4e2454c"
75
+ "gitHead": "8ff3e251ba4a5a702fbfbc279e4de4a88a13549d"
76
76
  }