cnhis-design-vue 3.2.2-beta.2 → 3.2.2-beta.9

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 (116) hide show
  1. package/README.md +87 -87
  2. package/es/components/biunique-chat/index.d.ts +750 -562
  3. package/es/components/biunique-chat/index.js +1 -1
  4. package/es/components/biunique-chat/src/Index.vue.d.ts +1213 -0
  5. package/es/components/biunique-chat/src/Index.vue.js +1 -0
  6. package/es/components/biunique-chat/src/Index.vue2.js +1 -0
  7. package/es/components/biunique-chat/src/api/index.d.ts +2 -5
  8. package/es/components/biunique-chat/src/api/index.js +1 -1
  9. package/es/components/biunique-chat/src/components/ChatFile.vue.d.ts +241 -0
  10. package/es/components/biunique-chat/src/components/ChatFile.vue.js +1 -0
  11. package/es/components/biunique-chat/src/components/ChatFile.vue2.js +1 -0
  12. package/es/components/biunique-chat/src/components/ChatFooter.vue.d.ts +3 -5
  13. package/es/components/biunique-chat/src/components/ChatFooter.vue2.js +1 -1
  14. package/es/components/biunique-chat/src/components/ChatHeader.vue.d.ts +639 -0
  15. package/es/components/biunique-chat/src/components/ChatHeader.vue2.js +1 -1
  16. package/es/components/biunique-chat/src/components/ChatMain.vue.d.ts +61 -5
  17. package/es/components/biunique-chat/src/components/ChatMain.vue2.js +1 -1
  18. package/es/components/biunique-chat/src/components/ChatRecord.vue.d.ts +101 -0
  19. package/es/components/biunique-chat/src/components/ChatRecord.vue.js +1 -0
  20. package/es/components/biunique-chat/src/components/ChatRecord.vue2.js +1 -0
  21. package/es/components/biunique-chat/src/components/ChatSet.vue.d.ts +246 -0
  22. package/es/components/biunique-chat/src/components/ChatSet.vue.js +1 -0
  23. package/es/components/biunique-chat/src/components/ChatSet.vue2.js +1 -0
  24. package/es/components/biunique-chat/src/components/PersonProfile.vue.d.ts +59 -0
  25. package/es/components/biunique-chat/src/components/PersonProfile.vue.js +1 -0
  26. package/es/components/biunique-chat/src/components/PersonProfile.vue2.js +1 -0
  27. package/es/components/biunique-chat/src/components/SiderList.vue.d.ts +18 -28
  28. package/es/components/biunique-chat/src/components/SiderList.vue2.js +1 -1
  29. package/es/components/biunique-chat/src/hooks/useState.d.ts +7 -0
  30. package/es/components/biunique-chat/src/hooks/useState.js +1 -0
  31. package/es/components/biunique-chat/src/types/index.d.ts +10 -0
  32. package/es/components/biunique-chat/src/types/index.js +1 -0
  33. package/es/components/biunique-chat/src/utils/index.d.ts +6 -0
  34. package/es/components/biunique-chat/src/utils/index.js +1 -0
  35. package/es/components/biunique-chat/style/iconfont.ttf +0 -0
  36. package/es/components/biunique-chat/style/index.css +1 -1
  37. package/es/components/button-print/src/utils/print.d.ts +1 -0
  38. package/es/components/button-print/src/utils/print.js +1 -1
  39. package/es/components/calendar/index.d.ts +2 -11
  40. package/es/components/calendar/src/Calendar.vue.d.ts +1 -11
  41. package/es/components/callback/src/components/render/popupMaps.d.ts +2 -0
  42. package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
  43. package/es/components/classification/src/index.vue.d.ts +3 -3
  44. package/es/components/expand-field/src/components/form.vue2.js +1 -1
  45. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
  46. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
  47. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
  48. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useLeft.js +1 -1
  49. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
  50. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  51. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  52. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  53. package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
  54. package/es/components/fabric-chart/src/hooks/useCommon.d.ts +1 -0
  55. package/es/components/fabric-chart/src/hooks/useCommon.js +1 -1
  56. package/es/components/fabric-chart/src/hooks/useCumputedPoint.js +1 -1
  57. package/es/components/field-set/src/FieldColor.vue.d.ts +1 -1
  58. package/es/components/field-set/src/components/edit-dialog.vue.d.ts +1 -1
  59. package/es/components/form-config/src/hooks/useSortalbeConfig.js +1 -1
  60. package/es/components/form-render/src/hooks/useFormEvent.js +1 -1
  61. package/es/components/form-render/src/hooks/useSelectedSetting.d.ts +3 -4
  62. package/es/components/form-render/src/hooks/useSelectedSetting.js +1 -1
  63. package/es/components/iho-table/index.d.ts +2 -0
  64. package/es/components/iho-table/src/IhoTable.vue.d.ts +2 -0
  65. package/es/components/iho-table/src/IhoTable.vue2.js +1 -1
  66. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue.d.ts +1 -0
  67. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue2.js +1 -1
  68. package/es/components/iho-table/src/plugins/headerPlugin.js +1 -1
  69. package/es/components/iho-table/src/plugins/verticalTablePlugin/src/hooks/index.d.ts +5 -0
  70. package/es/components/iho-table/src/plugins/verticalTablePlugin/src/hooks/useHeaderCSS.js +1 -1
  71. package/es/components/iho-table/src/plugins/verticalTablePlugin/src/hooks/useHoverColumn.js +1 -1
  72. package/es/components/iho-table/src/plugins/verticalTablePlugin/src/renderer.js +1 -1
  73. package/es/components/iho-table/src/plugins/verticalTablePlugin/src/types.d.ts +1 -0
  74. package/es/components/iho-table/src/plugins/verticalTablePlugin/src/utils.d.ts +1 -0
  75. package/es/components/iho-table/src/plugins/verticalTablePlugin/src/utils.js +1 -1
  76. package/es/components/iho-table/src/types/index.d.ts +1 -0
  77. package/es/components/iho-table/src/utils/index.d.ts +1 -1
  78. package/es/components/iho-table/src/utils/index.js +1 -1
  79. package/es/components/iho-table/style/index.css +1 -1
  80. package/es/components/index.css +1 -1
  81. package/es/components/index.js +1 -1
  82. package/es/components/node_modules/naive-ui/node_modules/date-fns/docs/logo.svg +26 -0
  83. package/es/components/node_modules/naive-ui/node_modules/date-fns/docs/logotype.svg +1 -0
  84. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  85. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  86. package/es/components/select-person/src/SearchMultiple.vue.d.ts +6 -0
  87. package/es/components/step-notice/index.d.ts +1 -0
  88. package/es/components/step-notice/src/StepNotice.vue.d.ts +2 -0
  89. package/es/components/step-notice/src/StepNotice.vue2.js +1 -1
  90. package/es/env.d.ts +25 -25
  91. package/es/shared/assets/img/failure.png.js +1 -1
  92. package/es/shared/assets/img/no-permission.png.js +1 -1
  93. package/es/shared/assets/img/nodata.png.js +1 -1
  94. package/es/shared/assets/img/notfound.png.js +1 -1
  95. package/es/shared/assets/img/qr.png.js +1 -1
  96. package/es/shared/assets/img/success.png.js +1 -1
  97. package/es/shared/assets/img/table_style_2.png.js +1 -1
  98. package/es/shared/assets/img/video.png.js +1 -1
  99. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  100. package/es/shared/assets/img/xb_big.png.js +1 -1
  101. package/es/shared/assets/img/xb_small.png.js +1 -1
  102. package/es/shared/hooks/index.js +1 -1
  103. package/es/shared/hooks/useTheme.d.ts +1 -0
  104. package/es/shared/hooks/useTheme.js +1 -1
  105. package/es/shared/package.json.js +1 -1
  106. package/package.json +2 -2
  107. package/es/components/biunique-chat/src/BiuniqueChat.vue.d.ts +0 -1005
  108. package/es/components/biunique-chat/src/BiuniqueChat.vue.js +0 -1
  109. package/es/components/biunique-chat/src/BiuniqueChat.vue2.js +0 -1
  110. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  111. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  112. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  113. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  114. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  115. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  116. package/es/shared/utils/tapable/index.d.ts +0 -139
