cnhis-design-vue 3.2.18-beta.9 → 3.2.19-beta.11

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 (134) hide show
  1. package/es/components/ai-chat/index.d.ts +17 -129
  2. package/es/components/ai-chat/src/Index.vue.d.ts +17 -129
  3. package/es/components/ai-chat/src/Index.vue2.js +1 -1
  4. package/es/components/ai-chat/src/components/ChatBI.vue.d.ts +2 -2
  5. package/es/components/ai-chat/src/components/ChatBI.vue2.js +1 -1
  6. package/es/components/ai-chat/src/components/ChatCard.js +1 -1
  7. package/es/components/ai-chat/src/components/ChatFooter.vue.d.ts +2 -50
  8. package/es/components/ai-chat/src/components/ChatFooter.vue2.js +1 -1
  9. package/es/components/ai-chat/src/components/ChatMain.d.ts +7 -1
  10. package/es/components/ai-chat/src/components/ChatMain.js +1 -1
  11. package/es/components/ai-chat/src/utils/index.d.ts +0 -1
  12. package/es/components/ai-chat/src/utils/index.js +1 -1
  13. package/es/components/ai-chat/style/index.css +1 -1
  14. package/es/components/audio-sdk/src/audioSDK.d.ts +7 -6
  15. package/es/components/audio-sdk/src/audioSDK.js +1 -1
  16. package/es/components/audio-sdk/src/utils/recordingModal.d.ts +1 -2
  17. package/es/components/audio-sdk/src/utils/recordingModal.js +1 -1
  18. package/es/components/button-print/src/components/OldPrintComponent.vue2.js +1 -1
  19. package/es/components/{template-render → card-render}/index.d.ts +2 -2
  20. package/es/components/card-render/index.js +1 -0
  21. package/es/components/card-render/src/CardRender.vue.js +1 -0
  22. package/es/components/card-render/src/CardRender.vue2.js +1 -0
  23. package/es/components/{template-render → card-render}/src/components/Button.vue2.js +1 -1
  24. package/es/components/card-render/src/components/Field.vue2.js +1 -0
  25. package/es/components/{template-render → card-render}/src/components/FieldGroup.vue2.js +1 -1
  26. package/es/components/{template-render → card-render}/src/components/Label.vue2.js +1 -1
  27. package/es/components/card-render/src/components/Row.vue2.js +1 -0
  28. package/es/components/card-render/src/components/Text.vue2.js +1 -0
  29. package/es/components/card-render/style/index.css +1 -0
  30. package/es/components/editor/src/Editor.js +1 -1
  31. package/es/components/editor/style/index.css +0 -1
  32. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
  33. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  34. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  35. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
  36. package/es/components/fabric-chart/src/hooks/useGrid.js +1 -1
  37. package/es/components/fabric-chart/src/interface.d.ts +2 -0
  38. package/es/components/field-editor/src/fields.js +1 -1
  39. package/es/components/form-render/src/FormRender.vue2.js +1 -1
  40. package/es/components/form-render/src/components/renderer/combination/jsonCombination.js +1 -1
  41. package/es/components/form-render/src/components/renderer/inputNumber.d.ts +15 -1
  42. package/es/components/form-render/src/components/renderer/inputNumber.js +1 -1
  43. package/es/components/iho-table/src/plugins/filterRemoteSearchPlugin/index.d.ts +1 -0
  44. package/es/components/iho-table/src/plugins/filterRemoteSearchPlugin/index.js +1 -0
  45. package/es/components/iho-table/src/plugins/filterRemoteSearchPlugin/remoteFilter.vue.d.ts +68 -0
  46. package/es/components/iho-table/src/plugins/filterRemoteSearchPlugin/remoteFilter.vue.js +1 -0
  47. package/es/components/iho-table/src/plugins/filterRemoteSearchPlugin/remoteFilter.vue2.js +1 -0
  48. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue.d.ts +7 -9
  49. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue2.js +1 -1
  50. package/es/components/iho-table/src/plugins/index.js +1 -1
  51. package/es/components/iho-table/src/plugins/pluginHooks/index.d.ts +1 -0
  52. package/es/components/iho-table/src/plugins/pluginHooks/index.js +1 -0
  53. package/es/components/iho-table/src/plugins/pluginHooks/useFilter.d.ts +21 -0
  54. package/es/components/iho-table/src/plugins/pluginHooks/useFilter.js +1 -0
  55. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/inputRendererPlugin.js +1 -1
  56. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/levelSearchCascadePlugin/levelSearchCascade.vue.d.ts +13 -0
  57. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/levelSearchCascadePlugin/levelSearchCascade.vue2.js +1 -1
  58. package/es/components/iho-table/src/plugins/verticalTablePlugin/src/hooks/index.js +1 -1
  59. package/es/components/iho-table/src/plugins/verticalTablePlugin/src/renderer.js +1 -1
  60. package/es/components/iho-table/src/plugins/verticalTablePlugin/src/utils.d.ts +1 -1
  61. package/es/components/iho-table/src/plugins/verticalTablePlugin/src/utils.js +1 -1
  62. package/es/components/iho-table/src/types/index.d.ts +8 -1
  63. package/es/components/iho-table/src/utils/index.d.ts +1 -0
  64. package/es/components/iho-table/src/utils/index.js +1 -1
  65. package/es/components/index.css +1 -1
  66. package/es/components/index.d.ts +2 -2
  67. package/es/components/index.js +1 -1
  68. package/es/components/shortcut-provider/src/hooks/useShortcuts.js +1 -1
  69. package/es/components/shortcut-provider/src/types/index.d.ts +3 -0
  70. package/es/components/shortcut-provider/src/utils/index.d.ts +1 -1
  71. package/es/components/shortcut-provider/src/utils/index.js +1 -1
  72. package/es/shared/package.json.js +1 -1
  73. package/es/shared/types/business.d.ts +14 -0
  74. package/package.json +2 -2
  75. package/es/components/ai-chat/src/api/index.d.ts +0 -5
  76. package/es/components/ai-chat/src/api/index.js +0 -1
  77. package/es/components/ai-chat/src/components/ChatAudio.vue.d.ts +0 -40
  78. package/es/components/ai-chat/src/components/ChatAudio.vue.js +0 -1
  79. package/es/components/ai-chat/src/components/ChatAudio.vue2.js +0 -1
  80. package/es/components/ai-chat/src/components/ChatMainInner.d.ts +0 -2
  81. package/es/components/ai-chat/src/components/ChatMainInner.js +0 -1
  82. package/es/components/ai-chat/src/components/ChatRight.vue.d.ts +0 -56
  83. package/es/components/ai-chat/src/components/ChatRight.vue.js +0 -1
  84. package/es/components/ai-chat/src/components/ChatRight.vue2.js +0 -1
  85. package/es/components/ai-chat/src/components/card/JsonCard.d.ts +0 -25
  86. package/es/components/ai-chat/src/components/card/JsonCard.js +0 -1
  87. package/es/components/ai-chat/src/components/card/SelectIcon.d.ts +0 -14
  88. package/es/components/ai-chat/src/components/card/SelectIcon.js +0 -1
  89. package/es/components/ai-chat/src/hooks/useProgram.d.ts +0 -6
  90. package/es/components/ai-chat/src/hooks/useProgram.js +0 -1
  91. package/es/components/ai-chat/src/hooks/useWebsocket.d.ts +0 -2
  92. package/es/components/ai-chat/src/hooks/useWebsocket.js +0 -1
  93. package/es/components/template-render/index.js +0 -1
  94. package/es/components/template-render/src/TemplateRender.vue.js +0 -1
  95. package/es/components/template-render/src/TemplateRender.vue2.js +0 -1
  96. package/es/components/template-render/src/components/Field.vue2.js +0 -1
  97. package/es/components/template-render/src/components/Row.vue2.js +0 -1
  98. package/es/components/template-render/src/components/Text.vue2.js +0 -1
  99. package/es/components/template-render/style/index.css +0 -1
  100. package/es/shared/assets/img/file-emr.png.js +0 -1
  101. package/es/shared/assets/img/file.png.js +0 -1
  102. package/es/shared/assets/img/use.png.js +0 -1
  103. /package/es/components/{template-render/src/TemplateRender.vue.d.ts → card-render/src/CardRender.vue.d.ts} +0 -0
  104. /package/es/components/{template-render → card-render}/src/components/Box.vue.d.ts +0 -0
  105. /package/es/components/{template-render → card-render}/src/components/Box.vue.js +0 -0
  106. /package/es/components/{template-render → card-render}/src/components/Box.vue2.js +0 -0
  107. /package/es/components/{template-render → card-render}/src/components/Button.vue.d.ts +0 -0
  108. /package/es/components/{template-render → card-render}/src/components/Button.vue.js +0 -0
  109. /package/es/components/{template-render → card-render}/src/components/Divider.vue.d.ts +0 -0
  110. /package/es/components/{template-render → card-render}/src/components/Divider.vue.js +0 -0
  111. /package/es/components/{template-render → card-render}/src/components/Divider.vue2.js +0 -0
  112. /package/es/components/{template-render → card-render}/src/components/Field.vue.d.ts +0 -0
  113. /package/es/components/{template-render → card-render}/src/components/Field.vue.js +0 -0
  114. /package/es/components/{template-render → card-render}/src/components/FieldGroup.vue.d.ts +0 -0
  115. /package/es/components/{template-render → card-render}/src/components/FieldGroup.vue.js +0 -0
  116. /package/es/components/{template-render → card-render}/src/components/Image.vue.d.ts +0 -0
  117. /package/es/components/{template-render → card-render}/src/components/Image.vue.js +0 -0
  118. /package/es/components/{template-render → card-render}/src/components/Image.vue2.js +0 -0
  119. /package/es/components/{template-render → card-render}/src/components/Label.vue.d.ts +0 -0
  120. /package/es/components/{template-render → card-render}/src/components/Label.vue.js +0 -0
  121. /package/es/components/{template-render → card-render}/src/components/Row.vue.d.ts +0 -0
  122. /package/es/components/{template-render → card-render}/src/components/Row.vue.js +0 -0
  123. /package/es/components/{template-render → card-render}/src/components/Slot.d.ts +0 -0
  124. /package/es/components/{template-render → card-render}/src/components/Slot.js +0 -0
  125. /package/es/components/{template-render → card-render}/src/components/Text.vue.d.ts +0 -0
  126. /package/es/components/{template-render → card-render}/src/components/Text.vue.js +0 -0
  127. /package/es/components/{template-render → card-render}/src/components/index.d.ts +0 -0
  128. /package/es/components/{template-render → card-render}/src/components/index.js +0 -0
  129. /package/es/components/{template-render → card-render}/src/constants/index.d.ts +0 -0
  130. /package/es/components/{template-render → card-render}/src/constants/index.js +0 -0
  131. /package/es/components/{template-render → card-render}/src/hooks/useCommon.d.ts +0 -0
  132. /package/es/components/{template-render → card-render}/src/hooks/useCommon.js +0 -0
  133. /package/es/components/{template-render → card-render}/src/utils/index.d.ts +0 -0
  134. /package/es/components/{template-render → card-render}/src/utils/index.js +0 -0
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i,drawLine as o,defaultLineStyle as n}from"../useDraw.js";import{useBirthProcessCumputedPoint as r}from"../useCumputedPoint.js";import{bus as a}from"../useEvent.js";import{useShadow as l}from"../useShadow.js";import{useCommon as s}from"../useCommon.js";import"vue";import{getIndex as c}from"../../utils/index.js";import{filter as d,cloneDeep as u,omit as f,flatten as h,isNumber as g,pick as m}from"lodash-es";import{format as p}from"date-fns";import{OTHER_MENU as v}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"./useTop.js";import"@vueuse/core";import"../../../../../shared/utils/index.js";const x=d(v,(t=>"add"!==t.type));function y(d,v,y,k,C,w,X,b,E){const{computedX:A,getXValue:L}=r(v),{getEqualXTypes:j,handleAddPrevent:P,isGridLimit:S,getPointEventProps:z}=s(d,y,v),{createShadowLines:I}=l(),{canvasWidth:M,other:T,yCellHeight:H,xCellWidth:O,endX:$,originX:B,originY:W,endY:Y,markHeight:D,event:_,topGridYCellHeight:V,extracorporealCirculationHeight:G}=v,K=new Map,R=u(T);let q=[],F=null;function J(){var o;if(!(null==(o=null==R?void 0:R.horizontal)?void 0:o.length))return;const n="horizontal";K.set(n,[]);const{horizontal:r}=R;let a=W+H/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:c={},textStyle:d={},data:u,showIcon:f=!0}=o;let h=null;u.forEach(((o,u)=>{const{time:g,value:m}=o,p=A(g);if(!ot(p))return;const v=[],x=f&&e(s,{...c,left:p,top:a});x&&v.push(x);const y=f?p+x.width/2+2:p,k=i([y,a],{value:m,...d,originX:"left"});v.push(k);const C=new t.Group(v,{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer",...z()});Object.assign(C,{originLeft:p,iconHalfWidth:x?x.width/2:0,origin:{type:"other",key:n,dataIndex:r,index:u,data:o,title:l},limitX:{x1:B,x2:$-C.width}}),h&&(C.limitX.x1=h.left,h.limitX.x2=C.left,C.prevPoint=h,h.nextPoint=C),h=C,tt(C),K.get(n).push(C)})),a+=H})),d.value.add(...K.get(n))}function N(){var t;if(!(null==(t=null==R?void 0:R.vertical)?void 0:t.length))return;const i="vertical";K.set(i,[]);const{vertical:o}=R;o.forEach(((t,o)=>{const{show:n=!0,marginTop:r=0,textStyle:a={},data:l,time:s}=t,c=A(s);if(!n||!ot(c))return;const{lineHeight:d=H}=a;let u=W+r+d/2;l.forEach(((t,n)=>{const r=e(String(t),{...a,lockMovementY:!0,left:c,originX:"left",top:u,origin:{type:"other",key:i,dataIndex:o,index:n,data:{value:t}},...z()});u+=d,tt(r),K.get(i).push(r)}));const f=K.get(i).filter((t=>t.origin.dataIndex===o)),h=Math.max(...f.map((t=>t.width))),g=c>$-h;f.forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=h,g&&t.set("originX","right")}))})),d.value.add(...K.get(i))}function Q(t,e="add"){const{dataIndex:i,data:o,index:n,key:r,dataKey:a,time:l}=t,s=R[r],d=["mark","extracorporealCirculation"].includes(r)?s.dataList[i]:s[i];switch(e){case"remove":d.data.splice(n,1);break;case"change":if("mark"===r){d.list.splice(n,1);const t=s.dataList.find((t=>t.time===l));t?t.list.push(o):(s.dataList.push({time:l,list:[o]}),s.dataList.sort(((t,e)=>Date.parse(t.time)-Date.parse(e.time))))}else"extracorporealCirculation"===r?d[a]=o:d.data[n]=o;break;default:{const t=Array.isArray(o)?o[0].time:o.time,e=c(t,d.data),i=Array.isArray(o)?o:[o];d.data.splice(e,0,...i);break}}U(t)}function U(t){var e;const{key:i}=t;switch(null==(e=d.value)||e.remove(...K.get(i)),K.delete(i),i){case"horizontal":J();break;case"vertical":N();break;case"mark":Z();break;case"extracorporealCirculation":rt()}}function Z(){if(!D)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=R.mark||{};if(!(null==r?void 0:r.length))return;const a="mark";K.set(a,[]);const l=i([B-5,Y+D/2],{value:t,...o,originX:"right"});d.value.add(l);const s=Y+D+G,c=Y+G;let u=0;const f={};r.forEach(((t,i)=>{const{time:o,list:r=[]}=t,l=A(o);if(!ot(l))return;let h=c+1;r.forEach(((t,o)=>{var r;const{style:g}=t,m=e((null==g?void 0:g.type)||"circleAndText",{...(null==g?void 0:g.pointAttr)||n,text:t.text,left:l,top:c+10,origin:{data:t,key:"mark",type:"other",dataIndex:i,index:o}}),p=m.height;u&&l-u<=O&&(null==(r=f[`x_${u}`])||r.forEach((([t,e])=>{h+p>=s&&(h=Y-1),t<e&&h>=t&&h<e&&(h=e),t>e&&h>e&&h<=t&&(h=e)})));const{topObj:v,startTop:x,oldStartTop:y}=function(t,e){const i={};let o;if(t>Y){const r=t+e;i.y2=t+e/2,r>=s?n(Y-1):(o=t,t=r)}else n(t);function n(n){o=n,i.y2=n-e/2;t=n-e}return{topObj:i,startTop:t,oldStartTop:o}}(h,p);h=x,f[`x_${l}`]||(f[`x_${l}`]=[]),f[`x_${l}`].push([y,h]),m.set("top",v.y2),K.get(a).push(m),tt(m),d.value.add(m)})),u=l})),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:$};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(K.get(a))}function tt(t){if(_.hovered&&(t.on("mouseover",(()=>{et(t)})),t.on("mouseout",(()=>{k.show=!1}))),t.lockMovementX&&t.lockMovementY)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e),n=["mark","extracorporealCirculation"].includes(e),r="extracorporealCirculation"===e;t.on("moving",(()=>{t.moving=!0,i?function(t){const e=t.origin.key,i="horizontal"===e;t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1+(i?1:0));t.left>t.limitX.x2&&t.set("left",t.limitX.x2+(i?-1:0));if("mark"===e){t.top<W&&t.set("top",W);const e=Y+G+D-t.height/2;t.top>e&&t.set("top",e)}i&&(t.originLeft=t.left+t.iconHalfWidth)}(t):r?function(t){t.setCoords();const{left:e,limitX:i}=t,o=p(new Date,"yyyy-MM-dd HH:mm"),n=A(o);i.isCurrentTime&&i.x2<n&&n>0&&n<M&&(i.x2=n);e<i.x1&&t.set({x1:i.x1,x2:i.x1});e>i.x2&&t.set({x1:i.x2,x2:i.x2});it(t,"left"),it(t,"right")}(t):(w(t),function(t){const e=t.left+t.maxTextWidth>$?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((i=>i.setCoords().set({originX:e,left:t.left})))}(t)),_.hovered&&et(t)})),t.on("mouseup",(r=>{var a;if(k.show=!1,1===r.button){if(!t.moving)return;t.moving=!1,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=L(null!=(a=t.originLeft)?a:t.left),r={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};d.value.discardActiveObject(),y("change",r),n&&Q(r,"change")}3===r.button&&["horizontal","vertical"].includes(e)&&(C.point={x:t.left,y:t.top},C.show=!0,C.target=t,C.list=x.map((t=>({...t,renderItem:()=>t.label,_type:"other"}))))}))}function et(t){k.isTarget=!0,k.show=!0;const{key:e,data:i={}}=t.origin||{};let o=i.value;const n="extracorporealCirculation"===e||"mark"===e;k.point={x:t.left,y:n?t.top:t.top+V/2};const r=!t.origin.isMenu&&t.originLeft?t.originLeft:t.left,a=L(r);k.list=[`时间 ${a.slice(-5)}`],n&&("mark"===e&&(o=i.name),k.list.unshift(o+" ")),k.sourceData=[{type:"other",key:e,time:a,value:o}]}function it(t,e){const{shadowObjs:i,params:o}=t[`${e}ShadowBox`]||{};if(!i||!o)return;i.forEach((t=>d.value.remove(t)));o["left"===e?1:0]=t.left;const n=nt(...o);t[`${e}ShadowBox`]={shadowObjs:n,params:o}}function ot(t){return t>=B&&t<=$}function nt(...e){const[i,o,r,a]=e,{mode:l,style:s}=a,c=f(s,["angle","space"]),u=[[i,Y],[o,Y],[o,r],[i,r]],h=new t.Polygon(u.map((t=>({x:t[0],y:t[1]}))),{...n,...c,stroke:"transparent",..."slash"===l?{fill:"transparent"}:{}}),g=[];return["slash"].includes(l)&&g.push(...I(u,s.angle,s.space,c)),d.value.add(h,...g),K.get("extracorporealCirculation").push(h,...g),[h,...g]}function rt(){if(!G)return;const{dataList:e,ascendAortaStyle:i,extracorporealCirculationStyle:o}=R.extracorporealCirculation||{};if(!(null==e?void 0:e.length))return;const n="extracorporealCirculation";K.set(n,[]);const r=Y+G;let a,l;function s(t){return t&&t>B&&t<M}function c(t){return void 0===t||""===t}e.forEach(((u,f)=>{const h=function(t){const{extracorporealCirculationStart:e,closeAscendAorta:i,openAscendAorta:o,extracorporealCirculationEnd:n}=t;let r,a,l,s;return e&&(r=A(e.time)),i&&(a=A(i.time)),o&&(l=A(o.time)),n&&(s=A(n.time)),[r,a,l,s]}(u);if(-1===h.findIndex((t=>t>0&&t<M)))return;let g;h.forEach(((m,v)=>{if(c(m))return;const x=h[v+1],y=h[v-1];if(s(m)||s(x)){const k=s(m)?m:B,C=s(x)?x:c(x)?null:$,w=s(y)?y:B,X={};if(v<h.length-1&&C&&(X.params=[k,C,r,[0,2].includes(v)?o:i],X.shadowObjs=nt(...X.params)),s(m)){const i=function(t){switch(t){case 0:return"extracorporealCirculationStart";case 1:return"closeAscendAorta";case 2:return"openAscendAorta";case 3:return"extracorporealCirculationEnd"}}(v),o=p(new Date,"yyyy-MM-dd HH:mm"),c=A(o),x=m<c&&s(c)?c:m,y=function(e,i){const o=new t.Line(e,{...i,stroke:"transparent",strokeWidth:5,hasControls:!1,hasBorders:!1,hoverCursor:"e-resize",lockMovementY:!0,originX:"center"});return tt(o),d.value.add(o),K.get("extracorporealCirculation").push(o),o}([m,Y,m,r],{origin:{dataIndex:f,dataKey:i,key:n,data:u[i],type:"other"},limitX:{x1:0===v?null!=a?a:B:w,x2:C||x,isCurrentTime:!C&&f===e.length-1},...[1,2,3].includes(v)?{leftShadowBox:g}:{},...[0,1,2].includes(v)?{rightShadowBox:X}:{}});v===h.length-1&&(a=m,l=y),0===v&&l&&(l.limitX.x2=k)}g=X}}))}))}function at(t){const{code:e}=t;F&&(e.includes("Enter")||e.includes("Esc"))&&(e.includes("Esc")&&(F.text=""),F.exitEditing(),d.value.discardActiveObject(F))}return function(){if(!(null==T?void 0:T.longLine)||!T.longLine.time)return;const{time:t,style:e}=T.longLine,i=A(t),n=o([i,0,i,Y],e);d.value.add(n)}(),function(){var t;if(!(null==(t=null==R?void 0:R.horizontal)?void 0:t.length))return;q=[];const{horizontal:i}=R,o=B-5;let n=W+H/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l,data:s=[]}=t,c=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r,isMenu:!0},originLeft:o,originTop:n});var u;q.push({type:"other",title:r,key:"horizontal",dataIndex:i,dataList:s.map((t=>A(t.time))),y1:n-c.height/2,y2:n+c.height/2}),(u=c).on("moving",(()=>{u.set("originX","center"),S(u)?et(u):k.show=!1})),u.on("mouseup:before",(t=>{if(k.show=!1,0===t.e.button&&S(u))if(j(K.get("horizontal"),u.left,"key",O).includes(u.origin.key))P("repeat"),console.log("重复节点");else{const t={data:{time:L(u.left),value:u.origin.defaultAddValue},...u.origin};y("add",f(t,["isMenu"])),Q(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(u)})),d.value.add(c),n+=H}))}(),J(),N(),Z(),rt(),a.on((()=>{const t="horizontal",e=X(K.get(t));e.length>0?b((()=>{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 h(Object.keys(e).map((t=>{const i=e[t];return R.horizontal[t].data.splice(i[0].index,i.length),i})))}(e);U({key:t}),y("remove",i)})):E()})),_.evented&&(window.addEventListener("keydown",at,!0),d.value.on("mouse:up",(e=>{var i,o,n,r;if(1===e.button){const{target:a,pointer:l={}}=e,{x:s=0,y:c=0}=l;if(!S({left:s,top:c}))return;if(!(null==q?void 0:q.length)||F)return;if(a&&"horizontal"!==(null==(i=a.origin)?void 0:i.key))return;let u="";if(a){if(a.moving)return;u=null==(r=null==(n=null==(o=a.origin)?void 0:o.data)?void 0:n.value)?void 0:r.toString()}const f=q.find((({y1:t,y2:e})=>c>=t&&c<=e));g(null==f?void 0:f.dataIndex)&&(F=new t.Textbox(u,{left:s,top:c,width:100,height:100,fontSize:18,objectCaching:!1,hasControls:!1,borderColor:"#000",editingBorderColor:"#000",backgroundColor:"#fff",fontFamily:"微软雅黑"}),F.otherListPointHeightRangeItem={...f,left:s,target:a},d.value.add(F),d.value.setActiveObject(F),F.enterEditing(),u&&F.setSelectionEnd(u.length))}})),d.value.on("selection:cleared",(({deselected:t})=>{var e;if(null==t?void 0:t.find((t=>t.otherListPointHeightRangeItem))){let{text:t}=F;const{otherListPointHeightRangeItem:i}=F;if(t=t.replace(/^\s+|\s+$/g,""),d.value.remove(F),F=null,!t)return;const{left:o,target:n}=i;if(n){if(t==(null==(e=n.origin)?void 0:e.data.value))return;const i={...n.origin,data:{...n.origin.data,value:t}};y("change",i),Q(i,"change")}else{const e={...m(i,["title","type","key","dataIndex"]),data:{time:L(o),value:t}};y("add",e),Q(e)}}}))),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i,_type:o}=t,n={...e.origin,type:o};y(i,n),"remove"===i&&Q(n,i)},handleKeydown:at}}export{y as useOther};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i,drawLine as o,defaultLineStyle as n}from"../useDraw.js";import{useBirthProcessCumputedPoint as r}from"../useCumputedPoint.js";import{bus as a}from"../useEvent.js";import{useShadow as l}from"../useShadow.js";import{useCommon as s}from"../useCommon.js";import"vue";import{getIndex as c}from"../../utils/index.js";import{filter as d,cloneDeep as u,omit as f,flatten as h,isNumber as g,pick as m}from"lodash-es";import{format as p}from"date-fns";import{OTHER_MENU as v}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"./useTop.js";import"@vueuse/core";import"../../../../../shared/utils/index.js";const x=d(v,(t=>"add"!==t.type));function y(d,v,y,k,C,w,X,b,E){const{computedX:A,getXValue:L}=r(v),{getEqualXTypes:j,handleAddPrevent:P,isGridLimit:S,getPointEventProps:z}=s(d,y,v),{createShadowLines:I}=l(),{canvasWidth:M,other:T,yCellHeight:H,xCellWidth:O,endX:$,originX:B,originY:W,endY:Y,markHeight:D,event:_,topGridYCellHeight:V,extracorporealCirculationHeight:G}=v,K=new Map,R=u(T);let q=[],F=null;function J(){var o;if(!(null==(o=null==R?void 0:R.horizontal)?void 0:o.length))return;const n="horizontal";K.set(n,[]);const{horizontal:r}=R;let a=W+H/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:c={},textStyle:d={},data:u,showIcon:f=!0}=o;let h=null;u.forEach(((o,u)=>{const{time:g,value:m}=o,p=A(g);if(!ot(p))return;const v=[],x=f&&e(s,{...c,left:p,top:a});x&&v.push(x);const y=f?p+x.width/2+2:p,k=i([y,a],{value:m,...d,originX:"left"});v.push(k);const C=new t.Group(v,{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer",...z()});Object.assign(C,{originLeft:p,iconHalfWidth:x?x.width/2:0,origin:{type:"other",key:n,dataIndex:r,index:u,data:o,title:l},limitX:{x1:B,x2:$-C.width}}),h&&(C.limitX.x1=h.left,h.limitX.x2=C.left,C.prevPoint=h,h.nextPoint=C),h=C,tt(C),K.get(n).push(C)})),a+=H})),d.value.add(...K.get(n))}function N(){var t;if(!(null==(t=null==R?void 0:R.vertical)?void 0:t.length))return;const i="vertical";K.set(i,[]);const{vertical:o}=R;o.forEach(((t,o)=>{const{show:n=!0,marginTop:r=0,textStyle:a={},data:l,time:s}=t,c=A(s);if(!n||!ot(c))return;const{lineHeight:d=H}=a;let u=W+r+d/2;l.forEach(((t,n)=>{const r=e(String(t.value),{...a,lockMovementY:!0,left:c,originX:"left",top:u,origin:{type:"other",key:i,dataIndex:o,index:n,data:t},...z()});u+=d,tt(r),K.get(i).push(r)}));const f=K.get(i).filter((t=>t.origin.dataIndex===o)),h=Math.max(...f.map((t=>t.width))),g=c>$-h;f.forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=h,g&&t.set("originX","right")}))})),d.value.add(...K.get(i))}function Q(t,e="add"){const{dataIndex:i,data:o,index:n,key:r,dataKey:a,time:l}=t,s=R[r],d=["mark","extracorporealCirculation"].includes(r)?s.dataList[i]:s[i];switch(e){case"remove":d.data.splice(n,1);break;case"change":if("mark"===r){d.list.splice(n,1);const t=s.dataList.find((t=>t.time===l));t?t.list.push(o):(s.dataList.push({time:l,list:[o]}),s.dataList.sort(((t,e)=>Date.parse(t.time)-Date.parse(e.time))))}else"extracorporealCirculation"===r?d[a]=o:d.data[n]=o;break;default:{const t=Array.isArray(o)?o[0].time:o.time,e=c(t,d.data),i=Array.isArray(o)?o:[o];d.data.splice(e,0,...i);break}}U(t)}function U(t){var e;const{key:i}=t;switch(null==(e=d.value)||e.remove(...K.get(i)),K.delete(i),i){case"horizontal":J();break;case"vertical":N();break;case"mark":Z();break;case"extracorporealCirculation":rt()}}function Z(){if(!D)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=R.mark||{};if(!(null==r?void 0:r.length))return;const a="mark";K.set(a,[]);const l=i([B-5,Y+D/2],{value:t,...o,originX:"right"});d.value.add(l);const s=Y+D+G,c=Y+G;let u=0;const f={};r.forEach(((t,i)=>{const{time:o,list:r=[]}=t,l=A(o);if(!ot(l))return;let h=c+1;r.forEach(((t,o)=>{var r;const{style:g}=t,m=e((null==g?void 0:g.type)||"circleAndText",{...(null==g?void 0:g.pointAttr)||n,text:t.text,left:l,top:c+10,origin:{data:t,key:"mark",type:"other",dataIndex:i,index:o}}),p=m.height;u&&l-u<=O&&(null==(r=f[`x_${u}`])||r.forEach((([t,e])=>{h+p>=s&&(h=Y-1),t<e&&h>=t&&h<e&&(h=e),t>e&&h>e&&h<=t&&(h=e)})));const{topObj:v,startTop:x,oldStartTop:y}=function(t,e){const i={};let o;if(t>Y){const r=t+e;i.y2=t+e/2,r>=s?n(Y-1):(o=t,t=r)}else n(t);function n(n){o=n,i.y2=n-e/2;t=n-e}return{topObj:i,startTop:t,oldStartTop:o}}(h,p);h=x,f[`x_${l}`]||(f[`x_${l}`]=[]),f[`x_${l}`].push([y,h]),m.set("top",v.y2),K.get(a).push(m),tt(m),d.value.add(m)})),u=l})),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:$};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(K.get(a))}function tt(t){if(_.hovered&&(t.on("mouseover",(()=>{et(t)})),t.on("mouseout",(()=>{k.show=!1}))),t.lockMovementX&&t.lockMovementY)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e),n=["mark","extracorporealCirculation"].includes(e),r="extracorporealCirculation"===e;t.on("moving",(()=>{t.moving=!0,i?function(t){const e=t.origin.key,i="horizontal"===e;t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1+(i?1:0));t.left>t.limitX.x2&&t.set("left",t.limitX.x2+(i?-1:0));if("mark"===e){t.top<W&&t.set("top",W);const e=Y+G+D-t.height/2;t.top>e&&t.set("top",e)}i&&(t.originLeft=t.left+t.iconHalfWidth)}(t):r?function(t){t.setCoords();const{left:e,limitX:i}=t,o=p(new Date,"yyyy-MM-dd HH:mm"),n=A(o);i.isCurrentTime&&i.x2<n&&n>0&&n<M&&(i.x2=n);e<i.x1&&t.set({x1:i.x1,x2:i.x1});e>i.x2&&t.set({x1:i.x2,x2:i.x2});it(t,"left"),it(t,"right")}(t):(w(t),function(t){const e=t.left+t.maxTextWidth>$?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((i=>i.setCoords().set({originX:e,left:t.left})))}(t)),_.hovered&&et(t)})),t.on("mouseup",(r=>{var a;if(k.show=!1,1===r.button){if(!t.moving)return;t.moving=!1,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=L(null!=(a=t.originLeft)?a:t.left),r={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};d.value.discardActiveObject(),y("change",r),n&&Q(r,"change")}3===r.button&&["horizontal","vertical"].includes(e)&&(C.point={x:t.left,y:t.top},C.show=!0,C.target=t,C.list=x.map((t=>({...t,renderItem:()=>t.label,_type:"other"}))))}))}function et(t){k.isTarget=!0,k.show=!0;const{key:e,data:i={}}=t.origin||{};let o=i.value;const n="extracorporealCirculation"===e||"mark"===e;k.point={x:t.left,y:n?t.top:t.top+V/2};const r=!t.origin.isMenu&&t.originLeft?t.originLeft:t.left,a=L(r);k.list=[`时间 ${a.slice(-5)}`],n&&("mark"===e&&(o=i.name),k.list.unshift(o+" ")),k.sourceData=[{type:"other",key:e,time:a,value:o}]}function it(t,e){const{shadowObjs:i,params:o}=t[`${e}ShadowBox`]||{};if(!i||!o)return;i.forEach((t=>d.value.remove(t)));o["left"===e?1:0]=t.left;const n=nt(...o);t[`${e}ShadowBox`]={shadowObjs:n,params:o}}function ot(t){return t>=B&&t<=$}function nt(...e){const[i,o,r,a]=e,{mode:l,style:s}=a,c=f(s,["angle","space"]),u=[[i,Y],[o,Y],[o,r],[i,r]],h=new t.Polygon(u.map((t=>({x:t[0],y:t[1]}))),{...n,...c,stroke:"transparent",..."slash"===l?{fill:"transparent"}:{}}),g=[];return["slash"].includes(l)&&g.push(...I(u,s.angle,s.space,c)),d.value.add(h,...g),K.get("extracorporealCirculation").push(h,...g),[h,...g]}function rt(){if(!G)return;const{dataList:e,ascendAortaStyle:i,extracorporealCirculationStyle:o}=R.extracorporealCirculation||{};if(!(null==e?void 0:e.length))return;const n="extracorporealCirculation";K.set(n,[]);const r=Y+G;let a,l;function s(t){return t&&t>B&&t<M}function c(t){return void 0===t||""===t}e.forEach(((u,f)=>{const h=function(t){const{extracorporealCirculationStart:e,closeAscendAorta:i,openAscendAorta:o,extracorporealCirculationEnd:n}=t;let r,a,l,s;return e&&(r=A(e.time)),i&&(a=A(i.time)),o&&(l=A(o.time)),n&&(s=A(n.time)),[r,a,l,s]}(u);if(-1===h.findIndex((t=>t>0&&t<M)))return;let g;h.forEach(((m,v)=>{if(c(m))return;const x=h[v+1],y=h[v-1];if(s(m)||s(x)){const k=s(m)?m:B,C=s(x)?x:c(x)?null:$,w=s(y)?y:B,X={};if(v<h.length-1&&C&&(X.params=[k,C,r,[0,2].includes(v)?o:i],X.shadowObjs=nt(...X.params)),s(m)){const i=function(t){switch(t){case 0:return"extracorporealCirculationStart";case 1:return"closeAscendAorta";case 2:return"openAscendAorta";case 3:return"extracorporealCirculationEnd"}}(v),o=p(new Date,"yyyy-MM-dd HH:mm"),c=A(o),x=m<c&&s(c)?c:m,y=function(e,i){const o=new t.Line(e,{...i,stroke:"transparent",strokeWidth:5,hasControls:!1,hasBorders:!1,hoverCursor:"e-resize",lockMovementY:!0,originX:"center"});return tt(o),d.value.add(o),K.get("extracorporealCirculation").push(o),o}([m,Y,m,r],{origin:{dataIndex:f,dataKey:i,key:n,data:u[i],type:"other"},limitX:{x1:0===v?null!=a?a:B:w,x2:C||x,isCurrentTime:!C&&f===e.length-1},...[1,2,3].includes(v)?{leftShadowBox:g}:{},...[0,1,2].includes(v)?{rightShadowBox:X}:{}});v===h.length-1&&(a=m,l=y),0===v&&l&&(l.limitX.x2=k)}g=X}}))}))}function at(t){const{code:e}=t;F&&(e.includes("Enter")||e.includes("Esc"))&&(e.includes("Esc")&&(F.text=""),F.exitEditing(),d.value.discardActiveObject(F))}return function(){if(!(null==T?void 0:T.longLine)||!T.longLine.time)return;const{time:t,style:e}=T.longLine,i=A(t),n=o([i,0,i,Y],e);d.value.add(n)}(),function(){var t;if(!(null==(t=null==R?void 0:R.horizontal)?void 0:t.length))return;q=[];const{horizontal:i}=R,o=B-5;let n=W+H/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l,data:s=[]}=t,c=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r,isMenu:!0},originLeft:o,originTop:n});var u;q.push({type:"other",title:r,key:"horizontal",dataIndex:i,dataList:s.map((t=>A(t.time))),y1:n-c.height/2,y2:n+c.height/2}),(u=c).on("moving",(()=>{u.set("originX","center"),S(u)?et(u):k.show=!1})),u.on("mouseup:before",(t=>{if(k.show=!1,0===t.e.button&&S(u))if(j(K.get("horizontal"),u.left,"key",O).includes(u.origin.key))P("repeat"),console.log("重复节点");else{const t={data:{time:L(u.left),value:u.origin.defaultAddValue},...u.origin};y("add",f(t,["isMenu"])),Q(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(u)})),d.value.add(c),n+=H}))}(),J(),N(),Z(),rt(),a.on((()=>{const t="horizontal",e=X(K.get(t));e.length>0?b((()=>{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 h(Object.keys(e).map((t=>{const i=e[t];return R.horizontal[t].data.splice(i[0].index,i.length),i})))}(e);U({key:t}),y("remove",i)})):E()})),_.evented&&(window.addEventListener("keydown",at,!0),d.value.on("mouse:up",(e=>{var i,o,n,r;if(1===e.button){const{target:a,pointer:l={}}=e,{x:s=0,y:c=0}=l;if(!S({left:s,top:c}))return;if(!(null==q?void 0:q.length)||F)return;if(a&&"horizontal"!==(null==(i=a.origin)?void 0:i.key))return;let u="";if(a){if(a.moving)return;u=null==(r=null==(n=null==(o=a.origin)?void 0:o.data)?void 0:n.value)?void 0:r.toString()}const f=q.find((({y1:t,y2:e})=>c>=t&&c<=e));g(null==f?void 0:f.dataIndex)&&(F=new t.Textbox(u,{left:s,top:c,width:100,height:100,fontSize:18,objectCaching:!1,hasControls:!1,borderColor:"#000",editingBorderColor:"#000",backgroundColor:"#fff",fontFamily:"微软雅黑"}),F.otherListPointHeightRangeItem={...f,left:s,target:a},d.value.add(F),d.value.setActiveObject(F),F.enterEditing(),u&&F.setSelectionEnd(u.length))}})),d.value.on("selection:cleared",(({deselected:t})=>{var e;if(null==t?void 0:t.find((t=>t.otherListPointHeightRangeItem))){let{text:t}=F;const{otherListPointHeightRangeItem:i}=F;if(t=t.replace(/^\s+|\s+$/g,""),d.value.remove(F),F=null,!t)return;const{left:o,target:n}=i;if(n){if(t==(null==(e=n.origin)?void 0:e.data.value))return;const i={...n.origin,data:{...n.origin.data,value:t}};y("change",i),Q(i,"change")}else{const e={...m(i,["title","type","key","dataIndex"]),data:{time:L(o),value:t}};y("add",e),Q(e)}}}))),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i,_type:o}=t,n={...e.origin,type:o};y(i,n),"remove"===i&&Q(n,i)},handleKeydown:at}}export{y as useOther};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,defaultStyle as i,drawPoint as n,drawText as o,drawArrow as l}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{format as s}from"date-fns";import{getType as a,getTime as u,isOneLine as d,isOverlapPoint as c,getFloorNumber as p,isValidValue as f,setOtherType as h,isEffectiveNode as v,deleteProperty as g,getIndex as y}from"../../utils/index.js";import{cloneDeep as m,omit as w,flatten as x,last as b}from"lodash-es";import"../useEvent.js";import{useShadow as j}from"../useShadow.js";import{useCommon as L}from"../useCommon.js";import"vue";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import{TEMPERATURE_MENU as k,PAIN_MENU as S,OVERLAP as Y}from"../../constants/index.js";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";import{promiseTimeout as E}from"@vueuse/shared";function M(M,C,T,$,P,V,A,R,I,X){r(M,{...C,isTemperature:!0});const{getEqualXTypes:H,handleAddPrevent:B,getPointEventProps:D}=L(M,T,C),{createShadowLines:W}=j(),{left:z,xScaleList:F,xCellWidth:_,yCellHeight:K,originX:q,endX:G,originY:N,endY:J,itemList:Q,event:U,vitalSignsOriginY:Z,painOriginY:ee,hospitalizationDate:te,config:ie,canvasHeight:ne,painSurplusCell:oe,iconsWidth:le,canvasWidth:re,borderStyle:se,painScalePositionSurplusHeight:ae}=C,ue=new Set,de=["xinmai","mai"],ce=new Map,pe=new Set,fe=new Set,he=new Set,ve=m(z.yScaleValue),ge=new Set;function ye(n){var o;const l=ve.find((e=>e.show&&"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(ue.size&&M.value.remove(...ue),ue.clear(),ce.size>1)){if(n){const{type:e,key:t}=n.origin||{};if("pulse"===e){const e=ce.get(t),i=null==e?void 0:e.findIndex((e=>e[0]===n.left));e.splice(i,1,[n.left,n.top])}}const o=function(){const e=[],t=[],i=[];for(const e of ce)t.push(e[1]),e[0]===de[0]&&e[1].forEach((e=>{(ce.get(de[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],d=n[i-1],c=n[i+1],p=o[s-1],f=o[s+1];if(d&&p){if(d[0]!==p[0]){const e=Math.max(d[0],p[0]);l.push([d,p].find((t=>t[0]===e)))}}else d?l.push(d):p&&r.push(p);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=b(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],r=[]};if(c&&f){if(c[0]!==f[0]){const e=Math.min(c[0],f[0]);l.push([c,f].find((t=>t[0]===e))),g()}}else c?(l.push(c),g()):f?(r.push(f),g()):g()})),e}();o.length>0&&function(e){E(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(he).forEach((n=>{var o,l;"pulse"===(null==(o=null==n?void 0:n.origin)?void 0:o.type)&&e.find((e=>Math.abs(n.left-e[0])<=1&&Math.abs(n.top-e[1])<=1))&&((null==(l=null==n?void 0:n.origin)?void 0:l.key)===de[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{0==t?e.rightLine&&M.value.remove(e.rightLine):e.leftLine&&M.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:r,style:s={}}=l.shadow||{};o.forEach((n=>{const o=n.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...i,...s,strokeWidth:1});if(["slash","line"].includes(r)){l.set({fill:"transparent",stroke:s.stroke||"#f00"});const e=[];if(["slash"].includes(r))e.push(...W(n,s._angle,s.space,w(s,["_angle","space"]))),e.forEach((e=>{ue.add(e)}));else{const i=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}(n);i.forEach((i=>{const n=t([...x(i)],{...s,originX:"center"});e.push(n),ue.add(n)}))}M.value.add(...e)}ue.add(l),M.value.add(l)}))}}function me(e,r,s){var a;const{type:u,riseStyle:c={},noRiseStyle:v={},verifiedStyle:g={},reduceStyle:y={},pacemaker:w={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:L={},respiratorStyle:k={},dataList:S=[],list:Y=[]}=s,{type:E,textStyle:C}=j,V=[],R=[],X=[];let H=null;const B=e=>"breathe"==u&&e.respirator&&k.type&&k.fixedValue&&!e.value&&be(e.time),W=d(s);if(null==(a=e.list)||a.forEach(((a,d)=>{var j,z,F,q;const G=W?S.find((e=>e.key===a.key)):e,N=je(B(a)?{...a,value:k.fixedValue}:a,s),J=e.list[d+1],Q=J?je(B(J)?{...J,value:k.fixedValue}:J,s):void 0,te=J?W?S.find((e=>e.key===J.key)):e:{},{title:le=""}=G;if(le===((null==(j=window.getLanguageByCode)?void 0:j.call(window,"10010.1.235"))||"脉搏")&&te.title!==((null==(z=window.getLanguageByCode)?void 0:z.call(window,"10010.1.235"))||"脉搏")||le!==((null==(F=window.getLanguageByCode)?void 0:F.call(window,"10010.1.235"))||"脉搏")&&te.title===((null==(q=window.getLanguageByCode)?void 0:q.call(window,"10010.1.235"))||"脉搏")||!N||!Q||p(N[0],1)!==p(Q[0],1))N&&H&&(N[0]=H),H=null;else{const e=N[0]-_/2;N[0]=e+_/4,Q[0]=H=N[0]+_/2}const re={};re.value=function(e,t,i){if(!(null==e?void 0:e.length)||!ie.showValue)return;const{lineAttr:n={}}=i,l=e[1]<=Z.originY+K?e[1]+K:e[1]-K,r=o([e[0],l],{value:B(t)?k.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(r),{obj:r,top:-K}}(N,a,G),function(e,r,s,a){var d,p,h;if(!["temperature","pain","breathe"].includes(u))return;if(!(null==e?void 0:e.length)&&"temperature"===u&&!be(r.time))return;if(!(null==e?void 0:e.length)&&"pain"===u)return;if(!r.value&&"breathe"===u)return;const{lineAttr:m={},key:w}=s,{value:x}=a,b=$(r.time);let j,L,S,Y,E,M;if(r.noRise&&v.show){const t=O(v,r)?P(u,35):(null==e?void 0:e[1])||0;if(v.text)S=o([b,O(v,r)?t:t+5],{value:v.text.split("").join("\n"),originY:"top",...v.style}),r.value||he.add(S);else if(r.value){S=l([b,t,t+2*K],{...v.style})}S&&X.push(S),S&&O(v,r)&&ge.add(S)}if(null==e?void 0:e[1]){if(r.rise&&c.show&&c.text&&(Y=o([b,e[1]-(x?K:0)-5],{value:c.text.split("").join("\n"),originY:"bottom",...c.style}),X.push(Y)),r.verified){const t=(null==(d=null==g?void 0:g.position)?void 0:d[w])||"top";E=o(["top-right"===t?b+_/2:b,e[1]-(x?K:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(E)}if(f(r.physicsReduce)||f(r.drugReduce)){const o=P(u,null!=(p=r.physicsReduce)?p:r.drugReduce),l=o<e[1]&&(null==ie?void 0:ie.hypothermyViewCustom)?b+_/2:b;j=t([...e,l,o],{...m,...y.line,...i}),L=n((null==(h=null==y?void 0:y.point)?void 0:h.type)||"circle",{left:l,top:o,...y.point,...i,originY:o===ne?"bottom":"center"}),j&&X.push(j),L&&X.push(L)}r.respirator&&(M=n(k.type,{left:b,top:e[1]-(x?K:0)-5,originX:"center",originY:"bottom",...k.style}),X.push(M))}Object.assign(a,{reduceLine:{obj:j,type:"line"},noRiseText:{obj:S,top:v.text?5:2*K,isFixed:O(v,r)},riseText:{obj:Y,top:(x?-K:0)-5},verifiedText:{obj:E,left:_/2,top:(x?-K:0)-5},reducePoint:{obj:L,type:"reduce"},respirator:{obj:M,top:(x?-K:0)-5}})}(N,a,G,re),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(u))return;const r=Math.max(...Y),s=Math.min(...Y);let a,d,c;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*K,i=[e[1]-K/2,t];t<Z.originY&&(t=e[1]+2.5*K,i=[t,e[1]+K/2]),a=l([e[0],i[0],i[1]],x,"up"),X.push(a)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>r){const t=a?e[1]+K/2+a.height:e[1]+K;d=o([e[0],t],i),X.push(d)}+t.value<s&&(d=o([e[0],e[1]-K],i),X.push(d))}if(L.show&&+t.value<s){const t=e[1];if(L.text)c=o([e[0],e[1]+5],{value:L.text.split("").join("\n"),originY:"top",...L.style});else{const i=t+2*K;c=l([e[0],t,i],{...L.style})}X.push(c)}Object.assign(n,{upArrow:{obj:a},limitValue:{obj:d,top:-K},belowMinValue:{obj:c,top:L.text?5:2*K,moveHide:!0}})}(N,a,G,re),function(i,o,l,a,d,c){let p,f;const{pointAttr:g={},lineAttr:y={},title:x="",key:b,type:j="circle",overlapKey:L}=d,S=g.height?g.height/2:5,Y=e.list[a+1];let O=m(i),H=m(o);const z=we(u,e.list[a].value),F=()=>"pulse"==u&&l.pacemakerShow?w.value:B(l)?k.type:z&&"number"===E?0:j,_=e=>e&&v.show&&v.fixed&&be(e.time)&&e.noRise&&!e.value&&0!==e.value;if((()=>{if(l.breakpoint)return!1;if("temperature"===u&&(i||_(l))&&(o||_(Y))){const e=P(u,35);return i||(O=[$(l.time),e]),o||(H=[$(Y.time),e]),!0}return!!i&&!!o})()){O&&H&&z&&we(u,Y.value)&&!oe[1]&&!ae&&"icon"===E&&(O[1]=O[1]-S,H[1]=H[1]-S),f=t([...O,...H],{...y});const{obj:e}=(null==c?void 0:c.reducePoint)||{};if(i&&o&&(null==e?void 0:e.top)<i[1]&&(null==ie?void 0:ie.hypothermyViewCustom)){const i=t([e.left,e.top,...o],{...y});X.unshift(i),Object.assign(c,{reduceRightLine:{obj:i,type:"reduce"}}),f.set("stroke","transparent")}}const K=F(),q=R[a-1],G={origin:{data:B(l)?{...l,value:k.fixedValue}:l,title:x,key:b||"",overlapKey:L,unit:s.unit,type:u,_type:h(x,u),dataIndex:r,index:a,isOneLine:W},leftLine:q,rightLine:f,otherObj:c,...l.pacemakerShow&&"pulse"==u?w.style:B(l)?k.style:g,...D(),lockMovementX:!0,...z?{selectable:!1,evented:!1,..."number"===E?C:{}}:{}};i&&(q?G.leftLine.set("x2",i[0]):G.leftLine=null,p=n(K,{left:i[0],top:!z||oe[1]||ae?i[1]:i[1]-S,...G}));R.push(f),p&&(b===de[1]?pe.add(p):B(l)||fe.add(p),function(e){U.hovered&&(e.on("mouseover",(()=>{xe(e,"hover")})),e.on("mouseout",(()=>{I.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?ee:Z;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,moveHide:r=!1,left:s=0}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left+s,top:e.top+o}),r&&(M.value.remove(i),delete e.otherObj.obj)))})),ye(e)}(e),U.hovered&&xe(e)})),e.on("mouseup",(t=>{if(I.show=!1,1===t.button){const{type:t}=e.origin,i=A(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};M.value.discardActiveObject(),T("change",n),ke(n,"change")}}))}(p),V.push(p),he.add(p))}(N,Q,a,d,G,re)})),"pulse"===u){let t=null;const i=e=>e.map(((e,i,n)=>{var o,l;const r=n[i+1];if(r&&p(e.left,1)===p(r.left,1)){const i=e.left-_/2;e.set("left",i+_/4),null==(o=e.rightLine)||o.set("x1",e.left),t=e.left+_/2,r.set("left",t)}else t&&(null==(l=e.leftLine)||l.set("x2",t),e.set("left",t)),t=null;return[e.left,e.top]}));if(W){const e={};de.forEach((t=>{e[t]=V.filter((e=>{var i;return(null==(i=e.origin)?void 0:i.key)===t})),ce.set(t,i(e[t]))}))}else{const{key:t}=e;ce.set(t,i(V))}}const z=R.filter((e=>e));M.value.add(...z,...V,...X)}function we(e,t){return"pain"===e&&0==t}function xe(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;I.point={x:e.left,y:e.top};let r=`时间 ${((null==l?void 0:l.time)||V(e.left)).slice(-5)}`;I.list=[function(){const{drugReduce:s,physicsReduce:a}=l||{},u="hover"===t?l.value:A(o,e.top);if(f(s))return r+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${u}—>${s}${n||""}`;if(f(a))return r+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${u}—>${a}${n||""}`;return`${i} ${u}${n||""}`}(),r],I.show=!0}function be(e){const[t]=F,i=b(F),n=t.start,o=i.end,l=u(e);return l>=n&&l<=o}function je(e,t){const i="pain"===t.type?ee:Z;if(!v(e)||!be(e.time))return;const n=$(e.time),o=P(t.type,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function Le(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=u(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=u(`${V(e)}:00`);return te&&l<u(te)?(B("exceedMin"),!1):!(l>o)||(B("exceedMax"),!1)}function ke(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:r}=e,s=ve.find((e=>e.type===i));if("add"===t){const e=d(s)?s.dataList.find((e=>e.enable)):s.dataList[n],t=y(l.time,e.list);e.list.splice(t,0,l)}else s.dataList[n].list[o]=l;Se()}function Se(){var e;he.size&&(null==(e=M.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}([...he]))),he.clear(),Ye()}function Ye(e){ce.clear(),he.clear(),pe.clear(),ge.clear(),fe.clear(),ve.forEach((t=>{t.show&&(null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||d(t)&&!e.enable||me(e,i,t)})))})),ye(),[...he].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=ve.find((e=>e.show&&"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>{var t;return e.title.includes((null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.235"))||"脉搏")})))return;const o=Object.assign({},Y,z.overlap||{}),l=[];pe.size&&[...pe].forEach((e=>{[...fe].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key,r=t.origin.overlapKey;if(e){const s={left:t.left,top:t.top,...i,hoverCursor:"default"};let a=r||"koumai";"yemai"===e&&(a=e);const u=r||e;l.push(n(a,{...o[u],...s}))}}}))})),setTimeout((()=>{M.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),he.add(e)}))}))}()}return function(){const t=new e.Rect({left:le,top:0,width:re-le-se.strokeWidth,height:ne-se.strokeWidth,fill:"transparent",...se});M.value.add(t)}(),Ye((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const i=P(e.type,e.positionLine.value),n=t([q,i,G,i],e.positionLine);M.value.add(n)}(e))),M.value.on("mouse:up",(e=>{var t;const{button:i,target:n,pointer:o={}}=e;if(3===i){if(!C.event.evented)return;const{x:e=0,y:i=0}=o;if(e>=q&&e<=G&&i>=N&&i<=J){X.point={x:e,y:i},X.show=!0;const{type:l}=(null==n?void 0:n.origin)||{};if(n&&["temperature","pain"].includes(l))"temperature"===l&&(X.list=[...k]),"pain"===l&&(X.list=[...S]),X.target=n;else{X.target=null,X.list=[(null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.219"))||"新增节点"],Q.forEach((t=>{if(!H([...he],e,"_type").includes(t.bigType)){const e=["pain"].includes(t.bigType)?ee:Z;i>=e.originY&&i<=e.endY&&X.list.push({renderItem:R?R(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:a(t.bigType),dataIndex:t.dataIndex,key:t.key,isOneLine:t.isOneLine},pointer:o})}}));const n=Le(e);n&&1!==X.list.length||(X.show=!1,1===X.list.length&&n&&B("repeat"))}}}if(1===i){if(n)return;const{x:e=0,y:t=0}=o;e>=q&&e<=G&&t>0&&t<ne&&T("click:grid",{x:e,y:t,time:V(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,isOneLine:o,dataIndex:l,index:r}=t.origin,a=g(i,[...k,...S]);a[`${e.type}`]=e.value,a.changeTime=s(new Date,"yyyy-MM-dd HH:mm"),o&&(a.key=t.origin.key);const u={...t.origin,data:a};T("change",u),ke(u,"change")}else{const t={data:{time:V(e.pointer.x),value:A(e.origin.type,e.pointer.y),...e.origin.isOneLine?{key:e.origin.key}:{}},...e.origin};T("add",t),ke(t)}},setPopup:xe,isAddPoint:Le,updateData:ke,redrawPoints:Se,gridPoints:he,fixedNoRisePoints:ge}}function O(e,t){return e.fixed||!t.value&&0!==t.value}export{M as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,defaultStyle as i,drawPoint as n,drawText as o,drawArrow as l}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{format as s}from"date-fns";import{getType as a,getTime as u,isOneLine as d,isOverlapPoint as c,getFloorNumber as p,isValidValue as f,setOtherType as h,isEffectiveNode as v,deleteProperty as g,getIndex as y}from"../../utils/index.js";import{cloneDeep as m,omit as w,flatten as x,last as b}from"lodash-es";import"../useEvent.js";import{useShadow as j}from"../useShadow.js";import{useCommon as L}from"../useCommon.js";import"vue";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import{TEMPERATURE_MENU as k,PAIN_MENU as S,OVERLAP as Y}from"../../constants/index.js";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";import{promiseTimeout as E}from"@vueuse/shared";function M(M,C,T,$,P,V,A,R,I,X){r(M,{...C,isTemperature:!0});const{getEqualXTypes:H,handleAddPrevent:B,getPointEventProps:D}=L(M,T,C),{createShadowLines:W}=j(),{left:z,xScaleList:F,xCellWidth:_,yCellHeight:K,originX:q,endX:G,originY:N,endY:J,itemList:Q,event:U,vitalSignsOriginY:Z,painOriginY:ee,hospitalizationDate:te,config:ie,canvasHeight:ne,painSurplusCell:oe,iconsWidth:le,canvasWidth:re,borderStyle:se,painScalePositionSurplusHeight:ae,painBorderColor:ue,painHeight:de}=C,ce=new Set,pe=["xinmai","mai"],fe=new Map,he=new Set,ve=new Set,ge=new Set,ye=m(z.yScaleValue),me=new Set;function we(n){var o;const l=ye.find((e=>e.show&&"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(ce.size&&M.value.remove(...ce),ce.clear(),fe.size>1)){if(n){const{type:e,key:t}=n.origin||{};if("pulse"===e){const e=fe.get(t),i=null==e?void 0:e.findIndex((e=>e[0]===n.left));e.splice(i,1,[n.left,n.top])}}const o=function(){const e=[],t=[],i=[];for(const e of fe)t.push(e[1]),e[0]===pe[0]&&e[1].forEach((e=>{(fe.get(pe[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],d=n[i-1],c=n[i+1],p=o[s-1],f=o[s+1];if(d&&p){if(d[0]!==p[0]){const e=Math.max(d[0],p[0]);l.push([d,p].find((t=>t[0]===e)))}}else d?l.push(d):p&&r.push(p);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=b(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],r=[]};if(c&&f){if(c[0]!==f[0]){const e=Math.min(c[0],f[0]);l.push([c,f].find((t=>t[0]===e))),g()}}else c?(l.push(c),g()):f?(r.push(f),g()):g()})),e}();o.length>0&&function(e){E(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(ge).forEach((n=>{var o,l;"pulse"===(null==(o=null==n?void 0:n.origin)?void 0:o.type)&&e.find((e=>Math.abs(n.left-e[0])<=1&&Math.abs(n.top-e[1])<=1))&&((null==(l=null==n?void 0:n.origin)?void 0:l.key)===pe[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{0==t?e.rightLine&&M.value.remove(e.rightLine):e.leftLine&&M.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:r,style:s={}}=l.shadow||{};o.forEach((n=>{const o=n.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...i,...s,strokeWidth:1});if(["slash","line"].includes(r)){l.set({fill:"transparent",stroke:s.stroke||"#f00"});const e=[];if(["slash"].includes(r))e.push(...W(n,s._angle,s.space,w(s,["_angle","space"]))),e.forEach((e=>{ce.add(e)}));else{const i=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}(n);i.forEach((i=>{const n=t([...x(i)],{...s,originX:"center"});e.push(n),ce.add(n)}))}M.value.add(...e)}ce.add(l),M.value.add(l)}))}}function xe(e,r,s){var a;const{type:u,riseStyle:c={},noRiseStyle:v={},verifiedStyle:g={},reduceStyle:y={},pacemaker:w={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:L={},respiratorStyle:k={},dataList:S=[],list:Y=[]}=s,{type:E,textStyle:C}=j,V=[],R=[],X=[];let H=null;const B=e=>"breathe"==u&&e.respirator&&k.type&&k.fixedValue&&!e.value&&Le(e.time),W=d(s);if(null==(a=e.list)||a.forEach(((a,d)=>{var j,z,F,q;const G=W?S.find((e=>e.key===a.key)):e,N=ke(B(a)?{...a,value:k.fixedValue}:a,s),J=e.list[d+1],Q=J?ke(B(J)?{...J,value:k.fixedValue}:J,s):void 0,te=J?W?S.find((e=>e.key===J.key)):e:{},{title:le=""}=G;if(le===((null==(j=window.getLanguageByCode)?void 0:j.call(window,"10010.1.235"))||"脉搏")&&te.title!==((null==(z=window.getLanguageByCode)?void 0:z.call(window,"10010.1.235"))||"脉搏")||le!==((null==(F=window.getLanguageByCode)?void 0:F.call(window,"10010.1.235"))||"脉搏")&&te.title===((null==(q=window.getLanguageByCode)?void 0:q.call(window,"10010.1.235"))||"脉搏")||!N||!Q||p(N[0],1)!==p(Q[0],1))N&&H&&(N[0]=H),H=null;else{const e=N[0]-_/2;N[0]=e+_/4,Q[0]=H=N[0]+_/2}const re={};re.value=function(e,t,i){if(!(null==e?void 0:e.length)||!ie.showValue)return;const{lineAttr:n={}}=i,l=e[1]<=Z.originY+K?e[1]+K:e[1]-K,r=o([e[0],l],{value:B(t)?k.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(r),{obj:r,top:-K}}(N,a,G),function(e,r,s,a){var d,p,h;if(!["temperature","pain","breathe"].includes(u))return;if(!(null==e?void 0:e.length)&&"temperature"===u&&!Le(r.time))return;if(!(null==e?void 0:e.length)&&"pain"===u)return;if(!r.value&&"breathe"===u)return;const{lineAttr:m={},key:w}=s,{value:x}=a,b=$(r.time);let j,L,S,Y,E,M;if(r.noRise&&v.show){const t=O(v,r)?P(u,35):(null==e?void 0:e[1])||0;if(v.text)S=o([b,O(v,r)?t:t+5],{value:v.text.split("").join("\n"),originY:"top",...v.style}),r.value||ge.add(S);else if(r.value){S=l([b,t,t+2*K],{...v.style})}S&&X.push(S),S&&O(v,r)&&me.add(S)}if(null==e?void 0:e[1]){if(r.rise&&c.show&&c.text&&(Y=o([b,e[1]-(x?K:0)-5],{value:c.text.split("").join("\n"),originY:"bottom",...c.style}),X.push(Y)),r.verified){const t=(null==(d=null==g?void 0:g.position)?void 0:d[w])||"top";E=o(["top-right"===t?b+_/2:b,e[1]-(x?K:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(E)}if(f(r.physicsReduce)||f(r.drugReduce)){const o=P(u,null!=(p=r.physicsReduce)?p:r.drugReduce),l=o<e[1]&&(null==ie?void 0:ie.hypothermyViewCustom)?b+_/2:b;j=t([...e,l,o],{...m,...y.line,...i}),L=n((null==(h=null==y?void 0:y.point)?void 0:h.type)||"circle",{left:l,top:o,...y.point,...i,originY:o===ne?"bottom":"center"}),j&&X.push(j),L&&X.push(L)}r.respirator&&(M=n(k.type,{left:b,top:e[1]-(x?K:0)-5,originX:"center",originY:"bottom",...k.style}),X.push(M))}Object.assign(a,{reduceLine:{obj:j,type:"line"},noRiseText:{obj:S,top:v.text?5:2*K,isFixed:O(v,r)},riseText:{obj:Y,top:(x?-K:0)-5},verifiedText:{obj:E,left:_/2,top:(x?-K:0)-5},reducePoint:{obj:L,type:"reduce"},respirator:{obj:M,top:(x?-K:0)-5}})}(N,a,G,re),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(u))return;const r=Math.max(...Y),s=Math.min(...Y);let a,d,c;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*K,i=[e[1]-K/2,t];t<Z.originY&&(t=e[1]+2.5*K,i=[t,e[1]+K/2]),a=l([e[0],i[0],i[1]],x,"up"),X.push(a)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>r){const t=a?e[1]+K/2+a.height:e[1]+K;d=o([e[0],t],i),X.push(d)}+t.value<s&&(d=o([e[0],e[1]-K],i),X.push(d))}if(L.show&&+t.value<s){const t=e[1];if(L.text)c=o([e[0],e[1]+5],{value:L.text.split("").join("\n"),originY:"top",...L.style});else{const i=t+2*K;c=l([e[0],t,i],{...L.style})}X.push(c)}Object.assign(n,{upArrow:{obj:a},limitValue:{obj:d,top:-K},belowMinValue:{obj:c,top:L.text?5:2*K,moveHide:!0}})}(N,a,G,re),function(i,o,l,a,d,c){let p,f;const{pointAttr:g={},lineAttr:y={},title:x="",key:b,type:j="circle",overlapKey:L}=d,S=g.height?g.height/2:5,Y=e.list[a+1];let O=m(i),H=m(o);const z=be(u,e.list[a].value),F=()=>"pulse"==u&&l.pacemakerShow?w.value:B(l)?k.type:z&&"number"===E?0:j,_=e=>e&&v.show&&v.fixed&&Le(e.time)&&e.noRise&&!e.value&&0!==e.value;if((()=>{if(l.breakpoint)return!1;if("temperature"===u&&(i||_(l))&&(o||_(Y))){const e=P(u,35);return i||(O=[$(l.time),e]),o||(H=[$(Y.time),e]),!0}return!!i&&!!o})()){O&&H&&z&&be(u,Y.value)&&!oe[1]&&!ae&&"icon"===E&&(O[1]=O[1]-S,H[1]=H[1]-S),f=t([...O,...H],{...y});const{obj:e}=(null==c?void 0:c.reducePoint)||{};if(i&&o&&(null==e?void 0:e.top)<i[1]&&(null==ie?void 0:ie.hypothermyViewCustom)){const i=t([e.left,e.top,...o],{...y});X.unshift(i),Object.assign(c,{reduceRightLine:{obj:i,type:"reduce"}}),f.set("stroke","transparent")}}const K=F(),q=R[a-1],G={origin:{data:B(l)?{...l,value:k.fixedValue}:l,title:x,key:b||"",overlapKey:L,unit:s.unit,type:u,_type:h(x,u),dataIndex:r,index:a,isOneLine:W},leftLine:q,rightLine:f,otherObj:c,...l.pacemakerShow&&"pulse"==u?w.style:B(l)?k.style:g,...D(),lockMovementX:!0,...z?{selectable:!1,evented:!1,..."number"===E?C:{}}:{}};i&&(q?G.leftLine.set("x2",i[0]):G.leftLine=null,p=n(K,{left:i[0],top:!z||oe[1]||ae?i[1]:i[1]-S,...G}));R.push(f),p&&(b===pe[1]?he.add(p):B(l)||ve.add(p),function(e){U.hovered&&(e.on("mouseover",(()=>{je(e,"hover")})),e.on("mouseout",(()=>{I.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?ee:Z;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,moveHide:r=!1,left:s=0}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left+s,top:e.top+o}),r&&(M.value.remove(i),delete e.otherObj.obj)))})),we(e)}(e),U.hovered&&je(e)})),e.on("mouseup",(t=>{if(I.show=!1,1===t.button){const{type:t}=e.origin,i=A(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};M.value.discardActiveObject(),T("change",n),Ye(n,"change")}}))}(p),V.push(p),ge.add(p))}(N,Q,a,d,G,re)})),"pulse"===u){let t=null;const i=e=>e.map(((e,i,n)=>{var o,l;const r=n[i+1];if(r&&p(e.left,1)===p(r.left,1)){const i=e.left-_/2;e.set("left",i+_/4),null==(o=e.rightLine)||o.set("x1",e.left),t=e.left+_/2,r.set("left",t)}else t&&(null==(l=e.leftLine)||l.set("x2",t),e.set("left",t)),t=null;return[e.left,e.top]}));if(W){const e={};pe.forEach((t=>{e[t]=V.filter((e=>{var i;return(null==(i=e.origin)?void 0:i.key)===t})),fe.set(t,i(e[t]))}))}else{const{key:t}=e;fe.set(t,i(V))}}const z=R.filter((e=>e));M.value.add(...z,...V,...X)}function be(e,t){return"pain"===e&&0==t}function je(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;I.point={x:e.left,y:e.top};let r=`时间 ${((null==l?void 0:l.time)||V(e.left)).slice(-5)}`;I.list=[function(){const{drugReduce:s,physicsReduce:a}=l||{},u="hover"===t?l.value:A(o,e.top);if(f(s))return r+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${u}—>${s}${n||""}`;if(f(a))return r+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${u}—>${a}${n||""}`;return`${i} ${u}${n||""}`}(),r],I.show=!0}function Le(e){const[t]=F,i=b(F),n=t.start,o=i.end,l=u(e);return l>=n&&l<=o}function ke(e,t){const i="pain"===t.type?ee:Z;if(!v(e)||!Le(e.time))return;const n=$(e.time),o=P(t.type,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function Se(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=u(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=u(`${V(e)}:00`);return te&&l<u(te)?(B("exceedMin"),!1):!(l>o)||(B("exceedMax"),!1)}function Ye(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:r}=e,s=ye.find((e=>e.type===i));if("add"===t){const e=d(s)?s.dataList.find((e=>e.enable)):s.dataList[n],t=y(l.time,e.list);e.list.splice(t,0,l)}else s.dataList[n].list[o]=l;Ee()}function Ee(){var e;ge.size&&(null==(e=M.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}([...ge]))),ge.clear(),Me()}function Me(e){fe.clear(),ge.clear(),he.clear(),me.clear(),ve.clear(),ye.forEach((t=>{t.show&&(null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||d(t)&&!e.enable||xe(e,i,t)})))})),we(),[...ge].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=ye.find((e=>e.show&&"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>{var t;return e.title.includes((null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.235"))||"脉搏")})))return;const o=Object.assign({},Y,z.overlap||{}),l=[];he.size&&[...he].forEach((e=>{[...ve].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key,r=t.origin.overlapKey;if(e){const s={left:t.left,top:t.top,...i,hoverCursor:"default"};let a=r||"koumai";"yemai"===e&&(a=e);const u=r||e;l.push(n(a,{...o[u],...s}))}}}))})),setTimeout((()=>{M.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ge.add(e)}))}))}()}return function(){const i=[];if(i.push(new e.Rect({left:le,top:0,width:re-le-se.strokeWidth,height:ne-se.strokeWidth,fill:"transparent",...se})),ue){const e=ee.originY-oe[0]*K,n=e+de+(oe[0]+oe[1])*K-1,o={...se,stroke:ue},l=t([le,e,G,e],o),r=t([le,n,G,n],o);i.push(l,r)}M.value.add(...i)}(),Me((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const i=P(e.type,e.positionLine.value),n=t([q,i,G,i],e.positionLine);M.value.add(n)}(e))),M.value.on("mouse:up",(e=>{var t;const{button:i,target:n,pointer:o={}}=e;if(3===i){if(!C.event.evented)return;const{x:e=0,y:i=0}=o;if(e>=q&&e<=G&&i>=N&&i<=J){X.point={x:e,y:i},X.show=!0;const{type:l}=(null==n?void 0:n.origin)||{};if(n&&["temperature","pain"].includes(l))"temperature"===l&&(X.list=[...k]),"pain"===l&&(X.list=[...S]),X.target=n;else{X.target=null,X.list=[(null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.219"))||"新增节点"],Q.forEach((t=>{if(!H([...ge],e,"_type").includes(t.bigType)){const e=["pain"].includes(t.bigType)?ee:Z;i>=e.originY&&i<=e.endY&&X.list.push({renderItem:R?R(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:a(t.bigType),dataIndex:t.dataIndex,key:t.key,isOneLine:t.isOneLine},pointer:o})}}));const n=Se(e);n&&1!==X.list.length||(X.show=!1,1===X.list.length&&n&&B("repeat"))}}}if(1===i){if(n)return;const{x:e=0,y:t=0}=o;e>=q&&e<=G&&t>0&&t<ne&&T("click:grid",{x:e,y:t,time:V(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,isOneLine:o,dataIndex:l,index:r}=t.origin,a=g(i,[...k,...S]);a[`${e.type}`]=e.value,a.changeTime=s(new Date,"yyyy-MM-dd HH:mm"),o&&(a.key=t.origin.key);const u={...t.origin,data:a};T("change",u),Ye(u,"change")}else{const t={data:{time:V(e.pointer.x),value:A(e.origin.type,e.pointer.y),...e.origin.isOneLine?{key:e.origin.key}:{}},...e.origin};T("add",t),Ye(t)}},setPopup:je,isAddPoint:Se,updateData:Ye,redrawPoints:Ee,gridPoints:ge,fixedNoRisePoints:me}}function O(e,t){return e.fixed||!t.value&&0!==t.value}export{M as useCenter};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as s}from"../../utils/index.js";import{last as r}from"lodash-es";import"../useEvent.js";import"../useShadow.js";import{getScaleInfo as u,drawScaleNumber as a,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";function p(p,d,g,f,m,v,y,w,S,b,Y,x){var j,C;const{getEqualXTypes:L,handleAddPrevent:X,isGridLimit:T}=c(p,g,d),{originY:N,endY:O,originX:V,endX:k,xCellWidth:E,yCellHeight:M,left:A,vitalSignsOriginY:G,painOriginY:I,painHeight:W,iconsWidth:H,itemList:R,painIndex:_,right:B,canvasWidth:J,canvasHeight:$,getRightInfo:q,borderStyle:D,surplusCell:P,painSurplusCell:z}=d;function F(o){var s;if(!(null==o?void 0:o.length))return;const{layout:c}=o[0];let d=H,g=V;"right"===c&&(d=k,g=k+(null!=(s=null==B?void 0:B.width)?s:0));const f=[],m=W&&"right"!==c?o.length-1:o.length,v=(g-d)/m,y=v+(g-d)%m;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:d,style:g,title:f}=n,m=I.originY-z[0]*M,v=l({width:V-H,height:W+(z[0]+z[1])*M,...D},{value:`${f}`,...i,...g||{}},{left:H,top:m}),y=t([H,m,V,m],D),w=[];if(r||h){const{lineXMain:t,textLeft:i}=u(c,H,V-H),l=o.length;o.forEach(((o,u)=>{let c=I.endY-u*M*s;if(0===u&&0===z[1]&&(c=O-5),h&&(!(0===u||u===l-1)||d||0===u&&z[1]>0||u===l-1&&z[0]>0)&&w.push(a(o,n,i,c)),r&&(0!==u||z[1]>0)){const[i,n]=t,o=new e.Line([i,c,n,c],{...D,...g});w.push(o)}}))}p.value.add(y,v,...w),v.sendToBack()}(o);const g=[],m=0===s?y:v,w=0===s?d:y+d+(s-1)*v,S="right"===c?0:G.originY,b="right"===c?$:G.endY,Y=s>0?t([w,S,w,b],{objectCaching:!1,...D}):null;Y&&g.push(Y);const x=w+m/2,{list:j=[],spaceGridNumber:C=5,showScale:L,showNumber:X,position:T,showMaxMinNumber:k,detailedList:E=[],showdetailedScale:A,showRange:R=[]}=o;if(L||X){const{lineXMain:e,lineXSub:t,textLeft:i}=u(T,w,m),n=(j[1]-j[0])/2,l=A&&!E.length?j.reduce(((e,t,i)=>{const o=e[e.length-1];return 0===i?[t]:e.concat([o+n,o+2*n])}),[]):A&&(null==E?void 0:E.length)?E:j,[s=l[0],c=r(l)]=R;l.forEach(((n,r)=>{if(s&&+n<+s)return;if(c&&+n>+c)return;const u=G.endY-r*M*(A?C/2:C),p=[s,c].includes(n);if(X&&(!p||k)){const e=0==r?u-5:u,t=a(n,o,i,e),l=G.originY+t.height/2;e<l&&t.set({top:l}),g.push(t)}g.push(...h(o,r,e,t,u,M,G.originY,l.findIndex((e=>e==c))+1))}))}let B=o.title||"";o.unit&&(B+="\n"+o.unit);let J=G.originY+2;0!==_&&P[0]>0&&(J=N+2),B&&g.push(new e.Text(String(B),{...i,originY:"top",left:x,top:J,textAlign:"center",...o.style}));const q=new e.Group(g,{...n,objectCaching:!1});f.push(q)}));const w=f.length>0?new e.Group([...f],{...n,objectCaching:!1}):null;w&&p.value.add(w),w&&w.sendToBack()}H&&function(){const e=JSON.parse(JSON.stringify(R));let t=O;const i=H-A.icons.marginRight;e.reverse().forEach((e=>{t-=10;let n=e.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:r}=o(n,e,{text:{left:i-(e.pointAttr.width||10)-5,top:t,originX:"right"},icon:{originX:"right",left:i,topY:t,origin:{key:e.key,type:s(e.bigType),_type:e.bigType,isOneLine:e.isOneLine},...d.event}});var u;t-=l.height||30,(u=r).on("moving",(()=>{u.set("originX","center"),function(e){if(e.left>=V&&e.left<=k){e.setCoords();const t="pain"===e.origin.type?I:G;e.top<t.originY&&e.set("top",t.originY),e.top>t.endY&&e.set("top",t.endY)}}(u),T(u)?f(u):m.show=!1})),u.on("mouseup:before",(e=>{if(m.show=!1,0===e.e.button&&T(u)){const e=L([...x],u.left,"_type").includes(u.origin._type),t=b(u.left);if(!t||e)e&&t&&X("repeat");else{const e={data:{time:w(u.left),value:S(u.origin.type,u.top),...u.origin.isOneLine?{key:u.origin.key}:{}},...u.origin};g("add",e),Y(e)}}!function(e){e.setCoords().set({originX:"right",left:e.originLeft,top:e.originTop})}(u)})),p.value.add(l,r)}))}();const K=A.yScaleValue.filter((e=>"left"===e.layout&&"pain"!==e.type&&e.show));if((null==B?void 0:B.width)&&"left"===(null==(j=null==B?void 0:B.yScaleValue)?void 0:j.layout)&&(null==(C=null==B?void 0:B.yScaleValue)?void 0:C.show)&&K.push(q),_>0&&A.yScaleValue[_].show){const e=A.yScaleValue[_];0===_&&A.yScaleValue.length>1&&K.unshift(e),_==A.yScaleValue.length-1&&K.push(e)}const Q=K.findIndex((e=>"pulse"===e.type&&e.show&&e.doubleShow)),U=K[Q];return Q>-1&&K.splice(Q,0,{...U,title:(null==U?void 0:U.doubleTitle)||(null==U?void 0:U.title)}),F(K),{drawScaleValue:F}}export{p as useLeft};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as s}from"../useDraw.js";import"date-fns";import{getType as l}from"../../utils/index.js";import{last as r}from"lodash-es";import"../useEvent.js";import"../useShadow.js";import{getScaleInfo as u,drawScaleNumber as a,drawScaleLine as c}from"../useScaleColumn.js";import{useCommon as h}from"../useCommon.js";import"vue";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";function p(p,d,g,f,m,y,v,w,S,b,x,Y){var j,C;const{getEqualXTypes:T,handleAddPrevent:L,isGridLimit:X}=h(p,g,d),{originY:N,endY:O,originX:V,endX:k,xCellWidth:E,yCellHeight:M,left:A,vitalSignsOriginY:B,painOriginY:G,painHeight:I,iconsWidth:H,itemList:R,painIndex:W,right:_,grid:J,canvasHeight:$,getRightInfo:q,borderStyle:D,surplusCell:P,painSurplusCell:z,painBorderColor:F,config:K}=d;function Q(o){var l;if(!(null==o?void 0:o.length))return;const{layout:h}=o[0];let d=H,g=V;"right"===h&&(d=k,g=k+(null!=(l=null==_?void 0:_.width)?l:0));const f=[],m=I&&"right"!==h?o.length-1:o.length,y=(g-d)/m,v=y+(g-d)%m,w=J.surplusCell||[0,0,0,0],S=B.originY-w[0]*M;o.forEach(((o,l)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:l=5,showScale:r,showNumber:c,position:h,showMaxMinNumber:d,style:g,title:f}=n,m=[],y=G.originY-z[0]*M,v=s({width:V-H,height:I+(z[0]+z[1])*M,...D},{value:`${f}`,...i,...g||{}},{left:H,top:y});m.push(v);const w=F?null:t([H,y,V,y],D);w&&m.push(w);const S=[];if(r||c){const{lineXMain:t,textLeft:i}=u(h,H,V-H),s=o.length;o.forEach(((o,u)=>{let h=G.endY-u*M*l;if(0===u&&0===z[1]&&(h=O-5),c&&(!(0===u||u===s-1)||d||0===u&&z[1]>0||u===s-1&&z[0]>0)&&S.push(a(o,n,i,h)),r&&(0!==u||z[1]>0)){const[i,n]=t,o=new e.Line([i,h,n,h],{...D,...g});S.push(o)}}))}p.value.add(...m,...S),v.sendToBack()}(o);const g=[],m=0===l?v:y,w=0===l?d:v+d+(l-1)*y;let b=0;"right"!==h&&(b=S,K.scaleTitleBorder&&(b+=M));const x="right"===h?$:B.endY,Y=l>0?t([w,b,w,x],{objectCaching:!1,...D}):null;Y&&g.push(Y);const j=w+m/2,{list:C=[],spaceGridNumber:T=5,showScale:L,showNumber:X,position:N,showMaxMinNumber:k,detailedList:E=[],showdetailedScale:A,showRange:R=[]}=o;if(L||X){const{lineXMain:e,lineXSub:t,textLeft:i}=u(N,w,m),n=(C[1]-C[0])/2,s=A&&!E.length?C.reduce(((e,t,i)=>{const o=e[e.length-1];return 0===i?[t]:e.concat([o+n,o+2*n])}),[]):A&&(null==E?void 0:E.length)?E:C,[l=s[0],h=r(s)]=R;s.forEach(((n,r)=>{if(l&&+n<+l)return;if(h&&+n>+h)return;const u=B.endY-r*M*(A?T/2:T),p=[l,h].includes(n);if(X&&(!p||k)){const e=0==r?u-5:u,t=a(n,o,i,e),s=B.originY+t.height/2;e<s&&t.set({top:s}),g.push(t)}g.push(...c(o,r,e,t,u,M,B.originY,s.findIndex((e=>e==h))+1))}))}let W=o.title||"";o.unit&&(W+="\n"+o.unit);const _=S+2;if(W){const n=new e.Text(String(W),{...i,originY:"top",left:j,top:_,textAlign:"center",...o.style});if(K.scaleTitleBorder){n.setCoords().set({top:M>12?S+1:S});const e=t([w,S+M,w+m,S+M],{objectCaching:!1,...D});g.push(e)}g.push(n)}const J=new e.Group(g,{...n,objectCaching:!1});f.push(J)}));const b=f.length>0?new e.Group([...f],{...n,objectCaching:!1}):null;b&&p.value.add(b),b&&b.sendToBack()}H&&function(){const e=JSON.parse(JSON.stringify(R));let t=O;const i=H-A.icons.marginRight;e.reverse().forEach((e=>{t-=10;let n=e.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:s,icon:r}=o(n,e,{text:{left:i-(e.pointAttr.width||10)-5,top:t,originX:"right"},icon:{originX:"right",left:i,topY:t,origin:{key:e.key,type:l(e.bigType),_type:e.bigType,isOneLine:e.isOneLine},...d.event}});var u;t-=s.height||30,(u=r).on("moving",(()=>{u.set("originX","center"),function(e){if(e.left>=V&&e.left<=k){e.setCoords();const t="pain"===e.origin.type?G:B;e.top<t.originY&&e.set("top",t.originY),e.top>t.endY&&e.set("top",t.endY)}}(u),X(u)?f(u):m.show=!1})),u.on("mouseup:before",(e=>{if(m.show=!1,0===e.e.button&&X(u)){const e=T([...Y],u.left,"_type").includes(u.origin._type),t=b(u.left);if(!t||e)e&&t&&L("repeat");else{const e={data:{time:w(u.left),value:S(u.origin.type,u.top),...u.origin.isOneLine?{key:u.origin.key}:{}},...u.origin};g("add",e),x(e)}}!function(e){e.setCoords().set({originX:"right",left:e.originLeft,top:e.originTop})}(u)})),p.value.add(s,r)}))}();const U=A.yScaleValue.filter((e=>"left"===e.layout&&"pain"!==e.type&&e.show));if((null==_?void 0:_.width)&&"left"===(null==(j=null==_?void 0:_.yScaleValue)?void 0:j.layout)&&(null==(C=null==_?void 0:_.yScaleValue)?void 0:C.show)&&U.push(q),W>0&&A.yScaleValue[W].show){const e=A.yScaleValue[W];0===W&&A.yScaleValue.length>1&&U.unshift(e),W==A.yScaleValue.length-1&&U.push(e)}const Z=U.findIndex((e=>"pulse"===e.type&&e.show&&e.doubleShow)),ee=U[Z];return Z>-1&&U.splice(Z,0,{...ee,title:(null==ee?void 0:ee.doubleTitle)||(null==ee?void 0:ee.title)}),Q(U),{drawScaleValue:Q}}export{p as useLeft};
@@ -1 +1 @@
1
- import{reactive as e,computed as a,watch as t,toRefs as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as i}from"../useCumputedPoint.js";import{useCanvasEvent as n}from"../useEvent.js";import"../useShadow.js";import"../useCommon.js";import{setOtherType as r,isOneLine as o,getFloorNumber as s}from"../../utils/index.js";import{flatten as v}from"lodash-es";import{format as d,addDays as c}from"date-fns";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../../constants/index.js";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";import{useTop as h}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useRight as g}from"./useRight.js";import{useCenter as m}from"./useCenter.js";import{useBottom as f}from"./useBottom.js";import{useOther as y}from"./useOther.js";function S(S,w,b,Y,j,x){const C=15,D=e({select:null,redrawPoints:null,clickMenu:null}),V=a((()=>{const{painSurplusCell:e=[0,0]}=w.data.grid||{};return~Q.value?e:[0,0]})),H=a((()=>{var e,a;const t=(null==(a=null==(e=w.data.grid)?void 0:e.surplusCell)?void 0:a.slice())||[0,0,0,0];return 0===Q.value?t[0]=t[0]+V.value[1]:Q.value>0&&(t[2]=t[2]+V.value[0]),t})),P=a((()=>0===Q.value?[V.value[0],H.value[1],H.value[2],H.value[3]]:Q.value>0?[H.value[0],H.value[1],V.value[1],H.value[3]]:H.value)),X=a((()=>{const{top:e}=w.data;return e.date.show&&(e.date.height||C)||0})),L=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.hospitalDays)?void 0:e.show)&&(a.hospitalDays.height||C)||0})),M=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.operationDays)?void 0:e.show)&&(a.operationDays.height||C)||0})),I=a((()=>{var e,a,t;const{top:l}=w.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||C)||0)+((null==(a=l.xScalevalue)?void 0:a.show)&&null!=(t=l.dayHeight)?t:0)})),O=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.childbirthDays)?void 0:e.show)&&(a.childbirthDays.height||C)||0})),N=a((()=>{var e;const{bottom:a}=w.data;return(null==(e=null==a?void 0:a.breathing)?void 0:e.show)&&(a.breathing.height||30)||0})),k=a((()=>{const{grid:e}=w.data;return e.mainXCell*e.subXCell+H.value[1]+H.value[3]})),R=a((()=>{const{mainYCell:e,subYCell:a,painSubYCell:t=5}=w.data.grid,l=Q.value>0?V.value[1]:V.value[0];return(e-1)*a+t+H.value[0]+H.value[2]+l})),W=a((()=>{var e;const{width:a,right:t=null,top:l}=w.data;if(!t)return a;return a-(null!=(e=t.width)?e:0)})),$=a((()=>W.value-H.value[1]*z.value)),A=a((()=>{const{top:e,left:a}=w.data;return e.titleWidth+B.value})),T=a((()=>{const{bottom:e=null,height:a}=w.data;if(!e)return a;return a-(e.height||30)})),q=a((()=>{var e;const{top:a}=w.data,t=a.xScalevalue.show&&(null!=(e=a.dayHeight)?e:0)||0,l=a.xScalevalue.show&&(a.xScalevalue.height||C)||0;return X.value+t+l+L.value+M.value+O.value})),z=a((()=>(W.value-A.value)/k.value)),G=a((()=>(T.value-q.value)/R.value)),B=a((()=>{var e,a;const{left:t}=w.data;return(null==(e=t.icons)?void 0:e.show)&&((null==(a=t.icons)?void 0:a.width)||100)||0})),E=a((()=>{var e,a;const{top:t,grid:l}=w.data,u=(null==(a=null==(e=t.date.list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],i=t.xScalevalue.times;let n=A.value-z.value;const r=t.date.startDate||d(new Date,"yyyy-MM-dd"),o=u.reduce(((e,a,t)=>0===t?e.concat(r):e.concat(d(c(new Date(r.replace(/-/g,"/")),t),"yyyy-MM-dd"))),[]).map((e=>i.map((a=>{n+=z.value;const t=Date.parse(`${e} ${a.start}`),l=Date.parse(`${e} ${a.end}`);return{start:t,end:l,left:n,center:n+z.value/2,scaleCell:(l-t)/z.value}}))));return v(o)})),F=a((()=>{var e;return(null==(e=w.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),J=a((()=>{const{left:e}=w.data;return v(e.yScaleValue.filter((e=>e.show)).map((e=>e.dataList.filter((e=>e.show)).map(((a,t)=>({...a,bigType:r(a.title,e.type),unit:e.unit,dataIndex:t,isOneLine:o(e)}))))))})),K=a((()=>{const{left:e}=w.data,a=e.yScaleValue.find((e=>"pain"===e.type));if(!a)return 0;const{numberVerticalPosition:t="bottom"}=a;return"center"===t?G.value/2:0})),Q=a((()=>{const{left:e}=w.data,a=e.yScaleValue.findIndex((e=>"pain"===e.type));return a>-1&&e.yScaleValue[a].show?a:-1})),U=a((()=>{const{painSubYCell:e=5}=w.data.grid;return-1===Q.value?0:G.value*e})),Z=a((()=>{const{left:e}=w.data,a={originY:q.value+V.value[0]*G.value,endY:T.value-V.value[1]*G.value-K.value};return 0===Q.value&&e.yScaleValue.length>1?a.endY=a.originY+U.value-K.value:Q.value===e.yScaleValue.length-1&&(a.originY=a.endY-U.value+K.value),a})),_=a((()=>{const{left:e}=w.data,a={originY:q.value+H.value[0]*G.value,endY:T.value-H.value[2]*G.value};return 0===Q.value&&e.yScaleValue.length>1?a.originY=Z.value.endY+K.value+H.value[0]*G.value:Q.value===e.yScaleValue.length-1&&(a.endY=Z.value.originY-H.value[2]*G.value),a})),ee=a((()=>{var e,a;const{top:t,grid:l}=w.data,u=[];for(const i in t)t[i].show&&u.push({...t[i],list:(null==(a=null==(e=t[i].list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,a)=>e.seq-a.seq))})),ae=a((()=>{var e;const{left:a,right:t}=w.data,l=a.yScaleValue.find((e=>"temperature"===e.type)),u=(null==t?void 0:t.yScaleValue)||{};if(null==(e=null==l?void 0:l.list)?void 0:e.length){const e=(null==u?void 0:u.showdetailedScale)?l.list.reduce((e=>{const a=e[e.length-1];return a?e.concat([a+1,a+2]):e.concat([92])}),[]):[],a=l.list.map((e=>s(1.8*e+32)));Object.assign(u,{list:a,detailedList:e,spaceGridNumber:l.spaceGridNumber})}return u})),te=e({canvasWidth:w.data.width,canvasHeight:w.data.height,borderStyle:{...u,...w.data.borderStyle||{}},selectionStyle:w.data.selectionStyle||{},dateHeight:X.value,hospitalDaysHeight:L.value,operationDaysHeight:M.value,xScalevalueHeight:I.value,childbirthDaysHeight:O.value,topList:ee.value,breathingHeight:N.value,hospitalizationDate:w.data.hospitalizationDate,grid:w.data.grid,top:w.data.top,left:w.data.left,right:w.data.right,bottom:w.data.bottom,other:w.data.other,painIndex:Q.value,painHeight:U.value,painOriginY:Z.value,vitalSignsOriginY:_.value,gridXNumber:k.value,gridYNumber:R.value,iconsWidth:B.value,originX:A.value,originY:q.value,endX:W.value,endXLimit:$.value,endY:T.value,xCellWidth:z.value,yCellHeight:G.value,xScaleList:E.value,event:F.value,itemList:J.value,getRightInfo:ae.value,config:w.data.config||{},surplusCell:H.value,painSurplusCell:V.value,mainSurplusCell:P.value,painScalePositionSurplusHeight:K.value}),{computedX:le,computedY:ue,getXValue:ie,getYValue:ne}=i(te);return t((()=>S.value),(e=>{e&&function(){h(S,te);const{setPopup:e,isAddPoint:a,updateData:t,redrawPoints:l,clickMenu:u,gridPoints:i,fixedNoRisePoints:r}=m(S,te,b,le,ue,ie,ne,w.addRenderItem,j,x);D.redrawPoints=l,D.clickMenu=u;const{drawScaleValue:o}=p(S,te,b,e,j,le,ue,ie,ne,a,t,i);g(S,te,o),f(S,te),y(S,te,b,le,ue,r);const{select:s}=n(S,te,b);D.select=s}()}),{immediate:!0}),{propItems:te,...l(D)}}export{S as useTemperatureChart};
1
+ import{reactive as e,computed as a,watch as t,toRefs as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as i}from"../useCumputedPoint.js";import{useCanvasEvent as n}from"../useEvent.js";import"../useShadow.js";import"../useCommon.js";import{setOtherType as r,isOneLine as o,getFloorNumber as s}from"../../utils/index.js";import{flatten as v}from"lodash-es";import{format as d,addDays as c}from"date-fns";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../../constants/index.js";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";import{useTop as h}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useRight as g}from"./useRight.js";import{useCenter as m}from"./useCenter.js";import{useBottom as f}from"./useBottom.js";import{useOther as y}from"./useOther.js";function S(S,b,w,Y,C,j){const x=15,D=e({select:null,redrawPoints:null,clickMenu:null}),V=a((()=>{const{painSurplusCell:e=[0,0]}=b.data.grid||{};return~Q.value?e:[0,0]})),H=a((()=>{var e,a;const t=(null==(a=null==(e=b.data.grid)?void 0:e.surplusCell)?void 0:a.slice())||[0,0,0,0];return 0===Q.value?t[0]=t[0]+V.value[1]:Q.value>0&&(t[2]=t[2]+V.value[0]),t})),P=a((()=>0===Q.value?[V.value[0],H.value[1],H.value[2],H.value[3]]:Q.value>0?[H.value[0],H.value[1],V.value[1],H.value[3]]:H.value)),X=a((()=>{const{top:e}=b.data;return e.date.show&&(e.date.height||x)||0})),L=a((()=>{var e;const{top:a}=b.data;return(null==(e=a.hospitalDays)?void 0:e.show)&&(a.hospitalDays.height||x)||0})),M=a((()=>{var e;const{top:a}=b.data;return(null==(e=a.operationDays)?void 0:e.show)&&(a.operationDays.height||x)||0})),I=a((()=>{var e,a,t;const{top:l}=b.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||x)||0)+((null==(a=l.xScalevalue)?void 0:a.show)&&null!=(t=l.dayHeight)?t:0)})),O=a((()=>{var e;const{top:a}=b.data;return(null==(e=a.childbirthDays)?void 0:e.show)&&(a.childbirthDays.height||x)||0})),N=a((()=>{var e;const{bottom:a}=b.data;return(null==(e=null==a?void 0:a.breathing)?void 0:e.show)&&(a.breathing.height||30)||0})),k=a((()=>{const{grid:e}=b.data;return e.mainXCell*e.subXCell+H.value[1]+H.value[3]})),R=a((()=>{const{mainYCell:e,subYCell:a,painSubYCell:t=5}=b.data.grid,l=Q.value>0?V.value[1]:V.value[0];return(e-1)*a+t+H.value[0]+H.value[2]+l})),W=a((()=>{var e;const{width:a,right:t=null,top:l}=b.data;if(!t)return a;return a-(null!=(e=t.width)?e:0)})),$=a((()=>W.value-H.value[1]*z.value)),A=a((()=>{const{top:e,left:a}=b.data;return e.titleWidth+G.value})),T=a((()=>{const{bottom:e=null,height:a}=b.data;if(!e)return a;return a-(e.height||30)})),q=a((()=>{var e;const{top:a}=b.data,t=a.xScalevalue.show&&(null!=(e=a.dayHeight)?e:0)||0,l=a.xScalevalue.show&&(a.xScalevalue.height||x)||0;return X.value+t+l+L.value+M.value+O.value})),z=a((()=>(W.value-A.value)/k.value)),B=a((()=>(T.value-q.value)/R.value)),G=a((()=>{var e,a;const{left:t}=b.data;return(null==(e=t.icons)?void 0:e.show)&&((null==(a=t.icons)?void 0:a.width)||100)||0})),E=a((()=>{var e,a;const{top:t,grid:l}=b.data,u=(null==(a=null==(e=t.date.list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],i=t.xScalevalue.times;let n=A.value-z.value;const r=t.date.startDate||d(new Date,"yyyy-MM-dd"),o=u.reduce(((e,a,t)=>0===t?e.concat(r):e.concat(d(c(new Date(r.replace(/-/g,"/")),t),"yyyy-MM-dd"))),[]).map((e=>i.map((a=>{n+=z.value;const t=Date.parse(`${e} ${a.start}`),l=Date.parse(`${e} ${a.end}`);return{start:t,end:l,left:n,center:n+z.value/2,scaleCell:(l-t)/z.value}}))));return v(o)})),F=a((()=>{var e;return(null==(e=b.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),J=a((()=>{const{left:e}=b.data;return v(e.yScaleValue.filter((e=>e.show)).map((e=>e.dataList.filter((e=>e.show)).map(((a,t)=>({...a,bigType:r(a.title,e.type),unit:e.unit,dataIndex:t,isOneLine:o(e)}))))))})),K=a((()=>{const{left:e}=b.data,a=e.yScaleValue.find((e=>"pain"===e.type));if(!a)return 0;const{numberVerticalPosition:t="bottom"}=a;return"center"===t?B.value/2:0})),Q=a((()=>{const{left:e}=b.data,a=e.yScaleValue.findIndex((e=>"pain"===e.type));return a>-1&&e.yScaleValue[a].show?a:-1})),U=a((()=>{const{painSubYCell:e=5}=b.data.grid;return-1===Q.value?0:B.value*e})),Z=a((()=>{const{left:e}=b.data;return(e.yScaleValue.find((e=>"pain"===e.type))||{}).borderColor})),_=a((()=>{const{left:e}=b.data,a={originY:q.value+V.value[0]*B.value,endY:T.value-V.value[1]*B.value-K.value};return 0===Q.value&&e.yScaleValue.length>1?a.endY=a.originY+U.value-K.value:Q.value===e.yScaleValue.length-1&&(a.originY=a.endY-U.value+K.value),a})),ee=a((()=>{const{left:e}=b.data,a={originY:q.value+H.value[0]*B.value,endY:T.value-H.value[2]*B.value};return 0===Q.value&&e.yScaleValue.length>1?a.originY=_.value.endY+K.value+H.value[0]*B.value:Q.value===e.yScaleValue.length-1&&(a.endY=_.value.originY-H.value[2]*B.value),a})),ae=a((()=>{var e,a;const{top:t,grid:l}=b.data,u=[];for(const i in t)t[i].show&&u.push({...t[i],list:(null==(a=null==(e=t[i].list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,a)=>e.seq-a.seq))})),te=a((()=>{var e;const{left:a,right:t}=b.data,l=a.yScaleValue.find((e=>"temperature"===e.type)),u=(null==t?void 0:t.yScaleValue)||{};if(null==(e=null==l?void 0:l.list)?void 0:e.length){const e=(null==u?void 0:u.showdetailedScale)?l.list.reduce((e=>{const a=e[e.length-1];return a?e.concat([a+1,a+2]):e.concat([92])}),[]):[],a=l.list.map((e=>s(1.8*e+32)));Object.assign(u,{list:a,detailedList:e,spaceGridNumber:l.spaceGridNumber})}return u})),le=e({canvasWidth:b.data.width,canvasHeight:b.data.height,borderStyle:{...u,...b.data.borderStyle||{}},selectionStyle:b.data.selectionStyle||{},dateHeight:X.value,hospitalDaysHeight:L.value,operationDaysHeight:M.value,xScalevalueHeight:I.value,childbirthDaysHeight:O.value,topList:ae.value,breathingHeight:N.value,hospitalizationDate:b.data.hospitalizationDate,grid:b.data.grid,top:b.data.top,left:b.data.left,right:b.data.right,bottom:b.data.bottom,other:b.data.other,painIndex:Q.value,painHeight:U.value,painOriginY:_.value,vitalSignsOriginY:ee.value,gridXNumber:k.value,gridYNumber:R.value,iconsWidth:G.value,originX:A.value,originY:q.value,endX:W.value,endXLimit:$.value,endY:T.value,xCellWidth:z.value,yCellHeight:B.value,xScaleList:E.value,event:F.value,itemList:J.value,getRightInfo:te.value,config:b.data.config||{},surplusCell:H.value,painSurplusCell:V.value,mainSurplusCell:P.value,painScalePositionSurplusHeight:K.value,painBorderColor:Z.value}),{computedX:ue,computedY:ie,getXValue:ne,getYValue:re}=i(le);return t((()=>S.value),(e=>{e&&function(){h(S,le);const{setPopup:e,isAddPoint:a,updateData:t,redrawPoints:l,clickMenu:u,gridPoints:i,fixedNoRisePoints:r}=m(S,le,w,ue,ie,ne,re,b.addRenderItem,C,j);D.redrawPoints=l,D.clickMenu=u;const{drawScaleValue:o}=p(S,le,w,e,C,ue,ie,ne,re,a,t,i);g(S,le,o),f(S,le),y(S,le,w,ue,ie,r);const{select:s}=n(S,le,w);D.select=s}()}),{immediate:!0}),{propItems:le,...l(D)}}export{S as useTemperatureChart};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";import{drawLine as l,defaultStyle as s}from"./useDraw.js";function n(n,i){var u,r,t;const{gridYNumber:o,originY:d,grid:a,originX:b,endX:c,xCellWidth:C,yCellHeight:g,gridXNumber:S,endY:m,borderStyle:p,mainSurplusCell:X,isTemperature:f}=i,Y=null!=(u=null!=X?X:i.surplusCell)?u:[0,0,0,0],h=[],y=[],v=new Set,j=(null==(r=a.mainLineStyle)?void 0:r.x)||{},x=(null==(t=a.mainLineStyle)?void 0:t.y)||{},L=a.subLineStyle||j,w=a.subSecondLineStyle||{},{originY:O=0,endY:N=0}=i.vitalSignsOriginY||{},T=Math.round((m-N)/g);for(let e=0;e<=o;e++){const s=d+~~(g*(o-e)),n={...p,...L},i=l([b,s,c,s],n);if(!f&&(e-Y[2])%a.subYCell==0&&e<=o-Y[0])i.set(j),v.add(i);else if(f){const l=d+g*(o-e);l>=O&&l<=N+1&&(e-T)%a.subYCell==0?(i.set(j),v.add(i)):h.push(i)}else h.push(i)}for(let e=0;e<=S;e++){const s=b+~~(C*e),n={...p,...a.subXCell?L:x};a.subXCell&&e%a.subXCell==0?Object.assign(n,{...0!==e&&e!==S?x:p}):a.subSecondXCell&&e%a.subSecondXCell==0&&Object.assign(n,w);const i=l([s,d,s,m],n);a.subXCell&&e%a.subXCell==0?v.add(i):y.push(i)}const k=new e.Group([...h,...y,...v],s);n.value.add(k),n.value.sendToBack(k)}export{n as useGrid};
1
+ import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";import{drawLine as l,defaultStyle as n}from"./useDraw.js";function i(i,s){var u,t,r;const{gridYNumber:d,originY:o,grid:a,originX:b,endX:c,xCellWidth:C,yCellHeight:S,gridXNumber:g,endY:m,borderStyle:p,mainSurplusCell:X,isTemperature:f,config:y}=s,Y=null!=(u=null!=X?X:s.surplusCell)?u:[0,0,0,0],h=[],v=[],L=new Set,j=(null==(t=a.mainLineStyle)?void 0:t.x)||{},x=(null==(r=a.mainLineStyle)?void 0:r.y)||{},w=a.subLineStyle||j,O=a.subSecondLineStyle||{},{originY:I=0,endY:N=0}=s.vitalSignsOriginY||{},P=Math.round((m-N)/S);for(let e=0;e<=d;e++){const n=o+~~(S*(d-e)),i={...p,...w},s=l([b,n,c,n],i);if((!f||y.mainLineStyleIncludePain)&&(e-Y[2])%a.subYCell==0&&e<=d-Y[0])s.set(j),L.add(s);else if(f&&!y.mainLineStyleIncludePain){const l=o+S*(d-e);l>=I&&l<=N+1&&(e-P)%a.subYCell==0?(s.set(j),L.add(s)):h.push(s)}else h.push(s)}for(let e=0;e<=g;e++){const n=b+~~(C*e),i={...p,...a.subXCell?w:x};a.subXCell&&e%a.subXCell==0?Object.assign(i,{...0!==e&&e!==g?x:p}):a.subSecondXCell&&e%a.subSecondXCell==0&&Object.assign(i,O);const s=l([n,o,n,m],i);a.subXCell&&e%a.subXCell==0?L.add(s):v.push(s)}const T=new e.Group([...h,...v,...L],n);i.value.add(T),i.value.sendToBack(T)}export{i as useGrid};
@@ -83,6 +83,7 @@ export interface IPropItems {
83
83
  surplusCell: ILineCoordinate;
84
84
  painSurplusCell: [number, number];
85
85
  painScalePositionSurplusHeight: number;
86
+ [key: string]: any;
86
87
  }
87
88
  export interface IPoint {
88
89
  time: string;
@@ -102,6 +103,7 @@ export interface IDate {
102
103
  height?: number;
103
104
  list: Array<string | number>;
104
105
  style?: fabric.ITextOptions;
106
+ key?: string;
105
107
  [key: string]: any;
106
108
  }
107
109
  export interface ITop {
@@ -1 +1 @@
1
- var l,e,a,d,o,n,t,i,w,u,g,v,y,C,L,_,T,B,E,c,m,I,x,s,O,p,A,h,D,H=(l=>(l.INPUT="INPUT",l.TEXTAREA="TEXTAREA",l.DIGITAL="DIGITAL",l.DATE="DATE",l.RADIO="RADIO",l.RADIO_BLOCK="RADIO_BLOCK",l.CHECKBOX="CHECKBOX",l.CHECKBOX_BLOCK="CHECKBOX_BLOCK",l.SELECT="SELECT",l.MULTI_SELECT="MULTI_SELECT",l))(H||{});const M={open:{describe:(null==(l=window.getLanguageByCode)?void 0:l.call(window,"10010.1.351"))||"是",value:"1"},close:{describe:(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.352"))||"否",value:"0"}},k=[{text:(null==(a=window.getLanguageByCode)?void 0:a.call(window,"10010.1.293"))||"文本框",value:"INPUT"},{text:(null==(d=window.getLanguageByCode)?void 0:d.call(window,"10010.1.564"))||"文本域",value:"TEXTAREA"},{text:(null==(o=window.getLanguageByCode)?void 0:o.call(window,"10010.1.292"))||"数字框",value:"DIGITAL"},{text:(null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.74"))||"日期",value:"DATE"},{text:(null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.565"))||"横向单选",value:"RADIO"},{text:(null==(i=window.getLanguageByCode)?void 0:i.call(window,"10010.1.566"))||"纵向单选",value:"RADIO_BLOCK"},{text:(null==(w=window.getLanguageByCode)?void 0:w.call(window,"10010.1.567"))||"横向多选",value:"CHECKBOX"},{text:(null==(u=window.getLanguageByCode)?void 0:u.call(window,"10010.1.568"))||"纵向多选",value:"CHECKBOX_BLOCK"},{text:(null==(g=window.getLanguageByCode)?void 0:g.call(window,"10010.1.294"))||"下拉框",value:"SELECT"},{text:(null==(v=window.getLanguageByCode)?void 0:v.call(window,"10010.1.569"))||"下拉多选框",value:"MULTI_SELECT"}],r=[{text:"1/3",value:4},{text:"2/3",value:8},{text:"1/4",value:3},{text:"3/4",value:9},{text:"1/6",value:2},{text:"5/6",value:10},{text:"1/8",value:1.5},{text:"7/8",value:10.5},{text:(null==(y=window.getLanguageByCode)?void 0:y.call(window,"10010.1.30"))||"半行",value:6},{text:(null==(C=window.getLanguageByCode)?void 0:C.call(window,"10010.1.29"))||"整行",value:12}],N=[{text:(null==(L=window.getLanguageByCode)?void 0:L.call(window,"10010.1.548"))||"年-月-日 时:分:秒",value:"yyyy-MM-dd HH:mm:ss"},{text:(null==(_=window.getLanguageByCode)?void 0:_.call(window,"10010.1.549"))||"年-月-日 时:分",value:"yyyy-MM-dd HH:mm"},{text:(null==(T=window.getLanguageByCode)?void 0:T.call(window,"10010.1.550"))||"年-月-日",value:"yyyy-MM-dd"},{text:(null==(B=window.getLanguageByCode)?void 0:B.call(window,"10010.1.551"))||"年-月",value:"yyyy-MM"},{text:"月-日 时-分",value:"MM-dd HH:mm"},{text:(null==(E=window.getLanguageByCode)?void 0:E.call(window,"10010.1.553"))||"月-日",value:"MM-dd"},{text:(null==(c=window.getLanguageByCode)?void 0:c.call(window,"10010.1.554"))||"时:分:秒",value:"HH:mm:ss"},{text:(null==(m=window.getLanguageByCode)?void 0:m.call(window,"10010.1.555"))||"时:分",value:"HH:mm"}],U={alias:(null==(I=window.getLanguageByCode)?void 0:I.call(window,"10010.1.541"))||"日期格式",val_key:"date_format",html_type:"SELECT",option:N},K={alias:"选项",val_key:"option",html_type:"COMBINATION",jsonCombination:!1,minGroupNum:0,children:[{elem_width:6,alias:"文本",val_key:"text",html_type:"INPUT",is_null:"0"},{elem_width:6,alias:(null==(x=window.getLanguageByCode)?void 0:x.call(window,"10010.1.22"))||"值",val_key:"value",html_type:"INPUT",is_null:"0"}]},P=[{alias:"id",val_key:"id",html_type:"TEXT",decoratorProps:{style:{display:"none"}}},{alias:(null==(s=window.getLanguageByCode)?void 0:s.call(window,"10010.1.530"))||"字段键名",val_key:"key",html_type:"INPUT",remark:"数据库字段键名,不填写时由系统生成,填写则以填写为准"},{alias:(null==(O=window.getLanguageByCode)?void 0:O.call(window,"10010.1.16"))||"是否必填",val_key:"is_null",html_type:"SWITCH",...M},{alias:(null==(p=window.getLanguageByCode)?void 0:p.call(window,"10010.1.529"))||"字段标题",val_key:"name",html_type:"INPUT"},{alias:(null==(A=window.getLanguageByCode)?void 0:A.call(window,"10010.1.532"))||"字段类型",val_key:"html_type",html_type:"SELECT",option:k,is_null:"0"},{alias:"字段默认值",val_key:"default_val",html_type:"INPUT"},{alias:(null==(h=window.getLanguageByCode)?void 0:h.call(window,"10010.1.534"))||"字段问号提示",val_key:"remark",html_type:"INPUT"},{alias:(null==(D=window.getLanguageByCode)?void 0:D.call(window,"10010.1.13"))||"宽度",val_key:"elem_width",html_type:"SELECT",option:r}],S=Object.freeze({DATE_FORMAT_FIELD:U,DECIMAL_LENGTH_FIELD:{alias:"小数位数",val_key:"decimal_length",html_type:"INPUT",remark:"小数位数,默认为0"},OPTION_FIELD:K,DEFAULT_FIELD_LIST:P});export{S as FIELD_EDITOR_FIELDS,H as HtmlType};
1
+ var l,e,a,d,o,t,n,i,w,u,g,v,y,C,_,L,T,B,E,c,m,I,s,x,O,p,A,h,D,H=(l=>(l.INPUT="INPUT",l.TEXTAREA="TEXTAREA",l.DIGITAL="DIGITAL",l.DATE="DATE",l.RADIO="RADIO",l.RADIO_BLOCK="RADIO_BLOCK",l.CHECKBOX="CHECKBOX",l.CHECKBOX_BLOCK="CHECKBOX_BLOCK",l.SELECT="SELECT",l.MULTI_SELECT="MULTI_SELECT",l))(H||{});const M={default_val:1,open:{describe:(null==(l=window.getLanguageByCode)?void 0:l.call(window,"10010.1.351"))||"是",value:0},close:{describe:(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.352"))||"否",value:1}},k=[{text:(null==(a=window.getLanguageByCode)?void 0:a.call(window,"10010.1.293"))||"文本框",value:"INPUT"},{text:(null==(d=window.getLanguageByCode)?void 0:d.call(window,"10010.1.564"))||"文本域",value:"TEXTAREA"},{text:(null==(o=window.getLanguageByCode)?void 0:o.call(window,"10010.1.292"))||"数字框",value:"DIGITAL"},{text:(null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.74"))||"日期",value:"DATE"},{text:(null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.565"))||"横向单选",value:"RADIO"},{text:(null==(i=window.getLanguageByCode)?void 0:i.call(window,"10010.1.566"))||"纵向单选",value:"RADIO_BLOCK"},{text:(null==(w=window.getLanguageByCode)?void 0:w.call(window,"10010.1.567"))||"横向多选",value:"CHECKBOX"},{text:(null==(u=window.getLanguageByCode)?void 0:u.call(window,"10010.1.568"))||"纵向多选",value:"CHECKBOX_BLOCK"},{text:(null==(g=window.getLanguageByCode)?void 0:g.call(window,"10010.1.294"))||"下拉框",value:"SELECT"},{text:(null==(v=window.getLanguageByCode)?void 0:v.call(window,"10010.1.569"))||"下拉多选框",value:"MULTI_SELECT"}],r=[{text:"1/3",value:"4"},{text:"2/3",value:"8"},{text:"1/4",value:"3"},{text:"3/4",value:"9"},{text:"1/6",value:"2"},{text:"5/6",value:"10"},{text:"1/8",value:"1.5"},{text:"7/8",value:"10.5"},{text:(null==(y=window.getLanguageByCode)?void 0:y.call(window,"10010.1.30"))||"半行",value:"6"},{text:(null==(C=window.getLanguageByCode)?void 0:C.call(window,"10010.1.29"))||"整行",value:"12"}],N=[{text:(null==(_=window.getLanguageByCode)?void 0:_.call(window,"10010.1.548"))||"年-月-日 时:分:秒",value:"yyyy-MM-dd HH:mm:ss"},{text:(null==(L=window.getLanguageByCode)?void 0:L.call(window,"10010.1.549"))||"年-月-日 时:分",value:"yyyy-MM-dd HH:mm"},{text:(null==(T=window.getLanguageByCode)?void 0:T.call(window,"10010.1.550"))||"年-月-日",value:"yyyy-MM-dd"},{text:(null==(B=window.getLanguageByCode)?void 0:B.call(window,"10010.1.551"))||"年-月",value:"yyyy-MM"},{text:"月-日 时-分",value:"MM-dd HH:mm"},{text:(null==(E=window.getLanguageByCode)?void 0:E.call(window,"10010.1.553"))||"月-日",value:"MM-dd"},{text:(null==(c=window.getLanguageByCode)?void 0:c.call(window,"10010.1.554"))||"时:分:秒",value:"HH:mm:ss"},{text:(null==(m=window.getLanguageByCode)?void 0:m.call(window,"10010.1.555"))||"时:分",value:"HH:mm"}],U={alias:(null==(I=window.getLanguageByCode)?void 0:I.call(window,"10010.1.541"))||"日期格式",val_key:"date_format",html_type:"SELECT",is_null:"0",option:N},K={alias:"选项",val_key:"option",html_type:"COMBINATION",jsonCombination:!1,default_val:[],minGroupNum:0,children:[{elem_width:6,alias:"文本",val_key:"text",html_type:"INPUT",is_null:"0"},{elem_width:6,alias:(null==(s=window.getLanguageByCode)?void 0:s.call(window,"10010.1.22"))||"值",val_key:"value",html_type:"INPUT",is_null:"0"}]},P=[{alias:"id",val_key:"id",html_type:"TEXT",decoratorProps:{style:{display:"none"}}},{alias:(null==(x=window.getLanguageByCode)?void 0:x.call(window,"10010.1.530"))||"字段键名",val_key:"key",html_type:"INPUT",remark:"数据库字段键名,不填写时由系统生成,填写则以填写为准"},{alias:(null==(O=window.getLanguageByCode)?void 0:O.call(window,"10010.1.16"))||"是否必填",val_key:"is_null",html_type:"SWITCH",...M},{alias:(null==(p=window.getLanguageByCode)?void 0:p.call(window,"10010.1.529"))||"字段标题",val_key:"name",html_type:"INPUT",default_val:""},{alias:(null==(A=window.getLanguageByCode)?void 0:A.call(window,"10010.1.532"))||"字段类型",val_key:"html_type",html_type:"SELECT",option:k,is_null:"0"},{alias:"字段默认值",val_key:"default_val",html_type:"INPUT"},{alias:(null==(h=window.getLanguageByCode)?void 0:h.call(window,"10010.1.534"))||"字段问号提示",val_key:"remark",html_type:"INPUT",default_val:""},{alias:(null==(D=window.getLanguageByCode)?void 0:D.call(window,"10010.1.13"))||"宽度",val_key:"elem_width",html_type:"SELECT",option:r}],S=Object.freeze({DATE_FORMAT_FIELD:U,DECIMAL_LENGTH_FIELD:{alias:"小数位数",val_key:"decimal_length",html_type:"INPUT",default_val:"0",remark:"小数位数,默认为0"},OPTION_FIELD:K,DEFAULT_FIELD_LIST:P});export{S as FIELD_EDITOR_FIELDS,H as HtmlType};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,provide as t,computed as r,nextTick as a,onBeforeUnmount as s,openBlock as i,createBlock as l,unref as n,mergeProps as m,withCtx as p,createElementBlock as d,createVNode as u,isRef as c,Fragment as f,renderList as h,createCommentVNode as y,createElementVNode as g,normalizeStyle as v,toDisplayString as b,renderSlot as j}from"vue";import{useTheme as k}from"../../../shared/hooks/useTheme.js";import{useElementSize as C}from"@vueuse/core";import"date-fns";import{isNumber as F,cloneDeep as S}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{NForm as x,NTabs as w,NTabPane as L,NConfigProvider as B}from"naive-ui";import{useVersion as A}from"../../../shared/hooks/useVersion.js";import"../../../shared/hooks/useScrollLoading.js";import{createForm as R,onFormMount as H,onFieldValueChange as O,onFieldMount as T,onFieldUnmount as I,onFieldReact as V}from"@formily/core";import{Path as N}from"@formily/path";import{FormProvider as _,FormConsumer as D}from"@formily/vue";import{InjectionFormColumnWidth as W,InjectionFormLifeCycleCaller as U,InjectionFormGraph as E}from"./constants/index.js";import"./components/renderer/text.js";import"./utils/business.js";import{createObjSchema as M}from"./utils/schema.js";import{useAnchor as q}from"./hooks/useAnchor.js";import"../index.js";import{useComplexOptionsSpan as P}from"./hooks/useComplexOptions.js";import{useFieldListAdaptor as G}from"./hooks/useFieldListAdaptor.js";import"../../../shared/utils/tapable/SyncHook.js";import"../../../shared/utils/tapable/SyncBailHook.js";import"../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../shared/utils/tapable/SyncLoopHook.js";import"../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import{useFieldVisitor as K}from"./hooks/useFieldVisitor.js";import{useFormContext as z}from"./hooks/useFormContext.js";import{useFormDomEvent as J,useFormExposeEvent as Q}from"./hooks/useFormEvent.js";import{useFormGraph as $}from"./hooks/useFormGraph.js";import{useFormRenderLifeCycle as X}from"./hooks/useFormRenderLifeCycle.js";import{validateMessageLocale as Y}from"./hooks/useFormValidator.js";import{useLowCodeEvent as Z}from"./hooks/useLowCodeEvent.js";import{useLowCodeReactions as ee}from"./hooks/useLowCodeReactions.js";import{useNuiThemeOverrides as oe}from"./hooks/useNuiThemeOverrides.js";import{useOperationalForm as te}from"./hooks/useOperationalForm.js";import{useWordbookSetting as re}from"./hooks/useWordbookSetting.js";import{useNewLowCodeReactions as ae}from"./hooks/useNewLowCodeReactions.js";import{GlobalState as se}from"@formily/core/esm/shared/constants";const ie={key:0,style:{height:"54px"}},le={style:{"white-space":"pre"}};var ne=e({__name:"FormRender",props:{fieldList:{type:Array},initialData:{type:Object,default:()=>({})},fieldVisitor:{type:Object},column:{type:Number,default:24},maxHeight:{type:[Number,String],default:""},anchor:{type:Boolean,default:!1},parallelism:{type:Number,default:5},businessFormatter:{type:Function},schema:{type:Object},components:{type:Object,default:()=>({})},scope:{type:Object,default:()=>({})},annotation:{type:Object},annotationShortcuts:{type:Array},consumer:{type:Boolean,default:!1},uuid:{type:String},lifeCycle:{type:Object},requestInstance:{type:Object},enterToNextWidget:{type:[Boolean,Function],default:!0},autoExpand:Boolean,lowCodeReactions:{type:Array},newLowCodeReactions:{type:Array},operationalForm:{type:Array},dateOperationalForm:{type:Object},operationalFormInit:{type:Boolean,default:!0},linebarAutoHidden:{type:Boolean},bordered:{type:[Boolean,String],default:!0},labelPlacementOverwrite:Boolean,outBordered:{type:Boolean,default:!1},uniqueCacheData:{type:Boolean,default:!1},forceClearable:Boolean,wordSplitFilter:{type:Boolean,default:!0},selectMode:Boolean,selectedFields:{type:Array},linebarDirection:{type:String,default:"vertical"},linebarTextDirection:{type:String,default:"horizontal"},linebarWidth:{type:[Number,String],default:120},autoWidth:{type:[Boolean,Number],default:!1},incrementalRender:{type:Boolean,default:!1},feedbackType:{type:String,default:"default"},fixMemoLeak:{type:Boolean}},emits:["formChange","annotationChange","scroll","update:selectedFields","linebarChange","ready"],setup(e,{expose:ne,emit:me}){const pe=e,de=k(),{nuiThemeOverrides:ue}=oe();Y();const ce=o(),{width:fe}=C(ce);t(W,r((()=>fe.value?(fe.value-16*(pe.column-1))/24:0)));const he=r((()=>F(pe.maxHeight)?pe.maxHeight+"px":pe.maxHeight)),{SchemaField:ye,businessCollector:ge,formItemDepsCollector:ve,changeContextCollector:be,asyncQueue:je,formUUID:ke}=z(pe,me),{anchorBarRef:Ce,currentAnchor:Fe,updateAnchorList:Se,anchorIdList:xe,onScroll:we,generateAnchorList:Le}=q(pe,me,ce,ve),{callLifeCycle:Be}=X(pe);t(U,Be),Be("onSetup");const{observeFormGraph:Ae,setGraph:Re,removeGraph:He}=$();t(E,Ae);const{lowCodeEventTrigger:Oe}=Z(),Te=o(!0),Ie=R({initialValues:pe.initialData,effects(e){const o={};H((()=>{Object.assign(o,S(e.values))})),O("*",(t=>{const r=N.getIn(o,t.path);N.setIn(o,t.path,t.value);const a=t.props.name.toString();ge.trigger(e,a),ve.trigger(t.path),Te.value&&me("formChange",{fieldInstance:t,fieldKey:a,oldValue:r,fieldName:t.title,value:t.value,context:be.getContext(a,t.value)}),Oe(t),Ve(a),Ne(a),_e.trigger(a),De.trigger(a,t.value)})),T("*",Re),T("*",(e=>{const o=e.props.name.toString();Ve(o),Ne(o),pe.operationalFormInit&&_e.trigger(o)})),I("*",He),pe.anchor&&V("*",Se)}}),{lowCodeReactionsHandler:Ve}=ee(r((()=>pe.lowCodeReactions)),Ie),{newLowCodeReactionsHandler:Ne}=ae(r((()=>pe.newLowCodeReactions)),Ie),_e=te(pe,Ie),De=re().create(Ie,be),{schemaAdaptor:We}=G(ge,pe.lifeCycle);let Ue=pe.fieldList||[],Ee=[];const Me=r((()=>{let e=!1;const o=pe.schema?pe.schema:pe.fieldList?(Ue!==pe.fieldList&&0!==Ue.length||(e=!0),Ue=K().traverse(S(pe.fieldList),pe.fieldVisitor),M(We(Ue,pe))):M({});return pe.incrementalRender&&e&&(Ee=[],Object.values(o.properties).forEach((e=>{var o;"visible"===e["x-display"]&&"LINEBAR"===e["x-component"]&&!1!==(null==(o=e["x-component-props"])?void 0:o.show)&&(Ee.push(e),e["x-component-props"].show=!1)})),qe()),o}));function qe(){Ee.length?setTimeout((()=>{const e=Ee.shift();e&&(ve.trigger(N.parse(e.name),!0),Ie.setFieldState(e.name,(e=>{e.componentProps.show=!0})),Ee.length?qe():a().then((()=>{me("ready")})))}),300):me("ready")}const{onKeydown:Pe}=J({formModel:Ie,formRenderRef:ce,props:pe,formUUID:ke}),{clearSpan:Ge}=P();s((()=>{Ge(ke),pe.fixMemoLeak&&(se.lifecycles.length=0)}));const Ke=Q({formModel:Ie,formRenderRef:ce,formItemDepsCollector:ve,businessCollector:ge,wordbookSettingHandler:De,operationalFormHandler:_e,getFieldList:()=>Ue,formUUID:ke,changeContextCollector:be,emitFormChange:Te});return ne({formModel:Ie,validate:(e="*",o={})=>Ke.validate(e,o),getFormValues:(e=!0)=>Ke.getFormValues(e),setFormValues:async(e,o={})=>Ke.setFormValues(e,o),setFieldState(e,o){Ke.setFieldState(e,o)},resetFields(e="*"){Ke.resetFields(e)},queryWidget:async e=>Ke.queryWidget(e),getFieldList:()=>Ue,applySelectedSetting:e=>Ke.applySelectedSetting(e),async reload(){console.error("reload function is abstract,it should be overwrite!")},async optionInited(e={}){if(await a(),je.activeTasks)return new Promise((o=>{var t;const r=()=>{o(),je.onActiveTaskChange=null};je.onActiveTaskChange=()=>{je.activeTasks||r()},setTimeout(r,null!=(t=e.timeout)?t:5e3)}))},updateAnchor(){Le(Ie)},getTextFormValues:()=>Ke.getTextFormValues()}),(o,t)=>(i(),l(n(x),m({class:["form-render",{"form-render--out-border":e.outBordered}],"require-mark-placement":"left",style:n(de)},n(A)(),{uuid:n(ke)}),{default:p((()=>[e.anchor?(i(),d("section",ie,[u(n(w),{value:n(Fe),"onUpdate:value":t[0]||(t[0]=e=>c(Fe)?Fe.value=e:null),type:"line",ref_key:"anchorBarRef",ref:Ce},{default:p((()=>[(i(!0),d(f,null,h(n(xe),(e=>(i(),l(n(L),{name:e.name,tab:e.title,key:e.name},null,8,["name","tab"])))),128))])),_:1},8,["value"])])):y("v-if",!0),u(n(B),{"theme-overrides":n(ue)},{default:p((()=>[g("section",{class:"form-render__wrapper",style:v({"--column":e.column,"--form-height":n(he)}),ref_key:"formRenderRef",ref:ce,onScroll:t[1]||(t[1]=(...e)=>n(we)&&n(we)(...e)),onKeydownCapture:t[2]||(t[2]=(...e)=>n(Pe)&&n(Pe)(...e))},[u(n(_),{form:n(Ie)},{default:p((()=>[u(n(ye),{schema:n(Me)},null,8,["schema"]),e.consumer?(i(),l(n(D),{key:0},{default:p((({form:e})=>[g("div",le,b(JSON.stringify(e.values,null,2)),1)])),_:1})):y("v-if",!0),j(o.$slots,"default")])),_:3},8,["form"])],36)])),_:3},8,["theme-overrides"])])),_:3},16,["class","style","uuid"]))}});export{ne as default};
1
+ import{defineComponent as e,ref as o,provide as t,computed as r,nextTick as a,onBeforeUnmount as s,openBlock as i,createBlock as l,unref as n,mergeProps as m,withCtx as p,createElementBlock as d,createVNode as u,isRef as c,Fragment as f,renderList as h,createCommentVNode as y,createElementVNode as g,normalizeStyle as v,toDisplayString as b,renderSlot as j}from"vue";import{useTheme as k}from"../../../shared/hooks/useTheme.js";import{useElementSize as C}from"@vueuse/core";import"date-fns";import{isNumber as F,cloneDeep as S}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{NForm as x,NTabs as w,NTabPane as L,NConfigProvider as B}from"naive-ui";import{useVersion as A}from"../../../shared/hooks/useVersion.js";import"../../../shared/hooks/useScrollLoading.js";import{createForm as R,onFormMount as H,onFieldValueChange as O,onFieldMount as T,onFieldUnmount as I,onFieldReact as V}from"@formily/core";import{Path as N}from"@formily/path";import{FormProvider as _,FormConsumer as D}from"@formily/vue";import{InjectionFormColumnWidth as W,InjectionFormLifeCycleCaller as U,InjectionFormGraph as E}from"./constants/index.js";import"./components/renderer/text.js";import"./utils/business.js";import{createObjSchema as M}from"./utils/schema.js";import{useAnchor as q}from"./hooks/useAnchor.js";import"../index.js";import{useComplexOptionsSpan as P}from"./hooks/useComplexOptions.js";import{useFieldListAdaptor as G}from"./hooks/useFieldListAdaptor.js";import"../../../shared/utils/tapable/SyncHook.js";import"../../../shared/utils/tapable/SyncBailHook.js";import"../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../shared/utils/tapable/SyncLoopHook.js";import"../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import{useFieldVisitor as K}from"./hooks/useFieldVisitor.js";import{useFormContext as z}from"./hooks/useFormContext.js";import{useFormDomEvent as J,useFormExposeEvent as Q}from"./hooks/useFormEvent.js";import{useFormGraph as $}from"./hooks/useFormGraph.js";import{useFormRenderLifeCycle as X}from"./hooks/useFormRenderLifeCycle.js";import{validateMessageLocale as Y}from"./hooks/useFormValidator.js";import{useLowCodeEvent as Z}from"./hooks/useLowCodeEvent.js";import{useLowCodeReactions as ee}from"./hooks/useLowCodeReactions.js";import{useNuiThemeOverrides as oe}from"./hooks/useNuiThemeOverrides.js";import{useOperationalForm as te}from"./hooks/useOperationalForm.js";import{useWordbookSetting as re}from"./hooks/useWordbookSetting.js";import{useNewLowCodeReactions as ae}from"./hooks/useNewLowCodeReactions.js";import{GlobalState as se}from"@formily/core/esm/shared/constants";const ie={key:0,style:{height:"54px"}},le={style:{"white-space":"pre"}};var ne=e({__name:"FormRender",props:{fieldList:{type:Array},initialData:{type:Object,default:()=>({})},fieldVisitor:{type:Object},column:{type:Number,default:24},maxHeight:{type:[Number,String],default:""},anchor:{type:Boolean,default:!1},parallelism:{type:Number,default:5},businessFormatter:{type:Function},schema:{type:Object},components:{type:Object,default:()=>({})},scope:{type:Object,default:()=>({})},annotation:{type:Object},annotationShortcuts:{type:Array},consumer:{type:Boolean,default:!1},uuid:{type:String},lifeCycle:{type:Object},requestInstance:{type:Object},enterToNextWidget:{type:[Boolean,Function],default:!0},autoExpand:Boolean,lowCodeReactions:{type:Array},newLowCodeReactions:{type:Array},operationalForm:{type:Array},dateOperationalForm:{type:Object},operationalFormInit:{type:Boolean,default:!0},linebarAutoHidden:{type:Boolean},bordered:{type:[Boolean,String],default:!0},labelPlacementOverwrite:Boolean,outBordered:{type:Boolean,default:!1},uniqueCacheData:{type:Boolean,default:!1},forceClearable:Boolean,wordSplitFilter:{type:Boolean,default:!0},selectMode:Boolean,selectedFields:{type:Array},linebarDirection:{type:String,default:"vertical"},linebarTextDirection:{type:String,default:"horizontal"},linebarWidth:{type:[Number,String],default:120},autoWidth:{type:[Boolean,Number],default:!1},incrementalRender:{type:Boolean,default:!1},feedbackType:{type:String,default:"default"},fixMemoLeak:{type:Boolean}},emits:["formChange","annotationChange","scroll","update:selectedFields","linebarChange","ready"],setup(e,{expose:ne,emit:me}){const pe=e,de=k(),{nuiThemeOverrides:ue}=oe();Y();const ce=o(),{width:fe}=C(ce);t(W,r((()=>fe.value?(fe.value-16*(pe.column-1))/24:0)));const he=r((()=>F(pe.maxHeight)?pe.maxHeight+"px":pe.maxHeight)),{SchemaField:ye,businessCollector:ge,formItemDepsCollector:ve,changeContextCollector:be,asyncQueue:je,formUUID:ke}=z(pe,me),{anchorBarRef:Ce,currentAnchor:Fe,updateAnchorList:Se,anchorIdList:xe,onScroll:we,generateAnchorList:Le}=q(pe,me,ce,ve),{callLifeCycle:Be}=X(pe);t(U,Be),Be("onSetup");const{observeFormGraph:Ae,setGraph:Re,removeGraph:He}=$();t(E,Ae);const{lowCodeEventTrigger:Oe}=Z(),Te=o(!0),Ie=R({initialValues:pe.initialData,effects(e){const o={};H((()=>{Object.assign(o,S(e.values))})),O("*",(t=>{const r=N.getIn(o,t.path);N.setIn(o,t.path,t.value);const a=t.props.name.toString();ge.trigger(e,a),ve.trigger(t.path),Te.value&&me("formChange",{fieldInstance:t,fieldKey:a,oldValue:r,fieldName:t.title,value:t.value,context:be.getContext(a,t.value)}),Oe(t),Ve(a),Ne(a),_e.trigger(a),De.trigger(a,t.value)})),T("*",Re),T("*",(e=>{const o=e.props.name.toString();Ve(o),Ne(o),pe.operationalFormInit&&_e.trigger(o)})),I("*",He),pe.anchor&&V("*",Se)}}),{lowCodeReactionsHandler:Ve}=ee(r((()=>pe.lowCodeReactions)),Ie),{newLowCodeReactionsHandler:Ne}=ae(r((()=>pe.newLowCodeReactions)),Ie),_e=te(pe,Ie),De=re().create(Ie,be),{schemaAdaptor:We}=G(ge,pe.lifeCycle);let Ue=pe.fieldList||[],Ee=[];const Me=r((()=>{var e;let o=!1;const t=pe.schema?pe.schema:pe.fieldList?(Ue!==pe.fieldList&&0!==Ue.length||(o=!0),Ue=K().traverse(S(pe.fieldList),pe.fieldVisitor),M(We(Ue,pe))):M({});return pe.incrementalRender&&(null==(e=pe.fieldList)?void 0:e.length)&&o&&(Ee=[],Object.values(t.properties).forEach((e=>{var o;"visible"===e["x-display"]&&"LINEBAR"===e["x-component"]&&!1!==(null==(o=e["x-component-props"])?void 0:o.show)&&(Ee.push(e),e["x-component-props"].show=!1)})),qe()),t}));function qe(){Ee.length?setTimeout((()=>{const e=Ee.shift();e&&(ve.trigger(N.parse(e.name),!0),Ie.setFieldState(e.name,(e=>{e.componentProps.show=!0})),Ee.length?qe():a().then((()=>{me("ready")})))}),300):me("ready")}const{onKeydown:Pe}=J({formModel:Ie,formRenderRef:ce,props:pe,formUUID:ke}),{clearSpan:Ge}=P();s((()=>{Ge(ke),pe.fixMemoLeak&&(se.lifecycles.length=0)}));const Ke=Q({formModel:Ie,formRenderRef:ce,formItemDepsCollector:ve,businessCollector:ge,wordbookSettingHandler:De,operationalFormHandler:_e,getFieldList:()=>Ue,formUUID:ke,changeContextCollector:be,emitFormChange:Te});return ne({formModel:Ie,validate:(e="*",o={})=>Ke.validate(e,o),getFormValues:(e=!0)=>Ke.getFormValues(e),setFormValues:async(e,o={})=>Ke.setFormValues(e,o),setFieldState(e,o){Ke.setFieldState(e,o)},resetFields(e="*"){Ke.resetFields(e)},queryWidget:async e=>Ke.queryWidget(e),getFieldList:()=>Ue,applySelectedSetting:e=>Ke.applySelectedSetting(e),async reload(){console.error("reload function is abstract,it should be overwrite!")},async optionInited(e={}){if(await a(),je.activeTasks)return new Promise((o=>{var t;const r=()=>{o(),je.onActiveTaskChange=null};je.onActiveTaskChange=()=>{je.activeTasks||r()},setTimeout(r,null!=(t=e.timeout)?t:5e3)}))},updateAnchor(){Le(Ie)},getTextFormValues:()=>Ke.getTextFormValues()}),(o,t)=>(i(),l(n(x),m({class:["form-render",{"form-render--out-border":e.outBordered}],"require-mark-placement":"left",style:n(de)},n(A)(),{uuid:n(ke)}),{default:p((()=>[e.anchor&&n(xe).length?(i(),d("section",ie,[u(n(w),{value:n(Fe),"onUpdate:value":t[0]||(t[0]=e=>c(Fe)?Fe.value=e:null),type:"line",ref_key:"anchorBarRef",ref:Ce},{default:p((()=>[(i(!0),d(f,null,h(n(xe),(e=>(i(),l(n(L),{name:e.name,tab:e.title,key:e.name},null,8,["name","tab"])))),128))])),_:1},8,["value"])])):y("v-if",!0),u(n(B),{"theme-overrides":n(ue)},{default:p((()=>[g("section",{class:"form-render__wrapper",style:v({"--column":e.column,"--form-height":n(he)}),ref_key:"formRenderRef",ref:ce,onScroll:t[1]||(t[1]=(...e)=>n(we)&&n(we)(...e)),onKeydownCapture:t[2]||(t[2]=(...e)=>n(Pe)&&n(Pe)(...e))},[u(n(_),{form:n(Ie)},{default:p((()=>[u(n(ye),{schema:n(Me)},null,8,["schema"]),e.consumer?(i(),l(n(D),{key:0},{default:p((({form:e})=>[g("div",le,b(JSON.stringify(e.values,null,2)),1)])),_:1})):y("v-if",!0),j(o.$slots,"default")])),_:3},8,["form"])],36)])),_:3},8,["theme-overrides"])])),_:3},16,["class","style","uuid"]))}});export{ne as default};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,computed as r,watch as n,onMounted as t,createVNode as i}from"vue";import{isField as l}from"@formily/core";import{Path as a}from"@formily/path";import{AddCircleOutline as u,RemoveCircle as m}from"@vicons/ionicons5";import{range as s,isNumber as p,isArray as c,isEqual as f}from"lodash-es";import"../../../../index.js";import{useDeepValidate as v}from"./hooks/useDeepValidate.js";import{connect as d,mapProps as y}from"@formily/vue";import{useDebounceFn as h,isObject as N}from"@vueuse/core";import{NButton as g,NIcon as b}from"naive-ui";import x from"../../../FormRender.vue.js";import{formRenderLog as C,mergeDeepProperties as _}from"../../../utils/index.js";import{assignUpdateValue as j}from"../../../utils/schema.js";const G=d(e({name:"FormJsonCombination",props:{title:{type:String,default:""},value:{type:[String,Array]},maxGroupNum:{type:Number},minGroupNum:{type:Number,default:1},properties:{type:Array,default:()=>[]},showLabel:Boolean,onInput:{},onBlur:{},onChange:{}},emits:["update:value"],setup(e,{emit:d}){C("当前COMBINATION控件为json模式,推荐使用非json模式,FieldItem.jsonCombination=false");const y=h((function(){d("update:value",JSON.stringify(j.value))}),300),j=o([]),G=r((()=>j.value.length));function I(o,r=!1){c(o)&&(o.length||o.push(...s(e.minGroupNum).map((()=>({})))),o=JSON.stringify(o));const n=function(e){try{if(!e)return null;const o=JSON.parse(e);return Array.isArray(o)?o:null}catch(e){return null}}(o);var t;(t=n)&&!f(t,j.value)&&(n.splice(F.value),n.forEach((function(o,n){if(!N(o))return;j.value[n]=o,r&&_(o,e.properties)})),j.value.splice(n.length),j.value.forEach(w))}n((()=>e.value),(e=>I(e))),t((()=>{const o=`[${s(e.minGroupNum).map((()=>"{}")).join(",")}]`;I(e.value||o,!0),y()}));const S=o([]);function w(e,o){var r;null==(r=S.value[o])||r.setFieldState("*",(o=>{l(o)&&(o.value=a.getIn(e,o.path))}))}function A(){j.value.push(_({},e.properties)),y()}v().bindDeepValidate(S);const F=r((()=>p(e.maxGroupNum)?e.maxGroupNum<1?0:~~e.maxGroupNum:1/0));n(F,(e=>{G.value<=e||(j.value.splice(e),y(),S.value.splice(e))}),{immediate:!0});const J=x;return()=>i("section",{class:"form-render__combination"},[i("header",{class:"form-render__combinationHeader"},[i("div",{class:"form-render__combinationHeaderText"},[e.title]),i(g,{onClick:A,style:{"--n-text-color":"var(--c-primary-color)"},text:!0,disabled:G.value>=F.value},{icon:()=>i(b,{component:u},null),default:()=>{var e;return(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.279"))||"新增"}})]),s(G.value).map(((o,r)=>i("section",{class:"form-render__combinationContentJson"},[i(J,{ref:e=>function(e,o){S.value[e]=o,w(j.value[e]||{},e)}(r,e),fieldList:e.properties,onFormChange:e=>function(e,{fieldKey:o,value:r}){!j.value[e]&&(j.value[e]={}),a.setIn(j.value[e],o,r),y()}(r,e)},null),i(g,{text:!0,class:"form-render__combinationClose",type:"error",onClick:()=>function(o){j.value.length>e.minGroupNum?(j.value.splice(o,1),S.value.splice(o,1)):j.value.splice(o,1,{}),y()}(r)},{icon:()=>i(b,{component:m},null)})])))])}}),y(j));export{G as JSON_COMBINATION};
1
+ import{defineComponent as e,ref as o,computed as n,watch as r,onMounted as t,inject as i,createVNode as l}from"vue";import{isField as a}from"@formily/core";import{Path as u}from"@formily/path";import{AddCircleOutline as m,RemoveCircle as s}from"@vicons/ionicons5";import{range as p,isNumber as c,isArray as f,isEqual as v}from"lodash-es";import"../../../../index.js";import{useDeepValidate as d}from"./hooks/useDeepValidate.js";import{connect as y,mapProps as h}from"@formily/vue";import{useDebounceFn as N,isObject as g}from"@vueuse/core";import{NButton as b,NIcon as x}from"naive-ui";import j from"../../../FormRender.vue.js";import{InjectionFormGlobalProps as C}from"../../../constants/index.js";import{formRenderLog as _,mergeDeepProperties as G}from"../../../utils/index.js";import{assignUpdateValue as I}from"../../../utils/schema.js";const S=y(e({name:"FormJsonCombination",props:{title:{type:String,default:""},value:{type:[String,Array]},maxGroupNum:{type:Number},minGroupNum:{type:Number,default:1},properties:{type:Array,default:()=>[]},showLabel:Boolean,onInput:{},onBlur:{},onChange:{}},emits:["update:value"],setup(e,{emit:y}){_("当前COMBINATION控件为json模式,推荐使用非json模式,FieldItem.jsonCombination=false");const h=N((function(){y("update:value",JSON.stringify(I.value))}),300),I=o([]),S=n((()=>I.value.length));function w(o,n=!1){f(o)&&(o.length||o.push(...p(e.minGroupNum).map((()=>({})))),o=JSON.stringify(o));const r=function(e){try{if(!e)return null;const o=JSON.parse(e);return Array.isArray(o)?o:null}catch(e){return null}}(o);var t;(t=r)&&!v(t,I.value)&&(r.splice(O.value),r.forEach((function(o,r){if(!g(o))return;I.value[r]=o,n&&G(o,e.properties)})),I.value.splice(r.length),I.value.forEach(F))}r((()=>e.value),(e=>w(e))),t((()=>{const o=`[${p(e.minGroupNum).map((()=>"{}")).join(",")}]`;w(e.value||o,!0),h()}));const A=o([]);function F(e,o){var n;null==(n=A.value[o])||n.setFieldState("*",(o=>{a(o)&&(o.value=u.getIn(e,o.path))}))}function J(){I.value.push(G({},e.properties)),h()}d().bindDeepValidate(A);const O=n((()=>c(e.maxGroupNum)?e.maxGroupNum<1?0:~~e.maxGroupNum:1/0));r(O,(e=>{S.value<=e||(I.value.splice(e),h(),A.value.splice(e))}),{immediate:!0});const B=j,k=i(C);return()=>l("section",{class:"form-render__combination"},[l("header",{class:"form-render__combinationHeader"},[l("div",{class:"form-render__combinationHeaderText"},[e.title]),l(b,{onClick:J,style:{"--n-text-color":"var(--c-primary-color)"},text:!0,disabled:S.value>=O.value},{icon:()=>l(x,{component:m},null),default:()=>{var e;return(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.279"))||"新增"}})]),p(S.value).map(((o,n)=>l("section",{class:"form-render__combinationContentJson"},[l(B,{ref:e=>function(e,o){A.value[e]=o,F(I.value[e]||{},e)}(n,e),fieldList:e.properties,components:null==k?void 0:k.components,onFormChange:e=>function(e,{fieldKey:o,value:n}){!I.value[e]&&(I.value[e]={}),u.setIn(I.value[e],o,n),h()}(n,e)},null),l(b,{text:!0,class:"form-render__combinationClose",type:"error",onClick:()=>function(o){I.value.length>e.minGroupNum?(I.value.splice(o,1),A.value.splice(o,1)):I.value.splice(o,1,{}),h()}(n)},{icon:()=>l(x,{component:s},null)})])))])}}),h(I));export{S as JSON_COMBINATION};
@@ -8,12 +8,18 @@ export declare const INPUT_NUMBER: import("vue").DefineComponent<{
8
8
  type: PropType<AnyFn>;
9
9
  required: true;
10
10
  };
11
+ pureInteger: {
12
+ type: BooleanConstructor;
13
+ };
11
14
  prefix: {
12
15
  type: (ObjectConstructor | StringConstructor | FunctionConstructor)[];
13
16
  };
14
17
  suffix: {
15
18
  type: (ObjectConstructor | StringConstructor | FunctionConstructor)[];
16
19
  };
20
+ precision: {
21
+ type: NumberConstructor;
22
+ };
17
23
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
18
24
  value: {
19
25
  type: (NumberConstructor | StringConstructor)[];
@@ -22,13 +28,21 @@ export declare const INPUT_NUMBER: import("vue").DefineComponent<{
22
28
  type: PropType<AnyFn>;
23
29
  required: true;
24
30
  };
31
+ pureInteger: {
32
+ type: BooleanConstructor;
33
+ };
25
34
  prefix: {
26
35
  type: (ObjectConstructor | StringConstructor | FunctionConstructor)[];
27
36
  };
28
37
  suffix: {
29
38
  type: (ObjectConstructor | StringConstructor | FunctionConstructor)[];
30
39
  };
31
- }>>, {}>;
40
+ precision: {
41
+ type: NumberConstructor;
42
+ };
43
+ }>>, {
44
+ pureInteger: boolean;
45
+ }>;
32
46
  export declare const INPUT_NUMBER_SLASH: import("vue").DefineComponent<{
33
47
  value: {
34
48
  type: (NumberConstructor | StringConstructor)[];
@@ -1 +1 @@
1
- import{defineComponent as e,watch as t,computed as n,createVNode as u,mergeProps as o}from"vue";import r from"../../../../../shared/components/InputNumberSlash/InputNumberSlash.js";import{connect as i,mapProps as a}from"@formily/vue";import{isString as l,isNumber as p}from"lodash-es";import{NInputNumber as s}from"naive-ui";import{useCommonInjection as m}from"../../hooks/useCommonInjection.js";import{createInputSlot as c,parseNumberFromMaybeString as v}from"../../utils/index.js";import{assignUpdateValue as f,assignClearBindVisited as y}from"../../utils/schema.js";const g=i(e({props:{value:{type:[Number,String]},onChange:{type:Function,required:!0},prefix:{type:[String,Function,Object]},suffix:{type:[String,Function,Object]}},setup(e){const o=c(e);m().injectValueValidate((()=>e.value)),t((()=>e.value),(t=>{if(null!=t)return!l(t)&&!p(t)||Number.isNaN(+t)?e.onChange(null):void e.onChange(+t)}));const r=n({get:()=>""===e.value?null:v(e.value),set:t=>{var n;return null==(n=e.onChange)?void 0:n.call(e,t)}}),i=m().injectValueBindKey(r);return()=>u(s,{key:i.value,value:r.value,"onUpdate:value":e=>r.value=e,"show-button":!1},o.value)}}),a(f,y)),h=i(e({props:{value:{type:[Number,String]},onChange:{type:Function,required:!0},prefix:{type:[String,Function,Object]},suffix:{type:[String,Function,Object]},precision:{type:Number}},setup(e){const t=m().injectValueBindKey((()=>e.value)),n=c(e);return()=>u(r,o(e,{key:t.value}),n.value)}}),a(f,y));export{g as INPUT_NUMBER,h as INPUT_NUMBER_SLASH};
1
+ import{defineComponent as e,watch as n,computed as t,createVNode as r,mergeProps as o}from"vue";import u from"../../../../../shared/components/InputNumberSlash/InputNumberSlash.js";import{connect as i,mapProps as p}from"@formily/vue";import{isString as l,isNumber as a,isInteger as s}from"lodash-es";import{NInputNumber as m}from"naive-ui";import{useCommonInjection as c}from"../../hooks/useCommonInjection.js";import{createInputSlot as v,parseNumberFromMaybeString as f}from"../../utils/index.js";import{assignUpdateValue as y,assignClearBindVisited as g}from"../../utils/schema.js";const b=i(e({props:{value:{type:[Number,String]},onChange:{type:Function,required:!0},pureInteger:{type:Boolean},prefix:{type:[String,Function,Object]},suffix:{type:[String,Function,Object]},precision:{type:Number}},setup(e){const u=v(e);c().injectValueValidate((()=>e.value)),n((()=>e.value),(n=>{if(null!=n)return!l(n)&&!a(n)||Number.isNaN(+n)?e.onChange(null):void e.onChange(+n)}));const i=t({get:()=>""===e.value?null:f(e.value),set:n=>{var t;return null==(t=e.onChange)?void 0:t.call(e,n)}}),p=c().injectValueBindKey(i);return()=>{const n={};return e.pureInteger&&(n.format=n=>s(n)?n.toString():a(n)&&null!=e.precision?n.toFixed(e.precision):n),r(m,o(n,{precision:e.precision,key:p.value,value:i.value,"onUpdate:value":e=>i.value=e,"show-button":!1}),u.value)}}}),p(y,g)),d=i(e({props:{value:{type:[Number,String]},onChange:{type:Function,required:!0},prefix:{type:[String,Function,Object]},suffix:{type:[String,Function,Object]},precision:{type:Number}},setup(e){const n=c().injectValueBindKey((()=>e.value)),t=v(e);return()=>r(u,o(e,{key:n.value}),t.value)}}),p(y,g));export{b as INPUT_NUMBER,d as INPUT_NUMBER_SLASH};
@@ -0,0 +1 @@
1
+ export declare function filterRemoteSearchPlugin(): import("../../../../../components/iho-table").TablePlugin;
@@ -0,0 +1 @@
1
+ import{createVNode as e}from"vue";import{isObject as o}from"@vue/shared";import"../../../index.js";import{IhoTableRenderHelper as i}from"../../utils/index.js";import r from"./remoteFilter.vue.js";import{defineTablePlugin as t}from"../../hooks/useTablePlugin.js";function n(){const n="filterRemoteSearchPlugin";return t({name:n,vxe(o){o.renderer.mixin({[n]:{showFilterFooter:!1,renderFilter:o=>e(r,{payload:o},null)}})},apply(e){e.fieldHooks.field.tap(n,((e,r,t,{$table:l})=>{var f;const a=null==(f=e.editRender)?void 0:f.props;return o(a)&&i.hasRemoteSearchFilter(a)?(e.filterRender={name:n},e.filters=[],t.filterConfig={iconMatch:"iho-table--iconfont iho-table-icon-filter",iconNone:"iho-table--iconfont iho-table-icon-filter",...t.filterConfig},e):e}))}})}export{n as filterRemoteSearchPlugin};
@@ -0,0 +1,68 @@
1
+ import { AnyObject } from '../../../../../shared/types';
2
+ import { PropType } from 'vue';
3
+ import { VxeColumnPropTypes } from 'vxe-table';
4
+ import { LowCodeTableFieldItem } from '../../../../../components/iho-table';
5
+ declare const _default: import("vue").DefineComponent<{
6
+ payload: {
7
+ type: PropType<VxeColumnPropTypes.FilterSlotParams>;
8
+ required: true;
9
+ };
10
+ }, {
11
+ props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
12
+ payload: {
13
+ type: PropType<VxeColumnPropTypes.FilterSlotParams>;
14
+ required: true;
15
+ };
16
+ }>> & {}>>;
17
+ searchFilterText: import("vue").Ref<string>;
18
+ loading: import("vue").Ref<boolean>;
19
+ optionsListRef: import("vue").Ref<AnyObject[]>;
20
+ lowCodeField: import("vue").ComputedRef<Partial<LowCodeTableFieldItem>>;
21
+ checkedRef: import("vue").Ref<string[]>;
22
+ containerStyleWithHeight: import("vue").ComputedRef<import("vue").CSSProperties>;
23
+ containerProps: {
24
+ ref: import("vue").Ref<any>;
25
+ onScroll: () => void;
26
+ style: Partial<CSSStyleDeclaration>;
27
+ };
28
+ wrapperProps: import("vue").ComputedRef<{
29
+ style: {
30
+ width: string;
31
+ height: string;
32
+ marginTop: string;
33
+ };
34
+ }>;
35
+ list: import("vue").Ref<import("@vueuse/core").UseVirtualListItem<AnyObject>[]>;
36
+ reset: () => void;
37
+ close: () => void;
38
+ confirm: () => void;
39
+ SlotRender: import("vue").DefineComponent<{
40
+ renderer: {
41
+ type: PropType<string | import("vue").Component | import("../../../../../shared/types").AnyFn>;
42
+ required: true;
43
+ };
44
+ rootSlots: {
45
+ type: PropType<Record<string, import("../../../../../shared/types").AnyFn>>;
46
+ };
47
+ }, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
48
+ renderer: {
49
+ type: PropType<string | import("vue").Component | import("../../../../../shared/types").AnyFn>;
50
+ required: true;
51
+ };
52
+ rootSlots: {
53
+ type: PropType<Record<string, import("../../../../../shared/types").AnyFn>>;
54
+ };
55
+ }>>, {}>;
56
+ NButton: any;
57
+ NButtonGroup: any;
58
+ NCheckbox: any;
59
+ NCheckboxGroup: any;
60
+ NInput: any;
61
+ NSpin: any;
62
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
63
+ payload: {
64
+ type: PropType<VxeColumnPropTypes.FilterSlotParams>;
65
+ required: true;
66
+ };
67
+ }>>, {}>;
68
+ export default _default;
@@ -0,0 +1 @@
1
+ import e from"./remoteFilter.vue2.js";import r from"../../../../../_virtual/_plugin-vue_export-helper.js";var t=r(e,[["__file","remoteFilter.vue"]]);export{t as default};
@@ -0,0 +1 @@
1
+ import{defineComponent as e,ref as l,computed as a,openBlock as t,createElementBlock as o,createVNode as n,unref as r,withCtx as i,createElementVNode as u,mergeProps as d,normalizeProps as s,guardReactiveProps as p,Fragment as v,renderList as c,createBlock as f,createTextVNode as w,toDisplayString as m,normalizeStyle as _}from"vue";import g from"../../../../../shared/components/SlotRender/SlotRender.js";import{NInput as y,NSpin as h,NCheckboxGroup as b,NCheckbox as L,NButtonGroup as C,NButton as k}from"naive-ui";import{useFilter as B}from"../pluginHooks/useFilter.js";import{getLowCodeFieldFromField as j}from"../../utils/index.js";const R={class:"iho-table__filterWrapper"},F=["title"],S={class:"iho-table__filterFooter"};var W=e({__name:"remoteFilter",props:{payload:{type:Object,required:!0}},setup(e){const W=e,x=l(""),H=l(!1),I=l([]),P=a((()=>j(W.payload.column)||{})),U=l([]),{containerStyleWithHeight:q,containerProps:z,wrapperProps:O,list:A}=B(W,I);function D(){}function E(){}function G(){}return(l,a)=>{var B,j;return t(),o("section",R,[n(r(y),{value:x.value,"onUpdate:value":a[0]||(a[0]=e=>x.value=e)},null,8,["value"]),n(r(h),{show:H.value},{default:i((()=>[n(r(b),{value:U.value,"onUpdate:value":a[1]||(a[1]=e=>U.value=e)},{default:i((()=>[u("section",d(r(z),{style:r(q),class:"iho-table__filterListWrapper"}),[u("section",s(p(r(O))),[(t(!0),o(v,null,c(r(A),(l=>(t(),o("div",{class:"iho-table__filterListItem",key:l.data.value},[n(r(L),{value:l.data.value},{default:i((()=>[u("div",{class:"iho-table__filterListItemContent",title:l.data.label},[r(P).filterLabelRender?(t(),f(r(g),d({key:0,renderer:r(P).filterLabelRender},e.payload,{option:l.data}),null,16,["renderer","option"])):(t(),o(v,{key:1},[w(m(l.data.label),1)],64))],8,F)])),_:2},1032,["value"])])))),128))],16)],16)])),_:1},8,["value"])])),_:1},8,["show"]),u("footer",S,[u("section",null,[w((null==(B=window.getLanguageByCode)?void 0:B.call(window,"10010.1.39"))||"已选择"),u("span",{style:_({color:"var(--c-primary-color)"})},m(U.value.length),5),w((null==(j=window.getLanguageByCode)?void 0:j.call(window,"10010.1.417"))||"项")]),n(r(C),{size:"small"},{default:i((()=>[n(r(k),{onClick:D},{default:i((()=>{var e;return[w((null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.509"))||"清空")]})),_:1}),n(r(k),{onClick:E},{default:i((()=>{var e;return[w((null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.28"))||"取消")]})),_:1}),n(r(k),{type:"primary",onClick:G},{default:i((()=>{var e;return[w((null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.27"))||"确定")]})),_:1})])),_:1})])])}}});export{W as default};
@@ -1,4 +1,4 @@
1
- import { CSSProperties, PropType } from 'vue';
1
+ import { PropType } from 'vue';
2
2
  import { VxeColumnPropTypes, VxeTableConstructor, VxeTableMethods, VxeTablePrivateMethods } from 'vxe-table';
3
3
  import { LowCodeTableFieldItem } from '../../../../../components/iho-table';
4
4
  declare const _default: import("vue").DefineComponent<{
@@ -23,11 +23,14 @@ declare const _default: import("vue").DefineComponent<{
23
23
  checkedCacheRef: import("vue").Ref<string[]>;
24
24
  searchFilterText: import("vue").Ref<string>;
25
25
  close: () => Promise<void>;
26
- OPTION_ITEM_HEIGHT: number;
27
- viewCapacity: import("vue").ComputedRef<number>;
28
26
  customFilterMethod: import("vue").ComputedRef<any>;
29
27
  filteredList: import("vue").ComputedRef<import("vxe-table").VxeTableDefines.FilterOption[]>;
30
- list: import("vue").Ref<import("@vueuse/core").UseVirtualListItem<import("vxe-table").VxeTableDefines.FilterOption>[]>;
28
+ partCheckAll: import("vue").WritableComputedRef<boolean>;
29
+ partIndeterminate: import("vue").ComputedRef<boolean>;
30
+ checkAll: import("vue").WritableComputedRef<boolean>;
31
+ indeterminate: import("vue").ComputedRef<boolean>;
32
+ containerStyleWithHeight: import("vue").ComputedRef<import("vue").CSSProperties>;
33
+ list: import("vue").Ref<import("@vueuse/core").UseVirtualListItem<import("../../../../../shared/types").AnyObject>[]>;
31
34
  containerProps: {
32
35
  ref: import("vue").Ref<any>;
33
36
  onScroll: () => void;
@@ -40,11 +43,6 @@ declare const _default: import("vue").DefineComponent<{
40
43
  marginTop: string;
41
44
  };
42
45
  }>;
43
- partCheckAll: import("vue").WritableComputedRef<boolean>;
44
- partIndeterminate: import("vue").ComputedRef<boolean>;
45
- checkAll: import("vue").WritableComputedRef<boolean>;
46
- indeterminate: import("vue").ComputedRef<boolean>;
47
- containerStyleWithHeight: import("vue").ComputedRef<CSSProperties>;
48
46
  confirm: () => void;
49
47
  reset: () => void;
50
48
  loading: import("vue").Ref<boolean>;