cnhis-design-vue 3.1.54-beta.1 → 3.1.54-beta.10

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 (65) hide show
  1. package/es/components/callback/src/components/render/popupMaps.d.ts +46 -9
  2. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
  3. package/es/components/fabric-chart/src/hooks/electrocardiogram/hooks/useDetailEvent.d.ts +21 -4
  4. package/es/components/fabric-chart/src/hooks/electrocardiogram/hooks/useDetailEvent.js +1 -1
  5. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogram.js +1 -1
  6. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.js +1 -1
  7. package/es/components/fabric-chart/src/hooks/electrocardiogram/useMeasureInstrument.js +1 -1
  8. package/es/components/fabric-chart/src/hooks/index.js +1 -1
  9. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
  10. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
  11. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
  12. package/es/components/fabric-chart/src/hooks/temperature/useCenter.d.ts +1 -1
  13. package/es/components/fabric-chart/src/hooks/temperature/useLeft.d.ts +1 -1
  14. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  15. package/es/components/fabric-chart/src/hooks/temperature/useOther.d.ts +1 -1
  16. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
  17. package/es/components/fabric-chart/src/hooks/useCumputedPoint.d.ts +8 -2
  18. package/es/components/fabric-chart/src/hooks/useCumputedPoint.js +1 -1
  19. package/es/components/form-config/index.d.ts +74 -56
  20. package/es/components/form-config/src/FormConfig.vue.d.ts +75 -57
  21. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +18 -9
  22. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +30 -21
  23. package/es/components/form-config/src/components/FormConfigEventSetting.vue.d.ts +12 -12
  24. package/es/components/form-config/src/constants/index.d.ts +4 -4
  25. package/es/components/form-config/src/types/index.d.ts +3 -3
  26. package/es/components/form-render/index.d.ts +18 -9
  27. package/es/components/form-render/src/FormRender.vue.d.ts +19 -10
  28. package/es/components/form-render/src/FormRender.vue2.js +1 -1
  29. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +18 -9
  30. package/es/components/form-render/src/components/renderer/date.js +1 -1
  31. package/es/components/form-render/src/hooks/useFieldNormalize.d.ts +4 -4
  32. package/es/components/form-render/src/hooks/useFormRenderOptions.d.ts +2 -2
  33. package/es/components/form-render/src/hooks/useLowCodeReactions.d.ts +2 -2
  34. package/es/components/form-render/src/hooks/useOperationalForm.d.ts +7 -5
  35. package/es/components/form-render/src/hooks/useOperationalForm.js +1 -1
  36. package/es/components/form-render/src/types/fieldItem.d.ts +3 -3
  37. package/es/components/form-render/src/types/index.d.ts +3 -3
  38. package/es/components/iho-table/index.d.ts +28 -0
  39. package/es/components/iho-table/src/IhoTable.vue.d.ts +28 -0
  40. package/es/components/iho-table/src/plugins/operationalFormPlugin/index.js +1 -1
  41. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/editDate.vue.d.ts +1 -1
  42. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/editDate.vue2.js +1 -1
  43. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/index.js +1 -1
  44. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue.d.ts +1 -0
  45. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue2.js +1 -1
  46. package/es/components/iho-table/src/types/index.d.ts +7 -5
  47. package/es/components/info-header/index.d.ts +46 -28
  48. package/es/components/info-header/src/InfoHeader.vue.d.ts +46 -28
  49. package/es/components/info-header/src/components/infoDescription/DescriptionItem.vue.d.ts +2 -2
  50. package/es/components/info-header/src/components/infoDescription/DescriptionList.vue.d.ts +2 -2
  51. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +20 -11
  52. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +18 -9
  53. package/es/components/shortcut-setter/index.d.ts +20 -11
  54. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +20 -11
  55. package/es/components/table-filter/src/components/classify-filter/hooks/useFilterConditions.js +1 -1
  56. package/es/components/table-filter/src/hooks/useAdvanced.js +1 -1
  57. package/es/shared/hooks/useLevelSearchCascader.d.ts +2 -2
  58. package/es/shared/package.json.js +1 -1
  59. package/es/shared/types/business.d.ts +61 -53
  60. package/es/shared/utils/business.d.ts +11 -7
  61. package/es/shared/utils/business.js +1 -1
  62. package/es/shared/utils/index.js +1 -1
  63. package/package.json +2 -2
  64. package/es/components/fabric-chart/src/hooks/electrocardiogram/constants/index.d.ts +0 -2
  65. package/es/components/fabric-chart/src/hooks/electrocardiogram/constants/index.js +0 -1
@@ -132,10 +132,13 @@ export declare const CallbackMaps: Map<string, {
132
132
  default: boolean;
133
133
  };
134
134
  lowCodeReactions: {
135
- type: import("vue").PropType<import("../../../..").FormLowCodeReactions.Config[]>;
135
+ type: import("vue").PropType<import("../../../..").LowCodeTypes.reactionsConfig[]>;
136
136
  };
137
137
  operationalForm: {
138
- type: import("vue").PropType<import("../../../..").FormOperationalConfig[]>;
138
+ type: import("vue").PropType<import("../../../..").LowCodeTypes.operationalConfig[]>;
139
+ };
140
+ dateOperationalForm: {
141
+ type: import("vue").PropType<import("../../../..").LowCodeTypes.dateOperationalConfig[]>;
139
142
  };
