cnhis-design-vue 3.1.50-beta.10 → 3.1.50-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/es/components/fabric-chart/src/FabricChart.vue2.js +1 -1
  2. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
  3. package/es/components/fabric-chart/src/hooks/index.js +1 -1
  4. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.d.ts +3 -0
  5. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
  6. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useLeft.js +1 -1
  7. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.d.ts +1 -1
  8. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
  9. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  10. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
  11. package/es/components/fabric-chart/src/hooks/temperature/useBottom.js +1 -1
  12. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  13. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  14. package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
  15. package/es/components/fabric-chart/src/hooks/temperature/useTop.js +1 -1
  16. package/es/components/fabric-chart/src/hooks/useEvent.d.ts +1 -0
  17. package/es/components/fabric-chart/src/hooks/useEvent.js +1 -1
  18. package/es/components/form-config/index.d.ts +188 -8
  19. package/es/components/form-config/src/FormConfig.vue.d.ts +188 -8
  20. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +91 -4
  21. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +94 -4
  22. package/es/components/form-config/src/hooks/useConfigurationField.js +1 -1
  23. package/es/components/form-render/index.d.ts +91 -4
  24. package/es/components/form-render/src/FormRender.vue.d.ts +91 -4
  25. package/es/components/form-render/src/FormRender.vue2.js +1 -1
  26. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +91 -4
  27. package/es/components/form-render/src/components/renderer/select.d.ts +3 -0
  28. package/es/components/form-render/src/components/renderer/select.js +1 -1
  29. package/es/components/form-render/src/hooks/useFieldListAdaptor.d.ts +2 -5
  30. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  31. package/es/components/form-render/src/hooks/useFieldNormalize.d.ts +173 -4
  32. package/es/components/form-render/src/hooks/useFieldNormalize.js +1 -1
  33. package/es/components/form-render/src/hooks/useLowCodeReactions.d.ts +1 -1
  34. package/es/components/form-render/src/hooks/useLowCodeReactions.js +1 -1
  35. package/es/components/form-render/src/types/index.d.ts +2 -0
  36. package/es/components/iho-table/index.d.ts +26 -0
  37. package/es/components/iho-table/src/IhoTable.vue.d.ts +26 -0
  38. package/es/components/iho-table/src/hooks/tapHooks/useConfigHooks.d.ts +3 -1
  39. package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin/index.js +1 -1
  40. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/checkRendererPlugin.js +1 -1
  41. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/defaultRendererPlugin.js +1 -1
  42. package/es/components/iho-table/src/plugins/varialbleHeightPlugin/index.js +1 -1
  43. package/es/components/iho-table/src/types/index.d.ts +4 -0
  44. package/es/components/info-header/index.d.ts +272 -11
  45. package/es/components/info-header/src/InfoHeader.vue.d.ts +272 -11
  46. package/es/components/info-header/src/components/infoDescription/DescriptionItem.vue.d.ts +86 -3
  47. package/es/components/info-header/src/components/infoDescription/DescriptionList.vue.d.ts +86 -3
  48. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +177 -7
  49. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +91 -4
  50. package/es/components/shortcut-setter/index.d.ts +91 -4
  51. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +91 -4
  52. package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.d.ts +28 -0
  53. package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.js +1 -1
  54. package/es/shared/package.json.js +1 -1
  55. package/es/shared/utils/business.d.ts +3 -1
  56. package/es/shared/utils/business.js +1 -1
  57. package/es/shared/utils/index.js +1 -1
  58. package/package.json +1 -1
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,reactive as r,onMounted as s,onBeforeUnmount as o,openBlock as a,createElementBlock as n,Fragment as i,createElementVNode as p,createBlock as u,mergeProps as l,unref as c,createCommentVNode as h}from"vue";import{fabric as m}from"../../../shared/utils/fabricjs/index.js";import f from"./components/PopupTip.vue.js";import d from"./components/PopupMenu.js";import"./hooks/useDraw.js";import"date-fns";import"lodash-es";import{useBirthProcessChart as v}from"./hooks/birthProcess/useBirthProcessChart.js";import{useTemperatureChart as w}from"./hooks/temperature/useTemperatureChart.js";import{useSurgicalAnesthesiaChart as k}from"./hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js";var g=e({__name:"FabricChart",props:{type:{type:String,default:"temperature"},data:{type:Object,required:!0},addRenderItem:{type:Function}},emits:["change","add","remove","select","add:prevent"],setup(e,{expose:g,emit:C}){const y=e,j=t(null),b=t(),P=r({show:!1,point:{x:0,y:0},list:[]}),x=r({show:!1,point:{x:0,y:0},list:[],target:null}),{propItems:I,redrawPoints:M,select:A,clickMenu:R}=function(){const e=[b,y,C,j,P,x];switch(y.type){case"birthProcess":return v(...e);case"surgicalAnesthesia":return k(...e);default:return w(...e)}}();return s((()=>{b.value=new m.Canvas(j.value,{width:I.canvasWidth,height:I.canvasHeight,backgroundColor:"#fff",selection:!1,containerClass:"c-fabric-chart",stopContextMenu:!0,fireRightClick:!0,allowTouchScrolling:!0})})),o((()=>{b.value.off(),b.value.clear()})),g({redrawPoints:M,select:A,canvas:b}),(e,t)=>(a(),n(i,null,[p("canvas",{ref_key:"canvasRef",ref:j},null,512),b.value?(a(),u(f,l({key:0,propItems:c(I)},P),null,16,["propItems"])):h("v-if",!0),b.value?(a(),u(c(d),l({key:1,propItems:c(I)},x,{show:x.show,"onUpdate:show":t[0]||(t[0]=e=>x.show=e),onClickMenu:c(R)}),null,16,["propItems","show","onClickMenu"])):h("v-if",!0)],64))}});export{g as default};
1
+ import{defineComponent as e,ref as t,reactive as s,onMounted as r,onBeforeUnmount as o,openBlock as a,createElementBlock as n,Fragment as i,createElementVNode as p,createBlock as u,mergeProps as l,unref as c,createCommentVNode as h}from"vue";import{fabric as m}from"../../../shared/utils/fabricjs/index.js";import f from"./components/PopupTip.vue.js";import d from"./components/PopupMenu.js";import"./hooks/useDraw.js";import"date-fns";import"lodash-es";import"./hooks/useEvent.js";import{useBirthProcessChart as v}from"./hooks/birthProcess/useBirthProcessChart.js";import{useTemperatureChart as w}from"./hooks/temperature/useTemperatureChart.js";import{useSurgicalAnesthesiaChart as k}from"./hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js";var g=e({__name:"FabricChart",props:{type:{type:String,default:"temperature"},data:{type:Object,required:!0},addRenderItem:{type:Function}},emits:["change","add","remove","select","add:prevent"],setup(e,{expose:g,emit:C}){const j=e,y=t(null),b=t(),P=s({show:!1,point:{x:0,y:0},list:[]}),x=s({show:!1,point:{x:0,y:0},list:[],target:null}),{propItems:I,redrawPoints:M,select:A,clickMenu:R}=function(){const e=[b,j,C,y,P,x];switch(j.type){case"birthProcess":return v(...e);case"surgicalAnesthesia":return k(...e);default:return w(...e)}}();return r((()=>{b.value=new m.Canvas(y.value,{width:I.canvasWidth,height:I.canvasHeight,backgroundColor:"#fff",selection:!1,containerClass:"c-fabric-chart",stopContextMenu:!0,fireRightClick:!0,allowTouchScrolling:!0})})),o((()=>{b.value.off(),b.value.clear()})),g({redrawPoints:M,select:A,canvas:b}),(e,t)=>(a(),n(i,null,[p("canvas",{ref_key:"canvasRef",ref:y},null,512),b.value?(a(),u(f,l({key:0,propItems:c(I)},P),null,16,["propItems"])):h("v-if",!0),b.value?(a(),u(c(d),l({key:1,propItems:c(I)},x,{show:x.show,"onUpdate:show":t[0]||(t[0]=e=>x.show=e),onClickMenu:c(R)}),null,16,["propItems","show","onClickMenu"])):h("v-if",!0)],64))}});export{g as default};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as n,drawText as o,defaultTextStyle as i,drawPoint as r,drawTextAndIconGroup as l,defaultStyle as s,defaultRectStyle as a}from"../useDraw.js";import{useGrid as u}from"../useGrid.js";import{useBirthProcessCumputedPoint as c}from"../useCumputedPoint.js";import{getScaleInfo as d,drawScaleNumber as f,drawScaleLine as p}from"../useScaleColumn.js";import{useCommon as h}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as v,getTime as m,getScaleNumberList as y}from"../../utils/index.js";import"../temperature/useShadow.js";import{cloneDeep as k}from"lodash-es";import{format as w}from"date-fns";import"naive-ui";function x(x,b,j,C,P){const{cumputedX:S,cumputedY:G,getXValue:M,getYValue:T}=c(b),{getEqualXTypes:Y,handleAddPrevent:E,isGridLimit:L}=h(x,j,b),{xAxis:X,grid:A,originX:I,originY:H,xCellWidth:W,endY:O,startTime:V,leftAddAreaWidth:D,leftScales:N,rightScales:R,yCellHeight:$,endX:B,scaleValues:F,canvasWidth:q,borderStyle:z,rightAddAreaWidth:J,event:K,originYCervix:Q,other:U,canvasHeight:Z}=b,_=k(F),ee=new Set;function te(){_.filter((e=>e.show)).forEach(((e,l)=>{var s;const a=[],u=[],c=[];null==(s=e.data)||s.forEach(((s,d)=>{!function(s,d,f){let p,h;const{pointAttr:g={},lineAttr:v={},title:m="",key:y,type:k="circle",childbirthStyle:w={}}=e,P=e.data[f+1],S=le(P,e);if(s&&S&&!d.breakpoint)h=t([...s,...S],{...v});else if(s&&!S&&!d.breakpoint){const n=le(P,e);h=n?t([...s,...n],{...v}):null}let G,Y;if(d.childbirth){const e=s[1]+$;G=n([s[0],s[1],e],w),c.push(G),Y=o([s[0]+W/2,e-$/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(Y)}const E=u[f-1],L={origin:{data:d,title:m,key:y||"",dataIndex:l,index:f},leftLine:E,rightLine:h,arrowGroup:G,arrowGroupText:Y,...g,...b.event.hovered?b.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:b.event};E?p=r(k,{left:E.get("x2"),top:E.get("y2"),...L}):s&&(L.leftLine=null,p=r(k,{left:s[0],top:s[1],...L}));u.push(h),p&&(!function(e){K.hovered&&(e.on("mouseover",(()=>{re(e,"hover")})),e.on("mouseout",(()=>{C.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ie(e),function(e){var t,n,o,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top}),null==(o=e.arrowGroup)||o.setCoords().set({left:e.left,top:e.top}),null==(i=e.arrowGroupText)||i.setCoords().set({left:e.left+W/2,top:e.top+$/2})}(e),K.hovered&&re(e)})),e.on("mouseup",(t=>{if(C.show=!1,1===t.button){const{key:t}=e.origin,n={...e.origin,data:{...e.origin.data,time:M(e.left),value:T(t,e.top)}};x.value.discardActiveObject(),j("change",n),ne(n,"change")}}))}(p),a.push(p),ee.add(p))}(le(s,e),s,d)})),Promise.all(a).then((e=>{const t=u.filter((e=>e));let n=null;e=e.filter((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),Promise.all(c).then((n=>{x.value.add(...t,...e,...n),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function ne(e,t="add"){const{dataIndex:n,data:o,index:i,key:r}=e,l=_.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const e=g(o.time,l.data);l.data.splice(e,0,o);break}}oe()}function oe(){var e;ee.size&&(null==(e=x.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),(null==e?void 0:e.arrowGroup)&&t.push(null==e?void 0:e.arrowGroup),(null==e?void 0:e.arrowGroupText)&&t.push(null==e?void 0:e.arrowGroupText)})),t}([...ee]))),ee.clear(),te()}function ie(e){const t=e.prevPoint?e.prevPoint.left:I,n=e.nextPoint?e.nextPoint.left:B;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<Q&&e.set("top",Q),e.top<H&&e.set("top",H),e.top>O&&e.set("top",O),e.left<t&&e.set("left",t),e.left>n&&e.set("left",n)}function re(e,t="moving"){const{title:n,key:o,data:i}=e.origin;C.point={x:e.left,y:e.top},C.list=[`${n} ${"hover"===t?i.value:T(o,e.top)}`,`时间 ${M(e.left).slice(-5)}`],C.show=!0}function le(e,t){if(v(e)&&function(e){const t=V+864e5,n=m(e);return n>=V&&n<=t}(e.time)){const n=S(e.time),o=G(t.key,t.range,e.value);return[n,o<H?H:o>O?O:o]}}function se(e,t){return e+1>t[1]?t[0]:e+1}return u(x,b),function(){const t=new e.Rect({...z,width:q-D-J-1,height:O-1,left:D,top:0,fill:"transparent"});x.value.add(t)}(),function(){function t(t,n="left"){let r="left"===n?D:B;t.forEach(((t,n)=>{const{range:l,spaceValue:u,width:c,title:h,titleStyle:g,key:v,position:m="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:b}=t,j=[],C=[],P=r+c/2,S=y(l,u),G=S.length;S.forEach(((e,n)=>{const{lineXMain:o,lineXSub:i,textLeft:l}=d(m,r,c),s=O-n*$*k,a=0===n?O-8:n!==S.length-1||H||Q&&"FHR"!==v?s:H+8;!w||(0===n||n===G-1)&&!b||j.push(f(String(e),t,l,a)),C.push(...p(t,n,o,i,s,$,H,G))}));const M=new e.Rect({...a,strokeWidth:.5,width:c,height:O,left:P,top:O/2}),T=o([P,H>0?H-$/2:$/2],{value:String(h),...i,...g}),Y=new e.Group([...C,...j,M,...T?[T]:[]],{objectCaching:!1,...s});x.value.add(Y),Y.sendToBack(),r+=c}))}t(N),t(R,"right")}(),function(){const{show:t,startTime:n,range:r=[0,23],position:l="top",style:a}=X.time,{show:u,range:c=[0,23],position:d,style:f}=X.processTime;if(t||u){const p=[],h=[],g=[],v=[],m=I+W/2,y=$/2;for(let e=0;e<A.mainXCell;e++){if(t){const t=0===e?+n.slice(11,13):se(p.at(-1),r);p.push(t);const s="top"===l?H-y:O+y;g.push(o([m+e*W,s],{value:String(t),...i,...a||{}}))}if(u){const t=0===e?c[0]:h.at(-1)+1;h.push(t);const n="top"===d?y:Z-y;v.push(o([m+e*W,n],{value:String(t),...i,...f||{}}))}}const k=new e.Group([...g,...v],{objectCaching:!1,...s});x.value.add(k),x.value.sendToBack(k)}}(),function(){var e;const n=Object.values(U),o=[],i={},r=_.find((e=>"cervix"===e.key&&e.show)),l=null==(e=null==r?void 0:r.data)?void 0:e.find((e=>3==+e.value));function s(e,t){const{key:n,range:o}=r||{},i=G(n,o,10),l=[0,t],s=[-t/e,0],a=[(O-i-t)/e,O-i],u=[B-I,e*(B-I)+t];let c=[],d=[];function f([n,o]){return Math.abs(o-e*n-t)<=1}function p([e,t]){const[n,o]=[...h([e,t])];return n>=I&&n<=B&&o>=i&&o<=O}function h([e,t]){return[I+e,O-t]}return f(l)&&p(l)&&(c=h(l)),f(s)&&p(s)&&(c=h(s)),f(a)&&p(a)&&(d=h(a)),f(u)&&p(u)&&(d=h(u)),[...c,...d]}n.forEach((e=>{if(!e.show)return;const{key:n}=e;switch(n){case"fetalPresentation":{const{range:i,show:r}=_.find((e=>e.key===n));if(r){const r=G(n,i,0);o.push(t([I,r,B,r],{...e}))}break}case"alert":if(l){const{key:n,range:a}=r||{},u=216e5,c={time:w(new Date(m(l.time)+u),"yyyy-MM-dd HH:mm"),value:10},[d,f]=[S(l.time)-I,O-G(n,a,l.value)],[p,h]=[S(c.time)-I,O-G(n,a,c.value)],g=(h-f)/(p-d),v=f-d*g,y=s(g,v);y.length>0&&(o.push(t(y,{...e})),Object.assign(i,{k:g,b:v}))}break;case"handling":if(l){const{k:n,b:r}=i,a=144e5,u=s(n,r-(S(w(new Date(m(l.time)+a),"yyyy-MM-dd HH:mm"))-S(l.time))*n);u.length>0&&o.push(t(u,{...e}))}}})),x.value.add(...o)}(),te(),function(){function e(e,t){const n=_.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:n,key:e.key},pointer:t}}b.event.evented&&x.value.on("mouse:up",(t=>{if(3===t.button){const{x:n=0,y:o=0}=t.pointer||{};n>=I&&n<=B&&o>=H&&o<=O&&(P.point={x:n,y:o},P.show=!0,t.target?(P.target=t.target,P.list=["删除节点"],[...ee].forEach((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&P.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(P.target=null,P.list=["新增节点"],_.filter((e=>e.show)).forEach((i=>{if(!Y([...ee],n,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<Q)return;P.list.push(e(i,t.pointer))}})),1===P.list.length&&(P.show=!1,E("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=q-J/2;function t(e,t){if(!e.length)return;let o=H;const i=[];e.forEach((e=>{const n=e.title.split("").join("\n"),r=F.findIndex((t=>t.key===e.key)),{text:s,icon:a}=l(n,e,{text:{originY:"top",left:t,top:o},icon:{left:t,topY:o,originY:"top",origin:{type:e.type,dataIndex:r},...b.event}},"vertical");var u;o+=s.height+a.height+15,(u=a).on("moving",(()=>{u.set("originY","center"),L(u)?(ie(u),re(u)):C.show=!1})),u.on("mouseup:before",(e=>{if(C.show=!1,0===e.e.button&&L(u))if(Y([...ee],u.left,"key").includes(u.origin.key))E("repeat");else{const e={data:{time:M(u.left),value:T(u.origin.key,u.top)},...u.origin};j("add",e),ne(e)}!function(e){e.setCoords().set({originY:"top",left:e.originLeft,top:e.originTop})}(u)})),i.push(s,a)})),n(i),x.value.add(...i)}function n(e){const t=e.at(-1),n=(O-H)/2,o=(t.height+t.top-H)/2;e.forEach((e=>{const t=e.top+n-o;e.set({top:t,originTop:t})}))}t(N,D/2),t(R,e)}(),{clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(j("remove",n),ne(n,"remove")):(Object.assign(n,{data:{time:M(e.pointer.x),value:T(e.origin.key,e.pointer.y)}}),j("add",n),ne(n))},redrawPoints:oe}}export{x as useBirthProcess};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as n,drawText as o,defaultTextStyle as i,drawPoint as r,drawTextAndIconGroup as l,defaultStyle as s,defaultRectStyle as a}from"../useDraw.js";import{useGrid as u}from"../useGrid.js";import{useBirthProcessCumputedPoint as c}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as d,drawScaleNumber as f,drawScaleLine as p}from"../useScaleColumn.js";import{useCommon as h}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as v,getTime as m,getScaleNumberList as y}from"../../utils/index.js";import"../temperature/useShadow.js";import{cloneDeep as k}from"lodash-es";import{format as w}from"date-fns";import"naive-ui";function x(x,b,j,C,P){const{cumputedX:S,cumputedY:E,getXValue:G,getYValue:M}=c(b),{getEqualXTypes:T,handleAddPrevent:Y,isGridLimit:L}=h(x,j,b),{xAxis:X,grid:A,originX:I,originY:H,xCellWidth:W,endY:O,startTime:V,leftAddAreaWidth:D,leftScales:N,rightScales:R,yCellHeight:$,endX:B,scaleValues:F,canvasWidth:q,borderStyle:z,rightAddAreaWidth:J,event:K,originYCervix:Q,other:U,canvasHeight:Z}=b,_=k(F),ee=new Set;function te(){_.filter((e=>e.show)).forEach(((e,l)=>{var s;const a=[],u=[],c=[];null==(s=e.data)||s.forEach(((s,d)=>{!function(s,d,f){let p,h;const{pointAttr:g={},lineAttr:v={},title:m="",key:y,type:k="circle",childbirthStyle:w={}}=e,P=e.data[f+1],S=le(P,e);if(s&&S&&!d.breakpoint)h=t([...s,...S],{...v});else if(s&&!S&&!d.breakpoint){const n=le(P,e);h=n?t([...s,...n],{...v}):null}let E,T;if(d.childbirth){const e=s[1]+$;E=n([s[0],s[1],e],w),c.push(E),T=o([s[0]+W/2,e-$/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(T)}const Y=u[f-1],L={origin:{data:d,title:m,key:y||"",dataIndex:l,index:f},leftLine:Y,rightLine:h,arrowGroup:E,arrowGroupText:T,...g,...b.event.hovered?b.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:b.event};Y?p=r(k,{left:Y.get("x2"),top:Y.get("y2"),...L}):s&&(L.leftLine=null,p=r(k,{left:s[0],top:s[1],...L}));u.push(h),p&&(!function(e){K.hovered&&(e.on("mouseover",(()=>{re(e,"hover")})),e.on("mouseout",(()=>{C.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ie(e),function(e){var t,n,o,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top}),null==(o=e.arrowGroup)||o.setCoords().set({left:e.left,top:e.top}),null==(i=e.arrowGroupText)||i.setCoords().set({left:e.left+W/2,top:e.top+$/2})}(e),K.hovered&&re(e)})),e.on("mouseup",(t=>{if(C.show=!1,1===t.button){const{key:t}=e.origin,n={...e.origin,data:{...e.origin.data,time:G(e.left),value:M(t,e.top)}};x.value.discardActiveObject(),j("change",n),ne(n,"change")}}))}(p),a.push(p),ee.add(p))}(le(s,e),s,d)})),Promise.all(a).then((e=>{const t=u.filter((e=>e));let n=null;e=e.filter((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),Promise.all(c).then((n=>{x.value.add(...t,...e,...n),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function ne(e,t="add"){const{dataIndex:n,data:o,index:i,key:r}=e,l=_.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const e=g(o.time,l.data);l.data.splice(e,0,o);break}}oe()}function oe(){var e;ee.size&&(null==(e=x.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),(null==e?void 0:e.arrowGroup)&&t.push(null==e?void 0:e.arrowGroup),(null==e?void 0:e.arrowGroupText)&&t.push(null==e?void 0:e.arrowGroupText)})),t}([...ee]))),ee.clear(),te()}function ie(e){const t=e.prevPoint?e.prevPoint.left:I,n=e.nextPoint?e.nextPoint.left:B;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<Q&&e.set("top",Q),e.top<H&&e.set("top",H),e.top>O&&e.set("top",O),e.left<t&&e.set("left",t),e.left>n&&e.set("left",n)}function re(e,t="moving"){const{title:n,key:o,data:i}=e.origin;C.point={x:e.left,y:e.top},C.list=[`${n} ${"hover"===t?i.value:M(o,e.top)}`,`时间 ${G(e.left).slice(-5)}`],C.show=!0}function le(e,t){if(v(e)&&function(e){const t=V+864e5,n=m(e);return n>=V&&n<=t}(e.time)){const n=S(e.time),o=E(t.key,t.range,e.value);return[n,o<H?H:o>O?O:o]}}function se(e,t){return e+1>t[1]?t[0]:e+1}return u(x,b),function(){const t=new e.Rect({...z,width:q-D-J-1,height:O-1,left:D,top:0,fill:"transparent"});x.value.add(t)}(),function(){function t(t,n="left"){let r="left"===n?D:B;t.forEach(((t,n)=>{const{range:l,spaceValue:u,width:c,title:h,titleStyle:g,key:v,position:m="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:b}=t,j=[],C=[],P=r+c/2,S=y(l,u),E=S.length;S.forEach(((e,n)=>{const{lineXMain:o,lineXSub:i,textLeft:l}=d(m,r,c),s=O-n*$*k,a=0===n?O-8:n!==S.length-1||H||Q&&"FHR"!==v?s:H+8;!w||(0===n||n===E-1)&&!b||j.push(f(String(e),t,l,a)),C.push(...p(t,n,o,i,s,$,H,E))}));const G=new e.Rect({...a,strokeWidth:.5,width:c,height:O,left:P,top:O/2}),M=o([P,H>0?H-$/2:$/2],{value:String(h),...i,...g}),T=new e.Group([...C,...j,G,...M?[M]:[]],{objectCaching:!1,...s});x.value.add(T),T.sendToBack(),r+=c}))}t(N),t(R,"right")}(),function(){const{show:t,startTime:n,range:r=[0,23],position:l="top",style:a}=X.time,{show:u,range:c=[0,23],position:d,style:f}=X.processTime;if(t||u){const p=[],h=[],g=[],v=[],m=I+W/2,y=$/2;for(let e=0;e<A.mainXCell;e++){if(t){const t=0===e?+n.slice(11,13):se(p.at(-1),r);p.push(t);const s="top"===l?H-y:O+y;g.push(o([m+e*W,s],{value:String(t),...i,...a||{}}))}if(u){const t=0===e?c[0]:h.at(-1)+1;h.push(t);const n="top"===d?y:Z-y;v.push(o([m+e*W,n],{value:String(t),...i,...f||{}}))}}const k=new e.Group([...g,...v],{objectCaching:!1,...s});x.value.add(k),x.value.sendToBack(k)}}(),function(){var e;const n=Object.values(U),o=[],i={},r=_.find((e=>"cervix"===e.key&&e.show)),l=null==(e=null==r?void 0:r.data)?void 0:e.find((e=>3==+e.value));function s(e,t){const{key:n,range:o}=r||{},i=E(n,o,10),l=[0,t],s=[-t/e,0],a=[(O-i-t)/e,O-i],u=[B-I,e*(B-I)+t];let c=[],d=[];function f([n,o]){return Math.abs(o-e*n-t)<=1}function p([e,t]){const[n,o]=[...h([e,t])];return n>=I&&n<=B&&o>=i&&o<=O}function h([e,t]){return[I+e,O-t]}return f(l)&&p(l)&&(c=h(l)),f(s)&&p(s)&&(c=h(s)),f(a)&&p(a)&&(d=h(a)),f(u)&&p(u)&&(d=h(u)),[...c,...d]}n.forEach((e=>{if(!e.show)return;const{key:n}=e;switch(n){case"fetalPresentation":{const{range:i,show:r}=_.find((e=>e.key===n));if(r){const r=E(n,i,0);o.push(t([I,r,B,r],{...e}))}break}case"alert":if(l){const{key:n,range:a}=r||{},u=216e5,c={time:w(new Date(m(l.time)+u),"yyyy-MM-dd HH:mm"),value:10},[d,f]=[S(l.time)-I,O-E(n,a,l.value)],[p,h]=[S(c.time)-I,O-E(n,a,c.value)],g=(h-f)/(p-d),v=f-d*g,y=s(g,v);y.length>0&&(o.push(t(y,{...e})),Object.assign(i,{k:g,b:v}))}break;case"handling":if(l){const{k:n,b:r}=i,a=144e5,u=s(n,r-(S(w(new Date(m(l.time)+a),"yyyy-MM-dd HH:mm"))-S(l.time))*n);u.length>0&&o.push(t(u,{...e}))}}})),x.value.add(...o)}(),te(),function(){function e(e,t){const n=_.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:n,key:e.key},pointer:t}}b.event.evented&&x.value.on("mouse:up",(t=>{if(3===t.button){const{x:n=0,y:o=0}=t.pointer||{};n>=I&&n<=B&&o>=H&&o<=O&&(P.point={x:n,y:o},P.show=!0,t.target?(P.target=t.target,P.list=["删除节点"],[...ee].forEach((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&P.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(P.target=null,P.list=["新增节点"],_.filter((e=>e.show)).forEach((i=>{if(!T([...ee],n,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<Q)return;P.list.push(e(i,t.pointer))}})),1===P.list.length&&(P.show=!1,Y("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=q-J/2;function t(e,t){if(!e.length)return;let o=H;const i=[];e.forEach((e=>{const n=e.title.split("").join("\n"),r=F.findIndex((t=>t.key===e.key)),{text:s,icon:a}=l(n,e,{text:{originY:"top",left:t,top:o},icon:{left:t,topY:o,originY:"top",origin:{type:e.type,dataIndex:r},...b.event}},"vertical");var u;o+=s.height+a.height+15,(u=a).on("moving",(()=>{u.set("originY","center"),L(u)?(ie(u),re(u)):C.show=!1})),u.on("mouseup:before",(e=>{if(C.show=!1,0===e.e.button&&L(u))if(T([...ee],u.left,"key").includes(u.origin.key))Y("repeat");else{const e={data:{time:G(u.left),value:M(u.origin.key,u.top)},...u.origin};j("add",e),ne(e)}!function(e){e.setCoords().set({originY:"top",left:e.originLeft,top:e.originTop})}(u)})),i.push(s,a)})),n(i),x.value.add(...i)}function n(e){const t=e.at(-1),n=(O-H)/2,o=(t.height+t.top-H)/2;e.forEach((e=>{const t=e.top+n-o;e.set({top:t,originTop:t})}))}t(N,D/2),t(R,e)}(),{clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(j("remove",n),ne(n,"remove")):(Object.assign(n,{data:{time:G(e.pointer.x),value:M(e.origin.key,e.pointer.y)}}),j("add",n),ne(n))},redrawPoints:oe}}export{x as useBirthProcess};
@@ -1 +1 @@
1
- export{defaultBorderStyle,defaultLineStyle,defaultRectStyle,defaultStyle,defaultTextStyle,drawArrow,drawLine,drawPoint,drawText,drawTextAndIconGroup,drawTextGroup}from"./useDraw.js";export{useGrid}from"./useGrid.js";export{useBirthProcessCumputedPoint,useCumputedPoint}from"./useCumputedPoint.js";export{useCanvasEvent}from"./useEvent.js";export{drawScaleLine,drawScaleNumber,getScaleInfo}from"./useScaleColumn.js";export{useCommon}from"./useCommon.js";export{useBirthProcessChart}from"./birthProcess/useBirthProcessChart.js";export{useTemperatureChart}from"./temperature/useTemperatureChart.js";export{useSurgicalAnesthesiaChart}from"./surgicalAnesthesia/useSurgicalAnesthesiaChart.js";
1
+ export{defaultBorderStyle,defaultLineStyle,defaultRectStyle,defaultStyle,defaultTextStyle,drawArrow,drawLine,drawPoint,drawText,drawTextAndIconGroup,drawTextGroup}from"./useDraw.js";export{useGrid}from"./useGrid.js";export{useBirthProcessCumputedPoint,useCumputedPoint}from"./useCumputedPoint.js";export{bus,useCanvasEvent}from"./useEvent.js";export{drawScaleLine,drawScaleNumber,getScaleInfo}from"./useScaleColumn.js";export{useCommon}from"./useCommon.js";export{useBirthProcessChart}from"./birthProcess/useBirthProcessChart.js";export{useTemperatureChart}from"./temperature/useTemperatureChart.js";export{useSurgicalAnesthesiaChart}from"./surgicalAnesthesia/useSurgicalAnesthesiaChart.js";
@@ -12,4 +12,7 @@ export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: AnyObje
12
12
  setPopup: (point: any, status?: string) => void;
13
13
  updateData: (params: AnyObject, mode?: string, n?: number) => void;
14
14
  getGridPoints: () => IObject[];
15
+ getContainPoints: (gridPoints?: never[]) => IObject[];
16
+ showDialog: (callback: Function) => void;
17
+ removeCurrentSelection: () => void;
15
18
  };
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t,drawLine as n,drawPoint as o}from"../useDraw.js";import{useGrid as i}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getPointRange as a,getIndex as s,isEffectiveNode as u,getTime as f}from"../../utils/index.js";import{cloneDeep as c}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function p(p,d,m,v,g){const{cumputedX:h,cumputedY:y,getXValue:x,getYValue:L}=l(d),{xCellWidth:k,pointSelectionStyle:P,originX:w,endX:b,originY:A,endY:C,event:j,scaleValues:T,xAxis:M,startTime:X,timeXCell:E,itemList:I,dialog:$}=d,O=new Map,S=new Set,V=c(T);let Y=[],_=null;i(p,d);const{getEqualXTypes:D,handleAddPrevent:N}=r(p,m,d);function z(){V.forEach((e=>{e.dataList.forEach(((t,o)=>{t.show&&(!function(e,t){const{max:o={},min:i={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function a({show:e=!1,value:o,name:i,lineStyle:l}){if(!e||!o)return;const r=y(t.type,t.range,o),a=n([w,r,b,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});j.hovered&&i&&(a.on("mousemove",(({pointer:e})=>{v.point={...e||{x:a.left,y:a.top}},v.list=[`${i} ${o}${t.unit||""}`],v.show=!0})),a.on("mouseout",(()=>{v.show=!1}))),p.value.add(a)}a(o),a(i),a(l),a(r)}(t,e),J(t,o,e))}))}))}function G(){_&&p.value.remove(_),_=null}function J(e,t,i){var l;const{type:r,unit:a,dataList:s=[]}=i,u=[];O.set(e.key,[]),null==(l=e.list)||l.forEach(((l,s)=>{!function(e,l,s,f){var c;let g,h;const{pointAttr:y={},lineAttr:P={},title:w="",key:b,type:A="circle"}=f,C=K(f.list[s+1],i);e&&C&&!l.breakpoint&&e[0]!==C[0]&&(h=n([...e,...C],P));const T=u[s-1],M={origin:{data:l,title:w,key:b||"",unit:a,type:r,dataIndex:t,index:s,lineAttr:P},__type:"main",leftLine:T,rightLine:h,...y,...d.event.hovered?d.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:d.event};T?g=o(A,{left:T.get("x2"),top:T.get("y2"),...M}):e&&(M.leftLine=null,g=o(A,{left:e[0],top:e[1],...M}));u.push(h),g&&(g.originLeft=g.left,g.originTop=g.top,function(e){j.hovered&&(e.on("mouseover",(()=>{B(e,"hover")})),e.on("mouseout",(()=>{v.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{H(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),j.hovered&&B(e),function(e){const{originLeft:t,originTop:n,left:o,top:i,origin:l}=e,r=~~((o-t)/k);if(o>t+k&&!e.nextPoint){if(0===Y.length){q(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[t,n],t,n]),e.leftLine&&e.leftLine.set({stroke:"transparent"})}const o=t+k*r;if(Y.every((e=>e.left!==o))){const t=x(o),n=L(l.type,i);Y.push({data:{time:t,value:n},left:o,top:i}),q(e,[...e.prevPointer,o,i])}Y.length<r&&function(e,t){const{originLeft:n,originTop:o,origin:i}=e;let l=1;for(;l<=t;){const t=n+k*l,r=Y.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=Y.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=Y[l-1]||{left:n,top:o},u=~~((r.left-(t-k))/k),f=(r.top-s.top)/u;a.top=s.top+f,a.left=t,a.data={time:x(t),value:L(i.type,a.top)},Y.splice(l,0,a),q(e,[s.left,s.top,a.left,a.top])}}l++}}(e,r)}if(Y.length>0&&o<Y[Y.length-1].left){for(const e of S)e.left>o&&(e.leftLine&&p.value.remove(e.leftLine),p.value.remove(e));if(Y=Y.filter((e=>e.left<=o)),0===Y.length){e.leftLine&&e.leftLine.set(e.origin.lineAttr);for(const e of S)e.leftLine&&p.value.remove(e.leftLine),p.value.remove(e)}if(Y.length>0){const t=Y.at(-1);e.prevPointer=[t.left,t.top]}}}(e)})),e.on("mouseup",(t=>{if(v.show=!1,1===t.button){const{key:t,type:n}=e.origin,o={...e.origin,data:{...e.origin.data,time:x(e.left),value:L(n,e.top)}};if(p.value.discardActiveObject(),Y.length>0){const e=Y.map((e=>e.data));m("add",{...o,data:e}),F({...o,data:e})}else m("change",o),F(o,"change")}}))}(g),null==(c=O.get(b))||c.push(g))}(K(l,i),l,s,e)})),Promise.all(O.get(e.key)).then((e=>{const t=u.filter((e=>e));let n=null;e=e.map((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),p.value.add(...t,...e)}))}function q(e,t){const[o,i,l,r]=t;e.clone((o=>{o.set({left:l,top:r}),e.prevPointer=[l,r];const i=n(t,e.origin.lineAttr);o.leftLine=i,S.add(o),p.value.add(i,o)}))}function F(e,t="add",n=1){const{dataIndex:o,data:i,index:l,key:r,type:a}=e,u=V.find((e=>e.type===a)),f=u.dataList.find((e=>e.key===r));switch(t){case"remove":f.list.splice(l,n);break;case"change":f.list[l]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=s(e,f.list),n=Array.isArray(i)?i:[i];f.list.splice(t,0,...n);break}}R({dataIndex:o,scaleValue:u})}function R(e){var t,n,o;if(S.size&&(null==(t=p.value)||t.remove(...W([...S]))),S.clear(),Y=[],e){const{dataIndex:t,scaleValue:o}=e,i=o.dataList[t];null==(n=p.value)||n.remove(...W(O.get(i.key))),O.delete(i.key),J(i,t,o)}else O.size&&(null==(o=p.value)||o.remove(...W(Q()))),O.clear(),z()}function W(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine)})),t}function B(e,t="moving"){const{title:n,type:o,data:i,unit:l}=e.origin;v.point={x:e.left,y:e.top};const r=`${"hover"===t?i.value:L(o,e.top)}`;v.list=[`${n} ${r}${l||""}`,`时间 ${x(e.left).slice(-5)}`],v.show=!0}function H(e){e.setCoords();const t=6e4/E,n=e.prevPoint?e.prevPoint.left+t:w,o=e.nextPoint?e.nextPoint.left-t:b;e.top<A&&e.set("top",A),e.top>C&&e.set("top",C),e.left<n&&e.set("left",n),e.left>o&&e.set("left",o)}function K(e,t){if(u(e)&&function(e){const t=Date.parse(M.list.at(-1)),n=f(e);return n>=X&&n<=t}(e.time)){const n=h(e.time),o=y(t.type,t.range,e.value);return[n,o<A?A:o>C?C:o]}}function Q(){return Array.from(O.values()).flat()}return z(),function(){if(!j.evented)return;let n=!1,o={x:0,y:0};p.value.on("mouse:up",(e=>{if(3===e.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=w&&t<=b&&n>=A&&n<=C)if(e.target){if("main"!==e.target.__type)return;o(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:i,maxTop:l}=a(e.target);Q().forEach((o=>{"main"===o.__type&&o.left>t&&o.left<n&&o.top>i&&o.top<l&&g.list.push({renderItem:()=>o.origin.title,origin:{...o.origin},mode:"remove",pointer:e.pointer})})),1===g.list.length&&(g.show=!1,console.log("当前时间段内无可删除节点"))}else o(e.pointer,null,["新增节点"]),I.forEach((n=>{D(Q(),t,"key",2*k).includes(n.key)||g.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key},pointer:e.pointer})})),1===g.list.length&&(g.show=!1,N("repeat"),console.log("当前时间段内无可新增节点"));function o(e,t,n){Object.assign(g,{point:e,show:!0,target:t,list:n})}}(e),1===e.button&&n){n=!1;const e=function(){if(!(null==_?void 0:_.areaPos))return[];const{startPos:e,endPos:t}=_.areaPos,[n,o]=[e.x,t.x].sort(((e,t)=>e-t)),[i,l]=[e.y,t.y].sort(((e,t)=>e-t));return Q().filter((e=>e.left>=n&&e.left<=o&&e.top>=i&&e.top<=l))}();e.length>0?$.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{const t=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return F(n[0],"remove",n.length),n}))}(e);m("remove",t),G()},onNegativeClick:()=>G(),onClose:()=>G()}):G()}})),p.value.on("mouse:down",(e=>{1!==e.button||e.target||(n=!0,o=e.pointer)})),p.value.on("mouse:move",(i=>{if(!n)return;const{x:l,y:r}=o,{x:a,y:s}=i.pointer;_&&p.value.remove(_),_=new e.Rect({...t,fill:"#CAF982",opacity:.4,...P,left:l,top:r,width:a-l,height:s-r,objectCaching:!0}),_.areaPos={startPos:o,endPos:i.pointer},p.value.add(_)}))}(),{redrawPoints:R,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(m("remove",n),F(n,"remove")):(Object.assign(n,{data:{time:x(e.pointer.x),value:L(e.origin.type,e.pointer.y)}}),m("add",n),F(n))},moveLimit:H,setPopup:B,updateData:F,getGridPoints:Q}}export{p as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t,drawLine as n,drawPoint as o}from"../useDraw.js";import{useGrid as i}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import{bus as r}from"../useEvent.js";import{useCommon as a}from"../useCommon.js";import"vue";import{getPointRange as s,getIndex as u,isEffectiveNode as f,getTime as c}from"../../utils/index.js";import{cloneDeep as p}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function m(m,d,v,g,h){const{cumputedX:y,cumputedY:x,getXValue:L,getYValue:k}=l(d),{xCellWidth:P,pointSelectionStyle:w,originX:b,endX:C,originY:j,endY:A,event:T,scaleValues:E,xAxis:M,startTime:X,timeXCell:I,itemList:S,dialog:$}=d,O=new Map,V=new Set,Y=p(E);let D=[],_=null;i(m,d);const{getEqualXTypes:N,handleAddPrevent:z}=a(m,v,d);function G(){Y.forEach((e=>{e.dataList.forEach(((t,o)=>{t.show&&(!function(e,t){const{max:o={},min:i={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function a({show:e=!1,value:o,name:i,lineStyle:l}){if(!e||!o)return;const r=x(t.type,t.range,o),a=n([b,r,C,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});T.hovered&&i&&(a.on("mousemove",(({pointer:e})=>{g.point={...e||{x:a.left,y:a.top}},g.list=[`${i} ${o}${t.unit||""}`],g.show=!0})),a.on("mouseout",(()=>{g.show=!1}))),m.value.add(a)}a(o),a(i),a(l),a(r)}(t,e),R(t,o,e))}))}))}function J(e=[]){if(!(null==_?void 0:_.areaPos))return[];const{startPos:t,endPos:n}=_.areaPos,[o,i]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:ee()).filter((e=>e.left>=o&&e.left<=i&&e.top>=l&&e.top<=r))}function q(e){$.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),F()},onNegativeClick:()=>F(),onClose:()=>F()})}function F(){_&&m.value.remove(_),_=null}function R(e,t,i){var l;const{type:r,unit:a,dataList:s=[]}=i,u=[];O.set(e.key,[]),null==(l=e.list)||l.forEach(((l,s)=>{!function(e,l,s,f){var c;let p,h;const{pointAttr:y={},lineAttr:x={},title:w="",key:b,type:C="circle"}=f,j=Z(f.list[s+1],i);e&&j&&!l.breakpoint&&e[0]!==j[0]&&(h=n([...e,...j],x));const A=u[s-1],E={origin:{data:l,title:w,key:b||"",unit:a,type:r,dataIndex:t,index:s,lineAttr:x},__type:"main",leftLine:A,rightLine:h,...y,...d.event.hovered?d.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:d.event};A?p=o(C,{left:A.get("x2"),top:A.get("y2"),...E}):e&&(E.leftLine=null,p=o(C,{left:e[0],top:e[1],...E}));u.push(h),p&&(p.originLeft=p.left,p.originTop=p.top,function(e){T.hovered&&(e.on("mouseover",(()=>{Q(e,"hover")})),e.on("mouseout",(()=>{g.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{U(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),T.hovered&&Q(e),function(e){const{originLeft:t,originTop:n,left:o,top:i,origin:l}=e,r=~~((o-t)/P);if(o>t+P&&!e.nextPoint){if(0===D.length){W(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[t,n],t,n]),e.leftLine&&e.leftLine.set({stroke:"transparent"})}const o=t+P*r;if(D.every((e=>e.left!==o))){const t=L(o),n=k(l.type,i);D.push({data:{time:t,value:n},left:o,top:i}),W(e,[...e.prevPointer,o,i])}D.length<r&&function(e,t){const{originLeft:n,originTop:o,origin:i}=e;let l=1;for(;l<=t;){const t=n+P*l,r=D.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=D.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=D[l-1]||{left:n,top:o},u=~~((r.left-(t-P))/P),f=(r.top-s.top)/u;a.top=s.top+f,a.left=t,a.data={time:L(t),value:k(i.type,a.top)},D.splice(l,0,a),W(e,[s.left,s.top,a.left,a.top])}}l++}}(e,r)}if(D.length>0&&o<D[D.length-1].left){for(const e of V)e.left>o&&(e.leftLine&&m.value.remove(e.leftLine),m.value.remove(e));if(D=D.filter((e=>e.left<=o)),0===D.length){e.leftLine&&e.leftLine.set(e.origin.lineAttr);for(const e of V)e.leftLine&&m.value.remove(e.leftLine),m.value.remove(e)}if(D.length>0){const t=D.at(-1);e.prevPointer=[t.left,t.top]}}}(e)})),e.on("mouseup",(t=>{if(g.show=!1,1===t.button){const{key:t,type:n}=e.origin,o={...e.origin,data:{...e.origin.data,time:L(e.left),value:k(n,e.top)}};if(m.value.discardActiveObject(),D.length>0){const e=D.map((e=>e.data));v("add",{...o,data:e}),B({...o,data:e})}else v("change",o),B(o,"change")}}))}(p),null==(c=O.get(b))||c.push(p))}(Z(l,i),l,s,e)})),Promise.all(O.get(e.key)).then((e=>{const t=u.filter((e=>e));let n=null;e=e.map((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),m.value.add(...t,...e)}))}function W(e,t){const[o,i,l,r]=t;e.clone((o=>{o.set({left:l,top:r}),e.prevPointer=[l,r];const i=n(t,e.origin.lineAttr);o.leftLine=i,V.add(o),m.value.add(i,o)}))}function B(e,t="add",n=1){const{dataIndex:o,data:i,index:l,key:r,type:a}=e,s=Y.find((e=>e.type===a)),f=s.dataList.find((e=>e.key===r));switch(t){case"remove":f.list.splice(l,n);break;case"change":f.list[l]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=u(e,f.list),n=Array.isArray(i)?i:[i];f.list.splice(t,0,...n);break}}H({dataIndex:o,scaleValue:s})}function H(e){var t,n,o;if(V.size&&(null==(t=m.value)||t.remove(...K([...V]))),V.clear(),D=[],e){const{dataIndex:t,scaleValue:o}=e,i=o.dataList[t];null==(n=m.value)||n.remove(...K(O.get(i.key))),O.delete(i.key),R(i,t,o)}else O.size&&(null==(o=m.value)||o.remove(...K(ee()))),O.clear(),G()}function K(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine)})),t}function Q(e,t="moving"){const{title:n,type:o,data:i,unit:l}=e.origin;g.point={x:e.left,y:e.top};const r=`${"hover"===t?i.value:k(o,e.top)}`;g.list=[`${n} ${r}${l||""}`,`时间 ${L(e.left).slice(-5)}`],g.show=!0}function U(e){e.setCoords();const t=6e4/I,n=e.prevPoint?e.prevPoint.left+t:b,o=e.nextPoint?e.nextPoint.left-t:C;e.top<j&&e.set("top",j),e.top>A&&e.set("top",A),e.left<n&&e.set("left",n),e.left>o&&e.set("left",o)}function Z(e,t){if(f(e)&&function(e){const t=Date.parse(M.list.at(-1)),n=c(e);return n>=X&&n<=t}(e.time)){const n=y(e.time),o=x(t.type,t.range,e.value);return[n,o<j?j:o>A?A:o]}}function ee(){return Array.from(O.values()).flat()}return G(),function(){if(!T.evented)return;let n=!1,o={x:0,y:0};m.value.on("mouse:up",(e=>{if(3===e.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=b&&t<=C&&n>=j&&n<=A)if(e.target){if("main"!==e.target.__type)return;o(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:i,maxTop:l}=s(e.target);ee().forEach((o=>{"main"===o.__type&&o.left>t&&o.left<n&&o.top>i&&o.top<l&&h.list.push({renderItem:()=>o.origin.title,origin:{...o.origin},mode:"remove",pointer:e.pointer})})),1===h.list.length&&(h.show=!1,console.log("当前时间段内无可删除节点"))}else o(e.pointer,null,["新增节点"]),S.forEach((n=>{N(ee(),t,"key",2*P).includes(n.key)||h.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key},pointer:e.pointer})})),1===h.list.length&&(h.show=!1,z("repeat"),console.log("当前时间段内无可新增节点"));function o(e,t,n){Object.assign(h,{point:e,show:!0,target:t,list:n})}}(e),1===e.button&&n){n=!1;const e=J();e.length>0?q((()=>{const t=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return B(n[0],"remove",n.length),n}))}(e);v("remove",t)})):r.emit(_)}})),m.value.on("mouse:down",(e=>{1!==e.button||e.target||(n=!0,o=e.pointer)})),m.value.on("mouse:move",(i=>{if(!n)return;const{x:l,y:r}=o,{x:a,y:s}=i.pointer;_&&m.value.remove(_),_=new e.Rect({...t,fill:"#CAF982",opacity:.4,...w,left:l,top:r,width:a-l,height:s-r,objectCaching:!0}),_.areaPos={startPos:o,endPos:i.pointer},m.value.add(_)}))}(),{redrawPoints:H,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(v("remove",n),B(n,"remove")):(Object.assign(n,{data:{time:L(e.pointer.x),value:k(e.origin.type,e.pointer.y)}}),v("add",n),B(n))},moveLimit:U,setPopup:Q,updateData:B,getGridPoints:ee,getContainPoints:J,showDialog:q,removeCurrentSelection:F}}export{m as useCenter};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as n,defaultTextStyle as l,defaultStyle as r}from"../useDraw.js";import{useBirthProcessCumputedPoint as a}from"../useCumputedPoint.js";import{drawScaleNumber as s}from"../useScaleColumn.js";import{useCommon as u}from"../useCommon.js";import"vue";import{getScaleNumberList as d}from"../../utils/index.js";import{cloneDeep as c}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function h(h,p,f,m,g,v,w,y){const{getYValue:j,getXValue:x}=a(p),{getEqualXTypes:b,handleAddPrevent:W,isGridLimit:X}=u(h,f,p),{originY:C,endY:k,borderStyle:E,left:S,itemList:Y,scaleValues:L,originX:V,endX:G,yCellHeight:H,markHeight:N,canvasWidth:T,canvasHeight:M,xCellWidth:P}=p;!function(){if(!S)return;const{title:t,titleWidth:i,titleStyle:o}=S,n=e({width:i,height:k-C+N,...E},{value:t.split("").join("\n"),...o||{}},{left:0,top:C},!0);h.value.add(n)}(),L.forEach(((e,i)=>{var o,a;const u="left"===e.layout?V-5:G+5,{range:c,spaceValue:p,title:f,unit:m,titleStyle:g,spaceGridNumber:v=1,showNumber:w,showMaxMinNumber:y}=e,j=[],x=d(c,p),b=x.length;x.forEach(((t,i)=>{const o=0===i?k-5:k-i*H*v;!w||(0===i||i===b-1)&&!y||j.push(s(String(t),{...e,position:e.layout},u,o))}));const W=f&&n(["left"===e.layout?S.width/2:G+(T-G)/2,(null!=(a=null==(o=j.at(-1))?void 0:o.top)?a:330)-H],{value:`${f}${m?"\n"+m:""}`,...l,...g}),X=new t.Group([...j,...W?[W]:[]],{objectCaching:!1,...r});h.value.add(X),X.sendToBack()})),function(){const e=new t.Rect({width:V-S.titleWidth,height:k-C+N,left:S.titleWidth,top:C,...i,originX:"left",originY:"top",...E});h.value.add(e);const n=c(Y),l=c(S.externalIconList||[]).map((t=>({...t,isExternal:!0})));let r=k;const a=S.titleWidth+15;l.concat(n.reverse()).forEach((t=>{r-=10;const e=t.title,{text:i,icon:n}=o(e,t,{text:{left:a,top:r},icon:{leftX:a,topY:r,...t.isExternal?{evented:!1,selectable:!1}:{}}});var l;r-=i.height||30,(l=n).on("moving",(()=>{l.set("originX","center"),X(l)?(g(l),v(l)):m.show=!1})),l.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&X(l))if(b(y(),l.left,"key",2*P).includes(l.origin.key))W("repeat");else{const t={data:{time:x(l.left),value:j(l.origin.type,l.top)},...l.origin};f("add",t),w(t)}!function(t){t.setCoords().set({originX:"left",left:t.originLeft,top:t.originTop})}(l)})),h.value.add(i,n)}))}(),h.value.add(new t.Rect({left:0,top:0,width:T-E.strokeWidth,height:M-E.strokeWidth,fill:"transparent",...E}))}export{h as useLeft};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as n,defaultTextStyle as l,defaultStyle as r}from"../useDraw.js";import{useBirthProcessCumputedPoint as s}from"../useCumputedPoint.js";import"../useEvent.js";import{drawScaleNumber as a}from"../useScaleColumn.js";import{useCommon as u}from"../useCommon.js";import"vue";import{getScaleNumberList as d}from"../../utils/index.js";import{cloneDeep as c}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function h(h,p,f,m,g,v,w,j){const{getYValue:y,getXValue:x}=s(p),{getEqualXTypes:b,handleAddPrevent:W,isGridLimit:X}=u(h,f,p),{originY:C,endY:E,borderStyle:k,left:S,itemList:Y,scaleValues:L,originX:V,endX:G,yCellHeight:H,markHeight:N,canvasWidth:T,canvasHeight:M,xCellWidth:P}=p;!function(){if(!S)return;const{title:t,titleWidth:i,titleStyle:o}=S,n=e({width:i,height:E-C+N,...k},{value:t.split("").join("\n"),...o||{}},{left:0,top:C},!0);h.value.add(n)}(),L.forEach(((e,i)=>{var o,s;const u="left"===e.layout?V-5:G+5,{range:c,spaceValue:p,title:f,unit:m,titleStyle:g,spaceGridNumber:v=1,showNumber:w,showMaxMinNumber:j}=e,y=[],x=d(c,p),b=x.length;x.forEach(((t,i)=>{const o=0===i?E-5:E-i*H*v;!w||(0===i||i===b-1)&&!j||y.push(a(String(t),{...e,position:e.layout},u,o))}));const W=f&&n(["left"===e.layout?S.width/2:G+(T-G)/2,(null!=(s=null==(o=y.at(-1))?void 0:o.top)?s:330)-H],{value:`${f}${m?"\n"+m:""}`,...l,...g}),X=new t.Group([...y,...W?[W]:[]],{objectCaching:!1,...r});h.value.add(X),X.sendToBack()})),function(){const e=new t.Rect({width:V-S.titleWidth,height:E-C+N,left:S.titleWidth,top:C,...i,originX:"left",originY:"top",...k});h.value.add(e);const n=c(Y),l=c(S.externalIconList||[]).map((t=>({...t,isExternal:!0})));let r=E;const s=S.titleWidth+15;l.concat(n.reverse()).forEach((t=>{r-=10;const e=t.title,{text:i,icon:n}=o(e,t,{text:{left:s,top:r},icon:{leftX:s,topY:r,...t.isExternal?{evented:!1,selectable:!1}:{}}});var l;r-=i.height||30,(l=n).on("moving",(()=>{l.set("originX","center"),X(l)?(g(l),v(l)):m.show=!1})),l.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&X(l))if(b(j(),l.left,"key",2*P).includes(l.origin.key))W("repeat");else{const t={data:{time:x(l.left),value:y(l.origin.type,l.top)},...l.origin};f("add",t),w(t)}!function(t){t.setCoords().set({originX:"left",left:t.originLeft,top:t.originTop})}(l)})),h.value.add(i,n)}))}(),h.value.add(new t.Rect({left:0,top:0,width:T-k.strokeWidth,height:M-k.strokeWidth,fill:"transparent",...k}))}export{h as useLeft};
@@ -2,7 +2,7 @@ import { Ref } from 'vue';
2
2
  import { fabric } from '../../../../../../es/shared/utils/fabricjs';