@@ -1 +1 @@
1
- import{onUnmounted as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as n,drawLine as i,drawPoint as o}from"../useDraw.js";import{useGrid as l}from"../useGrid.js";import{useBirthProcessCumputedPoint as r}from"../useCumputedPoint.js";import{bus as a}from"../useEvent.js";import{useCommon as s}from"../useCommon.js";import{getPointRange as f,getIndex as c,isEffectiveNode as u,getTime as d}from"../../utils/index.js";import{cloneDeep as p,omit as m,flatten as v}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import{useIntervalFn as g}from"@vueuse/core";function y(y,h,k,x,L){const{computedX:P,computedY:b,getXValue:w,getYValue:A}=r(h),{xCellWidth:I,pointSelectionStyle:C,originX:K,endX:j,originY:E,endY:X,event:M,scaleValues:V,xAxis:T,startTime:Y,timeXCell:S,itemList:$,dialog:F}=h,O=new Map,D=new Set,_=p(V);let z=[],N=null;const G=new Set;l(y,h);const{getEqualXTypes:J,handleAddPrevent:q,setPrevAndNextPoint:R}=s(y,k,h),{pause:W,resume:B}=g((()=>{!function(){if(!G.size)return;for(const e of G)e.set("opacity",1===e.opacity?.5:1);y.value.renderAll()}()}),800);function H(){_.forEach((e=>{const{range:t=[],spaceValue:n}=e;n&&(t[0]||t[1])&&e.dataList.forEach(((t,n)=>{t.show&&(!function(e,t){const{max:n={},min:o={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function a({show:e=!1,value:n,name:o,lineStyle:l}){if(!e||!n)return;const r=b(t.type,t.range,n),a=i([K,r,j,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});M.hovered&&o&&(a.on("mousemove",(({pointer:e})=>{x.point={...e||{x:a.left,y:a.top}},x.list=[`${o} ${n}${t.unit||""}`],x.show=!0})),a.on("mouseout",(()=>{x.show=!1}))),y.value.add(a)}a(n),a(o),a(l),a(r)}(t,e),ee(t,n,e))}))}))}function Q(e=[]){if(!(null==N?void 0:N.areaPos))return[];const{startPos:t,endPos:n}=N.areaPos,[i,o]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:fe()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=r))}function U(e){F.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),Z()},onNegativeClick:()=>Z(),onClose:()=>Z()})}function Z(){N&&y.value.remove(N),N=null}function ee(e,t,n){var l;const{type:r,unit:a,dataList:s=[]}=n,f=[];O.set(e.key,[]),function(e,t){G.size&&[...G].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&G.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,c)=>{!function(e,l,c,u){var d;let p,v,g=u;l.key&&(g=s.find((e=>e.key===l.key)));const{pointAttr:L={},lineAttr:P={},title:b="",key:C,type:K="circle"}=g,j=se(u.list[c+1],n);e&&j&&!l.breakpoint&&e[0]!==j[0]&&(v=i([...e,...j],P));const E=f[c-1],X={origin:{data:l,title:b,key:u.key,selfKey:C,unit:a,type:r,dataIndex:t,index:c,lineAttr:P},__type:"main",leftLine:E,rightLine:v,...L,...h.event.hovered?h.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:h.event};e&&(E||(X.leftLine=null),p=o(K,{left:e[0],top:e[1],...X}));f.push(v),p&&(p.originLeft=p.left,p.originTop=p.top,function(e){M.hovered&&(e.on("mouseover",(()=>{re(e,"hover")})),e.on("mouseout",(()=>{x.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ae(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),M.hovered&&re(e),function(e){var t,n,i,o;const{originLeft:l,originTop:r,left:a,top:s,origin:f}=e,c=~~((a-l)/I);if(a>l+I){if(0===z.length){ne(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[l,r],l,r]),null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,"stroke","transparent"),null==(o=null==(i=e.rightLine)?void 0:i.set)||o.call(i,"stroke","transparent")}const u=l+I*c;if(z.every((e=>e.left!==u))){const t=w(u),n=A(f.type,s);z.push({data:{time:t,value:n,...f.selfKey!==f.key?{key:f.selfKey}:{}},left:u,top:s}),ne(e,[...e.prevPointer,u,s])}if(z.length<c&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+I*l,r=z.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=z.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=z[l-1]||{left:n,top:i},f=~~((r.left-(t-I))/I),c=(r.top-s.top)/f;a.top=s.top+c,a.left=t,a.data={time:w(t),value:A(o.type,a.top),...o.selfKey!==o.key?{key:o.selfKey}:{}},z.splice(l,0,a),ne(e,[s.left,s.top,a.left,a.top])}}l++}}(e,c),e.nextPoint){const t=O.get(f.key);!function(e,t){const{left:n,top:i,origin:o}=t,l=I/2,r=e.findIndex((e=>Math.abs(n-e.left)<l&&Math.abs(i-e.top)<l&&o.index!==e.origin.index));r>-1?(t.set({scaleX:2.5,scaleY:2.5}),t.coincidePoint=e[r]):t.set({scaleX:t.scale,scaleY:t.scale})}(t,e),null==t||t.forEach((e=>{e.left<=l||f.index===e.origin.index||(e.left<a?te(e,"#999"):te(e,e.origin.lineAttr.stroke))}))}}!function(e){var t,n;const{left:i}=e;if(z.length>0&&i<z[z.length-1].left){for(const e of D)e.left>i&&(e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e));if(z=z.filter((e=>e.left<=i)),0===z.length){null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,e.origin.lineAttr);for(const e of D)e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e)}if(z.length>0){const t=z.at(-1);e.prevPointer=[t.left,t.top]}}}(e)}(e)})),e.on("mouseup",(t=>{if(x.show=!1,1===t.button){const{type:t,selfKey:n,dataIndex:i}=e.origin,o={...e.origin,data:{...e.origin.data,time:w(e.left),value:A(t,e.top)}};if(y.value.discardActiveObject(),z.length>0){const l=_.find((e=>e.type===t));let r=-1;const a=z.map((e=>e.data));if(e.nextPoint){if(2.5!==e.scaleX)return void oe({dataIndex:i,scaleValue:l});const t=e.coincidePoint.origin,n=t.data;r=t.index;const o=a.findIndex((e=>e.time===n.time));o>-1?a[o].value=n.value:a.push({...a.at(-1),time:n.time,value:n.value})}const s=l.dataList.findIndex((e=>e.key===n));k("add",{...m(o,["index","selfKey","lineAttr"]),dataIndex:s,key:n,data:a}),ie({...o,data:a,coincideIndex:r})}else k("change",{...m(o,["selfKey","lineAttr"]),key:n}),ie(o,"change")}}))}(p),null==(d=O.get(u.key))||d.push(p))}(se(l,n),l,c,e)})),Promise.all(O.get(e.key)).then((t=>{const n=f.filter((e=>e));R(t),y.value.add(...n,...t),function(e,t){const{max:n={},min:i={}}=t.panicValue||{},{max:o={},min:l={}}=t.diffValue||{};function r({show:t=!1,value:n,flickerable:i},o){!t&&n&&i&&e.forEach((e=>{const t=e.origin.data.value;"max"===o&&t<n||"min"===o&&t>n||G.add(e)}))}r(n,"max"),r(i,"min"),r(o,"max"),r(l,"min")}(t,e)}))}function te(e,t){["stroke","fill"].forEach((n=>{const i=e[n];i&&!["transparent","#fff","#ffffff","#FFFFFF"].includes(i)&&i!==t&&e.set(n,t)})),e.rightLine&&e.rightLine.stroke!==t&&e.rightLine.set("stroke",t)}function ne(e,t){const[,,n,o]=t;e.clone((l=>{l.set({left:n,top:o,scaleX:1,scaleY:1}),e.prevPointer=[n,o];const r=i(t,e.origin.lineAttr);l.leftLine=r,D.add(l),y.value.add(r,l)}))}function ie(e,t="add",n=1){const{data:i,index:o,key:l,type:r,coincideIndex:a}=e;let{dataIndex:s}=e;const f=_.find((e=>e.type===r)),u=f.dataList.find(((e,t)=>(s=t,e.key===l)));switch(t){case"remove":u.list.splice(o,n),u.list[o-1]&&(u.list[o-1].breakpoint=!0);break;case"change":u.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=c(e,u.list),n=Array.isArray(i)?i:[i];u.list.splice(t,a>-1?a-t+1:0,...n);break}}oe({dataIndex:s,scaleValue:f})}function oe(e){var t,n,i;if(D.size&&(null==(t=y.value)||t.remove(...le([...D]))),D.clear(),z=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=y.value)||n.remove(...le(O.get(o.key))),O.delete(o.key),ee(o,t,i)}else O.size&&(null==(i=y.value)||i.remove(...le(fe()))),O.clear(),H()}function le(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine)})),t}function re(e,t="moving"){const{title:n,type:i,data:o,unit:l}=e.origin;x.point={x:e.left,y:e.top};const r=`${"hover"===t?o.value:A(i,e.top)}`;x.list=[`${n} ${r}${l||""}`,`时间 ${w(e.left).slice(-5)}`],x.show=!0}function ae(e){e.setCoords();const t=6e4/S,n=e.prevPoint?e.prevPoint.left+t:K,i=j;e.top<E&&e.set("top",E),e.top>X&&e.set("top",X),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}function se(e,t){if(u(e)&&function(e){const t=Date.parse(T.list.at(-1)),n=d(e);return n>=Y&&n<=t}(e.time)){const n=P(e.time),i=b(t.type,t.range,e.value);return[n,i<E?E:i>X?X:i]}}function fe(){return v(Array.from(O.values()))}return e((()=>{W()})),H(),function(){if(!M.evented)return;let e=!1,i={x:0,y:0};y.value.on("mouse:up",(t=>{if(3===t.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=K&&t<=j&&n>=E&&n<=X)if(e.target){if("main"!==e.target.__type)return;i(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:o,maxTop:l}=f(e.target);fe().forEach((i=>{"main"===i.__type&&i.left>t&&i.left<n&&i.top>o&&i.top<l&&L.list.push({renderItem:()=>i.origin.title,origin:{...i.origin},mode:"remove",pointer:e.pointer})})),1===L.list.length&&(L.show=!1,console.log("当前时间段内无可删除节点"))}else i(e.pointer,null,["新增节点"]),$.forEach((n=>{J(fe(),t,"key",2*I).includes(n.linkKey||n.key)||L.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,linkKey:n.linkKey},pointer:e.pointer})})),1===L.list.length&&(L.show=!1,q("repeat"),console.log("当前时间段内无可新增节点"));function i(e,t,n){Object.assign(L,{point:e,show:!0,target:t,list:n})}}(t),1===t.button&&e){e=!1;const t=Q();t.length>0?U((()=>{const e=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return ie(n[0],"remove",n.length),n.map((e=>({...m(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(t);k("remove",e)})):a.emit(N)}})),y.value.on("mouse:down",(t=>{1!==t.button||t.target||(e=!0,i=t.pointer)})),y.value.on("mouse:move",(o=>{if(!e)return;const{x:l,y:r}=i,{x:a,y:s}=o.pointer;N&&y.value.remove(N),N=new t.Rect({...n,fill:"#CAF982",opacity:.4,...C,left:l,top:r,width:a-l,height:s-r,objectCaching:!0}),N.areaPos={startPos:i,endPos:o.pointer},y.value.add(N)}))}(),{redrawPoints:oe,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(k("remove",n),ie(n,"remove")):(Object.assign(n,{data:{time:w(e.pointer.x),value:A(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),k("add",n),ie({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:ae,setPopup:re,updateData:ie,getGridPoints:fe,getContainPoints:Q,showDialog:U,removeCurrentSelection:Z}}export{y as useCenter};
1
+ import{onUnmounted as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as n,drawLine as i,drawPoint as o}from"../useDraw.js";import{useGrid as l}from"../useGrid.js";import{useBirthProcessCumputedPoint as r}from"../useCumputedPoint.js";import{bus as a}from"../useEvent.js";import{useCommon as s}from"../useCommon.js";import{getPointRange as f,getIndex as c,isEffectiveNode as u,getTime as d}from"../../utils/index.js";import{cloneDeep as p,last as m,omit as v,flatten as g}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import{useIntervalFn as y}from"@vueuse/core";function h(h,k,x,L,P){const{computedX:w,computedY:b,getXValue:A,getYValue:I}=r(k),{xCellWidth:C,pointSelectionStyle:K,originX:j,endX:E,originY:X,endY:V,event:T,scaleValues:M,xAxis:S,startTime:Y,timeXCell:$,itemList:F,dialog:O}=k,D=new Map,_=new Set,z=p(M);let N=[],G=null;const J=new Set;l(h,k);const{getEqualXTypes:q,handleAddPrevent:R,setPrevAndNextPoint:W,getPointEventProps:B}=s(h,x,k),{pause:H,resume:Q}=y((()=>{!function(){if(!J.size)return;for(const e of J)e.set("opacity",1===e.opacity?.5:1);h.value.renderAll()}()}),800);function U(){z.forEach((e=>{const{range:t=[],spaceValue:n}=e;n&&(t[0]||t[1])&&e.dataList.forEach(((t,n)=>{t.show&&(!function(e,t){const{max:n={},min:o={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function a({show:e=!1,value:n,name:o,lineStyle:l}){if(!e||!n)return;const r=b(t.type,t.range,n),a=i([j,r,E,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});T.hovered&&o&&(a.on("mousemove",(({pointer:e})=>{L.point={...e||{x:a.left,y:a.top}},L.list=[`${o} ${n}${t.unit||""}`],L.show=!0})),a.on("mouseout",(()=>{L.show=!1}))),h.value.add(a)}a(n),a(o),a(l),a(r)}(t,e),ne(t,n,e))}))}))}function Z(e=[]){if(!(null==G?void 0:G.areaPos))return[];const{startPos:t,endPos:n}=G.areaPos,[i,o]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:ue()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=r))}function ee(e){O.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),te()},onNegativeClick:()=>te(),onClose:()=>te()})}function te(){G&&h.value.remove(G),G=null}function ne(e,t,n){var l;const{type:r,unit:a,dataList:s=[]}=n,f=[];D.set(e.key,[]),function(e,t){J.size&&[...J].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&J.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,c)=>{!function(e,l,c,u){var d;let p,g,y=u;l.key&&(y=s.find((e=>e.key===l.key)));const{pointAttr:k={},lineAttr:P={},title:w="",key:b,type:K="circle"}=y,j=ce(u.list[c+1],n);e&&j&&!l.breakpoint&&e[0]!==j[0]&&(g=i([...e,...j],P));const E=f[c-1],X={origin:{data:l,title:w,key:u.key,selfKey:b,unit:a,type:r,dataIndex:t,index:c,lineAttr:P},__type:"main",leftLine:E,rightLine:g,...k,...B()};e&&(E||(X.leftLine=null),p=o(K,{left:e[0],top:e[1],...X}));f.push(g),p&&(p.originLeft=p.left,p.originTop=p.top,function(e){T.hovered&&(e.on("mouseover",(()=>{se(e,"hover")})),e.on("mouseout",(()=>{L.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{fe(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),T.hovered&&se(e),function(e){var t,n,i,o;const{originLeft:l,originTop:r,left:a,top:s,origin:f}=e,c=~~((a-l)/C);if(a>l+C){if(0===N.length){oe(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[l,r],l,r]),null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,"stroke","transparent"),null==(o=null==(i=e.rightLine)?void 0:i.set)||o.call(i,"stroke","transparent")}const u=l+C*c;if(N.every((e=>e.left!==u))){const t=A(u),n=I(f.type,s);N.push({data:{time:t,value:n,...f.selfKey!==f.key?{key:f.selfKey}:{}},left:u,top:s}),oe(e,[...e.prevPointer,u,s])}if(N.length<c&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+C*l,r=N.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=N.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=N[l-1]||{left:n,top:i},f=~~((r.left-(t-C))/C),c=(r.top-s.top)/f;a.top=s.top+c,a.left=t,a.data={time:A(t),value:I(o.type,a.top),...o.selfKey!==o.key?{key:o.selfKey}:{}},N.splice(l,0,a),oe(e,[s.left,s.top,a.left,a.top])}}l++}}(e,c),e.nextPoint){const t=D.get(f.key);!function(e,t){const{left:n,top:i,origin:o}=t,l=C/2,r=e.findIndex((e=>Math.abs(n-e.left)<l&&Math.abs(i-e.top)<l&&o.index!==e.origin.index));r>-1?(t.set({scaleX:2.5,scaleY:2.5}),t.coincidePoint=e[r]):t.set({scaleX:t.scale,scaleY:t.scale})}(t,e),null==t||t.forEach((e=>{e.left<=l||f.index===e.origin.index||(e.left<a?ie(e,"#999"):ie(e,e.origin.lineAttr.stroke))}))}}!function(e){var t,n;const{left:i}=e;if(N.length>0&&i<N[N.length-1].left){for(const e of _)e.left>i&&(e.leftLine&&h.value.remove(e.leftLine),h.value.remove(e));if(N=N.filter((e=>e.left<=i)),0===N.length){null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,e.origin.lineAttr);for(const e of _)e.leftLine&&h.value.remove(e.leftLine),h.value.remove(e)}if(N.length>0){const t=m(N);e.prevPointer=[t.left,t.top]}}}(e)}(e)})),e.on("mouseup",(t=>{if(L.show=!1,1===t.button){const{type:t,selfKey:n,dataIndex:i}=e.origin,o={...e.origin,data:{...e.origin.data,time:A(e.left),value:I(t,e.top)}};if(h.value.discardActiveObject(),N.length>0){const l=z.find((e=>e.type===t));let r=-1;const a=N.map((e=>e.data));if(e.nextPoint){if(2.5!==e.scaleX)return void re({dataIndex:i,scaleValue:l});const t=e.coincidePoint.origin,n=t.data;r=t.index;const o=a.findIndex((e=>e.time===n.time));o>-1?a[o].value=n.value:a.push({...m(a),time:n.time,value:n.value})}const s=l.dataList.findIndex((e=>e.key===n));x("add",{...v(o,["index","selfKey","lineAttr"]),dataIndex:s,key:n,data:a}),le({...o,data:a,coincideIndex:r})}else x("change",{...v(o,["selfKey","lineAttr"]),key:n}),le(o,"change")}}))}(p),null==(d=D.get(u.key))||d.push(p))}(ce(l,n),l,c,e)})),Promise.all(D.get(e.key)).then((t=>{const n=f.filter((e=>e));W(t),h.value.add(...n,...t),function(e,t){const{max:n={},min:i={}}=t.panicValue||{},{max:o={},min:l={}}=t.diffValue||{};function r({show:t=!1,value:n,flickerable:i},o){!t&&n&&i&&e.forEach((e=>{const t=e.origin.data.value;"max"===o&&t<n||"min"===o&&t>n||J.add(e)}))}r(n,"max"),r(i,"min"),r(o,"max"),r(l,"min")}(t,e)}))}function ie(e,t){["stroke","fill"].forEach((n=>{const i=e[n];i&&!["transparent","#fff","#ffffff","#FFFFFF"].includes(i)&&i!==t&&e.set(n,t)})),e.rightLine&&e.rightLine.stroke!==t&&e.rightLine.set("stroke",t)}function oe(e,t){const[,,n,o]=t;e.clone((l=>{l.set({left:n,top:o,scaleX:1,scaleY:1}),e.prevPointer=[n,o];const r=i(t,e.origin.lineAttr);l.leftLine=r,_.add(l),h.value.add(r,l)}))}function le(e,t="add",n=1){const{data:i,index:o,key:l,type:r,coincideIndex:a}=e;let{dataIndex:s}=e;const f=z.find((e=>e.type===r)),u=f.dataList.find(((e,t)=>(s=t,e.key===l)));switch(t){case"remove":u.list.splice(o,n),u.list[o-1]&&(u.list[o-1].breakpoint=!0);break;case"change":u.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=c(e,u.list),n=Array.isArray(i)?i:[i];u.list.splice(t,a>-1?a-t+1:0,...n);break}}re({dataIndex:s,scaleValue:f})}function re(e){var t,n,i;if(_.size&&(null==(t=h.value)||t.remove(...ae([..._]))),_.clear(),N=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=h.value)||n.remove(...ae(D.get(o.key))),D.delete(o.key),ne(o,t,i)}else D.size&&(null==(i=h.value)||i.remove(...ae(ue()))),D.clear(),U()}function ae(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine)})),t}function se(e,t="moving"){const{title:n,type:i,data:o,unit:l}=e.origin;L.point={x:e.left,y:e.top};const r=`${"hover"===t?o.value:I(i,e.top)}`;L.list=[`${n} ${r}${l||""}`,`时间 ${A(e.left).slice(-5)}`],L.show=!0}function fe(e){e.setCoords();const t=6e4/$,n=e.prevPoint?e.prevPoint.left+t:j,i=E;e.top<X&&e.set("top",X),e.top>V&&e.set("top",V),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}function ce(e,t){if(u(e)&&function(e){const t=Date.parse(m(S.list)),n=d(e);return n>=Y&&n<=t}(e.time)){const n=w(e.time),i=b(t.type,t.range,e.value);return[n,i<X?X:i>V?V:i]}}function ue(){return g(Array.from(D.values()))}return e((()=>{H()})),U(),function(){if(!T.evented)return;let e=!1,i={x:0,y:0};h.value.on("mouse:up",(t=>{if(3===t.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=j&&t<=E&&n>=X&&n<=V)if(e.target){if("main"!==e.target.__type)return;i(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:o,maxTop:l}=f(e.target);ue().forEach((i=>{"main"===i.__type&&i.left>t&&i.left<n&&i.top>o&&i.top<l&&P.list.push({renderItem:()=>i.origin.title,origin:{...i.origin},mode:"remove",pointer:e.pointer})})),1===P.list.length&&(P.show=!1,console.log("当前时间段内无可删除节点"))}else i(e.pointer,null,["新增节点"]),F.forEach((n=>{q(ue(),t,"key",2*C).includes(n.linkKey||n.key)||P.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,linkKey:n.linkKey},pointer:e.pointer})})),1===P.list.length&&(P.show=!1,R("repeat"),console.log("当前时间段内无可新增节点"));function i(e,t,n){Object.assign(P,{point:e,show:!0,target:t,list:n})}}(t),1===t.button&&e){e=!1;const t=Z();t.length>0?ee((()=>{const e=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return le(n[0],"remove",n.length),n.map((e=>({...v(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(t);x("remove",e)})):a.emit(G)}})),h.value.on("mouse:down",(t=>{1!==t.button||t.target||(e=!0,i=t.pointer)})),h.value.on("mouse:move",(o=>{if(!e)return;const{x:l,y:r}=i,{x:a,y:s}=o.pointer;G&&h.value.remove(G),G=new t.Rect({...n,fill:"#CAF982",opacity:.4,...K,left:l,top:r,width:a-l,height:s-r,objectCaching:!0}),G.areaPos={startPos:i,endPos:o.pointer},h.value.add(G)}))}(),{redrawPoints:re,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(x("remove",n),le(n,"remove")):(Object.assign(n,{data:{time:A(e.pointer.x),value:I(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),x("add",n),le({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:fe,setPopup:se,updateData:le,getGridPoints:ue,getContainPoints:Z,showDialog:ee,removeCurrentSelection:te}}export{h as useCenter};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as n,defaultTextStyle as r,defaultStyle as l}from"../useDraw.js";import{useBirthProcessCumputedPoint as a}from"../useCumputedPoint.js";import"../useEvent.js";import{drawScaleNumber as s}from"../useScaleColumn.js";import{useCommon as u}from"../useCommon.js";import"vue";import{getScaleNumberList as d}from"../../utils/index.js";import{cloneDeep as c}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import"@vueuse/core";function f(f,p,g,h,m,v,y,k){const{getYValue:w,getXValue:j}=a(p),{getEqualXTypes:x,handleAddPrevent:b,isGridLimit:X}=u(f,g,p),{originY:W,endY:C,borderStyle:E,left:S,itemList:Y,scaleValues:K,originX:L,endX:M,yCellHeight:N,markHeight:V,canvasWidth:G,canvasHeight:H,xCellWidth:T}=p;!function(){if(!S)return;const{title:t,titleWidth:i,titleStyle:o}=S,n=e({width:i,height:C-W+V,...E},{value:t.split("").join("\n"),...o||{}},{left:0,top:W},!0);f.value.add(n)}(),K.forEach(((e,i)=>{var o,a;const{range:u,spaceValue:c,title:p,unit:g,titleStyle:h,spaceGridNumber:m=1,showNumber:v,showMaxMinNumber:y,titleMargin:k=[5,30],margin:w=5}=e,j="left"===e.layout?L-w:M+w,x=[],b=d(u,c),X=b.length;b.forEach(((t,i)=>{const o=0===i?C-5:C-i*N*m;!v||(0===i||i===X-1)&&!y||x.push(s(String(t),{...e,position:e.layout},j,o))}));const W="left"===e.layout?"right":"left",E=p&&n(["left"===e.layout?L-k[0]:M+k[0],(null!=(a=null==(o=x.at(-1))?void 0:o.top)?a:330)-N-k[1]],{value:`${p}${g?"\n"+g:""}`,...r,...h,textAlign:W,originX:W,originY:"bottom"}),S=new t.Group([...x,...E?[E]:[]],{objectCaching:!1,...l});f.value.add(S),S.sendToBack()})),function(){const e=new t.Rect({width:L-S.titleWidth,height:C-W+V,left:S.titleWidth,top:W,...i,originX:"left",originY:"top",...E});f.value.add(e);const n=c(Y),r=c(S.externalIconList||[]).map((t=>({...t,isExternal:!0}))),{projectNameMargin:l=[5,30],titleWidth:a=20}=S;let s=C+V-l[0];const u=a+l[1];r.concat(n.reverse()).forEach((t=>{s-=10;const e=t.title,{text:i,icon:n}=o(e,t,{text:{left:u,top:s},icon:{leftX:u,topY:s,originX:"center",...t.isExternal?{evented:!1,selectable:!1}:{},origin:{linkKey:t.linkKey}}});var r;s-=i.height||30,n.set("left",n.left+n.width/2),(r=n).on("moving",(()=>{r.set("originX","center"),X(r)?(m(r),v(r)):h.show=!1})),r.on("mouseup:before",(t=>{if(h.show=!1,0===t.e.button&&X(r)){const t=r.origin.linkKey||r.origin.key;if(x(k(),r.left,"key",2*T).includes(t))b("repeat");else{const e={data:{time:j(r.left),value:w(r.origin.type,r.top),...r.origin.linkKey?{key:r.origin.key}:{}},...r.origin};g("add",e),y({...e,key:t})}}!function(t){t.setCoords().set({originX:"left",left:t.originLeft,top:t.originTop})}(r)})),f.value.add(i,n)}))}(),f.value.add(new t.Rect({left:0,top:0,width:G-E.strokeWidth,height:H-E.strokeWidth,fill:"transparent",...E}))}export{f as useLeft};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as n,defaultTextStyle as r,defaultStyle as l}from"../useDraw.js";import{useBirthProcessCumputedPoint as s}from"../useCumputedPoint.js";import"../useEvent.js";import{drawScaleNumber as a}from"../useScaleColumn.js";import{useCommon as u}from"../useCommon.js";import"vue";import{getScaleNumberList as d}from"../../utils/index.js";import{cloneDeep as c,last as f}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import"@vueuse/core";function p(p,g,h,m,v,y,k,w){const{getYValue:j,getXValue:x}=s(g),{getEqualXTypes:b,handleAddPrevent:X,isGridLimit:W}=u(p,h,g),{originY:C,endY:E,borderStyle:S,left:Y,itemList:K,scaleValues:L,originX:M,endX:N,yCellHeight:V,markHeight:G,canvasWidth:H,canvasHeight:T,xCellWidth:A}=g;!function(){if(!Y)return;const{title:t,titleWidth:i,titleStyle:o}=Y,n=e({width:i,height:E-C+G,...S},{value:t.split("").join("\n"),...o||{}},{left:0,top:C},!0);p.value.add(n)}(),L.forEach(((e,i)=>{var o,s;const{range:u,spaceValue:c,title:g,unit:h,titleStyle:m,spaceGridNumber:v=1,showNumber:y,showMaxMinNumber:k,titleMargin:w=[5,30],margin:j=5}=e,x="left"===e.layout?M-j:N+j,b=[],X=d(u,c),W=X.length;X.forEach(((t,i)=>{const o=0===i?E-5:E-i*V*v;!y||(0===i||i===W-1)&&!k||b.push(a(String(t),{...e,position:e.layout},x,o))}));const C="left"===e.layout?"right":"left",S=g&&n(["left"===e.layout?M-w[0]:N+w[0],(null!=(s=null==(o=f(b))?void 0:o.top)?s:330)-V-w[1]],{value:`${g}${h?"\n"+h:""}`,...r,...m,textAlign:C,originX:C,originY:"bottom"}),Y=new t.Group([...b,...S?[S]:[]],{objectCaching:!1,...l});p.value.add(Y),Y.sendToBack()})),function(){const e=new t.Rect({width:M-Y.titleWidth,height:E-C+G,left:Y.titleWidth,top:C,...i,originX:"left",originY:"top",...S});p.value.add(e);const n=c(K),r=c(Y.externalIconList||[]).map((t=>({...t,isExternal:!0}))),{projectNameMargin:l=[5,30],titleWidth:s=20}=Y;let a=E+G-l[0];const u=s+l[1];r.concat(n.reverse()).forEach((t=>{a-=10;const e=t.title,{text:i,icon:n}=o(e,t,{text:{left:u,top:a},icon:{leftX:u,topY:a,originX:"center",...t.isExternal?{evented:!1,selectable:!1}:{},origin:{linkKey:t.linkKey}}});var r;a-=i.height||30,n.set("left",n.left+n.width/2),(r=n).on("moving",(()=>{r.set("originX","center"),W(r)?(v(r),y(r)):m.show=!1})),r.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&W(r)){const t=r.origin.linkKey||r.origin.key;if(b(w(),r.left,"key",2*A).includes(t))X("repeat");else{const e={data:{time:x(r.left),value:j(r.origin.type,r.top),...r.origin.linkKey?{key:r.origin.key}:{}},...r.origin};h("add",e),k({...e,key:t})}}!function(t){t.setCoords().set({originX:"left",left:t.originLeft,top:t.originTop})}(r)})),p.value.add(i,n)}))}(),p.value.add(new t.Rect({left:0,top:0,width:H-S.strokeWidth,height:T-S.strokeWidth,fill:"transparent",...S}))}export{p as useLeft};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i}from"../useDraw.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import{bus as n}from"../useEvent.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getIndex as a}from"../../utils/index.js";import{cloneDeep as l,flatten as s}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as d}from"../../constants/index.js";import"naive-ui";import"@vueuse/core";function c(c,u,f,h,m,g,p,v,x){const{computedX:k,getXValue:y}=o(u),{getEqualXTypes:X,handleAddPrevent:b,isGridLimit:w}=r(c,f,u),{other:P,yCellHeight:j,xCellWidth:z,endX:C,originX:E,originY:A,endY:L,markHeight:M,event:S,topGridYCellHeight:I}=u,T=new Map,H=l(P);function W(){var o;if(!(null==(o=null==H?void 0:H.horizontal)?void 0:o.length))return;const n="horizontal";T.set(n,[]);const{horizontal:r}=H;let a=A+j/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:d={},textStyle:u={},data:f}=o;let h=null;f.forEach(((o,f)=>{const{time:m,value:g}=o,p=k(m);if(!D(p))return;const v=e(s,{...d,left:p,top:a}),x=p+v.width/2+2,y=i([x,a],{value:g,...u,originX:"left"}),X=new t.Group([v,y],{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer"});Object.assign(X,{originLeft:p,iconHalfWidth:v.width/2,origin:{type:"other",key:n,dataIndex:r,index:f,data:o,title:l},limitX:{x1:E,x2:C-X.width}}),h&&(X.limitX.x1=h.left,h.limitX.x2=X.left,X.prevPoint=h,h.nextPoint=X),h=X,q(X),T.get(n).push(X),c.value.add(X)})),a+=j}))}function Y(){var t;if(!(null==(t=null==H?void 0:H.vertical)?void 0:t.length))return;const i="vertical";T.set(i,[]);const{vertical:o}=H;o.forEach(((t,o)=>{const{show:n=!0,marginTop:r=0,textStyle:a={},data:l,time:s}=t,d=k(s);if(!n||!D(d))return;const{lineHeight:u=j}=a;let f=A+r+u/2;l.forEach(((t,n)=>{const r=e(String(t),{...a,lockMovementY:!0,left:d,originX:"left",top:f,origin:{type:"other",key:i,dataIndex:o,index:n,data:{value:t}}});f+=u,q(r),T.get(i).push(r),c.value.add(r)}));const h=T.get(i).filter((t=>t.origin.dataIndex===o)),m=Math.max(...h.map((t=>t.width))),g=d>C-m;h.forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=m,g&&t.setCoords().set("originX","right")}))}))}function V(t,e="add"){const{dataIndex:i,data:o,index:n,key:r}=t,l=H[r],s=["mark"].includes(r)?l.dataList[i]:l[i];switch(e){case"remove":s.data.splice(n,1);break;case"change":s.data[n]=o;break;default:{const t=Array.isArray(o)?o[0].time:o.time,e=a(t,s.data),i=Array.isArray(o)?o:[o];s.data.splice(e,0,...i);break}}G(t)}function G(t){var e;const{key:i}=t;switch(null==(e=c.value)||e.remove(...T.get(i)),T.delete(i),i){case"horizontal":W();break;case"vertical":Y();break;case"mark":O()}}function O(){if(!(null==P?void 0:P.mark)||!M)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=P.mark,a=i([E-5,L+M/2],{value:t,...o,originX:"right"});c.value.add(a);const l=L+M,s=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=k(i);if(!D(r))return;let a=L;o.forEach((t=>{let i=!1;const o=e("circleAndText",{...n,text:t.text,left:r,top:a,origin:{data:t,key:"mark",type:"other"}}),d=o.height;a+d<=l&&a>=L?(o.set("top",a+d/2),a+=d):(i||(a=L,i=!0),o.set("top",a-d/2),a-=d),s.push(o),q(o),c.value.add(o)}))})),function(t){const e=t=>{var e,i;return null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart},i=t.find((t=>e(t))),o=t.find((t=>!e(t)&&t.left>i.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:E,x2:C};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(s)}function q(t){if(S.hovered&&(t.on("mouseover",(()=>{B(t)})),t.on("mouseout",(()=>{h.show=!1}))),!S.evented)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e);t.on("moving",(()=>{i?function(t){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<A&&t.set("top",A);const e=L+M-t.height/2;t.top>e&&t.set("top",e)}i&&(t.originLeft=t.left+t.iconHalfWidth)}(t):(g(t),function(t){const e=t.left+t.maxTextWidth>C?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((i=>i.setCoords().set({originX:e,left:t.left})))}(t)),S.hovered&&B(t)})),t.on("mouseup",(n=>{var r;if(h.show=!1,1===n.button){i&&function(t){var e,i;if("mark"===t.origin.key){if((null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),i=Math.min(...e);t.startPoint.limitX.x2=i}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=y(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};c.value.discardActiveObject(),f("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(m.point={x:t.left,y:t.top},m.show=!0,m.target=t,m.list=d.map((t=>({...t,renderItem:()=>t.label}))))}))}function B(t){h.point={x:t.left,y:"mark"===t.origin.key?t.top:t.top+I/2};const e=!t.origin.isMenu&&t.originLeft?t.originLeft:t.left;h.list=[`时间 ${y(e).slice(-5)}`],"mark"===t.origin.key&&h.list.unshift(t.origin.data.name+" "),h.show=!0}function D(t){return t>=E&&t<=C}return function(){var t;if(!(null==(t=null==H?void 0:H.horizontal)?void 0:t.length))return;const{horizontal:i}=H,o=E-5;let n=A+j/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l}=t,s=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r,isMenu:!0},originLeft:o,originTop:n});var d;(d=s).on("moving",(()=>{d.set("originX","center"),w(d)?B(d):h.show=!1})),d.on("mouseup:before",(t=>{if(h.show=!1,0===t.e.button&&w(d))if(X(T.get("horizontal"),d.left,"key",z).includes(d.origin.key))b("repeat"),console.log("重复节点");else{const t={data:{time:y(d.left),value:d.origin.defaultAddValue},...d.origin};f("add",t),V(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(d)})),c.value.add(s),n+=j}))}(),W(),Y(),O(),n.on((()=>{const t="horizontal",e=p(T.get(t));e.length>0?v((()=>{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 s(Object.keys(e).map((t=>{const i=e[t];return H.horizontal[t].data.splice(i[0].index,i.length),i})))}(e);G({key:t}),f("remove",i)})):x()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};f(i,o),"remove"===i&&V(o,i)}}}export{c as useOther};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i}from"../useDraw.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import{bus as n}from"../useEvent.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getIndex as a}from"../../utils/index.js";import{cloneDeep as l,flatten as s}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as d}from"../../constants/index.js";import"naive-ui";import"@vueuse/core";function c(c,u,f,h,g,m,p,v,x){const{computedX:k,getXValue:y}=o(u),{getEqualXTypes:X,handleAddPrevent:P,isGridLimit:b,getPointEventProps:w}=r(c,f,u),{other:E,yCellHeight:j,xCellWidth:z,endX:A,originX:C,originY:L,endY:M,markHeight:S,event:I,topGridYCellHeight:T}=u,H=new Map,W=l(E);function Y(){var o;if(!(null==(o=null==W?void 0:W.horizontal)?void 0:o.length))return;const n="horizontal";H.set(n,[]);const{horizontal:r}=W;let a=L+j/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:d={},textStyle:u={},data:f}=o;let h=null;f.forEach(((o,f)=>{const{time:g,value:m}=o,p=k(g);if(!$(p))return;const v=e(s,{...d,left:p,top:a}),x=p+v.width/2+2,y=i([x,a],{value:m,...u,originX:"left"}),X=new t.Group([v,y],{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer"});Object.assign(X,{originLeft:p,iconHalfWidth:v.width/2,origin:{type:"other",key:n,dataIndex:r,index:f,data:o,title:l},limitX:{x1:C,x2:A-X.width}}),h&&(X.limitX.x1=h.left,h.limitX.x2=X.left,X.prevPoint=h,h.nextPoint=X),h=X,B(X),H.get(n).push(X),c.value.add(X)})),a+=j}))}function V(){var t;if(!(null==(t=null==W?void 0:W.vertical)?void 0:t.length))return;const i="vertical";H.set(i,[]);const{vertical:o}=W;o.forEach(((t,o)=>{const{show:n=!0,marginTop:r=0,textStyle:a={},data:l,time:s}=t,d=k(s);if(!n||!$(d))return;const{lineHeight:c=j}=a;let u=L+r+c/2;l.forEach(((t,n)=>{const r=e(String(t),{...a,lockMovementY:!0,left:d,originX:"left",top:u,origin:{type:"other",key:i,dataIndex:o,index:n,data:{value:t}},...w()});u+=c,B(r),H.get(i).push(r)}));const f=H.get(i).filter((t=>t.origin.dataIndex===o)),h=Math.max(...f.map((t=>t.width))),g=d>A-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")}))})),c.value.add(...H.get(i))}function G(t,e="add"){const{dataIndex:i,data:o,index:n,key:r}=t,l=W[r],s=["mark"].includes(r)?l.dataList[i]:l[i];switch(e){case"remove":s.data.splice(n,1);break;case"change":s.data[n]=o;break;default:{const t=Array.isArray(o)?o[0].time:o.time,e=a(t,s.data),i=Array.isArray(o)?o:[o];s.data.splice(e,0,...i);break}}O(t)}function O(t){var e;const{key:i}=t;switch(null==(e=c.value)||e.remove(...H.get(i)),H.delete(i),i){case"horizontal":Y();break;case"vertical":V();break;case"mark":q()}}function q(){if(!(null==E?void 0:E.mark)||!S)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=E.mark,a=i([C-5,M+S/2],{value:t,...o,originX:"right"});c.value.add(a);const l=M+S,s=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=k(i);if(!$(r))return;let a=M;o.forEach((t=>{let i=!1;const o=e("circleAndText",{...n,text:t.text,left:r,top:a,origin:{data:t,key:"mark",type:"other"}}),d=o.height;a+d<=l&&a>=M?(o.set("top",a+d/2),a+=d):(i||(a=M,i=!0),o.set("top",a-d/2),a-=d),s.push(o),B(o),c.value.add(o)}))})),function(t){const e=t=>{var e,i;return null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart},i=t.find((t=>e(t))),o=t.find((t=>!e(t)&&t.left>i.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:C,x2:A};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(s)}function B(t){if(I.hovered&&(t.on("mouseover",(()=>{D(t)})),t.on("mouseout",(()=>{h.show=!1}))),!I.evented)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e);t.on("moving",(()=>{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<L&&t.set("top",L);const e=M+S-t.height/2;t.top>e&&t.set("top",e)}i&&(t.originLeft=t.left+t.iconHalfWidth)}(t):(m(t),function(t){const e=t.left+t.maxTextWidth>A?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((i=>i.setCoords().set({originX:e,left:t.left})))}(t)),I.hovered&&D(t)})),t.on("mouseup",(n=>{var r;if(h.show=!1,1===n.button){i&&function(t){var e,i;if("mark"===t.origin.key){if((null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),i=Math.min(...e);t.startPoint.limitX.x2=i}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=y(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};c.value.discardActiveObject(),f("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(g.point={x:t.left,y:t.top},g.show=!0,g.target=t,g.list=d.map((t=>({...t,renderItem:()=>t.label}))))}))}function D(t){h.point={x:t.left,y:"mark"===t.origin.key?t.top:t.top+T/2};const e=!t.origin.isMenu&&t.originLeft?t.originLeft:t.left;h.list=[`时间 ${y(e).slice(-5)}`],"mark"===t.origin.key&&h.list.unshift(t.origin.data.name+" "),h.show=!0}function $(t){return t>=C&&t<=A}return function(){var t;if(!(null==(t=null==W?void 0:W.horizontal)?void 0:t.length))return;const{horizontal:i}=W,o=C-5;let n=L+j/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l}=t,s=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r,isMenu:!0},originLeft:o,originTop:n});var d;(d=s).on("moving",(()=>{d.set("originX","center"),b(d)?D(d):h.show=!1})),d.on("mouseup:before",(t=>{if(h.show=!1,0===t.e.button&&b(d))if(X(H.get("horizontal"),d.left,"key",z).includes(d.origin.key))P("repeat"),console.log("重复节点");else{const t={data:{time:y(d.left),value:d.origin.defaultAddValue},...d.origin};f("add",t),G(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(d)})),c.value.add(s),n+=j}))}(),Y(),V(),q(),n.on((()=>{const t="horizontal",e=p(H.get(t));e.length>0?v((()=>{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 s(Object.keys(e).map((t=>{const i=e[t];return W.horizontal[t].data.splice(i[0].index,i.length),i})))}(e);O({key:t}),f("remove",i)})):x()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};f(i,o),"remove"===i&&G(o,i)}}}export{c as useOther};
@@ -1 +1 @@
1
- import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as n}from"vue";import{useDialog as l}from"naive-ui";import{defaultBorderStyle as o}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as u}from"date-fns";import{getChildrenSize as s}from"../../utils/index.js";import"../useEvent.js";import{cloneDeep as d,range as c,flatten as p}from"lodash-es";import"../temperature/useShadow.js";import{OTHER_MENU as m}from"../../constants/index.js";import"@vueuse/core";import{useTop as v}from"./useTop.js";import{useLeft as h}from"./useLeft.js";import{useCenter as f}from"./useCenter.js";import{useOther as g}from"./useOther.js";function y(y,w,x,b,j,C){const Y=l(),H=e(),S=e(),D=e(),A=t((()=>w.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),M=t((()=>{var e;return null!=(e=w.data.left.width)?e:0})),T=t((()=>{const{grid:e}=w.data;return e.mainXCell*e.subXCell})),X=t((()=>{const{grid:e}=w.data;return e.mainYCell*e.subYCell})),G=t((()=>{const{treeData:e=[],show:t=!0}=w.data.top;return t?s(e):0})),V=t((()=>w.data.top.tree.cellHeight)),k=t((()=>V.value*G.value)),P=t((()=>te(_("drug")||"top"))),L=t((()=>P.value+k.value)),N=t((()=>{var e;return Date.parse((null==(e=w.data.xAxis)?void 0:e.startTime)||u(new Date,"yyyy-MM-dd HH:mm:ss"))})),O=t((()=>{const e=d(w.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=c(T.value/t+1).map((r=>0===r?e.startTime:u(new Date(N.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:M.value}})),E=function(){const{show:e=!0}=w.data.top;if(!e)return[];const t=d(w.data.top.treeData);let a=0;const{cellWidth:r,cellHeight:i}=w.data.top.tree;return function e(t,n=0){t.forEach((t=>{var l;const o={top:a*i+P.value,left:n*r,width:r,height:i};if(a++,null==(l=t.children)?void 0:l.length){a--;const r=s(t.children);o.height=r*i,e(t.children,n+1)}else o.width=M.value-o.left;Object.assign(t,o)}))}(t),t}(),W=t((()=>te(_("xAxis")||"center"))),I=t((()=>{var e;const{width:t,right:a}=w.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),q=t((()=>te(_("intraoperatively")||"bottom"))),z=t((()=>{var e;const{show:t=!0,height:a}=(null==(e=w.data.other)?void 0:e.mark)||{};return t&&a?a:0})),B=t((()=>q.value+(w.data.height-k.value-O.value.height-z.value))),F=t((()=>(I.value-M.value)/T.value)),J=t((()=>(B.value-q.value)/X.value)),K=t((()=>O.value.spaceTimeStamp/F.value)),Q=t((()=>{const{scaleValues:e}=w.data;return p(e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))))})),R=t((()=>ae("pulse"))),U=t((()=>ae("temperature"))),Z=t((()=>{var e;return(null==(e=w.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),$=a({canvasWidth:w.data.width,canvasHeight:w.data.height,borderStyle:{...o,...w.data.borderStyle},pointSelectionStyle:w.data.pointSelectionStyle||{},grid:w.data.grid,top:w.data.top,left:w.data.left,other:w.data.other,topGridYNumber:r(G),topGridYCellHeight:r(V),topGridOriginY:r(P),topGridEndY:r(L),treeData:E,xAxis:r(O),originYXAxis:r(W),startTime:r(N),timeXCell:r(K),gridXNumber:r(T),gridYNumber:r(X),xCellWidth:r(F),yCellHeight:r(J),originX:r(M),endX:r(I),originY:r(q),endY:r(B),markHeight:r(z),itemList:r(Q),scaleValues:w.data.scaleValues,pulseYCell:r(R),temperatureYCell:r(U),event:r(Z),dialog:Y});function _(e){let t="";return Object.entries(A.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function ee(e){const t=A.value[e],a=O.value.height;switch(t){case"drug":return k.value;case"xAxis":return a;default:return w.data.height-k.value-a}}function te(e){switch(e){case"top":return 0;case"center":return ee("top");default:return ee("top")+ee("center")}}function ae(e){const{scaleValues:t}=w.data,a=t.find((t=>t.type===e));return J.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await n(),v(y,$,x,j);const{redrawPoints:e,clickMenu:t,moveLimit:a,setPopup:r,updateData:i,getGridPoints:l,getContainPoints:o,showDialog:u,removeCurrentSelection:s}=f(y,$,x,j,C);h(y,$,x,j,a,r,i,l);const{clickMenu:d}=g(y,$,x,j,C,a,o,u,s);S.value=e,D.value=e=>{const{item:a}=e;a.type&&m.map((e=>e.type)).includes(a.type)?d(e):t(e)}})),{propItems:$,redrawPoints:S,select:H,clickMenu:D}}export{y as useSurgicalAnesthesiaChart};
1
+ import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as n}from"vue";import{useDialog as l}from"naive-ui";import{defaultBorderStyle as o}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as u}from"date-fns";import{getChildrenSize as s}from"../../utils/index.js";import{cloneDeep as d,range as c,flatten as p}from"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import{OTHER_MENU as m}from"../../constants/index.js";import"@vueuse/core";import{useTop as v}from"./useTop.js";import{useLeft as h}from"./useLeft.js";import{useCenter as f}from"./useCenter.js";import{useOther as g}from"./useOther.js";function y(y,w,x,b,j,C){const Y=l(),H=e(),S=e(),D=e(),A=t((()=>w.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),M=t((()=>{var e;return null!=(e=w.data.left.width)?e:0})),T=t((()=>{const{grid:e}=w.data;return e.mainXCell*e.subXCell})),X=t((()=>{const{grid:e}=w.data;return e.mainYCell*e.subYCell})),G=t((()=>{const{treeData:e=[],show:t=!0}=w.data.top;return t?s(e):0})),V=t((()=>w.data.top.tree.cellHeight)),k=t((()=>V.value*G.value)),P=t((()=>te(_("drug")||"top"))),L=t((()=>P.value+k.value)),N=t((()=>{var e;return Date.parse((null==(e=w.data.xAxis)?void 0:e.startTime)||u(new Date,"yyyy-MM-dd HH:mm:ss"))})),O=t((()=>{const e=d(w.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=c(T.value/t+1).map((r=>0===r?e.startTime:u(new Date(N.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:M.value}})),E=function(){const{show:e=!0}=w.data.top;if(!e)return[];const t=d(w.data.top.treeData);let a=0;const{cellWidth:r,cellHeight:i}=w.data.top.tree;return function e(t,n=0){t.forEach((t=>{var l;const o={top:a*i+P.value,left:n*r,width:r,height:i};if(a++,null==(l=t.children)?void 0:l.length){a--;const r=s(t.children);o.height=r*i,e(t.children,n+1)}else o.width=M.value-o.left;Object.assign(t,o)}))}(t),t}(),W=t((()=>te(_("xAxis")||"center"))),I=t((()=>{var e;const{width:t,right:a}=w.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),q=t((()=>te(_("intraoperatively")||"bottom"))),z=t((()=>{var e;const{show:t=!0,height:a}=(null==(e=w.data.other)?void 0:e.mark)||{};return t&&a?a:0})),B=t((()=>q.value+(w.data.height-k.value-O.value.height-z.value))),F=t((()=>(I.value-M.value)/T.value)),J=t((()=>(B.value-q.value)/X.value)),K=t((()=>O.value.spaceTimeStamp/F.value)),Q=t((()=>{const{scaleValues:e}=w.data;return p(e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))))})),R=t((()=>ae("pulse"))),U=t((()=>ae("temperature"))),Z=t((()=>{var e;return(null==(e=w.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),$=a({canvasWidth:w.data.width,canvasHeight:w.data.height,borderStyle:{...o,...w.data.borderStyle},pointSelectionStyle:w.data.pointSelectionStyle||{},grid:w.data.grid,top:w.data.top,left:w.data.left,other:w.data.other,topGridYNumber:r(G),topGridYCellHeight:r(V),topGridOriginY:r(P),topGridEndY:r(L),treeData:E,xAxis:r(O),originYXAxis:r(W),startTime:r(N),timeXCell:r(K),gridXNumber:r(T),gridYNumber:r(X),xCellWidth:r(F),yCellHeight:r(J),originX:r(M),endX:r(I),originY:r(q),endY:r(B),markHeight:r(z),itemList:r(Q),scaleValues:w.data.scaleValues,pulseYCell:r(R),temperatureYCell:r(U),event:r(Z),dialog:Y});function _(e){let t="";return Object.entries(A.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function ee(e){const t=A.value[e],a=O.value.height;switch(t){case"drug":return k.value;case"xAxis":return a;default:return w.data.height-k.value-a}}function te(e){switch(e){case"top":return 0;case"center":return ee("top");default:return ee("top")+ee("center")}}function ae(e){const{scaleValues:t}=w.data,a=t.find((t=>t.type===e));return J.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await n(),v(y,$,x,j);const{redrawPoints:e,clickMenu:t,moveLimit:a,setPopup:r,updateData:i,getGridPoints:l,getContainPoints:o,showDialog:u,removeCurrentSelection:s}=f(y,$,x,j,C);h(y,$,x,j,a,r,i,l);const{clickMenu:d}=g(y,$,x,j,C,a,o,u,s);S.value=e,D.value=e=>{const{item:a}=e;a.type&&m.map((e=>e.type)).includes(a.type)?d(e):t(e)}})),{propItems:$,redrawPoints:S,select:H,clickMenu:D}}export{y as useSurgicalAnesthesiaChart};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as c,getFloorNumber as d,isValidValue as p,setOtherType as f,isEffectiveNode as h,getTime as v,getIndex as g,deleteProperty as y}from"../../utils/index.js";import"../useEvent.js";import{useCommon as m}from"../useCommon.js";import"vue";import{cloneDeep as x,flatten as b}from"lodash-es";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as j,PAIN_MENU as w,OVERLAP as L}from"../../constants/index.js";function k(k,Y,E,M,$,O,C,P,A,I){r(k,Y);const{getEqualXTypes:R,handleAddPrevent:T}=m(k,E,Y),{createShadowLines:V}=t(),{left:X,xScaleList:z,xCellWidth:D,yCellHeight:F,originX:H,endX:_,originY:W,endY:q,itemList:G,event:B,vitalSignsOriginY:J,painOriginY:K,hospitalizationDate:N,config:Q,canvasHeight:U}=Y,Z=new Set,ee=["xinmai","mai"],te=new Map,ie=new Set,ne=new Set,oe=new Set,le=x(X.yScaleValue);function se(t){var o;const l=le.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(Z.size&&k.value.remove(...Z),Z.clear(),te.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=te.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of te)t.push(e[1]),e[0]===ee[0]&&e[1].forEach((e=>{(te.get(ee[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),a=n[i],u=o[r],c=n[i-1],d=n[i+1],p=o[r-1],f=o[r+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&s.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]);s.push([a,u].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(s.push(f),g()):g()})),e}(),{mode:s,style:r={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...r,strokeWidth:1});if(["slash","line"].includes(s)){l.set({fill:"transparent",stroke:r.stroke||"#f00"});const e=[];if(["slash"].includes(s))e.push(...V(t,r._angle,r.space)),e.forEach((e=>{Object.assign(e,{...n,...r}),Z.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...b(t)],{...r,originX:"center"});e.push(n),Z.add(n)}))}k.value.add(...e)}Z.add(l),k.value.add(l)}))}}function re(){var e;const t=le.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},L,X.overlap||{}),l=[];ie.size&&[...ie].forEach((e=>{[...ne].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(o(r,{...i[e]||{},...s}))}}}))})),setTimeout((()=>{k.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),oe.add(e)}))}))}function ae(e,t,r){var u;const{type:c,riseStyle:h={},noRiseStyle:v={},verifiedStyle:g={},reduceStyle:y={},pacemaker:m={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:w={},dataList:L=[],list:M=[]}=r,{type:O,textStyle:P,showConnectLine:I=!1}=j,R=[],T=[],V=[];let X=null;if(null==(u=e.list)||u.forEach(((u,j)=>{const z=a(c)?L.find((e=>e.key===u.key)):e,H=de(u,r),_=e.list[j+1],W=_?de(_,r):void 0,q=_?a(c)?L.find((e=>e.key===_.key)):e:{},{title:G=""}=z;if("脉搏"===G&&"脉搏"!==q.title||"脉搏"!==G&&"脉搏"===q.title||!H||!W||d(H[0],1)!==d(W[0],1))H&&X&&(H[0]=X),X=null;else{const e=H[0]-D/2;H[0]=e+D/4,W[0]=X=H[0]+D/2}const N={};N.value=function(e,t,i){if(!(null==e?void 0:e.length)||!Q.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=J.originY+F?e[1]+F:e[1]-F,s=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return V.push(s),{obj:s,top:-F}}(H,u,z),function(e,t,r,a){var u,d;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(c))return;const{lineAttr:f={}}=r,{value:m}=a;let x,b,j,w,L;if(t.noRise&&v.show){const t=S(v)?$(c,M,35):e[1];if(v.text)j=l([e[0],S(v)?t:t+5],{value:v.text.split("").join("\n"),originY:"top",...v.style});else{const i=t+2*F;j=s([e[0],t,i],{...v.style})}V.push(j)}t.rise&&h.show&&h.text&&(w=l([e[0],e[1]-(m?F:0)-5],{value:h.text.split("").join("\n"),originY:"bottom",...h.style}),V.push(w));t.verified&&(L=l([e[0],e[1]-(m?F:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),V.push(L));if(p(t.physicsReduce)||p(t.drugReduce)){const l=$(c,M,null!=(u=t.physicsReduce)?u:t.drugReduce),s=l<e[1]&&(null==Q?void 0:Q.hypothermyViewCustom)?e[0]+D/2:e[0];x=i([...e,s,l],{...f,...y.line,...n}),b=o((null==(d=null==y?void 0:y.point)?void 0:d.type)||"circle",{left:s,top:l,...y.point,...n,originY:l===U?"bottom":"center"}),x&&V.push(x),b&&V.push(b)}Object.assign(a,{reduceLine:{obj:x,type:"line"},noRiseText:{obj:j,top:v.text?5:2*F,isFixed:S(v)},riseText:{obj:w,top:(m?-F:0)-5},verifiedText:{obj:L,top:(m?-F:0)-5},reducePoint:{obj:b,type:"reduce"}})}(H,u,z,N),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;const o=Math.max(...M),r=Math.min(...M);let a,u,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*F,i=[e[1]-F/2,t];t<J.originY&&(t=e[1]+2.5*F,i=[t,e[1]+F/2]),a=s([e[0],i[0],i[1]],x,"up"),V.push(a)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>o){const t=a?e[1]+F/2+a.height:e[1]+F;u=l([e[0],t],i),V.push(u)}+t.value<r&&(u=l([e[0],e[1]-F],i),V.push(u))}if(w.show&&+t.value<r){const t=e[1];if(w.text)d=l([e[0],e[1]+5],{value:w.text.split("").join("\n"),originY:"top",...w.style});else{const i=t+2*F;d=s([e[0],t,i],{...w.style})}V.push(d)}Object.assign(n,{upArrow:{obj:a},limitValue:{obj:u,top:-F},belowMinValue:{obj:d,top:w.text?5:2*F,moveHide:!0}})}(H,u,z,N),function(n,l,s,a,u,d){let p,h;const{pointAttr:v={},lineAttr:g={},title:y="",key:x,type:b="circle"}=u,j=e.list[a+1],w=ue(c,e.list[a].value),L=l&&ue(c,j.value);if(n&&l&&!s.breakpoint&&(!w&&!L||I)){h=i([...n,...l],{...g});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if((null==e?void 0:e.top)<n[1]&&(null==Q?void 0:Q.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...g});V.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),h.set("stroke","transparent")}}const S=s.pacemakerShow&&"pulse"==c?m.value:w&&"number"===O?0:b,M=T[a-1],$={origin:{data:s,title:y,key:x||"",unit:r.unit,type:c,_type:f(y,c),dataIndex:t,index:a},leftLine:M,rightLine:h,otherObj:d,lockMovementX:!0,...s.pacemakerShow&&"pulse"==c?m.style:v,...Y.event.hovered?Y.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:Y.event,...w?{selectable:!1,evented:!1,..."number"===O?P:{}}:{}};n&&(M?$.leftLine.set("x2",n[0]):$.leftLine=null,p=o(S,{left:n[0],top:w?n[1]-5:n[1],...$}));T.push(h),p&&(y.includes("脉搏")?ie.add(p):ne.add(p),function(e){B.hovered&&(e.on("mouseover",(()=>{ce(e,"hover")})),e.on("mouseout",(()=>{A.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?K:J;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:s=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),s&&(k.value.remove(i),delete e.otherObj.obj)))})),se(e)}(e),B.hovered&&ce(e)})),e.on("mouseup",(t=>{if(A.show=!1,1===t.button){const{type:t}=e.origin,i=C(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};k.value.discardActiveObject(),E("change",n),fe(n,"change")}}))}(p),R.push(p),oe.add(p))}(H,W,u,j,z,N)})),"pulse"===c){const e={};ee.forEach((t=>{e[t]=R.filter((e=>{var i;return(null==(i=e.origin)?void 0:i.key)===t}))}));let t=null;ee.forEach((i=>{te.set(i,e[i].map(((e,i,n)=>{var o,l;const s=n[i+1];if(s&&d(e.left,1)===d(s.left,1)){const i=e.left-D/2;e.set("left",i+D/4),null==(o=e.rightLine)||o.set("x1",e.left),t=e.left+D/2,s.set("left",t)}else t&&(null==(l=e.leftLine)||l.set("x2",t),e.set("left",t)),t=null;return[e.left,e.top]})))}))}Promise.all(R).then((e=>{const t=T.filter((e=>e));Promise.all(V).then((i=>{k.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&k.value.remove(e.leftLine),e.rightLine&&k.value.remove(e.rightLine))}}(t,e)}))}))}))}function ue(e,t){return"pain"===e&&0==t}function ce(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;A.point={x:e.left,y:e.top},A.list=[function(){const{drugReduce:s,physicsReduce:r}=l||{},a="hover"===t?l.value:C(o,e.top);if(p(s))return`药物降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;if(p(r))return`物理降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||O(e.left)).slice(-5)}`],A.show=!0}function de(e,t){const i="pain"===t.type?K:J;if(!h(e)||!function(e){const[t]=z,i=z.at(-1),n=t.start,o=i.end,l=v(e);return l>=n&&l<=o}(e.time))return;const n=M(e.time),o=$(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function pe(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=v(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=v(`${O(e)}:00`);return N&&l<v(N)?(T("exceedMin"),!1):!(l>o)||(T("exceedMax"),!1)}function fe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=le.find((e=>e.type===i));if("add"===t){const e=a(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=g(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;he()}function he(){var e;oe.size&&(null==(e=k.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}([...oe]))),te.clear(),oe.clear(),ie.clear(),ne.clear(),le.forEach((e=>{e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||ae(t,i,e)}))})),se(),re()}return te.clear(),ie.clear(),ne.clear(),le.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=$(e.type,e.list,e.positionLine.value),n=i([H,t,_,t],e.positionLine);k.value.add(n)}(e),e.dataList.forEach(((t,i)=>{!t.show||a(e.type)&&!t.enable||ae(t,i,e)}))})),se(),re(),k.value.on("mouse:up",(e=>{const{button:t,target:i,pointer:n={}}=e;if(3===t){if(!Y.event.evented)return;const{x:e=0,y:t=0}=n;if(e>=H&&e<=_&&t>=W&&t<=q){I.point={x:e,y:t},I.show=!0;const{type:o}=(null==i?void 0:i.origin)||{};if(i&&["temperature","pain"].includes(o))"temperature"===o&&(I.list=[...j]),"pain"===o&&(I.list=[...w]),I.target=i;else{I.target=null,I.list=["新增节点"],G.forEach((i=>{if(!R([...oe],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?K:J;t>=e.originY&&t<=e.endY&&I.list.push({renderItem:P?P(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:u(i.bigType),dataIndex:i.dataIndex,key:i.key},pointer:n})}}));const i=pe(e);i&&1!==I.list.length||(I.show=!1,1===I.list.length&&i&&T("repeat"))}}}if(1===t){if(i)return;const{x:e=0,y:t=0}=n;e>=H&&e<=_&&t>0&&t<U&&E("click:grid",{x:e,y:t,time:O(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=y(i,[...j,...w]);s[`${e.type}`]=e.value,a(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};E("change",r),fe(r,"change")}else{const t={data:{time:O(e.pointer.x),value:C(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};E("add",t),fe(t)}},setPopup:ce,isAddPoint:pe,updateData:fe,redrawPoints:he,gridPoints:oe}}function S(e){return"fixed"===e.position}export{k as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import"date-fns";import{isOneLine as u,getType as a,isOverlapPoint as c,getFloorNumber as d,isValidValue as p,setOtherType as f,isEffectiveNode as h,getTime as v,getIndex as g,deleteProperty as y}from"../../utils/index.js";import{cloneDeep as m,flatten as x,last as b}from"lodash-es";import"../useEvent.js";import{useCommon as j}from"../useCommon.js";import"vue";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as w,PAIN_MENU as L,OVERLAP as k}from"../../constants/index.js";function S(S,E,M,$,O,P,C,A,I,R){r(S,E);const{getEqualXTypes:T,handleAddPrevent:V,getPointEventProps:X}=j(S,M,E),{createShadowLines:z}=t(),{left:D,xScaleList:F,xCellWidth:H,yCellHeight:_,originX:W,endX:q,originY:G,endY:B,itemList:J,event:K,vitalSignsOriginY:N,painOriginY:Q,hospitalizationDate:U,config:Z,canvasHeight:ee}=E,te=new Set,ie=["xinmai","mai"],ne=new Map,oe=new Set,le=new Set,se=new Set,re=m(D.yScaleValue);function ue(t){var o;const l=re.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(te.size&&S.value.remove(...te),te.clear(),ne.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=ne.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of ne)t.push(e[1]),e[0]===ie[0]&&e[1].forEach((e=>{(ne.get(ie[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),u=n[i],a=o[r],c=n[i-1],d=n[i+1],p=o[r-1],f=o[r+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&s.push(p);const h=Math.min(u[1],a[1]);l.push([u,a].find((e=>e[1]===h)));const v=Math.max(u[1],a[1]);s.push([u,a].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=b(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(s.push(f),g()):g()})),e}(),{mode:s,style:r={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...r,strokeWidth:1});if(["slash","line"].includes(s)){l.set({fill:"transparent",stroke:r.stroke||"#f00"});const e=[];if(["slash"].includes(s))e.push(...z(t,r._angle,r.space)),e.forEach((e=>{Object.assign(e,{...n,...r}),te.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...x(t)],{...r,originX:"center"});e.push(n),te.add(n)}))}S.value.add(...e)}te.add(l),S.value.add(l)}))}}function ae(){var e;const t=re.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},k,D.overlap||{}),l=[];oe.size&&[...oe].forEach((e=>{[...le].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(o(r,{...i[e]||{},...s}))}}}))})),setTimeout((()=>{S.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),se.add(e)}))}))}function ce(e,t,r){var a;const{type:c,riseStyle:h={},noRiseStyle:v={},verifiedStyle:g={},reduceStyle:y={},pacemaker:m={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:w={},dataList:L=[],list:k=[]}=r,{type:E,textStyle:$,showConnectLine:P=!1}=j,A=[],R=[],T=[];let V=null;if(null==(a=e.list)||a.forEach(((a,j)=>{const z=u(c)?L.find((e=>e.key===a.key)):e,D=fe(a,r),F=e.list[j+1],W=F?fe(F,r):void 0,q=F?u(c)?L.find((e=>e.key===F.key)):e:{},{title:G=""}=z;if("脉搏"===G&&"脉搏"!==q.title||"脉搏"!==G&&"脉搏"===q.title||!D||!W||d(D[0],1)!==d(W[0],1))D&&V&&(D[0]=V),V=null;else{const e=D[0]-H/2;D[0]=e+H/4,W[0]=V=D[0]+H/2}const B={};B.value=function(e,t,i){if(!(null==e?void 0:e.length)||!Z.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=N.originY+_?e[1]+_:e[1]-_,s=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return T.push(s),{obj:s,top:-_}}(D,a,z),function(e,t,r,u){var a,d;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(c))return;const{lineAttr:f={}}=r,{value:m}=u;let x,b,j,w,L;if(t.noRise&&v.show){const t=Y(v)?O(c,k,35):e[1];if(v.text)j=l([e[0],Y(v)?t:t+5],{value:v.text.split("").join("\n"),originY:"top",...v.style});else{const i=t+2*_;j=s([e[0],t,i],{...v.style})}T.push(j)}t.rise&&h.show&&h.text&&(w=l([e[0],e[1]-(m?_:0)-5],{value:h.text.split("").join("\n"),originY:"bottom",...h.style}),T.push(w));t.verified&&(L=l([e[0],e[1]-(m?_:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),T.push(L));if(p(t.physicsReduce)||p(t.drugReduce)){const l=O(c,k,null!=(a=t.physicsReduce)?a:t.drugReduce),s=l<e[1]&&(null==Z?void 0:Z.hypothermyViewCustom)?e[0]+H/2:e[0];x=i([...e,s,l],{...f,...y.line,...n}),b=o((null==(d=null==y?void 0:y.point)?void 0:d.type)||"circle",{left:s,top:l,...y.point,...n,originY:l===ee?"bottom":"center"}),x&&T.push(x),b&&T.push(b)}Object.assign(u,{reduceLine:{obj:x,type:"line"},noRiseText:{obj:j,top:v.text?5:2*_,isFixed:Y(v)},riseText:{obj:w,top:(m?-_:0)-5},verifiedText:{obj:L,top:(m?-_:0)-5},reducePoint:{obj:b,type:"reduce"}})}(D,a,z,B),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;const o=Math.max(...k),r=Math.min(...k);let u,a,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*_,i=[e[1]-_/2,t];t<N.originY&&(t=e[1]+2.5*_,i=[t,e[1]+_/2]),u=s([e[0],i[0],i[1]],x,"up"),T.push(u)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>o){const t=u?e[1]+_/2+u.height:e[1]+_;a=l([e[0],t],i),T.push(a)}+t.value<r&&(a=l([e[0],e[1]-_],i),T.push(a))}if(w.show&&+t.value<r){const t=e[1];if(w.text)d=l([e[0],e[1]+5],{value:w.text.split("").join("\n"),originY:"top",...w.style});else{const i=t+2*_;d=s([e[0],t,i],{...w.style})}T.push(d)}Object.assign(n,{upArrow:{obj:u},limitValue:{obj:a,top:-_},belowMinValue:{obj:d,top:w.text?5:2*_,moveHide:!0}})}(D,a,z,B),function(n,l,s,u,a,d){let p,h;const{pointAttr:v={},lineAttr:g={},title:y="",key:x,type:b="circle"}=a,j=e.list[u+1],w=de(c,e.list[u].value),L=l&&de(c,j.value);if(n&&l&&!s.breakpoint&&(!w&&!L||P)){h=i([...n,...l],{...g});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if((null==e?void 0:e.top)<n[1]&&(null==Z?void 0:Z.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...g});T.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),h.set("stroke","transparent")}}const k=s.pacemakerShow&&"pulse"==c?m.value:w&&"number"===E?0:b,Y=R[u-1],O={origin:{data:s,title:y,key:x||"",unit:r.unit,type:c,_type:f(y,c),dataIndex:t,index:u},leftLine:Y,rightLine:h,otherObj:d,...s.pacemakerShow&&"pulse"==c?m.style:v,lockMovementX:!0,...X(),...w?{selectable:!1,evented:!1,..."number"===E?$:{}}:{}};n&&(Y?O.leftLine.set("x2",n[0]):O.leftLine=null,p=o(k,{left:n[0],top:w?n[1]-5:n[1],...O}));R.push(h),p&&(y.includes("脉搏")?oe.add(p):le.add(p),function(e){K.hovered&&(e.on("mouseover",(()=>{pe(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?Q:N;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:s=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),s&&(S.value.remove(i),delete e.otherObj.obj)))})),ue(e)}(e),K.hovered&&pe(e)})),e.on("mouseup",(t=>{if(I.show=!1,1===t.button){const{type:t}=e.origin,i=C(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};S.value.discardActiveObject(),M("change",n),ve(n,"change")}}))}(p),A.push(p),se.add(p))}(D,W,a,j,z,B)})),"pulse"===c){const e={};ie.forEach((t=>{e[t]=A.filter((e=>{var i;return(null==(i=e.origin)?void 0:i.key)===t}))}));let t=null;ie.forEach((i=>{ne.set(i,e[i].map(((e,i,n)=>{var o,l;const s=n[i+1];if(s&&d(e.left,1)===d(s.left,1)){const i=e.left-H/2;e.set("left",i+H/4),null==(o=e.rightLine)||o.set("x1",e.left),t=e.left+H/2,s.set("left",t)}else t&&(null==(l=e.leftLine)||l.set("x2",t),e.set("left",t)),t=null;return[e.left,e.top]})))}))}Promise.all(A).then((e=>{const t=R.filter((e=>e));Promise.all(T).then((i=>{S.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&S.value.remove(e.leftLine),e.rightLine&&S.value.remove(e.rightLine))}}(t,e)}))}))}))}function de(e,t){return"pain"===e&&0==t}function pe(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;I.point={x:e.left,y:e.top},I.list=[function(){const{drugReduce:s,physicsReduce:r}=l||{},u="hover"===t?l.value:C(o,e.top);if(p(s))return`药物降${"pain"==o?"痛":"温"} ${u}—>${s}${n||""}`;if(p(r))return`物理降${"pain"==o?"痛":"温"} ${u}—>${r}${n||""}`;return`${i} ${u}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||P(e.left)).slice(-5)}`],I.show=!0}function fe(e,t){const i="pain"===t.type?Q:N;if(!h(e)||!function(e){const[t]=F,i=b(F),n=t.start,o=i.end,l=v(e);return l>=n&&l<=o}(e.time))return;const n=$(e.time),o=O(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function he(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=v(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=v(`${P(e)}:00`);return U&&l<v(U)?(V("exceedMin"),!1):!(l>o)||(V("exceedMax"),!1)}function ve(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=re.find((e=>e.type===i));if("add"===t){const e=u(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=g(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;ge()}function ge(){var e;se.size&&(null==(e=S.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}([...se]))),ne.clear(),se.clear(),oe.clear(),le.clear(),re.forEach((e=>{e.dataList.forEach(((t,i)=>{u(e.type)&&!t.enable||ce(t,i,e)}))})),ue(),ae()}return ne.clear(),oe.clear(),le.clear(),re.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=O(e.type,e.list,e.positionLine.value),n=i([W,t,q,t],e.positionLine);S.value.add(n)}(e),e.dataList.forEach(((t,i)=>{!t.show||u(e.type)&&!t.enable||ce(t,i,e)}))})),ue(),ae(),S.value.on("mouse:up",(e=>{const{button:t,target:i,pointer:n={}}=e;if(3===t){if(!E.event.evented)return;const{x:e=0,y:t=0}=n;if(e>=W&&e<=q&&t>=G&&t<=B){R.point={x:e,y:t},R.show=!0;const{type:o}=(null==i?void 0:i.origin)||{};if(i&&["temperature","pain"].includes(o))"temperature"===o&&(R.list=[...w]),"pain"===o&&(R.list=[...L]),R.target=i;else{R.target=null,R.list=["新增节点"],J.forEach((i=>{if(!T([...se],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?Q:N;t>=e.originY&&t<=e.endY&&R.list.push({renderItem:A?A(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:a(i.bigType),dataIndex:i.dataIndex,key:i.key},pointer:n})}}));const i=he(e);i&&1!==R.list.length||(R.show=!1,1===R.list.length&&i&&V("repeat"))}}}if(1===t){if(i)return;const{x:e=0,y:t=0}=n;e>=W&&e<=q&&t>0&&t<ee&&M("click:grid",{x:e,y:t,time:P(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=y(i,[...w,...L]);s[`${e.type}`]=e.value,u(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};M("change",r),ve(r,"change")}else{const t={data:{time:P(e.pointer.x),value:C(e.origin.type,e.pointer.y),...u(e.origin.type)?{key:e.origin.key}:{}},...e.origin};M("add",t),ve(t)}},setPopup:pe,isAddPoint:he,updateData:ve,redrawPoints:ge,gridPoints:se}}function Y(e){return"fixed"===e.position}export{S as useCenter};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as r,isOneLine as s}from"../../utils/index.js";import"../useEvent.js";import{getScaleInfo as u,drawScaleNumber as a,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"lodash-es";import"./useShadow.js";import"naive-ui";import"@vueuse/core";function g(g,d,p,f,m,v,y,w,S,Y,b,x){var j,C;const{getEqualXTypes:X,handleAddPrevent:N,isGridLimit:T}=c(g,p,d),{originY:V,endY:L,originX:k,endX:E,xCellWidth:M,yCellHeight:W,left:G,vitalSignsOriginY:O,painOriginY:R,painHeight:A,iconsWidth:H,itemList:I,painIndex:_,right:B,canvasWidth:J,canvasHeight:$,getRightInfo:q,borderStyle:D,surplusCell:P}=d;function z(o){var r;if(!(null==o?void 0:o.length))return;const{layout:s}=o[0];let c=H,d=k;"right"===s&&(c=E,d=E+(null!=(r=null==B?void 0:B.width)?r:0));const p=[],f=A&&"right"!==s?o.length-1:o.length,m=(d-c)/f,v=m+(d-c)%f;o.forEach(((o,r)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:r=5,showScale:s,showNumber:h,position:c,showMaxMinNumber:d,style:p,title:f}=n,m=l({width:k-H,height:A,...D},{value:`${f}`,...i,...p||{}},{left:H,top:R.originY}),v=e([H,R.originY,k,R.originY],D),y=[];if(s||h){const{lineXMain:e,textLeft:i}=u(c,H,k-H),l=o.length;o.forEach(((o,u)=>{let c=R.endY-u*W*r;if(0===u&&(c=L-5),!h||(0===u||u===l-1)&&!d||y.push(a(o,n,i,c)),s&&0!==u){const[i,n]=e,o=new t.Line([i,c,n,c],{...D,...p});y.push(o)}}))}g.value.add(v,m,...y),m.sendToBack()}(o);const d=[],f=0===r?v:m,y=0===r?c:v+c+(r-1)*m,w="right"===s?0:O.originY,S="right"===s?$:O.endY,Y=r>0?e([y,w,y,S],{objectCaching:!1,...D}):null;Y&&d.push(Y);const b=y+f/2,{list:x=[],spaceGridNumber:j=5,showScale:C,showNumber:X,position:N,showMaxMinNumber:T,detailedList:E=[],showdetailedScale:M,showRange:G=[]}=o;if(C||X){const[t,e]=G,{lineXMain:i,lineXSub:n,textLeft:l}=u(N,y,f),r=(x[1]-x[0])/2,s=M&&!E.length?x.reduce(((t,e,i)=>{const n=t[t.length-1];return 0===i?[e]:t.concat([n+r,n+2*r])}),[]):M&&(null==E?void 0:E.length)?E:x,c=s.length;s.forEach(((r,s)=>{if(t&&+r<t)return;if(e&&+r>e)return;const u=O.endY-s*W*(M?j/2:j);if(X&&(!(0===s||s===c-1)||T)&&t!==+r){const t=0==s?u-5:u,e=a(r,o,l,t),i=O.originY+e.height/2;t<i&&e.set({top:i}),d.push(e)}d.push(...h(o,s,i,n,u,W,O.originY))}))}let I=o.title||"";o.unit&&(I+="\n"+o.unit);let B=O.originY+W;0!==_&&P[0]>1&&(B=V+W*P[0]/2),I&&d.push(new t.Text(String(I),{...i,left:b,top:B,textAlign:"center",...o.style}));const J=new t.Group(d,{...n,objectCaching:!1});p.push(J)}));const y=p.length>0?new t.Group([...p],{...n,objectCaching:!1}):null;y&&g.value.add(y),y&&y.sendToBack()}H&&function(){const t=JSON.parse(JSON.stringify(I));let e=L;const i=H-G.icons.marginRight;t.reverse().forEach((t=>{e-=10;let n=t.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:u}=o(n,t,{text:{left:i-(t.pointAttr.width||10)-5,top:e,originX:"right"},icon:{originX:"right",left:i,topY:e,origin:{type:r(t.bigType),_type:t.bigType},...d.event}});var a;e-=l.height||30,(a=u).on("moving",(()=>{a.set("originX","center"),function(t){if(t.left>=k&&t.left<=E){t.setCoords();const e="pain"===t.origin.type?R:O;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(a),T(a)?f(a):m.show=!1})),a.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&T(a)){const t=X([...x],a.left,"_type").includes(a.origin._type),e=Y(a.left);if(!e||t)t&&e&&N("repeat");else{const t={data:{time:w(a.left),value:S(a.origin.type,a.top),...s(a.origin.type)?{key:a.origin.key}:{}},...a.origin};p("add",t),b(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(a)})),g.value.add(l,u)}))}();const F=G.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==B?void 0:B.width)&&"left"===(null==(j=null==B?void 0:B.yScaleValue)?void 0:j.layout)&&(null==(C=null==B?void 0:B.yScaleValue)?void 0:C.show)&&F.push(q),_>0&&G.yScaleValue[_].show){const t=G.yScaleValue[_];0===_&&G.yScaleValue.length>1&&F.unshift(t),_==G.yScaleValue.length-1&&F.push(t)}const K=F.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),Q=F[K];return K>-1&&F.splice(K,0,{...Q,title:(null==Q?void 0:Q.doubleTitle)||(null==Q?void 0:Q.title)}),z(F),g.value.add(new t.Rect({left:H,top:0,width:J-H-D.strokeWidth,height:$-D.strokeWidth,fill:"transparent",...D})),{drawScaleValue:z}}export{g as useLeft};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as r,isOneLine as s}from"../../utils/index.js";import"lodash-es";import"../useEvent.js";import{getScaleInfo as u,drawScaleNumber as a,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"./useShadow.js";import"naive-ui";import"@vueuse/core";function g(g,d,p,f,m,v,y,w,S,Y,b,x){var j,C;const{getEqualXTypes:X,handleAddPrevent:N,isGridLimit:T}=c(g,p,d),{originY:V,endY:L,originX:k,endX:E,xCellWidth:M,yCellHeight:W,left:G,vitalSignsOriginY:O,painOriginY:R,painHeight:A,iconsWidth:H,itemList:I,painIndex:_,right:B,canvasWidth:J,canvasHeight:$,getRightInfo:q,borderStyle:D,surplusCell:P}=d;function z(o){var r;if(!(null==o?void 0:o.length))return;const{layout:s}=o[0];let c=H,d=k;"right"===s&&(c=E,d=E+(null!=(r=null==B?void 0:B.width)?r:0));const p=[],f=A&&"right"!==s?o.length-1:o.length,m=(d-c)/f,v=m+(d-c)%f;o.forEach(((o,r)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:r=5,showScale:s,showNumber:h,position:c,showMaxMinNumber:d,style:p,title:f}=n,m=l({width:k-H,height:A,...D},{value:`${f}`,...i,...p||{}},{left:H,top:R.originY}),v=e([H,R.originY,k,R.originY],D),y=[];if(s||h){const{lineXMain:e,textLeft:i}=u(c,H,k-H),l=o.length;o.forEach(((o,u)=>{let c=R.endY-u*W*r;if(0===u&&(c=L-5),!h||(0===u||u===l-1)&&!d||y.push(a(o,n,i,c)),s&&0!==u){const[i,n]=e,o=new t.Line([i,c,n,c],{...D,...p});y.push(o)}}))}g.value.add(v,m,...y),m.sendToBack()}(o);const d=[],f=0===r?v:m,y=0===r?c:v+c+(r-1)*m,w="right"===s?0:O.originY,S="right"===s?$:O.endY,Y=r>0?e([y,w,y,S],{objectCaching:!1,...D}):null;Y&&d.push(Y);const b=y+f/2,{list:x=[],spaceGridNumber:j=5,showScale:C,showNumber:X,position:N,showMaxMinNumber:T,detailedList:E=[],showdetailedScale:M,showRange:G=[]}=o;if(C||X){const[t,e]=G,{lineXMain:i,lineXSub:n,textLeft:l}=u(N,y,f),r=(x[1]-x[0])/2,s=M&&!E.length?x.reduce(((t,e,i)=>{const n=t[t.length-1];return 0===i?[e]:t.concat([n+r,n+2*r])}),[]):M&&(null==E?void 0:E.length)?E:x,c=s.length;s.forEach(((r,s)=>{if(t&&+r<t)return;if(e&&+r>e)return;const u=O.endY-s*W*(M?j/2:j);if(X&&(!(0===s||s===c-1)||T)&&t!==+r){const t=0==s?u-5:u,e=a(r,o,l,t),i=O.originY+e.height/2;t<i&&e.set({top:i}),d.push(e)}d.push(...h(o,s,i,n,u,W,O.originY))}))}let I=o.title||"";o.unit&&(I+="\n"+o.unit);let B=O.originY+W;0!==_&&P[0]>1&&(B=V+W*P[0]/2),I&&d.push(new t.Text(String(I),{...i,left:b,top:B,textAlign:"center",...o.style}));const J=new t.Group(d,{...n,objectCaching:!1});p.push(J)}));const y=p.length>0?new t.Group([...p],{...n,objectCaching:!1}):null;y&&g.value.add(y),y&&y.sendToBack()}H&&function(){const t=JSON.parse(JSON.stringify(I));let e=L;const i=H-G.icons.marginRight;t.reverse().forEach((t=>{e-=10;let n=t.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:u}=o(n,t,{text:{left:i-(t.pointAttr.width||10)-5,top:e,originX:"right"},icon:{originX:"right",left:i,topY:e,origin:{type:r(t.bigType),_type:t.bigType},...d.event}});var a;e-=l.height||30,(a=u).on("moving",(()=>{a.set("originX","center"),function(t){if(t.left>=k&&t.left<=E){t.setCoords();const e="pain"===t.origin.type?R:O;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(a),T(a)?f(a):m.show=!1})),a.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&T(a)){const t=X([...x],a.left,"_type").includes(a.origin._type),e=Y(a.left);if(!e||t)t&&e&&N("repeat");else{const t={data:{time:w(a.left),value:S(a.origin.type,a.top),...s(a.origin.type)?{key:a.origin.key}:{}},...a.origin};p("add",t),b(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(a)})),g.value.add(l,u)}))}();const F=G.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==B?void 0:B.width)&&"left"===(null==(j=null==B?void 0:B.yScaleValue)?void 0:j.layout)&&(null==(C=null==B?void 0:B.yScaleValue)?void 0:C.show)&&F.push(q),_>0&&G.yScaleValue[_].show){const t=G.yScaleValue[_];0===_&&G.yScaleValue.length>1&&F.unshift(t),_==G.yScaleValue.length-1&&F.push(t)}const K=F.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),Q=F[K];return K>-1&&F.splice(K,0,{...Q,title:(null==Q?void 0:Q.doubleTitle)||(null==Q?void 0:Q.title)}),z(F),g.value.add(new t.Rect({left:H,top:0,width:J-H-D.strokeWidth,height:$-D.strokeWidth,fill:"transparent",...D})),{drawScaleValue:z}}export{g as useLeft};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as e}from"../useDraw.js";import"date-fns";import"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"naive-ui";import"@vueuse/core";function i(i,n,o,l){const{other:r,vitalSignsOriginY:s,xCellWidth:h,yCellHeight:a,endX:u}=n;let c=0;function f(n,l,s){const u=[];String(n.value).split("").forEach(((i,o)=>{const l=new t.Text(i,{left:0,top:a*o,originX:"center",...e,objectCaching:!1,...n.style||{}});c=(a-(l.height||0))/2,u.push(l)}));const f=new t.Rect({left:0,top:0,width:h,height:a*u.length,fill:"transparent",originX:"center",...e}),{eventHighlight:g=!1}=r||{},p={originX:"center",left:l,top:s+c,baseTop:(n.baseTop||0)*a,trueLeft:l,trueHeight:u.length*a,objectCaching:!1,hoverCursor:"pointer",highlightObject:f,originData:n,selectable:!1,evented:g},v=new t.Group([f,...u],p);return function(t){const{highlightColor:e="#ffff00"}=r||{};t.on("mouseover",(()=>{t.highlightObject.set("fill",e),i.value.requestRenderAll()})),t.on("mouseout",(()=>{t.highlightObject.set("fill","transparent"),i.value.requestRenderAll()})),t.on("mousedown",(function(){o("eventClick",t.originData)}))}(v),i.value.add(v),v}!function(){if(!(null==r?void 0:r.list))return!1;const t=[],e=[];r.list.forEach(((t,i)=>{const n=0===i?"vertical":t.align||"vertical",o=l(t.time,!0);if(o>u)return;const r=e.find((t=>t.left==o));if(r)r[n].push(t);else{const i={left:o,vertical:[],horizontal:[]};i[n].push(t),e.push(i)}})),e.forEach((e=>{let i=s.originY,n=e.left;e.vertical.forEach(((o,l)=>{var r,u;const c=(o.baseTop||0)*a,g=(null==(r=t.at(-1))?void 0:r.left)||0;0===l&&e.left<=g&&(n=g+h);if(t.filter((t=>t.trueLeft===n)).length){const e=String(o.value).length*a,l=(null==(u=t.at(-1))?void 0:u.trueHeight)||0;i+=l,i+e+c>s.endY&&(i=s.originY,n+=h)}i+=c,String(o.value).length&&t.push(f(o,n,i))})),e.horizontal.forEach(((i,o)=>{var l;const r=s.originY+(i.baseTop||0)*a,u=(null==(l=t.at(-1))?void 0:l.left)||0;e.left<=u&&(n=u+h),String(i.value).length&&t.push(f(i,n,r))}))}))}()}export{i as useOther};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as e}from"../useDraw.js";import"date-fns";import{last as i}from"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"naive-ui";import"@vueuse/core";function n(n,o,r,l){const{other:s,vitalSignsOriginY:h,xCellWidth:a,yCellHeight:u,endX:c}=o;let f=0;function g(i,o,l){const h=[];String(i.value).split("").forEach(((n,o)=>{const r=new t.Text(n,{left:0,top:u*o,originX:"center",...e,objectCaching:!1,...i.style||{}});f=(u-(r.height||0))/2,h.push(r)}));const c=new t.Rect({left:0,top:0,width:a,height:u*h.length,fill:"transparent",originX:"center",...e}),{eventHighlight:g=!1}=s||{},p={originX:"center",left:o,top:l+f,baseTop:(i.baseTop||0)*u,trueLeft:o,trueHeight:h.length*u,objectCaching:!1,hoverCursor:"pointer",highlightObject:c,originData:i,selectable:!1,evented:g},v=new t.Group([c,...h],p);return function(t){const{highlightColor:e="#ffff00"}=s||{};t.on("mouseover",(()=>{t.highlightObject.set("fill",e),n.value.requestRenderAll()})),t.on("mouseout",(()=>{t.highlightObject.set("fill","transparent"),n.value.requestRenderAll()})),t.on("mousedown",(function(){r("eventClick",t.originData)}))}(v),n.value.add(v),v}!function(){if(!(null==s?void 0:s.list))return!1;const t=[],e=[];s.list.forEach(((t,i)=>{const n=0===i?"vertical":t.align||"vertical",o=l(t.time,!0);if(o>c)return;const r=e.find((t=>t.left==o));if(r)r[n].push(t);else{const i={left:o,vertical:[],horizontal:[]};i[n].push(t),e.push(i)}})),e.forEach((e=>{let n=h.originY,o=e.left;e.vertical.forEach(((r,l)=>{var s,c;const f=(r.baseTop||0)*u,p=(null==(s=i(t))?void 0:s.left)||0;0===l&&e.left<=p&&(o=p+a);if(t.filter((t=>t.trueLeft===o)).length){const e=String(r.value).length*u,l=(null==(c=i(t))?void 0:c.trueHeight)||0;n+=l,n+e+f>h.endY&&(n=h.originY,o+=a)}n+=f,String(r.value).length&&t.push(g(r,o,n))})),e.horizontal.forEach(((n,r)=>{var l;const s=h.originY+(n.baseTop||0)*u,c=(null==(l=i(t))?void 0:l.left)||0;e.left<=c&&(o=c+a),String(n.value).length&&t.push(g(n,o,s))}))}))}()}export{n as useOther};
@@ -7,4 +7,5 @@ export declare function useCommon(canvas: Ref<fabric.Canvas>, emits: Function, p
7
7
  handleAddPrevent: (type: 'repeat' | 'exceedMax' | 'exceedMin') => void;
8
8
  isGridLimit: (point: IObject) => boolean;
9
9
  setPrevAndNextPoint: (pointList: any[]) => void;
10
+ getPointEventProps: () => any;
10
11
  };
@@ -1 +1 @@
1
- const e={repeat:"该时段已存在数值不能新增",exceedMax:"未来时间不允许录入",exceedMin:"不允许小于入院时间"};function n(n,t,i){return{getEqualXTypes:function(e,n,t,r=i.xCellWidth){const o=[],d=r/2;return e.forEach((e=>{e.origin&&!e.origin.isMenu&&Math.abs(n-e.left)<=d&&o.push(e.origin[t])})),[...new Set(o)]},handleAddPrevent:function(n){t("add:prevent",{type:n,message:e[n]})},isGridLimit:function(e){const{left:n,top:t}=e,{originX:r,endX:o,originY:d,endY:u}=i;return n>=r&&n<=o&&t>=d&&t<=u},setPrevAndNextPoint:function(e){e.reduce(((e,n)=>e&&n?(n.prevPoint=e,e.nextPoint=n,n):n||e),null)}}}export{n as useCommon};
1
+ const e={repeat:"该时段已存在数值不能新增",exceedMax:"未来时间不允许录入",exceedMin:"不允许小于入院时间"};function n(n,t,i){return{getEqualXTypes:function(e,n,t,o=i.xCellWidth){const r=[],l=o/2;return e.forEach((e=>{e.origin&&!e.origin.isMenu&&Math.abs(n-e.left)<=l&&r.push(e.origin[t])})),[...new Set(r)]},handleAddPrevent:function(n){t("add:prevent",{type:n,message:e[n]})},isGridLimit:function(e){const{left:n,top:t}=e,{originX:o,endX:r,originY:l,endY:c}=i;return n>=o&&n<=r&&t>=l&&t<=c},setPrevAndNextPoint:function(e){e.reduce(((e,n)=>e&&n?(n.prevPoint=e,e.nextPoint=n,n):n||e),null)},getPointEventProps:function(){var e,n;return(null==(e=i.event)?void 0:e.hovered)?(null==(n=i.event)?void 0:n.evented)?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:i.event}}}export{n as useCommon};
@@ -1 +1 @@
1
- import{format as n}from"date-fns";import{getTime as t,getFloorNumber as e}from"../utils/index.js";function i(i){const{xScaleList:u,xCellWidth:l,left:r,vitalSignsOriginY:o,painOriginY:c,canvasWidth:a}=i;return{computedX:function(n,e=!1){const i=t(n),[l]=u,r=u.at(-1);if(i<l.start)return 0;if(i>r.end)return a;const o=u.findIndex((n=>n.end>=i));if(o>-1){return u[o].center}},computedY:function(n,t,e){const u=i[`${n}YCell`],l=+e-Math.min(...t);return("pain"===n?c.endY:o.endY)-u*l},getXValue:function(t){const e=u.findIndex((n=>n.left+l>=t));if(e>-1){const i=u[e],l=t-i.left,r=i.scaleCell*l,o=i.start+r;return n(new Date(o),"yyyy-MM-dd HH:mm")}},getYValue:function(n,t){var u;const l=i[`${n}YCell`],a=(null==(u=r.yScaleValue.find((t=>t.type===n)))?void 0:u.list)||[],d=a.length?Math.min(...a):0,f="pain"===n?c.endY:o.endY;return e((f-t)/l+d)}}}function u(i){const{xAxis:u,originX:l,originY:r,xCellWidth:o,endY:c,timeXCell:a,startTime:d,scaleValues:f}=i;return{computedX:function(n){return(t(n)-d)/a+l},computedY:function(n,t,e){const[u]=t;return c-(+e-u)*i[`${n}YCell`]},getXValue:function(t){return n(new Date((t-l)*a+d),"yyyy-MM-dd HH:mm")},getYValue:function(n,t){const u=f.find((t=>[t.key,t.type||""].includes(n))),[l]=(null==u?void 0:u.range)||[0],r=(c-t)/i[`${n}YCell`]+l;return e(r)}}}function l(n){const{config:t,xCellWidth:i,yCellHeight:u}=n,{hz:l,mainXCellValue:r,valueUnit:o,mainYCellValue:c}=t;return{computedX:function(n){return n/l/r*i},computedY:function(n){return("uv"===o?.001*n:"v"===o?1e3*n:n)/c*u},getXValue:function(n){return e(r/i*n)},getYValue:function(n){return e(c/u*n)}}}export{u as useBirthProcessCumputedPoint,i as useCumputedPoint,l as useElectrocardiogramCumputedPoint};
1
+ import{format as n}from"date-fns";import{getTime as e,getFloorNumber as t}from"../utils/index.js";import{last as i}from"lodash-es";function u(u){const{xScaleList:l,xCellWidth:r,left:o,vitalSignsOriginY:c,painOriginY:a,canvasWidth:d}=u;return{computedX:function(n,t=!1){const u=e(n),[r]=l,o=i(l);if(u<r.start)return 0;if(u>o.end)return d;const c=l.findIndex((n=>n.end>=u));if(c>-1){return l[c].center}},computedY:function(n,e,t){const i=u[`${n}YCell`],l=+t-Math.min(...e);return("pain"===n?a.endY:c.endY)-i*l},getXValue:function(e){const t=l.findIndex((n=>n.left+r>=e));if(t>-1){const i=l[t],u=e-i.left,r=i.scaleCell*u,o=i.start+r;return n(new Date(o),"yyyy-MM-dd HH:mm")}},getYValue:function(n,e){var i;const l=u[`${n}YCell`],r=(null==(i=o.yScaleValue.find((e=>e.type===n)))?void 0:i.list)||[],d=r.length?Math.min(...r):0,f="pain"===n?a.endY:c.endY;return t((f-e)/l+d)}}}function l(i){const{xAxis:u,originX:l,originY:r,xCellWidth:o,endY:c,timeXCell:a,startTime:d,scaleValues:f}=i;return{computedX:function(n){return(e(n)-d)/a+l},computedY:function(n,e,t){const[u]=e;return c-(+t-u)*i[`${n}YCell`]},getXValue:function(e){return n(new Date((e-l)*a+d),"yyyy-MM-dd HH:mm")},getYValue:function(n,e){const u=f.find((e=>[e.key,e.type||""].includes(n))),[l]=(null==u?void 0:u.range)||[0],r=(c-e)/i[`${n}YCell`]+l;return t(r)}}}function r(n){const{config:e,xCellWidth:i,yCellHeight:u}=n,{hz:l,mainXCellValue:r,valueUnit:o,mainYCellValue:c}=e;return{computedX:function(n){return n/l/r*i},computedY:function(n){return("uv"===o?.001*n:"v"===o?1e3*n:n)/c*u},getXValue:function(n){return t(r/i*n)},getYValue:function(n){return t(c/u*n)}}}export{l as useBirthProcessCumputedPoint,u as useCumputedPoint,r as useElectrocardiogramCumputedPoint};
@@ -504,7 +504,7 @@ declare const _default: import("vue").DefineComponent<{
504
504
  formRef: import("vue").Ref<any>;
505
505
  conditionRef: import("vue").Ref<any>;
506
506
  filterVisible: import("vue").Ref<boolean>;
507
- title: import("vue").ComputedRef<"修改" | "新增" | "过滤条件">;
507
+ title: import("vue").ComputedRef<"新增" | "修改" | "过滤条件">;
508
508
  model: {
509
509
  name: string;
510
510
  color: string;
@@ -44,7 +44,7 @@ declare const _default: import("vue").DefineComponent<{
44
44
  formRef: import("vue").Ref<any>;
45
45
  conditionRef: import("vue").Ref<any>;
46
46
  filterVisible: import("vue").Ref<boolean>;
47
- title: import("vue").ComputedRef<"修改" | "新增" | "过滤条件">;
47
+ title: import("vue").ComputedRef<"新增" | "修改" | "过滤条件">;
48
48
  model: {
49
49
  name: string;
50
50
  color: string;
@@ -1 +1 @@
1
- import{findAncestor as e,traverse as o}from"../../../../shared/utils/index.js";import{isFunction as t}from"lodash-es";import{unref as s}from"vue";import{FORM_CONFIG_GROUP as i}from"../constants/index.js";function a({group:a,hooks:r={},fieldList:n,materialList:c}={}){let l,m=null;return{move:function({to:i,from:a,dragged:m}){const{type:f,required:d,extra:u,key:g}=m.dataset||{};if("LINE_BAR"===f&&e(i,(e=>"LINE_BAR"===e.dataset.type)))return!1;const y=e(i,(e=>e.classList.contains("form-config__materialContent"))),h=e(a,(e=>e.classList.contains("form-config__materialContent")));if("true"===d&&"true"!==u&&y)return!1;if(t(r.beforeMove)){const e=[...s(n||[]),...s(c||[])];let t,l,m;o(e,((e,o)=>{t||e.key!==g||(t=e),l||e.key!==a.dataset.key||(l=e),m||e.key!==i.dataset.key||(m=e),t&&l&&m&&o()}));if(!1===r.beforeMove({fromType:h?"material":"layout",toType:y?"material":"layout",dragField:t,fromField:l,toField:m,from:a,to:i}))return!1}null==l||l.classList.remove("is-choosing-area"),l=i,i!==a&&a.classList.remove("is-choosing-area"),i.classList.add("is-choosing-area")},onChoose:function({target:e,item:o}){m=setTimeout((()=>{e.classList.add("is-choosing-area"),o.classList.add("is-choosing")}),200)},onUnchoose:function({from:e,to:o,target:t,item:s}){clearTimeout(m),[e,o,t].forEach((e=>{e.classList.remove("is-choosing-area")})),s.classList.remove("is-choosing")},tag:"section",forceFallback:!1,animation:"150","item-key":"key",group:a||i}}export{a as useSortableConfig};
1
+ import{findAncestor as e,traverse as o}from"../../../../shared/utils/index.js";import{isFunction as t}from"lodash-es";import{unref as s}from"vue";import{FORM_CONFIG_GROUP as i}from"../constants/index.js";function a({group:a,hooks:r={},fieldList:n,materialList:c}={}){let l,m=null;return{move:function({to:i,from:a,dragged:m}){const{type:f,required:d,extra:u,key:g}=m.dataset||{};if("LINE_BAR"===f&&e(i,(e=>"LINE_BAR"===e.dataset.type)))return!1;const y=e(i,(e=>e.classList.contains("form-config__materialContent"))),h=e(a,(e=>e.classList.contains("form-config__materialContent")));if(t(r.beforeMove)){const e=[...s(n||[]),...s(c||[])];let t,l,m;o(e,((e,o)=>{t||e.key!==g||(t=e),l||e.key!==a.dataset.key||(l=e),m||e.key!==i.dataset.key||(m=e),t&&l&&m&&o()}));if(!1===r.beforeMove({fromType:h?"material":"layout",toType:y?"material":"layout",dragField:t,fromField:l,toField:m,from:a,to:i}))return!1}if("true"===d&&"true"!==u&&y)return!1;null==l||l.classList.remove("is-choosing-area"),l=i,i!==a&&a.classList.remove("is-choosing-area"),i.classList.add("is-choosing-area")},onChoose:function({target:e,item:o}){m=setTimeout((()=>{e.classList.add("is-choosing-area"),o.classList.add("is-choosing")}),200)},onUnchoose:function({from:e,to:o,target:t,item:s}){clearTimeout(m),[e,o,t].forEach((e=>{e.classList.remove("is-choosing-area")})),s.classList.remove("is-choosing")},tag:"section",forceFallback:!1,animation:"150","item-key":"key",group:a||i}}export{a as useSortableConfig};
@@ -1 +1 @@
1
- import{arrayed as e,findAncestor as t}from"../../../../shared/utils/index.js";import{isField as r}from"@formily/core";import{Path as o}from"@formily/path";import{isObject as i}from"@vue/shared";import{promiseTimeout as n}from"@vueuse/shared";import{isFunction as a,isArray as s,isString as d}from"lodash-es";import{nextTick as l}from"vue";import"../../index.js";import{NESTED_FORM_ITEM_TYPE as u}from"../constants/index.js";import{queryDecoratorByAddress as m,queryInput as f,queryDecoratorByFieldKey as c,findNextWidget as p}from"../utils/dom.js";import{validateMessageParser as g,combineExtendKey as v,splitExtendKey as y}from"../utils/index.js";import{getParentLinebar as h}from"../utils/schema.js";import{useSelectedSetting as b}from"./useSelectedSetting.js";function S({formModel:t,formRenderRef:n,formUUID:u,getFieldList:p,formItemDepsCollector:S,businessCollector:x,wordbookSettingHandler:D,operationalFormHandler:j}){const{applySelectedSetting:F}=b(t);return{validate(o,{force:l}={}){if(null==o&&(o="*"),a(o)){const e=Object.entries(t.fields).reduce(((e,[t,r])=>(o(r)&&e.push(t),e)),[]);if(!e.length)return Promise.resolve();o=e.length?`*(${e.join(",")})`:"*"}const c=[];l&&t.setFieldState(o,(e=>{"visible"===e.display&&"editable"!==e.pattern&&r(e)&&(c.push({pattern:e.pattern,state:e}),e.pattern="editable")}));const p=t.validate(o).catch((e=>Promise.reject(Array.isArray(e)?e.reduce(v,[]):e)));return l&&c.forEach((({pattern:e,state:t})=>t.pattern=e)),p;function v(t,r){if(!i(r))return t;let o=!1;return s(r.messages)&&r.messages.forEach((r=>{i(r)&&(t.push(...e(r).map(y)),o=!0)})),!o&&t.push(y(r)),t}function y(e){if(e.decoratorElement)return e;const r=t.query(e.path),o=r.get("title"),a=e.messages.map((e=>function(e,t){if(!t||!i(t.fieldItem))return e;const r=t.fieldItem.defined_error_msg;return g(r&&d(r)?r:e,t.fieldItem)}(e,r.get("decoratorProps")))),s=m(e.address,n.value,u);return{...e,messages:a,title:o,decoratorElement:s,...f(s)}}},getFormValues(e=!0){let r=t.getFormState().values;return e&&(r=v(p(),r)),r},async setFormValues(e,i){i=Object.assign({avoidDependKeyConnection:!0,needSplitExtendKey:!0,avoidWordbookSettingConnection:!0,avoidOperationalFormConnection:!0,dependKeyKeepValue:!1,avoidBusinessConnection:!1,overwrite:!0},i),x.triggerDisabled=i.avoidBusinessConnection,S.triggerDisabled=i.avoidDependKeyConnection,S.keepValue=i.dependKeyKeepValue,D.triggerDisabled=i.avoidWordbookSettingConnection,j.triggerDisabled=i.avoidOperationalFormConnection,i.needSplitExtendKey&&(e=y(p(),e)),t.setFieldState("*",(t=>{r(t)&&(i.overwrite||o.existIn(e,t.path))&&(t.value=o.getIn(e,t.path))})),await l(),x.triggerDisabled=!1,S.triggerDisabled=!1,D.triggerDisabled=!1,j.triggerDisabled=!1,S.keepValue=!1},setFieldState(e,r){t.setFieldState(e,r)},resetFields:(e="*")=>t.reset(e),queryWidget:e=>async function(e,t,r){if(!n.value)return s();const i=c(e,t,u);if(i)return s(i);const a=h(e,r);return a?(S.trigger(o.parse(a),!0),await l(),s(c(e,t,u))):s();function s(e){return{decoratorElement:e,...f(e)}}}(e,n.value,p()),applySelectedSetting:F}}function x({props:e,formRenderRef:r,formModel:o}){return{onKeydown:async function i(s){var d;if(e.enterToNextWidget&&s.target){if("TEXTAREA"===s.target.tagName&&!s.ctrlKey)return;s.preventDefault()}if(await n(0),Reflect.get(s,"stopCapture")||!e.enterToNextWidget||!r.value)return;const l=t(s.target,(e=>e.classList.contains("form-render__formItem")));if(!l)return;const m=`.form-render__formItem${u.map((e=>`:not([widget-type=${e}])`)).join("")}`,f=Array.from(r.value.querySelectorAll(m)),c=f.findIndex((e=>e.id===l.id));if(!~c)return;const{widget:g,field:v}=p(f,c,s.target);if(g)if(a(e.enterToNextWidget)){const t=v&&o.query(v).take();!t||e.enterToNextWidget(null==(d=t.decoratorProps)?void 0:d.fieldItem)?y():i({target:g})}else y();async function y(){await n(0),g.focus()}}}}export{x as useFormDomEvent,S as useFormExposeEvent};
1
+ import{arrayed as e,findAncestor as t}from"../../../../shared/utils/index.js";import{isField as r}from"@formily/core";import{Path as o}from"@formily/path";import{isObject as i}from"@vue/shared";import{promiseTimeout as n}from"@vueuse/shared";import{isFunction as a,isArray as s,isString as d}from"lodash-es";import{nextTick as l}from"vue";import"../../index.js";import{NESTED_FORM_ITEM_TYPE as u}from"../constants/index.js";import{queryDecoratorByAddress as m,queryInput as f,queryDecoratorByFieldKey as c,findNextWidget as p}from"../utils/dom.js";import{validateMessageParser as g,combineExtendKey as v,splitExtendKey as y}from"../utils/index.js";import{getParentLinebar as S}from"../utils/schema.js";import{useSelectedSetting as h}from"./useSelectedSetting.js";function b({formModel:t,formRenderRef:n,formUUID:u,getFieldList:p,formItemDepsCollector:b,businessCollector:F,wordbookSettingHandler:x,operationalFormHandler:D}){const{applySelectedSetting:j}=h();return{validate(o,{force:l}={}){if(null==o&&(o="*"),a(o)){const e=Object.entries(t.fields).reduce(((e,[t,r])=>(o(r)&&e.push(t),e)),[]);if(!e.length)return Promise.resolve();o=e.length?`*(${e.join(",")})`:"*"}const c=[];l&&t.setFieldState(o,(e=>{"visible"===e.display&&"editable"!==e.pattern&&r(e)&&(c.push({pattern:e.pattern,state:e}),e.pattern="editable")}));const p=t.validate(o).catch((e=>Promise.reject(Array.isArray(e)?e.reduce(v,[]):e)));return l&&c.forEach((({pattern:e,state:t})=>t.pattern=e)),p;function v(t,r){if(!i(r))return t;let o=!1;return s(r.messages)&&r.messages.forEach((r=>{i(r)&&(t.push(...e(r).map(y)),o=!0)})),!o&&t.push(y(r)),t}function y(e){if(e.decoratorElement)return e;const r=t.query(e.path),o=r.get("title"),a=e.messages.map((e=>function(e,t){if(!t||!i(t.fieldItem))return e;const r=t.fieldItem.defined_error_msg;return g(r&&d(r)?r:e,t.fieldItem)}(e,r.get("decoratorProps")))),s=m(e.address,n.value,u);return{...e,messages:a,title:o,decoratorElement:s,...f(s)}}},getFormValues(e=!0){let r=t.getFormState().values;return e&&(r=v(p(),r)),r},async setFormValues(e,i){i=Object.assign({avoidDependKeyConnection:!0,needSplitExtendKey:!0,avoidWordbookSettingConnection:!0,avoidOperationalFormConnection:!0,dependKeyKeepValue:!1,avoidBusinessConnection:!1,overwrite:!0},i),F.triggerDisabled=i.avoidBusinessConnection,b.triggerDisabled=i.avoidDependKeyConnection,b.keepValue=i.dependKeyKeepValue,x.triggerDisabled=i.avoidWordbookSettingConnection,D.triggerDisabled=i.avoidOperationalFormConnection,i.needSplitExtendKey&&(e=y(p(),e)),t.setFieldState("*",(t=>{r(t)&&(i.overwrite||o.existIn(e,t.path))&&(t.value=o.getIn(e,t.path))})),await l(),F.triggerDisabled=!1,b.triggerDisabled=!1,x.triggerDisabled=!1,D.triggerDisabled=!1,b.keepValue=!1},setFieldState(e,r){t.setFieldState(e,r)},resetFields:(e="*")=>t.reset(e),queryWidget:e=>async function(e,t,r){if(!n.value)return s();const i=c(e,t,u);if(i)return s(i);const a=S(e,r);return a?(b.trigger(o.parse(a),!0),await l(),s(c(e,t,u))):s();function s(e){return{decoratorElement:e,...f(e)}}}(e,n.value,p()),applySelectedSetting(e){const o=t.getFormState().values;j(o,e,((e,o)=>{t.setFieldState(e,(e=>{r(e)&&e.setValue(o)}))}))}}}function F({props:e,formRenderRef:r,formModel:o}){return{onKeydown:async function i(s){var d;if(e.enterToNextWidget&&s.target){if("TEXTAREA"===s.target.tagName&&!s.ctrlKey)return;s.preventDefault()}if(await n(0),Reflect.get(s,"stopCapture")||!e.enterToNextWidget||!r.value)return;const l=t(s.target,(e=>e.classList.contains("form-render__formItem")));if(!l)return;const m=`.form-render__formItem${u.map((e=>`:not([widget-type=${e}])`)).join("")}`,f=Array.from(r.value.querySelectorAll(m)),c=f.findIndex((e=>e.id===l.id));if(!~c)return;const{widget:g,field:v}=p(f,c,s.target);if(g)if(a(e.enterToNextWidget)){const t=v&&o.query(v).take();!t||e.enterToNextWidget(null==(d=t.decoratorProps)?void 0:d.fieldItem)?y():i({target:g})}else y();async function y(){await n(0),g.focus()}}}}export{F as useFormDomEvent,b as useFormExposeEvent};
@@ -1,5 +1,4 @@
1
- import { LowCodeTypes } from '../../../../shared/types';
2
- import { Form } from '@formily/core';
3
- export declare function useSelectedSetting(formModel: Form): {
4
- applySelectedSetting: (selectedSettings: LowCodeTypes.selectedSettingConfig[]) => void;
1
+ import { AnyObject, LowCodeTypes } from '../../../../shared/types';
2
+ export declare function useSelectedSetting(): {
3
+ applySelectedSetting: (data: AnyObject, selectedSettings: LowCodeTypes.selectedSettingConfig[], setter?: ((key: string, value: any) => void) | undefined) => void;
5
4
  };
@@ -1 +1 @@
1
- import"../../../../shared/utils/index.js";import{isField as e}from"@formily/core";import{isEmpty as t}from"lodash-es";import{isMatchNewLowCodeConditionsWithSqlExpression as r}from"../../../../shared/utils/business.js";function i(i){return{applySelectedSetting:function(o){const s=i.getFormState().values;o.forEach((o=>{if(t(o.children))return;const l=o.children.find((e=>r(s,e)));l&&i.setFieldState(o.selectedField,(t=>{e(t)&&t.setValue(l.value)}))}))}}}export{i as useSelectedSetting};
1
+ import"../../../../shared/utils/index.js";import{isEmpty as e}from"lodash-es";import{isMatchNewLowCodeConditionsWithSqlExpression as i}from"../../../../shared/utils/business.js";function t(){return{applySelectedSetting:function(t,r,s){r.forEach((r=>{if(e(r.children))return;const l=r.children.find((e=>i(t,e)));l&&(s?s(r.selectedField,l.value):t[r.selectedField]=l.value)}))}}}export{t as useSelectedSetting};
@@ -3211,6 +3211,7 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<{
3211
3211
  verticalConfig?: {
3212
3212
  enable?: boolean | undefined;
3213
3213
  headerWidth?: number | "auto" | ((level: number) => number) | undefined;
3214
+ bodyWidth?: number | ((index: number) => number) | undefined;
3214
3215
  } | undefined;
3215
3216
  onFormChange?: ((payload_0: import("../../components/iho-table/src/types").IhoTableFormChangePayload) => void) | undefined;
3216
3217
  onCopy?: ((params: import("vxe-table").VxeTableDefines.CopyEventParams) => void) | undefined;
@@ -6774,6 +6775,7 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<{
6774
6775
  verticalConfig?: {
6775
6776
  enable?: boolean | undefined;
6776
6777
  headerWidth?: number | "auto" | ((level: number) => number) | undefined;
6778
+ bodyWidth?: number | ((index: number) => number) | undefined;
6777
6779
  } | undefined;
6778
6780
  onFormChange?: ((payload_0: import("../../components/iho-table/src/types").IhoTableFormChangePayload) => void) | undefined;
6779
6781
  onSettingClick?: (() => void) | undefined;
@@ -3212,6 +3212,7 @@ declare const _default: import("vue").DefineComponent<{
3212
3212
  verticalConfig?: {
3213
3213
  enable?: boolean | undefined;
3214
3214
  headerWidth?: number | "auto" | ((level: number) => number) | undefined;
3215
+ bodyWidth?: number | ((index: number) => number) | undefined;
3215
3216
  } | undefined;
3216
3217
  onFormChange?: ((payload_0: import("../../../components/iho-table/src/types").IhoTableFormChangePayload) => void) | undefined;
3217
3218
  onCopy?: ((params: import("vxe-table").VxeTableDefines.CopyEventParams) => void) | undefined;
@@ -6775,6 +6776,7 @@ declare const _default: import("vue").DefineComponent<{
6775
6776
  verticalConfig?: {
6776
6777
  enable?: boolean | undefined;
6777
6778
  headerWidth?: number | "auto" | ((level: number) => number) | undefined;
6779
+ bodyWidth?: number | ((index: number) => number) | undefined;
6778
6780
  } | undefined;
6779
6781
  onFormChange?: ((payload_0: import("../../../components/iho-table/src/types").IhoTableFormChangePayload) => void) | undefined;
6780
6782
  onSettingClick?: (() => void) | undefined;
@@ -1 +1 @@
1
- import{defineComponent as e,computed as t,provide as o,ref as a,toRaw as l,watch as n,resolveComponent as s,openBlock as r,createElementBlock as i,mergeProps as u,unref as c,createBlock as d,resolveDynamicComponent as f,createElementVNode as m,normalizeStyle as p,createVNode as v,withCtx as b,createSlots as h,renderList as g,createCommentVNode as x,renderSlot as k,normalizeProps as y,guardReactiveProps as C}from"vue";import{useTheme as D}from"../../../shared/hooks/useTheme.js";import{useDebounceFn as j}from"@vueuse/core";import"date-fns";import{isString as $,isEqualWith as I,isFunction as w,pick as q}from"lodash-es";import{useFormAsyncQueue as R,presetRequestHandler as H}from"../../../shared/hooks/useFormRequest/index.js";import{promiseTimeout as T}from"@vueuse/shared";import{widthAppend as _,uuidGenerator as P}from"../../../shared/utils/index.js";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{NConfigProvider as A}from"naive-ui";import{useVersion as L}from"../../../shared/hooks/useVersion.js";import{VxeTableEventNameList as S,InjectionIhoTableEmits as F,InjectionTableAsyncQueue as O,InjectionIhoTableAnnotation as B,InjectionIhoTableUUID as E,InjectionIhoTableInstance as N,InjectionIhoTableConfig as V,InjectionIhoTableFieldList as W,InjectionIhoTableHandler as z}from"./constants/index.js";import{createTableHooks as G,applyTableConfigHooks as J,applyTableFieldHooks as K,createTableEventHandlers as M,createDomInsertComponent as Q,createDataTransfer as U}from"./hooks/tapHooks/index.js";import{provideIhoTableEventListener as X}from"./hooks/tapHooks/useEventHooks.js";import{eventName2EventListener as Y}from"./utils/index.js";const Z=["id"];var ee=e({__name:"IhoTable",props:{tableConfig:{type:Object,default:()=>({})},fieldList:{type:Array,default:()=>[]},tableData:{type:Array,default:()=>[]},annotation:{type:Object},requestInstance:{type:Object},uniqueCacheData:{type:Boolean,default:!1},parallelism:{type:Number,default:3}},emits:["formChange","settingClick","formClick","keyboard","rowDrag",...S],setup(e,{expose:S,emit:ee}){var te,oe;const ae=e,le=D({"--c-border-color":"#d0d0d0","--c-head-bg-color":"#f2f2f2","--c-hover-color":"#e6e6e6","--c-stripe-color":"#f6f6f6"}),ne=t((()=>{var e,t;const o=null!=(t=null==(e=ae.tableConfig)?void 0:e.height)?t:"100%";return{height:"auto"===o?"100%":$(o)&&(o.includes("calc")||o.endsWith("%"))?o:_(o)}})),se=X(),re=function(e,...t){ee(e,...t);const o=c(fe)[Y(e)];w(o)&&o(...t),se.trigger(e,...t)};o(F,re);const ie=R(t((()=>ae.requestInstance)),t((()=>!!ae.uniqueCacheData))).create(ae.parallelism,{beforeRequest:(e,t)=>t,afterRequest:(e,t)=>H(t)});o(O,ie);const ue=G();o(B,t((()=>ae.annotation)));const ce=P();o(E,ce);const de=a();o(N,de);const fe=a({uuid:null!=(oe=null==(te=ae.tableConfig)?void 0:te.uuid)?oe:ce});o(V,fe);const me=j(pe,10);function pe(){var e,t;fe.value=J(ue,{...ae.tableConfig,uuid:null!=(t=null==(e=ae.tableConfig)?void 0:e.uuid)?t:ce},{$table:de,emits:re,globProps:ae})}const ve=a([]);o(W,ve);const be=j(he,10);function he(){const e=K(ue,ae.fieldList,fe.value,{$table:de,emits:re,globProps:ae});I(e,l(ve.value),((e,t)=>{if(w(e)&&w(t))return e.toString()===t.toString()}))||(ve.value=e)}const ge=U(ue,fe,de),xe=a([]);async function ke(){var e,t;const o=await ge(ae.tableData),a=null==(e=de.value)?void 0:e.getTableData().fullData;if(a){let e=0;if(!(a.some((t=>{var a;if(!(null==(a=de.value)?void 0:a.isInsertByRow(t))){if(t!==o[e])return!0;e++}}))||e!==o.length))return}xe.value=o,null==(t=de.value)||t.recalculate(!0)}const ye={updateTableDataRef:j(ke,10),updateConfigRef:me,updateFieldListRef:be};o(z,ye);const Ce=M({hooks:ue,config:fe,$table:de,context:ye,emits:re,globProps:ae}),De=t((()=>({...fe.value,...Ce})));let je=!1,$e=!1,Ie=!1;const we=j((()=>{je&&pe(),$e&&he(),Ie&&ke(),je=!1,$e=!1,Ie=!1}),10);n((()=>ae.tableConfig),(()=>{je=!0,$e=!0,Ie=!0,we()}),{deep:!0}),n((()=>ae.fieldList),(()=>{$e=!0,Ie=!0,we()}),{deep:!0}),n([()=>[...ae.tableData],()=>{var e;return null==(e=ae.tableData)?void 0:e.length}],(()=>{Ie=!0,we()})),n([()=>ae.tableData,()=>{var e;return null==(e=ae.tableData)?void 0:e.length}],(async()=>{var e,t;(null==(e=fe.value.treeConfig)?void 0:e.expandAll)&&(await T(11),null==(t=de.value)||t.setAllTreeExpand(!0))})),pe(),he(),ke();const{header:qe,footer:Re}=Q(ue);function He(e){return q(e,["row","rowIndex","$rowIndex","column","columnIndex","$columnIndex","_columnIndex","checked","disabled","indeterminate"])}return S({$table:de,async loadData(e){var t;null==(t=de.value)||t.loadData(await ge(e))},setSort:(e,t)=>({field:e,value:t}),setFilter:(e,t)=>({field:e,value:t}),reload(){var e,t;null==(e=de.value)||e.loadColumn([]),null==(t=de.value)||t.loadData([]),pe(),he(),ke()},verticalTable:{update:()=>{}},...ue.exposeHooks.expose.call({},fe,{$table:de,emits:re,globProps:ae,...ye})}),ue.setupHooks.setup.call(fe,ve,{$table:de,emits:re,globProps:ae}),(e,t)=>{const o=s("vxe-grid");return r(),i("section",u({class:"iho-table",id:c(ce),style:c(le)},c(L)()),[(r(),d(f(c(qe)))),m("section",{style:p(c(ne))},[v(c(A),{abstract:"",namespace:"vxe-table--ignore-clear"},{default:b((()=>[v(o,u({ref_key:"$table",ref:de},c(De),{columns:ve.value,data:xe.value}),h({_:2},[g(e.$slots,((t,o)=>({name:o,fn:b((t=>[x(" 实际上所有的vxe-grid插槽都支持 "),k(e.$slots,o,y(C(He(t))))]))})))]),1040,["columns","data"])])),_:3})],4),(r(),d(f(c(Re))))],16,Z)}}});export{ee as default};
1
+ import{defineComponent as e,computed as t,provide as o,ref as a,toRaw as l,watch as r,resolveComponent as n,openBlock as s,createElementBlock as i,mergeProps as u,unref as c,createBlock as d,resolveDynamicComponent as f,createElementVNode as m,normalizeStyle as p,createVNode as v,withCtx as b,createSlots as h,renderList as g,createCommentVNode as x,renderSlot as y,normalizeProps as k,guardReactiveProps as C}from"vue";import{useTheme as D,createOpacityColor as j}from"../../../shared/hooks/useTheme.js";import{useDebounceFn as $}from"@vueuse/core";import"date-fns";import{isString as I,isEqualWith as w,isFunction as q,pick as R}from"lodash-es";import{useFormAsyncQueue as H,presetRequestHandler as T}from"../../../shared/hooks/useFormRequest/index.js";import{promiseTimeout as _}from"@vueuse/shared";import{hex2rgba as P,widthAppend as A,uuidGenerator as L}from"../../../shared/utils/index.js";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{NConfigProvider as S}from"naive-ui";import{useVersion as F}from"../../../shared/hooks/useVersion.js";import{VxeTableEventNameList as O,InjectionIhoTableEmits as B,InjectionTableAsyncQueue as E,InjectionIhoTableAnnotation as N,InjectionIhoTableUUID as V,InjectionIhoTableInstance as W,InjectionIhoTableConfig as z,InjectionIhoTableFieldList as G,InjectionIhoTableHandler as J}from"./constants/index.js";import{createTableHooks as K,applyTableConfigHooks as M,applyTableFieldHooks as Q,createTableEventHandlers as U,createDomInsertComponent as X,createDataTransfer as Y}from"./hooks/tapHooks/index.js";import{provideIhoTableEventListener as Z}from"./hooks/tapHooks/useEventHooks.js";import{eventName2EventListener as ee}from"./utils/index.js";const te=["id"];var oe=e({__name:"IhoTable",props:{tableConfig:{type:Object,default:()=>({})},fieldList:{type:Array,default:()=>[]},tableData:{type:Array,default:()=>[]},annotation:{type:Object},requestInstance:{type:Object},uniqueCacheData:{type:Boolean,default:!1},parallelism:{type:Number,default:3}},emits:["formChange","settingClick","formClick","keyboard","rowDrag",...O],setup(e,{expose:O,emit:oe}){var ae,le;const re=e,ne=t((()=>{const e=D({"--c-border-color":"#d0d0d0","--c-head-bg-color":"#f2f2f2","--c-hover-color":"#e6e6e6","--c-stripe-color":"#f6f6f6"}).value;return e["--c-primary-color-opacity3"]=j(...P(e["--c-primary-color"]),.3),e})),se=t((()=>{var e,t;const o=null!=(t=null==(e=re.tableConfig)?void 0:e.height)?t:"100%";return{height:"auto"===o?"100%":I(o)&&(o.includes("calc")||o.endsWith("%"))?o:A(o)}})),ie=Z(),ue=function(e,...t){oe(e,...t);const o=c(pe)[ee(e)];q(o)&&o(...t),ie.trigger(e,...t)};o(B,ue);const ce=H(t((()=>re.requestInstance)),t((()=>!!re.uniqueCacheData))).create(re.parallelism,{beforeRequest:(e,t)=>t,afterRequest:(e,t)=>T(t)});o(E,ce);const de=K();o(N,t((()=>re.annotation)));const fe=L();o(V,fe);const me=a();o(W,me);const pe=a({uuid:null!=(le=null==(ae=re.tableConfig)?void 0:ae.uuid)?le:fe});o(z,pe);const ve=$(be,10);function be(){var e,t;pe.value=M(de,{...re.tableConfig,uuid:null!=(t=null==(e=re.tableConfig)?void 0:e.uuid)?t:fe},{$table:me,emits:ue,globProps:re})}const he=a([]);o(G,he);const ge=$(xe,10);function xe(){const e=Q(de,re.fieldList,pe.value,{$table:me,emits:ue,globProps:re});w(e,l(he.value),((e,t)=>{if(q(e)&&q(t))return e.toString()===t.toString()}))||(he.value=e)}const ye=Y(de,pe,me),ke=a([]);async function Ce(){var e,t;const o=await ye(re.tableData),a=null==(e=me.value)?void 0:e.getTableData().fullData;if(a){let e=0;if(!(a.some((t=>{var a;if(!(null==(a=me.value)?void 0:a.isInsertByRow(t))){if(t!==o[e])return!0;e++}}))||e!==o.length))return}ke.value=o,null==(t=me.value)||t.recalculate(!0)}const De={updateTableDataRef:$(Ce,10),updateConfigRef:ve,updateFieldListRef:ge};o(J,De);const je=U({hooks:de,config:pe,$table:me,context:De,emits:ue,globProps:re}),$e=t((()=>({...pe.value,...je})));let Ie=!1,we=!1,qe=!1;const Re=$((()=>{Ie&&be(),we&&xe(),qe&&Ce(),Ie=!1,we=!1,qe=!1}),10);r((()=>re.tableConfig),(()=>{Ie=!0,we=!0,qe=!0,Re()}),{deep:!0}),r((()=>re.fieldList),(()=>{we=!0,qe=!0,Re()}),{deep:!0}),r([()=>[...re.tableData],()=>{var e;return null==(e=re.tableData)?void 0:e.length}],(()=>{qe=!0,Re()})),r([()=>re.tableData,()=>{var e;return null==(e=re.tableData)?void 0:e.length}],(async()=>{var e,t;(null==(e=pe.value.treeConfig)?void 0:e.expandAll)&&(await _(11),null==(t=me.value)||t.setAllTreeExpand(!0))})),be(),xe(),Ce();const{header:He,footer:Te}=X(de);function _e(e){return R(e,["row","rowIndex","$rowIndex","column","columnIndex","$columnIndex","_columnIndex","checked","disabled","indeterminate"])}return O({$table:me,async loadData(e){var t;null==(t=me.value)||t.loadData(await ye(e))},setSort:(e,t)=>({field:e,value:t}),setFilter:(e,t)=>({field:e,value:t}),reload(){var e,t;null==(e=me.value)||e.loadColumn([]),null==(t=me.value)||t.loadData([]),be(),xe(),Ce()},verticalTable:{update:()=>{}},...de.exposeHooks.expose.call({},pe,{$table:me,emits:ue,globProps:re,...De})}),de.setupHooks.setup.call(pe,he,{$table:me,emits:ue,globProps:re}),(e,t)=>{const o=n("vxe-grid");return s(),i("section",u({class:"iho-table",id:c(fe),style:c(ne)},c(F)()),[(s(),d(f(c(He)))),m("section",{style:p(c(se))},[v(c(S),{abstract:"",namespace:"vxe-table--ignore-clear"},{default:b((()=>[v(o,u({ref_key:"$table",ref:me},c($e),{columns:he.value,data:ke.value}),h({_:2},[g(e.$slots,((t,o)=>({name:o,fn:b((t=>[x(" 实际上所有的vxe-grid插槽都支持 "),y(e.$slots,o,k(C(_e(t))))]))})))]),1040,["columns","data"])])),_:3})],4),(s(),d(f(c(Te))))],16,te)}}});export{oe as default};
@@ -13,6 +13,7 @@ declare const _default: import("vue").DefineComponent<{
13
13
  };
14
14
  }>> & {}>>;
15
15
  $table: (VxeTableConstructor & VxeTablePrivateMethods & VxeTableMethods) | undefined;
16
+ tableConfig: import("vue").Ref<import("../../../../../components/iho-table").IhoTableConfig>;
16
17
  multipleRef: import("vue").ComputedRef<boolean>;
17
18
  optionsRef: import("vue").ComputedRef<import("vxe-table").VxeTableDefines.FilterOption[] & VxeColumnPropTypes.Filter[]>;
18
19
  checkedRef: import("vue").WritableComputedRef<string[]>;
@@ -1 +1 @@
1
- import{defineComponent as e,inject as l,computed as a,ref as t,onDeactivated as u,onMounted as i,toRaw as o,openBlock as r,createElementBlock as n,unref as v,createBlock as c,createCommentVNode as s,createElementVNode as d,createVNode as p,isRef as f,withCtx as h,mergeProps as m,normalizeProps as _,guardReactiveProps as y,Fragment as b,renderList as k,toDisplayString as g,createTextVNode as C,normalizeStyle as L}from"vue";import w from"../../../../../shared/components/CancelRadio/CancelRadio.js";import{keywordMatcher as I,widthAppend as D}from"../../../../../shared/utils/index.js";import{useVirtualList as S}from"@vueuse/core";import{isNumber as U,isString as j,isFunction as x,isEqual as F}from"lodash-es";import{NInput as R,NCheckbox as W,NSpin as E,NCheckboxGroup as $,NRadioGroup as O,NButtonGroup as P,NButton as V}from"naive-ui";import{isVariableHeightTable as Y}from"../../utils/index.js";const q={class:"iho-table__filterWrapper"},z={key:1,class:"iho-table__filterCheckAllWrapper"},A={class:"iho-table__filterListItem"},H={class:"iho-table__filterListItem"},M=["title"],B=["title"],G={class:"iho-table__filterListItemContent"},J={class:"iho-table__filterFooter"};var K=e({__name:"filter",props:{payload:{type:Object,required:!0}},setup(e){const K=e,N=l("$xetable"),Q=a((()=>{var e;return!!(null==(e=K.payload)?void 0:e.column.filterMultiple)})),T=a((()=>{var e,l,a;return null!=(a=null==(l=null==(e=K.payload)?void 0:e.column)?void 0:l.filters)?a:[]})),X=a({get:()=>T.value.reduce(((e,l)=>(l.checked&&e.push(l.value),e)),[]),async set(e){if(!K.payload||!N)return;const l=N.reactData.filterStore.options||[];if(Q.value?(l.forEach((l=>l._checked=e.includes(l.value))),N.checkFilterOptions()):l.forEach((l=>l._checked=l.value===e[0])),!Y(N))return a();function a(){K.payload.$panel.confirmFilter(new CustomEvent("click"))}N.reactData.scrollYLoad=!0,a(),N.reactData.scrollYLoad=!1}}),Z=t([...X.value]),ee=t("");async function le(){N&&(N.reactData.filterStore.visible=!1)}u(le);const ae=a((()=>{var e,l;if(!K.payload||!K.payload.column)return 10;const{filterCapacity:a}=null!=(l=null==(e=K.payload.column.editRender)?void 0:e.props)?l:{};return U(a)&&a>0?a:10})),te=a((()=>ee.value?T.value.filter((e=>!!`${e.label}`.includes(ee.value)||(j(e.data)?I(ee.value,e.data):void 0))):T.value)),{list:ue,containerProps:ie,wrapperProps:oe}=S(te,{itemHeight:32,overscan:3}),re=a({get:()=>te.value.every((e=>Z.value.includes(e.value))),set(e){Z.value=e?[...new Set([...Z.value,...te.value.map((e=>e.value))])]:Z.value.filter((e=>te.value.every((l=>l.value!==e))))}}),ne=a((()=>te.value.some((e=>Z.value.includes(e.value)))&&!re.value)),ve=a({get:()=>Z.value.length===T.value.length&&0!==T.value.length,set:e=>{Z.value=e?T.value.map((e=>e.value)):[]}}),ce=a((()=>!!Z.value.length&&!ve.value)),se=a((()=>({height:D(32*ae.value)})));function de(){X.value=Q.value?Z.value:F(Z.value[0],null)?[]:[Z.value[0]],le()}function pe(){Z.value=Q.value?[]:[null]}const fe=t(!1);return i((async()=>{var e;if(!N)return;const l=null==(e=K.payload.column.editRender.props)?void 0:e.onFilterShow;if(x(l))try{fe.value=!0,await l(K.payload);const{filterStore:e}=N.reactData;o(e.options)!==o(T.value)&&(e.options=T.value)}finally{fe.value=!1}})),(e,l)=>(r(),n("section",q,[v(T).length>5?(r(),c(v(R),{key:0,value:ee.value,"onUpdate:value":l[0]||(l[0]=e=>ee.value=e)},null,8,["value"])):s("v-if",!0),v(Q)?(r(),n("div",z,[d("div",A,[p(v(W),{label:"全选当前",checked:v(re),"onUpdate:checked":l[1]||(l[1]=e=>f(re)?re.value=e:null),indeterminate:v(ne)},null,8,["checked","indeterminate"])]),d("div",H,[p(v(W),{label:"全选所有",checked:v(ve),"onUpdate:checked":l[2]||(l[2]=e=>f(ve)?ve.value=e:null),indeterminate:v(ce)},null,8,["checked","indeterminate"])])])):s("v-if",!0),p(v(E),{show:fe.value},{default:h((()=>[v(Q)?(r(),c(v($),{key:0,value:Z.value,"onUpdate:value":l[3]||(l[3]=e=>Z.value=e)},{default:h((()=>[d("section",m(v(ie),{style:v(se),class:"iho-table__filterListWrapper"}),[d("section",_(y(v(oe))),[(r(!0),n(b,null,k(v(ue),(e=>(r(),n("div",{class:"iho-table__filterListItem",key:e.data.value},[p(v(W),{value:e.data.value},{default:h((()=>[d("div",{class:"iho-table__filterListItemContent",title:e.data.label},g(e.data.label),9,M)])),_:2},1032,["value"])])))),128))],16)],16)])),_:1},8,["value"])):(r(),c(v(O),{key:1,value:Z.value[0],"onUpdate:value":l[5]||(l[5]=e=>Z.value[0]=e)},{default:h((()=>[d("section",m(v(ie),{style:v(se),class:"iho-table__filterListWrapper"}),[d("section",_(y(v(oe))),[(r(!0),n(b,null,k(v(ue),(e=>(r(),n("div",{class:"iho-table__filterListItem",key:e.data.value,title:e.data.label},[p(v(w),{value:e.data.value,currentValue:Z.value[0],cancelable:"",onCancel:l[4]||(l[4]=e=>Z.value=[null])},{default:h((()=>[d("div",G,g(e.data.label),1)])),_:2},1032,["value","currentValue"])],8,B)))),128))],16)],16)])),_:1},8,["value"]))])),_:1},8,["show"]),d("footer",J,[d("section",null,[v(Q)?(r(),n(b,{key:0},[C(" 已选择 "),d("span",{style:L({color:"var(--c-primary-color)"})},g(Z.value.length),5),C(" 项 ")],64)):s("v-if",!0)]),p(v(P),{size:"small"},{default:h((()=>[p(v(V),{onClick:pe},{default:h((()=>[C("清空")])),_:1}),p(v(V),{onClick:le},{default:h((()=>[C("取消")])),_:1}),p(v(V),{type:"primary",onClick:de},{default:h((()=>[C("确定")])),_:1})])),_:1})])]))}});export{K as default};
1
+ import{defineComponent as e,inject as l,computed as a,ref as t,onDeactivated as u,onMounted as i,toRaw as n,openBlock as o,createElementBlock as r,unref as v,createBlock as s,createCommentVNode as c,createElementVNode as d,createVNode as p,isRef as f,withCtx as m,mergeProps as h,normalizeProps as _,guardReactiveProps as y,Fragment as b,renderList as k,toDisplayString as g,createTextVNode as C,normalizeStyle as L}from"vue";import w from"../../../../../shared/components/CancelRadio/CancelRadio.js";import{keywordMatcher as D,widthAppend as I}from"../../../../../shared/utils/index.js";import{useVirtualList as j}from"@vueuse/core";import{isNumber as x,isString as F,isFunction as S,isEqual as U}from"lodash-es";import{NInput as R,NCheckbox as W,NSpin as E,NCheckboxGroup as Y,NRadioGroup as $,NButtonGroup as O,NButton as P}from"naive-ui";import{InjectionIhoTableConfig as V}from"../../constants/index.js";import{isVariableHeightTable as q}from"../../utils/index.js";const z={class:"iho-table__filterWrapper"},A={key:1,class:"iho-table__filterCheckAllWrapper"},H={class:"iho-table__filterListItem"},M={class:"iho-table__filterListItem"},B=["title"],G=["title"],J={class:"iho-table__filterListItemContent"},K={class:"iho-table__filterFooter"};var N=e({__name:"filter",props:{payload:{type:Object,required:!0}},setup(e){const N=e,Q=l("$xetable"),T=l(V),X=a((()=>{var e;return!!(null==(e=N.payload)?void 0:e.column.filterMultiple)})),Z=a((()=>{var e,l,a;return null!=(a=null==(l=null==(e=N.payload)?void 0:e.column)?void 0:l.filters)?a:[]})),ee=a({get:()=>Z.value.reduce(((e,l)=>(l.checked&&e.push(l.value),e)),[]),async set(e){var l,a,t,u;if(!N.payload||!Q)return;const i=Q.reactData.filterStore.options||[];if(X.value?(i.forEach((l=>l._checked=e.includes(l.value))),Q.checkFilterOptions()):i.forEach((l=>l._checked=l.value===e[0])),!q(Q))return n();function n(){N.payload.$panel.confirmFilter(new CustomEvent("click"))}(null!=(a=null==(l=Q.internalData.afterFullData)?void 0:l.length)?a:0)>(null!=(u=null==(t=T.value.scrollY)?void 0:t.gt)?u:100)&&(Q.reactData.scrollYLoad=!0),n(),Q.reactData.scrollYLoad=!1}}),le=t([...ee.value]),ae=t("");async function te(){Q&&(Q.reactData.filterStore.visible=!1)}u(te);const ue=a((()=>{var e,l;if(!N.payload||!N.payload.column)return 10;const{filterCapacity:a}=null!=(l=null==(e=N.payload.column.editRender)?void 0:e.props)?l:{};return x(a)&&a>0?a:10})),ie=a((()=>ae.value?Z.value.filter((e=>!!`${e.label}`.includes(ae.value)||(F(e.data)?D(ae.value,e.data):void 0))):Z.value)),{list:ne,containerProps:oe,wrapperProps:re}=j(ie,{itemHeight:32,overscan:3}),ve=a({get:()=>ie.value.every((e=>le.value.includes(e.value))),set(e){le.value=e?[...new Set([...le.value,...ie.value.map((e=>e.value))])]:le.value.filter((e=>ie.value.every((l=>l.value!==e))))}}),se=a((()=>ie.value.some((e=>le.value.includes(e.value)))&&!ve.value)),ce=a({get:()=>le.value.length===Z.value.length&&0!==Z.value.length,set:e=>{le.value=e?Z.value.map((e=>e.value)):[]}}),de=a((()=>!!le.value.length&&!ce.value)),pe=a((()=>({height:I(32*ue.value)})));function fe(){ee.value=X.value?le.value:U(le.value[0],null)?[]:[le.value[0]],te()}function me(){le.value=X.value?[]:[null]}const he=t(!1);return i((async()=>{var e;if(!Q)return;const l=null==(e=N.payload.column.editRender.props)?void 0:e.onFilterShow;if(S(l))try{he.value=!0,await l(N.payload);const{filterStore:e}=Q.reactData;n(e.options)!==n(Z.value)&&(e.options=Z.value)}finally{he.value=!1}})),(e,l)=>(o(),r("section",z,[v(Z).length>5?(o(),s(v(R),{key:0,value:ae.value,"onUpdate:value":l[0]||(l[0]=e=>ae.value=e)},null,8,["value"])):c("v-if",!0),v(X)?(o(),r("div",A,[d("div",H,[p(v(W),{label:"全选当前",checked:v(ve),"onUpdate:checked":l[1]||(l[1]=e=>f(ve)?ve.value=e:null),indeterminate:v(se)},null,8,["checked","indeterminate"])]),d("div",M,[p(v(W),{label:"全选所有",checked:v(ce),"onUpdate:checked":l[2]||(l[2]=e=>f(ce)?ce.value=e:null),indeterminate:v(de)},null,8,["checked","indeterminate"])])])):c("v-if",!0),p(v(E),{show:he.value},{default:m((()=>[v(X)?(o(),s(v(Y),{key:0,value:le.value,"onUpdate:value":l[3]||(l[3]=e=>le.value=e)},{default:m((()=>[d("section",h(v(oe),{style:v(pe),class:"iho-table__filterListWrapper"}),[d("section",_(y(v(re))),[(o(!0),r(b,null,k(v(ne),(e=>(o(),r("div",{class:"iho-table__filterListItem",key:e.data.value},[p(v(W),{value:e.data.value},{default:m((()=>[d("div",{class:"iho-table__filterListItemContent",title:e.data.label},g(e.data.label),9,B)])),_:2},1032,["value"])])))),128))],16)],16)])),_:1},8,["value"])):(o(),s(v($),{key:1,value:le.value[0],"onUpdate:value":l[5]||(l[5]=e=>le.value[0]=e)},{default:m((()=>[d("section",h(v(oe),{style:v(pe),class:"iho-table__filterListWrapper"}),[d("section",_(y(v(re))),[(o(!0),r(b,null,k(v(ne),(e=>(o(),r("div",{class:"iho-table__filterListItem",key:e.data.value,title:e.data.label},[p(v(w),{value:e.data.value,currentValue:le.value[0],cancelable:"",onCancel:l[4]||(l[4]=e=>le.value=[null])},{default:m((()=>[d("div",J,g(e.data.label),1)])),_:2},1032,["value","currentValue"])],8,G)))),128))],16)],16)])),_:1},8,["value"]))])),_:1},8,["show"]),d("footer",K,[d("section",null,[v(X)?(o(),r(b,{key:0},[C(" 已选择 "),d("span",{style:L({color:"var(--c-primary-color)"})},g(le.value.length),5),C(" 项 ")],64)):c("v-if",!0)]),p(v(O),{size:"small"},{default:m((()=>[p(v(P),{onClick:me},{default:m((()=>[C("清空")])),_:1}),p(v(P),{onClick:te},{default:m((()=>[C("取消")])),_:1}),p(v(P),{type:"primary",onClick:fe},{default:m((()=>[C("确定")])),_:1})])),_:1})])]))}});export{N as default};
@@ -1 +1 @@
1
- import{useAttrs as e,onBeforeUnmount as t,inject as l,createVNode as o}from"vue";import{arrayed as n,widthAppend as a}from"../../../../shared/utils/index.js";import{isObject as r,isString as i,isFunction as s}from"lodash-es";import u from"../../../annotation-edit/index.js";import"../../index.js";import{InjectionIhoTableAnnotation as d,InjectionIhoTableConfig as m}from"../constants/index.js";import{getLowCodeFieldFromField as h,IhoTableRenderHelper as c}from"../utils/index.js";import{defineTablePlugin as p}from"../hooks/useTablePlugin.js";function f(){const f="headerPlugin";return p({name:f,apply(p){let v=null;p.setupHooks.setup.tap(f,(()=>{v=e(),t((()=>{v=null}))})),p.fieldHooks.field.tap(f,(e=>{var t;const p=null==(t=e.slots)?void 0:t.header;return e.slots={...e.slots,header:t=>function(e,t,h){const p=l(d),f=l(m),x=l("$xetable"),b=e.column||{},j=r(null==p?void 0:p.value)&&!1!==t.annotation,g=c.isEditableColumn(f.value,b),w=c.hasFilter(t)||c.hasDateFiler(t),W=c.hasTitlePrefix(t),k=i(h)?h:s(h)?h(e):null;let y=!1;if(f.value){const e=f.value.editRules&&f.value.editRules[b.field];e&&(y=n(e).some((e=>e.required)))}const D=f.value.border?Math.max(2,Math.ceil(x.reactData.scrollbarWidth/x.reactData.tableColumn.length)):1,M=a(Math.max(0,b.renderWidth-20-D-(y?14:0)-(j?18:0)-(w?23:0)-(g?22:0)-(W?20:0)-(b.sortable?23:0)));return o("section",{class:"iho-table__headerWrapper"},[o("section",{style:{width:M}},[null!=k?k:o("div",{style:{maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},[function(){const e=b.title,t=/\\n|\n|\r/g;if(!t.test(e))return e;const l=e.replace(t,"<br>").split("<br>");return l.map(((e,t)=>[e,t===l.length-1?null:o("br",null,null)]))}()])]),j?o(u,{modelValue:p.value[b.field],"onUpdate:modelValue":e=>p.value[b.field]=e,shortcuts:v&&(v["annotation-shortcuts"]||v.annotationShortcuts)||[]},null):null])}(t,h(e),p)},e}))}})}export{f as default};
1
+ import{useAttrs as e,onBeforeUnmount as t,inject as l,createVNode as o}from"vue";import{arrayed as n,widthAppend as a}from"../../../../shared/utils/index.js";import{isObject as r,isString as i,isFunction as s}from"lodash-es";import u from"../../../annotation-edit/index.js";import"../../index.js";import{InjectionIhoTableAnnotation as d,InjectionIhoTableConfig as m}from"../constants/index.js";import{getLowCodeFieldFromField as c,IhoTableRenderHelper as h}from"../utils/index.js";import{defineTablePlugin as p}from"../hooks/useTablePlugin.js";function f(){const f="headerPlugin";return p({name:f,apply(p){let v=null;p.setupHooks.setup.tap(f,(()=>{v=e(),t((()=>{v=null}))})),p.fieldHooks.field.tap(f,(e=>{var t;const p=null==(t=e.slots)?void 0:t.header;return e.slots={...e.slots,header:t=>function(e,t,c){const p=l(d),f=l(m),x=l("$xetable"),b=e.column||{},j=r(null==p?void 0:p.value)&&!1!==t.annotation,g=h.isEditableColumn(f.value,b),w=h.hasFilter(t)||h.hasDateFiler(t),W=h.hasTitlePrefix(e.column),k=i(c)?c:s(c)?c(e):null;let y=!1;if(f.value){const e=f.value.editRules&&f.value.editRules[b.field];e&&(y=n(e).some((e=>e.required)))}const D=f.value.border?Math.max(2,Math.ceil(x.reactData.scrollbarWidth/x.reactData.tableColumn.length)):1,M=a(Math.max(0,b.renderWidth-20-D-(y?14:0)-(j?18:0)-(w?23:0)-(g?22:0)-(W?20:0)-(b.sortable?23:0)));return o("section",{class:"iho-table__headerWrapper"},[o("section",{style:{width:M}},[null!=k?k:o("div",{style:{maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},[function(){const e=b.title,t=/\\n|\n|\r/g;if(!t.test(e))return e;const l=e.replace(t,"<br>").split("<br>");return l.map(((e,t)=>[e,t===l.length-1?null:o("br",null,null)]))}()])]),j?o(u,{modelValue:p.value[b.field],"onUpdate:modelValue":e=>p.value[b.field]=e,shortcuts:v&&(v["annotation-shortcuts"]||v.annotationShortcuts)||[]},null):null])}(t,c(e),p)},e}))}})}export{f as default};
@@ -28,6 +28,7 @@ export declare const createVerticalTableHooks: () => {
28
28
  } | null;
29
29
  editStateEvent: (event: MouseEvent) => void;
30
30
  hoveringRow: AnyObject | null;
31
+ hoveringFieldKey: string | null;
31
32
  }>], void, import("../../../../../../../shared/utils/tapable").UnsetAdditionalOptions>;
32
33
  cellStyle: SyncWaterfallHook<[CSSProperties, {
33
34
  column: VxeTableDefines.ColumnInfo;
@@ -48,6 +49,7 @@ export declare const createVerticalTableHooks: () => {
48
49
  } | null;
49
50
  editStateEvent: (event: MouseEvent) => void;
50
51
  hoveringRow: AnyObject | null;
52
+ hoveringFieldKey: string | null;
51
53
  }>], import("../../../../../../../shared/utils/tapable").UnsetAdditionalOptions>;
52
54
  cellClassName: SyncWaterfallHook<[Record<string, boolean>, {
53
55
  column: VxeTableDefines.ColumnInfo;
@@ -67,6 +69,7 @@ export declare const createVerticalTableHooks: () => {
67
69
  } | null;
68
70
  editStateEvent: (event: MouseEvent) => void;
69
71
  hoveringRow: AnyObject | null;
72
+ hoveringFieldKey: string | null;
70
73
  }>], import("../../../../../../../shared/utils/tapable").UnsetAdditionalOptions>;
71
74
  config: SyncWaterfallHook<[IhoTableConfig, Partial<{
72
75
  originalTableConfig: IhoTableConfig;
@@ -84,6 +87,7 @@ export declare const createVerticalTableHooks: () => {
84
87
  } | null;
85
88
  editStateEvent: (event: MouseEvent) => void;
86
89
  hoveringRow: AnyObject | null;
90
+ hoveringFieldKey: string | null;
87
91
  }>], import("../../../../../../../shared/utils/tapable").UnsetAdditionalOptions>;
88
92
  headerRowStyle: SyncWaterfallHook<[CSSProperties, {
89
93
  $table: VxeTableConstructor & VxeTablePrivateMethods;
@@ -106,6 +110,7 @@ export declare const createVerticalTableHooks: () => {
106
110
  } | null;
107
111
  editStateEvent: (event: MouseEvent) => void;
108
112
  hoveringRow: AnyObject | null;
113
+ hoveringFieldKey: string | null;
109
114
  }>], import("../../../../../../../shared/utils/tapable").UnsetAdditionalOptions>;
110
115
  };
111
116
  export declare const usePresetVerticalPlugins: VerticalTablePlugin;
@@ -1 +1 @@
1
- import{isVerticalHeader as e,getOriginFieldFromRowData as t,getSpanInfo as n}from"../utils.js";const c=c=>{c.cellStyle.tap("useHeaderCSS",((c,{column:l,row:s})=>(e(l.field)||(s&&["checkbox","radio","seq"].includes(t(s).type||"")&&Object.assign(c,{textAlign:"center"}),Object.assign(c,{textShadow:"none"})),s&&n({row:s,column:l}).colspan>1&&Object.assign(c,{textAlign:"center"}),l.colSpan>1&&Object.assign(c,{textAlign:"center"}),c))),c.cellClassName.tap("useHeaderCSS",((t,{column:n})=>{const c=e(n.field);return Object.assign(t,{"vxe-header--column":c,"vxe-table--header":c,[n.field]:!0})}))};export{c as useHeaderCSS};
1
+ import{isVerticalHeader as e,getOriginFieldFromRowData as t,getSpanInfo as l}from"../utils.js";const n=n=>{n.cellStyle.tap("useHeaderCSS",((n,{column:c,row:s})=>(e(c.field)||(s&&["checkbox","radio","seq"].includes(t(s).type||"")&&Object.assign(n,{textAlign:"center"}),Object.assign(n,{textShadow:"none"})),s&&l({row:s,column:c}).colspan>1&&Object.assign(n,{textAlign:"center"}),c.colSpan>1&&Object.assign(n,{textAlign:"center"}),n))),n.cellClassName.tap("useHeaderCSS",((t,{column:l})=>{const n=e(l.field);return Object.assign(t,{"vxe-header--column":n,"vxe-table--header":n,[l.field.replaceAll("_parent","")]:!0})}))};export{n as useHeaderCSS};