140
143
  linebarAutoHidden: {
141
144
  type: BooleanConstructor;
@@ -281,10 +284,13 @@ export declare const CallbackMaps: Map<string, {
281
284
  default: boolean;
282
285
  };
283
286
  lowCodeReactions: {
284
- type: import("vue").PropType<import("../../../..").FormLowCodeReactions.Config[]>;
287
+ type: import("vue").PropType<import("../../../..").LowCodeTypes.reactionsConfig[]>;
285
288
  };
286
289
  operationalForm: {
287
- type: import("vue").PropType<import("../../../..").FormOperationalConfig[]>;
290
+ type: import("vue").PropType<import("../../../..").LowCodeTypes.operationalConfig[]>;
291
+ };
292
+ dateOperationalForm: {
293
+ type: import("vue").PropType<import("../../../..").LowCodeTypes.dateOperationalConfig[]>;
288
294
  };
289
295
  linebarAutoHidden: {
290
296
  type: BooleanConstructor;
@@ -366,7 +372,7 @@ export declare const CallbackMaps: Map<string, {
366
372
  }>;
367
373
  lowCodeReactionsHandler: (field: string) => void;
368
374
  triggerAllReactionsHandler: () => void;
369
- operationalFormHandler: (field: string) => void;
375
+ operationalFormHandler: (fieldKey: string) => void;
370
376
  triggerAllOperationalFormHandler: () => void;
371
377
  wordbookSettingHandler: {
372
378
  trigger: (fieldKey: string, value: unknown) => void;
@@ -455,11 +461,11 @@ export declare const CallbackMaps: Map<string, {
455
461
  businessFormatter: import("../../../../../../es/components/form-render").FormBusinessFormatter;
456
462
  requestInstance: import("../../../..").FormRequestDefine.RequestInstance;
457
463
  enterToNextWidget: boolean | ((fieldItem: import("../../../../../../es/components/form-render").FieldItem) => boolean | void);
458
- lowCodeReactions: import("../../../..").FormLowCodeReactions.Config[];
464
+ lowCodeReactions: import("../../../..").LowCodeTypes.reactionsConfig[];
459
465
  linebarAutoHidden: boolean;
460
466
  bordered: string | boolean;
461
467
  uniqueCacheData: boolean;
462
- operationalForm: import("../../../..").FormOperationalConfig[];
468
+ operationalForm: import("../../../..").LowCodeTypes.operationalConfig[];
463
469
  outBordered: boolean;
464
470
  forceClearable: boolean;
465
471
  }>) => Record<string, import("@formily/json-schema").Stringify<{
@@ -873,10 +879,13 @@ export declare const CallbackMaps: Map<string, {
873
879
  default: boolean;
874
880
  };
875
881
  lowCodeReactions: {
876
- type: import("vue").PropType<import("../../../..").FormLowCodeReactions.Config[]>;
882
+ type: import("vue").PropType<import("../../../..").LowCodeTypes.reactionsConfig[]>;
877
883
  };
878
884
  operationalForm: {
879
- type: import("vue").PropType<import("../../../..").FormOperationalConfig[]>;
885
+ type: import("vue").PropType<import("../../../..").LowCodeTypes.operationalConfig[]>;
886
+ };
887
+ dateOperationalForm: {
888
+ type: import("vue").PropType<import("../../../..").LowCodeTypes.dateOperationalConfig[]>;
880
889
  };
881
890
  linebarAutoHidden: {
882
891
  type: BooleanConstructor;
@@ -3135,12 +3144,26 @@ export declare const CallbackMaps: Map<string, {
3135
3144
  enable?: boolean | undefined;
3136
3145
  usePreset?: boolean | undefined;
3137
3146
  } | undefined;
3147
+ operationalForm?: {
3148
+ operationFormParam: string[];
3149
+ operationalRule: string;
3150
+ operationalPrecision: string;
3151
+ operationalResult: string;
3152
+ }[] | undefined;
3138
3153
  operationForm?: {
3139
3154
  operationFormParam: string[];
3140
3155
  operationalRule: string;
3141
3156
  operationalPrecision: string;
3142
3157
  operationalResult: string;
3143
3158
  }[] | undefined;
3159
+ dateOperationalForm?: {
3160
+ scene: "DIFF" | "CALC";
3161
+ precision: string;
3162
+ diffValUnit: "DAY" | "MIN" | "HOUR" | "DHM";
3163
+ diffValField: string;
3164
+ startDateField: string;
3165
+ endDateField: string;
3166
+ }[] | undefined;
3144
3167
  }>;
3145
3168
  updateConfigRefDebounced: () => void;
3146
3169
  updateConfigRef: () => void;
@@ -5578,12 +5601,26 @@ export declare const CallbackMaps: Map<string, {
5578
5601
  enable?: boolean | undefined;
5579
5602
  usePreset?: boolean | undefined;
5580
5603
  } | undefined;
5604
+ operationalForm?: {
5605
+ operationFormParam: string[];
5606
+ operationalRule: string;
5607
+ operationalPrecision: string;
5608
+ operationalResult: string;
5609
+ }[] | undefined;
5581
5610
  operationForm?: {
5582
5611
  operationFormParam: string[];
5583
5612
  operationalRule: string;
5584
5613
  operationalPrecision: string;
5585
5614
  operationalResult: string;
5586
5615
  }[] | undefined;
5616
+ dateOperationalForm?: {
5617
+ scene: "DIFF" | "CALC";
5618
+ precision: string;
5619
+ diffValUnit: "DAY" | "MIN" | "HOUR" | "DHM";
5620
+ diffValField: string;
5621
+ startDateField: string;
5622
+ endDateField: string;
5623
+ }[] | undefined;
5587
5624
  }>;
5588
5625
  configChanged: boolean;
5589
5626
  fieldChanged: boolean;
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as o,drawText as n,defaultTextStyle as i,drawPoint as r,drawTextAndIconGroup as l,defaultStyle as s,defaultRectStyle as a}from"../useDraw.js";import{useGrid as u}from"../useGrid.js";import{useBirthProcessCumputedPoint as c}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as d,drawScaleNumber as f,drawScaleLine as p}from"../useScaleColumn.js";import{useCommon as h}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as v,getTime as m,getScaleNumberList as y}from"../../utils/index.js";import"../temperature/useShadow.js";import{cloneDeep as k}from"lodash-es";import{format as w}from"date-fns";import"naive-ui";import"@vueuse/core";function x(x,b,j,C,P){const{cumputedX:S,cumputedY:E,getXValue:G,getYValue:M}=c(b),{getEqualXTypes:T,handleAddPrevent:Y,isGridLimit:L,setPrevAndNextPoint:X}=h(x,j,b),{xAxis:A,grid:I,originX:H,originY:W,xCellWidth:N,endY:O,startTime:V,leftAddAreaWidth:D,leftScales:R,rightScales:$,yCellHeight:B,endX:F,scaleValues:q,canvasWidth:z,borderStyle:J,rightAddAreaWidth:K,event:Q,originYCervix:U,other:Z,canvasHeight:_}=b,ee=k(q),te=new Set;function oe(){ee.filter((e=>e.show)).forEach(((e,l)=>{var s;const a=[],u=[],c=[];null==(s=e.data)||s.forEach(((s,d)=>{!function(s,d,f){let p,h;const{pointAttr:g={},lineAttr:v={},title:m="",key:y,type:k="circle",childbirthStyle:w={}}=e,P=e.data[f+1],S=se(P,e);if(s&&S&&!d.breakpoint)h=t([...s,...S],{...v});else if(s&&!S&&!d.breakpoint){const o=se(P,e);h=o?t([...s,...o],{...v}):null}let E,T;if(d.childbirth){const e=s[1]+B;E=o([s[0],s[1],e],w),c.push(E),T=n([s[0]+N/2,e-B/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(T)}const Y=u[f-1],L={origin:{data:d,title:m,key:y||"",dataIndex:l,index:f},leftLine:Y,rightLine:h,arrowGroup:E,arrowGroupText:T,...g,...b.event.hovered?b.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:b.event};Y?p=r(k,{left:Y.get("x2"),top:Y.get("y2"),...L}):s&&(L.leftLine=null,p=r(k,{left:s[0],top:s[1],...L}));u.push(h),p&&(!function(e){Q.hovered&&(e.on("mouseover",(()=>{le(e,"hover")})),e.on("mouseout",(()=>{C.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{re(e),function(e){var t,o,n,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(o=e.rightLine)||o.setCoords().set({x1:e.left,y1:e.top}),null==(n=e.arrowGroup)||n.setCoords().set({left:e.left,top:e.top}),null==(i=e.arrowGroupText)||i.setCoords().set({left:e.left+N/2,top:e.top+B/2})}(e),Q.hovered&&le(e)})),e.on("mouseup",(t=>{if(C.show=!1,1===t.button){const{key:t}=e.origin,o={...e.origin,data:{...e.origin.data,time:G(e.left),value:M(t,e.top)}};x.value.discardActiveObject(),j("change",o),ne(o,"change")}}))}(p),a.push(p),te.add(p))}(se(s,e),s,d)})),Promise.all(a).then((e=>{const t=u.filter((e=>e));X(e),Promise.all(c).then((o=>{x.value.add(...t,...e,...o),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function ne(e,t="add"){const{dataIndex:o,data:n,index:i,key:r}=e,l=ee.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=n;break;default:{const e=g(n.time,l.data);l.data.splice(e,0,n);break}}ie()}function ie(){var e;te.size&&(null==(e=x.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),(null==e?void 0:e.arrowGroup)&&t.push(null==e?void 0:e.arrowGroup),(null==e?void 0:e.arrowGroupText)&&t.push(null==e?void 0:e.arrowGroupText)})),t}([...te]))),te.clear(),oe()}function re(e){const t=e.prevPoint?e.prevPoint.left:H,o=e.nextPoint?e.nextPoint.left:F;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<U&&e.set("top",U),e.top<W&&e.set("top",W),e.top>O&&e.set("top",O),e.left<t&&e.set("left",t),e.left>o&&e.set("left",o)}function le(e,t="moving"){const{title:o,key:n,data:i}=e.origin;C.point={x:e.left,y:e.top},C.list=[`${o} ${"hover"===t?i.value:M(n,e.top)}`,`时间 ${G(e.left).slice(-5)}`],C.show=!0}function se(e,t){if(v(e)&&function(e){const t=V+864e5,o=m(e);return o>=V&&o<=t}(e.time)){const o=S(e.time),n=E(t.key,t.range,e.value);return[o,n<W?W:n>O?O:n]}}function ae(e,t){return e+1>t[1]?t[0]:e+1}return u(x,b),function(){const t=new e.Rect({...J,width:z-D-K-1,height:O-1,left:D,top:0,fill:"transparent"});x.value.add(t)}(),function(){function t(t,o="left"){let r="left"===o?D:F;t.forEach(((t,o)=>{const{range:l,spaceValue:u,width:c,title:h,titleStyle:g,key:v,position:m="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:b}=t,j=[],C=[],P=r+c/2,S=y(l,u),E=S.length;S.forEach(((e,o)=>{const{lineXMain:n,lineXSub:i,textLeft:l}=d(m,r,c),s=O-o*B*k,a=0===o?O-8:o!==S.length-1||W||U&&"FHR"!==v?s:W+8;!w||(0===o||o===E-1)&&!b||j.push(f(String(e),t,l,a)),C.push(...p(t,o,n,i,s,B,W,E))}));const G=new e.Rect({...a,strokeWidth:.5,width:c,height:O,left:P,top:O/2}),M=n([P,W>0?W-B/2:B/2],{value:String(h),...i,...g}),T=new e.Group([...C,...j,G,...M?[M]:[]],{objectCaching:!1,...s});x.value.add(T),T.sendToBack(),r+=c}))}t(R),t($,"right")}(),function(){const{show:t,startTime:o,range:r=[0,23],position:l="top",style:a}=A.time,{show:u,range:c=[0,23],position:d,style:f}=A.processTime;if(t||u){const p=[],h=[],g=[],v=[],m=H+N/2,y=B/2;for(let e=0;e<I.mainXCell;e++){if(t){const t=0===e?+o.slice(11,13):ae(p.at(-1),r);p.push(t);const s="top"===l?W-y:O+y;g.push(n([m+e*N,s],{value:String(t),...i,...a||{}}))}if(u){const t=0===e?c[0]:h.at(-1)+1;h.push(t);const o="top"===d?y:_-y;v.push(n([m+e*N,o],{value:String(t),...i,...f||{}}))}}const k=new e.Group([...g,...v],{objectCaching:!1,...s});x.value.add(k),x.value.sendToBack(k)}}(),function(){var e;const o=Object.values(Z),n=[],i={},r=ee.find((e=>"cervix"===e.key&&e.show)),l=null==(e=null==r?void 0:r.data)?void 0:e.find((e=>3==+e.value));function s(e,t){const{key:o,range:n}=r||{},i=E(o,n,10),l=[0,t],s=[-t/e,0],a=[(O-i-t)/e,O-i],u=[F-H,e*(F-H)+t];let c=[],d=[];function f([o,n]){return Math.abs(n-e*o-t)<=1}function p([e,t]){const[o,n]=[...h([e,t])];return o>=H&&o<=F&&n>=i&&n<=O}function h([e,t]){return[H+e,O-t]}return f(l)&&p(l)&&(c=h(l)),f(s)&&p(s)&&(c=h(s)),f(a)&&p(a)&&(d=h(a)),f(u)&&p(u)&&(d=h(u)),[...c,...d]}o.forEach((e=>{if(!e.show)return;const{key:o}=e;switch(o){case"fetalPresentation":{const{range:i,show:r}=ee.find((e=>e.key===o));if(r){const r=E(o,i,0);n.push(t([H,r,F,r],{...e}))}break}case"alert":if(l){const{key:o,range:a}=r||{},u=216e5,c={time:w(new Date(m(l.time)+u),"yyyy-MM-dd HH:mm"),value:10},[d,f]=[S(l.time)-H,O-E(o,a,l.value)],[p,h]=[S(c.time)-H,O-E(o,a,c.value)],g=(h-f)/(p-d),v=f-d*g,y=s(g,v);y.length>0&&(n.push(t(y,{...e})),Object.assign(i,{k:g,b:v}))}break;case"handling":if(l){const{k:o,b:r}=i,a=144e5,u=s(o,r-(S(w(new Date(m(l.time)+a),"yyyy-MM-dd HH:mm"))-S(l.time))*o);u.length>0&&n.push(t(u,{...e}))}}})),x.value.add(...n)}(),oe(),function(){function e(e,t){const o=ee.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:o,key:e.key},pointer:t}}b.event.evented&&x.value.on("mouse:up",(t=>{if(3===t.button){const{x:o=0,y:n=0}=t.pointer||{};o>=H&&o<=F&&n>=W&&n<=O&&(P.point={x:o,y:n},P.show=!0,t.target?(P.target=t.target,P.list=["删除节点"],[...te].forEach((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&P.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(P.target=null,P.list=["新增节点"],ee.filter((e=>e.show)).forEach((i=>{if(!T([...te],o,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&n<U)return;P.list.push(e(i,t.pointer))}})),1===P.list.length&&(P.show=!1,Y("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=z-K/2;function t(e,t){if(!e.length)return;let n=W;const i=[];e.forEach((e=>{const o=e.title.split("").join("\n"),r=q.findIndex((t=>t.key===e.key)),{text:s,icon:a}=l(o,e,{text:{originY:"top",left:t,top:n},icon:{left:t,topY:n,originY:"top",origin:{type:e.type,dataIndex:r},...b.event}},"vertical");var u;n+=s.height+a.height+15,(u=a).on("moving",(()=>{u.set("originY","center"),L(u)?(re(u),le(u)):C.show=!1})),u.on("mouseup:before",(e=>{if(C.show=!1,0===e.e.button&&L(u))if(T([...te],u.left,"key").includes(u.origin.key))Y("repeat");else{const e={data:{time:G(u.left),value:M(u.origin.key,u.top)},...u.origin};j("add",e),ne(e)}!function(e){e.setCoords().set({originY:"top",left:e.originLeft,top:e.originTop})}(u)})),i.push(s,a)})),o(i),x.value.add(...i)}function o(e){const t=e.at(-1),o=(O-W)/2,n=(t.height+t.top-W)/2;e.forEach((e=>{const t=e.top+o-n;e.set({top:t,originTop:t})}))}t(R,D/2),t($,e)}(),{clickMenu:function({item:e,target:t}){const o={...e.origin};"remove"===e.mode?(j("remove",o),ne(o,"remove")):(Object.assign(o,{data:{time:G(e.pointer.x),value:M(e.origin.key,e.pointer.y)}}),j("add",o),ne(o))},redrawPoints:ie}}export{x as useBirthProcess};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as o,drawText as n,defaultTextStyle as i,drawPoint as r,drawTextAndIconGroup as l,defaultStyle as s,defaultRectStyle as a}from"../useDraw.js";import{useGrid as u}from"../useGrid.js";import{useBirthProcessCumputedPoint as c}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as d,drawScaleNumber as f,drawScaleLine as p}from"../useScaleColumn.js";import{useCommon as h}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as v,getTime as m,getScaleNumberList as y}from"../../utils/index.js";import"../temperature/useShadow.js";import{cloneDeep as k}from"lodash-es";import{format as w}from"date-fns";import"naive-ui";import"@vueuse/core";function x(x,b,j,C,P){const{computedX:S,cumputedY:E,getXValue:G,getYValue:M}=c(b),{getEqualXTypes:T,handleAddPrevent:Y,isGridLimit:L,setPrevAndNextPoint:X}=h(x,j,b),{xAxis:A,grid:I,originX:H,originY:W,xCellWidth:N,endY:O,startTime:V,leftAddAreaWidth:D,leftScales:R,rightScales:$,yCellHeight:B,endX:F,scaleValues:q,canvasWidth:z,borderStyle:J,rightAddAreaWidth:K,event:Q,originYCervix:U,other:Z,canvasHeight:_}=b,ee=k(q),te=new Set;function oe(){ee.filter((e=>e.show)).forEach(((e,l)=>{var s;const a=[],u=[],c=[];null==(s=e.data)||s.forEach(((s,d)=>{!function(s,d,f){let p,h;const{pointAttr:g={},lineAttr:v={},title:m="",key:y,type:k="circle",childbirthStyle:w={}}=e,P=e.data[f+1],S=se(P,e);if(s&&S&&!d.breakpoint)h=t([...s,...S],{...v});else if(s&&!S&&!d.breakpoint){const o=se(P,e);h=o?t([...s,...o],{...v}):null}let E,T;if(d.childbirth){const e=s[1]+B;E=o([s[0],s[1],e],w),c.push(E),T=n([s[0]+N/2,e-B/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(T)}const Y=u[f-1],L={origin:{data:d,title:m,key:y||"",dataIndex:l,index:f},leftLine:Y,rightLine:h,arrowGroup:E,arrowGroupText:T,...g,...b.event.hovered?b.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:b.event};Y?p=r(k,{left:Y.get("x2"),top:Y.get("y2"),...L}):s&&(L.leftLine=null,p=r(k,{left:s[0],top:s[1],...L}));u.push(h),p&&(!function(e){Q.hovered&&(e.on("mouseover",(()=>{le(e,"hover")})),e.on("mouseout",(()=>{C.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{re(e),function(e){var t,o,n,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(o=e.rightLine)||o.setCoords().set({x1:e.left,y1:e.top}),null==(n=e.arrowGroup)||n.setCoords().set({left:e.left,top:e.top}),null==(i=e.arrowGroupText)||i.setCoords().set({left:e.left+N/2,top:e.top+B/2})}(e),Q.hovered&&le(e)})),e.on("mouseup",(t=>{if(C.show=!1,1===t.button){const{key:t}=e.origin,o={...e.origin,data:{...e.origin.data,time:G(e.left),value:M(t,e.top)}};x.value.discardActiveObject(),j("change",o),ne(o,"change")}}))}(p),a.push(p),te.add(p))}(se(s,e),s,d)})),Promise.all(a).then((e=>{const t=u.filter((e=>e));X(e),Promise.all(c).then((o=>{x.value.add(...t,...e,...o),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function ne(e,t="add"){const{dataIndex:o,data:n,index:i,key:r}=e,l=ee.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=n;break;default:{const e=g(n.time,l.data);l.data.splice(e,0,n);break}}ie()}function ie(){var e;te.size&&(null==(e=x.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),(null==e?void 0:e.arrowGroup)&&t.push(null==e?void 0:e.arrowGroup),(null==e?void 0:e.arrowGroupText)&&t.push(null==e?void 0:e.arrowGroupText)})),t}([...te]))),te.clear(),oe()}function re(e){const t=e.prevPoint?e.prevPoint.left:H,o=e.nextPoint?e.nextPoint.left:F;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<U&&e.set("top",U),e.top<W&&e.set("top",W),e.top>O&&e.set("top",O),e.left<t&&e.set("left",t),e.left>o&&e.set("left",o)}function le(e,t="moving"){const{title:o,key:n,data:i}=e.origin;C.point={x:e.left,y:e.top},C.list=[`${o} ${"hover"===t?i.value:M(n,e.top)}`,`时间 ${G(e.left).slice(-5)}`],C.show=!0}function se(e,t){if(v(e)&&function(e){const t=V+864e5,o=m(e);return o>=V&&o<=t}(e.time)){const o=S(e.time),n=E(t.key,t.range,e.value);return[o,n<W?W:n>O?O:n]}}function ae(e,t){return e+1>t[1]?t[0]:e+1}return u(x,b),function(){const t=new e.Rect({...J,width:z-D-K-1,height:O-1,left:D,top:0,fill:"transparent"});x.value.add(t)}(),function(){function t(t,o="left"){let r="left"===o?D:F;t.forEach(((t,o)=>{const{range:l,spaceValue:u,width:c,title:h,titleStyle:g,key:v,position:m="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:b}=t,j=[],C=[],P=r+c/2,S=y(l,u),E=S.length;S.forEach(((e,o)=>{const{lineXMain:n,lineXSub:i,textLeft:l}=d(m,r,c),s=O-o*B*k,a=0===o?O-8:o!==S.length-1||W||U&&"FHR"!==v?s:W+8;!w||(0===o||o===E-1)&&!b||j.push(f(String(e),t,l,a)),C.push(...p(t,o,n,i,s,B,W,E))}));const G=new e.Rect({...a,strokeWidth:.5,width:c,height:O,left:P,top:O/2}),M=n([P,W>0?W-B/2:B/2],{value:String(h),...i,...g}),T=new e.Group([...C,...j,G,...M?[M]:[]],{objectCaching:!1,...s});x.value.add(T),T.sendToBack(),r+=c}))}t(R),t($,"right")}(),function(){const{show:t,startTime:o,range:r=[0,23],position:l="top",style:a}=A.time,{show:u,range:c=[0,23],position:d,style:f}=A.processTime;if(t||u){const p=[],h=[],g=[],v=[],m=H+N/2,y=B/2;for(let e=0;e<I.mainXCell;e++){if(t){const t=0===e?+o.slice(11,13):ae(p.at(-1),r);p.push(t);const s="top"===l?W-y:O+y;g.push(n([m+e*N,s],{value:String(t),...i,...a||{}}))}if(u){const t=0===e?c[0]:h.at(-1)+1;h.push(t);const o="top"===d?y:_-y;v.push(n([m+e*N,o],{value:String(t),...i,...f||{}}))}}const k=new e.Group([...g,...v],{objectCaching:!1,...s});x.value.add(k),x.value.sendToBack(k)}}(),function(){var e;const o=Object.values(Z),n=[],i={},r=ee.find((e=>"cervix"===e.key&&e.show)),l=null==(e=null==r?void 0:r.data)?void 0:e.find((e=>3==+e.value));function s(e,t){const{key:o,range:n}=r||{},i=E(o,n,10),l=[0,t],s=[-t/e,0],a=[(O-i-t)/e,O-i],u=[F-H,e*(F-H)+t];let c=[],d=[];function f([o,n]){return Math.abs(n-e*o-t)<=1}function p([e,t]){const[o,n]=[...h([e,t])];return o>=H&&o<=F&&n>=i&&n<=O}function h([e,t]){return[H+e,O-t]}return f(l)&&p(l)&&(c=h(l)),f(s)&&p(s)&&(c=h(s)),f(a)&&p(a)&&(d=h(a)),f(u)&&p(u)&&(d=h(u)),[...c,...d]}o.forEach((e=>{if(!e.show)return;const{key:o}=e;switch(o){case"fetalPresentation":{const{range:i,show:r}=ee.find((e=>e.key===o));if(r){const r=E(o,i,0);n.push(t([H,r,F,r],{...e}))}break}case"alert":if(l){const{key:o,range:a}=r||{},u=216e5,c={time:w(new Date(m(l.time)+u),"yyyy-MM-dd HH:mm"),value:10},[d,f]=[S(l.time)-H,O-E(o,a,l.value)],[p,h]=[S(c.time)-H,O-E(o,a,c.value)],g=(h-f)/(p-d),v=f-d*g,y=s(g,v);y.length>0&&(n.push(t(y,{...e})),Object.assign(i,{k:g,b:v}))}break;case"handling":if(l){const{k:o,b:r}=i,a=144e5,u=s(o,r-(S(w(new Date(m(l.time)+a),"yyyy-MM-dd HH:mm"))-S(l.time))*o);u.length>0&&n.push(t(u,{...e}))}}})),x.value.add(...n)}(),oe(),function(){function e(e,t){const o=ee.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:o,key:e.key},pointer:t}}b.event.evented&&x.value.on("mouse:up",(t=>{if(3===t.button){const{x:o=0,y:n=0}=t.pointer||{};o>=H&&o<=F&&n>=W&&n<=O&&(P.point={x:o,y:n},P.show=!0,t.target?(P.target=t.target,P.list=["删除节点"],[...te].forEach((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&P.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(P.target=null,P.list=["新增节点"],ee.filter((e=>e.show)).forEach((i=>{if(!T([...te],o,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&n<U)return;P.list.push(e(i,t.pointer))}})),1===P.list.length&&(P.show=!1,Y("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=z-K/2;function t(e,t){if(!e.length)return;let n=W;const i=[];e.forEach((e=>{const o=e.title.split("").join("\n"),r=q.findIndex((t=>t.key===e.key)),{text:s,icon:a}=l(o,e,{text:{originY:"top",left:t,top:n},icon:{left:t,topY:n,originY:"top",origin:{type:e.type,dataIndex:r},...b.event}},"vertical");var u;n+=s.height+a.height+15,(u=a).on("moving",(()=>{u.set("originY","center"),L(u)?(re(u),le(u)):C.show=!1})),u.on("mouseup:before",(e=>{if(C.show=!1,0===e.e.button&&L(u))if(T([...te],u.left,"key").includes(u.origin.key))Y("repeat");else{const e={data:{time:G(u.left),value:M(u.origin.key,u.top)},...u.origin};j("add",e),ne(e)}!function(e){e.setCoords().set({originY:"top",left:e.originLeft,top:e.originTop})}(u)})),i.push(s,a)})),o(i),x.value.add(...i)}function o(e){const t=e.at(-1),o=(O-W)/2,n=(t.height+t.top-W)/2;e.forEach((e=>{const t=e.top+o-n;e.set({top:t,originTop:t})}))}t(R,D/2),t($,e)}(),{clickMenu:function({item:e,target:t}){const o={...e.origin};"remove"===e.mode?(j("remove",o),ne(o,"remove")):(Object.assign(o,{data:{time:G(e.pointer.x),value:M(e.origin.key,e.pointer.y)}}),j("add",o),ne(o))},redrawPoints:ie}}export{x as useBirthProcess};
@@ -1,11 +1,28 @@
1
+ import { AnyObject } from '../../../../../../../es/shared/types';
1
2
  import { fabric } from '../../../../../../../es/shared/utils/fabricjs';
2
- declare type DetailEventOptions = Partial<{
3
- beforeEvent: () => any | Promise<any>;
3
+ declare type DetailEventOptions = {
4
+ points: number[];
5
+ lineStartIndex: number;
6
+ beforeEvent?: () => any | Promise<any>;
7
+ xCellWidth: number;
8
+ yCellHeight: number;
4
9
  showScaleText: boolean;
5
- }> & {
10
+ showNumberText: boolean;
11
+ detailRadius: number;
6
12
  scale: number;
7
13
  endX: number;
8
14
  endY: number;
15
+ hz: number;
16
+ grid: {
17
+ mainLineStyle: {
18
+ x: AnyObject;
19
+ y: AnyObject;
20
+ };
21
+ subLineStyle: AnyObject;
22
+ };
23
+ mainXCellValue: number;
24
+ mainYCellValue: number;
25
+ valueUnit: 'v' | 'mv' | 'uv';
9
26
  };
10
- export declare function useDetailEvent(polyline: fabric.Polyline, { scale, beforeEvent, endY, endX, showScaleText }: DetailEventOptions): void;
27
+ export declare function useDetailEvent(polyline: fabric.Polyline, options: DetailEventOptions): void;
11
28
  export {};
@@ -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"../../temperature/useShadow.js";import"naive-ui";import"@vueuse/core";import{POLYLINE_BASIC_SCALE as n,DETAIL_RADIUS as o}from"../constants/index.js";function r(r,{scale:s,beforeEvent:a,endY:i,endX:l,showScaleText:p=!0}){let u=null;function d(){var t;u&&(null==(t=r.canvas)||t.remove(u)),u=null}r.on("mousedown",(async f=>{var c,h;if(await(null==a?void 0:a()),1!==f.button||!f.target||!f.pointer)return;const y=f.target;if(!y.points)return;const{x:w,y:m}=f.pointer,x=(w-(y.left||0))/n;let v=x-o,g=x+o;v<=0?(v=0,g=Math.min(2*o,y.points.length-1)):g>=y.points.length-1&&(g=y.points.length-1,v=Math.max(y.points.length-2*o,0));const k=y.points.slice(v,g).map((({y:t},e)=>({x:e,y:t}))),b=x-v;let j=0,A=0;k.forEach(((t,e)=>{t.y>k[j].y&&(j=e),t.y<k[A].y&&(A=e)}));const D=n*s*o*2-1,S=n*s*(k[j].y-k[A].y)-1,E=S+30+70,L={x:l-w<=D?w-D:w,y:i-m<=E?m-E:m};var W,X,Y;d(),u=new t.Group([],{}),u.add(new t.Rect({...e,left:L.x,top:L.y,width:D,height:E,stroke:"transparent",fill:"#fff",shadow:new t.Shadow({color:"rgba(0, 0, 0, 0.3)",blur:15,offsetX:8,offsetY:8})}),(Y=k,new t.Polyline(Y,{...e,fill:"transparent",stroke:"red",strokeWidth:2,scaleX:n*s,scaleY:n*s,left:L.x,top:L.y+30})),function(n,o){const r=new t.Line(i(n[j]),{...e,stroke:"red",strokeDashArray:[3,4],width:3,left:L.x+j/k.length*D,top:L.y}),s=new t.Line(i(n[A]),{...e,stroke:"blue",strokeDashArray:[3,4],width:3,left:L.x+A/k.length*D,top:L.y}),a=new t.Line(i(n[o]),{...e,stroke:"green",strokeDashArray:[3,4],width:3,left:L.x+o/k.length*D,top:L.y});return new t.Group([r,s,a],{});function i(t){return[t.x,t.y,t.x,t.y-E]}}(k,b),(W=k,X=b,new t.Circle({...e,radius:5,fill:"transparent",stroke:"green",strokeWidth:1,left:L.x+X/k.length*D-5,top:L.y+(W[b].y-W[A].y)/(W[j].y-W[A].y)*S-5+30}))),p&&u.add(new t.Text(`x${s}`,{fill:"black",fontSize:20,left:L.x+10,top:L.y+E-30})),null==(c=r.canvas)||c.add(u),u.addWithUpdate(),null==(h=r.canvas)||h.discardActiveObject()})),r.on("mouseup",(async t=>{await(null==a?void 0:a()),1===t.button&&d()}))}export{r as useDetailEvent};
1
+ import{fabric as e}from"../../../../../../shared/utils/fabricjs/index.js";import{range as t}from"lodash-es";import{defaultStyle as n}from"../../useDraw.js";import{useElectrocardiogramCumputedPoint as o}from"../../useCumputedPoint.js";import"../../useEvent.js";import"vue";import"date-fns";import"../../temperature/useShadow.js";import"naive-ui";import"@vueuse/core";function r(r,i){const{scale:l,beforeEvent:s,endY:u,endX:a,showScaleText:f,showNumberText:p,detailRadius:c,points:y,lineStartIndex:d,xCellWidth:h,yCellHeight:m,grid:w={subLineStyle:{},mainLineStyle:{x:{},y:{}}}}=i;let x=null;const{computedX:g,cumputedY:v,getYValue:b}=o(i);function S(e){return g(e)*l}function k(e){return v(e)*l}function L(e){return b(e/l)}const j=h*l,G=m*l;function T(){var e;x&&(null==(e=r.canvas)||e.remove(x)),x=null}r.on("mousedown",(async o=>{var i,h;if(await(null==s?void 0:s()),1!==o.button||!o.target||!o.pointer)return;const m=o.target;if(!m.points)return;const{x:g,y:v}=o.pointer,b=Math.floor((g-m.left)/m.width*m.points.length)+d;let M=b-c,C=b+c;M<=0?(M=0,C=Math.min(2*c,y.length-1)):C>=y.length-1&&(C=y.length-1,M=Math.max(y.length-2*c,0));const W=y.slice(M,C).map(((e,t)=>({x:M+S(t),y:k(e)}))),Y=b-M;let $=0,E=0;W.forEach(((e,t)=>{e.y>W[$].y&&($=t),e.y<W[E].y&&(E=t)}));const X=S(2*c-1),z=W[$].y-W[E].y-1,A=z+30+70,D={x:a-g<=X?g-X:g,y:u-v<=A?v-A:v};T(),x=new e.Group;const P=[new e.Rect({...n,left:D.x,top:D.y,width:X,height:A,stroke:"transparent",fill:"#fff",shadow:new e.Shadow({color:"rgba(0, 0, 0, 0.3)",blur:15,offsetX:8,offsetY:8})}),function(){const n=e=>e%5?w.subLineStyle:null,o=Math.ceil(A/G*5),r=new e.Group(t(o).map((t=>{const o=t*G/5;return new e.Line([0,o,X,o],{...w.mainLineStyle.y,...n(t)})}))),i=Math.ceil(X/j*5),l=new e.Group(t(i).map((t=>{const o=t*j/5;return new e.Line([o,0,o,A],{...w.mainLineStyle.x,...n(t)})})));return new e.Group([l,r],{left:D.x,top:D.y})}(),(I=W.map((({x:e,y:t})=>({x:e,y:-t}))),new e.Polyline(I,{...n,fill:"transparent",stroke:"red",strokeWidth:1,left:D.x,top:D.y+30})),function(t,o){const r={strokeDashArray:[3,4],width:3,top:D.y},i=new e.Line(u(t[$]),{...n,...r,left:D.x+$/t.length*X,stroke:"red"}),l=new e.Line(u(t[E]),{...n,...r,stroke:"blue",left:D.x+E/t.length*X}),s=new e.Line(u(t[o]),{...n,...r,stroke:"green",left:D.x+o/t.length*X});return new e.Group([i,l,s]);function u(e){return[e.x,e.y,e.x,e.y-A]}}(W,Y),(R=W,H=Y,new e.Circle({...n,radius:5,fill:"transparent",stroke:"green",strokeWidth:1,left:D.x+H/R.length*X-5,top:D.y+(R[H].y-R[$].y)/(R[E].y-R[$].y)*z-5+30}))];var R,H,I;f&&P.push(new e.Text(`x${l}`,{...n,fill:"black",fontSize:20,left:D.x+10,top:D.y+A-30})),p&&P.push(function(t,o){const r={fontSize:16,left:D.x+X/2+10},i=new e.Text(`最大: ${L(t[$].y)} mv`,{...n,...r,fill:"red",top:D.y+A-20}),l=new e.Text(`最小: ${L(t[E].y)} mv`,{...n,...r,fill:"blue",top:D.y+A-40}),s=new e.Text(`当前: ${L(t[o].y)} mv`,{...n,...r,fill:"green",top:D.y+A-60});return new e.Group([i,l,s])}(W,Y)),x.add(...P).addWithUpdate(),null==(i=r.canvas)||i.add(x),null==(h=r.canvas)||h.discardActiveObject()})),r.on("mouseup",(async e=>{await(null==s?void 0:s()),1===e.button&&T()}))}export{r as useDetailEvent};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useThrottleFn as t}from"@vueuse/core";import{range as r}from"lodash-es";import{useDetailEvent as o}from"./hooks/useDetailEvent.js";import{defaultTextStyle as n,drawLine as i}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import"date-fns";import"../useEvent.js";import"vue";import"../temperature/useShadow.js";import"naive-ui";import{POLYLINE_BASIC_SCALE as a}from"./constants/index.js";function l(l,d,c){const{borderStyle:u,originX:f,originY:m,xCellWidth:h,endY:p,yCellHeight:v,endX:g,canvasWidth:x,canvasHeight:j,dataList:k,columnNumber:w}=d,Y=new Set;function y(t=0){k.forEach(((r,i)=>{const{x:s,y:d}=r.origin,u=~~(r.data.length/w),f=r.data.reduce(((e,r,o)=>{const n=i<12&&o>=t&&o<=t+u||12===i?[{x:e.length+1,y:p-+r}]:[];return e.concat(n)}),[]),m=new e.Polyline(f,{fill:"transparent",stroke:"red",strokeWidth:10,left:s,top:d,scaleX:a,scaleY:a,originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"default",lockMovementX:!0,lockMovementY:!0}),x=new e.Text(String(r.title),{...n,left:s+h,top:d-2*v,originX:"left",originY:"top"});!function(e,{scale:t=6}={}){o(e,{scale:t,endX:g,endY:p,beforeEvent:()=>c.value&&Promise.reject()})}(m),m.startIdx=t,Y.add(m),l.value.add(x,m)}))}s(l,d),function(){const{strokeWidth:t}=u,r=new e.Rect({...u,width:x-t,height:j-t,left:f,top:m,fill:"transparent"});l.value.add(r)}(),function(){const e=x/w,t=[];r(w).forEach((r=>{if(r+1>=w)return;const o=(r+1)*e,n=i([o,0,o,j],{stroke:"#000"});t.push(n)})),l.value.add(...t)}(),y();return{updatePolyline:t((e=>{if(1===w)return;const t=k[k.length-1].data.length,r=~~(t/w),o=e/100*t-r/2,n=o+r>t?t-r:Math.max(0,o);if(Y.size){const[e]=[...Y];if(e.startIdx===n)return;[...Y].forEach((e=>l.value.remove(e))),Y.clear()}y(n)}),250)}}export{l as useElectrocardiogram};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useThrottleFn as t}from"@vueuse/core";import{range as r}from"lodash-es";import{useDetailEvent as o}from"./hooks/useDetailEvent.js";import{defaultTextStyle as n,drawLine as i}from"../useDraw.js";import{useGrid as a}from"../useGrid.js";import{useElectrocardiogramCumputedPoint as s}from"../useCumputedPoint.js";import"../useEvent.js";import"vue";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function l(l,u,d){const{computedX:c,cumputedY:m}=s(u),{borderStyle:h,originX:f,originY:g,xCellWidth:p,yCellHeight:v,canvasWidth:x,canvasHeight:b,dataList:j,columnNumber:w,gridYNumber:C,gridXNumber:k}=u,y=new Set,S=new Set;function E(t=0){j.forEach(((r,o)=>{if(o===j.length-1&&arguments.length)return;const{x:i,y:a}=r.origin,s=~~(r.data.length/w),l=r.data.reduce(((e,r,n)=>{const i=o<12&&n>=t&&n<=t+s||12===o?[{x:c(e.length+1),y:m(-+r)}]:[];return e.concat(i)}),[]),h=new e.Polyline(l,{fill:"transparent",stroke:"red",strokeWidth:1,left:i,top:a,hasControls:!1,hasBorders:!1,hoverCursor:"default",lockMovementX:!0,lockMovementY:!0,objectCaching:!0});if(N(h,{...u.config,...u,lineStartIndex:t,points:r.data,scale:4,showScaleText:!0,showNumberText:!0,detailRadius:370,beforeEvent:()=>d.value&&Promise.reject()}),h.startIdx=t,o<j.length-1?y.add(h):S.add(h),arguments.length)return;const f=new e.Text(String(r.title),{...n,left:i+p,top:a});S.add(f)}));const r=arguments.length?[...y]:[...y,...S];l.value.add(...r)}function N(e,t){o(e,t)}a(l,{...u,gridXNumber:5*k,gridYNumber:5*C,xCellWidth:p/5,yCellHeight:v/5,grid:{...u.grid,subXCell:5,subYCell:5}}),function(){const{strokeWidth:t}=h,r=new e.Rect({...h,width:x-t,height:b-t,left:f,top:g,fill:"transparent"});l.value.add(r)}(),function(){const e=x/w,t=[];r(w).forEach((r=>{if(r+1>=w)return;const o=(r+1)*e,n=i([o,0,o,b],{stroke:"#000"});t.push(n)})),l.value.add(...t)}(),E();return{updatePolyline:t((t=>{if(1===w)return;const r=j[j.length-1].data.length,o=~~(r/w),n=t/100*r-o/2,i=n+o>r?r-o:Math.max(0,n);e.util.requestAnimFrame((()=>{if(y.size){const[e]=[...y];if(e.startIdx===i)return;[...y].forEach((e=>l.value.remove(e))),y.clear()}E(i)}))}),150)}}export{l as useElectrocardiogram};
@@ -1 +1 @@
1
- import{ref as e,computed as a,reactive as t,unref as r,watch as u}from"vue";import{defaultBorderStyle as i}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import"naive-ui";import"@vueuse/core";import{useElectrocardiogram as l}from"./useElectrocardiogram.js";import{useMeasureInstrument as d}from"./useMeasureInstrument.js";function o(o,s,n,v,m,p){const g=e(),c=e(),h=e(),f=e(),C=a((()=>s.data.width)),b=a((()=>s.data.height)),j=a((()=>(C.value-0)/w.value)),y=a((()=>(b.value-0)/x.value)),w=a((()=>s.data.grid.mainXCell)),x=a((()=>s.data.grid.mainYCell)),M=a((()=>{var e;return(null==(e=s.data.grid)?void 0:e.event)||{selectable:!0,evented:!0}})),R=a((()=>{const{mode:e="2-6"}=s.data;return e.split("-").map((e=>+e))[0]})),X=a((()=>{const{dataList:e,width:a}=s.data,t=a/R.value,r=4*y.value,u=3*y.value;return e.map(((e,a)=>{const i=a%R.value,l=Math.floor(a/R.value);return{...e,origin:{x:i*t,y:l*r+u}}}))})),Y=t({canvasWidth:s.data.width,canvasHeight:s.data.height,borderStyle:{...i,...s.data.borderStyle||{}},grid:s.data.grid,originX:0,endX:C.value,originY:0,endY:b.value,xCellWidth:j.value,yCellHeight:y.value,gridXNumber:w.value,gridYNumber:x.value,event:M.value,dataList:X.value,columnNumber:r(R)});return u((()=>o.value),(e=>{e&&function(){const{useMeasureRuler:e,flag:a,useCaliper:t,useCaliperRuler:r}=d(o,Y),{updatePolyline:u}=l(o,Y,a);c.value=e,h.value=t,f.value=r,g.value=u}()}),{immediate:!0}),{propItems:Y,updatePolyline:g,useMeasureRuler:c,useCaliper:h,useCaliperRuler:f}}export{o as useElectrocardiogramChart};
1
+ import{ref as e,computed as a,reactive as t,unref as u,watch as r}from"vue";import{defaultBorderStyle as l}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import"naive-ui";import"@vueuse/core";import{useElectrocardiogram as i}from"./useElectrocardiogram.js";import{useMeasureInstrument as n}from"./useMeasureInstrument.js";function o(o,d,s,m,v,c){const g=e(),h=e(),p=e(),f=e(),b=a((()=>d.data.width)),C=a((()=>d.data.height)),M=a((()=>(b.value-0)/j.value)),N=a((()=>(C.value-0)/w.value)),j=a((()=>{const{dataList:e,config:a}=d.data,t=e[e.length-1].data.length/a.hz;return Math.ceil(t/a.mainXCellValue)})),w=a((()=>{const{config:e}=d.data;return Math.ceil((13*y.value+2*e.mainYCellValue)/e.mainYCellValue)})),y=a((()=>{const{dataList:e,config:a}=d.data,t=e[e.length-1].data,u=Math.max(...t)-Math.min(...t);return"uv"===a.valueUnit?.001*u:"v"===a.valueUnit?1e3*u:u})),Y=a((()=>{var e;return(null==(e=d.data.grid)?void 0:e.event)||{selectable:!0,evented:!0}})),x=a((()=>{const{mode:e="2-6"}=d.data,[a,t]=e.split("-").map((e=>+e));return{columnNumber:a,rowNumber:t}})),L=a((()=>{const{dataList:e,width:a,config:t}=d.data,{columnNumber:u,rowNumber:r}=x.value,l=a/u,i=y.value/t.mainYCellValue*N.value+N.value,n=N.value;return e.map(((a,t)=>{const u=t===e.length-1?r:t%r;return{...a,origin:{x:(t===e.length-1?0:Math.floor(t/r))*l,y:u*i+n}}}))})),R=t({canvasWidth:d.data.width,canvasHeight:d.data.height,borderStyle:{...l,...d.data.borderStyle||{}},grid:d.data.grid,originX:0,endX:b.value,originY:0,endY:C.value,xCellWidth:M.value,yCellHeight:N.value,gridXNumber:j.value,gridYNumber:w.value,event:Y.value,dataList:L.value,columnNumber:u(x).columnNumber,config:d.data.config});return r((()=>o.value),(e=>{e&&function(){const{useMeasureRuler:e,flag:a,useCaliper:t,useCaliperRuler:u}=n(o,R),{updatePolyline:r}=i(o,R,a);h.value=e,p.value=t,f.value=u,g.value=r}()}),{immediate:!0}),{propItems:R,updatePolyline:g,useMeasureRuler:h,useCaliper:p,useCaliperRuler:f}}export{o as useElectrocardiogramChart};
@@ -1 +1 @@
1
- import{ref as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as o,drawText as r}from"../useDraw.js";import"date-fns";import"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import"naive-ui";import"@vueuse/core";function i(i,n){const{borderStyle:l,grid:s,originX:u,originY:a,xCellWidth:f,endY:d,yCellHeight:c,endX:h,canvasWidth:v,rightAddAreaWidth:p,canvasHeight:g,dataList:x,columnNumber:m}=n,C=e(!1),y={origin:{x:0,y:0},line:null,rendering:!1},L={origin:{x:300,y:0},caliper:{width:100,height:60,rect:null},caliperRuler:{width:230,height:120,rect:null}};function b(e){k();const{width:o,height:n,rect:l}=L[e];if(l)return;const{x:s,y:u}=L.origin,a=L.caliper.height;L[e].rect=new t.Rect({left:s+2,top:u,width:o-4,height:n,strokeWidth:0,fill:"transparent",hasControls:!1,hasBorders:!1,hoverCursor:"default"});const f={hasControls:!1,hasBorders:!1,stroke:"blue",strokeWidth:2,__type:e},d=new t.Line([s,u,s,n],{...f,lockMovementY:!0}),c=new t.Line([s+o,u,s+o,n],{...f,lockMovementY:!0}),h=new t.Line([s,a,s+o,a],{...f,lockMovementX:!0,evented:"caliper"===e}),v=r([s,h.top+10],{value:w(h.x1,h.x2),fill:"blue",originX:"left",originY:"top"});d.rect=L[e].rect,c.rect=L[e].rect,h.rect=L[e].rect,Object.assign(L[e].rect,{leftLine:d,rightLine:c,horizontalLine:h,text:v}),function(e,t){e.on("moving",(()=>{const{leftLine:o,rightLine:r,horizontalLine:i,text:n}=e;null==o||o.setCoords().set({x1:e.left-2,y1:e.top,x2:e.left-2,y2:e.top+e.height}),null==r||r.setCoords().set({x1:e.left+e.width,y1:e.top,x2:e.left+e.width,y2:e.top+e.height});const l="caliper"===t?e.top+e.height:e.top+e.height/2;null==i||i.setCoords().set({x1:e.left-2,y1:l,x2:e.left+e.width,y2:l}),n.setCoords().set({left:e.left,top:l+10})})),e.on("mouseup",(t=>{1===t.button&&(i.value.discardActiveObject(),e.leftLine.bringToFront(),e.rightLine.bringToFront(),e.horizontalLine.bringToFront())}))}(L[e].rect,e),j(d,"left"),j(c,"right"),"caliper"===e&&j(h,"horizontal"),i.value.add(L[e].rect,d,c,h,v)}function w(e,t){var o;return`${`${null!=(o=(6e4/(t-e)*10).toFixed(2))?o:0}bpm`}\n${10*(t-e)+"ms"}`}function j(e,t){e.on("moving",(()=>{const{rect:o}=e;if(!o)return;const{leftLine:r,rightLine:i,horizontalLine:n,text:l}=o;if("horizontal"===t)return e.top<=o.top+1?e.setCoords().set({y1:o.top+1,y2:o.top+1}):e.setCoords().set({y1:e.top,y2:e.top}),o.setCoords().set({height:e.top-o.top}),null==r||r.setCoords().set({y2:e.top}),null==i||i.setCoords().set({y2:e.top}),void l.setCoords().set({top:e.top+10});"left"===t&&(e.left>=i.left-1?e.setCoords().set({x1:i.left-1,x2:i.left-1}):e.setCoords().set({x1:e.left,x2:e.left}),o.setCoords().set({left:e.left+2,width:i.left-e.left-4}),n.setCoords().set({x1:e.left}),l.setCoords().set({left:e.left})),"right"===t&&(e.left<=r.left+1?e.setCoords().set({x1:r.left+1,x2:r.left+1}):e.setCoords().set({x1:e.left,x2:e.left}),o.setCoords().set({width:e.left-r.left-4}),n.setCoords().set({x2:e.left})),l.set("text",w(n.x1,n.x2))}))}function k(){Object.values(L).forEach((e=>{const{rect:t}=e;t&&(i.value.remove(t),i.value.remove(t.leftLine),i.value.remove(t.rightLine),i.value.remove(t.horizontalLine),i.value.remove(t.text),e.rect=null)})),y.line&&(i.value.remove(y.line),y.line.text&&i.value.remove(y.line.text),y.line=null)}return i.value.on("mouse:down",(e=>{if(1===e.button&&C.value){const{x:t=0,y:o=0}=e.pointer||{};y.origin={x:t,y:o},y.rendering=!0}})),i.value.on("mouse:up",(e=>{const{button:t}=e;1===t&&C.value&&setTimeout((()=>{C.value=!1,y.rendering=!1})),3===t&&k()})),i.value.on("mouse:move",(e=>{var t;if(1===e.button&&C.value&&y.rendering){const{x:n=0,y:l=0}=e.pointer||{};y.line&&i.value.remove(y.line),(null==(t=y.line)?void 0:t.text)&&i.value.remove(y.line.text);const{x:s,y:u}=y.origin;y.line=o([s,u,n,l],{stroke:"blue"});const a=r([n,l+2*c],{value:`${-(l-u)/4+"mv"}\n${10*(n-s)+"ms"}`,fill:"blue"});y.line.text=a,i.value.add(y.line,a)}})),{flag:C,useMeasureRuler:function(){C.value||(C.value=!0)},useCaliper:function(){b("caliper")},useCaliperRuler:function(){b("caliperRuler")}}}export{i as useMeasureInstrument};
1
+ import{ref as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as o,drawText as r}from"../useDraw.js";import{useElectrocardiogramCumputedPoint as i}from"../useCumputedPoint.js";import"../useEvent.js";import"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import"@vueuse/core";function l(l,n){const{getXValue:s,getYValue:u}=i(n),{yCellHeight:a,xCellWidth:f}=n,c=e(!1),h={origin:{x:0,y:0},line:null,rendering:!1},d={origin:{x:300,y:0},caliper:{width:4*f,height:60,rect:null},caliperRuler:{width:6*f,height:120,rect:null}};function v(e){m();const{width:o,height:i,rect:n}=d[e];if(n)return;const{x:s,y:u}=d.origin,a=d.caliper.height;d[e].rect=new t.Rect({left:s+2,top:u,width:o-4,height:i,strokeWidth:0,fill:"transparent",hasControls:!1,hasBorders:!1,hoverCursor:"move"});const f={hasControls:!1,hasBorders:!1,hoverCursor:"e-resize",stroke:"blue",strokeWidth:2,__type:e},c=new t.Line([s,u,s,i],{...f,lockMovementY:!0}),h=new t.Line([s+o,u,s+o,i],{...f,lockMovementY:!0}),v=new t.Line([s,a,s+o+2,a],{...f,lockMovementX:!0,evented:"caliper"===e,hoverCursor:"caliper"===e?"n-resize":"default"}),g=r([s,v.top+10],{value:p(v.x1,v.x2),fill:"blue",originX:"left",originY:"top"});c.rect=d[e].rect,h.rect=d[e].rect,v.rect=d[e].rect,Object.assign(d[e].rect,{leftLine:c,rightLine:h,horizontalLine:v,text:g}),function(e,t){e.on("moving",(()=>{const{leftLine:o,rightLine:r,horizontalLine:i,text:l}=e;null==o||o.setCoords().set({x1:e.left-2,y1:e.top,x2:e.left-2,y2:e.top+e.height}),null==r||r.setCoords().set({x1:e.left+e.width,y1:e.top,x2:e.left+e.width,y2:e.top+e.height});const n="caliper"===t?e.top+e.height:e.top+e.height/2;null==i||i.setCoords().set({x1:e.left-2,y1:n,x2:e.left+e.width+2,y2:n}),l.setCoords().set({left:e.left,top:n+10})})),e.on("mouseup",(t=>{1===t.button&&(l.value.discardActiveObject(),e.leftLine.bringToFront(),e.rightLine.bringToFront(),e.horizontalLine.bringToFront())}))}(d[e].rect,e),x(c,"left"),x(h,"right"),"caliper"===e&&x(v,"horizontal"),l.value.add(d[e].rect,c,h,v,g)}function p(e,t){return`${1e3*s(t-e)}ms`}function x(e,t){e.on("moving",(()=>{const{rect:o}=e;if(!o)return;const{leftLine:r,rightLine:i,horizontalLine:l,text:n}=o;if("horizontal"===t)return e.top<=o.top+1?e.setCoords().set({y1:o.top+1,y2:o.top+1}):e.setCoords().set({y1:e.top,y2:e.top}),o.setCoords().set({height:e.top-o.top}),null==r||r.setCoords().set({y2:e.top}),null==i||i.setCoords().set({y2:e.top}),void n.setCoords().set({top:e.top+10});"left"===t&&(e.left>=i.left-1?e.setCoords().set({x1:i.left-1,x2:i.left-1}):e.setCoords().set({x1:e.left,x2:e.left}),o.setCoords().set({left:e.left+2,width:i.left-e.left-4}),l.setCoords().set({x1:e.left}),n.setCoords().set({left:e.left})),"right"===t&&(e.left<=r.left+1?e.setCoords().set({x1:r.left+1,x2:r.left+1}):e.setCoords().set({x1:e.left,x2:e.left}),o.setCoords().set({width:e.left-r.left-4}),l.setCoords().set({x2:e.left+2})),n.set("text",p(l.x1,l.x2))}))}function m(){Object.values(d).forEach((e=>{const{rect:t}=e;t&&(l.value.remove(t),l.value.remove(t.leftLine),l.value.remove(t.rightLine),l.value.remove(t.horizontalLine),l.value.remove(t.text),e.rect=null)})),h.line&&(l.value.remove(h.line),h.line.text&&l.value.remove(h.line.text),h.line=null)}return l.value.on("mouse:down",(e=>{if(1===e.button&&c.value){const{x:t=0,y:o=0}=e.pointer||{};h.origin={x:t,y:o},h.rendering=!0}})),l.value.on("mouse:up",(e=>{const{button:t}=e;1===t&&c.value&&setTimeout((()=>{c.value=!1,h.rendering=!1})),3===t&&m()})),l.value.on("mouse:move",(e=>{var t;if(1===e.button&&c.value&&h.rendering){const{x:i=0,y:n=0}=e.pointer||{};h.line&&l.value.remove(h.line),(null==(t=h.line)?void 0:t.text)&&l.value.remove(h.line.text);const{x:f,y:c}=h.origin;h.line=o([f,c,i,n],{stroke:"blue"});const d=-u(n-c).toFixed(2),v=1e3*s(i-f),p=r([i,n+2*a],{value:`${d}mv\n${v}ms`,fill:"blue"});h.line.text=p,l.value.add(h.line,p)}})),{flag:c,useMeasureRuler:function(){c.value||(c.value=!0)},useCaliper:function(){v("caliper")},useCaliperRuler:function(){v("caliperRuler")}}}export{l as useMeasureInstrument};
@@ -1 +1 @@
1
- export{defaultBorderStyle,defaultLineStyle,defaultRectStyle,defaultStyle,defaultTextStyle,drawArrow,drawLine,drawPoint,drawText,drawTextAndIconGroup,drawTextGroup}from"./useDraw.js";export{useGrid}from"./useGrid.js";export{useBirthProcessCumputedPoint,useCumputedPoint}from"./useCumputedPoint.js";export{bus,useCanvasEvent}from"./useEvent.js";export{drawScaleLine,drawScaleNumber,getScaleInfo}from"./useScaleColumn.js";export{useCommon}from"./useCommon.js";export{useBirthProcessChart}from"./birthProcess/useBirthProcessChart.js";export{useTemperatureChart}from"./temperature/useTemperatureChart.js";export{useSurgicalAnesthesiaChart}from"./surgicalAnesthesia/useSurgicalAnesthesiaChart.js";export{useElectrocardiogramChart}from"./electrocardiogram/useElectrocardiogramChart.js";
1
+ export{defaultBorderStyle,defaultLineStyle,defaultRectStyle,defaultStyle,defaultTextStyle,drawArrow,drawLine,drawPoint,drawText,drawTextAndIconGroup,drawTextGroup}from"./useDraw.js";export{useGrid}from"./useGrid.js";export{useBirthProcessCumputedPoint,useCumputedPoint,useElectrocardiogramCumputedPoint}from"./useCumputedPoint.js";export{bus,useCanvasEvent}from"./useEvent.js";export{drawScaleLine,drawScaleNumber,getScaleInfo}from"./useScaleColumn.js";export{useCommon}from"./useCommon.js";export{useBirthProcessChart}from"./birthProcess/useBirthProcessChart.js";export{useTemperatureChart}from"./temperature/useTemperatureChart.js";export{useSurgicalAnesthesiaChart}from"./surgicalAnesthesia/useSurgicalAnesthesiaChart.js";export{useElectrocardiogramChart}from"./electrocardiogram/useElectrocardiogramChart.js";
@@ -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}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import{useIntervalFn as v}from"@vueuse/core";function g(g,y,h,k,x){const{cumputedX:L,cumputedY:P,getXValue:b,getYValue:w}=r(y),{xCellWidth:A,pointSelectionStyle:I,originX:C,endX:K,originY:j,endY:E,event:X,scaleValues:M,xAxis:T,startTime:V,timeXCell:Y,itemList:S,dialog:$}=y,F=new Map,O=new Set,D=p(M);let _=[],z=null;const N=new Set;l(g,y);const{getEqualXTypes:G,handleAddPrevent:J,setPrevAndNextPoint:q}=s(g,h,y),{pause:R,resume:W}=v((()=>{!function(){if(!N.size)return;for(const e of N)e.set("opacity",1===e.opacity?.5:1);g.value.renderAll()}()}),800);function B(){D.forEach((e=>{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=P(t.type,t.range,n),a=i([C,r,K,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});X.hovered&&o&&(a.on("mousemove",(({pointer:e})=>{k.point={...e||{x:a.left,y:a.top}},k.list=[`${o} ${n}${t.unit||""}`],k.show=!0})),a.on("mouseout",(()=>{k.show=!1}))),g.value.add(a)}a(n),a(o),a(l),a(r)}(t,e),Z(t,n,e))}))}))}function H(e=[]){if(!(null==z?void 0:z.areaPos))return[];const{startPos:t,endPos:n}=z.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:se()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=r))}function Q(e){$.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),U()},onNegativeClick:()=>U(),onClose:()=>U()})}function U(){z&&g.value.remove(z),z=null}function Z(e,t,n){var l;const{type:r,unit:a,dataList:s=[]}=n,f=[];F.set(e.key,[]),function(e,t){N.size&&[...N].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&N.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,c)=>{!function(e,l,c,u){var d;let p,v,x=u;l.key&&(x=s.find((e=>e.key===l.key)));const{pointAttr:L={},lineAttr:P={},title:I="",key:C,type:K="circle"}=x,j=ae(u.list[c+1],n);e&&j&&!l.breakpoint&&e[0]!==j[0]&&(v=i([...e,...j],P));const E=f[c-1],M={origin:{data:l,title:I,key:u.key,selfKey:C,unit:a,type:r,dataIndex:t,index:c,lineAttr:P},__type:"main",leftLine:E,rightLine:v,...L,...y.event.hovered?y.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:y.event};E?p=o(K,{left:E.get("x2"),top:E.get("y2"),...M}):e&&(M.leftLine=null,p=o(K,{left:e[0],top:e[1],...M}));f.push(v),p&&(p.originLeft=p.left,p.originTop=p.top,function(e){X.hovered&&(e.on("mouseover",(()=>{le(e,"hover")})),e.on("mouseout",(()=>{k.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{re(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),X.hovered&&le(e),function(e){var t,n,i,o;const{originLeft:l,originTop:r,left:a,top:s,origin:f}=e,c=~~((a-l)/A);if(a>l+A){if(0===_.length){te(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+A*c;if(_.every((e=>e.left!==u))){const t=b(u),n=w(f.type,s);_.push({data:{time:t,value:n,...f.selfKey!==f.key?{key:f.selfKey}:{}},left:u,top:s}),te(e,[...e.prevPointer,u,s])}if(_.length<c&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+A*l,r=_.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=_.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=_[l-1]||{left:n,top:i},f=~~((r.left-(t-A))/A),c=(r.top-s.top)/f;a.top=s.top+c,a.left=t,a.data={time:b(t),value:w(o.type,a.top),...o.selfKey!==o.key?{key:o.selfKey}:{}},_.splice(l,0,a),te(e,[s.left,s.top,a.left,a.top])}}l++}}(e,c),e.nextPoint){const t=F.get(f.key);!function(e,t){const{left:n,top:i,origin:o}=t,l=A/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?ee(e,"#999"):ee(e,e.origin.lineAttr.stroke))}))}}!function(e){var t,n;const{left:i}=e;if(_.length>0&&i<_[_.length-1].left){for(const e of O)e.left>i&&(e.leftLine&&g.value.remove(e.leftLine),g.value.remove(e));if(_=_.filter((e=>e.left<=i)),0===_.length){null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,e.origin.lineAttr);for(const e of O)e.leftLine&&g.value.remove(e.leftLine),g.value.remove(e)}if(_.length>0){const t=_.at(-1);e.prevPointer=[t.left,t.top]}}}(e)}(e)})),e.on("mouseup",(t=>{if(k.show=!1,1===t.button){const{type:t,selfKey:n,dataIndex:i}=e.origin,o={...e.origin,data:{...e.origin.data,time:b(e.left),value:w(t,e.top)}};if(g.value.discardActiveObject(),_.length>0){const l=D.find((e=>e.type===t));let r=-1;const a=_.map((e=>e.data));if(e.nextPoint){if(2.5!==e.scaleX)return void ie({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));h("add",{...m(o,["index","selfKey","lineAttr"]),dataIndex:s,key:n,data:a}),ne({...o,data:a,coincideIndex:r})}else h("change",{...m(o,["selfKey","lineAttr"]),key:n}),ne(o,"change")}}))}(p),null==(d=F.get(u.key))||d.push(p))}(ae(l,n),l,c,e)})),Promise.all(F.get(e.key)).then((t=>{const n=f.filter((e=>e));q(t),g.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||N.add(e)}))}r(n,"max"),r(i,"min"),r(o,"max"),r(l,"min")}(t,e)}))}function ee(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 te(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,O.add(l),g.value.add(r,l)}))}function ne(e,t="add",n=1){const{data:i,index:o,key:l,type:r,coincideIndex:a}=e;let{dataIndex:s}=e;const f=D.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}}ie({dataIndex:s,scaleValue:f})}function ie(e){var t,n,i;if(O.size&&(null==(t=g.value)||t.remove(...oe([...O]))),O.clear(),_=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=g.value)||n.remove(...oe(F.get(o.key))),F.delete(o.key),Z(o,t,i)}else F.size&&(null==(i=g.value)||i.remove(...oe(se()))),F.clear(),B()}function oe(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 le(e,t="moving"){const{title:n,type:i,data:o,unit:l}=e.origin;k.point={x:e.left,y:e.top};const r=`${"hover"===t?o.value:w(i,e.top)}`;k.list=[`${n} ${r}${l||""}`,`时间 ${b(e.left).slice(-5)}`],k.show=!0}function re(e){e.setCoords();const t=6e4/Y,n=e.prevPoint?e.prevPoint.left+t:C,i=K;e.top<j&&e.set("top",j),e.top>E&&e.set("top",E),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}function ae(e,t){if(u(e)&&function(e){const t=Date.parse(T.list.at(-1)),n=d(e);return n>=V&&n<=t}(e.time)){const n=L(e.time),i=P(t.type,t.range,e.value);return[n,i<j?j:i>E?E:i]}}function se(){return Array.from(F.values()).flat()}return e((()=>{R()})),B(),function(){if(!X.evented)return;let e=!1,i={x:0,y:0};g.value.on("mouse:up",(t=>{if(3===t.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=C&&t<=K&&n>=j&&n<=E)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);se().forEach((i=>{"main"===i.__type&&i.left>t&&i.left<n&&i.top>o&&i.top<l&&x.list.push({renderItem:()=>i.origin.title,origin:{...i.origin},mode:"remove",pointer:e.pointer})})),1===x.list.length&&(x.show=!1,console.log("当前时间段内无可删除节点"))}else i(e.pointer,null,["新增节点"]),S.forEach((n=>{G(se(),t,"key",2*A).includes(n.linkKey||n.key)||x.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===x.list.length&&(x.show=!1,J("repeat"),console.log("当前时间段内无可新增节点"));function i(e,t,n){Object.assign(x,{point:e,show:!0,target:t,list:n})}}(t),1===t.button&&e){e=!1;const t=H();t.length>0?Q((()=>{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 ne(n[0],"remove",n.length),n.map((e=>({...m(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(t);h("remove",e)})):a.emit(z)}})),g.value.on("mouse:down",(t=>{1!==t.button||t.target||(e=!0,i=t.pointer)})),g.value.on("mouse:move",(o=>{if(!e)return;const{x:l,y:r}=i,{x:a,y:s}=o.pointer;z&&g.value.remove(z),z=new t.Rect({...n,fill:"#CAF982",opacity:.4,...I,left:l,top:r,width:a-l,height:s-r,objectCaching:!0}),z.areaPos={startPos:i,endPos:o.pointer},g.value.add(z)}))}(),{redrawPoints:ie,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(h("remove",n),ne(n,"remove")):(Object.assign(n,{data:{time:b(e.pointer.x),value:w(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),h("add",n),ne({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:re,setPopup:le,updateData:ne,getGridPoints:se,getContainPoints:H,showDialog:Q,removeCurrentSelection:U}}export{g 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,omit as m}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import{useIntervalFn as v}from"@vueuse/core";function g(g,y,h,k,x){const{computedX:L,cumputedY:P,getXValue:b,getYValue:w}=r(y),{xCellWidth:A,pointSelectionStyle:I,originX:C,endX:K,originY:j,endY:E,event:X,scaleValues:M,xAxis:T,startTime:V,timeXCell:Y,itemList:S,dialog:$}=y,F=new Map,O=new Set,D=p(M);let _=[],z=null;const N=new Set;l(g,y);const{getEqualXTypes:G,handleAddPrevent:J,setPrevAndNextPoint:q}=s(g,h,y),{pause:R,resume:W}=v((()=>{!function(){if(!N.size)return;for(const e of N)e.set("opacity",1===e.opacity?.5:1);g.value.renderAll()}()}),800);function B(){D.forEach((e=>{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=P(t.type,t.range,n),a=i([C,r,K,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});X.hovered&&o&&(a.on("mousemove",(({pointer:e})=>{k.point={...e||{x:a.left,y:a.top}},k.list=[`${o} ${n}${t.unit||""}`],k.show=!0})),a.on("mouseout",(()=>{k.show=!1}))),g.value.add(a)}a(n),a(o),a(l),a(r)}(t,e),Z(t,n,e))}))}))}function H(e=[]){if(!(null==z?void 0:z.areaPos))return[];const{startPos:t,endPos:n}=z.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:se()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=r))}function Q(e){$.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),U()},onNegativeClick:()=>U(),onClose:()=>U()})}function U(){z&&g.value.remove(z),z=null}function Z(e,t,n){var l;const{type:r,unit:a,dataList:s=[]}=n,f=[];F.set(e.key,[]),function(e,t){N.size&&[...N].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&N.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,c)=>{!function(e,l,c,u){var d;let p,v,x=u;l.key&&(x=s.find((e=>e.key===l.key)));const{pointAttr:L={},lineAttr:P={},title:I="",key:C,type:K="circle"}=x,j=ae(u.list[c+1],n);e&&j&&!l.breakpoint&&e[0]!==j[0]&&(v=i([...e,...j],P));const E=f[c-1],M={origin:{data:l,title:I,key:u.key,selfKey:C,unit:a,type:r,dataIndex:t,index:c,lineAttr:P},__type:"main",leftLine:E,rightLine:v,...L,...y.event.hovered?y.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:y.event};E?p=o(K,{left:E.get("x2"),top:E.get("y2"),...M}):e&&(M.leftLine=null,p=o(K,{left:e[0],top:e[1],...M}));f.push(v),p&&(p.originLeft=p.left,p.originTop=p.top,function(e){X.hovered&&(e.on("mouseover",(()=>{le(e,"hover")})),e.on("mouseout",(()=>{k.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{re(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),X.hovered&&le(e),function(e){var t,n,i,o;const{originLeft:l,originTop:r,left:a,top:s,origin:f}=e,c=~~((a-l)/A);if(a>l+A){if(0===_.length){te(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+A*c;if(_.every((e=>e.left!==u))){const t=b(u),n=w(f.type,s);_.push({data:{time:t,value:n,...f.selfKey!==f.key?{key:f.selfKey}:{}},left:u,top:s}),te(e,[...e.prevPointer,u,s])}if(_.length<c&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+A*l,r=_.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=_.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=_[l-1]||{left:n,top:i},f=~~((r.left-(t-A))/A),c=(r.top-s.top)/f;a.top=s.top+c,a.left=t,a.data={time:b(t),value:w(o.type,a.top),...o.selfKey!==o.key?{key:o.selfKey}:{}},_.splice(l,0,a),te(e,[s.left,s.top,a.left,a.top])}}l++}}(e,c),e.nextPoint){const t=F.get(f.key);!function(e,t){const{left:n,top:i,origin:o}=t,l=A/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?ee(e,"#999"):ee(e,e.origin.lineAttr.stroke))}))}}!function(e){var t,n;const{left:i}=e;if(_.length>0&&i<_[_.length-1].left){for(const e of O)e.left>i&&(e.leftLine&&g.value.remove(e.leftLine),g.value.remove(e));if(_=_.filter((e=>e.left<=i)),0===_.length){null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,e.origin.lineAttr);for(const e of O)e.leftLine&&g.value.remove(e.leftLine),g.value.remove(e)}if(_.length>0){const t=_.at(-1);e.prevPointer=[t.left,t.top]}}}(e)}(e)})),e.on("mouseup",(t=>{if(k.show=!1,1===t.button){const{type:t,selfKey:n,dataIndex:i}=e.origin,o={...e.origin,data:{...e.origin.data,time:b(e.left),value:w(t,e.top)}};if(g.value.discardActiveObject(),_.length>0){const l=D.find((e=>e.type===t));let r=-1;const a=_.map((e=>e.data));if(e.nextPoint){if(2.5!==e.scaleX)return void ie({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));h("add",{...m(o,["index","selfKey","lineAttr"]),dataIndex:s,key:n,data:a}),ne({...o,data:a,coincideIndex:r})}else h("change",{...m(o,["selfKey","lineAttr"]),key:n}),ne(o,"change")}}))}(p),null==(d=F.get(u.key))||d.push(p))}(ae(l,n),l,c,e)})),Promise.all(F.get(e.key)).then((t=>{const n=f.filter((e=>e));q(t),g.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||N.add(e)}))}r(n,"max"),r(i,"min"),r(o,"max"),r(l,"min")}(t,e)}))}function ee(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 te(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,O.add(l),g.value.add(r,l)}))}function ne(e,t="add",n=1){const{data:i,index:o,key:l,type:r,coincideIndex:a}=e;let{dataIndex:s}=e;const f=D.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}}ie({dataIndex:s,scaleValue:f})}function ie(e){var t,n,i;if(O.size&&(null==(t=g.value)||t.remove(...oe([...O]))),O.clear(),_=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=g.value)||n.remove(...oe(F.get(o.key))),F.delete(o.key),Z(o,t,i)}else F.size&&(null==(i=g.value)||i.remove(...oe(se()))),F.clear(),B()}function oe(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 le(e,t="moving"){const{title:n,type:i,data:o,unit:l}=e.origin;k.point={x:e.left,y:e.top};const r=`${"hover"===t?o.value:w(i,e.top)}`;k.list=[`${n} ${r}${l||""}`,`时间 ${b(e.left).slice(-5)}`],k.show=!0}function re(e){e.setCoords();const t=6e4/Y,n=e.prevPoint?e.prevPoint.left+t:C,i=K;e.top<j&&e.set("top",j),e.top>E&&e.set("top",E),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}function ae(e,t){if(u(e)&&function(e){const t=Date.parse(T.list.at(-1)),n=d(e);return n>=V&&n<=t}(e.time)){const n=L(e.time),i=P(t.type,t.range,e.value);return[n,i<j?j:i>E?E:i]}}function se(){return Array.from(F.values()).flat()}return e((()=>{R()})),B(),function(){if(!X.evented)return;let e=!1,i={x:0,y:0};g.value.on("mouse:up",(t=>{if(3===t.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=C&&t<=K&&n>=j&&n<=E)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);se().forEach((i=>{"main"===i.__type&&i.left>t&&i.left<n&&i.top>o&&i.top<l&&x.list.push({renderItem:()=>i.origin.title,origin:{...i.origin},mode:"remove",pointer:e.pointer})})),1===x.list.length&&(x.show=!1,console.log("当前时间段内无可删除节点"))}else i(e.pointer,null,["新增节点"]),S.forEach((n=>{G(se(),t,"key",2*A).includes(n.linkKey||n.key)||x.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===x.list.length&&(x.show=!1,J("repeat"),console.log("当前时间段内无可新增节点"));function i(e,t,n){Object.assign(x,{point:e,show:!0,target:t,list:n})}}(t),1===t.button&&e){e=!1;const t=H();t.length>0?Q((()=>{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 ne(n[0],"remove",n.length),n.map((e=>({...m(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(t);h("remove",e)})):a.emit(z)}})),g.value.on("mouse:down",(t=>{1!==t.button||t.target||(e=!0,i=t.pointer)})),g.value.on("mouse:move",(o=>{if(!e)return;const{x:l,y:r}=i,{x:a,y:s}=o.pointer;z&&g.value.remove(z),z=new t.Rect({...n,fill:"#CAF982",opacity:.4,...I,left:l,top:r,width:a-l,height:s-r,objectCaching:!0}),z.areaPos={startPos:i,endPos:o.pointer},g.value.add(z)}))}(),{redrawPoints:ie,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(h("remove",n),ne(n,"remove")):(Object.assign(n,{data:{time:b(e.pointer.x),value:w(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),h("add",n),ne({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:re,setPopup:le,updateData:ne,getGridPoints:se,getContainPoints:H,showDialog:Q,removeCurrentSelection:U}}export{g as useCenter};
@@ -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}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as s}from"../../constants/index.js";import"naive-ui";import"@vueuse/core";function d(d,c,u,f,h,m,g,p,v){const{cumputedX:x,getXValue:k}=o(c),{getEqualXTypes:y,handleAddPrevent:X,isGridLimit:b}=r(d,u,c),{other:P,yCellHeight:w,xCellWidth:j,endX:z,originX:C,originY:E,endY:A,markHeight:L,event:M,topGridYCellHeight:S}=c,I=new Map,T=l(P);function H(){var o;if(!(null==(o=null==T?void 0:T.horizontal)?void 0:o.length))return;const n="horizontal";I.set(n,[]);const{horizontal:r}=T;let a=E+w/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:c={},textStyle:u={},data:f}=o;let h=null;f.forEach(((o,f)=>{const{time:m,value:g}=o,p=x(m);if(!B(p))return;const v=e(s,{...c,left:p,top:a}),k=p+v.width/2+2,y=i([k,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:C,x2:z-X.width}}),h&&(X.limitX.x1=h.left,h.limitX.x2=X.left,X.prevPoint=h,h.nextPoint=X),h=X,O(X),I.get(n).push(X),d.value.add(X)})),a+=w}))}function W(){var t;if(!(null==(t=null==T?void 0:T.vertical)?void 0:t.length))return;const i="vertical";I.set(i,[]);const{vertical:o}=T;o.forEach(((t,o)=>{const{textStyle:n={},data:r,time:a}=t,l=x(a);if(!B(l))return;let s=E+w/2;r.forEach(((t,r)=>{const a=e(String(t),{...n,lockMovementY:!0,left:l,originX:"left",top:s,origin:{type:"other",key:i,dataIndex:o,index:r,data:{value:t}}});s+=w,O(a),I.get(i).push(a),d.value.add(a)}));const c=I.get(i).filter((t=>t.origin.dataIndex===o)),u=Math.max(...c.map((t=>t.width))),f=l>z-u;c.forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=u,f&&t.setCoords().set("originX","right")}))}))}function Y(t,e="add"){const{dataIndex:i,data:o,index:n,key:r}=t,l=T[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}}V(t)}function V(t){var e;const{key:i}=t;switch(null==(e=d.value)||e.remove(...I.get(i)),I.delete(i),i){case"horizontal":H();break;case"vertical":W();break;case"mark":G()}}function G(){if(!(null==P?void 0:P.mark)||!L)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=P.mark,a=i([C-5,A+L/2],{value:t,...o,originX:"right"});d.value.add(a);const l=A+L,s=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=x(i);if(!B(r))return;let a=A;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"}}),c=o.height;a+c<=l&&a>=A?(o.set("top",a+c/2),a+=c):(i||(a=A,i=!0),o.set("top",a-c/2),a-=c),s.push(o),O(o),d.value.add(o)}))})),function(t){const e=t=>{var e,i;return null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart},i=t.find((t=>e(t))),o=t.find((t=>!e(t)&&t.left>i.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:C,x2:z};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(s)}function O(t){if(M.hovered&&(t.on("mouseover",(()=>{q(t)})),t.on("mouseout",(()=>{f.show=!1}))),!M.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<E&&t.set("top",E);const e=A+L-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>z?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((i=>i.setCoords().set({originX:e,left:t.left})))}(t)),M.hovered&&q(t)})),t.on("mouseup",(n=>{var r;if(f.show=!1,1===n.button){i&&function(t){var e,i;if("mark"===t.origin.key){if((null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),i=Math.min(...e);t.startPoint.limitX.x2=i}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=k(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};d.value.discardActiveObject(),u("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(h.point={x:t.left,y:t.top},h.show=!0,h.target=t,h.list=s.map((t=>({...t,renderItem:()=>t.label}))))}))}function q(t){f.point={x:t.left,y:"mark"===t.origin.key?t.top:t.top+S/2};const e=!t.origin.isMenu&&t.originLeft?t.originLeft:t.left;f.list=[`时间 ${k(e).slice(-5)}`],"mark"===t.origin.key&&f.list.unshift(t.origin.data.name+" "),f.show=!0}function B(t){return t>=C&&t<=z}return function(){var t;if(!(null==(t=null==T?void 0:T.horizontal)?void 0:t.length))return;const{horizontal:i}=T,o=C-5;let n=E+w/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l}=t,s=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r,isMenu:!0},originLeft:o,originTop:n});var c;(c=s).on("moving",(()=>{c.set("originX","center"),b(c)?q(c):f.show=!1})),c.on("mouseup:before",(t=>{if(f.show=!1,0===t.e.button&&b(c))if(y(I.get("horizontal"),c.left,"key",j).includes(c.origin.key))X("repeat"),console.log("重复节点");else{const t={data:{time:k(c.left),value:c.origin.defaultAddValue},...c.origin};u("add",t),Y(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(c)})),d.value.add(s),n+=w}))}(),H(),W(),G(),n.on((()=>{const t="horizontal",e=g(I.get(t));e.length>0?p((()=>{const i=function(t){const e=t.reduce(((t,e)=>{const{dataIndex:i}=e.origin;return t[i]=t[i]?t[i].concat(e.origin):[e.origin],t}),{});return Object.keys(e).map((t=>{const i=e[t];return T.horizontal[t].data.splice(i[0].index,i.length),i})).flat()}(e);V({key:t}),u("remove",i)})):v()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};u(i,o),"remove"===i&&Y(o,i)}}}export{d as useOther};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i}from"../useDraw.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import{bus as n}from"../useEvent.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getIndex as a}from"../../utils/index.js";import{cloneDeep as l}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as s}from"../../constants/index.js";import"naive-ui";import"@vueuse/core";function d(d,c,u,f,h,m,g,p,v){const{computedX:x,getXValue:k}=o(c),{getEqualXTypes:y,handleAddPrevent:X,isGridLimit:b}=r(d,u,c),{other:P,yCellHeight:w,xCellWidth:j,endX:z,originX:C,originY:E,endY:A,markHeight:L,event:M,topGridYCellHeight:S}=c,I=new Map,T=l(P);function H(){var o;if(!(null==(o=null==T?void 0:T.horizontal)?void 0:o.length))return;const n="horizontal";I.set(n,[]);const{horizontal:r}=T;let a=E+w/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:c={},textStyle:u={},data:f}=o;let h=null;f.forEach(((o,f)=>{const{time:m,value:g}=o,p=x(m);if(!B(p))return;const v=e(s,{...c,left:p,top:a}),k=p+v.width/2+2,y=i([k,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:C,x2:z-X.width}}),h&&(X.limitX.x1=h.left,h.limitX.x2=X.left,X.prevPoint=h,h.nextPoint=X),h=X,O(X),I.get(n).push(X),d.value.add(X)})),a+=w}))}function W(){var t;if(!(null==(t=null==T?void 0:T.vertical)?void 0:t.length))return;const i="vertical";I.set(i,[]);const{vertical:o}=T;o.forEach(((t,o)=>{const{textStyle:n={},data:r,time:a}=t,l=x(a);if(!B(l))return;let s=E+w/2;r.forEach(((t,r)=>{const a=e(String(t),{...n,lockMovementY:!0,left:l,originX:"left",top:s,origin:{type:"other",key:i,dataIndex:o,index:r,data:{value:t}}});s+=w,O(a),I.get(i).push(a),d.value.add(a)}));const c=I.get(i).filter((t=>t.origin.dataIndex===o)),u=Math.max(...c.map((t=>t.width))),f=l>z-u;c.forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=u,f&&t.setCoords().set("originX","right")}))}))}function Y(t,e="add"){const{dataIndex:i,data:o,index:n,key:r}=t,l=T[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}}V(t)}function V(t){var e;const{key:i}=t;switch(null==(e=d.value)||e.remove(...I.get(i)),I.delete(i),i){case"horizontal":H();break;case"vertical":W();break;case"mark":G()}}function G(){if(!(null==P?void 0:P.mark)||!L)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=P.mark,a=i([C-5,A+L/2],{value:t,...o,originX:"right"});d.value.add(a);const l=A+L,s=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=x(i);if(!B(r))return;let a=A;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"}}),c=o.height;a+c<=l&&a>=A?(o.set("top",a+c/2),a+=c):(i||(a=A,i=!0),o.set("top",a-c/2),a-=c),s.push(o),O(o),d.value.add(o)}))})),function(t){const e=t=>{var e,i;return null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart},i=t.find((t=>e(t))),o=t.find((t=>!e(t)&&t.left>i.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:C,x2:z};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(s)}function O(t){if(M.hovered&&(t.on("mouseover",(()=>{q(t)})),t.on("mouseout",(()=>{f.show=!1}))),!M.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<E&&t.set("top",E);const e=A+L-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>z?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((i=>i.setCoords().set({originX:e,left:t.left})))}(t)),M.hovered&&q(t)})),t.on("mouseup",(n=>{var r;if(f.show=!1,1===n.button){i&&function(t){var e,i;if("mark"===t.origin.key){if((null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),i=Math.min(...e);t.startPoint.limitX.x2=i}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=k(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};d.value.discardActiveObject(),u("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(h.point={x:t.left,y:t.top},h.show=!0,h.target=t,h.list=s.map((t=>({...t,renderItem:()=>t.label}))))}))}function q(t){f.point={x:t.left,y:"mark"===t.origin.key?t.top:t.top+S/2};const e=!t.origin.isMenu&&t.originLeft?t.originLeft:t.left;f.list=[`时间 ${k(e).slice(-5)}`],"mark"===t.origin.key&&f.list.unshift(t.origin.data.name+" "),f.show=!0}function B(t){return t>=C&&t<=z}return function(){var t;if(!(null==(t=null==T?void 0:T.horizontal)?void 0:t.length))return;const{horizontal:i}=T,o=C-5;let n=E+w/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l}=t,s=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r,isMenu:!0},originLeft:o,originTop:n});var c;(c=s).on("moving",(()=>{c.set("originX","center"),b(c)?q(c):f.show=!1})),c.on("mouseup:before",(t=>{if(f.show=!1,0===t.e.button&&b(c))if(y(I.get("horizontal"),c.left,"key",j).includes(c.origin.key))X("repeat"),console.log("重复节点");else{const t={data:{time:k(c.left),value:c.origin.defaultAddValue},...c.origin};u("add",t),Y(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(c)})),d.value.add(s),n+=w}))}(),H(),W(),G(),n.on((()=>{const t="horizontal",e=g(I.get(t));e.length>0?p((()=>{const i=function(t){const e=t.reduce(((t,e)=>{const{dataIndex:i}=e.origin;return t[i]=t[i]?t[i].concat(e.origin):[e.origin],t}),{});return Object.keys(e).map((t=>{const i=e[t];return T.horizontal[t].data.splice(i[0].index,i.length),i})).flat()}(e);V({key:t}),u("remove",i)})):v()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};u(i,o),"remove"===i&&Y(o,i)}}}export{d as useOther};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as a}from"../useCumputedPoint.js";import"../useEvent.js";import"vue";import{cloneDeep as f}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import"@vueuse/core";function c(c,u,d,m,h){const{cumputedX:p,getXValue:v}=a(u),{originX:g,endX:x,xCellWidth:L,originYXAxis:X,top:C,canvasWidth:w,borderStyle:Y,treeData:y,xAxis:S,topGridYNumber:j,topGridOriginY:b,topGridYCellHeight:k,topGridEndY:G,event:I}=u,z=new Set;function A(t,e,i){let n;const{content:o}=t.value||{};if(o){const{textStyle:l}=C.data||{},{startLine:s,endLine:a}=e;n=r(o,{fontSize:12,...l,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const f=E(n,e,i);n&&(n.set(f),n.origin={data:t},$(n),s&&(s.text=n),a&&(a.text=n))}return n}function E(t,e,i){const n=t.width+1,{startLine:o,centerLine:l,endLine:r}=e,s={top:i,originX:"center",originY:"center"};return l&&n<=l.width?s.left=l.x1+l.width/2:r&&n<=r.limitX.x2-r.left?(s.originX="left",s.left=r.left+1):o&&!r&&n<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&n<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):l?(s.originY="top",s.left=l.x1+l.width/2,s.top=i+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=i+1),s}function M(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:a,y2:f,halfY:c}=e;if(!s||s<g||s>x)return;const{lineStyle:u}=C.data||{};let d;const m={left:s,top:c};d=i?r("circle",{fill:u.stroke,...m}):n?r(">",{fill:u.stroke,...m,fontSize:18}):l([s,a,s,c],u);const h=new t.Rect({width:L,height:k,fill:"transparent",left:s-L/2,top:a}),p=new t.Group([d,h],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,hoverCursor:"pointer",lockMovementY:!0});return p.isLeft=o,p.isCustomIcon=i,$(p),p}function $(t){I.hovered&&(t.on("mouseover",(()=>{W(t,"hover")})),t.on("mouseout",(()=>{m.show=!1}))),t.lockMovementX&&t.lockMovementY||(t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(t),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=E(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(t),I.hovered&&W(t)})),t.on("mouseup",(e=>{if(1===e.button){!function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(t);const e={type:"tree",...t.origin};d("change",e)}})))}function W(t,e="moving"){var i,n,o;const{data:l}=t.origin;m.point={x:t.left,y:t.top};let[r="",s=""]=l.time||[];if("moving"===e){const e=v(t.left);t.isLeft?r=e:s=e,l.time=[r,s],t.text&&(t.text.origin.data.time=[r,s])}m.list=[`开始时间 ${r}`,`结束时间 ${s}`,`流速 ${(null==(i=l.value)?void 0:i.currentSpeed)||""}`,`浓度 ${(null==(n=l.value)?void 0:n.consistence)||""}`,`总量 ${(null==(o=l.value)?void 0:o.total)||""}`],m.show=!0}s(c,{...u,gridYNumber:j,originY:b,yCellHeight:k,endY:G}),function(){var o;const{height:l,list:r,left:s,spaceValue:a}=S;if(!l)return;const f=[],u=X+l/2;r.forEach(((t,i)=>{const n=s+i*L*a;f.push(e([n,u],{value:t.slice(11,16)}))}));const d=f.length>0?new t.Group([...f],{...i,objectCaching:!1}):null;d&&c.value.add(d);const m=new t.Rect({width:w,height:l,left:0,top:X,...n,originX:"left",originY:"top",...Y}),h=e([x+(w-x)/2,u],{value:"总量",...null==(o=C.data)?void 0:o.totalStyle});c.value.add(m,h)}(),function(){var n;const r=(null==(n=null==C?void 0:C.tree)?void 0:n.textStyle)||{},s=[];!function t(i){i.forEach((i=>{var n;const{width:a,height:u,left:d,top:m,title:h=""}=i,v={value:h,...r};(null==(n=i.children)?void 0:n.length)?(v.value=h.split("").join("\n"),t(i.children)):(v.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e}=C.data||{},i=t.top,n=i+k,o=n-k/2,r={y1:i,y2:n,halfY:o};let s=null;const a=f(t);delete a.data,t.data.forEach(((t,i,n)=>{const{time:f,continue:c}=t,[u,d]=f,m=u&&p(u),h=d&&p(d),v=M({...r,x:m},{isCustomIcon:!h&&!c,isContinue:!1,isLeft:!0}),L=M({...r,x:h},{isCustomIcon:!1,isContinue:!!c});let X;if((v||m<g)&&(L||h>x)){X=l([v?m:g,o,L?h:x,o],e)}const C={startLine:v,centerLine:X,endLine:L};let w,Y;!function(t,e,i){const{startLine:n,centerLine:o,endLine:l}=e,{startLine:r,endLine:s}=t||{};if(n){n.origin=i;const t={x1:g,x2:l?l.left:x};s?(t.x1=s.left,s.limitX.x2=n.left,n.prevLine=s,s.nextLine=n):r&&(t.x1=r.left,r.limitX.x2=n.left,n.prevLine=r,r.nextLine=n),n.limitX=t,o&&(n.centerLine=o)}if(l){l.origin=i;const t={x1:n?n.left:g,x2:x};l.limitX=t,o&&(l.centerLine=o)}n&&l&&(n.nearLine=l,l.nearLine=n)}(s,C,Object.assign({},a,{data:t,index:i})),s&&(w=A(n[i-1],s,o)),i===n.length-1&&(Y=A(t,C,o)),s=C,X&&z.add(X),v&&z.add(v),L&&z.add(L),w&&z.add(w),Y&&z.add(Y)}))}(i),function(t){var i;if(!(null==t?void 0:t.total))return;const n=t.top+k/2,o=x+(w-x)/2,l=e([o,n],{value:t.total,...null==(i=C.data)?void 0:i.totalStyle}),r=w-Y.strokeWidth;o+l.width>r&&l.set({originX:"right",left:r});l&&c.value.add(l)}(i)),s.push(o({width:a,height:u,...Y},v,{left:d,top:m},!0))}))}(y);const a=s.length>0?new t.Group([...s],{...i,objectCaching:!1}):null;a&&c.value.add(a),z.size&&c.value.add(...z)}()}export{c as useTop};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as a}from"../useCumputedPoint.js";import"../useEvent.js";import"vue";import{cloneDeep as f}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import"@vueuse/core";function c(c,u,d,m,h){const{computedX:p,getXValue:v}=a(u),{originX:g,endX:x,xCellWidth:L,originYXAxis:X,top:C,canvasWidth:w,borderStyle:Y,treeData:y,xAxis:S,topGridYNumber:j,topGridOriginY:b,topGridYCellHeight:k,topGridEndY:G,event:I}=u,z=new Set;function A(t,e,i){let n;const{content:o}=t.value||{};if(o){const{textStyle:l}=C.data||{},{startLine:s,endLine:a}=e;n=r(o,{fontSize:12,...l,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const f=E(n,e,i);n&&(n.set(f),n.origin={data:t},$(n),s&&(s.text=n),a&&(a.text=n))}return n}function E(t,e,i){const n=t.width+1,{startLine:o,centerLine:l,endLine:r}=e,s={top:i,originX:"center",originY:"center"};return l&&n<=l.width?s.left=l.x1+l.width/2:r&&n<=r.limitX.x2-r.left?(s.originX="left",s.left=r.left+1):o&&!r&&n<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&n<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):l?(s.originY="top",s.left=l.x1+l.width/2,s.top=i+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=i+1),s}function M(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:a,y2:f,halfY:c}=e;if(!s||s<g||s>x)return;const{lineStyle:u}=C.data||{};let d;const m={left:s,top:c};d=i?r("circle",{fill:u.stroke,...m}):n?r(">",{fill:u.stroke,...m,fontSize:18}):l([s,a,s,c],u);const h=new t.Rect({width:L,height:k,fill:"transparent",left:s-L/2,top:a}),p=new t.Group([d,h],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,hoverCursor:"pointer",lockMovementY:!0});return p.isLeft=o,p.isCustomIcon=i,$(p),p}function $(t){I.hovered&&(t.on("mouseover",(()=>{W(t,"hover")})),t.on("mouseout",(()=>{m.show=!1}))),t.lockMovementX&&t.lockMovementY||(t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(t),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=E(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(t),I.hovered&&W(t)})),t.on("mouseup",(e=>{if(1===e.button){!function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(t);const e={type:"tree",...t.origin};d("change",e)}})))}function W(t,e="moving"){var i,n,o;const{data:l}=t.origin;m.point={x:t.left,y:t.top};let[r="",s=""]=l.time||[];if("moving"===e){const e=v(t.left);t.isLeft?r=e:s=e,l.time=[r,s],t.text&&(t.text.origin.data.time=[r,s])}m.list=[`开始时间 ${r}`,`结束时间 ${s}`,`流速 ${(null==(i=l.value)?void 0:i.currentSpeed)||""}`,`浓度 ${(null==(n=l.value)?void 0:n.consistence)||""}`,`总量 ${(null==(o=l.value)?void 0:o.total)||""}`],m.show=!0}s(c,{...u,gridYNumber:j,originY:b,yCellHeight:k,endY:G}),function(){var o;const{height:l,list:r,left:s,spaceValue:a}=S;if(!l)return;const f=[],u=X+l/2;r.forEach(((t,i)=>{const n=s+i*L*a;f.push(e([n,u],{value:t.slice(11,16)}))}));const d=f.length>0?new t.Group([...f],{...i,objectCaching:!1}):null;d&&c.value.add(d);const m=new t.Rect({width:w,height:l,left:0,top:X,...n,originX:"left",originY:"top",...Y}),h=e([x+(w-x)/2,u],{value:"总量",...null==(o=C.data)?void 0:o.totalStyle});c.value.add(m,h)}(),function(){var n;const r=(null==(n=null==C?void 0:C.tree)?void 0:n.textStyle)||{},s=[];!function t(i){i.forEach((i=>{var n;const{width:a,height:u,left:d,top:m,title:h=""}=i,v={value:h,...r};(null==(n=i.children)?void 0:n.length)?(v.value=h.split("").join("\n"),t(i.children)):(v.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e}=C.data||{},i=t.top,n=i+k,o=n-k/2,r={y1:i,y2:n,halfY:o};let s=null;const a=f(t);delete a.data,t.data.forEach(((t,i,n)=>{const{time:f,continue:c}=t,[u,d]=f,m=u&&p(u),h=d&&p(d),v=M({...r,x:m},{isCustomIcon:!h&&!c,isContinue:!1,isLeft:!0}),L=M({...r,x:h},{isCustomIcon:!1,isContinue:!!c});let X;if((v||m<g)&&(L||h>x)){X=l([v?m:g,o,L?h:x,o],e)}const C={startLine:v,centerLine:X,endLine:L};let w,Y;!function(t,e,i){const{startLine:n,centerLine:o,endLine:l}=e,{startLine:r,endLine:s}=t||{};if(n){n.origin=i;const t={x1:g,x2:l?l.left:x};s?(t.x1=s.left,s.limitX.x2=n.left,n.prevLine=s,s.nextLine=n):r&&(t.x1=r.left,r.limitX.x2=n.left,n.prevLine=r,r.nextLine=n),n.limitX=t,o&&(n.centerLine=o)}if(l){l.origin=i;const t={x1:n?n.left:g,x2:x};l.limitX=t,o&&(l.centerLine=o)}n&&l&&(n.nearLine=l,l.nearLine=n)}(s,C,Object.assign({},a,{data:t,index:i})),s&&(w=A(n[i-1],s,o)),i===n.length-1&&(Y=A(t,C,o)),s=C,X&&z.add(X),v&&z.add(v),L&&z.add(L),w&&z.add(w),Y&&z.add(Y)}))}(i),function(t){var i;if(!(null==t?void 0:t.total))return;const n=t.top+k/2,o=x+(w-x)/2,l=e([o,n],{value:t.total,...null==(i=C.data)?void 0:i.totalStyle}),r=w-Y.strokeWidth;o+l.width>r&&l.set({originX:"right",left:r});l&&c.value.add(l)}(i)),s.push(o({width:a,height:u,...Y},v,{left:d,top:m},!0))}))}(y);const a=s.length>0?new t.Group([...s],{...i,objectCaching:!1}):null;a&&c.value.add(a),z.size&&c.value.add(...z)}()}export{c as useTop};
@@ -2,7 +2,7 @@ import { type Ref } from 'vue';
2
2
  import { fabric } from '../../../../../../es/shared/utils/fabricjs';
