cnhis-design-vue 3.1.48-beta.2 → 3.1.48-beta.20

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 (98) hide show
  1. package/es/components/base-search/index.d.ts +13 -0
  2. package/es/components/base-search/src/index.vue.d.ts +13 -0
  3. package/es/components/base-search/src/index.vue2.js +1 -1
  4. package/es/components/base-search/style/index.css +1 -1
  5. package/es/components/card-reader-sdk/src/cardReaderSDK.d.ts +37 -8
  6. package/es/components/card-reader-sdk/src/cardReaderSDK.js +1 -1
  7. package/es/components/card-reader-sdk/src/components/readCardDialog.vue.d.ts +19 -0
  8. package/es/components/card-reader-sdk/src/components/readCardDialog.vue2.js +1 -1
  9. package/es/components/card-reader-sdk/src/constants/index.d.ts +60 -168
  10. package/es/components/card-reader-sdk/src/constants/index.js +1 -1
  11. package/es/components/card-reader-sdk/src/insuranceSDK.d.ts +1 -6
  12. package/es/components/card-reader-sdk/src/insuranceSDK.js +1 -1
  13. package/es/components/card-reader-sdk/src/types/index.d.ts +27 -21
  14. package/es/components/card-reader-sdk/src/utils/index.d.ts +1 -1
  15. package/es/components/card-reader-sdk/src/utils/index.js +1 -1
  16. package/es/components/card-reader-sdk/src/utils/readHealthCard.d.ts +6 -1
  17. package/es/components/card-reader-sdk/src/utils/readHealthCard.js +1 -1
  18. package/es/components/classification/index.d.ts +3 -0
  19. package/es/components/classification/src/components/search-filter/index.vue.d.ts +3 -0
  20. package/es/components/classification/src/components/set-classification/index.vue.d.ts +3 -0
  21. package/es/components/classification/src/index.vue.d.ts +3 -0
  22. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
  23. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.d.ts +7 -1
  24. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
  25. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.d.ts +2 -1
  26. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
  27. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  28. package/es/components/fabric-chart/src/hooks/temperature/useCenter.d.ts +2 -1
  29. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  30. package/es/components/fabric-chart/src/hooks/temperature/useLeft.d.ts +2 -2
  31. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  32. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
  33. package/es/components/fabric-chart/src/hooks/useCommon.d.ts +1 -1
  34. package/es/components/fabric-chart/src/hooks/useCommon.js +1 -1
  35. package/es/components/fabric-chart/src/hooks/useDraw.js +1 -1
  36. package/es/components/field-set/index.d.ts +21 -1
  37. package/es/components/field-set/src/FieldSet.vue.d.ts +22 -2
  38. package/es/components/field-set/src/FieldSet.vue2.js +1 -1
  39. package/es/components/field-set/src/components/Row.vue2.js +1 -1
  40. package/es/components/field-set/src/types/index.d.ts +8 -0
  41. package/es/components/field-set/src/utils/index.js +1 -1
  42. package/es/components/form-render/src/components/renderer/radio&checkbox.d.ts +13 -0
  43. package/es/components/form-render/src/components/renderer/radio_checkbox.js +1 -1
  44. package/es/components/form-render/src/components/renderer/select.js +1 -1
  45. package/es/components/form-render/src/hooks/useBusinessBinding.d.ts +1 -1
  46. package/es/components/form-render/src/hooks/useBusinessBinding.js +1 -1
  47. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  48. package/es/components/form-render/src/hooks/useFormRenderOptions.d.ts +2 -0
  49. package/es/components/form-render/src/hooks/useFormRenderOptions.js +1 -1
  50. package/es/components/form-render/src/types/index.d.ts +1 -0
  51. package/es/components/iho-table/src/constants/index.d.ts +2 -1
  52. package/es/components/iho-table/src/constants/index.js +1 -1
  53. package/es/components/iho-table/src/hooks/useColumnConfigAdaptor.js +1 -1
  54. package/es/components/iho-table/src/plugins/bindEventSettingPlugin/index.d.ts +1 -0
  55. package/es/components/iho-table/src/plugins/bindEventSettingPlugin/index.js +1 -0
  56. package/es/components/iho-table/src/plugins/highLightSetPlugin.js +1 -1
  57. package/es/components/iho-table/src/plugins/index.js +1 -1
  58. package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin/index.js +1 -1
  59. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/radioRendererPlugin.d.ts +1 -0
  60. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/radioRendererPlugin.js +1 -0
  61. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.d.ts +18 -0
  62. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
  63. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.js +1 -1
  64. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/colorRendererPlugin.js +1 -1
  65. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/defaultRendererPlugin.js +1 -1
  66. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/labelRendererPlugin.js +1 -1
  67. package/es/components/iho-table/src/plugins/rowGroupSettingPlugin/rowGroupUtils.js +1 -1
  68. package/es/components/iho-table/src/plugins/virtualTreePlugin/index.js +1 -1
  69. package/es/components/iho-table/src/types/index.d.ts +1 -0
  70. package/es/components/iho-table/src/utils/index.d.ts +1 -0
  71. package/es/components/iho-table/src/utils/index.js +1 -1
  72. package/es/components/iho-table/style/index.css +1 -1
  73. package/es/components/index.css +1 -1
  74. package/es/components/info-header/index.d.ts +13 -0
  75. package/es/components/info-header/src/InfoHeader.vue.d.ts +13 -0
  76. package/es/components/info-header/src/InfoHeader.vue2.js +1 -1
  77. package/es/components/info-header/src/components/patientInfo/index.vue2.js +1 -1
  78. package/es/components/info-header/style/index.css +1 -1
  79. package/es/components/quick-search/style/index.css +1 -1
  80. package/es/components/scale-view/index.d.ts +2 -0
  81. package/es/components/scale-view/src/ScaleView.vue.d.ts +2 -0
  82. package/es/components/scale-view/src/components/EvaluateCountdown.vue.d.ts +2 -0
  83. package/es/components/scale-view/src/components/EvaluateCountdown.vue2.js +1 -1
  84. package/es/components/scale-view/src/components/formitem/r-datetime.js +1 -1
  85. package/es/components/scale-view/src/hooks/scaleview-init.js +1 -1
  86. package/es/components/scale-view/src/hooks/scaleview-submit.js +1 -1
  87. package/es/components/scale-view/src/utils/judge-types.d.ts +9 -1
  88. package/es/components/scale-view/src/utils/judge-types.js +1 -1
  89. package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +3 -0
  90. package/es/components/table-filter/src/components/classify-filter/index.vue2.js +1 -1
  91. package/es/shared/package.json.js +1 -1
  92. package/es/shared/types/index.d.ts +1 -0
  93. package/es/shared/utils/business.js +1 -1
  94. package/package.json +2 -2
  95. package/es/components/iho-table/src/plugins/fieldConnectionPlugin/index.d.ts +0 -1
  96. package/es/components/iho-table/src/plugins/fieldConnectionPlugin/index.js +0 -1
  97. package/es/components/iho-table/src/plugins/tooltipPlugin.d.ts +0 -1
  98. package/es/components/iho-table/src/plugins/tooltipPlugin.js +0 -1