3
3
  import { IPointTipProps, IPointMenuProps } from '../../../../../../es/components/fabric-chart/src/interface';
4
4
  import { AnyObject } from '../../../../../../es/shared/types';
5
- export declare function useOther(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: Function, pointTipProps: IPointTipProps, pointMenuProps: IPointMenuProps, moveLimit: Function): {
5
+ export declare function useOther(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: Function, pointTipProps: IPointTipProps, pointMenuProps: IPointMenuProps, moveLimit: Function, getContainPoints: Function, showDialog: Function, removeCurrentSelection: Function): {
6
6
  clickMenu: ({ item, target }: {
7
7
  item: AnyObject;
8
8
  target: any;
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i}from"../useDraw.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import{useCommon as n}from"../useCommon.js";import"vue";import{getIndex as r}from"../../utils/index.js";import{cloneDeep as l}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as a}from"../../constants/index.js";import"naive-ui";function s(s,d,f,u,c,h){const{cumputedX:m,getXValue:g}=o(d),{getEqualXTypes:p,handleAddPrevent:v,isGridLimit:x}=n(s,f,d),{other:k,yCellHeight:y,xCellWidth:X,endX:P,originX:b,originY:w,endY:A,markHeight:E,event:j,topGridYCellHeight:C}=d,z=new Map,L=l(k);function S(){var o;if(!(null==(o=null==L?void 0:L.horizontal)?void 0:o.length))return;const n="horizontal";z.set(n,[]);const{horizontal:r}=L;let l=w+y/2;r.forEach(((o,r)=>{const{title:a,type:d,pointAttr:f={},textStyle:u={},data:c}=o;let h=null;c.forEach(((o,c)=>{const{time:g,value:p}=o,v=m(g);if(!V(v))return;const x=e(d,{...f,left:v,top:l}),k=v+x.width/2+2,y=i([k,l],{value:p,...u,originX:"left"}),X=new t.Group([x,y],{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer"});Object.assign(X,{originLeft:v,iconHalfWidth:x.width/2,origin:{type:"other",key:n,dataIndex:r,index:c,data:o,title:a},limitX:{x1:b,x2:P-X.width}}),h&&(X.limitX.x1=h.left,h.limitX.x2=X.left,X.prevPoint=h,h.nextPoint=X),h=X,Y(X),z.get(n).push(X),s.value.add(X)})),l+=y}))}function H(){var t;if(!(null==(t=null==L?void 0:L.vertical)?void 0:t.length))return;const i="vertical";z.set(i,[]);const{vertical:o}=L;o.forEach(((t,o)=>{const{textStyle:n={},data:r,time:l}=t,a=m(l);if(!V(a))return;let d=w+y/2;r.forEach(((t,r)=>{const l=e(String(t),{...n,lockMovementY:!0,left:a,originX:"left",top:d,origin:{type:"other",key:i,dataIndex:o,index:r,data:{value:t}}});d+=y,Y(l),z.get(i).push(l),s.value.add(l)})),z.get(i).filter((t=>t.origin.dataIndex===o)).forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index))}))}))}function I(t,e="add"){const{dataIndex:i,data:o,index:n,key:l}=t,a=L[l],d=["mark"].includes(l)?a.dataList[i]:a[i];switch(e){case"remove":d.data.splice(n,1);break;case"change":d.data[n]=o;break;default:{const t=Array.isArray(o)?o[0].time:o.time,e=r(t,d.data),i=Array.isArray(o)?o:[o];d.data.splice(e,0,...i);break}}!function(t){var e;const{key:i}=t;switch(null==(e=s.value)||e.remove(...z.get(i)),z.delete(i),i){case"horizontal":S();break;case"vertical":H();break;case"mark":M()}}(t)}function M(){if(!(null==k?void 0:k.mark)||!E)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=k.mark,l=i([b-5,A+E/2],{value:t,...o,originX:"right"});s.value.add(l);const a=A+E,d=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=m(i);if(!V(r))return;let l=A;o.forEach((t=>{let i=!1;const o=e("circleAndText",{...n,text:t.text,left:r,top:l,origin:{data:t,key:"mark",type:"other"}}),f=o.height;l+f<=a&&l>=A?(o.set("top",l+f/2),l+=f):(i||(l=A,i=!0),o.set("top",l-f/2),l-=f),d.push(o),Y(o),s.value.add(o)}))})),function(t){const e=t=>{var e,i;return null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart},i=t.find((t=>e(t))),o=t.find((t=>!e(t)&&t.left>i.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:b,x2:P};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(d)}function Y(t){if(j.hovered&&(t.on("mouseover",(()=>{T(t)})),t.on("mouseout",(()=>{u.show=!1}))),!j.evented)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e);t.on("moving",(()=>{i?function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2);if("mark"===t.origin.key){t.top<w&&t.set("top",w);const e=A+E-t.height/2;t.top>e&&t.set("top",e)}t.originLeft&&t.iconHalfWidth&&(t.originLeft=t.left+t.iconHalfWidth)}(t):(h(t),function(t){var e;if(!(null==(e=t.siblingPoints)?void 0:e.length))return;t.siblingPoints.forEach((e=>e.setCoords().set("left",t.left)))}(t)),j.hovered&&T(t)})),t.on("mouseup",(n=>{var r;if(u.show=!1,1===n.button){i&&function(t){var e,i;if("mark"===t.origin.key){if((null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),i=Math.min(...e);t.startPoint.limitX.x2=i}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=g(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};s.value.discardActiveObject(),f("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(c.point={x:t.left,y:t.top},c.show=!0,c.target=t,c.list=a.map((t=>({...t,renderItem:()=>t.label}))))}))}function T(t){var e;u.point={x:t.left,y:"mark"===t.origin.key?t.top:t.top+C/2},u.list=[`时间 ${g(null!=(e=t.originLeft)?e:t.left).slice(-5)}`],"mark"===t.origin.key&&u.list.unshift(t.origin.data.name+" "),u.show=!0}function V(t){return t>=b&&t<=P}return function(){var t;if(!(null==(t=null==L?void 0:L.horizontal)?void 0:t.length))return;const{horizontal:i}=L,o=b-5;let n=w+y/2;i.forEach(((t,i)=>{const{title:r,titleStyle:l={},defaultAddValue:a}=t,d=r&&e(r,{...l,originX:"right",left:o,top:n,origin:{defaultAddValue:a,dataIndex:i,type:"other",key:"horizontal",title:r},originLeft:o,originTop:n});var c;(c=d).on("moving",(()=>{c.set("originX","center"),x(c)?T(c):u.show=!1})),c.on("mouseup:before",(t=>{if(u.show=!1,0===t.e.button&&x(c))if(p(z.get("horizontal"),c.left,"key",X).includes(c.origin.key))v("repeat");else{const t={data:{time:g(c.left),value:c.origin.defaultAddValue},...c.origin};f("add",t),I(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(c)})),s.value.add(d),n+=y}))}(),S(),H(),M(),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};f(i,o),"remove"===i&&I(o,i)}}}export{s as useOther};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i}from"../useDraw.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import{bus as n}from"../useEvent.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getIndex as a}from"../../utils/index.js";import{cloneDeep as l}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as s}from"../../constants/index.js";import"naive-ui";function d(d,u,c,f,h,m,g,p,v){const{cumputedX:x,getXValue:k}=o(u),{getEqualXTypes:y,handleAddPrevent:X,isGridLimit:b}=r(d,c,u),{other:P,yCellHeight:w,xCellWidth:j,endX:E,originX:z,originY:A,endY:C,markHeight:L,event:S,topGridYCellHeight:I}=u,H=new Map,M=l(P);function Y(){var o;if(!(null==(o=null==M?void 0:M.horizontal)?void 0:o.length))return;const n="horizontal";H.set(n,[]);const{horizontal:r}=M;let a=A+w/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:u={},textStyle:c={},data:f}=o;let h=null;f.forEach(((o,f)=>{const{time:m,value:g}=o,p=x(m);if(!B(p))return;const v=e(s,{...u,left:p,top:a}),k=p+v.width/2+2,y=i([k,a],{value:g,...c,originX:"left"}),X=new t.Group([v,y],{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer"});Object.assign(X,{originLeft:p,iconHalfWidth:v.width/2,origin:{type:"other",key:n,dataIndex:r,index:f,data:o,title:l},limitX:{x1:z,x2:E-X.width}}),h&&(X.limitX.x1=h.left,h.limitX.x2=X.left,X.prevPoint=h,h.nextPoint=X),h=X,O(X),H.get(n).push(X),d.value.add(X)})),a+=w}))}function T(){var t;if(!(null==(t=null==M?void 0:M.vertical)?void 0:t.length))return;const i="vertical";H.set(i,[]);const{vertical:o}=M;o.forEach(((t,o)=>{const{textStyle:n={},data:r,time:a}=t,l=x(a);if(!B(l))return;let s=A+w/2;r.forEach(((t,r)=>{const a=e(String(t),{...n,lockMovementY:!0,left:l,originX:"left",top:s,origin:{type:"other",key:i,dataIndex:o,index:r,data:{value:t}}});s+=w,O(a),H.get(i).push(a),d.value.add(a)})),H.get(i).filter((t=>t.origin.dataIndex===o)).forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index))}))}))}function V(t,e="add"){const{dataIndex:i,data:o,index:n,key:r}=t,l=M[r],s=["mark"].includes(r)?l.dataList[i]:l[i];switch(e){case"remove":s.data.splice(n,1);break;case"change":s.data[n]=o;break;default:{const t=Array.isArray(o)?o[0].time:o.time,e=a(t,s.data),i=Array.isArray(o)?o:[o];s.data.splice(e,0,...i);break}}W(t)}function W(t){var e;const{key:i}=t;switch(null==(e=d.value)||e.remove(...H.get(i)),H.delete(i),i){case"horizontal":Y();break;case"vertical":T();break;case"mark":G()}}function G(){if(!(null==P?void 0:P.mark)||!L)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=P.mark,a=i([z-5,C+L/2],{value:t,...o,originX:"right"});d.value.add(a);const l=C+L,s=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=x(i);if(!B(r))return;let a=C;o.forEach((t=>{let i=!1;const o=e("circleAndText",{...n,text:t.text,left:r,top:a,origin:{data:t,key:"mark",type:"other"}}),u=o.height;a+u<=l&&a>=C?(o.set("top",a+u/2),a+=u):(i||(a=C,i=!0),o.set("top",a-u/2),a-=u),s.push(o),O(o),d.value.add(o)}))})),function(t){const e=t=>{var e,i;return null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart},i=t.find((t=>e(t))),o=t.find((t=>!e(t)&&t.left>i.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:z,x2:E};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(s)}function O(t){if(S.hovered&&(t.on("mouseover",(()=>{q(t)})),t.on("mouseout",(()=>{f.show=!1}))),!S.evented)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e);t.on("moving",(()=>{i?function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2);if("mark"===t.origin.key){t.top<A&&t.set("top",A);const e=C+L-t.height/2;t.top>e&&t.set("top",e)}t.originLeft&&t.iconHalfWidth&&(t.originLeft=t.left+t.iconHalfWidth)}(t):(m(t),function(t){var e;if(!(null==(e=t.siblingPoints)?void 0:e.length))return;t.siblingPoints.forEach((e=>e.setCoords().set("left",t.left)))}(t)),S.hovered&&q(t)})),t.on("mouseup",(n=>{var r;if(f.show=!1,1===n.button){i&&function(t){var e,i;if("mark"===t.origin.key){if((null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),i=Math.min(...e);t.startPoint.limitX.x2=i}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=k(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};d.value.discardActiveObject(),c("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(h.point={x:t.left,y:t.top},h.show=!0,h.target=t,h.list=s.map((t=>({...t,renderItem:()=>t.label}))))}))}function q(t){var e;f.point={x:t.left,y:"mark"===t.origin.key?t.top:t.top+I/2},f.list=[`时间 ${k(null!=(e=t.originLeft)?e:t.left).slice(-5)}`],"mark"===t.origin.key&&f.list.unshift(t.origin.data.name+" "),f.show=!0}function B(t){return t>=z&&t<=E}return function(){var t;if(!(null==(t=null==M?void 0:M.horizontal)?void 0:t.length))return;const{horizontal:i}=M,o=z-5;let n=A+w/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l}=t,s=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r},originLeft:o,originTop:n});var u;(u=s).on("moving",(()=>{u.set("originX","center"),b(u)?q(u):f.show=!1})),u.on("mouseup:before",(t=>{if(f.show=!1,0===t.e.button&&b(u))if(y(H.get("horizontal"),u.left,"key",j).includes(u.origin.key))X("repeat");else{const t={data:{time:k(u.left),value:u.origin.defaultAddValue},...u.origin};c("add",t),V(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(u)})),d.value.add(s),n+=w}))}(),Y(),T(),G(),n.on((()=>{const t="horizontal",e=g(H.get(t));e.length>0?p((()=>{const i=function(t){const e=t.reduce(((t,e)=>{const{dataIndex:i}=e.origin;return t[i]=t[i]?t[i].concat(e.origin):[e.origin],t}),{});return Object.keys(e).map((t=>{const i=e[t];return M.horizontal[t].data.splice(i[0].index,i.length),i})).flat()}(e);W({key:t}),c("remove",i)})):v()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};c(i,o),"remove"===i&&V(o,i)}}}export{d as useOther};
@@ -1 +1 @@
1
- import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as l}from"vue";import{useDialog as n}from"naive-ui";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as o}from"date-fns";import{getChildrenSize as s}from"../../utils/index.js";import{cloneDeep as d,range as c}from"lodash-es";import"../temperature/useShadow.js";import{OTHER_MENU as p}from"../../constants/index.js";import{useTop as m}from"./useTop.js";import{useLeft as v}from"./useLeft.js";import{useCenter as h}from"./useCenter.js";import{useOther as f}from"./useOther.js";function g(g,y,x,w,b,j){const Y=n(),C=e(),H=e(),S=e(),D=t((()=>y.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),A=t((()=>{var e;return null!=(e=y.data.left.width)?e:0})),M=t((()=>{const{grid:e}=y.data;return e.mainXCell*e.subXCell})),T=t((()=>{const{grid:e}=y.data;return e.mainYCell*e.subYCell})),X=t((()=>s(y.data.top.treeData))),G=t((()=>y.data.top.tree.cellHeight)),V=t((()=>G.value*X.value)),k=t((()=>ee($("drug")||"top"))),L=t((()=>k.value+V.value)),N=t((()=>{var e;return Date.parse((null==(e=y.data.xAxis)?void 0:e.startTime)||o(new Date,"yyyy-MM-dd HH:mm:ss"))})),O=t((()=>{const e=d(y.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=c(M.value/t+1).map((r=>0===r?e.startTime:o(new Date(N.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:A.value}})),P=function(){const e=d(y.data.top.treeData);let t=0;const{cellWidth:a,cellHeight:r}=y.data.top.tree;return function e(i,l=0){i.forEach((i=>{var n;const u={top:t*r+k.value,left:l*a,width:a,height:r};if(t++,null==(n=i.children)?void 0:n.length){t--;const a=s(i.children);u.height=a*r,e(i.children,l+1)}else u.width=A.value-u.left;Object.assign(i,u)}))}(e),e}(),W=t((()=>ee($("xAxis")||"center"))),E=t((()=>{var e;const{width:t,right:a}=y.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),I=t((()=>ee($("intraoperatively")||"bottom"))),q=t((()=>{var e;const{show:t=!0,height:a}=(null==(e=y.data.other)?void 0:e.mark)||{};return t&&a?a:0})),z=t((()=>I.value+(y.data.height-V.value-O.value.height-q.value))),B=t((()=>(E.value-A.value)/M.value)),F=t((()=>(z.value-I.value)/T.value)),J=t((()=>O.value.spaceTimeStamp/B.value)),K=t((()=>{const{scaleValues:e}=y.data;return e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))).flat()})),Q=t((()=>te("pulse"))),R=t((()=>te("temperature"))),U=t((()=>{var e;return(null==(e=y.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),Z=a({canvasWidth:y.data.width,canvasHeight:y.data.height,borderStyle:{...u,...y.data.borderStyle},pointSelectionStyle:y.data.pointSelectionStyle||{},grid:y.data.grid,top:y.data.top,left:y.data.left,other:y.data.other,topGridYNumber:r(X),topGridYCellHeight:r(G),topGridOriginY:r(k),topGridEndY:r(L),treeData:P,xAxis:r(O),originYXAxis:r(W),startTime:r(N),timeXCell:r(J),gridXNumber:r(M),gridYNumber:r(T),xCellWidth:r(B),yCellHeight:r(F),originX:r(A),endX:r(E),originY:r(I),endY:r(z),markHeight:r(q),itemList:r(K),scaleValues:y.data.scaleValues,pulseYCell:r(Q),temperatureYCell:r(R),event:r(U),dialog:Y});function $(e){let t="";return Object.entries(D.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function _(e){const t=D.value[e],a=O.value.height;switch(t){case"drug":return V.value;case"xAxis":return a;default:return y.data.height-V.value-a}}function ee(e){switch(e){case"top":return 0;case"center":return _("top");default:return _("top")+_("center")}}function te(e){const{scaleValues:t}=y.data,a=t.find((t=>t.type===e));return F.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await l(),m(g,Z,x,b);const{redrawPoints:e,clickMenu:t,moveLimit:a,setPopup:r,updateData:i,getGridPoints:n}=h(g,Z,x,b,j);v(g,Z,x,b,a,r,i,n);const{clickMenu:u}=f(g,Z,x,b,j,a);H.value=e,S.value=e=>{const{item:a}=e;a.type&&p.map((e=>e.type)).includes(a.type)?u(e):t(e)}})),{propItems:Z,redrawPoints:H,select:C,clickMenu:S}}export{g as useSurgicalAnesthesiaChart};
1
+ import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as l}from"vue";import{useDialog as n}from"naive-ui";import{defaultBorderStyle as o}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as u}from"date-fns";import{getChildrenSize as s}from"../../utils/index.js";import"../useEvent.js";import{cloneDeep as d,range as c}from"lodash-es";import"../temperature/useShadow.js";import{OTHER_MENU as p}from"../../constants/index.js";import{useTop as m}from"./useTop.js";import{useLeft as v}from"./useLeft.js";import{useCenter as h}from"./useCenter.js";import{useOther as f}from"./useOther.js";function g(g,y,x,w,b,j){const C=n(),Y=e(),H=e(),S=e(),D=t((()=>y.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),A=t((()=>{var e;return null!=(e=y.data.left.width)?e:0})),M=t((()=>{const{grid:e}=y.data;return e.mainXCell*e.subXCell})),T=t((()=>{const{grid:e}=y.data;return e.mainYCell*e.subYCell})),X=t((()=>s(y.data.top.treeData))),G=t((()=>y.data.top.tree.cellHeight)),V=t((()=>G.value*X.value)),k=t((()=>ee($("drug")||"top"))),P=t((()=>k.value+V.value)),L=t((()=>{var e;return Date.parse((null==(e=y.data.xAxis)?void 0:e.startTime)||u(new Date,"yyyy-MM-dd HH:mm:ss"))})),N=t((()=>{const e=d(y.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=c(M.value/t+1).map((r=>0===r?e.startTime:u(new Date(L.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:A.value}})),O=function(){const e=d(y.data.top.treeData);let t=0;const{cellWidth:a,cellHeight:r}=y.data.top.tree;return function e(i,l=0){i.forEach((i=>{var n;const o={top:t*r+k.value,left:l*a,width:a,height:r};if(t++,null==(n=i.children)?void 0:n.length){t--;const a=s(i.children);o.height=a*r,e(i.children,l+1)}else o.width=A.value-o.left;Object.assign(i,o)}))}(e),e}(),E=t((()=>ee($("xAxis")||"center"))),W=t((()=>{var e;const{width:t,right:a}=y.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),I=t((()=>ee($("intraoperatively")||"bottom"))),q=t((()=>{var e;const{show:t=!0,height:a}=(null==(e=y.data.other)?void 0:e.mark)||{};return t&&a?a:0})),z=t((()=>I.value+(y.data.height-V.value-N.value.height-q.value))),B=t((()=>(W.value-A.value)/M.value)),F=t((()=>(z.value-I.value)/T.value)),J=t((()=>N.value.spaceTimeStamp/B.value)),K=t((()=>{const{scaleValues:e}=y.data;return e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))).flat()})),Q=t((()=>te("pulse"))),R=t((()=>te("temperature"))),U=t((()=>{var e;return(null==(e=y.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),Z=a({canvasWidth:y.data.width,canvasHeight:y.data.height,borderStyle:{...o,...y.data.borderStyle},pointSelectionStyle:y.data.pointSelectionStyle||{},grid:y.data.grid,top:y.data.top,left:y.data.left,other:y.data.other,topGridYNumber:r(X),topGridYCellHeight:r(G),topGridOriginY:r(k),topGridEndY:r(P),treeData:O,xAxis:r(N),originYXAxis:r(E),startTime:r(L),timeXCell:r(J),gridXNumber:r(M),gridYNumber:r(T),xCellWidth:r(B),yCellHeight:r(F),originX:r(A),endX:r(W),originY:r(I),endY:r(z),markHeight:r(q),itemList:r(K),scaleValues:y.data.scaleValues,pulseYCell:r(Q),temperatureYCell:r(R),event:r(U),dialog:C});function $(e){let t="";return Object.entries(D.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function _(e){const t=D.value[e],a=N.value.height;switch(t){case"drug":return V.value;case"xAxis":return a;default:return y.data.height-V.value-a}}function ee(e){switch(e){case"top":return 0;case"center":return _("top");default:return _("top")+_("center")}}function te(e){const{scaleValues:t}=y.data,a=t.find((t=>t.type===e));return F.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await l(),m(g,Z,x,b);const{redrawPoints:e,clickMenu:t,moveLimit:a,setPopup:r,updateData:i,getGridPoints:n,getContainPoints:o,showDialog:u,removeCurrentSelection:s}=h(g,Z,x,b,j);v(g,Z,x,b,a,r,i,n);const{clickMenu:d}=f(g,Z,x,b,j,a,o,u,s);H.value=e,S.value=e=>{const{item:a}=e;a.type&&p.map((e=>e.type)).includes(a.type)?d(e):t(e)}})),{propItems:Z,redrawPoints:H,select:Y,clickMenu:S}}export{g as useSurgicalAnesthesiaChart};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as a}from"../useCumputedPoint.js";import"vue";import{cloneDeep as f}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function c(c,u,d,m,h){const{cumputedX:p,getXValue:v}=a(u),{originX:x,endX:g,xCellWidth:L,originYXAxis:X,top:C,canvasWidth:w,borderStyle:Y,treeData:y,xAxis:S,topGridYNumber:j,topGridOriginY:b,topGridYCellHeight:k,topGridEndY:G,event:I}=u,z=new Set;function A(t,e,i){let n;const{content:o}=t.value||{};if(o){const{textStyle:l}=C.data||{},{startLine:s,endLine:a}=e;n=r(o,{fontSize:12,...l,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const f=M(n,e,i);n&&(n.set(f),n.origin={data:t},E(n),s&&(s.text=n),a&&(a.text=n))}return n}function M(t,e,i){const n=t.width+1,{startLine:o,centerLine:l,endLine:r}=e,s={top:i,originX:"center",originY:"center"};return l&&n<=l.width?s.left=l.x1+l.width/2:r&&n<=r.limitX.x2-r.left?(s.originX="left",s.left=r.left+1):o&&!r&&n<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&n<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):l?(s.originY="top",s.left=l.x1+l.width/2,s.top=i+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=i+1),s}function $(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:a,y2:f,halfY:c}=e;if(!s||s<x||s>g)return;const{lineStyle:u}=C.data||{};let d;const m={left:s,top:c};d=i?r("circle",{fill:u.stroke,...m}):n?r(">",{fill:u.stroke,...m,fontSize:18}):l([s,a,s,c],u);const h=new t.Rect({width:L,height:k,fill:"transparent",left:s-L/2,top:a}),p=new t.Group([d,h],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,hoverCursor:"pointer",lockMovementY:!0});return p.isLeft=o,p.isCustomIcon=i,E(p),p}function E(t){I.hovered&&(t.on("mouseover",(()=>{D(t,"hover")})),t.on("mouseout",(()=>{m.show=!1}))),t.lockMovementX&&t.lockMovementY||(t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(t),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=M(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(t),I.hovered&&D(t)})),t.on("mouseup",(e=>{if(1===e.button){!function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(t);const e={type:"tree",...t.origin};d("change",e)}})))}function D(t,e="moving"){var i,n,o;const{data:l}=t.origin;m.point={x:t.left,y:t.top};let[r="",s=""]=l.time||[];if("moving"===e){const e=v(t.left);t.isLeft?r=e:s=e,l.time=[r,s],t.text&&(t.text.origin.data.time=[r,s])}m.list=[`开始时间 ${r}`,`结束时间 ${s}`,`流速 ${(null==(i=l.value)?void 0:i.currentSpeed)||""}`,`浓度 ${(null==(n=l.value)?void 0:n.consistence)||""}`,`总量 ${(null==(o=l.value)?void 0:o.total)||""}`],m.show=!0}s(c,{...u,gridYNumber:j,originY:b,yCellHeight:k,endY:G}),function(){var o;const{height:l,list:r,left:s,spaceValue:a}=S;if(!l)return;const f=[],u=X+l/2;r.forEach(((t,i)=>{const n=s+i*L*a;f.push(e([n,u],{value:t.slice(11,16)}))}));const d=f.length>0?new t.Group([...f],{...i,objectCaching:!1}):null;d&&c.value.add(d);const m=new t.Rect({width:w,height:l,left:0,top:X,...n,originX:"left",originY:"top",...Y}),h=e([g+(w-g)/2,u],{value:"总量",...null==(o=C.data)?void 0:o.totalStyle});c.value.add(m,h)}(),function(){var n;const r=(null==(n=null==C?void 0:C.tree)?void 0:n.textStyle)||{},s=[];!function t(i){i.forEach((i=>{var n;const{width:a,height:u,left:d,top:m,title:h=""}=i,v={value:h,...r};(null==(n=i.children)?void 0:n.length)?(v.value=h.split("").join("\n"),t(i.children)):(v.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e}=C.data||{},i=t.top,n=i+k,o=n-k/2,r={y1:i,y2:n,halfY:o};let s=null;const a=f(t);delete a.data,t.data.forEach(((t,i,n)=>{const{time:f,continue:c}=t,[u,d]=f,m=u&&p(u),h=d&&p(d),v=$({...r,x:m},{isCustomIcon:!h&&!c,isContinue:!1,isLeft:!0}),L=$({...r,x:h},{isCustomIcon:!1,isContinue:!!c});let X;if((v||m<x)&&(L||h>g)){X=l([v?m:x,o,L?h:g,o],e)}const C={startLine:v,centerLine:X,endLine:L};let w,Y;!function(t,e,i){const{startLine:n,centerLine:o,endLine:l}=e,{startLine:r,endLine:s}=t||{};if(n){n.origin=i;const t={x1:x,x2:l?l.left:g};s?(t.x1=s.left,s.limitX.x2=n.left,n.prevLine=s,s.nextLine=n):r&&(t.x1=r.left,r.limitX.x2=n.left,n.prevLine=r,r.nextLine=n),n.limitX=t,o&&(n.centerLine=o)}if(l){l.origin=i;const t={x1:n?n.left:x,x2:g};l.limitX=t,o&&(l.centerLine=o)}n&&l&&(n.nearLine=l,l.nearLine=n)}(s,C,Object.assign({},a,{data:t,index:i})),s&&(w=A(n[i-1],s,o)),i===n.length-1&&(Y=A(t,C,o)),s=C,X&&z.add(X),v&&z.add(v),L&&z.add(L),w&&z.add(w),Y&&z.add(Y)}))}(i),function(t){var i;if(!(null==t?void 0:t.total))return;const n=t.top+k/2,o=e([g+(w-g)/2,n],{value:t.total,...null==(i=C.data)?void 0:i.totalStyle});o&&c.value.add(o)}(i)),s.push(o({width:a,height:u,...Y},v,{left:d,top:m},!0))}))}(y);const a=s.length>0?new t.Group([...s],{...i,objectCaching:!1}):null;a&&c.value.add(a),z.size&&c.value.add(...z)}()}export{c as useTop};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as a}from"../useCumputedPoint.js";import"../useEvent.js";import"vue";import{cloneDeep as f}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function c(c,u,d,m,h){const{cumputedX:p,getXValue:v}=a(u),{originX:x,endX:g,xCellWidth:L,originYXAxis:X,top:C,canvasWidth:w,borderStyle:Y,treeData:y,xAxis:S,topGridYNumber:j,topGridOriginY:b,topGridYCellHeight:k,topGridEndY:G,event:I}=u,z=new Set;function A(t,e,i){let n;const{content:o}=t.value||{};if(o){const{textStyle:l}=C.data||{},{startLine:s,endLine:a}=e;n=r(o,{fontSize:12,...l,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const f=E(n,e,i);n&&(n.set(f),n.origin={data:t},$(n),s&&(s.text=n),a&&(a.text=n))}return n}function E(t,e,i){const n=t.width+1,{startLine:o,centerLine:l,endLine:r}=e,s={top:i,originX:"center",originY:"center"};return l&&n<=l.width?s.left=l.x1+l.width/2:r&&n<=r.limitX.x2-r.left?(s.originX="left",s.left=r.left+1):o&&!r&&n<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&n<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):l?(s.originY="top",s.left=l.x1+l.width/2,s.top=i+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=i+1),s}function M(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:a,y2:f,halfY:c}=e;if(!s||s<x||s>g)return;const{lineStyle:u}=C.data||{};let d;const m={left:s,top:c};d=i?r("circle",{fill:u.stroke,...m}):n?r(">",{fill:u.stroke,...m,fontSize:18}):l([s,a,s,c],u);const h=new t.Rect({width:L,height:k,fill:"transparent",left:s-L/2,top:a}),p=new t.Group([d,h],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,hoverCursor:"pointer",lockMovementY:!0});return p.isLeft=o,p.isCustomIcon=i,$(p),p}function $(t){I.hovered&&(t.on("mouseover",(()=>{D(t,"hover")})),t.on("mouseout",(()=>{m.show=!1}))),t.lockMovementX&&t.lockMovementY||(t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(t),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=E(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(t),I.hovered&&D(t)})),t.on("mouseup",(e=>{if(1===e.button){!function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(t);const e={type:"tree",...t.origin};d("change",e)}})))}function D(t,e="moving"){var i,n,o;const{data:l}=t.origin;m.point={x:t.left,y:t.top};let[r="",s=""]=l.time||[];if("moving"===e){const e=v(t.left);t.isLeft?r=e:s=e,l.time=[r,s],t.text&&(t.text.origin.data.time=[r,s])}m.list=[`开始时间 ${r}`,`结束时间 ${s}`,`流速 ${(null==(i=l.value)?void 0:i.currentSpeed)||""}`,`浓度 ${(null==(n=l.value)?void 0:n.consistence)||""}`,`总量 ${(null==(o=l.value)?void 0:o.total)||""}`],m.show=!0}s(c,{...u,gridYNumber:j,originY:b,yCellHeight:k,endY:G}),function(){var o;const{height:l,list:r,left:s,spaceValue:a}=S;if(!l)return;const f=[],u=X+l/2;r.forEach(((t,i)=>{const n=s+i*L*a;f.push(e([n,u],{value:t.slice(11,16)}))}));const d=f.length>0?new t.Group([...f],{...i,objectCaching:!1}):null;d&&c.value.add(d);const m=new t.Rect({width:w,height:l,left:0,top:X,...n,originX:"left",originY:"top",...Y}),h=e([g+(w-g)/2,u],{value:"总量",...null==(o=C.data)?void 0:o.totalStyle});c.value.add(m,h)}(),function(){var n;const r=(null==(n=null==C?void 0:C.tree)?void 0:n.textStyle)||{},s=[];!function t(i){i.forEach((i=>{var n;const{width:a,height:u,left:d,top:m,title:h=""}=i,v={value:h,...r};(null==(n=i.children)?void 0:n.length)?(v.value=h.split("").join("\n"),t(i.children)):(v.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e}=C.data||{},i=t.top,n=i+k,o=n-k/2,r={y1:i,y2:n,halfY:o};let s=null;const a=f(t);delete a.data,t.data.forEach(((t,i,n)=>{const{time:f,continue:c}=t,[u,d]=f,m=u&&p(u),h=d&&p(d),v=M({...r,x:m},{isCustomIcon:!h&&!c,isContinue:!1,isLeft:!0}),L=M({...r,x:h},{isCustomIcon:!1,isContinue:!!c});let X;if((v||m<x)&&(L||h>g)){X=l([v?m:x,o,L?h:g,o],e)}const C={startLine:v,centerLine:X,endLine:L};let w,Y;!function(t,e,i){const{startLine:n,centerLine:o,endLine:l}=e,{startLine:r,endLine:s}=t||{};if(n){n.origin=i;const t={x1:x,x2:l?l.left:g};s?(t.x1=s.left,s.limitX.x2=n.left,n.prevLine=s,s.nextLine=n):r&&(t.x1=r.left,r.limitX.x2=n.left,n.prevLine=r,r.nextLine=n),n.limitX=t,o&&(n.centerLine=o)}if(l){l.origin=i;const t={x1:n?n.left:x,x2:g};l.limitX=t,o&&(l.centerLine=o)}n&&l&&(n.nearLine=l,l.nearLine=n)}(s,C,Object.assign({},a,{data:t,index:i})),s&&(w=A(n[i-1],s,o)),i===n.length-1&&(Y=A(t,C,o)),s=C,X&&z.add(X),v&&z.add(v),L&&z.add(L),w&&z.add(w),Y&&z.add(Y)}))}(i),function(t){var i;if(!(null==t?void 0:t.total))return;const n=t.top+k/2,o=e([g+(w-g)/2,n],{value:t.total,...null==(i=C.data)?void 0:i.totalStyle});o&&c.value.add(o)}(i)),s.push(o({width:a,height:u,...Y},v,{left:d,top:m},!0))}))}(y);const a=s.length>0?new t.Group([...s],{...i,objectCaching:!1}):null;a&&c.value.add(a),z.size&&c.value.add(...z)}()}export{c as useTop};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultTextStyle as i,defaultStyle as n}from"../useDraw.js";import"date-fns";import"lodash-es";import"vue";import"./useShadow.js";import"naive-ui";function o(o,s){const{xScaleList:a,originX:l,endX:r,endY:h,xCellWidth:c,canvasWidth:d,canvasHeight:u,bottom:p,breathingHeight:g,iconsWidth:f,borderStyle:m}=s;!function(){var s,d,u;if(!g||!p){const e=new t.Line([f,h-1,r,h-1],m);return o.value.add(e),e.sendToBack(),!1}const v=g,b=(null==(s=p.breathing)?void 0:s.list)||[],w=[];let x=!0;a.forEach(((t,n)=>{const o=l+n*c;let s="";b.forEach(((e,i)=>{const n=new Date(e.time).getTime();n>=t&&n<+t+t.scaleCell&&(s=e.value)}));const a=x?{top:-(v/2-10)}:{top:v/2-10};s&&(x=!x);const r=e({width:c,height:v,...m},Object.assign({},{text:String(s),...i},s?a:{}),{left:o,top:h});w.push(r)}));const j=e({width:r,height:v,...m},{text:String((null==(d=p.breathing)?void 0:d.title)+(null==(u=p.breathing)?void 0:u.unit)),...i,left:-(r-l)/2},{left:0,top:h});w.push(j);const S=w.length>0?new t.Group([...w],{...n}):null;S&&S.sendToBack(),S&&o.value.add(S)}()}export{o as useBottom};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultTextStyle as i,defaultStyle as n}from"../useDraw.js";import"date-fns";import"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"naive-ui";function o(o,s){const{xScaleList:a,originX:r,endX:l,endY:h,xCellWidth:c,canvasWidth:d,canvasHeight:u,bottom:p,breathingHeight:g,iconsWidth:m,borderStyle:f}=s;!function(){var s,d,u;if(!g||!p){const e=new t.Line([m,h-1,l,h-1],f);return o.value.add(e),e.sendToBack(),!1}const v=g,b=(null==(s=p.breathing)?void 0:s.list)||[],w=[];let j=!0;a.forEach(((t,n)=>{const o=r+n*c;let s="";b.forEach(((e,i)=>{const n=new Date(e.time).getTime();n>=t&&n<+t+t.scaleCell&&(s=e.value)}));const a=j?{top:-(v/2-10)}:{top:v/2-10};s&&(j=!j);const l=e({width:c,height:v,...f},Object.assign({},{text:String(s),...i},s?a:{}),{left:o,top:h});w.push(l)}));const x=e({width:l,height:v,...f},{text:String((null==(d=p.breathing)?void 0:d.title)+(null==(u=p.breathing)?void 0:u.unit)),...i,left:-(l-r)/2},{left:0,top:h});w.push(x);const S=w.length>0?new t.Group([...w],{...n}):null;S&&S.sendToBack(),S&&o.value.add(S)}()}export{o as useBottom};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as c,isValidValue as p,setOtherType as d,isEffectiveNode as f,getTime as h,getIndex as g,deleteProperty as v}from"../../utils/index.js";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import"naive-ui";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as j}from"../../constants/index.js";function L(L,k,S,Y,E,M,$,O,P,A){s(L,k);const{getEqualXTypes:C,handleAddPrevent:I}=y(L,S,k),{createShadowLines:T}=t(),{left:R,xScaleList:X,xCellWidth:F,yCellHeight:z,originX:D,endX:V,originY:_,endY:G,itemList:H,event:W,vitalSignsOriginY:q,painOriginY:B,hospitalizationDate:J,config:K,canvasHeight:N}=k,Q=new Set,U=["xinmai","mai"],Z=new Map,ee=new Set,te=new Set,ie=new Set,ne=m(R.yScaleValue);function oe(t){var o;const l=ne.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(Q.size&&L.value.remove(...Q),Q.clear(),Z.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=Z.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of Z)t.push(e[1]),e[0]===U[0]&&e[1].forEach((e=>{(Z.get(U[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],r=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),s=o.findIndex((e=>e[0]===t)),a=n[i],u=o[s],c=n[i-1],p=n[i+1],d=o[s-1],f=o[s+1];if(c&&d){if(c[0]!==d[0]){const e=Math.max(c[0],d[0]);l.push([c,d].find((t=>t[0]===e)))}}else c?l.push(c):d&&r.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const g=Math.max(a[1],u[1]);r.push([a,u].find((e=>e[1]===g)));const v=()=>{const t=[...l,...r.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],r=[]};if(p&&f){if(p[0]!==f[0]){const e=Math.min(p[0],f[0]);l.push([p,f].find((t=>t[0]===e))),v()}}else p?(l.push(p),v()):f?(r.push(f),v()):v()})),e}(),{mode:r,style:s={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...s,strokeWidth:1});if(["slash","line"].includes(r)){l.set({fill:"transparent",stroke:s.stroke||"#f00"});const e=[];if(["slash"].includes(r))e.push(...T(t,s._angle,s.space)),e.forEach((e=>{Object.assign(e,{...n,...s}),Q.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...t.flat()],{...s,originX:"center"});e.push(n),Q.add(n)}))}L.value.add(...e)}Q.add(l),L.value.add(l)}))}}function le(){var e;const t=ne.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},j,R.overlap||{}),l=[];ee.size&&[...ee].forEach((e=>{[...te].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key;if(e){const r={left:t.left,top:t.top,...n,hoverCursor:"default"};let s="koumai";"yemai"===e&&(s=e),"humai"===e&&(s="circle"),l.push(o(s,{...i[e]||{},...r}))}}}))})),setTimeout((()=>{L.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ie.add(e)}))}))}function re(e,t,s){var u;const{type:c,riseStyle:f={},noRiseStyle:h={},verifiedStyle:g={},reduceStyle:v={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:j=[]}=s,{type:Y,textStyle:M,showConnectLine:O=!1}=b,A=[],C=[],I=[];null==(u=e.list)||u.forEach(((u,b)=>{const T=a(c)?j.find((e=>e.key===u.key)):e,R=ue(u,s),X={};X.value=function(e,t,i){if(!(null==e?void 0:e.length)||!K.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=q.originY+z?e[1]+z:e[1]-z,r=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return I.push(r),{obj:r,top:-z}}(R,u,T),function(e,t,s,a,u){var d,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(c))return;const{lineAttr:m={}}=s,{value:x}=a;let b,j,L,k,S,Y;if(t.noRise&&h.show){const t=w(h)?E(u.type,u.list,35):e[1];if(h.text)L=l([e[0],w(h)?t:t+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),I.push(L);else{const i=t+2*z;k=r([e[0],t,i],h.style||{}),I.push(k)}}t.rise&&f.show&&f.text&&(S=l([e[0],e[1]-(x?z:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style||{}}),I.push(S));t.verified&&(Y=l([e[0],e[1]-(x?z:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),I.push(Y));if(p(t.physicsReduce)||p(t.drugReduce)){const l=E(c,u.list,null!=(d=t.physicsReduce)?d:t.drugReduce);b=i([...e,e[0],l],{...m,...v.line,...n}),j=o((null==(y=null==v?void 0:v.point)?void 0:y.type)||"circle",{left:e[0],top:l,...v.point,...n,originY:l===N?"bottom":"center"}),b&&I.push(b),j&&I.push(j)}Object.assign(a,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:L,top:5,isFixed:w(h)},arrowGroup:{obj:k,top:2*z,isFixed:w(h)},riseText:{obj:S,top:(x?-z:0)-5},verifiedText:{obj:Y,top:(x?-z:0)-5},reducePoint:{obj:j,type:"reduce"}})}(R,u,T,X,s),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;let o,a;const{upArrowShow:u=!1,limitValueShow:p=!1}=i;if(u&&+t.value>180){let t=e[1]-2.5*z,i=[e[1]-z/2,t];t<q.originY&&(t=e[1]+2.5*z,i=[t,e[1]+z/2]),o=r([e[0],i[0],i[1]],m,"up"),I.push(o)}if(p){const i={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...s.list)){const t=o?e[1]+z/2+o.height:e[1]+z;a=l([e[0],t],i),I.push(a)}+t.value<Math.min(...s.list)&&(a=l([e[0],e[1]-z],i),I.push(a))}Object.assign(n,{upArrow:{obj:o},limitValue:{obj:a,top:-z}})}(R,u,T,X),function(n,l,r,a,u){let p,f;const{pointAttr:h={},lineAttr:g={},title:v="",key:m,type:x="circle"}=a,b=e.list[r+1],j=ue(b,s),w=se(c,e.list[r].value),E=j&&se(c,b.value);n&&j&&!l.breakpoint&&(!w&&!E||O)&&n[0]!==j[0]&&(f=i([...n,...j],{...g}));const I=l.pacemakerShow&&"pulse"==c?y.value:w&&"number"===Y?0:x,T=C[r-1],R={origin:{data:l,title:v,key:m||"",unit:s.unit,type:c,_type:d(v,c),dataIndex:t,index:r},leftLine:T,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==c?y.style:h,...k.event.hovered?k.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:k.event,...w?{selectable:!1,evented:!1,..."number"===Y?M:{}}:{}};if(T){const e=T.get("y2");p=o(I,{left:T.get("x2"),top:w?e-5:e,...R})}else n&&(R.leftLine=null,p=o(I,{left:n[0],top:w?n[1]-5:n[1],...R}));C.push(f),p&&(v.includes("脉搏")?ee.add(p):te.add(p),function(e){W.hovered&&(e.on("mouseover",(()=>{ae(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?B:q;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):!l&&(null==i||i.setCoords().set({left:e.left,top:e.top+o})))})),oe(e)}(e),W.hovered&&ae(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{type:t}=e.origin,i=$(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};L.value.discardActiveObject(),S("change",n),pe(n,"change")}}))}(p),A.push(p),ie.add(p))}(R,u,b,T,X)})),"pulse"===c&&U.forEach((e=>{Z.set(e,A.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(A).then((e=>{const t=C.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(I).then((i=>{L.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&L.value.remove(e.leftLine),e.rightLine&&L.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function ae(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;P.point={x:e.left,y:e.top},P.list=[function(){const{drugReduce:r,physicsReduce:s}=l||{},a="hover"===t?l.value:$(o,e.top);if(p(r))return`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(p(s))return`物理降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||M(e.left)).slice(-5)}`],P.show=!0}function ue(e,t){const i="pain"===t.type?B:q;if(f(e)&&function(e){const[t]=X,i=X.at(-1),n=t.start,o=i.end,l=h(e);return l>=n&&l<=o}(e.time)){const n=Y(e.time),o=E(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ce(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=h(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=h(`${M(e)}:00`);return J&&l<h(J)?(I("exceedMin"),!1):!(l>o)||(I("exceedMax"),!1)}function pe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:r}=e,s=ne.find((e=>e.type===i));if("add"===t){const e=a(i)?s.dataList.find((e=>e.enable)):s.dataList[n],t=g(l.time,e.list);e.list.splice(t,0,l)}else s.dataList[n].list[o]=l;de()}function de(){var e;ie.size&&(null==(e=L.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...ie]))),Z.clear(),ie.clear(),ee.clear(),te.clear(),ne.forEach((e=>{e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||re(t,i,e)}))})),oe(),le()}return Z.clear(),ee.clear(),te.clear(),ne.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=E(e.type,e.list,e.positionLine.value),n=i([D,t,V,t],e.positionLine);L.value.add(n)}(e),e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||re(t,i,e)}))})),oe(),le(),k.event.evented&&L.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=D&&i<=V&&n>=_&&n<=G){A.point={x:i,y:n},A.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(A.list=[...x]),"pain"===o&&(A.list=[...b]),A.target=e.target;else{A.target=null,A.list=["新增节点"],H.forEach((t=>{if(!C([...ie],i,"_type").includes(t.bigType)){const i=["pain"].includes(t.bigType)?B:q;n>=i.originY&&n<=i.endY&&A.list.push({renderItem:O?O(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ce(i);t&&1!==A.list.length||(A.show=!1,1===A.list.length&&t&&I("repeat"))}}}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,r=v(i,[...x,...b]);r[`${e.type}`]=e.value,a(n)&&(r.key=t.origin.key);const s={...t.origin,data:r};S("change",s),pe(s,"change")}else{const t={data:{time:M(e.pointer.x),value:$(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};S("add",t),pe(t)}},setPopup:ae,isAddPoint:ce,updateData:pe,redrawPoints:de,gridPoints:ie}}function w(e){return"fixed"===e.position}export{L as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as c,isValidValue as p,setOtherType as d,isEffectiveNode as f,getTime as h,getIndex as v,deleteProperty as g}from"../../utils/index.js";import"../useEvent.js";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import"naive-ui";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as j}from"../../constants/index.js";function L(L,k,S,Y,E,M,$,O,P,A){s(L,k);const{getEqualXTypes:C,handleAddPrevent:I}=y(L,S,k),{createShadowLines:T}=t(),{left:R,xScaleList:X,xCellWidth:F,yCellHeight:z,originX:D,endX:V,originY:_,endY:G,itemList:H,event:W,vitalSignsOriginY:q,painOriginY:B,hospitalizationDate:J,config:K,canvasHeight:N}=k,Q=new Set,U=["xinmai","mai"],Z=new Map,ee=new Set,te=new Set,ie=new Set,ne=m(R.yScaleValue);function oe(t){var o;const l=ne.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(Q.size&&L.value.remove(...Q),Q.clear(),Z.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=Z.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of Z)t.push(e[1]),e[0]===U[0]&&e[1].forEach((e=>{(Z.get(U[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],r=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),s=o.findIndex((e=>e[0]===t)),a=n[i],u=o[s],c=n[i-1],p=n[i+1],d=o[s-1],f=o[s+1];if(c&&d){if(c[0]!==d[0]){const e=Math.max(c[0],d[0]);l.push([c,d].find((t=>t[0]===e)))}}else c?l.push(c):d&&r.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const v=Math.max(a[1],u[1]);r.push([a,u].find((e=>e[1]===v)));const g=()=>{const t=[...l,...r.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],r=[]};if(p&&f){if(p[0]!==f[0]){const e=Math.min(p[0],f[0]);l.push([p,f].find((t=>t[0]===e))),g()}}else p?(l.push(p),g()):f?(r.push(f),g()):g()})),e}(),{mode:r,style:s={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...s,strokeWidth:1});if(["slash","line"].includes(r)){l.set({fill:"transparent",stroke:s.stroke||"#f00"});const e=[];if(["slash"].includes(r))e.push(...T(t,s._angle,s.space)),e.forEach((e=>{Object.assign(e,{...n,...s}),Q.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...t.flat()],{...s,originX:"center"});e.push(n),Q.add(n)}))}L.value.add(...e)}Q.add(l),L.value.add(l)}))}}function le(){var e;const t=ne.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},j,R.overlap||{}),l=[];ee.size&&[...ee].forEach((e=>{[...te].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key;if(e){const r={left:t.left,top:t.top,...n,hoverCursor:"default"};let s="koumai";"yemai"===e&&(s=e),"humai"===e&&(s="circle"),l.push(o(s,{...i[e]||{},...r}))}}}))})),setTimeout((()=>{L.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ie.add(e)}))}))}function re(e,t,s){var u;const{type:c,riseStyle:f={},noRiseStyle:h={},verifiedStyle:v={},reduceStyle:g={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:j=[]}=s,{type:Y,textStyle:M,showConnectLine:O=!1}=b,A=[],C=[],I=[];null==(u=e.list)||u.forEach(((u,b)=>{const T=a(c)?j.find((e=>e.key===u.key)):e,R=ue(u,s),X={};X.value=function(e,t,i){if(!(null==e?void 0:e.length)||!K.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=q.originY+z?e[1]+z:e[1]-z,r=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return I.push(r),{obj:r,top:-z}}(R,u,T),function(e,t,s,a,u){var d,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(c))return;const{lineAttr:m={}}=s,{value:x}=a;let b,j,L,k,S,Y;if(t.noRise&&h.show){const t=w(h)?E(u.type,u.list,35):e[1];if(h.text)L=l([e[0],w(h)?t:t+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),I.push(L);else{const i=t+2*z;k=r([e[0],t,i],h.style||{}),I.push(k)}}t.rise&&f.show&&f.text&&(S=l([e[0],e[1]-(x?z:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style||{}}),I.push(S));t.verified&&(Y=l([e[0],e[1]-(x?z:0)-5],{value:"v",originX:"center",originY:"bottom",...v}),I.push(Y));if(p(t.physicsReduce)||p(t.drugReduce)){const l=E(c,u.list,null!=(d=t.physicsReduce)?d:t.drugReduce);b=i([...e,e[0],l],{...m,...g.line,...n}),j=o((null==(y=null==g?void 0:g.point)?void 0:y.type)||"circle",{left:e[0],top:l,...g.point,...n,originY:l===N?"bottom":"center"}),b&&I.push(b),j&&I.push(j)}Object.assign(a,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:L,top:5,isFixed:w(h)},arrowGroup:{obj:k,top:2*z,isFixed:w(h)},riseText:{obj:S,top:(x?-z:0)-5},verifiedText:{obj:Y,top:(x?-z:0)-5},reducePoint:{obj:j,type:"reduce"}})}(R,u,T,X,s),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;let o,a;const{upArrowShow:u=!1,limitValueShow:p=!1}=i;if(u&&+t.value>180){let t=e[1]-2.5*z,i=[e[1]-z/2,t];t<q.originY&&(t=e[1]+2.5*z,i=[t,e[1]+z/2]),o=r([e[0],i[0],i[1]],m,"up"),I.push(o)}if(p){const i={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...s.list)){const t=o?e[1]+z/2+o.height:e[1]+z;a=l([e[0],t],i),I.push(a)}+t.value<Math.min(...s.list)&&(a=l([e[0],e[1]-z],i),I.push(a))}Object.assign(n,{upArrow:{obj:o},limitValue:{obj:a,top:-z}})}(R,u,T,X),function(n,l,r,a,u){let p,f;const{pointAttr:h={},lineAttr:v={},title:g="",key:m,type:x="circle"}=a,b=e.list[r+1],j=ue(b,s),w=se(c,e.list[r].value),E=j&&se(c,b.value);n&&j&&!l.breakpoint&&(!w&&!E||O)&&n[0]!==j[0]&&(f=i([...n,...j],{...v}));const I=l.pacemakerShow&&"pulse"==c?y.value:w&&"number"===Y?0:x,T=C[r-1],R={origin:{data:l,title:g,key:m||"",unit:s.unit,type:c,_type:d(g,c),dataIndex:t,index:r},leftLine:T,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==c?y.style:h,...k.event.hovered?k.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:k.event,...w?{selectable:!1,evented:!1,..."number"===Y?M:{}}:{}};if(T){const e=T.get("y2");p=o(I,{left:T.get("x2"),top:w?e-5:e,...R})}else n&&(R.leftLine=null,p=o(I,{left:n[0],top:w?n[1]-5:n[1],...R}));C.push(f),p&&(g.includes("脉搏")?ee.add(p):te.add(p),function(e){W.hovered&&(e.on("mouseover",(()=>{ae(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?B:q;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):!l&&(null==i||i.setCoords().set({left:e.left,top:e.top+o})))})),oe(e)}(e),W.hovered&&ae(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{type:t}=e.origin,i=$(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};L.value.discardActiveObject(),S("change",n),pe(n,"change")}}))}(p),A.push(p),ie.add(p))}(R,u,b,T,X)})),"pulse"===c&&U.forEach((e=>{Z.set(e,A.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(A).then((e=>{const t=C.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(I).then((i=>{L.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&L.value.remove(e.leftLine),e.rightLine&&L.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function ae(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;P.point={x:e.left,y:e.top},P.list=[function(){const{drugReduce:r,physicsReduce:s}=l||{},a="hover"===t?l.value:$(o,e.top);if(p(r))return`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(p(s))return`物理降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||M(e.left)).slice(-5)}`],P.show=!0}function ue(e,t){const i="pain"===t.type?B:q;if(f(e)&&function(e){const[t]=X,i=X.at(-1),n=t.start,o=i.end,l=h(e);return l>=n&&l<=o}(e.time)){const n=Y(e.time),o=E(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ce(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=h(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=h(`${M(e)}:00`);return J&&l<h(J)?(I("exceedMin"),!1):!(l>o)||(I("exceedMax"),!1)}function pe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:r}=e,s=ne.find((e=>e.type===i));if("add"===t){const e=a(i)?s.dataList.find((e=>e.enable)):s.dataList[n],t=v(l.time,e.list);e.list.splice(t,0,l)}else s.dataList[n].list[o]=l;de()}function de(){var e;ie.size&&(null==(e=L.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...ie]))),Z.clear(),ie.clear(),ee.clear(),te.clear(),ne.forEach((e=>{e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||re(t,i,e)}))})),oe(),le()}return Z.clear(),ee.clear(),te.clear(),ne.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=E(e.type,e.list,e.positionLine.value),n=i([D,t,V,t],e.positionLine);L.value.add(n)}(e),e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||re(t,i,e)}))})),oe(),le(),k.event.evented&&L.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=D&&i<=V&&n>=_&&n<=G){A.point={x:i,y:n},A.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(A.list=[...x]),"pain"===o&&(A.list=[...b]),A.target=e.target;else{A.target=null,A.list=["新增节点"],H.forEach((t=>{if(!C([...ie],i,"_type").includes(t.bigType)){const i=["pain"].includes(t.bigType)?B:q;n>=i.originY&&n<=i.endY&&A.list.push({renderItem:O?O(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ce(i);t&&1!==A.list.length||(A.show=!1,1===A.list.length&&t&&I("repeat"))}}}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,r=g(i,[...x,...b]);r[`${e.type}`]=e.value,a(n)&&(r.key=t.origin.key);const s={...t.origin,data:r};S("change",s),pe(s,"change")}else{const t={data:{time:M(e.pointer.x),value:$(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};S("add",t),pe(t)}},setPopup:ae,isAddPoint:ce,updateData:pe,redrawPoints:de,gridPoints:ie}}function w(e){return"fixed"===e.position}export{L as useCenter};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as s,isOneLine as r}from"../../utils/index.js";import{getScaleInfo as a,drawScaleNumber as u,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"lodash-es";import"./useShadow.js";import"naive-ui";function g(g,p,d,f,m,y,v,w,S,Y,b,x){var j,X;const{getEqualXTypes:C,handleAddPrevent:N,isGridLimit:T}=c(g,d,p),{originY:V,endY:k,originX:L,endX:M,xCellWidth:W,yCellHeight:E,left:G,vitalSignsOriginY:O,painOriginY:A,painHeight:H,iconsWidth:I,itemList:R,painIndex:_,right:B,canvasWidth:J,canvasHeight:$,getRightInfo:q,borderStyle:D}=p;function P(o){var s;if(!(null==o?void 0:o.length))return;const{layout:r}=o[0];let c=I,p=L;"right"===r&&(c=M,p=M+(null!=(s=null==B?void 0:B.width)?s:0));const d=[],f=H&&"right"!==r?o.length-1:o.length,m=(p-c)/f,y=m+(p-c)%f;o.forEach(((o,s)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:s=5,showScale:r,showNumber:h,position:c,showMaxMinNumber:p,style:d,title:f}=n,m=l({width:L-I,height:H,...D},{value:`${f}`,...i,...d||{}},{left:I,top:A.originY}),y=e([I,A.originY,L,A.originY],D),v=[];if(r||h){const{lineXMain:e,textLeft:i}=a(c,I,L-I),l=o.length;o.forEach(((o,a)=>{let c=A.endY-a*E*s;if(0===a&&(c=k-5),!h||(0===a||a===l-1)&&!p||v.push(u(o,n,i,c)),r&&0!==a){const[i,n]=e,o=new t.Line([i,c,n,c],{...D,...d});v.push(o)}}))}g.value.add(y,m,...v),m.sendToBack()}(o);const p=[],f=0===s?y:m,v=0===s?c:y+c+(s-1)*m,w="right"===r?0:O.originY,S="right"===r?$:O.endY,Y=s>0?e([v,w,v,S],{objectCaching:!1,...D}):null;Y&&p.push(Y);const b=v+f/2,{list:x=[],spaceGridNumber:j=5,showScale:X,showNumber:C,position:N,showMaxMinNumber:T}=o;if(X||C){const{lineXMain:t,lineXSub:e,textLeft:i}=a(N,v,f),n=x.length;x.forEach(((l,s)=>{const r=O.endY-s*E*j;if(C&&(!(0===s||s===n-1)||T)){const t=0==s?r-5:r,e=u(l,o,i,t),n=O.originY+e.height/2;t<n&&e.set({top:n}),p.push(e)}p.push(...h(o,s,t,e,r,E,O.originY))}))}let V=o.title||"";o.unit&&(V+="\n"+o.unit),V&&p.push(new t.Text(String(V),{...i,left:b,top:O.originY+E*j/2,textAlign:"center",...o.style}));const M=new t.Group(p,{...n,objectCaching:!1});d.push(M)}));const v=d.length>0?new t.Group([...d],{...n,objectCaching:!1}):null;v&&g.value.add(v),v&&v.sendToBack()}I&&function(){const t=JSON.parse(JSON.stringify(R));let e=k;const i=I-G.icons.marginRight;t.reverse().forEach((t=>{e-=10;let n=t.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:a}=o(n,t,{text:{left:i-(t.pointAttr.width||10)-5,top:e,originX:"right"},icon:{originX:"right",left:i,topY:e,origin:{type:s(t.bigType),_type:t.bigType},...p.event}});var u;e-=l.height||30,(u=a).on("moving",(()=>{u.set("originX","center"),function(t){if(t.left>=L&&t.left<=M){t.setCoords();const e="pain"===t.origin.type?A:O;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(u),T(u)?f(u):m.show=!1})),u.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&T(u)){const t=C([...x],u.left,"_type").includes(u.origin._type),e=Y(u.left);if(!e||t)t&&e&&N("repeat");else{const t={data:{time:w(u.left),value:S(u.origin.type,u.top),...r(u.origin.type)?{key:u.origin.key}:{}},...u.origin};d("add",t),b(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(u)})),g.value.add(l,a)}))}();const z=G.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==B?void 0:B.width)&&"left"===(null==(j=null==B?void 0:B.yScaleValue)?void 0:j.layout)&&(null==(X=null==B?void 0:B.yScaleValue)?void 0:X.show)&&z.push(q),_>0&&G.yScaleValue[_].show){const t=G.yScaleValue[_];0===_&&G.yScaleValue.length>1&&z.unshift(t),_==G.yScaleValue.length-1&&z.push(t)}const F=z.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),K=z[F];return F>-1&&z.splice(F,0,{...K,title:(null==K?void 0:K.doubleTitle)||(null==K?void 0:K.title)}),P(z),g.value.add(new t.Rect({left:I,top:0,width:J-I-D.strokeWidth,height:$-D.strokeWidth,fill:"transparent",...D})),{drawScaleValue:P}}export{g as useLeft};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as s,isOneLine as r}from"../../utils/index.js";import"../useEvent.js";import{getScaleInfo as a,drawScaleNumber as u,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"lodash-es";import"./useShadow.js";import"naive-ui";function p(p,g,d,f,m,y,v,w,S,Y,b,x){var j,X;const{getEqualXTypes:C,handleAddPrevent:N,isGridLimit:T}=c(p,d,g),{originY:V,endY:k,originX:E,endX:L,xCellWidth:M,yCellHeight:W,left:G,vitalSignsOriginY:O,painOriginY:A,painHeight:H,iconsWidth:I,itemList:R,painIndex:_,right:B,canvasWidth:J,canvasHeight:$,getRightInfo:q,borderStyle:D}=g;function P(o){var s;if(!(null==o?void 0:o.length))return;const{layout:r}=o[0];let c=I,g=E;"right"===r&&(c=L,g=L+(null!=(s=null==B?void 0:B.width)?s:0));const d=[],f=H&&"right"!==r?o.length-1:o.length,m=(g-c)/f,y=m+(g-c)%f;o.forEach(((o,s)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:s=5,showScale:r,showNumber:h,position:c,showMaxMinNumber:g,style:d,title:f}=n,m=l({width:E-I,height:H,...D},{value:`${f}`,...i,...d||{}},{left:I,top:A.originY}),y=e([I,A.originY,E,A.originY],D),v=[];if(r||h){const{lineXMain:e,textLeft:i}=a(c,I,E-I),l=o.length;o.forEach(((o,a)=>{let c=A.endY-a*W*s;if(0===a&&(c=k-5),!h||(0===a||a===l-1)&&!g||v.push(u(o,n,i,c)),r&&0!==a){const[i,n]=e,o=new t.Line([i,c,n,c],{...D,...d});v.push(o)}}))}p.value.add(y,m,...v),m.sendToBack()}(o);const g=[],f=0===s?y:m,v=0===s?c:y+c+(s-1)*m,w="right"===r?0:O.originY,S="right"===r?$:O.endY,Y=s>0?e([v,w,v,S],{objectCaching:!1,...D}):null;Y&&g.push(Y);const b=v+f/2,{list:x=[],spaceGridNumber:j=5,showScale:X,showNumber:C,position:N,showMaxMinNumber:T}=o;if(X||C){const{lineXMain:t,lineXSub:e,textLeft:i}=a(N,v,f),n=x.length;x.forEach(((l,s)=>{const r=O.endY-s*W*j;if(C&&(!(0===s||s===n-1)||T)){const t=0==s?r-5:r,e=u(l,o,i,t),n=O.originY+e.height/2;t<n&&e.set({top:n}),g.push(e)}g.push(...h(o,s,t,e,r,W,O.originY))}))}let V=o.title||"";o.unit&&(V+="\n"+o.unit),V&&g.push(new t.Text(String(V),{...i,left:b,top:O.originY+W*j/2,textAlign:"center",...o.style}));const L=new t.Group(g,{...n,objectCaching:!1});d.push(L)}));const v=d.length>0?new t.Group([...d],{...n,objectCaching:!1}):null;v&&p.value.add(v),v&&v.sendToBack()}I&&function(){const t=JSON.parse(JSON.stringify(R));let e=k;const i=I-G.icons.marginRight;t.reverse().forEach((t=>{e-=10;let n=t.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:a}=o(n,t,{text:{left:i-(t.pointAttr.width||10)-5,top:e,originX:"right"},icon:{originX:"right",left:i,topY:e,origin:{type:s(t.bigType),_type:t.bigType},...g.event}});var u;e-=l.height||30,(u=a).on("moving",(()=>{u.set("originX","center"),function(t){if(t.left>=E&&t.left<=L){t.setCoords();const e="pain"===t.origin.type?A:O;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(u),T(u)?f(u):m.show=!1})),u.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&T(u)){const t=C([...x],u.left,"_type").includes(u.origin._type),e=Y(u.left);if(!e||t)t&&e&&N("repeat");else{const t={data:{time:w(u.left),value:S(u.origin.type,u.top),...r(u.origin.type)?{key:u.origin.key}:{}},...u.origin};d("add",t),b(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(u)})),p.value.add(l,a)}))}();const z=G.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==B?void 0:B.width)&&"left"===(null==(j=null==B?void 0:B.yScaleValue)?void 0:j.layout)&&(null==(X=null==B?void 0:B.yScaleValue)?void 0:X.show)&&z.push(q),_>0&&G.yScaleValue[_].show){const t=G.yScaleValue[_];0===_&&G.yScaleValue.length>1&&z.unshift(t),_==G.yScaleValue.length-1&&z.push(t)}const F=z.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),K=z[F];return F>-1&&z.splice(F,0,{...K,title:(null==K?void 0:K.doubleTitle)||(null==K?void 0:K.title)}),P(z),p.value.add(new t.Rect({left:I,top:0,width:J-I-D.strokeWidth,height:$-D.strokeWidth,fill:"transparent",...D})),{drawScaleValue:P}}export{p as useLeft};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as e}from"../useDraw.js";import"date-fns";import"lodash-es";import"vue";import"./useShadow.js";import"naive-ui";function i(i,n,o){const{other:l,vitalSignsOriginY:r,xCellWidth:s,yCellHeight:a,endX:c}=n;let u=0;function h(i,n,o){const l=[];String(i.value).split("").forEach(((n,o)=>{const r=new t.Text(n,{left:0,top:a*o,originX:"center",...e,objectCaching:!1,...i.style||{}});u=(a-(r.height||0))/2,l.push(r)}));const r={originX:"center",left:n,top:o+u,baseTop:(i.baseTop||0)*a,trueLeft:n,trueHeight:l.length*a,objectCaching:!1};return new t.Group(l,r)}!function(){if(!(null==l?void 0:l.list))return!1;const n=[],u=[];l.list.forEach(((t,e)=>{const i=0===e?"vertical":t.align||"vertical",n=o(t.time,!0);if(n>c)return;const l=u.find((t=>t.left==n));if(l)l[i].push(t);else{const e={left:n,vertical:[],horizontal:[]};e[i].push(t),u.push(e)}})),u.forEach((t=>{let e=r.originY,i=t.left;t.vertical.forEach(((o,l)=>{var c,u;const f=(o.baseTop||0)*a,g=(null==(c=n.at(-1))?void 0:c.left)||0;0===l&&t.left<=g&&(i=g+s);if(n.filter((t=>t.trueLeft===i)).length){const t=String(o.value).length*a,l=(null==(u=n.at(-1))?void 0:u.trueHeight)||0;e+=l,e+t+f>r.endY&&(e=r.originY,i+=s)}e+=f,String(o.value).length&&n.push(h(o,i,e))})),t.horizontal.forEach(((e,o)=>{var l;const c=r.originY+(e.baseTop||0)*a,u=(null==(l=n.at(-1))?void 0:l.left)||0;t.left<=u&&(i=u+s),String(e.value).length&&n.push(h(e,i,c))}))}));const f=n.length>0?new t.Group([...n],{...e,objectCaching:!1}):null;f&&i.value.add(f)}()}export{i as useOther};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as e}from"../useDraw.js";import"date-fns";import"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"naive-ui";function i(i,n,o){const{other:r,vitalSignsOriginY:l,xCellWidth:s,yCellHeight:a,endX:u}=n;let c=0;function h(i,n,o){const r=[];String(i.value).split("").forEach(((n,o)=>{const l=new t.Text(n,{left:0,top:a*o,originX:"center",...e,objectCaching:!1,...i.style||{}});c=(a-(l.height||0))/2,r.push(l)}));const l={originX:"center",left:n,top:o+c,baseTop:(i.baseTop||0)*a,trueLeft:n,trueHeight:r.length*a,objectCaching:!1};return new t.Group(r,l)}!function(){if(!(null==r?void 0:r.list))return!1;const n=[],c=[];r.list.forEach(((t,e)=>{const i=0===e?"vertical":t.align||"vertical",n=o(t.time,!0);if(n>u)return;const r=c.find((t=>t.left==n));if(r)r[i].push(t);else{const e={left:n,vertical:[],horizontal:[]};e[i].push(t),c.push(e)}})),c.forEach((t=>{let e=l.originY,i=t.left;t.vertical.forEach(((o,r)=>{var u,c;const f=(o.baseTop||0)*a,g=(null==(u=n.at(-1))?void 0:u.left)||0;0===r&&t.left<=g&&(i=g+s);if(n.filter((t=>t.trueLeft===i)).length){const t=String(o.value).length*a,r=(null==(c=n.at(-1))?void 0:c.trueHeight)||0;e+=r,e+t+f>l.endY&&(e=l.originY,i+=s)}e+=f,String(o.value).length&&n.push(h(o,i,e))})),t.horizontal.forEach(((e,o)=>{var r;const u=l.originY+(e.baseTop||0)*a,c=(null==(r=n.at(-1))?void 0:r.left)||0;t.left<=c&&(i=c+s),String(e.value).length&&n.push(h(e,i,u))}))}));const f=n.length>0?new t.Group([...n],{...e,objectCaching:!1}):null;f&&i.value.add(f)}()}export{i as useOther};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultStyle as l,drawTextGroup as i,defaultTextStyle as s}from"../useDraw.js";import"date-fns";import"lodash-es";import"vue";import"./useShadow.js";import"naive-ui";function o(o,u){const{grid:h,originX:n,endX:a,xCellWidth:c,gridXNumber:r,top:p,xScalevalueHeight:d,iconsWidth:f,topList:v,endXLimit:g,canvasWidth:y,borderStyle:m}=u;!function(){const S=[];g&&S.push(new t.Line([g,0,y,0],m));let w=0;v.forEach(((t,l)=>{if(l>0&&(w+=u[`${v[l-1].key}Height`]),"xScalevalue"==t.key)!function(t,l,o){const u=p.dayHeight;if(!u)return;l.push(e([n,o+u,a,o+u],m));const d=c*h.subSecondXCell,f=(r-h.surplusXCell)/h.subSecondXCell;for(let h=0;h<f;h++){const a=n+h*d,c=h%2==0?"上午":"下午",r=i({width:d,height:u,...m},{value:c,...s,...t.style||{}},{left:a,top:o});l.push(r),l.push(e([a+d,o,a+d,o+u],m))}}(t,S,w),function(t,l,o){var u;const r=p.xScalevalue.show&&null!=(u=p.dayHeight)?u:0,v=d-r;if(!v)return;l.push(e([f,o+d,a,o+d],m));const g=i({width:n-f,height:d,...m},{value:p.xScalevalue.title,...s,...t.style||{},...t.titleStyle||{}},{left:f,top:o});l.push(g),l.push(e([n,o,n,o+d],m));const y=[];for(let t=0;t<h.mainXCell;t++)y.push(p.xScalevalue.list);y.flat().forEach(((u,h)=>{const a=n+h*c,p=i({width:c,height:v,...m},{value:u.value,...s,...t.style||{},...u.style||{}},{left:a,top:o+r});l.push(p),l.push(e([a+c,o+r,a+c,o+r+v],m))}))}(t,S,w);else{if(!u[`${t.key}Height`])return;const o=u[`${v[l].key}Height`];!function(t,l,o){const a=u[`${t.key}Height`],r=i({width:n-f,height:a,...m},{value:t.title,...s,...(null==t?void 0:t.style)||{},...t.titleStyle||{}},{left:f,top:o});l.push(r);const p=c*h.subXCell;t.list.forEach(((u,h)=>{const c=n+h*p,r=i({width:p,height:a,...m},{value:u,...s,...(null==t?void 0:t.style)||{}},{left:c,top:o});l.push(e([c+p,o,c+p,o+a],m)),l.push(r)}))}(t,S,w),S.push(e([f,w+o,a,w+o],m)),S.push(e([n,w,n,w+o],m))}}));const X=S.length>0?new t.Group([...S],{...l,objectCaching:!1}):null;X&&X.sendToBack(),X&&o.value.add(X)}()}export{o as useTop};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultStyle as l,drawTextGroup as i,defaultTextStyle as s}from"../useDraw.js";import"date-fns";import"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"naive-ui";function o(o,u){const{grid:h,originX:n,endX:a,xCellWidth:c,gridXNumber:r,top:p,xScalevalueHeight:d,iconsWidth:f,topList:v,endXLimit:g,canvasWidth:y,borderStyle:m}=u;!function(){const S=[];g&&S.push(new t.Line([g,0,y,0],m));let w=0;v.forEach(((t,l)=>{if(l>0&&(w+=u[`${v[l-1].key}Height`]),"xScalevalue"==t.key)!function(t,l,o){const u=p.dayHeight;if(!u)return;l.push(e([n,o+u,a,o+u],m));const d=c*h.subSecondXCell,f=(r-h.surplusXCell)/h.subSecondXCell;for(let h=0;h<f;h++){const a=n+h*d,c=h%2==0?"上午":"下午",r=i({width:d,height:u,...m},{value:c,...s,...t.style||{}},{left:a,top:o});l.push(r),l.push(e([a+d,o,a+d,o+u],m))}}(t,S,w),function(t,l,o){var u;const r=p.xScalevalue.show&&null!=(u=p.dayHeight)?u:0,v=d-r;if(!v)return;l.push(e([f,o+d,a,o+d],m));const g=i({width:n-f,height:d,...m},{value:p.xScalevalue.title,...s,...t.style||{},...t.titleStyle||{}},{left:f,top:o});l.push(g),l.push(e([n,o,n,o+d],m));const y=[];for(let t=0;t<h.mainXCell;t++)y.push(p.xScalevalue.list);y.flat().forEach(((u,h)=>{const a=n+h*c,p=i({width:c,height:v,...m},{value:u.value,...s,...t.style||{},...u.style||{}},{left:a,top:o+r});l.push(p),l.push(e([a+c,o+r,a+c,o+r+v],m))}))}(t,S,w);else{if(!u[`${t.key}Height`])return;const o=u[`${v[l].key}Height`];!function(t,l,o){const a=u[`${t.key}Height`],r=i({width:n-f,height:a,...m},{value:t.title,...s,...(null==t?void 0:t.style)||{},...t.titleStyle||{}},{left:f,top:o});l.push(r);const p=c*h.subXCell;t.list.forEach(((u,h)=>{const c=n+h*p,r=i({width:p,height:a,...m},{value:u,...s,...(null==t?void 0:t.style)||{}},{left:c,top:o});l.push(e([c+p,o,c+p,o+a],m)),l.push(r)}))}(t,S,w),S.push(e([f,w+o,a,w+o],m)),S.push(e([n,w,n,w+o],m))}}));const X=S.length>0?new t.Group([...S],{...l,objectCaching:!1}):null;X&&X.sendToBack(),X&&o.value.add(X)}()}export{o as useTop};
@@ -1,6 +1,7 @@
1
1
  import { Ref } from 'vue';
2
2
  import { fabric } from '../../../../../es/shared/utils/fabricjs';
3
3
  import { IPropItems } from '../interface';
4
+ export declare const bus: import("@vueuse/core").UseEventBusReturn<string, any>;
4
5
  export declare function useCanvasEvent(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: any): {
5
6
  select: (key: string) => void;
6
7
  };
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../shared/utils/fabricjs/index.js";function e(e,n,o){const{originY:l,originX:i,endX:s,endY:d,iconsWidth:r,selectionStyle:h,topList:u}=n;function c(n,o){const{left:l,top:i,width:s,height:d}=n,r=new t.Rect({key:o,left:null!=l?l:0,top:null!=i?i:0,width:s,height:d,stroke:"transparent",fill:"transparent",lockMovementX:!0,lockMovementY:!0,transparentCorners:!1,hasControls:!1,...h,strokeWidth:0});return e.value.add(r),r}let f=[];function a(t){k();p(null==f?void 0:f.find((e=>e.key===t)))}function k(){f.forEach((t=>{t.set("strokeWidth",0),t.key.endsWith("All")&&t.sendToBack()}))}function p(t){var n;e.value.discardActiveObject(),!(null==t?void 0:t.key.includes("grid"))&&(null==t||t.bringToFront()),null==t||t.set("strokeWidth",null!=(n=h.strokeWidth)?n:2)}return("boolean"!=typeof(null==h?void 0:h.evented)||(null==h?void 0:h.evented))&&(f=function(){const t=[];t.push(c({left:r,top:l+1,width:i-r,height:d-l-3},"left"));let e=0;return u.forEach(((o,l)=>{l>0&&(e+=n[`${u[l-1].key}Height`]);const d={top:e+1,height:n[`${o.key}Height`]-1};t.push(c({left:r,width:s-r,...d},o.key+"All")),t.push(c({left:r,width:i-r,...d},o.key+"Title")),t.push(c({left:i,width:s-i,...d},o.key))})),t.push(c({left:i,top:l+1,width:s-i,height:d-l-3},"grid")),t.forEach((t=>{t.key.endsWith("All")?(t.sendToBack(),t.on("mouseup",(e=>{const{button:n,pointer:l}=e;if(1==n){const e=t.key.replace("All",""),n=(null==l?void 0:l.x)&&(null==l?void 0:l.x)<=i?e+"Title":e;t.sendToBack(),a(n),o("select",n)}}))):t.on("mousedown",(()=>{k(),p(t),o("select",t.key)}))})),t}()),{select:a}}export{e as useCanvasEvent};
1
+ import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";import{useEventBus as t}from"@vueuse/core";const n=t("selection");function o(t,n,o){const{originY:l,originX:i,endX:s,endY:r,iconsWidth:d,selectionStyle:h,topList:c}=n;function u(n,o){const{left:l,top:i,width:s,height:r}=n,d=new e.Rect({key:o,left:null!=l?l:0,top:null!=i?i:0,width:s,height:r,stroke:"transparent",fill:"transparent",lockMovementX:!0,lockMovementY:!0,transparentCorners:!1,hasControls:!1,...h,strokeWidth:0});return t.value.add(d),d}let f=[];function a(e){k();p(null==f?void 0:f.find((t=>t.key===e)))}function k(){f.forEach((e=>{e.set("strokeWidth",0),e.key.endsWith("All")&&e.sendToBack()}))}function p(e){var n;t.value.discardActiveObject(),!(null==e?void 0:e.key.includes("grid"))&&(null==e||e.bringToFront()),null==e||e.set("strokeWidth",null!=(n=h.strokeWidth)?n:2)}return("boolean"!=typeof(null==h?void 0:h.evented)||(null==h?void 0:h.evented))&&(f=function(){const e=[];e.push(u({left:d,top:l+1,width:i-d,height:r-l-3},"left"));let t=0;return c.forEach(((o,l)=>{l>0&&(t+=n[`${c[l-1].key}Height`]);const r={top:t+1,height:n[`${o.key}Height`]-1};e.push(u({left:d,width:s-d,...r},o.key+"All")),e.push(u({left:d,width:i-d,...r},o.key+"Title")),e.push(u({left:i,width:s-i,...r},o.key))})),e.push(u({left:i,top:l+1,width:s-i,height:r-l-3},"grid")),e.forEach((e=>{e.key.endsWith("All")?(e.sendToBack(),e.on("mouseup",(t=>{const{button:n,pointer:l}=t;if(1==n){const t=e.key.replace("All",""),n=(null==l?void 0:l.x)&&(null==l?void 0:l.x)<=i?t+"Title":t;e.sendToBack(),a(n),o("select",n)}}))):e.on("mousedown",(()=>{k(),p(e),o("select",e.key)}))})),e}()),{select:a}}export{n as bus,o as useCanvasEvent};