3
3
  import { IObject, IPropItems, IPointTipProps, IPointMenuProps } from '../../../../../../es/components/fabric-chart/src/interface';
4
4
  import { AnyObject } from '../../../../../../es/shared/types';
5
- export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: Function, cumputedX: Function, cumputedY: Function, getXValue: Function, getYValue: Function, addRenderItem: Function | undefined, pointTipProps: IPointTipProps, pointMenuProps: IPointMenuProps): {
5
+ export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: Function, computedX: Function, cumputedY: Function, getXValue: Function, getYValue: Function, addRenderItem: Function | undefined, pointTipProps: IPointTipProps, pointMenuProps: IPointMenuProps): {
6
6
  clickMenu: ({ item, target }: {
7
7
  item: any;
8
8
  target: any;
@@ -1,6 +1,6 @@
1
1
  import { Ref } from 'vue';
2
2
  import { fabric } from '../../../../../../es/shared/utils/fabricjs';
3
3
  import { IPropItems, IPointTipProps, IObject } from '../../../../../../es/components/fabric-chart/src/interface';
4
- export declare function useLeft(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: Function, setPopup: Function, pointTipProps: IPointTipProps, cumputedX: Function, cumputedY: Function, getXValue: Function, getYValue: Function, isAddPoint: Function, updateData: Function, gridPoints: Set<IObject>): {
4
+ export declare function useLeft(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: Function, setPopup: Function, pointTipProps: IPointTipProps, computedX: Function, cumputedY: Function, getXValue: Function, getYValue: Function, isAddPoint: Function, updateData: Function, gridPoints: Set<IObject>): {
5
5
  drawScaleValue: (yScaleValueList: any[]) => void;
6
6
  };
@@ -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)){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"../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,4 +1,4 @@
1
1
  import { Ref } from 'vue';
2
2
  import { fabric } from '../../../../../../es/shared/utils/fabricjs';
3
3
  import { IPropItems } from '../../../../../../es/components/fabric-chart/src/interface';
4
- export declare function useOther(canvas: Ref<fabric.Canvas>, propItems: IPropItems, cumputedX: Function): void;
4
+ export declare function useOther(canvas: Ref<fabric.Canvas>, propItems: IPropItems, computedX: Function): void;
@@ -1 +1 @@
1
- import{ref as e,computed as t,reactive as a,watch as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as i}from"../useCumputedPoint.js";import{useCanvasEvent as n}from"../useEvent.js";import{setOtherType as r,getFloorNumber as o}from"../../utils/index.js";import"lodash-es";import{format as s,addDays as d}from"date-fns";import"naive-ui";import"@vueuse/core";import{useTop as v}from"./useTop.js";import{useLeft as c}from"./useLeft.js";import{useRight as h}from"./useRight.js";import{useCenter as p}from"./useCenter.js";import{useBottom as g}from"./useBottom.js";import{useOther as m}from"./useOther.js";function f(f,y,S,b,w,Y){const C=15,x=e(),D=e(),j=e(),V=t((()=>{var e;return(null==(e=y.data.grid)?void 0:e.surplusCell)||[0,0,0,0]})),H=t((()=>{const{top:e}=y.data;return e.date.show&&(e.date.height||C)||0})),X=t((()=>{var e;const{top:t}=y.data;return(null==(e=t.hospitalDays)?void 0:e.show)&&(t.hospitalDays.height||C)||0})),L=t((()=>{var e;const{top:t}=y.data;return(null==(e=t.operationDays)?void 0:e.show)&&(t.operationDays.height||C)||0})),I=t((()=>{var e,t,a;const{top:l}=y.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||C)||0)+((null==(t=l.xScalevalue)?void 0:t.show)&&null!=(a=l.dayHeight)?a:0)})),M=t((()=>{var e;const{bottom:t}=y.data;return(null==(e=null==t?void 0:t.breathing)?void 0:e.show)&&(t.breathing.height||30)||0})),P=t((()=>{const{grid:e}=y.data;return e.mainXCell*e.subXCell+V.value[1]+V.value[3]})),N=t((()=>{const{grid:e}=y.data;return e.mainYCell*e.subYCell+V.value[0]+V.value[2]})),O=t((()=>{var e;const{width:t,right:a=null,top:l}=y.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),W=t((()=>O.value-V.value[2]*z.value)),$=t((()=>{const{top:e,left:t}=y.data;return e.titleWidth+A.value})),k=t((()=>{const{bottom:e=null,height:t}=y.data;if(!e)return t;return t-(e.height||30)})),G=t((()=>k.value-V.value[2]*T.value)),R=t((()=>{var e;const{top:t}=y.data,a=t.xScalevalue.show&&(null!=(e=t.dayHeight)?e:0)||0,l=t.xScalevalue.show&&(t.xScalevalue.height||C)||0;return H.value+a+l+X.value+L.value})),q=t((()=>R.value+V.value[0]*T.value)),z=t((()=>(O.value-$.value)/P.value)),T=t((()=>(k.value-R.value)/N.value)),A=t((()=>{var e,t;const{left:a}=y.data;return(null==(e=a.icons)?void 0:e.show)&&((null==(t=a.icons)?void 0:t.width)||100)||0})),B=t((()=>{var e,t;const{top:a,grid:l}=y.data,u=(null==(t=null==(e=a.date.list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],i=a.xScalevalue.times;let n=$.value-z.value;const r=a.date.startDate||s(new Date,"yyyy-MM-dd");return u.reduce(((e,t,a)=>0===a?e.concat(r):e.concat(s(d(new Date(r.replace(/-/g,"/")),a),"yyyy-MM-dd"))),[]).map((e=>i.map((t=>{n+=z.value;const a=Date.parse(`${e} ${t.start}`),l=Date.parse(`${e} ${t.end}`);return{start:a,end:l,left:n,center:n+z.value/2,scaleCell:(l-a)/z.value}})))).flat()})),E=t((()=>ie("breathe"))),F=t((()=>ie("pulse"))),J=t((()=>ie("temperature"))),K=t((()=>ie("pain"))),Q=t((()=>{var e;return(null==(e=y.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),U=t((()=>{const{left:e}=y.data;return e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:r(t.title,e.type),unit:e.unit,dataIndex:a}))))).flat()})),Z=t((()=>{var e,t;const{left:a}=y.data,l=a.yScaleValue.findIndex((e=>"pain"===e.type));return l>-1&&(null==(t=null==(e=a.yScaleValue[l].dataList)?void 0:e[0])?void 0:t.show)?l:-1})),_=t((()=>{const{grid:e}=y.data;return-1===Z.value?0:T.value*e.subYCell})),ee=t((()=>{const{left:e}=y.data,t={originY:q.value,endY:G.value};return 0===Z.value&&e.yScaleValue.length>1?t.endY=q.value+_.value:Z.value===e.yScaleValue.length-1&&(t.originY=G.value-_.value),t})),te=t((()=>{const{left:e}=y.data,t={originY:q.value,endY:G.value};return 0===Z.value&&e.yScaleValue.length>1?t.originY=q.value+_.value:Z.value===e.yScaleValue.length-1&&(t.endY=G.value-_.value),t})),ae=t((()=>{var e,t;const{top:a,grid:l}=y.data,u=[];for(const i in a)a[i].show&&u.push({...a[i],list:(null==(t=null==(e=a[i].list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,t)=>e.seq-t.seq))})),le=t((()=>{var e;const{left:t,right:a}=y.data,l=t.yScaleValue.find((e=>"temperature"===e.type)),u=(null==a?void 0:a.yScaleValue)||{};if(null==(e=null==l?void 0:l.list)?void 0:e.length){const e=(null==u?void 0:u.showdetailedScale)?l.list.reduce((e=>{const t=e[e.length-1];return t?e.concat([t+1,t+2]):e.concat([92])}),[]):[],t=l.list.map((e=>o(1.8*e+32)));Object.assign(u,{list:t,detailedList:e,spaceGridNumber:l.spaceGridNumber})}return u})),ue=a({canvasWidth:y.data.width,canvasHeight:y.data.height,borderStyle:{...u,...y.data.borderStyle||{}},selectionStyle:y.data.selectionStyle||{},dateHeight:H.value,hospitalDaysHeight:X.value,operationDaysHeight:L.value,xScalevalueHeight:I.value,topList:ae.value,breathingHeight:M.value,hospitalizationDate:y.data.hospitalizationDate,grid:y.data.grid,top:y.data.top,left:y.data.left,right:y.data.right,bottom:y.data.bottom,other:y.data.other,painIndex:Z.value,painHeight:_.value,painOriginY:ee.value,vitalSignsOriginY:te.value,gridXNumber:P.value,gridYNumber:N.value,iconsWidth:A.value,originX:$.value,originY:R.value,originYLimit:q.value,endX:O.value,endXLimit:W.value,endY:k.value,xCellWidth:z.value,yCellHeight:T.value,xScaleList:B.value,breatheYCell:E.value,pulseYCell:F.value,temperatureYCell:J.value,painYCell:K.value,event:Q.value,itemList:U.value,getRightInfo:le.value,config:y.data.config||{},surplusCell:V.value});function ie(e){const{yScaleValue:t}=y.data.left,a=t.find((t=>t.type===e)),l=(null==a?void 0:a.list)||[];return l.length?T.value/((l[1]-l[0])/a.spaceGridNumber):0}const{cumputedX:ne,cumputedY:re,getXValue:oe,getYValue:se}=i(ue);return l((()=>f.value),(e=>{e&&function(){v(f,ue);const{setPopup:e,isAddPoint:t,updateData:a,redrawPoints:l,clickMenu:u,gridPoints:i}=p(f,ue,S,ne,re,oe,se,y.addRenderItem,w,Y);D.value=l,j.value=u;const{drawScaleValue:r}=c(f,ue,S,e,w,ne,re,oe,se,t,a,i);h(f,ue,r),g(f,ue),m(f,ue,ne);const{select:o}=n(f,ue,S);x.value=o}()}),{immediate:!0}),{propItems:ue,redrawPoints:D,select:x,clickMenu:j}}export{f as useTemperatureChart};
1
+ import{ref as e,computed as t,reactive as a,watch as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as i}from"../useCumputedPoint.js";import{useCanvasEvent as n}from"../useEvent.js";import{setOtherType as r,getFloorNumber as o}from"../../utils/index.js";import"lodash-es";import{format as s,addDays as d}from"date-fns";import"naive-ui";import"@vueuse/core";import{useTop as v}from"./useTop.js";import{useLeft as c}from"./useLeft.js";import{useRight as h}from"./useRight.js";import{useCenter as p}from"./useCenter.js";import{useBottom as g}from"./useBottom.js";import{useOther as m}from"./useOther.js";function f(f,y,S,b,w,Y){const C=15,x=e(),D=e(),j=e(),V=t((()=>{var e;return(null==(e=y.data.grid)?void 0:e.surplusCell)||[0,0,0,0]})),H=t((()=>{const{top:e}=y.data;return e.date.show&&(e.date.height||C)||0})),X=t((()=>{var e;const{top:t}=y.data;return(null==(e=t.hospitalDays)?void 0:e.show)&&(t.hospitalDays.height||C)||0})),L=t((()=>{var e;const{top:t}=y.data;return(null==(e=t.operationDays)?void 0:e.show)&&(t.operationDays.height||C)||0})),I=t((()=>{var e,t,a;const{top:l}=y.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||C)||0)+((null==(t=l.xScalevalue)?void 0:t.show)&&null!=(a=l.dayHeight)?a:0)})),M=t((()=>{var e;const{bottom:t}=y.data;return(null==(e=null==t?void 0:t.breathing)?void 0:e.show)&&(t.breathing.height||30)||0})),P=t((()=>{const{grid:e}=y.data;return e.mainXCell*e.subXCell+V.value[1]+V.value[3]})),N=t((()=>{const{grid:e}=y.data;return e.mainYCell*e.subYCell+V.value[0]+V.value[2]})),O=t((()=>{var e;const{width:t,right:a=null,top:l}=y.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),W=t((()=>O.value-V.value[2]*z.value)),$=t((()=>{const{top:e,left:t}=y.data;return e.titleWidth+A.value})),k=t((()=>{const{bottom:e=null,height:t}=y.data;if(!e)return t;return t-(e.height||30)})),G=t((()=>k.value-V.value[2]*T.value)),R=t((()=>{var e;const{top:t}=y.data,a=t.xScalevalue.show&&(null!=(e=t.dayHeight)?e:0)||0,l=t.xScalevalue.show&&(t.xScalevalue.height||C)||0;return H.value+a+l+X.value+L.value})),q=t((()=>R.value+V.value[0]*T.value)),z=t((()=>(O.value-$.value)/P.value)),T=t((()=>(k.value-R.value)/N.value)),A=t((()=>{var e,t;const{left:a}=y.data;return(null==(e=a.icons)?void 0:e.show)&&((null==(t=a.icons)?void 0:t.width)||100)||0})),B=t((()=>{var e,t;const{top:a,grid:l}=y.data,u=(null==(t=null==(e=a.date.list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],i=a.xScalevalue.times;let n=$.value-z.value;const r=a.date.startDate||s(new Date,"yyyy-MM-dd");return u.reduce(((e,t,a)=>0===a?e.concat(r):e.concat(s(d(new Date(r.replace(/-/g,"/")),a),"yyyy-MM-dd"))),[]).map((e=>i.map((t=>{n+=z.value;const a=Date.parse(`${e} ${t.start}`),l=Date.parse(`${e} ${t.end}`);return{start:a,end:l,left:n,center:n+z.value/2,scaleCell:(l-a)/z.value}})))).flat()})),E=t((()=>ie("breathe"))),F=t((()=>ie("pulse"))),J=t((()=>ie("temperature"))),K=t((()=>ie("pain"))),Q=t((()=>{var e;return(null==(e=y.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),U=t((()=>{const{left:e}=y.data;return e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:r(t.title,e.type),unit:e.unit,dataIndex:a}))))).flat()})),Z=t((()=>{var e,t;const{left:a}=y.data,l=a.yScaleValue.findIndex((e=>"pain"===e.type));return l>-1&&(null==(t=null==(e=a.yScaleValue[l].dataList)?void 0:e[0])?void 0:t.show)?l:-1})),_=t((()=>{const{grid:e}=y.data;return-1===Z.value?0:T.value*e.subYCell})),ee=t((()=>{const{left:e}=y.data,t={originY:q.value,endY:G.value};return 0===Z.value&&e.yScaleValue.length>1?t.endY=q.value+_.value:Z.value===e.yScaleValue.length-1&&(t.originY=G.value-_.value),t})),te=t((()=>{const{left:e}=y.data,t={originY:q.value,endY:G.value};return 0===Z.value&&e.yScaleValue.length>1?t.originY=q.value+_.value:Z.value===e.yScaleValue.length-1&&(t.endY=G.value-_.value),t})),ae=t((()=>{var e,t;const{top:a,grid:l}=y.data,u=[];for(const i in a)a[i].show&&u.push({...a[i],list:(null==(t=null==(e=a[i].list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,t)=>e.seq-t.seq))})),le=t((()=>{var e;const{left:t,right:a}=y.data,l=t.yScaleValue.find((e=>"temperature"===e.type)),u=(null==a?void 0:a.yScaleValue)||{};if(null==(e=null==l?void 0:l.list)?void 0:e.length){const e=(null==u?void 0:u.showdetailedScale)?l.list.reduce((e=>{const t=e[e.length-1];return t?e.concat([t+1,t+2]):e.concat([92])}),[]):[],t=l.list.map((e=>o(1.8*e+32)));Object.assign(u,{list:t,detailedList:e,spaceGridNumber:l.spaceGridNumber})}return u})),ue=a({canvasWidth:y.data.width,canvasHeight:y.data.height,borderStyle:{...u,...y.data.borderStyle||{}},selectionStyle:y.data.selectionStyle||{},dateHeight:H.value,hospitalDaysHeight:X.value,operationDaysHeight:L.value,xScalevalueHeight:I.value,topList:ae.value,breathingHeight:M.value,hospitalizationDate:y.data.hospitalizationDate,grid:y.data.grid,top:y.data.top,left:y.data.left,right:y.data.right,bottom:y.data.bottom,other:y.data.other,painIndex:Z.value,painHeight:_.value,painOriginY:ee.value,vitalSignsOriginY:te.value,gridXNumber:P.value,gridYNumber:N.value,iconsWidth:A.value,originX:$.value,originY:R.value,originYLimit:q.value,endX:O.value,endXLimit:W.value,endY:k.value,xCellWidth:z.value,yCellHeight:T.value,xScaleList:B.value,breatheYCell:E.value,pulseYCell:F.value,temperatureYCell:J.value,painYCell:K.value,event:Q.value,itemList:U.value,getRightInfo:le.value,config:y.data.config||{},surplusCell:V.value});function ie(e){const{yScaleValue:t}=y.data.left,a=t.find((t=>t.type===e)),l=(null==a?void 0:a.list)||[];return l.length?T.value/((l[1]-l[0])/a.spaceGridNumber):0}const{computedX:ne,cumputedY:re,getXValue:oe,getYValue:se}=i(ue);return l((()=>f.value),(e=>{e&&function(){v(f,ue);const{setPopup:e,isAddPoint:t,updateData:a,redrawPoints:l,clickMenu:u,gridPoints:i}=p(f,ue,S,ne,re,oe,se,y.addRenderItem,w,Y);D.value=l,j.value=u;const{drawScaleValue:r}=c(f,ue,S,e,w,ne,re,oe,se,t,a,i);h(f,ue,r),g(f,ue),m(f,ue,ne);const{select:o}=n(f,ue,S);x.value=o}()}),{immediate:!0}),{propItems:ue,redrawPoints:D,select:x,clickMenu:j}}export{f as useTemperatureChart};
@@ -1,14 +1,20 @@
1
1
  import { IPointType } from '../interface';
2
2
  import { AnyObject } from '../../../../../es/shared/types';
3
3
  export declare function useCumputedPoint(propItems: AnyObject): {
4
- cumputedX: (value: number | string, setAllCenter?: boolean) => any;
4
+ computedX: (value: number | string, setAllCenter?: boolean) => any;
5
5
  cumputedY: (type: IPointType, scaleValueList: number[], value: number | string) => number;
6
6
  getXValue: (pointX: number) => string | undefined;
7
7
  getYValue: (type: IPointType, pointY: number) => number;
8
8
  };
9
9
  export declare function useBirthProcessCumputedPoint(propItems: AnyObject): {
10
- cumputedX: (value: number | string) => any;
10
+ computedX: (value: number | string) => any;
11
11
  cumputedY: (key: string, range: [number, number], value: number | string) => number;
12
12
  getXValue: (pointX: number) => string;
13
13
  getYValue: (key: string, pointY: number) => number;
14
14
  };
15
+ export declare function useElectrocardiogramCumputedPoint(propItems: AnyObject): {
16
+ computedX: (index: number) => number;
17
+ cumputedY: (value: number) => number;
18
+ getXValue: (pointX: number) => number;
19
+ getYValue: (pointY: number) => number;
20
+ };
@@ -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:r,left:l,vitalSignsOriginY:c,painOriginY:d,canvasWidth:o}=i;return{cumputedX:function(n,e=!1){const i=t(n),[r]=u,l=u.at(-1);if(i<r.start)return 0;if(i>l.end)return o;const c=u.findIndex((n=>n.end>=i));if(c>-1){return u[c].center}},cumputedY:function(n,t,e){const u=i[`${n}YCell`],r=+e-Math.min(...t);return("pain"===n?d.endY:c.endY)-u*r},getXValue:function(t){const e=u.findIndex((n=>n.left+r>=t));if(e>-1){const i=u[e],r=t-i.left,l=i.scaleCell*r,c=i.start+l;return n(new Date(c),"yyyy-MM-dd HH:mm")}},getYValue:function(n,t){var u;const r=i[`${n}YCell`],o=(null==(u=l.yScaleValue.find((t=>t.type===n)))?void 0:u.list)||[],a=o.length?Math.min(...o):0,s="pain"===n?d.endY:c.endY;return e((s-t)/r+a)}}}function u(i){const{xAxis:u,originX:r,originY:l,xCellWidth:c,endY:d,timeXCell:o,startTime:a,scaleValues:s}=i;return{cumputedX:function(n){return(t(n)-a)/o+r},cumputedY:function(n,t,e){const[u]=t;return d-(+e-u)*i[`${n}YCell`]},getXValue:function(t){return n(new Date((t-r)*o+a),"yyyy-MM-dd HH:mm")},getYValue:function(n,t){const u=s.find((t=>[t.key,t.type||""].includes(n))),[r]=(null==u?void 0:u.range)||[0],l=(d-t)/i[`${n}YCell`]+r;return e(l)}}}export{u as useBirthProcessCumputedPoint,i as useCumputedPoint};
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:c,painOriginY:o,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 c=u.findIndex((n=>n.end>=i));if(c>-1){return u[c].center}},cumputedY:function(n,t,e){const u=i[`${n}YCell`],l=+e-Math.min(...t);return("pain"===n?o.endY:c.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,c=i.start+r;return n(new Date(c),"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?o.endY:c.endY;return e((f-t)/l+d)}}}function u(i){const{xAxis:u,originX:l,originY:r,xCellWidth:c,endY:o,timeXCell:a,startTime:d,scaleValues:f}=i;return{computedX:function(n){return(t(n)-d)/a+l},cumputedY:function(n,t,e){const[u]=t;return o-(+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=(o-t)/i[`${n}YCell`]+l;return e(r)}}}function l(n){const{config:t,xCellWidth:i,yCellHeight:u}=n,{hz:l,mainXCellValue:r,valueUnit:c,mainYCellValue:o}=t;return{computedX:function(n){return n/l/r*i},cumputedY:function(n){return("uv"===c?.001*n:"v"===c?1e3*n:n)/o*u},getXValue:function(n){return e(r/i*n)},getYValue:function(n){return e(o/u*n)}}}export{u as useBirthProcessCumputedPoint,i as useCumputedPoint,l as useElectrocardiogramCumputedPoint};