@@ -1,7 +1,8 @@
1
- import { AnyObject, Func } from '../../../../../es/shared/types';
1
+ import { AnyObject, Func, NumberRange } from '../../../../../es/shared/types';
2
+ import { TRANS_CMD } from '../../../../../es/components/card-reader-sdk/src/constants';
2
3
  export declare namespace InsuranceType {
3
- type ExecType = 'hisyb' | 'login';
4
- type IHOWindow = Window & {
4
+ export type ExecType = 'hisyb' | 'login';
5
+ export type IHOWindow = Window & {
5
6
  chrome: {
6
7
  webview: {
7
8
  addEventListener: (type: string, handler: Func) => void;
@@ -10,44 +11,49 @@ export declare namespace InsuranceType {
10
11
  };
11
12
  };
12
13
  };
13
- type MessageDataType = {
14
+ export type MessageDataType = {
14
15
  exec: ExecType;
15
16
  res: {
16
17
  transcmd: string;
17
18
  };
18
19
  };
19
- type MessageType = {
20
+ export type MessageType = {
20
21
  data: string | MessageDataType;
21
22
  };
22
- type PostMessageResult<T extends ExecType> = {
23
+ export type PostMessageResult<T extends ExecType> = {
23
24
  result: any;
24
25
  exec: T;
25
26
  res: any;
26
27
  };
27
- type CardReadParams = Partial<{
28
+ export type CardReadParams = Partial<{
28
29
  operatorname: string;
29
30
  operatorcode: string;
30
- location: number;
31
+ location: '0' | '1' | '2' | '';
31
32
  needLogin: boolean;
32
- interfaceid: string;
33
- iar1Json: AnyObject;
34
- personinfo: AnyObject;
33
+ interfaceid: number | string;
34
+ transtime: string;
35
+ serialnumber: string;
36
+ transcmd: TRANS_CMD;
35
37
  transdata: AnyObject;
36
38
  loginCode: string;
37
- transtype: string;
38
- transchannel: string;
39
+ transtype: 'YB0000' | 'IDCARD' | '';
40
+ transsystem: '10' | '11' | '99' | '';
41
+ transchannel: '101' | '102' | '103' | '104' | '999' | '';
39
42
  }>;
40
- type CardReadResult = {
41
- returncode: number;
43
+ type MapperIar<T extends any[], Res extends any[] = []> = T extends [infer F, ...infer Rest] ? MapperIar<Rest, [...Res, `iar${F extends number ? F : never}`]> : Res;
44
+ export type CardReadResult = {
45
+ returncode: number | string;
42
46
  returnmsg: string;
43
47
  } & Partial<{
44
- returndata: {
45
- persioninfo?: AnyObject;
46
- };
47
- cardid: string;
48
- cardno: string;
48
+ returndata: Partial<{
49
+ personinfo: Record<'address' | 'age' | 'birthday' | 'cardnum' | 'cardpwd' | 'folk' | 'idnumber' | 'location' | 'ownpay' | 'ptname' | 'pttype' | 'recordid' | 'sex' | 'updateflag', string>;
50
+ cardinfo: Partial<Record<'cardno' | 'cardid' | 'name' | 'sex' | 'sex_code' | 'birthday' | 'nation_name' | 'nation_code' | 'address' | 'idnumber' | 'idtype' | 'issuer' | 'issuedate' | 'expirydate' | 'hasphoto' | 'telphone' | 'companyname' | 'age' | 'age_code' | 'age_name' | 'ages', string>>;
51
+ iar1: Record<'acf01' | 'iaa01' | 'iab02' | 'iac03' | 'iad04' | 'iai03' | 'iak04' | 'iak05' | 'iak06' | 'iak22' | 'iar01' | 'iar10' | MapperIar<NumberRange<10, 75>>[number], string>;
52
+ }>;
53
+ transcmd: string;
49
54
  }>;
50
- type CardReadOptions = Partial<{
55
+ export type CardReadOptions = Partial<{
51
56
  basicParams: CardReadParams | (() => CardReadParams);
52
57
  }>;
58
+ export {};
53
59
  }
@@ -5,5 +5,5 @@ export declare function getTranstime(): string;
5
5
  export declare function pad2(n: number): string | number;
6
6
  export declare function generateTimeRequestNumber(): string;
7
7
  export declare function insuranceLog(...messages: any[]): any;
8
- export declare function getErrorMessageByType(type?: string): string;
8
+ export declare function getErrorMessageByType(code?: number): string;
9
9
  export declare function getDataMessageByData(_data: string | AnyObject, configMap?: typeof CONFIG_MAP): any;
@@ -1 +1 @@
1
- import{isString as e}from"lodash-es";function n(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}function t(){return o()+parseInt(1e3*Math.random()+"")}function r(e){return e<10?"0"+e:e}function o(){const e=new Date;return e.getFullYear().toString()+r(e.getMonth()+1)+r(e.getDate())+r(e.getHours())+r(e.getMinutes())+r(e.getSeconds())}function a(...e){return console.log("[INSURANCE-SDK]: ",...e),e.reduce(((e,n)=>e+n))}const d={fastReport:"打印服务异常",newdsfz:"身份证读卡接口服务异常",newdhyk:"会员读卡接口服务异常",pos:"pos接口服务异常"};function u(e){return e&&d[e]||"请检查医保服务是否正常"}function s(n,t){var r;e(n)&&(n=JSON.parse(n));const o=n,{type:a="",returncodes:d=[]}=t||{};if(d.includes(null!=(r=o.returncode)?r:"")){if("newdhyk"===a)return o.returndata.cardinfo&&o.returndata.cardinfo.cardno?o.returndata.cardinfo:Promise.reject("未获取到卡号");if("newdsfz"===a){let n=null,t=null;return e(o.returndata)?(n=JSON.parse(o.returndata),t=n.cardinfo):t=o.returndata.cardinfo,t={...t,Sex:t.sex,Sex_Code:t.sex_code,Name:t.name,Age:t.age,Age_Code:t.age_code,Age_Name:t.age_name,BirthDate:t.birthdate,Nation_Name:t.nation_name,Nation_Code:t.nation_code,Address:t.address,CardNo:t.cardno,HasPhoto:t.hasphoto},t}return o}return Promise.reject(a+"--"+o.returnmsg)}export{o as generateTimeRequestNumber,s as getDataMessageByData,u as getErrorMessageByType,n as getSerialNumber,t as getTranstime,a as insuranceLog,r as pad2};
1
+ import{jsonParse as e}from"../../../../shared/utils/index.js";import{isString as t}from"lodash-es";import{TRANS_CMD as n}from"../constants/index.js";function r(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}function o(){return d()+parseInt(1e3*Math.random()+"")}function a(e){return e<10?"0"+e:e}function d(){const e=new Date;return e.getFullYear().toString()+a(e.getMonth()+1)+a(e.getDate())+a(e.getHours())+a(e.getMinutes())+a(e.getSeconds())}function i(...e){return console.log("[INSURANCE-SDK]: ",...e),e.reduce(((e,t)=>e+t))}const s={[n.ID_CARD_READ]:"身份证读卡接口服务异常",[n.MEMBER_CARD_READ]:"会员读卡接口服务异常",[n.FAST_REPORT_OR_POS]:"打印或pos接口服务异常"};function u(e){return e&&s[e]||"请检查医保服务是否正常"}function c(r,o){var a;t(r)&&(r=JSON.parse(r));const d=r,{transcmd:i=n.NS_GETPERSONALINFO}=o||{};if(["0","1"].includes(null!=(a=d.returncode)?a:"")){if(i===n.NS_GETPERSONALINFO)return d.returndata.cardinfo&&d.returndata.cardinfo.cardno?d.returndata.cardinfo:Promise.reject("未获取到卡号");if(i===n.ID_CARD_READ){const n=t(d.returndata)?e(d.returndata).cardinfo:d.returndata.cardinfo;return Object.assign(n,{Sex:n.sex,Sex_Code:n.sex_code,Name:n.name,Age:n.age,Age_Code:n.age_code,Age_Name:n.age_name,BirthDate:n.birthdate,Nation_Name:n.nation_name,Nation_Code:n.nation_code,Address:n.address,CardNo:n.cardno,HasPhoto:n.hasphoto}),n}return d}return Promise.reject(d.returnmsg)}export{d as generateTimeRequestNumber,c as getDataMessageByData,u as getErrorMessageByType,r as getSerialNumber,o as getTranstime,i as insuranceLog,a as pad2};
@@ -1,6 +1,11 @@
1
+ import { AnyObject } from '../../../../../es/shared/types';
1
2
  import { ComponentInternalInstance } from 'vue';
2
3
  export declare class ReadHealthCard {
3
4
  rendered: boolean;
4
5
  static createMsg(message: string): string;
5
- show(instance?: ComponentInternalInstance): Promise<string>;
6
+ show({ instance, inputProps, modalProps }?: {
7
+ instance?: ComponentInternalInstance;
8
+ inputProps?: AnyObject;
9
+ modalProps?: AnyObject;
10
+ }): Promise<string>;
6
11
  }
@@ -1 +1 @@
1
- import{ref as e,render as r,createVNode as t,withCtx as n,nextTick as o}from"vue";import{createProviderWrapper as a}from"../../../../shared/utils/index.js";import s from"../components/readCardDialog.vue.js";class d{constructor(){this.rendered=!1}static createMsg(e){return`[ReadHealthCardDialog] ${e}`}show(i){return this.rendered?Promise.reject(d.createMsg("请勿重复打开弹窗")):new Promise(((l,u)=>{this.rendered=!0;const c=document.createElement("div"),m=e(!1),h=a(i);var f;function p(){u(d.createMsg("弹窗关闭"))}function v(e){l(e),m.value=!1}r(t(h,null,{default:n((()=>t(s,{show:m.value,"onUpdate:show":e=>m.value=e,onConfirm:v,onClose:p,onAfterLeave:()=>function(e){if(!e.parentElement)return;C.rendered=!1,e.parentElement.removeChild(e)}(c)},null)),i)}),c),f=c,document.body.appendChild(f),o((()=>m.value=!0));const C=this}))}}export{d as ReadHealthCard};
1
+ import{ref as e,render as r,createVNode as t,withCtx as n,mergeProps as o,nextTick as s}from"vue";import{createProviderWrapper as a}from"../../../../shared/utils/index.js";import d from"../components/readCardDialog.vue.js";class i{constructor(){this.rendered=!1}static createMsg(e){return`[ReadHealthCardDialog] ${e}`}show({instance:l,inputProps:u,modalProps:c}={}){return this.rendered?Promise.reject(i.createMsg("请勿重复打开弹窗")):new Promise(((m,p)=>{this.rendered=!0;const h=document.createElement("div"),f=e(!1),v=a(l);var C;function P(){p(i.createMsg("弹窗关闭"))}function g(e){m(e),f.value=!1}r(t(v,null,{default:n((()=>t(d,o({show:f.value,"onUpdate:show":e=>f.value=e,onConfirm:g,onClose:P,onAfterLeave:()=>function(e){if(!e.parentElement)return;w.rendered=!1,e.parentElement.removeChild(e)}(h)},{inputProps:u,modalProps:c}),null)),l)}),h),C=h,document.body.appendChild(C),s((()=>f.value=!0));const w=this}))}}export{i as ReadHealthCard};
@@ -607,6 +607,9 @@ declare const CClassification: SFCWithInstall<import("vue").DefineComponent<{
607
607
  };
608
608
  }, {
609
609
  $message: import("naive-ui").MessageApi;
610
+ menuProps: {
611
+ class: string;
612
+ };
610
613
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
611
614
  actionList_prop: {
612
615
  type: import("vue").PropType<import("..").IClassifyListType>;
@@ -84,6 +84,9 @@ declare const _default: import("vue").DefineComponent<{
84
84
  };
85
85
  }, {
86
86
  $message: import("naive-ui").MessageApi;
87
+ menuProps: {
88
+ class: string;
89
+ };
87
90
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
88
91
  actionList_prop: {
89
92
  type: import("vue").PropType<import("../../../..").IClassifyListType>;
@@ -394,6 +394,9 @@ declare const _default: import("vue").DefineComponent<{
394
394
  };
395
395
  }, {
396
396
  $message: import("naive-ui").MessageApi;
397
+ menuProps: {
398
+ class: string;
399
+ };
397
400
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
398
401
  actionList_prop: {
399
402
  type: import("vue").PropType<IClassifyListType>;
@@ -608,6 +608,9 @@ declare const _default: import("vue").DefineComponent<{
608
608
  };
609
609
  }, {
610
610
  $message: import("naive-ui").MessageApi;
611
+ menuProps: {
612
+ class: string;
613
+ };
611
614
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
612
615
  actionList_prop: {
613
616
  type: PropType<IClassifyListType>;
@@ -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"@vueuse/core";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";function x(x,b,j,C,P){const{cumputedX:S,cumputedY:G,getXValue:M,getYValue:T}=c(b),{getEqualXTypes:Y,handleAddPrevent:E,isGridLimit:L}=h(x,j,b),{xAxis:X,grid:A,originX:I,originY:H,xCellWidth:O,endY:W,startTime:V,leftAddAreaWidth:D,leftScales:N,rightScales:R,yCellHeight:$,endX:B,scaleValues:F,canvasWidth:q,borderStyle:z,rightAddAreaWidth:J,event:K,originYCervix:Q,other:U,canvasHeight:Z}=b,_=k(F),ee=new Set;function te(){_.filter((e=>e.show)).forEach(((e,l)=>{var s;const a=[],u=[],c=[];null==(s=e.data)||s.forEach(((s,d)=>{!function(s,d,f){let p,h;const{pointAttr:g={},lineAttr:v={},title:m="",key:y,type:k="circle",childbirthStyle:w={}}=e,P=e.data[f+1],S=le(P,e);if(s&&S&&!d.breakpoint)h=t([...s,...S],{...v});else if(s&&!S&&!d.breakpoint){const o=le(P,e);h=o?t([...s,...o],{...v}):null}let G,Y;if(d.childbirth){const e=s[1]+$;G=o([s[0],s[1],e],w),c.push(G),Y=n([s[0]+O/2,e-$/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(Y)}const E=u[f-1],L={origin:{data:d,title:m,key:y||"",dataIndex:l,index:f},leftLine:E,rightLine:h,arrowGroup:G,arrowGroupText:Y,...g,...b.event.hovered?b.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:b.event};E?p=r(k,{left:E.get("x2"),top:E.get("y2"),...L}):s&&(L.leftLine=null,p=r(k,{left:s[0],top:s[1],...L}));u.push(h),p&&(!function(e){K.hovered&&(e.on("mouseover",(()=>{re(e,"hover")})),e.on("mouseout",(()=>{C.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ie(e),function(e){var t,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+O/2,top:e.top+$/2})}(e),K.hovered&&re(e)})),e.on("mouseup",(t=>{if(C.show=!1,1===t.button){const{key:t}=e.origin,o={...e.origin,data:{...e.origin.data,time:M(e.left),value:T(t,e.top)}};x.value.discardActiveObject(),j("change",o),oe(o,"change")}}))}(p),a.push(p),ee.add(p))}(le(s,e),s,d)})),Promise.all(a).then((e=>{const t=u.filter((e=>e));let o=null;e=e.filter((e=>(e&&o&&(o.nextPoint=e,e.prevPoint=o),o=e||o,e))),Promise.all(c).then((o=>{x.value.add(...t,...e,...o),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function oe(e,t="add"){const{dataIndex:o,data:n,index:i,key:r}=e,l=_.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=n;break;default:{const e=g(n.time,l.data);l.data.splice(e,0,n);break}}ne()}function ne(){var e;ee.size&&(null==(e=x.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),(null==e?void 0:e.arrowGroup)&&t.push(null==e?void 0:e.arrowGroup),(null==e?void 0:e.arrowGroupText)&&t.push(null==e?void 0:e.arrowGroupText)})),t}([...ee]))),ee.clear(),te()}function ie(e){const t=e.prevPoint?e.prevPoint.left:I,o=e.nextPoint?e.nextPoint.left:B;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<Q&&e.set("top",Q),e.top<H&&e.set("top",H),e.top>W&&e.set("top",W),e.left<t&&e.set("left",t),e.left>o&&e.set("left",o)}function re(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:T(n,e.top)}`,`时间 ${M(e.left).slice(-5)}`],C.show=!0}function le(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=G(t.key,t.range,e.value);return[o,n<H?H:n>W?W:n]}}function se(e,t){return e+1>t[1]?t[0]:e+1}return u(x,b),function(){const t=new e.Rect({...z,width:q-D-J-1,height:W-1,left:D,top:0,fill:"transparent"});x.value.add(t)}(),function(){function t(t,o="left"){let r="left"===o?D:B;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),G=S.length;S.forEach(((e,o)=>{const{lineXMain:n,lineXSub:i,textLeft:l}=d(m,r,c),s=W-o*$*k,a=0===o?W-8:o!==S.length-1||H||Q&&"FHR"!==v?s:H+8;!w||(0===o||o===G-1)&&!b||j.push(f(String(e),t,l,a)),C.push(...p(t,o,n,i,s,$,H,G))}));const M=new e.Rect({...a,strokeWidth:.5,width:c,height:W,left:P,top:W/2}),T=n([P,H>0?H-$/2:$/2],{value:String(h),...i,...g}),Y=new e.Group([...C,...j,M,...T?[T]:[]],{objectCaching:!1,...s});x.value.add(Y),Y.sendToBack(),r+=c}))}t(N),t(R,"right")}(),function(){const{show:t,startTime:o,range:r=[0,23],position:l="top",style:a}=X.time,{show:u,range:c=[0,23],position:d,style:f}=X.processTime;if(t||u){const p=[],h=[],g=[],v=[],m=I+O/2,y=$/2;for(let e=0;e<A.mainXCell;e++){if(t){const t=0===e?+o.slice(11,13):se(p.at(-1),r);p.push(t);const s="top"===l?H-y:W+y;g.push(n([m+e*O,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:Z-y;v.push(n([m+e*O,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(U),n=[],i={},r=_.find((e=>"cervix"===e.key&&e.show)),l=null==(e=null==r?void 0:r.data)?void 0:e.find((e=>3==+e.value));function s(e,t){const{key:o,range:n}=r||{},i=G(o,n,10),l=[0,t],s=[-t/e,0],a=[(W-i-t)/e,W-i],u=[B-I,e*(B-I)+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>=I&&o<=B&&n>=i&&n<=W}function h([e,t]){return[I+e,W-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}=_.find((e=>e.key===o));if(r){const r=G(o,i,0);n.push(t([I,r,B,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)-I,W-G(o,a,l.value)],[p,h]=[S(c.time)-I,W-G(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)}(),te(),function(){function e(e,t){const o=_.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>=I&&o<=B&&n>=H&&n<=W&&(P.point={x:o,y:n},P.show=!0,t.target?(P.target=t.target,P.list=["删除节点"],x.value.forEachObject((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&P.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(P.target=null,P.list=["新增节点"],_.filter((e=>e.show)).forEach((i=>{if(!Y(o,"key",O).includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&n<Q)return;P.list.push(e(i,t.pointer))}})),1===P.list.length&&(P.show=!1,E("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=q-J/2;function t(e,t){if(!e.length)return;let n=H;const i=[];e.forEach((e=>{const o=e.title.split("").join("\n"),r=F.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)?(ie(u),re(u)):C.show=!1})),u.on("mouseup:before",(e=>{if(C.show=!1,0===e.e.button&&L(u))if(Y(u.left,"key",O).includes(u.origin.key))E("repeat");else{const e={data:{time:M(u.left),value:T(u.origin.key,u.top)},...u.origin};j("add",e),oe(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=(W-H)/2,n=(t.height+t.top-H)/2;e.forEach((e=>{const t=e.top+o-n;e.set({top:t,originTop:t})}))}t(N,D/2),t(R,e)}(),{clickMenu:function({item:e,target:t}){const o={...e.origin};"remove"===e.mode?(j("remove",o),oe(o,"remove")):(Object.assign(o,{data:{time:M(e.pointer.x),value:T(e.origin.key,e.pointer.y)}}),j("add",o),oe(o))},redrawPoints:ne}}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"@vueuse/core";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";function x(x,b,j,C,P){const{cumputedX:S,cumputedY:G,getXValue:M,getYValue:T}=c(b),{getEqualXTypes:Y,handleAddPrevent:E,isGridLimit:L}=h(x,j,b),{xAxis:X,grid:A,originX:I,originY:H,xCellWidth:W,endY:O,startTime:V,leftAddAreaWidth:D,leftScales:N,rightScales:R,yCellHeight:$,endX:B,scaleValues:F,canvasWidth:q,borderStyle:z,rightAddAreaWidth:J,event:K,originYCervix:Q,other:U,canvasHeight:Z}=b,_=k(F),ee=new Set;function te(){_.filter((e=>e.show)).forEach(((e,l)=>{var s;const a=[],u=[],c=[];null==(s=e.data)||s.forEach(((s,d)=>{!function(s,d,f){let p,h;const{pointAttr:g={},lineAttr:v={},title:m="",key:y,type:k="circle",childbirthStyle:w={}}=e,P=e.data[f+1],S=le(P,e);if(s&&S&&!d.breakpoint)h=t([...s,...S],{...v});else if(s&&!S&&!d.breakpoint){const o=le(P,e);h=o?t([...s,...o],{...v}):null}let G,Y;if(d.childbirth){const e=s[1]+$;G=o([s[0],s[1],e],w),c.push(G),Y=n([s[0]+W/2,e-$/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(Y)}const E=u[f-1],L={origin:{data:d,title:m,key:y||"",dataIndex:l,index:f},leftLine:E,rightLine:h,arrowGroup:G,arrowGroupText:Y,...g,...b.event.hovered?b.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:b.event};E?p=r(k,{left:E.get("x2"),top:E.get("y2"),...L}):s&&(L.leftLine=null,p=r(k,{left:s[0],top:s[1],...L}));u.push(h),p&&(!function(e){K.hovered&&(e.on("mouseover",(()=>{re(e,"hover")})),e.on("mouseout",(()=>{C.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ie(e),function(e){var t,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+W/2,top:e.top+$/2})}(e),K.hovered&&re(e)})),e.on("mouseup",(t=>{if(C.show=!1,1===t.button){const{key:t}=e.origin,o={...e.origin,data:{...e.origin.data,time:M(e.left),value:T(t,e.top)}};x.value.discardActiveObject(),j("change",o),oe(o,"change")}}))}(p),a.push(p),ee.add(p))}(le(s,e),s,d)})),Promise.all(a).then((e=>{const t=u.filter((e=>e));let o=null;e=e.filter((e=>(e&&o&&(o.nextPoint=e,e.prevPoint=o),o=e||o,e))),Promise.all(c).then((o=>{x.value.add(...t,...e,...o),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function oe(e,t="add"){const{dataIndex:o,data:n,index:i,key:r}=e,l=_.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=n;break;default:{const e=g(n.time,l.data);l.data.splice(e,0,n);break}}ne()}function ne(){var e;ee.size&&(null==(e=x.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),(null==e?void 0:e.arrowGroup)&&t.push(null==e?void 0:e.arrowGroup),(null==e?void 0:e.arrowGroupText)&&t.push(null==e?void 0:e.arrowGroupText)})),t}([...ee]))),ee.clear(),te()}function ie(e){const t=e.prevPoint?e.prevPoint.left:I,o=e.nextPoint?e.nextPoint.left:B;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<Q&&e.set("top",Q),e.top<H&&e.set("top",H),e.top>O&&e.set("top",O),e.left<t&&e.set("left",t),e.left>o&&e.set("left",o)}function re(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:T(n,e.top)}`,`时间 ${M(e.left).slice(-5)}`],C.show=!0}function le(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=G(t.key,t.range,e.value);return[o,n<H?H:n>O?O:n]}}function se(e,t){return e+1>t[1]?t[0]:e+1}return u(x,b),function(){const t=new e.Rect({...z,width:q-D-J-1,height:O-1,left:D,top:0,fill:"transparent"});x.value.add(t)}(),function(){function t(t,o="left"){let r="left"===o?D:B;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),G=S.length;S.forEach(((e,o)=>{const{lineXMain:n,lineXSub:i,textLeft:l}=d(m,r,c),s=O-o*$*k,a=0===o?O-8:o!==S.length-1||H||Q&&"FHR"!==v?s:H+8;!w||(0===o||o===G-1)&&!b||j.push(f(String(e),t,l,a)),C.push(...p(t,o,n,i,s,$,H,G))}));const M=new e.Rect({...a,strokeWidth:.5,width:c,height:O,left:P,top:O/2}),T=n([P,H>0?H-$/2:$/2],{value:String(h),...i,...g}),Y=new e.Group([...C,...j,M,...T?[T]:[]],{objectCaching:!1,...s});x.value.add(Y),Y.sendToBack(),r+=c}))}t(N),t(R,"right")}(),function(){const{show:t,startTime:o,range:r=[0,23],position:l="top",style:a}=X.time,{show:u,range:c=[0,23],position:d,style:f}=X.processTime;if(t||u){const p=[],h=[],g=[],v=[],m=I+W/2,y=$/2;for(let e=0;e<A.mainXCell;e++){if(t){const t=0===e?+o.slice(11,13):se(p.at(-1),r);p.push(t);const s="top"===l?H-y:O+y;g.push(n([m+e*W,s],{value:String(t),...i,...a||{}}))}if(u){const t=0===e?c[0]:h.at(-1)+1;h.push(t);const o="top"===d?y:Z-y;v.push(n([m+e*W,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(U),n=[],i={},r=_.find((e=>"cervix"===e.key&&e.show)),l=null==(e=null==r?void 0:r.data)?void 0:e.find((e=>3==+e.value));function s(e,t){const{key:o,range:n}=r||{},i=G(o,n,10),l=[0,t],s=[-t/e,0],a=[(O-i-t)/e,O-i],u=[B-I,e*(B-I)+t];let c=[],d=[];function f([o,n]){return Math.abs(n-e*o-t)<=1}function p([e,t]){const[o,n]=[...h([e,t])];return o>=I&&o<=B&&n>=i&&n<=O}function h([e,t]){return[I+e,O-t]}return f(l)&&p(l)&&(c=h(l)),f(s)&&p(s)&&(c=h(s)),f(a)&&p(a)&&(d=h(a)),f(u)&&p(u)&&(d=h(u)),[...c,...d]}o.forEach((e=>{if(!e.show)return;const{key:o}=e;switch(o){case"fetalPresentation":{const{range:i,show:r}=_.find((e=>e.key===o));if(r){const r=G(o,i,0);n.push(t([I,r,B,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)-I,O-G(o,a,l.value)],[p,h]=[S(c.time)-I,O-G(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)}(),te(),function(){function e(e,t){const o=_.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>=I&&o<=B&&n>=H&&n<=O&&(P.point={x:o,y:n},P.show=!0,t.target?(P.target=t.target,P.list=["删除节点"],[...ee].forEach((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&P.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(P.target=null,P.list=["新增节点"],_.filter((e=>e.show)).forEach((i=>{if(!Y([...ee],o,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&n<Q)return;P.list.push(e(i,t.pointer))}})),1===P.list.length&&(P.show=!1,E("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=q-J/2;function t(e,t){if(!e.length)return;let n=H;const i=[];e.forEach((e=>{const o=e.title.split("").join("\n"),r=F.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)?(ie(u),re(u)):C.show=!1})),u.on("mouseup:before",(e=>{if(C.show=!1,0===e.e.button&&L(u))if(Y([...ee],u.left,"key").includes(u.origin.key))E("repeat");else{const e={data:{time:M(u.left),value:T(u.origin.key,u.top)},...u.origin};j("add",e),oe(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-H)/2,n=(t.height+t.top-H)/2;e.forEach((e=>{const t=e.top+o-n;e.set({top:t,originTop:t})}))}t(N,D/2),t(R,e)}(),{clickMenu:function({item:e,target:t}){const o={...e.origin};"remove"===e.mode?(j("remove",o),oe(o,"remove")):(Object.assign(o,{data:{time:M(e.pointer.x),value:T(e.origin.key,e.pointer.y)}}),j("add",o),oe(o))},redrawPoints:ne}}export{x as useBirthProcess};
@@ -2,4 +2,10 @@ import { type Ref } from 'vue';
2
2
  import { fabric } from '../../../../../../es/shared/utils/fabricjs';
3
3
  import { AnyObject } from '../../../../../../es/shared/types';
4
4
  import { IPointTipProps, IPointMenuProps } from '../../../../../../es/components/fabric-chart/src/interface';
5
- export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: Function, pointTipProps: IPointTipProps, pointMenuProps: IPointMenuProps): void;
5
+ export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: Function, pointTipProps: IPointTipProps, pointMenuProps: IPointMenuProps): {
6
+ redrawPoints: (ItemObj?: AnyObject) => void;
7
+ clickMenu: ({ item, target }: {
8
+ item: any;
9
+ target: any;
10
+ }) => void;
11
+ };
@@ -1 +1 @@
1
- import{drawLine as e,drawPoint as t}from"../useDraw.js";import{useGrid as n}from"../useGrid.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import"@vueuse/core";import"../../../../../shared/utils/fabricjs/index.js";import"vue";import{getIndex as i,isEffectiveNode as l,getTime as r}from"../../utils/index.js";import{cloneDeep as s}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";function a(a,f,u,p,c){const{cumputedX:d,cumputedY:v,getXValue:m,getYValue:h}=o(f),{xCellWidth:g,yCellHeight:L,originX:y,endX:x,originY:k,endY:P,event:A,scaleValues:b,xAxis:j,startTime:w,timeXCell:C}=f,X=new Set,E=new Set,Y=s(b);let M=[];function S(n,o,i){var l;const{type:r,unit:s,dataList:c=[]}=i,d=[],v=[];null==(l=n.list)||l.forEach(((l,c)=>{!function(n,l,c,L){let b,j;const{pointAttr:w={},lineAttr:Y={},title:S="",key:O,type:D="circle"}=L,I=z(L.list[c+1],i);n&&I&&!l.breakpoint&&n[0]!==I[0]&&(j=e([...n,...I],Y));const J=v[c-1],N={origin:{data:l,title:S,key:O||"",unit:s,type:r,dataIndex:o,index:c,lineAttr:Y},leftLine:J,rightLine:j,...w,...f.event.hovered?f.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:f.event};J?b=t(D,{left:J.get("x2"),top:J.get("y2"),...N}):n&&(N.leftLine=null,b=t(D,{left:n[0],top:n[1],...N}));v.push(j),b&&(b.originLeft=b.left,b.originTop=b.top,function(e){A.hovered&&(e.on("mouseover",(()=>{V(e,"hover")})),e.on("mouseout",(()=>{p.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t=6e4/C,n=e.prevPoint?e.prevPoint.left+t:y,o=e.nextPoint?e.nextPoint.left-t:x;e.top<k&&e.set("top",k),e.top>P&&e.set("top",P),e.left<n&&e.set("left",n),e.left>o&&e.set("left",o)}(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),A.hovered&&V(e),function(e){const{originLeft:t,originTop:n,left:o,top:i,origin:l}=e,r=~~((o-t)/g);if(o>t+g&&!e.nextPoint){if(0===M.length){$(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[t,n],t,n]),e.leftLine&&e.leftLine.set({stroke:"transparent"})}const o=t+g*r;if(M.every((e=>e.left!==o))){const t=m(o),n=h(l.type,i);M.push({data:{time:t,value:n},left:o,top:i}),$(e,[...e.prevPointer,o,i])}M.length<r&&function(e,t){const{originLeft:n,originTop:o,origin:i}=e;let l=1;for(;l<=t;){const t=n+g*l,r=M.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=M.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const s=JSON.parse(JSON.stringify(r)),a=M[l-1]||{left:n,top:o},f=~~((r.left-(t-g))/g),u=(r.top-a.top)/f;s.top=a.top+u,s.left=t,s.data={time:m(t),value:h(i.type,s.top)},M.splice(l,0,s),$(e,[a.left,a.top,s.left,s.top])}}l++}}(e,r)}if(M.length>0&&o<M[M.length-1].left){for(const e of E)e.left>o&&(e.leftLine&&a.value.remove(e.leftLine),a.value.remove(e));if(M=M.filter((e=>e.left<=o)),0===M.length){e.leftLine&&e.leftLine.set(e.origin.lineAttr);for(const e of E)e.leftLine&&a.value.remove(e.leftLine),a.value.remove(e)}if(M.length>0){const t=M.at(-1);e.prevPointer=[t.left,t.top]}}}(e)})),e.on("mouseup",(t=>{if(p.show=!1,1===t.button){const{key:t,type:n}=e.origin,o={...e.origin,data:{...e.origin.data,time:m(e.left),value:h(n,e.top)}};a.value.discardActiveObject(),M.length>0?(o.data=M.map((e=>e.data)),u("add",o),T(o,"add")):(u("change",o),T(o,"change"))}}))}(b),d.push(b),X.add(b))}(z(l,i),l,c,n)})),Promise.all(d).then((e=>{const t=v.filter((e=>e));let n=null;e=e.map((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),a.value.add(...t,...e)}))}function $(t,n){const[o,i,l,r]=n;t.clone((o=>{o.set({left:l,top:r}),t.prevPointer=[l,r];const i=e(n,t.origin.lineAttr);o.leftLine=i,E.add(o),a.value.add(i,o)}))}function T(e,t="add"){const{dataIndex:n,data:o,index:l,key:r,type:s}=e,f=Y.find((e=>e.type===s)).dataList.find((e=>e.key===r));switch(t){case"remove":f.list.splice(l,1);break;case"change":f.list[l]=o;break;default:{const e=Array.isArray(o)?o[0].time:o.time,t=i(e,f.list),n=Array.isArray(o)?o:[o];f.list.splice(t,0,...n);break}}var u,p;X.size&&(null==(u=a.value)||u.remove(...O([...X]))),E.size&&(null==(p=a.value)||p.remove(...O([...E]))),X.clear(),E.clear(),M=[],Y.forEach((e=>{e.dataList.forEach(((t,n)=>{S(t,n,e)}))}))}function O(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 V(e,t="moving"){const{title:n,type:o,data:i,unit:l}=e.origin;p.point={x:e.left,y:e.top};const r=`${"hover"===t?i.value:h(o,e.top)}`;p.list=[`${n} ${r}${l||""}`,`时间 ${m(e.left).slice(-5)}`],p.show=!0}function z(e,t){if(l(e)&&function(e){const t=Date.parse(j.list.at(-1)),n=r(e);return n>=w&&n<=t}(e.time)){const n=d(e.time),o=v(t.type,t.range,e.value);return[n,o<k?k:o>P?P:o]}}n(a,f),Y.forEach((e=>{e.dataList.forEach(((t,n)=>{S(t,n,e)}))}))}export{a as useCenter};
1
+ import{drawLine as e,drawPoint as t}from"../useDraw.js";import{useGrid as n}from"../useGrid.js";import{useBirthProcessCumputedPoint as i}from"../useCumputedPoint.js";import"@vueuse/core";import"../../../../../shared/utils/fabricjs/index.js";import{useCommon as o}from"../useCommon.js";import"vue";import{getIndex as l,isEffectiveNode as r,getTime as a}from"../../utils/index.js";import{cloneDeep as s}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";function f(f,u,p,c,d){const{cumputedX:v,cumputedY:m,getXValue:g,getYValue:h}=i(u),{xCellWidth:y,yCellHeight:L,originX:x,endX:k,originY:P,endY:b,event:A,scaleValues:w,xAxis:j,startTime:C,timeXCell:I,itemList:X}=u,E=new Map,M=new Set,T=s(w);let Y=[];n(f,u);const{getEqualXTypes:V,handleAddPrevent:$}=o(f,p,u);function O(){T.forEach((e=>{e.dataList.forEach(((t,n)=>{S(t,n,e)}))})),function(){if(!A.evented)return;f.value.on("mouse:up",(e=>{if(3===e.button){const{x:t=0,y:n=0}=e.pointer||{};t>=x&&t<=k&&n>=P&&n<=b&&(d.point={x:t,y:n},d.show=!0,e.target?(d.target=e.target,d.list=["删除节点"],H().forEach((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&d.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(d.target=null,d.list=["新增节点"],X.forEach((n=>{V(H(),t,"key").includes(n.key)||d.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key},pointer:e.pointer})})),1===d.list.length&&(d.show=!1,$("repeat"),console.log("当前时间段内无可新增节点"))))}}))}()}function S(n,i,o){var l;const{type:r,unit:a,dataList:s=[]}=o,d=[];E.set(n.key,[]),null==(l=n.list)||l.forEach(((l,s)=>{!function(n,l,s,v){var m;let L,w;const{pointAttr:j={},lineAttr:C={},title:X="",key:T,type:V="circle"}=v,$=G(v.list[s+1],o);n&&$&&!l.breakpoint&&n[0]!==$[0]&&(w=e([...n,...$],C));const O=d[s-1],S={origin:{data:l,title:X,key:T||"",unit:a,type:r,dataIndex:i,index:s,lineAttr:C},leftLine:O,rightLine:w,...j,...u.event.hovered?u.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:u.event};O?L=t(V,{left:O.get("x2"),top:O.get("y2"),...S}):n&&(S.leftLine=null,L=t(V,{left:n[0],top:n[1],...S}));d.push(w),L&&(L.originLeft=L.left,L.originTop=L.top,function(e){A.hovered&&(e.on("mouseover",(()=>{q(e,"hover")})),e.on("mouseout",(()=>{c.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t=6e4/I,n=e.prevPoint?e.prevPoint.left+t:x,i=e.nextPoint?e.nextPoint.left-t:k;e.top<P&&e.set("top",P),e.top>b&&e.set("top",b),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}(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),A.hovered&&q(e),function(e){const{originLeft:t,originTop:n,left:i,top:o,origin:l}=e,r=~~((i-t)/y);if(i>t+y&&!e.nextPoint){if(0===Y.length){z(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[t,n],t,n]),e.leftLine&&e.leftLine.set({stroke:"transparent"})}const i=t+y*r;if(Y.every((e=>e.left!==i))){const t=g(i),n=h(l.type,o);Y.push({data:{time:t,value:n},left:i,top:o}),z(e,[...e.prevPointer,i,o])}Y.length<r&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+y*l,r=Y.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=Y.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=Y[l-1]||{left:n,top:i},f=~~((r.left-(t-y))/y),u=(r.top-s.top)/f;a.top=s.top+u,a.left=t,a.data={time:g(t),value:h(o.type,a.top)},Y.splice(l,0,a),z(e,[s.left,s.top,a.left,a.top])}}l++}}(e,r)}if(Y.length>0&&i<Y[Y.length-1].left){for(const e of M)e.left>i&&(e.leftLine&&f.value.remove(e.leftLine),f.value.remove(e));if(Y=Y.filter((e=>e.left<=i)),0===Y.length){e.leftLine&&e.leftLine.set(e.origin.lineAttr);for(const e of M)e.leftLine&&f.value.remove(e.leftLine),f.value.remove(e)}if(Y.length>0){const t=Y.at(-1);e.prevPointer=[t.left,t.top]}}}(e)})),e.on("mouseup",(t=>{if(c.show=!1,1===t.button){const{key:t,type:n}=e.origin,i={...e.origin,data:{...e.origin.data,time:g(e.left),value:h(n,e.top)}};if(f.value.discardActiveObject(),Y.length>0){const e=Y.map((e=>e.data));p("add",{...i,data:e}),D({...i,data:e})}else p("change",i),D(i,"change")}}))}(L),null==(m=E.get(T))||m.push(L))}(G(l,o),l,s,n)})),Promise.all(E.get(n.key)).then((e=>{const t=d.filter((e=>e));let n=null;e=e.map((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),f.value.add(...t,...e)}))}function z(t,n){const[i,o,l,r]=n;t.clone((i=>{i.set({left:l,top:r}),t.prevPointer=[l,r];const o=e(n,t.origin.lineAttr);i.leftLine=o,M.add(i),f.value.add(o,i)}))}function D(e,t="add"){const{dataIndex:n,data:i,index:o,key:r,type:a}=e,s=T.find((e=>e.type===a)),f=s.dataList.find((e=>e.key===r));switch(t){case"remove":f.list.splice(o,1);break;case"change":f.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=l(e,f.list),n=Array.isArray(i)?i:[i];f.list.splice(t,0,...n);break}}J({dataIndex:n,scaleValue:s})}function J(e){var t,n,i;if(M.size&&(null==(t=f.value)||t.remove(...N([...M]))),M.clear(),Y=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=f.value)||n.remove(...N(E.get(o.key))),E.delete(o.key),S(o,t,i)}else E.size&&(null==(i=f.value)||i.remove(...N(H()))),E.clear(),O()}function N(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine)})),t}function q(e,t="moving"){const{title:n,type:i,data:o,unit:l}=e.origin;c.point={x:e.left,y:e.top};const r=`${"hover"===t?o.value:h(i,e.top)}`;c.list=[`${n} ${r}${l||""}`,`时间 ${g(e.left).slice(-5)}`],c.show=!0}function G(e,t){if(r(e)&&function(e){const t=Date.parse(j.list.at(-1)),n=a(e);return n>=C&&n<=t}(e.time)){const n=v(e.time),i=m(t.type,t.range,e.value);return[n,i<P?P:i>b?b:i]}}function H(){return Array.from(E.values()).flat()}return O(),{redrawPoints:J,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(p("remove",n),D(n,"remove")):(Object.assign(n,{data:{time:g(e.pointer.x),value:h(e.origin.type,e.pointer.y)}}),p("add",n),D(n))}}}export{f as useCenter};
@@ -1,4 +1,5 @@
1
1
  import { Ref } from 'vue';
2
2
  import { fabric } from '../../../../../../es/shared/utils/fabricjs';
3
+ import { IPointTipProps } from '../../../../../../es/components/fabric-chart/src/interface';
3
4
  import { AnyObject } from '../../../../../../es/shared/types';
4
- export declare function useOther(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: Function): void;
5
+ export declare function useOther(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: Function, pointTipProps: IPointTipProps): void;
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as o,drawText as e}from"../useDraw.js";import{useBirthProcessCumputedPoint as r}from"../useCumputedPoint.js";import"@vueuse/core";import"vue";import"lodash-es";import"date-fns";import"../temperature/useShadow.js";function i(i,n,l){const{cumputedX:a}=r(n),{other:u,yCellHeight:c,endX:s,originX:f,originY:d}=n;function m(t){return t>=f&&t<=s}!function(){if(!(null==u?void 0:u.horizontal))return;const{horizontal:r}=u,n=f-5;let l=d+c/2;r.forEach((r=>{const{title:u,titleStyle:s={},type:f,pointAttr:d={},textStyle:p={},data:h}=r,v=u&&o(u,{...s,originX:"right",left:n,top:l});i.value.add(v),h.forEach((r=>{const{time:n,value:u}=r,c=a(n);if(!m(c))return;const s=o(f,{...d,left:c,top:l}),h=c+s.width/2+2,v=e([h,l],{value:u,...p,originX:"left"}),g=new t.Group([s,v],{lockMovementX:!0,lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer"});i.value.add(g)})),l+=c}))}(),function(){if(!(null==u?void 0:u.vertical))return;const{vertical:t}=u;t.forEach((t=>{const{textStyle:e={},data:r,time:n}=t,l=a(n);if(!m(l))return;let u=d+c/2;r.forEach((t=>{const r=o(String(t),{...e,lockMovementX:!0,lockMovementY:!0,left:l,originX:"left",top:u});u+=c,i.value.add(r)}))}))}()}export{i as useOther};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as o,drawText as e}from"../useDraw.js";import{useBirthProcessCumputedPoint as i}from"../useCumputedPoint.js";import"@vueuse/core";import"vue";import"lodash-es";import"date-fns";import"../temperature/useShadow.js";function n(n,r,l,s){const{cumputedX:a,getXValue:u}=i(r),{other:c,yCellHeight:f,endX:m,originX:d,originY:h,endY:v,markHeight:p,event:g}=r;function x(t){const{name:o}=t.origin;s.point={x:t.left,y:t.top},s.list=[`${o}`,`时间 ${u(t.left).slice(-5)}`],s.show=!0}function X(t){return t>=d&&t<=m}!function(){if(!(null==c?void 0:c.horizontal))return;const{horizontal:i}=c,r=d-5;let l=h+f/2;i.forEach((i=>{const{title:s,titleStyle:u={},type:c,pointAttr:m={},textStyle:d={},data:h}=i,v=s&&o(s,{...u,originX:"right",left:r,top:l});n.value.add(v),h.forEach((i=>{const{time:r,value:s}=i,u=a(r);if(!X(u))return;const f=o(c,{...m,left:u,top:l}),h=u+f.width/2+2,v=e([h,l],{value:s,...d,originX:"left"}),p=new t.Group([f,v],{lockMovementX:!0,lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer"});n.value.add(p)})),l+=f}))}(),function(){if(!(null==c?void 0:c.vertical))return;const{vertical:t}=c;t.forEach((t=>{const{textStyle:e={},data:i,time:r}=t,l=a(r);if(!X(l))return;let s=h+f/2;i.forEach((t=>{const i=o(String(t),{...e,lockMovementX:!0,lockMovementY:!0,left:l,originX:"left",top:s});s+=f,n.value.add(i)}))}))}(),function(){if(!(null==c?void 0:c.mark)||!p)return;const{title:t,titleStyle:i,pointAttr:r,dataList:f}=c.mark,S=e([d-5,v+p/2],{value:t,...i,originX:"right"});n.value.add(S);const k=v+p,P=[];f.forEach((t=>{const{time:e,list:i=[]}=t,c=a(e);if(!X(c))return;let f=v;i.forEach((t=>{let e=!1;const i=o("circleAndText",{...r,text:t.text,left:c,top:f,origin:t}),a=i.height;f+a<=k&&f>=v?(i.set("top",f+a/2),f+=a):(e||(f=v,e=!0),i.set("top",f-a/2),f-=a),P.push(i),function(t){g.hovered&&(t.on("mouseover",(()=>{x(t)})),t.on("mouseout",(()=>{s.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;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.top<h&&t.set("top",h);const o=v+p-t.height/2;t.top>o&&t.set("top",o)}(t),g.hovered&&x(t)})),t.on("mouseup",(o=>{if(s.show=!1,1===o.button){!function(t){var o;if((null==(o=t.origin)?void 0:o.isStart)&&t.otherPoints)t.otherPoints.forEach((o=>{o.limitX.x1=t.left}));else{const o=t.startPoint.otherPoints.map((t=>t.left));console.log(o);const e=Math.min(...o);console.log(e,t.startPoint),t.startPoint.limitX.x2=e}}(t);const o={type:"mark",time:u(t.left),data:t.origin};n.value.discardActiveObject(),l("change",o)}}))}(i),n.value.add(i)}))})),function(t){const o=t.find((t=>{var o;return null==(o=t.origin)?void 0:o.isStart})),e=t.find((t=>{var e;return!(null==(e=t.origin)?void 0:e.isStart)&&t.left>o.left})),i=t.filter((t=>{var o;return!(null==(o=t.origin)?void 0:o.isStart)}));t.forEach((t=>{var n;const r={x1:d,x2:m};(null==(n=t.origin)?void 0:n.isStart)?(r.x2=e.left,t.otherPoints=i):(r.x1=o.left,t.startPoint=o),t.limitX=r}))}(P)}()}export{n as useOther};
@@ -1 +1 @@
1
- import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as n}from"date-fns";import{getChildrenSize as s}from"../../utils/index.js";import"@vueuse/core";import{cloneDeep as o,range as d}from"lodash-es";import"../temperature/useShadow.js";import{useTop as c}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useCenter as m}from"./useCenter.js";import{useOther as h}from"./useOther.js";function v(v,f,g,x,y,w){const b=e(),Y=e(),j=e(),C=t((()=>f.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),H=t((()=>{var e;return null!=(e=f.data.left.width)?e:0})),A=t((()=>{const{grid:e}=f.data;return e.mainXCell*e.subXCell})),D=t((()=>{const{grid:e}=f.data;return e.mainYCell*e.subYCell})),T=t((()=>s(f.data.top.treeData))),X=t((()=>f.data.top.tree.cellHeight)),V=t((()=>X.value*T.value)),G=t((()=>Z(R("drug")||"top"))),M=t((()=>G.value+V.value)),S=t((()=>{var e;return Date.parse((null==(e=f.data.xAxis)?void 0:e.startTime)||n(new Date,"yyyy-MM-dd HH:mm:ss"))})),N=t((()=>{const e=o(f.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=d(A.value/t+1).map((r=>0===r?e.startTime:n(new Date(S.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:H.value}})),O=function(){const e=o(f.data.top.treeData);let t=0;const{cellWidth:a,cellHeight:r}=f.data.top.tree;return function e(i,l=0){i.forEach((i=>{var u;const n={top:t*r+G.value,left:l*a,width:a,height:r};if(t++,null==(u=i.children)?void 0:u.length){t--;const a=s(i.children);n.height=a*r,e(i.children,l+1)}else n.width=H.value-n.left;Object.assign(i,n)}))}(e),e}(),k=t((()=>Z(R("xAxis")||"center"))),L=t((()=>{var e;const{width:t,right:a}=f.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),W=t((()=>Z(R("intraoperatively")||"bottom"))),E=t((()=>{var e;const{show:t=!0,height:a}=(null==(e=f.data.other)?void 0:e.mark)||{};return t&&a?a:0})),I=t((()=>W.value+(f.data.height-V.value-N.value.height-E.value))),P=t((()=>(L.value-H.value)/A.value)),q=t((()=>(I.value-W.value)/D.value)),z=t((()=>N.value.spaceTimeStamp/P.value)),B=t((()=>{const{scaleValues:e}=f.data;return e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))).flat()})),F=t((()=>$("pulse"))),J=t((()=>$("temperature"))),K=t((()=>{var e;return(null==(e=f.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),Q=a({canvasWidth:f.data.width,canvasHeight:f.data.height,borderStyle:{...u,...f.data.borderStyle||{}},grid:f.data.grid,top:f.data.top,left:f.data.left,other:f.data.other,topGridYNumber:r(T),topGridYCellHeight:r(X),topGridOriginY:r(G),topGridEndY:r(M),treeData:O,xAxis:r(N),originYXAxis:r(k),startTime:r(S),timeXCell:r(z),gridXNumber:r(A),gridYNumber:r(D),xCellWidth:r(P),yCellHeight:r(q),originX:r(H),endX:r(L),originY:r(W),endY:r(I),markHeight:r(E),itemList:r(B),scaleValues:f.data.scaleValues,pulseYCell:r(F),temperatureYCell:r(J),event:r(K)});function R(e){let t="";return Object.entries(C.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function U(e){const t=C.value[e],a=N.value.height;switch(t){case"drug":return V.value;case"xAxis":return a;default:return f.data.height-V.value-a}}function Z(e){switch(e){case"top":return 0;case"center":return U("top");default:return U("top")+U("center")}}function $(e){const{scaleValues:t}=f.data,a=t.find((t=>t.type===e));return q.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await l(),c(v,Q,g,y),p(v,Q),h(v,Q),m(v,Q,g,y)})),{propItems:Q,redrawPoints:Y,select:b,clickMenu:j}}export{v as useSurgicalAnesthesiaChart};
1
+ import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as n}from"date-fns";import{getChildrenSize as s}from"../../utils/index.js";import{useEvent as o}from"../useEvent.js";import{cloneDeep as d,range as c}from"lodash-es";import"../temperature/useShadow.js";import{useTop as m}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useCenter as v}from"./useCenter.js";import{useOther as h}from"./useOther.js";function f(f,g,x,y,w,b){const j=e(),Y=e(),C=e(),H=t((()=>g.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),A=t((()=>{var e;return null!=(e=g.data.left.width)?e:0})),D=t((()=>{const{grid:e}=g.data;return e.mainXCell*e.subXCell})),T=t((()=>{const{grid:e}=g.data;return e.mainYCell*e.subYCell})),X=t((()=>s(g.data.top.treeData))),M=t((()=>g.data.top.tree.cellHeight)),V=t((()=>M.value*X.value)),G=t((()=>$(U("drug")||"top"))),S=t((()=>G.value+V.value)),k=t((()=>{var e;return Date.parse((null==(e=g.data.xAxis)?void 0:e.startTime)||n(new Date,"yyyy-MM-dd HH:mm:ss"))})),N=t((()=>{const e=d(g.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=c(D.value/t+1).map((r=>0===r?e.startTime:n(new Date(k.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:A.value}})),O=function(){const e=d(g.data.top.treeData);let t=0;const{cellWidth:a,cellHeight:r}=g.data.top.tree;return function e(i,l=0){i.forEach((i=>{var u;const n={top:t*r+G.value,left:l*a,width:a,height:r};if(t++,null==(u=i.children)?void 0:u.length){t--;const a=s(i.children);n.height=a*r,e(i.children,l+1)}else n.width=A.value-n.left;Object.assign(i,n)}))}(e),e}(),E=t((()=>$(U("xAxis")||"center"))),L=t((()=>{var e;const{width:t,right:a}=g.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),W=t((()=>$(U("intraoperatively")||"bottom"))),I=t((()=>{var e;const{show:t=!0,height:a}=(null==(e=g.data.other)?void 0:e.mark)||{};return t&&a?a:0})),P=t((()=>W.value+(g.data.height-V.value-N.value.height-I.value))),q=t((()=>(L.value-A.value)/D.value)),z=t((()=>(P.value-W.value)/T.value)),B=t((()=>N.value.spaceTimeStamp/q.value)),F=t((()=>{const{scaleValues:e}=g.data;return e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))).flat()})),J=t((()=>_("pulse"))),K=t((()=>_("temperature"))),Q=t((()=>{var e;return(null==(e=g.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),R=a({canvasWidth:g.data.width,canvasHeight:g.data.height,borderStyle:{...u,...g.data.borderStyle||{}},grid:g.data.grid,top:g.data.top,left:g.data.left,other:g.data.other,topGridYNumber:r(X),topGridYCellHeight:r(M),topGridOriginY:r(G),topGridEndY:r(S),treeData:O,xAxis:r(N),originYXAxis:r(E),startTime:r(k),timeXCell:r(B),gridXNumber:r(D),gridYNumber:r(T),xCellWidth:r(q),yCellHeight:r(z),originX:r(A),endX:r(L),originY:r(W),endY:r(P),markHeight:r(I),itemList:r(F),scaleValues:g.data.scaleValues,pulseYCell:r(J),temperatureYCell:r(K),event:r(Q)});function U(e){let t="";return Object.entries(H.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function Z(e){const t=H.value[e],a=N.value.height;switch(t){case"drug":return V.value;case"xAxis":return a;default:return g.data.height-V.value-a}}function $(e){switch(e){case"top":return 0;case"center":return Z("top");default:return Z("top")+Z("center")}}function _(e){const{scaleValues:t}=g.data,a=t.find((t=>t.type===e));return z.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await l(),m(f,R,x,w),p(f,R),h(f,R,x,w);const{redrawPoints:e,clickMenu:t}=v(f,R,x,w,b);Y.value=e,C.value=t,o(y.value)})),{propItems:R,redrawPoints:Y,select:j,clickMenu:C}}export{f as useSurgicalAnesthesiaChart};
@@ -1,6 +1,6 @@
1
1
  import { type Ref } from 'vue';
2
2
  import { fabric } from '../../../../../../es/shared/utils/fabricjs';
3
- import { IPropItems, IPointTipProps, IPointMenuProps } from '../../../../../../es/components/fabric-chart/src/interface';
3
+ import { IObject, IPropItems, IPointTipProps, IPointMenuProps } from '../../../../../../es/components/fabric-chart/src/interface';
4
4
  import { AnyObject } from '../../../../../../es/shared/types';
5
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): {
6
6
  clickMenu: ({ item, target }: {
@@ -11,4 +11,5 @@ export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: IPropIt
11
11
  isAddPoint: (x: number) => boolean;
12
12
  updateData: (params: AnyObject, mode?: string) => void;
13
13
  redrawPoints: () => void;
14
+ gridPoints: Set<IObject>;
14
15
  };
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as d,isValidValue as c,setOtherType as p,isEffectiveNode as f,getTime as h,getIndex as v,deleteProperty as g}from"../../utils/index.js";import"@vueuse/core";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as w}from"../../constants/index.js";function j(j,k,Y,S,E,$,M,O,P,A){r(j,k);const{getEqualXTypes:I,handleAddPrevent:T}=y(j,Y,k),{createShadowLines:C}=t(),{left:R,xScaleList:X,xCellWidth:F,yCellHeight:z,originX:D,endX:V,originY:_,endY:G,itemList:H,event:q,vitalSignsOriginY:W,painOriginY:B,hospitalizationDate:J,config:K,canvasHeight:N}=k,Q=new Set,U=["xinmai","mai"],Z=new Map,ee=new Set,te=new Set,ie=new Set,ne=m(R.yScaleValue);function oe(t){var i;const o=ne.find((e=>"pulse"===e.type));if(o&&(null==(i=o.dataList)?void 0:i.length)&&(Q.size&&j.value.remove(...Q),Q.clear(),Z.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=Z.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}(function(){const e=[],t=[],i=[];for(const e of Z)t.push(e[1]),e[0]===U[0]&&e[1].forEach((e=>{(Z.get(U[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),a=n[i],u=o[r],d=n[i-1],c=n[i+1],p=o[r-1],f=o[r+1];if(d&&p){if(d[0]!==p[0]){const e=Math.max(d[0],p[0]);l.push([d,p].find((t=>t[0]===e)))}}else d?l.push(d):p&&s.push(p);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const v=Math.max(a[1],u[1]);s.push([a,u].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(c&&f){if(c[0]!==f[0]){const e=Math.min(c[0],f[0]);l.push([c,f].find((t=>t[0]===e))),g()}}else c?(l.push(c),g()):f?(s.push(f),g()):g()})),e})().forEach((t=>{var i,l,s,r,a,u;const d=t.map((e=>({x:e[0],y:e[1]}))),c=new e.Polygon(d,{...n,...(null==(i=o.shadow)?void 0:i.style)||{}});if("slash"==(null==(l=o.shadow)?void 0:l.mode)){c.set({fill:"transparent",stroke:(null==(r=null==(s=o.shadow)?void 0:s.style)?void 0:r.stroke)||"#f00"});const e=C(t,null==(a=o.shadow)?void 0:a.style._angle,null==(u=o.shadow)?void 0:u.style.space);e.forEach((e=>{var t;Object.assign(e,{...n,...(null==(t=o.shadow)?void 0:t.style)||{}}),Q.add(e)})),j.value.add(...e)}Q.add(c),j.value.add(c)}))}}function le(){var e;const t=ne.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},w,R.overlap||{}),l=[];ee.size&&[...ee].forEach((e=>{[...te].forEach((t=>{if(t.origin&&d(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(o(r,{...i[e]||{},...s}))}}}))})),setTimeout((()=>{j.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ie.add(e)}))}))}function se(e,t,r){var u;const{type:d,riseStyle:f={},noRiseStyle:h={},verifiedStyle:v={},reduceStyle:g={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:w=[]}=r,S=[],$=[],O=[];null==(u=e.list)||u.forEach(((u,A)=>{const I=a(d)?w.find((e=>e.key===u.key)):e,T=ue(u,r),C={};C.value=function(e,t,i){if(!(null==e?void 0:e.length)||!K.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=W.originY+z?e[1]+z:e[1]-z,s=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return O.push(s),{obj:s,top:-z}}(T,u,I),function(e,t,r,a,u){var p,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(d))return;const{lineAttr:m={}}=r,{value:x}=a;let b,w,j,k,Y,S;if(t.noRise&&h.show){const t=L(h)?E(u.type,u.list,35):e[1];if(h.text)j=l([e[0],L(h)?t:t+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),O.push(j);else{const i=t+2*z;k=s([e[0],t,i],h.style||{}),O.push(k)}}t.rise&&f.show&&f.text&&(Y=l([e[0],e[1]-(x?z:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style||{}}),O.push(Y));t.verified&&(S=l([e[0],e[1]-(x?z:0)-5],{value:"v",originX:"center",originY:"bottom",...v}),O.push(S));if(c(t.physicsReduce)||c(t.drugReduce)){const l=E(d,u.list,null!=(p=t.physicsReduce)?p:t.drugReduce);b=i([...e,e[0],l],{...m,...g.line,...n}),w=o((null==(y=null==g?void 0:g.point)?void 0:y.type)||"circle",{left:e[0],top:l,...g.point,...n,originY:l===N?"bottom":"center"}),b&&O.push(b),w&&O.push(w)}Object.assign(a,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:j,top:5,isFixed:L(h)},arrowGroup:{obj:k,top:2*z,isFixed:L(h)},riseText:{obj:Y,top:(x?-z:0)-5},verifiedText:{obj:S,top:(x?-z:0)-5},reducePoint:{obj:w,type:"reduce"}})}(T,u,I,C,r),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(d))return;let o,a;const{upArrowShow:u=!1,limitValueShow:c=!1}=i;if(u&&+t.value>180){let t=e[1]-2.5*z,i=[e[1]-z/2,t];t<W.originY&&(t=e[1]+2.5*z,i=[t,e[1]+z/2]),o=s([e[0],i[0],i[1]],m,"up"),O.push(o)}if(c){const i={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...r.list)){const t=o?e[1]+z/2+o.height:e[1]+z;a=l([e[0],t],i),O.push(a)}+t.value<Math.min(...r.list)&&(a=l([e[0],e[1]-z],i),O.push(a))}Object.assign(n,{upArrow:{obj:o},limitValue:{obj:a,top:-z}})}(T,u,I,C),function(n,l,s,a,u){let c,f;const{pointAttr:h={},lineAttr:v={},title:g="",key:m,type:x="circle"}=a,w=e.list[s+1],L=ue(w,r),E=re(d,e.list[s].value),O=L&&re(d,w.value);!n||!L||l.breakpoint||E||O||n[0]===L[0]||(f=i([...n,...L],{...v}));const A=l.pacemakerShow&&"pulse"==d?y.value:E?0:x,I=$[s-1],T={origin:{data:l,title:g,key:m||"",unit:r.unit,type:d,_type:p(g,d),dataIndex:t,index:s},leftLine:I,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==d?y.style:h,...k.event.hovered?k.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:k.event,...E?{selectable:!1,evented:!1,...b}:{}};if(I){const e=I.get("y2");c=o(A,{left:I.get("x2"),top:E?e-5:e,...T})}else n&&(T.leftLine=null,c=o(A,{left:n[0],top:E?n[1]-5:n[1],...T}));$.push(f),c&&(g.includes("脉搏")?ee.add(c):te.add(c),function(e){q.hovered&&(e.on("mouseover",(()=>{ae(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?B:W;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):!l&&(null==i||i.setCoords().set({left:e.left,top:e.top+o})))})),oe(e)}(e),q.hovered&&ae(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{type:t}=e.origin,i=M(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};j.value.discardActiveObject(),Y("change",n),ce(n,"change")}}))}(c),S.push(c),ie.add(c))}(T,u,A,I,C)})),"pulse"===d&&U.forEach((e=>{Z.set(e,S.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(S).then((e=>{const t=$.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(O).then((i=>{j.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&j.value.remove(e.leftLine),e.rightLine&&j.value.remove(e.rightLine))}}(t,e)}))}))}))}function re(e,t){return"pain"===e&&0==t}function ae(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;P.point={x:e.left,y:e.top},P.list=[function(){const{drugReduce:s,physicsReduce:r}=l||{},a="hover"===t?l.value:M(o,e.top);if(c(s))return`药物降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;if(c(r))return`物理降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||$(e.left)).slice(-5)}`],P.show=!0}function ue(e,t){const i="pain"===t.type?B:W;if(f(e)&&function(e){const[t]=X,i=X.at(-1),n=t.start,o=i.end,l=h(e);return l>=n&&l<=o}(e.time)){const n=S(e.time),o=E(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function de(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=h(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=h(`${$(e)}:00`);return J&&l<h(J)?(T("exceedMin"),!1):!(l>o)||(T("exceedMax"),!1)}function ce(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ne.find((e=>e.type===i));if("add"===t){const e=a(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=v(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;pe()}function pe(){var e;ie.size&&(null==(e=j.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...ie]))),Z.clear(),ie.clear(),ee.clear(),te.clear(),ne.forEach((e=>{e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||se(t,i,e)}))})),oe(),le()}return Z.clear(),ee.clear(),te.clear(),ne.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=E(e.type,e.list,e.positionLine.value),n=i([D,t,V,t],e.positionLine);j.value.add(n)}(e),e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||se(t,i,e)}))})),oe(),le(),k.event.evented&&j.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=D&&i<=V&&n>=_&&n<=G){A.point={x:i,y:n},A.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(A.list=[...x]),"pain"===o&&(A.list=[...b]),A.target=e.target;else{A.target=null,A.list=["新增节点"],H.forEach((t=>{if(!I(i,"_type",F).includes(t.bigType)){const i=["pain"].includes(t.bigType)?B:W;n>=i.originY&&n<=i.endY&&A.list.push({renderItem:O?O(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=de(i);t&&1!==A.list.length||(A.show=!1,1===A.list.length&&t&&T("repeat"))}}}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=g(i,[...x,...b]);s[`${e.type}`]=e.value,a(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};Y("change",r),ce(r,"change")}else{const t={data:{time:$(e.pointer.x),value:M(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};Y("add",t),ce(t)}},setPopup:ae,isAddPoint:de,updateData:ce,redrawPoints:pe}}function L(e){return"fixed"===e.position}export{j as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as c,isValidValue as p,setOtherType as d,isEffectiveNode as f,getTime as h,getIndex as g,deleteProperty as v}from"../../utils/index.js";import"@vueuse/core";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as j}from"../../constants/index.js";function L(L,w,S,Y,E,M,$,O,P,A){s(L,w);const{getEqualXTypes:I,handleAddPrevent:T}=y(L,S,w),{createShadowLines:C}=t(),{left:R,xScaleList:X,xCellWidth:F,yCellHeight:z,originX:D,endX:V,originY:_,endY:G,itemList:H,event:W,vitalSignsOriginY:q,painOriginY:B,hospitalizationDate:J,config:K,canvasHeight:N}=w,Q=new Set,U=["xinmai","mai"],Z=new Map,ee=new Set,te=new Set,ie=new Set,ne=m(R.yScaleValue);function oe(t){var o;const l=ne.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(Q.size&&L.value.remove(...Q),Q.clear(),Z.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=Z.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of Z)t.push(e[1]),e[0]===U[0]&&e[1].forEach((e=>{(Z.get(U[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],r=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),s=o.findIndex((e=>e[0]===t)),a=n[i],u=o[s],c=n[i-1],p=n[i+1],d=o[s-1],f=o[s+1];if(c&&d){if(c[0]!==d[0]){const e=Math.max(c[0],d[0]);l.push([c,d].find((t=>t[0]===e)))}}else c?l.push(c):d&&r.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const g=Math.max(a[1],u[1]);r.push([a,u].find((e=>e[1]===g)));const v=()=>{const t=[...l,...r.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],r=[]};if(p&&f){if(p[0]!==f[0]){const e=Math.min(p[0],f[0]);l.push([p,f].find((t=>t[0]===e))),v()}}else p?(l.push(p),v()):f?(r.push(f),v()):v()})),e}(),{mode:r,style:s={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...s,strokeWidth:1});if(["slash","line"].includes(r)){l.set({fill:"transparent",stroke:s.stroke||"#f00"});const e=[];if(["slash"].includes(r))e.push(...C(t,s._angle,s.space)),e.forEach((e=>{Object.assign(e,{...n,...s}),Q.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]?e[i].push(t):e[i]=[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...t.flat()],{...s,originX:"center"});e.push(n),Q.add(n)}))}L.value.add(...e)}Q.add(l),L.value.add(l)}))}}function le(){var e;const t=ne.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},j,R.overlap||{}),l=[];ee.size&&[...ee].forEach((e=>{[...te].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key;if(e){const r={left:t.left,top:t.top,...n,hoverCursor:"default"};let s="koumai";"yemai"===e&&(s=e),"humai"===e&&(s="circle"),l.push(o(s,{...i[e]||{},...r}))}}}))})),setTimeout((()=>{L.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ie.add(e)}))}))}function re(e,t,s){var u;const{type:c,riseStyle:f={},noRiseStyle:h={},verifiedStyle:g={},reduceStyle:v={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:j=[]}=s,{type:Y,textStyle:M}=b,O=[],A=[],I=[];null==(u=e.list)||u.forEach(((u,b)=>{const T=a(c)?j.find((e=>e.key===u.key)):e,C=ue(u,s),R={};R.value=function(e,t,i){if(!(null==e?void 0:e.length)||!K.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=q.originY+z?e[1]+z:e[1]-z,r=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return I.push(r),{obj:r,top:-z}}(C,u,T),function(e,t,s,a,u){var d,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(c))return;const{lineAttr:m={}}=s,{value:x}=a;let b,j,L,w,S,Y;if(t.noRise&&h.show){const t=k(h)?E(u.type,u.list,35):e[1];if(h.text)L=l([e[0],k(h)?t:t+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),I.push(L);else{const i=t+2*z;w=r([e[0],t,i],h.style||{}),I.push(w)}}t.rise&&f.show&&f.text&&(S=l([e[0],e[1]-(x?z:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style||{}}),I.push(S));t.verified&&(Y=l([e[0],e[1]-(x?z:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),I.push(Y));if(p(t.physicsReduce)||p(t.drugReduce)){const l=E(c,u.list,null!=(d=t.physicsReduce)?d:t.drugReduce);b=i([...e,e[0],l],{...m,...v.line,...n}),j=o((null==(y=null==v?void 0:v.point)?void 0:y.type)||"circle",{left:e[0],top:l,...v.point,...n,originY:l===N?"bottom":"center"}),b&&I.push(b),j&&I.push(j)}Object.assign(a,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:L,top:5,isFixed:k(h)},arrowGroup:{obj:w,top:2*z,isFixed:k(h)},riseText:{obj:S,top:(x?-z:0)-5},verifiedText:{obj:Y,top:(x?-z:0)-5},reducePoint:{obj:j,type:"reduce"}})}(C,u,T,R,s),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;let o,a;const{upArrowShow:u=!1,limitValueShow:p=!1}=i;if(u&&+t.value>180){let t=e[1]-2.5*z,i=[e[1]-z/2,t];t<q.originY&&(t=e[1]+2.5*z,i=[t,e[1]+z/2]),o=r([e[0],i[0],i[1]],m,"up"),I.push(o)}if(p){const i={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...s.list)){const t=o?e[1]+z/2+o.height:e[1]+z;a=l([e[0],t],i),I.push(a)}+t.value<Math.min(...s.list)&&(a=l([e[0],e[1]-z],i),I.push(a))}Object.assign(n,{upArrow:{obj:o},limitValue:{obj:a,top:-z}})}(C,u,T,R),function(n,l,r,a,u){let p,f;const{pointAttr:h={},lineAttr:g={},title:v="",key:m,type:x="circle"}=a,b=e.list[r+1],j=ue(b,s),k=se(c,e.list[r].value),E=j&&se(c,b.value);!n||!j||l.breakpoint||k||E||n[0]===j[0]||(f=i([...n,...j],{...g}));const I=l.pacemakerShow&&"pulse"==c?y.value:k&&"number"===Y?0:x,T=A[r-1],C={origin:{data:l,title:v,key:m||"",unit:s.unit,type:c,_type:d(v,c),dataIndex:t,index:r},leftLine:T,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==c?y.style:h,...w.event.hovered?w.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:w.event,...k?{selectable:!1,evented:!1,..."number"===Y?M:{}}:{}};if(T){const e=T.get("y2");p=o(I,{left:T.get("x2"),top:k?e-5:e,...C})}else n&&(C.leftLine=null,p=o(I,{left:n[0],top:k?n[1]-5:n[1],...C}));A.push(f),p&&(v.includes("脉搏")?ee.add(p):te.add(p),function(e){W.hovered&&(e.on("mouseover",(()=>{ae(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?B:q;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):!l&&(null==i||i.setCoords().set({left:e.left,top:e.top+o})))})),oe(e)}(e),W.hovered&&ae(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{type:t}=e.origin,i=$(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};L.value.discardActiveObject(),S("change",n),pe(n,"change")}}))}(p),O.push(p),ie.add(p))}(C,u,b,T,R)})),"pulse"===c&&U.forEach((e=>{Z.set(e,O.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(O).then((e=>{const t=A.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(I).then((i=>{L.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&L.value.remove(e.leftLine),e.rightLine&&L.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function ae(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;P.point={x:e.left,y:e.top},P.list=[function(){const{drugReduce:r,physicsReduce:s}=l||{},a="hover"===t?l.value:$(o,e.top);if(p(r))return`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(p(s))return`物理降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||M(e.left)).slice(-5)}`],P.show=!0}function ue(e,t){const i="pain"===t.type?B:q;if(f(e)&&function(e){const[t]=X,i=X.at(-1),n=t.start,o=i.end,l=h(e);return l>=n&&l<=o}(e.time)){const n=Y(e.time),o=E(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ce(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=h(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=h(`${M(e)}:00`);return J&&l<h(J)?(T("exceedMin"),!1):!(l>o)||(T("exceedMax"),!1)}function pe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:r}=e,s=ne.find((e=>e.type===i));if("add"===t){const e=a(i)?s.dataList.find((e=>e.enable)):s.dataList[n],t=g(l.time,e.list);e.list.splice(t,0,l)}else s.dataList[n].list[o]=l;de()}function de(){var e;ie.size&&(null==(e=L.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...ie]))),Z.clear(),ie.clear(),ee.clear(),te.clear(),ne.forEach((e=>{e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||re(t,i,e)}))})),oe(),le()}return Z.clear(),ee.clear(),te.clear(),ne.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=E(e.type,e.list,e.positionLine.value),n=i([D,t,V,t],e.positionLine);L.value.add(n)}(e),e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||re(t,i,e)}))})),oe(),le(),w.event.evented&&L.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=D&&i<=V&&n>=_&&n<=G){A.point={x:i,y:n},A.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(A.list=[...x]),"pain"===o&&(A.list=[...b]),A.target=e.target;else{A.target=null,A.list=["新增节点"],H.forEach((t=>{if(!I([...ie],i,"_type").includes(t.bigType)){const i=["pain"].includes(t.bigType)?B:q;n>=i.originY&&n<=i.endY&&A.list.push({renderItem:O?O(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ce(i);t&&1!==A.list.length||(A.show=!1,1===A.list.length&&t&&T("repeat"))}}}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,r=v(i,[...x,...b]);r[`${e.type}`]=e.value,a(n)&&(r.key=t.origin.key);const s={...t.origin,data:r};S("change",s),pe(s,"change")}else{const t={data:{time:M(e.pointer.x),value:$(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};S("add",t),pe(t)}},setPopup:ae,isAddPoint:ce,updateData:pe,redrawPoints:de,gridPoints:ie}}function k(e){return"fixed"===e.position}export{L as useCenter};
@@ -1,6 +1,6 @@
1
1
  import { Ref } from 'vue';
2
2
  import { fabric } from '../../../../../../es/shared/utils/fabricjs';
3
- import { IPropItems, IPointTipProps } 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): {
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>): {
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 s,isOneLine as r}from"../../utils/index.js";import"@vueuse/core";import{getScaleInfo as a,drawScaleNumber as u,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"lodash-es";import"./useShadow.js";function g(g,p,d,f,m,y,v,w,S,Y,b){var x,j;const{getEqualXTypes:X,handleAddPrevent:C,isGridLimit:N}=c(g,d,p),{originY:T,endY:V,originX:k,endX:L,xCellWidth:M,yCellHeight:W,left:E,vitalSignsOriginY:G,painOriginY:O,painHeight:A,iconsWidth:H,itemList:I,painIndex:R,right:_,canvasWidth:B,canvasHeight:J,getRightInfo:$,borderStyle:q}=p;function D(o){var s;if(!(null==o?void 0:o.length))return;const{layout:r}=o[0];let c=H,p=k;"right"===r&&(c=L,p=L+(null!=(s=null==_?void 0:_.width)?s:0));const d=[],f=A&&"right"!==r?o.length-1:o.length,m=(p-c)/f,y=m+(p-c)%f;o.forEach(((o,s)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:s=5,showScale:r,showNumber:h,position:c,showMaxMinNumber:p,style:d,title:f}=n,m=l({width:k-H,height:A,...q},{value:`${f}`,...i,...d||{}},{left:H,top:O.originY}),y=e([H,O.originY,k,O.originY],q),v=[];if(r||h){const{lineXMain:e,textLeft:i}=a(c,H,k-H),l=o.length;o.forEach(((o,a)=>{let c=O.endY-a*W*s;if(0===a&&(c=V-5),!h||(0===a||a===l-1)&&!p||v.push(u(o,n,i,c)),r&&0!==a){const[i,n]=e,o=new t.Line([i,c,n,c],{...q,...d});v.push(o)}}))}g.value.add(y,m,...v),m.sendToBack()}(o);const p=[],f=0===s?y:m,v=0===s?c:y+c+(s-1)*m,w="right"===r?0:G.originY,S="right"===r?J:G.endY,Y=s>0?e([v,w,v,S],{objectCaching:!1,...q}):null;Y&&p.push(Y);const b=v+f/2,{list:x=[],spaceGridNumber:j=5,showScale:X,showNumber:C,position:N,showMaxMinNumber:T}=o;if(X||C){const{lineXMain:t,lineXSub:e,textLeft:i}=a(N,v,f),n=x.length;x.forEach(((l,s)=>{const r=G.endY-s*W*j;if(C&&(!(0===s||s===n-1)||T)){const t=0==s?r-5:r,e=u(l,o,i,t),n=G.originY+e.height/2;t<n&&e.set({top:n}),p.push(e)}p.push(...h(o,s,t,e,r,W,G.originY))}))}let L=o.title||"";o.unit&&(L+="\n"+o.unit),L&&p.push(new t.Text(String(L),{...i,left:b,top:G.originY+W*j/2,textAlign:"center",...o.style}));const M=new t.Group(p,{...n,objectCaching:!1});d.push(M)}));const v=d.length>0?new t.Group([...d],{...n,objectCaching:!1}):null;v&&g.value.add(v),v&&v.sendToBack()}H&&function(){const t=JSON.parse(JSON.stringify(I));let e=V;const i=H-E.icons.marginRight;t.reverse().forEach((t=>{e-=10;let n=t.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:a}=o(n,t,{text:{left:i-(t.pointAttr.width||10)-5,top:e,originX:"right"},icon:{originX:"right",left:i,topY:e,origin:{type:s(t.bigType),_type:t.bigType},...p.event}});var u;e-=l.height||30,(u=a).on("moving",(()=>{u.set("originX","center"),function(t){if(t.left>=k&&t.left<=L){t.setCoords();const e="pain"===t.origin.type?O:G;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(u),N(u)?f(u):m.show=!1})),u.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&N(u)){const t=X(u.left,"_type",M).includes(u.origin._type),e=Y(u.left);if(!e||t)t&&e&&C("repeat");else{const t={data:{time:w(u.left),value:S(u.origin.type,u.top),...r(u.origin.type)?{key:u.origin.key}:{}},...u.origin};d("add",t),b(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(u)})),g.value.add(l,a)}))}();const P=E.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==_?void 0:_.width)&&"left"===(null==(x=null==_?void 0:_.yScaleValue)?void 0:x.layout)&&(null==(j=null==_?void 0:_.yScaleValue)?void 0:j.show)&&P.push($),R>0&&E.yScaleValue[R].show){const t=E.yScaleValue[R];0===R&&E.yScaleValue.length>1&&P.unshift(t),R==E.yScaleValue.length-1&&P.push(t)}const z=P.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),F=P[z];return z>-1&&P.splice(z,0,{...F,title:(null==F?void 0:F.doubleTitle)||(null==F?void 0:F.title)}),D(P),g.value.add(new t.Rect({left:H,top:0,width:B-H-q.strokeWidth,height:J-q.strokeWidth,fill:"transparent",...q})),{drawScaleValue:D}}export{g as useLeft};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as s,isOneLine as r}from"../../utils/index.js";import"@vueuse/core";import{getScaleInfo as a,drawScaleNumber as u,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"lodash-es";import"./useShadow.js";function g(g,p,d,f,m,y,v,w,S,Y,b,x){var j,X;const{getEqualXTypes:C,handleAddPrevent:N,isGridLimit:T}=c(g,d,p),{originY:V,endY:k,originX:L,endX:M,xCellWidth:W,yCellHeight:E,left:G,vitalSignsOriginY:O,painOriginY:A,painHeight:H,iconsWidth:I,itemList:R,painIndex:_,right:B,canvasWidth:J,canvasHeight:$,getRightInfo:q,borderStyle:D}=p;function P(o){var s;if(!(null==o?void 0:o.length))return;const{layout:r}=o[0];let c=I,p=L;"right"===r&&(c=M,p=M+(null!=(s=null==B?void 0:B.width)?s:0));const d=[],f=H&&"right"!==r?o.length-1:o.length,m=(p-c)/f,y=m+(p-c)%f;o.forEach(((o,s)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:s=5,showScale:r,showNumber:h,position:c,showMaxMinNumber:p,style:d,title:f}=n,m=l({width:L-I,height:H,...D},{value:`${f}`,...i,...d||{}},{left:I,top:A.originY}),y=e([I,A.originY,L,A.originY],D),v=[];if(r||h){const{lineXMain:e,textLeft:i}=a(c,I,L-I),l=o.length;o.forEach(((o,a)=>{let c=A.endY-a*E*s;if(0===a&&(c=k-5),!h||(0===a||a===l-1)&&!p||v.push(u(o,n,i,c)),r&&0!==a){const[i,n]=e,o=new t.Line([i,c,n,c],{...D,...d});v.push(o)}}))}g.value.add(y,m,...v),m.sendToBack()}(o);const p=[],f=0===s?y:m,v=0===s?c:y+c+(s-1)*m,w="right"===r?0:O.originY,S="right"===r?$:O.endY,Y=s>0?e([v,w,v,S],{objectCaching:!1,...D}):null;Y&&p.push(Y);const b=v+f/2,{list:x=[],spaceGridNumber:j=5,showScale:X,showNumber:C,position:N,showMaxMinNumber:T}=o;if(X||C){const{lineXMain:t,lineXSub:e,textLeft:i}=a(N,v,f),n=x.length;x.forEach(((l,s)=>{const r=O.endY-s*E*j;if(C&&(!(0===s||s===n-1)||T)){const t=0==s?r-5:r,e=u(l,o,i,t),n=O.originY+e.height/2;t<n&&e.set({top:n}),p.push(e)}p.push(...h(o,s,t,e,r,E,O.originY))}))}let V=o.title||"";o.unit&&(V+="\n"+o.unit),V&&p.push(new t.Text(String(V),{...i,left:b,top:O.originY+E*j/2,textAlign:"center",...o.style}));const M=new t.Group(p,{...n,objectCaching:!1});d.push(M)}));const v=d.length>0?new t.Group([...d],{...n,objectCaching:!1}):null;v&&g.value.add(v),v&&v.sendToBack()}I&&function(){const t=JSON.parse(JSON.stringify(R));let e=k;const i=I-G.icons.marginRight;t.reverse().forEach((t=>{e-=10;let n=t.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:a}=o(n,t,{text:{left:i-(t.pointAttr.width||10)-5,top:e,originX:"right"},icon:{originX:"right",left:i,topY:e,origin:{type:s(t.bigType),_type:t.bigType},...p.event}});var u;e-=l.height||30,(u=a).on("moving",(()=>{u.set("originX","center"),function(t){if(t.left>=L&&t.left<=M){t.setCoords();const e="pain"===t.origin.type?A:O;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(u),T(u)?f(u):m.show=!1})),u.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&T(u)){const t=C([...x],u.left,"_type").includes(u.origin._type),e=Y(u.left);if(!e||t)t&&e&&N("repeat");else{const t={data:{time:w(u.left),value:S(u.origin.type,u.top),...r(u.origin.type)?{key:u.origin.key}:{}},...u.origin};d("add",t),b(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(u)})),g.value.add(l,a)}))}();const z=G.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==B?void 0:B.width)&&"left"===(null==(j=null==B?void 0:B.yScaleValue)?void 0:j.layout)&&(null==(X=null==B?void 0:B.yScaleValue)?void 0:X.show)&&z.push(q),_>0&&G.yScaleValue[_].show){const t=G.yScaleValue[_];0===_&&G.yScaleValue.length>1&&z.unshift(t),_==G.yScaleValue.length-1&&z.push(t)}const F=z.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),K=z[F];return F>-1&&z.splice(F,0,{...K,title:(null==K?void 0:K.doubleTitle)||(null==K?void 0:K.title)}),P(z),g.value.add(new t.Rect({left:I,top:0,width:J-I-D.strokeWidth,height:$-D.strokeWidth,fill:"transparent",...D})),{drawScaleValue:P}}export{g as useLeft};
@@ -1 +1 @@
1
- import{ref as e,computed as t,reactive as a,onMounted as l,nextTick as u}from"vue";import{defaultBorderStyle as i}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as r}from"../useCumputedPoint.js";import{useEvent as n,useCanvasEvent as o}from"../useEvent.js";import{setOtherType as s,getFloorNumber as d}from"../../utils/index.js";import"lodash-es";import{format as v,addDays as c}from"date-fns";import{useTop as h}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useRight as g}from"./useRight.js";import{useCenter as m}from"./useCenter.js";import{useBottom as f}from"./useBottom.js";import{useOther as y}from"./useOther.js";function Y(Y,S,b,w,C,x){const D=15,j=e(),V=e(),X=e(),H=t((()=>{const{top:e}=S.data;return e.date.show&&(e.date.height||D)||0})),L=t((()=>{var e;const{top:t}=S.data;return(null==(e=t.hospitalDays)?void 0:e.show)&&(t.hospitalDays.height||D)||0})),I=t((()=>{var e;const{top:t}=S.data;return(null==(e=t.operationDays)?void 0:e.show)&&(t.operationDays.height||D)||0})),M=t((()=>{var e,t,a;const{top:l}=S.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||D)||0)+((null==(t=l.xScalevalue)?void 0:t.show)&&null!=(a=l.dayHeight)?a:0)})),N=t((()=>{var e;const{bottom:t}=S.data;return(null==(e=null==t?void 0:t.breathing)?void 0:e.show)&&(t.breathing.height||30)||0})),P=t((()=>{const{grid:e}=S.data;return e.mainXCell*e.subXCell+e.surplusXCell})),O=t((()=>{const{grid:e}=S.data;return e.mainYCell*e.subYCell+e.surplusYCell})),W=t((()=>{var e;const{width:t,right:a=null,top:l}=S.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),$=t((()=>{const{grid:e}=S.data;return W.value-e.surplusXCell*z.value})),k=t((()=>{const{top:e,left:t}=S.data;return e.titleWidth+A.value})),G=t((()=>{const{bottom:e=null,height:t}=S.data;if(!e)return t;return t-(e.height||30)})),R=t((()=>{var e;const{top:t}=S.data,a=t.xScalevalue.show&&(null!=(e=t.dayHeight)?e:0)||0,l=t.xScalevalue.show&&(t.xScalevalue.height||D)||0;return H.value+a+l+L.value+I.value})),q=t((()=>{const{grid:e}=S.data;return R.value+e.surplusYCell*T.value})),z=t((()=>(W.value-k.value)/P.value)),T=t((()=>(G.value-R.value)/O.value)),A=t((()=>{var e,t;const{left:a}=S.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}=S.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 r=k.value-z.value;const n=a.date.startDate||v(new Date,"yyyy-MM-dd");return u.reduce(((e,t,a)=>0===a?e.concat(n):e.concat(v(c(new Date(n.replace(/-/g,"/")),a),"yyyy-MM-dd"))),[]).map((e=>i.map((t=>{r+=z.value;const a=Date.parse(`${e} ${t.start}`),l=Date.parse(`${e} ${t.end}`);return{start:a,end:l,left:r,center:r+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=S.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),U=t((()=>{const{left:e}=S.data;return e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:s(t.title,e.type),unit:e.unit,dataIndex:a}))))).flat()})),Z=t((()=>{const{left:e}=S.data;return e.yScaleValue.findIndex((e=>"pain"===e.type))})),_=t((()=>{const{grid:e}=S.data;return-1===Z.value?0:T.value*e.subYCell})),ee=t((()=>{const{left:e}=S.data,t={originY:G.value,endY:G.value};return 0===Z.value&&e.yScaleValue.length>1?(t.originY=q.value,t.endY=q.value+_.value):Z.value===e.yScaleValue.length-1&&(t.originY=G.value-_.value,t.endY=G.value),t})),te=t((()=>{const{left:e}=S.data,t={originY:R.value,endY:G.value};return 0===Z.value&&e.yScaleValue.length>1?(t.originY=q.value+_.value,t.endY=G.value):Z.value===e.yScaleValue.length-1&&(t.originY=q.value,t.endY=G.value-_.value),t})),ae=t((()=>{var e,t;const{top:a,grid:l}=S.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}=S.data,l=t.yScaleValue.find((e=>"temperature"===e.type)),u=(null==a?void 0:a.yScaleValue)||{};return(null==(e=null==l?void 0:l.list)?void 0:e.length)&&Object.assign(u,{list:l.list.map((e=>d(1.8*e+32))),spaceGridNumber:l.spaceGridNumber}),u})),ue=a({canvasWidth:S.data.width,canvasHeight:S.data.height,borderStyle:{...i,...S.data.borderStyle||{}},selectionStyle:S.data.selectionStyle||{},dateHeight:H.value,hospitalDaysHeight:L.value,operationDaysHeight:I.value,xScalevalueHeight:M.value,topList:ae.value,breathingHeight:N.value,hospitalizationDate:S.data.hospitalizationDate,grid:S.data.grid,top:S.data.top,left:S.data.left,right:S.data.right,bottom:S.data.bottom,other:S.data.other,painIndex:Z.value,painHeight:_.value,painOriginY:ee.value,vitalSignsOriginY:te.value,gridXNumber:P.value,gridYNumber:O.value,iconsWidth:A.value,originX:k.value,originY:R.value,originYLimit:q.value,endX:W.value,endXLimit:$.value,endY:G.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:S.data.config||{}});function ie(e){const{yScaleValue:t}=S.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:re,cumputedY:ne,getXValue:oe,getYValue:se}=r(ue);return l((()=>{u((()=>{h(Y,ue);const{setPopup:e,isAddPoint:t,updateData:a,redrawPoints:l,clickMenu:u}=m(Y,ue,b,re,ne,oe,se,S.addRenderItem,C,x);V.value=l,X.value=u;const{drawScaleValue:i}=p(Y,ue,b,e,C,re,ne,oe,se,t,a);g(Y,ue,i),f(Y,ue),y(Y,ue,re),n(w.value);const{select:r}=o(Y,ue,b);j.value=r}))})),{propItems:ue,redrawPoints:V,select:j,clickMenu:X}}export{Y as useTemperatureChart};
1
+ import{ref as e,computed as t,reactive as a,onMounted as l,nextTick as u}from"vue";import{defaultBorderStyle as i}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as r}from"../useCumputedPoint.js";import{useEvent as n,useCanvasEvent as o}from"../useEvent.js";import{setOtherType as s,getFloorNumber as d}from"../../utils/index.js";import"lodash-es";import{format as v,addDays as c}from"date-fns";import{useTop as h}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useRight as g}from"./useRight.js";import{useCenter as m}from"./useCenter.js";import{useBottom as f}from"./useBottom.js";import{useOther as y}from"./useOther.js";function Y(Y,S,b,w,C,x){const D=15,j=e(),V=e(),X=e(),H=t((()=>{const{top:e}=S.data;return e.date.show&&(e.date.height||D)||0})),L=t((()=>{var e;const{top:t}=S.data;return(null==(e=t.hospitalDays)?void 0:e.show)&&(t.hospitalDays.height||D)||0})),I=t((()=>{var e;const{top:t}=S.data;return(null==(e=t.operationDays)?void 0:e.show)&&(t.operationDays.height||D)||0})),M=t((()=>{var e,t,a;const{top:l}=S.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||D)||0)+((null==(t=l.xScalevalue)?void 0:t.show)&&null!=(a=l.dayHeight)?a:0)})),P=t((()=>{var e;const{bottom:t}=S.data;return(null==(e=null==t?void 0:t.breathing)?void 0:e.show)&&(t.breathing.height||30)||0})),N=t((()=>{const{grid:e}=S.data;return e.mainXCell*e.subXCell+e.surplusXCell})),O=t((()=>{const{grid:e}=S.data;return e.mainYCell*e.subYCell+e.surplusYCell})),W=t((()=>{var e;const{width:t,right:a=null,top:l}=S.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),$=t((()=>{const{grid:e}=S.data;return W.value-e.surplusXCell*z.value})),k=t((()=>{const{top:e,left:t}=S.data;return e.titleWidth+A.value})),G=t((()=>{const{bottom:e=null,height:t}=S.data;if(!e)return t;return t-(e.height||30)})),R=t((()=>{var e;const{top:t}=S.data,a=t.xScalevalue.show&&(null!=(e=t.dayHeight)?e:0)||0,l=t.xScalevalue.show&&(t.xScalevalue.height||D)||0;return H.value+a+l+L.value+I.value})),q=t((()=>{const{grid:e}=S.data;return R.value+e.surplusYCell*T.value})),z=t((()=>(W.value-k.value)/N.value)),T=t((()=>(G.value-R.value)/O.value)),A=t((()=>{var e,t;const{left:a}=S.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}=S.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 r=k.value-z.value;const n=a.date.startDate||v(new Date,"yyyy-MM-dd");return u.reduce(((e,t,a)=>0===a?e.concat(n):e.concat(v(c(new Date(n.replace(/-/g,"/")),a),"yyyy-MM-dd"))),[]).map((e=>i.map((t=>{r+=z.value;const a=Date.parse(`${e} ${t.start}`),l=Date.parse(`${e} ${t.end}`);return{start:a,end:l,left:r,center:r+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=S.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),U=t((()=>{const{left:e}=S.data;return e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:s(t.title,e.type),unit:e.unit,dataIndex:a}))))).flat()})),Z=t((()=>{const{left:e}=S.data;return e.yScaleValue.findIndex((e=>"pain"===e.type))})),_=t((()=>{const{grid:e}=S.data;return-1===Z.value?0:T.value*e.subYCell})),ee=t((()=>{const{left:e}=S.data,t={originY:G.value,endY:G.value};return 0===Z.value&&e.yScaleValue.length>1?(t.originY=q.value,t.endY=q.value+_.value):Z.value===e.yScaleValue.length-1&&(t.originY=G.value-_.value,t.endY=G.value),t})),te=t((()=>{const{left:e}=S.data,t={originY:R.value,endY:G.value};return 0===Z.value&&e.yScaleValue.length>1?(t.originY=q.value+_.value,t.endY=G.value):Z.value===e.yScaleValue.length-1&&(t.originY=q.value,t.endY=G.value-_.value),t})),ae=t((()=>{var e,t;const{top:a,grid:l}=S.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}=S.data,l=t.yScaleValue.find((e=>"temperature"===e.type)),u=(null==a?void 0:a.yScaleValue)||{};return(null==(e=null==l?void 0:l.list)?void 0:e.length)&&Object.assign(u,{list:l.list.map((e=>d(1.8*e+32))),spaceGridNumber:l.spaceGridNumber}),u})),ue=a({canvasWidth:S.data.width,canvasHeight:S.data.height,borderStyle:{...i,...S.data.borderStyle||{}},selectionStyle:S.data.selectionStyle||{},dateHeight:H.value,hospitalDaysHeight:L.value,operationDaysHeight:I.value,xScalevalueHeight:M.value,topList:ae.value,breathingHeight:P.value,hospitalizationDate:S.data.hospitalizationDate,grid:S.data.grid,top:S.data.top,left:S.data.left,right:S.data.right,bottom:S.data.bottom,other:S.data.other,painIndex:Z.value,painHeight:_.value,painOriginY:ee.value,vitalSignsOriginY:te.value,gridXNumber:N.value,gridYNumber:O.value,iconsWidth:A.value,originX:k.value,originY:R.value,originYLimit:q.value,endX:W.value,endXLimit:$.value,endY:G.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:S.data.config||{}});function ie(e){const{yScaleValue:t}=S.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:re,cumputedY:ne,getXValue:oe,getYValue:se}=r(ue);return l((()=>{u((()=>{h(Y,ue);const{setPopup:e,isAddPoint:t,updateData:a,redrawPoints:l,clickMenu:u,gridPoints:i}=m(Y,ue,b,re,ne,oe,se,S.addRenderItem,C,x);V.value=l,X.value=u;const{drawScaleValue:r}=p(Y,ue,b,e,C,re,ne,oe,se,t,a,i);g(Y,ue,r),f(Y,ue),y(Y,ue,re),n(w.value);const{select:s}=o(Y,ue,b);j.value=s}))})),{propItems:ue,redrawPoints:V,select:j,clickMenu:X}}export{Y as useTemperatureChart};
@@ -3,7 +3,7 @@ import { fabric } from '../../../../../es/shared/utils/fabricjs';
3
3
  import { IObject } from '../interface';
4
4
  import { AnyObject } from '../../../../../es/shared/types';
5
5
  export declare function useCommon(canvas: Ref<fabric.Canvas>, emits: Function, propItems: AnyObject): {
6
- getEqualXTypes: (pointX: number, field: string, range?: number) => string[];
6
+ getEqualXTypes: (points: any[], pointX: number, field: string, range?: any) => string[];
7
7
  handleAddPrevent: (type: 'repeat' | 'exceedMax' | 'exceedMin') => void;
8
8
  isGridLimit: (point: IObject) => boolean;
9
9
  };
@@ -1 +1 @@
1
- const e={repeat:"该时段已存在数值不能新增",exceedMax:"未来时间不允许录入",exceedMin:"不允许小于入院时间"};function n(n,t,i){return{getEqualXTypes:function(e,t,i=6){const r=[],o=i/2;return n.value.forEachObject((n=>{n.origin&&!n.origin.isMenu&&n.left>=e-o&&n.left<=e+o&&r.push(n.origin[t])})),[...new Set(r)]},handleAddPrevent:function(n){t("add:prevent",{type:n,message:e[n]})},isGridLimit:function(e){const{left:n,top:t}=e,{originX:r,endX:o,originY:c,endY:u}=i;return n>=r&&n<=o&&t>=c&&t<=u}}}export{n as useCommon};
1
+ const e={repeat:"该时段已存在数值不能新增",exceedMax:"未来时间不允许录入",exceedMin:"不允许小于入院时间"};function n(n,t,i){return{getEqualXTypes:function(e,n,t,r=i.xCellWidth){const o=[],d=r/2;return e.forEach((e=>{e.origin&&!e.origin.isMenu&&Math.abs(n-e.left)<=d&&o.push(e.origin[t])})),[...new Set(o)]},handleAddPrevent:function(n){t("add:prevent",{type:n,message:e[n]})},isGridLimit:function(e){const{left:n,top:t}=e,{originX:r,endX:o,originY:d,endY:c}=i;return n>=r&&n<=o&&t>=d&&t<=c}}}export{n as useCommon};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";const t={evented:!1,selectable:!1},i={stroke:"#000",strokeWidth:1,strokeUniform:!0,...t},n={stroke:"#000",strokeWidth:1,strokeDashArray:[0,0],strokeUniform:!0,...t},r={fill:"transparent",stroke:"#000",strokeWidth:1,originX:"center",originY:"center",objectCaching:!1,strokeUniform:!0,...t},o={fontFamily:"微软雅黑",fontSize:12,fill:"#000",centeredRotation:!0,originX:"center",originY:"center",lineHeight:1,objectCaching:!1,strokeUniform:!0,...t};function c(t,i){return new e.Line(t,{...n,...i})}function l([t,i],n){return new e.Text(String(n.value),{...o,left:t,top:i,...n})}function s([i,n,r],o,s="down"){const a=c([i,n,i,r],{strokeWidth:1,stroke:o.fill}),g=l([i+.5,"up"===s?r-3:r+3],{value:"v",originX:"center",originY:"bottom",fontSize:16,angle:"up"===s?180:0,objectCaching:!1,...o});return new e.Group([a,g],{...t,originX:"center",originY:"top",objectCaching:!1})}function a(i,n,c,l=!1){const s=new e.Rect({...r,...i,...l?{}:{stroke:"transparent"}}),{value:a="标题",textAlign:g="center",verticalAlign:u="center"}=n,h=i.width/2,f=i.height/2,d=new e.Text(String(a),{...o,...n,..."left"==g||"right"==g?{originX:g,left:"left"==g?-h:h}:{},..."top"==u||"bottom"==u?{originY:u,top:"top"==u?-f:f}:{}});return new e.Group([s,d],{objectCaching:!1,...t,...c})}function g(t="circle",i){const n={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",objectCaching:!1,...i},r=()=>new e.Circle({objectCaching:!1,strokeWidth:i.strokeWidth||1,stroke:i.stroke||"red",radius:i.radius||5,fill:"#fff"});switch(t){case"triangle":return new e.Triangle({width:20,height:20,strokeWidth:1,scale:1,...n});case"circle":return new e.Circle({objectCaching:!1,strokeWidth:1,radius:5,scale:1,...n});case"image":return new e.Image(i.element,{...n,scale:1});case"yemai":{const t=()=>{const t=2*((i.radius||5)+(i.strokeWidth||1)),n={stroke:i.strokeX||"blue",strokeWidth:i.strokeWidthX||1,originX:"center",originY:"center"},r=new e.Line([0,t/2,t,t/2],n),o=new e.Line([t/2,0,t/2,t],n);return new e.Group([r,o])};return new e.Group([r(),t()],{scale:1,...n})}case"koumai":{const t=(i.radius||5)+(i.strokeWidth||1),o=new e.Circle({objectCaching:!1,radius:i.radiusCircle||2,fill:i.fillCircle||"#000",originX:"center",originY:"center",left:t,top:t});return new e.Group([r(),o],{scale:1,...n})}default:return i&&Reflect.deleteProperty(i,"stroke"),new e.Text(String(t),{fontFamily:"微软雅黑",scale:1,fontSize:14,fill:"#000",...n})}}function u(i,n,r,o="horizontal"){const c=new e.Text(String(i),{...t,objectCaching:!1,...n.titleStyle||{},originX:"left",originY:"bottom",lineHeight:1,fontSize:12,...r.text}),{top:l,topY:s,left:a,leftX:u}=r.icon,h=null!=l?l:"horizontal"===o?s-(c.height||30)/2-1:s+c.height+3,f=null!=a?a:u+c.width+5;return{text:c,icon:g(n.type,{...n.pointAttr,originY:"center",originX:"left",originLeft:f,originTop:h,...r.icon,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,isMenu:!0,...r.icon.origin},left:f,top:h})}}export{i as defaultBorderStyle,n as defaultLineStyle,r as defaultRectStyle,t as defaultStyle,o as defaultTextStyle,s as drawArrow,c as drawLine,g as drawPoint,l as drawText,u as drawTextAndIconGroup,a as drawTextGroup};
1
+ import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";const t={evented:!1,selectable:!1},i={stroke:"#000",strokeWidth:1,strokeUniform:!0,...t},n={stroke:"#000",strokeWidth:1,strokeDashArray:[0,0],strokeUniform:!0,...t},r={fill:"transparent",stroke:"#000",strokeWidth:1,originX:"center",originY:"center",objectCaching:!1,strokeUniform:!0,...t},o={fontFamily:"微软雅黑",fontSize:12,fill:"#000",centeredRotation:!0,originX:"center",originY:"center",lineHeight:1,objectCaching:!1,strokeUniform:!0,...t};function c(t,i){return new e.Line(t,{...n,...i})}function l([t,i],n){return new e.Text(String(n.value),{...o,left:t,top:i,...n})}function s([i,n,r],o,s="down"){const a=c([i,n,i,r],{strokeWidth:1,stroke:o.fill}),g=l([i+.5,"up"===s?r-3:r+3],{value:"v",originX:"center",originY:"bottom",fontSize:16,angle:"up"===s?180:0,objectCaching:!1,...o});return new e.Group([a,g],{...t,originX:"center",originY:"top",objectCaching:!1})}function a(i,n,c,l=!1){const s=new e.Rect({...r,...i,...l?{}:{stroke:"transparent"}}),{value:a="标题",textAlign:g="center",verticalAlign:u="center"}=n,f=i.width/2,h=i.height/2,d=new e.Text(String(a),{...o,...n,..."left"==g||"right"==g?{originX:g,left:"left"==g?-f:f}:{},..."top"==u||"bottom"==u?{originY:u,top:"top"==u?-h:h}:{}});return new e.Group([s,d],{objectCaching:!1,...t,...c})}function g(t){return new e.Circle({objectCaching:!1,strokeWidth:t.strokeWidth||1,stroke:t.stroke||"red",radius:t.radius||5,fill:"#fff"})}function u(t="circle",i){var n;const r={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",objectCaching:!1,scale:1,...i},o=i.radius?(i.radius||5)+(i.strokeWidth||1):null!=(n=i.width)?n:0;switch(t){case"triangle":return new e.Triangle({width:20,height:20,strokeWidth:1,...r});case"circle":return new e.Circle({objectCaching:!1,strokeWidth:1,radius:5,...r});case"image":return new e.Image(i.element,r);case"yemai":{const t=()=>{const t=2*o,n={stroke:i.strokeX||"blue",strokeWidth:i.strokeWidthX||1,originX:"center",originY:"center"},r=new e.Line([0,o,t,o],n),c=new e.Line([o,0,o,t],n);return new e.Group([r,c])};return new e.Group([g(i),t()],r)}case"koumai":{const t=new e.Circle({objectCaching:!1,radius:i.radiusCircle||2,fill:i.fillCircle||"#000",originX:"center",originY:"center",left:o-.5,top:o-.5});return new e.Group([g(i),t],r)}case"circleAndText":{const t=new e.Text(String(i.text),{fontFamily:"微软雅黑",fontSize:12,originX:"center",originY:"center",fill:i.stroke,left:o-.5,top:o-1,objectCaching:!1});return new e.Group([g(i),t],r)}default:return i&&Reflect.deleteProperty(i,"stroke"),new e.Text(String(t),{fontFamily:"微软雅黑",scale:1,fontSize:14,fill:"#000",...r})}}function f(i,n,r,o="horizontal"){const c=new e.Text(String(i),{...t,objectCaching:!1,...n.titleStyle||{},originX:"left",originY:"bottom",lineHeight:1,fontSize:12,...r.text}),{top:l,topY:s,left:a,leftX:g}=r.icon,f=null!=l?l:"horizontal"===o?s-(c.height||30)/2-1:s+c.height+3,h=null!=a?a:g+c.width+5;return{text:c,icon:u(n.type,{...n.pointAttr,originY:"center",originX:"left",originLeft:h,originTop:f,...r.icon,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,isMenu:!0,...r.icon.origin},left:h,top:f})}}export{i as defaultBorderStyle,n as defaultLineStyle,r as defaultRectStyle,t as defaultStyle,o as defaultTextStyle,s as drawArrow,c as drawLine,u as drawPoint,l as drawText,f as drawTextAndIconGroup,a as drawTextGroup};
@@ -40,6 +40,10 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
40
40
  groupSetting: {
41
41
  type: import("vue").PropType<Partial<Record<"firstRowGroup" | "secondRowGroup" | "thirdRowGroup" | "fourthRowGroup" | "fifthRowGroup" | "sixthRowGroup" | "seventhRowGroup" | "eighthRowGroup" | "ninthRowGroup" | "tenthRowGroup", import("..").IhoTableRowGroupItem[]>> | undefined>;
42
42
  };
43
+ customColumns: {
44
+ type: import("vue").PropType<import("./src/types").FieldSetColumnItem[]>;
45
+ default: () => never[];
46
+ };
43
47
  }, {
44
48
  fieldsMapping: Record<string, string>;
45
49
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -82,6 +86,10 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
82
86
  groupSetting: {
83
87
  type: import("vue").PropType<Partial<Record<"firstRowGroup" | "secondRowGroup" | "thirdRowGroup" | "fourthRowGroup" | "fifthRowGroup" | "sixthRowGroup" | "seventhRowGroup" | "eighthRowGroup" | "ninthRowGroup" | "tenthRowGroup", import("..").IhoTableRowGroupItem[]>> | undefined>;
84
88
  };
89
+ customColumns: {
90
+ type: import("vue").PropType<import("./src/types").FieldSetColumnItem[]>;
91
+ default: () => never[];
92
+ };
85
93
  }>> & {
86
94
  onReset?: ((...args: any[]) => any) | undefined;
87
95
  onClose?: ((...args: any[]) => any) | undefined;
@@ -89,7 +97,14 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
89
97
  }>>;
90
98
  emit: (event: "close" | "save" | "reset", ...args: any[]) => void;
91
99
  newFields: import("vue").Ref<import("../../../es/shared/types").AnyObject[]>;
92
- columns: import("vue").Ref<import("../../../es/shared/types").AnyObject[]>;
100
+ columns: import("vue").Ref<{
101
+ title: string;
102
+ type: "text" | "checkbox" | "select" | "input" | "inputNumber";
103
+ field: string;
104
+ checkedAll?: boolean | undefined;
105
+ disabledAll?: boolean | undefined;
106
+ isShow?: boolean | undefined;
107
+ }[]>;
93
108
  fieldList: import("vue").ComputedRef<import("../../../es/shared/types").AnyObject[]>;
94
109
  handleFieldSave: () => void;
95
110
  onCancle: () => void;
@@ -354,6 +369,10 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
354
369
  groupSetting: {
355
370
  type: import("vue").PropType<Partial<Record<"firstRowGroup" | "secondRowGroup" | "thirdRowGroup" | "fourthRowGroup" | "fifthRowGroup" | "sixthRowGroup" | "seventhRowGroup" | "eighthRowGroup" | "ninthRowGroup" | "tenthRowGroup", import("..").IhoTableRowGroupItem[]>> | undefined>;
356
371
  };
372
+ customColumns: {
373
+ type: import("vue").PropType<import("./src/types").FieldSetColumnItem[]>;
374
+ default: () => never[];
375
+ };
357
376
  }>> & {
358
377
  onReset?: ((...args: any[]) => any) | undefined;
359
378
  onClose?: ((...args: any[]) => any) | undefined;
@@ -380,5 +399,6 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
380
399
  }>[];
381
400
  footerFlag: boolean;
382
401
  isEdit: boolean;
402
+ customColumns: import("./src/types").FieldSetColumnItem[];
383
403
  }>>;
384
404
  export default FieldSet;