cnhis-design-vue 3.1.44-beta.2 → 3.1.44-beta.4

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 (44) hide show
  1. package/README.md +87 -87
  2. package/es/components/fabric-chart/index.d.ts +4 -2
  3. package/es/components/fabric-chart/src/FabricChart.vue.d.ts +4 -2
  4. package/es/components/fabric-chart/src/FabricChart.vue.js +1 -1
  5. package/es/components/fabric-chart/src/hooks/useBirthProcess.d.ts +2 -2
  6. package/es/components/fabric-chart/src/hooks/useBirthProcess.js +1 -1
  7. package/es/components/fabric-chart/src/hooks/useBirthProcessChart.js +1 -1
  8. package/es/components/fabric-chart/src/hooks/useCenter.d.ts +3 -3
  9. package/es/components/fabric-chart/src/hooks/useCenter.js +1 -1
  10. package/es/components/fabric-chart/src/hooks/useCommon.d.ts +2 -4
  11. package/es/components/fabric-chart/src/hooks/useCommon.js +1 -1
  12. package/es/components/fabric-chart/src/hooks/useCumputedPoint.js +1 -1
  13. package/es/components/fabric-chart/src/hooks/useLeft.d.ts +1 -1
  14. package/es/components/fabric-chart/src/hooks/useLeft.js +1 -1
  15. package/es/components/fabric-chart/src/hooks/useTemperatureChart.js +1 -1
  16. package/es/components/fabric-chart/src/utils/utils.d.ts +2 -0
  17. package/es/components/fabric-chart/src/utils/utils.js +1 -1
  18. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/selectUtils.js +1 -1
  19. package/es/components/scale-view/src/ScaleView.vue.js +1 -1
  20. package/es/components/select-label/src/LabelFormContent.vue.js +1 -1
  21. package/es/components/select-person/src/SearchMultiple.vue.d.ts +6 -0
  22. package/es/env.d.ts +25 -25
  23. package/es/shared/package.json.js +1 -1
  24. package/package.json +2 -2
  25. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  26. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  27. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  28. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  29. package/es/components/fabric-chart/src/utils/index.d.ts +0 -6823
  30. package/es/components/form-render/src/components/renderer/dist/levelSearchCascader.d.ts +0 -77
  31. package/es/components/form-render/src/components/renderer/dist/searchCascade.d.ts +0 -93
  32. package/es/components/iho-table/src/plugins/dist/highLightSetPlugin.d.ts +0 -3
  33. package/es/components/iho-table/src/plugins/filterRenderPlugin/dist/index.d.ts +0 -3
  34. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/dist/index.d.ts +0 -3
  35. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/dist/defaultRendererPlugin.d.ts +0 -3
  36. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/dist/seqRendererPlugin.d.ts +0 -3
  37. package/es/components/iho-table/src/utils/dist/index.d.ts +0 -44
  38. package/es/components/scale-view/src/components/formitem/dist/r-address.d.ts +0 -36
  39. package/es/components/scale-view/src/components/formitem/dist/r-sign.d.ts +0 -36
  40. package/es/components/scale-view/src/components/formitem/dist/standard-modal.d.ts +0 -82
  41. package/es/components/search-cascader/src/components/dist/SearchMenu.d.ts +0 -57
  42. package/es/components/search-cascader/src/components/dist/SearchMenu1.d.ts +0 -57
  43. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  44. package/es/shared/utils/tapable/index.d.ts +0 -139
package/README.md CHANGED
@@ -1,87 +1,87 @@
1
- # 安装
2
-
3
- ```shell
4
- npm i cnhis-design-vue@[版本号]
5
- # or
6
- yarn add cnhis-design-vue@[版本号] #推荐
7
- ```
8
-
9
- ## 1.全局引入
10
-
11
- ```typescript
12
- // main.ts
13
- import { createApp } from 'vue';
14
- import App from './App.vue';
15
- import 'cnhis-design-vue/es/packages/index.css';
16
- import cui from 'cnhis-design-vue';
17
-
18
- const app = createApp(App);
19
- app.use(cui).mount('#app');
20
- ```
21
-
22
- ## 2. 按需引入
23
-
24
- 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
-
26
- ### 2.1 样式处理方式1 (按需引入样式)
27
-
28
- ```shell
29
- # 安装自动导入样式的插件
30
- npm i -d vite-plugin-style-import
31
- ```
32
-
33
- ```typescript
34
- // vite.config.ts
35
- import { defineConfig } from 'vite';
36
- import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
-
38
- export default defineConfig({
39
- plugins: [
40
- // ...otherPlugins
41
- createStyleImportPlugin({
42
- libs: [
43
- {
44
- libraryName: 'cnhis-design-vue',
45
- esModule: true,
46
- ensureStyleFile: true,
47
- resolveStyle: name => {
48
- return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
- }
50
- }
51
- ]
52
- })
53
- ]
54
- });
55
- ```
56
-
57
- ### 2.2 样式处理方式2 (全局引入样式)
58
-
59
- ```typescript
60
- // main.ts
61
- import 'cnhis-design-vue/es/components/index.css';
62
- ```
63
-
64
- ## 3.FAQ
65
-
66
- ### 3.1 项目打包后样式丢失
67
-
68
- 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
-
70
- ```typescript
71
- // vite.config.ts
72
- import { defineConfig } from 'vite';
73
-
74
- export default defineConfig({
75
- build: {
76
- rollupOptions: {
77
- // ..otherOptions
78
- output: {
79
- dir: './dist',
80
- manualChunks: {
81
- 'cnhis-vendor': ['cnhis-design-vue']
82
- }
83
- }
84
- }
85
- }
86
- });
87
- ```
1
+ # 安装
2
+
3
+ ```shell
4
+ npm i cnhis-design-vue@[版本号]
5
+ # or
6
+ yarn add cnhis-design-vue@[版本号] #推荐
7
+ ```
8
+
9
+ ## 1.全局引入
10
+
11
+ ```typescript
12
+ // main.ts
13
+ import { createApp } from 'vue';
14
+ import App from './App.vue';
15
+ import 'cnhis-design-vue/es/packages/index.css';
16
+ import cui from 'cnhis-design-vue';
17
+
18
+ const app = createApp(App);
19
+ app.use(cui).mount('#app');
20
+ ```
21
+
22
+ ## 2. 按需引入
23
+
24
+ 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
+
26
+ ### 2.1 样式处理方式1 (按需引入样式)
27
+
28
+ ```shell
29
+ # 安装自动导入样式的插件
30
+ npm i -d vite-plugin-style-import
31
+ ```
32
+
33
+ ```typescript
34
+ // vite.config.ts
35
+ import { defineConfig } from 'vite';
36
+ import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
+
38
+ export default defineConfig({
39
+ plugins: [
40
+ // ...otherPlugins
41
+ createStyleImportPlugin({
42
+ libs: [
43
+ {
44
+ libraryName: 'cnhis-design-vue',
45
+ esModule: true,
46
+ ensureStyleFile: true,
47
+ resolveStyle: name => {
48
+ return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
+ }
50
+ }
51
+ ]
52
+ })
53
+ ]
54
+ });
55
+ ```
56
+
57
+ ### 2.2 样式处理方式2 (全局引入样式)
58
+
59
+ ```typescript
60
+ // main.ts
61
+ import 'cnhis-design-vue/es/components/index.css';
62
+ ```
63
+
64
+ ## 3.FAQ
65
+
66
+ ### 3.1 项目打包后样式丢失
67
+
68
+ 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
+
70
+ ```typescript
71
+ // vite.config.ts
72
+ import { defineConfig } from 'vite';
73
+
74
+ export default defineConfig({
75
+ build: {
76
+ rollupOptions: {
77
+ // ..otherOptions
78
+ output: {
79
+ dir: './dist',
80
+ manualChunks: {
81
+ 'cnhis-vendor': ['cnhis-design-vue']
82
+ }
83
+ }
84
+ }
85
+ }
86
+ });
87
+ ```
@@ -29,8 +29,9 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
29
29
  onSelect?: ((...args: any[]) => any) | undefined;
30
30
  onAdd?: ((...args: any[]) => any) | undefined;
31
31
  onRemove?: ((...args: any[]) => any) | undefined;
32
+ "onAdd:prevent"?: ((...args: any[]) => any) | undefined;
32
33
  }>>;
33
- emits: (event: "select" | "add" | "change" | "remove", ...args: any[]) => void;
34
+ emits: (event: "select" | "add" | "change" | "remove" | "add:prevent", ...args: any[]) => void;
34
35
  isTemperature: import("vue").ComputedRef<boolean>;
35
36
  canvasRef: import("vue").Ref<HTMLCanvasElement | null>;
36
37
  canvas: import("vue").Ref<any>;
@@ -182,7 +183,7 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
182
183
  show: boolean;
183
184
  list: unknown[];
184
185
  }>;
185
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "add" | "change" | "remove")[], "remove" | "select" | "add" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
186
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "add" | "change" | "remove" | "add:prevent")[], "remove" | "select" | "add" | "change" | "add:prevent", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
186
187
  type: {
187
188
  type: import("vue").PropType<import("./src/interface").IType>;
188
189
  default: string;
@@ -199,6 +200,7 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
199
200
  onSelect?: ((...args: any[]) => any) | undefined;
200
201
  onAdd?: ((...args: any[]) => any) | undefined;
201
202
  onRemove?: ((...args: any[]) => any) | undefined;
203
+ "onAdd:prevent"?: ((...args: any[]) => any) | undefined;
202
204
  }, {
203
205
  type: import("./src/interface").IType;
204
206
  }>>;
@@ -31,8 +31,9 @@ declare const _default: import("vue").DefineComponent<{
31
31
  onSelect?: ((...args: any[]) => any) | undefined;
32
32
  onAdd?: ((...args: any[]) => any) | undefined;
33
33
  onRemove?: ((...args: any[]) => any) | undefined;
34
+ "onAdd:prevent"?: ((...args: any[]) => any) | undefined;
34
35
  }>>;
35
- emits: (event: "select" | "add" | "change" | "remove", ...args: any[]) => void;
36
+ emits: (event: "select" | "add" | "change" | "remove" | "add:prevent", ...args: any[]) => void;
36
37
  isTemperature: import("vue").ComputedRef<boolean>;
37
38
  canvasRef: import("vue").Ref<HTMLCanvasElement | null>;
38
39
  canvas: import("vue").Ref<any>;
@@ -184,7 +185,7 @@ declare const _default: import("vue").DefineComponent<{
184
185
  show: boolean;
185
186
  list: unknown[];
186
187
  }>;
187
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "add" | "change" | "remove")[], "remove" | "select" | "add" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
188
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "add" | "change" | "remove" | "add:prevent")[], "remove" | "select" | "add" | "change" | "add:prevent", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
188
189
  type: {
189
190
  type: PropType<IType>;
190
191
  default: string;
@@ -201,6 +202,7 @@ declare const _default: import("vue").DefineComponent<{
201
202
  onSelect?: ((...args: any[]) => any) | undefined;
202
203
  onAdd?: ((...args: any[]) => any) | undefined;
203
204
  onRemove?: ((...args: any[]) => any) | undefined;
205
+ "onAdd:prevent"?: ((...args: any[]) => any) | undefined;
204
206
  }, {
205
207
  type: IType;
206
208
  }>;
@@ -1 +1 @@
1
- import{defineComponent as e,computed as t,ref as r,onMounted as o,openBlock as s,createElementBlock as n,Fragment as p,createElementVNode as a,createBlock as i,mergeProps as u,unref as l,createCommentVNode as c}from"vue";import{fabric as m}from"./utils/index.js";import f from"./components/PopupTip.vue.js";import h from"./components/PopupMenu.js";import v from"./hooks/useTemperatureChart.js";import d from"./hooks/useBirthProcessChart.js";import k from"../../../_virtual/plugin-vue_export-helper.js";var C=k(e({__name:"FabricChart",props:{type:{type:String,default:"temperature"},data:{type:Object,required:!0},addRenderItem:{type:Function}},emits:["change","add","remove","select"],setup(e,{expose:k,emit:C}){const w=e,y=t((()=>"temperature"===w.type)),g=r(null),j=r(),{propItems:P,redrawPoints:_,select:I,pointTipProps:b,pointMenuProps:M,clickMenu:x}=function(){const e=[j,w,C,g];return y.value?v(...e):d(...e)}();return o((()=>{j.value=new m.Canvas(g.value,{width:P.canvasWidth,height:P.canvasHeight,backgroundColor:"#fff",selection:!1,containerClass:"c-fabric-chart",fireRightClick:!0})})),k({redrawPoints:_,select:I,canvas:j}),(e,t)=>(s(),n(p,null,[a("canvas",{ref_key:"canvasRef",ref:g},null,512),j.value?(s(),i(f,u({key:0,propItems:l(P)},l(b)),null,16,["propItems"])):c("v-if",!0),j.value?(s(),i(l(h),u({key:1,propItems:l(P)},l(M),{show:l(M).show,"onUpdate:show":t[0]||(t[0]=e=>l(M).show=e),onClickMenu:l(x)}),null,16,["propItems","show","onClickMenu"])):c("v-if",!0)],64))}}),[["__file","FabricChart.vue"]]);export{C as default};
1
+ import{defineComponent as e,computed as t,ref as r,onMounted as o,onBeforeUnmount as a,openBlock as s,createElementBlock as n,Fragment as p,createElementVNode as i,createBlock as u,mergeProps as l,unref as c,createCommentVNode as m}from"vue";import{fabric as f}from"./utils/index.js";import v from"./components/PopupTip.vue.js";import h from"./components/PopupMenu.js";import d from"./hooks/useTemperatureChart.js";import k from"./hooks/useBirthProcessChart.js";import C from"../../../_virtual/plugin-vue_export-helper.js";var w=C(e({__name:"FabricChart",props:{type:{type:String,default:"temperature"},data:{type:Object,required:!0},addRenderItem:{type:Function}},emits:["change","add","remove","select","add:prevent"],setup(e,{expose:C,emit:w}){const y=e,g=t((()=>"temperature"===y.type)),j=r(null),P=r(),{propItems:_,redrawPoints:I,select:b,pointTipProps:M,pointMenuProps:x,clickMenu:F}=function(){const e=[P,y,w,j];return g.value?d(...e):k(...e)}();return o((()=>{P.value=new f.Canvas(j.value,{width:_.canvasWidth,height:_.canvasHeight,backgroundColor:"#fff",selection:!1,containerClass:"c-fabric-chart",fireRightClick:!0})})),a((()=>{P.value.off(),P.value.clear()})),C({redrawPoints:I,select:b,canvas:P}),(e,t)=>(s(),n(p,null,[i("canvas",{ref_key:"canvasRef",ref:j},null,512),P.value?(s(),u(v,l({key:0,propItems:c(_)},c(M)),null,16,["propItems"])):m("v-if",!0),P.value?(s(),u(c(h),l({key:1,propItems:c(_)},c(x),{show:c(x).show,"onUpdate:show":t[0]||(t[0]=e=>c(x).show=e),onClickMenu:c(F)}),null,16,["propItems","show","onClickMenu"])):m("v-if",!0)],64))}}),[["__file","FabricChart.vue"]]);export{w as default};
@@ -1,7 +1,7 @@
1
- import { Ref } from 'vue';
1
+ import { type Ref } from 'vue';
2
2
  import { fabric } from '../utils';
3
3
  import { AnyObject } from '../../../../../es/shared/types';
4
- export declare function useBirthProcess(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: Function, pointTipProps: AnyObject, pointMenuProps: AnyObject, commonFunc: AnyObject): {
4
+ export declare function useBirthProcess(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: Function, pointTipProps: AnyObject, pointMenuProps: AnyObject): {
5
5
  clickMenu: ({ item, target }: {
6
6
  item: any;
7
7
  target: any;
@@ -1 +1 @@
1
- import{useBirthProcessCumputedPoint as t}from"./useCumputedPoint.js";import e from"./useGrid.js";import{drawLine as n,drawArrow as o,drawText as i,defaultTextStyle as r,drawPoint as l,defaultStyle as s,defaultRectStyle as a}from"./useDraw.js";import{getScaleInfo as u,drawScaleNumber as c,drawScaleLine as f}from"./useScaleColumn.js";import{fabric as p}from"../utils/index.js";import{getIndex as d,isEffectiveNode as h}from"../utils/utils.js";import{cloneDeep as g}from"lodash-es";import{format as v}from"date-fns";function m(m,y,k,w,x,b){const{cumputedX:T,cumputedY:S,getXValue:j,getYValue:C}=t(y),{getEqualXTypes:M,repeatTip:P}=b,{xAxis:E,grid:G,originX:L,originY:Y,xCellWidth:X,endY:A,startTime:H,leftAddAreaWidth:I,leftScales:D,rightScales:O,yCellHeight:V,endX:W,scaleValues:N,canvasWidth:R,borderStyle:$,rightAddAreaWidth:B,event:F,originYCervix:q,other:z,canvasHeight:J}=y,K=g(N),Q=new Set;function U(){K.filter((t=>t.show)).forEach(((t,e)=>{var s;const a=[],u=[],c=[];null==(s=t.data)||s.forEach(((s,f)=>{!function(s,f,p){let d,h;const{pointAttr:g={},lineAttr:v={},title:x="",key:b,type:T="circle",childbirthStyle:S={}}=t,M=t.data[p+1],P=nt(M,t);if(s&&P&&!f.breakpoint)h=n([...s,...P],{...v});else if(s&&!P&&!f.breakpoint){const e=nt(M,t);h=e?n([...s,...e],{...v}):null}let E,G;if(f.childbirth){const t=s[1]+V;E=o([s[0],s[1],t],S),c.push(E),G=i([s[0]+X/2,t-V/2],{value:String(f.childbirth),...r,originX:"left",originY:"center",...S}),c.push(G)}const L=u[p-1],Y={origin:{data:f,title:x,key:b||"",dataIndex:e,index:p},leftLine:L,rightLine:h,arrowGroup:E,arrowGroupText:G,...g,...y.event.hovered?y.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:y.event};L?d=l(T,{left:L.get("x2"),top:L.get("y2"),...Y}):s&&(Y.leftLine=null,d=l(T,{left:s[0],top:s[1],...Y}));u.push(h),d&&(!function(t){F.hovered&&(t.on("mouseover",(()=>{et(t)})),t.on("mouseout",(()=>{w.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;t.on("moving",(()=>{tt(t),function(t){var e,n,o,i;null==(e=t.leftLine)||e.setCoords().set({x2:t.left,y2:t.top}),null==(n=t.rightLine)||n.setCoords().set({x1:t.left,y1:t.top}),null==(o=t.arrowGroup)||o.setCoords().set({left:t.left,top:t.top}),null==(i=t.arrowGroupText)||i.setCoords().set({left:t.left+X/2,top:t.top+V/2})}(t),F.hovered&&et(t)})),t.on("mouseup",(e=>{if(w.show=!1,1===e.button){const{key:e}=t.origin,n={...t.origin,data:{...t.origin.data,time:j(t.left),value:C(e,t.top)}};m.value.discardActiveObject(),k("change",n),Z(n,"change")}}))}(d),a.push(d),Q.add(d))}(nt(s,t),s,f)})),Promise.all(a).then((t=>{const e=u.filter((t=>t));let n=null;t=t.filter((t=>(t&&n&&(n.nextPoint=t,t.prevPoint=n),n=t||n,t))),Promise.all(c).then((n=>{m.value.add(...e,...t,...n),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function Z(t,e="add"){const{dataIndex:n,data:o,index:i,key:r}=t,l=K.find((t=>t.key===r));switch(e){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const t=d(o.time,l.data);l.data.splice(t,0,o);break}}_()}function _(){var t;Q.size&&(null==(t=m.value)||t.remove(...function(t){const e=[];return t.forEach((t=>{t&&e.push(t),(null==t?void 0:t.leftLine)&&e.push(null==t?void 0:t.leftLine),(null==t?void 0:t.rightLine)&&e.push(null==t?void 0:t.rightLine),(null==t?void 0:t.arrowGroup)&&e.push(null==t?void 0:t.arrowGroup),(null==t?void 0:t.arrowGroupText)&&e.push(null==t?void 0:t.arrowGroupText)})),e}([...Q]))),Q.clear(),U()}function tt(t){const e=t.prevPoint?t.prevPoint.left:L,n=t.nextPoint?t.nextPoint.left:W;t.setCoords(),["cervix","fetalPresentation"].includes(t.origin.key)&&t.top<q&&t.set("top",q),t.top<Y&&t.set("top",Y),t.top>A&&t.set("top",A),t.left<e&&t.set("left",e),t.left>n&&t.set("left",n)}function et(t){const{title:e,key:n}=t.origin;w.point={x:t.left,y:t.top},w.list=[`${e} ${C(n,t.top)}`,`时间 ${j(t.left).slice(-5)}`],w.show=!0}function nt(t,e){if(h(t)&&function(t){const e=H+864e5,n=new Date(t).getTime();return n>=H&&n<=e}(t.time)){const n=T(t.time),o=S(e.key,e.range,t.value);return[n,o<Y?Y:o>A?A:o]}}function ot(t,e){return t+1>e[1]?e[0]:t+1}return e(m,y,!0),function(){const t=new p.Rect({...$,width:R-I-B-1,height:A-1,left:I,top:0,fill:"transparent"});m.value.add(t)}(),function(){function t(t,e="left"){let n="left"===e?I:W;t.forEach(((t,e)=>{const{range:o,spaceValue:l,width:d,title:h,titleStyle:g,key:v,position:y="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:x}=t,b=[],T=[],S=n+d/2,j=function(t,e){const n=[],[o,i]=t;for(let t=o;e>0?t<=i:t>=i;t+=e)n.push(t);return n}(o,l),C=j.length;j.forEach(((e,o)=>{const{lineXMain:i,lineXSub:r,textLeft:l}=u(y,n,d),s=A-o*V*k,a=0===o?A-8:o!==j.length-1||Y||q&&"FHR"!==v?s:Y+8;!w||(0===o||o===C-1)&&!x||b.push(c(String(e),t,l,a)),T.push(...f(t,o,i,r,s,V,Y,C))}));const M=new p.Rect({...a,width:d,height:A,left:S,top:A/2}),P=i([S,Y>0?Y-V/2:V/2],{value:String(h),...r,...g}),E=new p.Group([...T,...b,M,...P?[P]:[]],{objectCaching:!1,...s});m.value.add(E),E.sendToBack(),n+=d}))}t(D),t(O,"right")}(),function(){const{show:t,startTime:e,range:n=[0,23],position:o="top",style:l}=E.time,{show:a,range:u=[0,23],position:c,style:f}=E.processTime;if(t||a){const d=[],h=[],g=[],v=[],y=L+X/2,k=V/2;for(let s=0;s<G.mainXCell;s++){if(t){const t=0===s?+e.slice(11,13):ot(d.at(-1),n);d.push(t);const a="top"===o?Y-k:A+k;g.push(i([y+s*X,a],{value:String(t),...r,...l||{}}))}if(a){const t=0===s?u[0]:h.at(-1)+1;h.push(t);const e="top"===c?k:J-k;v.push(i([y+s*X,e],{value:String(t),...r,...f||{}}))}}const w=new p.Group([...g,...v],{objectCaching:!1,...s});m.value.add(w),m.value.sendToBack(w)}}(),function(){var t;const e=Object.values(z),o=[],i={},r=K.find((t=>"cervix"===t.key&&t.show)),l=null==(t=null==r?void 0:r.data)?void 0:t.find((t=>3==+t.value));function s(t,e){const{key:n,range:o}=r||{},i=S(n,o,10),l=[0,e],s=[-e/t,0],a=[(A-i-e)/t,A-i],u=[W-L,t*(W-L)+e];let c=[],f=[];function p([n,o]){return Math.abs(o-t*n-e)<=1}function d([t,e]){const[n,o]=[...h([t,e])];return n>=L&&n<=W&&o>=i&&o<=A}function h([t,e]){return[L+t,A-e]}return p(l)&&d(l)&&(c=h(l)),p(s)&&d(s)&&(c=h(s)),p(a)&&d(a)&&(f=h(a)),p(u)&&d(u)&&(f=h(u)),[...c,...f]}e.forEach((t=>{if(!t.show)return;const{key:e}=t;switch(e){case"fetalPresentation":{const{range:i,show:r}=K.find((t=>t.key===e));if(r){const r=S(e,i,0);o.push(n([L,r,W,r],{...t}))}break}case"alert":if(l){const{key:e,range:a}=r||{},u=216e5,c={time:v(new Date(new Date(l.time).getTime()+u),"yyyy-MM-dd HH:mm"),value:10},[f,p]=[T(l.time)-L,A-S(e,a,l.value)],[d,h]=[T(c.time)-L,A-S(e,a,c.value)],g=(h-p)/(d-f),m=p-f*g,y=s(g,m);y.length>0&&(o.push(n(y,{...t})),Object.assign(i,{k:g,b:m}))}break;case"handling":if(l){const{k:e,b:r}=i,a=144e5,u=s(e,r-(T(v(new Date(new Date(l.time).getTime()+a),"yyyy-MM-dd HH:mm"))-T(l.time))*e);u.length>0&&o.push(n(u,{...t}))}}})),m.value.add(...o)}(),U(),function(){function t(t,e){const n=K.findIndex((e=>e.key===t.key));return{renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,dataIndex:n,key:t.key},pointer:e}}y.event.evented&&m.value.on("mouse:up",(e=>{if(3===e.button){const{x:n=0,y:o=0}=e.pointer||{};n>=L&&n<=W&&o>=Y&&o<=A&&(x.point={x:n,y:o},x.show=!0,e.target?(x.target=e.target,x.list=["删除节点"],m.value.forEachObject((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&x.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(x.target=null,x.list=["新增节点"],K.filter((t=>t.show)).forEach((i=>{if(!M(n,"key",X).includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<q)return;x.list.push(t(i,e.pointer))}})),1===x.list.length&&(x.show=!1,P(),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const t=R-B/2;function e(t,e){if(!t.length)return;let o=Y;const i=[];t.forEach((t=>{const n=t.title.split("").join("\n"),s=N.findIndex((e=>e.key===t.key)),a=new p.Text(String(n),{...r,...t.titleStyle||{},originY:"top",left:e,top:o,lineHeight:1}),u=l(t.type,{left:e,top:o+a.height+3,...t.pointAttr,originY:"top",origin:{title:t.title,unit:t.unit,type:t.type,dataIndex:s,key:t.key,isMenu:!0},originLeft:e,originTop:o+a.height+3,...y.event});o+=a.height+u.height+15,function(t){function e(t){const{left:e,top:n}=t;return e>=L&&e<=W&&n>=Y&&n<=A}t.on("moving",(()=>{t.set("originY","center"),e(t)?(tt(t),et(t)):w.show=!1})),t.on("mouseup:before",(n=>{if(w.show=!1,0===n.e.button&&e(t))if(M(t.left,"key",X).includes(t.origin.key))P();else{const e={data:{time:j(t.left),value:C(t.origin.key,t.top)},...t.origin};k("add",e),Z(e)}!function(t){t.setCoords().set({originY:"top",left:t.originLeft,top:t.originTop})}(t)}))}(u),i.push(a,u)})),n(i),m.value.add(...i)}function n(t){const e=t.at(-1),n=(A-Y)/2,o=(e.height+e.top-Y)/2;t.forEach((t=>{const e=t.top+n-o;t.set({top:e,originTop:e})}))}e(D,I/2),e(O,t)}(),{clickMenu:function({item:t,target:e}){const n={...t.origin};"remove"===t.mode?(k("remove",n),Z(n,"remove")):(Object.assign(n,{data:{time:j(t.pointer.x),value:C(t.origin.key,t.pointer.y)}}),k("add",n),Z(n))},redrawPoints:_}}export{m as useBirthProcess};
1
+ import{useBirthProcessCumputedPoint as t}from"./useCumputedPoint.js";import e from"./useGrid.js";import{drawLine as n,drawArrow as o,drawText as i,defaultTextStyle as r,drawPoint as l,defaultStyle as s,defaultRectStyle as a}from"./useDraw.js";import{getScaleInfo as u,drawScaleNumber as c,drawScaleLine as f}from"./useScaleColumn.js";import{fabric as d}from"../utils/index.js";import{useCommon as p}from"./useCommon.js";import{getIndex as h,isEffectiveNode as g}from"../utils/utils.js";import{cloneDeep as v}from"lodash-es";import{format as m}from"date-fns";function y(y,k,w,x,b){const{cumputedX:T,cumputedY:j,getXValue:C,getYValue:S}=t(k),{getEqualXTypes:M,handleAddPrevent:P}=p(y,w),{xAxis:E,grid:G,originX:L,originY:Y,xCellWidth:X,endY:A,startTime:H,leftAddAreaWidth:I,leftScales:D,rightScales:O,yCellHeight:V,endX:W,scaleValues:N,canvasWidth:R,borderStyle:$,rightAddAreaWidth:B,event:F,originYCervix:q,other:z,canvasHeight:J}=k,K=v(N),Q=new Set;function U(){K.filter((t=>t.show)).forEach(((t,e)=>{var s;const a=[],u=[],c=[];null==(s=t.data)||s.forEach(((s,f)=>{!function(s,f,d){let p,h;const{pointAttr:g={},lineAttr:v={},title:m="",key:b,type:T="circle",childbirthStyle:j={}}=t,M=t.data[d+1],P=nt(M,t);if(s&&P&&!f.breakpoint)h=n([...s,...P],{...v});else if(s&&!P&&!f.breakpoint){const e=nt(M,t);h=e?n([...s,...e],{...v}):null}let E,G;if(f.childbirth){const t=s[1]+V;E=o([s[0],s[1],t],j),c.push(E),G=i([s[0]+X/2,t-V/2],{value:String(f.childbirth),...r,originX:"left",originY:"center",...j}),c.push(G)}const L=u[d-1],Y={origin:{data:f,title:m,key:b||"",dataIndex:e,index:d},leftLine:L,rightLine:h,arrowGroup:E,arrowGroupText:G,...g,...k.event.hovered?k.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:k.event};L?p=l(T,{left:L.get("x2"),top:L.get("y2"),...Y}):s&&(Y.leftLine=null,p=l(T,{left:s[0],top:s[1],...Y}));u.push(h),p&&(!function(t){F.hovered&&(t.on("mouseover",(()=>{et(t,"hover")})),t.on("mouseout",(()=>{x.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;t.on("moving",(()=>{tt(t),function(t){var e,n,o,i;null==(e=t.leftLine)||e.setCoords().set({x2:t.left,y2:t.top}),null==(n=t.rightLine)||n.setCoords().set({x1:t.left,y1:t.top}),null==(o=t.arrowGroup)||o.setCoords().set({left:t.left,top:t.top}),null==(i=t.arrowGroupText)||i.setCoords().set({left:t.left+X/2,top:t.top+V/2})}(t),F.hovered&&et(t)})),t.on("mouseup",(e=>{if(x.show=!1,1===e.button){const{key:e}=t.origin,n={...t.origin,data:{...t.origin.data,time:C(t.left),value:S(e,t.top)}};y.value.discardActiveObject(),w("change",n),Z(n,"change")}}))}(p),a.push(p),Q.add(p))}(nt(s,t),s,f)})),Promise.all(a).then((t=>{const e=u.filter((t=>t));let n=null;t=t.filter((t=>(t&&n&&(n.nextPoint=t,t.prevPoint=n),n=t||n,t))),Promise.all(c).then((n=>{y.value.add(...e,...t,...n),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function Z(t,e="add"){const{dataIndex:n,data:o,index:i,key:r}=t,l=K.find((t=>t.key===r));switch(e){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const t=h(o.time,l.data);l.data.splice(t,0,o);break}}_()}function _(){var t;Q.size&&(null==(t=y.value)||t.remove(...function(t){const e=[];return t.forEach((t=>{t&&e.push(t),(null==t?void 0:t.leftLine)&&e.push(null==t?void 0:t.leftLine),(null==t?void 0:t.rightLine)&&e.push(null==t?void 0:t.rightLine),(null==t?void 0:t.arrowGroup)&&e.push(null==t?void 0:t.arrowGroup),(null==t?void 0:t.arrowGroupText)&&e.push(null==t?void 0:t.arrowGroupText)})),e}([...Q]))),Q.clear(),U()}function tt(t){const e=t.prevPoint?t.prevPoint.left:L,n=t.nextPoint?t.nextPoint.left:W;t.setCoords(),["cervix","fetalPresentation"].includes(t.origin.key)&&t.top<q&&t.set("top",q),t.top<Y&&t.set("top",Y),t.top>A&&t.set("top",A),t.left<e&&t.set("left",e),t.left>n&&t.set("left",n)}function et(t,e="moving"){const{title:n,key:o,data:i}=t.origin;x.point={x:t.left,y:t.top},x.list=[`${n} ${"hover"===e?i.value:S(o,t.top)}`,`时间 ${C(t.left).slice(-5)}`],x.show=!0}function nt(t,e){if(g(t)&&function(t){const e=H+864e5,n=new Date(t).getTime();return n>=H&&n<=e}(t.time)){const n=T(t.time),o=j(e.key,e.range,t.value);return[n,o<Y?Y:o>A?A:o]}}function ot(t,e){return t+1>e[1]?e[0]:t+1}return e(y,k,!0),function(){const t=new d.Rect({...$,width:R-I-B-1,height:A-1,left:I,top:0,fill:"transparent"});y.value.add(t)}(),function(){function t(t,e="left"){let n="left"===e?I:W;t.forEach(((t,e)=>{const{range:o,spaceValue:l,width:p,title:h,titleStyle:g,key:v,position:m="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:x}=t,b=[],T=[],j=n+p/2,C=function(t,e){const n=[],[o,i]=t;for(let t=o;e>0?t<=i:t>=i;t+=e)n.push(t);return n}(o,l),S=C.length;C.forEach(((e,o)=>{const{lineXMain:i,lineXSub:r,textLeft:l}=u(m,n,p),s=A-o*V*k,a=0===o?A-8:o!==C.length-1||Y||q&&"FHR"!==v?s:Y+8;!w||(0===o||o===S-1)&&!x||b.push(c(String(e),t,l,a)),T.push(...f(t,o,i,r,s,V,Y,S))}));const M=new d.Rect({...a,width:p,height:A,left:j,top:A/2}),P=i([j,Y>0?Y-V/2:V/2],{value:String(h),...r,...g}),E=new d.Group([...T,...b,M,...P?[P]:[]],{objectCaching:!1,...s});y.value.add(E),E.sendToBack(),n+=p}))}t(D),t(O,"right")}(),function(){const{show:t,startTime:e,range:n=[0,23],position:o="top",style:l}=E.time,{show:a,range:u=[0,23],position:c,style:f}=E.processTime;if(t||a){const p=[],h=[],g=[],v=[],m=L+X/2,k=V/2;for(let s=0;s<G.mainXCell;s++){if(t){const t=0===s?+e.slice(11,13):ot(p.at(-1),n);p.push(t);const a="top"===o?Y-k:A+k;g.push(i([m+s*X,a],{value:String(t),...r,...l||{}}))}if(a){const t=0===s?u[0]:h.at(-1)+1;h.push(t);const e="top"===c?k:J-k;v.push(i([m+s*X,e],{value:String(t),...r,...f||{}}))}}const w=new d.Group([...g,...v],{objectCaching:!1,...s});y.value.add(w),y.value.sendToBack(w)}}(),function(){var t;const e=Object.values(z),o=[],i={},r=K.find((t=>"cervix"===t.key&&t.show)),l=null==(t=null==r?void 0:r.data)?void 0:t.find((t=>3==+t.value));function s(t,e){const{key:n,range:o}=r||{},i=j(n,o,10),l=[0,e],s=[-e/t,0],a=[(A-i-e)/t,A-i],u=[W-L,t*(W-L)+e];let c=[],f=[];function d([n,o]){return Math.abs(o-t*n-e)<=1}function p([t,e]){const[n,o]=[...h([t,e])];return n>=L&&n<=W&&o>=i&&o<=A}function h([t,e]){return[L+t,A-e]}return d(l)&&p(l)&&(c=h(l)),d(s)&&p(s)&&(c=h(s)),d(a)&&p(a)&&(f=h(a)),d(u)&&p(u)&&(f=h(u)),[...c,...f]}e.forEach((t=>{if(!t.show)return;const{key:e}=t;switch(e){case"fetalPresentation":{const{range:i,show:r}=K.find((t=>t.key===e));if(r){const r=j(e,i,0);o.push(n([L,r,W,r],{...t}))}break}case"alert":if(l){const{key:e,range:a}=r||{},u=216e5,c={time:m(new Date(new Date(l.time).getTime()+u),"yyyy-MM-dd HH:mm"),value:10},[f,d]=[T(l.time)-L,A-j(e,a,l.value)],[p,h]=[T(c.time)-L,A-j(e,a,c.value)],g=(h-d)/(p-f),v=d-f*g,y=s(g,v);y.length>0&&(o.push(n(y,{...t})),Object.assign(i,{k:g,b:v}))}break;case"handling":if(l){const{k:e,b:r}=i,a=144e5,u=s(e,r-(T(m(new Date(new Date(l.time).getTime()+a),"yyyy-MM-dd HH:mm"))-T(l.time))*e);u.length>0&&o.push(n(u,{...t}))}}})),y.value.add(...o)}(),U(),function(){function t(t,e){const n=K.findIndex((e=>e.key===t.key));return{renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,dataIndex:n,key:t.key},pointer:e}}k.event.evented&&y.value.on("mouse:up",(e=>{if(3===e.button){const{x:n=0,y:o=0}=e.pointer||{};n>=L&&n<=W&&o>=Y&&o<=A&&(b.point={x:n,y:o},b.show=!0,e.target?(b.target=e.target,b.list=["删除节点"],y.value.forEachObject((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&b.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(b.target=null,b.list=["新增节点"],K.filter((t=>t.show)).forEach((i=>{if(!M(n,"key",X).includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<q)return;b.list.push(t(i,e.pointer))}})),1===b.list.length&&(b.show=!1,P("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const t=R-B/2;function e(t,e){if(!t.length)return;let o=Y;const i=[];t.forEach((t=>{const n=t.title.split("").join("\n"),s=N.findIndex((e=>e.key===t.key)),a=new d.Text(String(n),{...r,...t.titleStyle||{},originY:"top",left:e,top:o,lineHeight:1}),u=l(t.type,{left:e,top:o+a.height+3,...t.pointAttr,originY:"top",origin:{title:t.title,unit:t.unit,type:t.type,dataIndex:s,key:t.key,isMenu:!0},originLeft:e,originTop:o+a.height+3,...k.event});o+=a.height+u.height+15,function(t){function e(t){const{left:e,top:n}=t;return e>=L&&e<=W&&n>=Y&&n<=A}t.on("moving",(()=>{t.set("originY","center"),e(t)?(tt(t),et(t)):x.show=!1})),t.on("mouseup:before",(n=>{if(x.show=!1,0===n.e.button&&e(t))if(M(t.left,"key",X).includes(t.origin.key))P("repeat");else{const e={data:{time:C(t.left),value:S(t.origin.key,t.top)},...t.origin};w("add",e),Z(e)}!function(t){t.setCoords().set({originY:"top",left:t.originLeft,top:t.originTop})}(t)}))}(u),i.push(a,u)})),n(i),y.value.add(...i)}function n(t){const e=t.at(-1),n=(A-Y)/2,o=(e.height+e.top-Y)/2;t.forEach((t=>{const e=t.top+n-o;t.set({top:e,originTop:e})}))}e(D,I/2),e(O,t)}(),{clickMenu:function({item:t,target:e}){const n={...t.origin};"remove"===t.mode?(w("remove",n),Z(n,"remove")):(Object.assign(n,{data:{time:C(t.pointer.x),value:S(t.origin.key,t.pointer.y)}}),w("add",n),Z(n))},redrawPoints:_}}export{y as useBirthProcess};
@@ -1 +1 @@
1
- import{ref as e,reactive as a,computed as t,onMounted as l,nextTick as u}from"vue";import{defaultBorderStyle as r}from"./useDraw.js";import"date-fns";import"../utils/index.js";import"lodash-es";import"./useShadow.js";import{useEvent as i,useCanvasEvent as s}from"./useEvent.js";import{useBirthProcess as o}from"./useBirthProcess.js";import{useCommon as n}from"./useCommon.js";function d(d,v,c,h){const m=e(),p=e(),f=e(),g=a({show:!1,point:{x:0,y:0},list:[]}),x=a({show:!1,point:{x:0,y:0},list:[],target:null}),w=t((()=>v.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),y=t((()=>v.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),V=t((()=>{var e;return(null==(e=y.value)?void 0:e.length)?30:0})),A=t((()=>{var e;return 30+(null==(e=w.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),C=t((()=>{var e;const{width:a}=v.data,t=null==(e=y.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-V.value-t})),b=t((()=>v.data.grid.mainXCell)),j=t((()=>{const e=v.data.grid.mainYCell||14;return v.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),k=t((()=>(C.value-A.value)/b.value)),Y=t((()=>{const{xAxis:e,height:a}=v.data,t=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(j.value+t)})),P=t((()=>{const{xAxis:e}=v.data,a=Object.values(e).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0);return Y.value*a})),S=t((()=>{var e;const{scaleValues:a}=v.data;if(!(null==(e=a.find((e=>"FHR"===e.key)))?void 0:e.show)&&!P.value)return P.value;const t=a.find((e=>"cervix"===e.key)),[,l]=(null==t?void 0:t.range)||[0,10],u=(null==t?void 0:t.spaceValue)||1;return H.value-l*u*Y.value})),H=t((()=>{const{xAxis:e,height:a}=v.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-Y.value*t})),X=t((()=>new Date(v.data.xAxis.time.startTime).getTime())),F=t((()=>36e5/k.value)),R=t((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"cervix"===e.key));return((null==a?void 0:a.spaceValue)||1)/Y.value})),T=t((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"FHR"===e.key));return((null==a?void 0:a.spaceValue)||10)/Y.value})),W=t((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"fetalPresentation"===e.key));return((null==a?void 0:a.spaceValue)||1)/Y.value})),M=t((()=>{var e;return(null==(e=v.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),O=a({canvasWidth:v.data.width,canvasHeight:v.data.height,borderStyle:{...r,...v.data.borderStyle},selectionStyle:v.data.selectionStyle||{},grid:v.data.grid,other:v.data.other,originX:A.value,endX:C.value,originY:P.value,endY:H.value,xCellWidth:k.value,yCellHeight:Y.value,gridXNumber:b.value,gridYNumber:j.value,xAxis:v.data.xAxis,leftScales:w.value,rightScales:y.value,leftAddAreaWidth:30,rightAddAreaWidth:V.value,startTime:X.value,timeXCell:F.value,cervixYCell:R.value,FHRYCell:T.value,fetalPresentationYCell:W.value,scaleValues:v.data.scaleValues,event:M.value,originYCervix:S.value}),D=n(d);return l((()=>{u((()=>{const{clickMenu:e,redrawPoints:a}=o(d,O,c,g,x,D);p.value=a,f.value=e,i(h.value);const{select:t}=s(d,O,c);m.value=t}))})),{propItems:O,redrawPoints:p,select:m,pointTipProps:g,pointMenuProps:x,clickMenu:f}}export{d as default};
1
+ import{ref as e,reactive as a,computed as t,onMounted as l,nextTick as u}from"vue";import{defaultBorderStyle as r}from"./useDraw.js";import"date-fns";import"lodash-es";import"../utils/index.js";import"./useShadow.js";import{useEvent as i,useCanvasEvent as s}from"./useEvent.js";import{useBirthProcess as n}from"./useBirthProcess.js";function o(o,d,v,c){const h=e(),p=e(),m=e(),g=a({show:!1,point:{x:0,y:0},list:[]}),f=a({show:!1,point:{x:0,y:0},list:[],target:null}),x=t((()=>d.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),w=t((()=>d.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),y=t((()=>{var e;return(null==(e=w.value)?void 0:e.length)?30:0})),V=t((()=>{var e;return 30+(null==(e=x.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),A=t((()=>{var e;const{width:a}=d.data,t=null==(e=w.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-y.value-t})),b=t((()=>d.data.grid.mainXCell)),C=t((()=>{const e=d.data.grid.mainYCell||14;return d.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),j=t((()=>(A.value-V.value)/b.value)),k=t((()=>{const{xAxis:e,height:a}=d.data,t=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(C.value+t)})),Y=t((()=>{const{xAxis:e}=d.data,a=Object.values(e).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0);return k.value*a})),P=t((()=>{var e;const{scaleValues:a}=d.data;if(!(null==(e=a.find((e=>"FHR"===e.key)))?void 0:e.show)&&!Y.value)return Y.value;const t=a.find((e=>"cervix"===e.key)),[,l]=(null==t?void 0:t.range)||[0,10],u=(null==t?void 0:t.spaceValue)||1;return S.value-l*u*k.value})),S=t((()=>{const{xAxis:e,height:a}=d.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-k.value*t})),H=t((()=>new Date(d.data.xAxis.time.startTime).getTime())),X=t((()=>36e5/j.value)),F=t((()=>{const{scaleValues:e}=d.data,a=e.find((e=>"cervix"===e.key));return((null==a?void 0:a.spaceValue)||1)/k.value})),R=t((()=>{const{scaleValues:e}=d.data,a=e.find((e=>"FHR"===e.key));return((null==a?void 0:a.spaceValue)||10)/k.value})),T=t((()=>{const{scaleValues:e}=d.data,a=e.find((e=>"fetalPresentation"===e.key));return((null==a?void 0:a.spaceValue)||1)/k.value})),W=t((()=>{var e;return(null==(e=d.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),M=a({canvasWidth:d.data.width,canvasHeight:d.data.height,borderStyle:{...r,...d.data.borderStyle},selectionStyle:d.data.selectionStyle||{},grid:d.data.grid,other:d.data.other,originX:V.value,endX:A.value,originY:Y.value,endY:S.value,xCellWidth:j.value,yCellHeight:k.value,gridXNumber:b.value,gridYNumber:C.value,xAxis:d.data.xAxis,leftScales:x.value,rightScales:w.value,leftAddAreaWidth:30,rightAddAreaWidth:y.value,startTime:H.value,timeXCell:X.value,cervixYCell:F.value,FHRYCell:R.value,fetalPresentationYCell:T.value,scaleValues:d.data.scaleValues,event:W.value,originYCervix:P.value});return l((()=>{u((()=>{const{clickMenu:e,redrawPoints:a}=n(o,M,v,g,f);p.value=a,m.value=e,i(c.value);const{select:t}=s(o,M,v);h.value=t}))})),{propItems:M,redrawPoints:p,select:h,pointTipProps:g,pointMenuProps:f,clickMenu:m}}export{o as default};
@@ -2,15 +2,15 @@ import { type Ref } from 'vue';
2
2
  import { fabric } from '../utils';
3
3
  import { IPropItems } from '../interface';
4
4
  import { AnyObject } from '../../../../../es/shared/types';
5
- export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: Function, cumputedX: Function, cumputedY: Function, getXValue: Function, getYValue: Function, addRenderItem: Function | undefined, pointTipProps: AnyObject, pointMenuProps: AnyObject, commonFunc: AnyObject): {
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: AnyObject, pointMenuProps: AnyObject): {
6
6
  pointTipProps: AnyObject;
7
7
  pointMenuProps: AnyObject;
8
8
  clickMenu: ({ item, target }: {
9
9
  item: any;
10
10
  target: any;
11
11
  }) => void;
12
- setPopup: (point: any) => void;
12
+ setPopup: (point: any, status?: string) => void;
13
13
  isAddPoint: (x: number) => boolean;
14
- updateData: (params: any, mode?: string) => void;
14
+ updateData: (params: AnyObject, mode?: string) => void;
15
15
  redrawPoints: () => void;
16
16
  };
@@ -1 +1 @@
1
- import{fabric as e}from"../utils/index.js";import{drawLine as t,defaultStyle as i,drawPoint as n,drawText as o,drawArrow as l}from"./useDraw.js";import s from"./useGrid.js";import{useShadow as r}from"./useShadow.js";import{TEMPERATURE_MENU as a,PAIN_MENU as u,OVERLAP as p}from"./constant.js";import{cloneDeep as c}from"lodash-es";import{isOneLine as d,getType as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,getIndex as y,deleteProperty as m}from"../utils/utils.js";function b(b,x,w,L,j,k,Y,S,E,$,T){s(b,x);const{getEqualXTypes:M,repeatTip:P,maxLimitTip:O,minLimitTip:I}=T,{createShadowLines:A}=r(),{left:D,xScaleList:R,xCellWidth:C,yCellHeight:X,originX:z,endX:V,originY:F,endY:_,itemList:G,event:H,vitalSignsOriginY:q,painOriginY:W,hospitalizationDate:B,config:J,canvasHeight:K}=x,N=new Set,Q=["xinmai","mai"],U=new Map,Z=new Set,ee=new Set,te=new Set,ie=c(D.yScaleValue);function ne(t){var n;const o=ie.find((e=>"pulse"===e.type));if(o&&(null==(n=o.dataList)?void 0:n.length)&&(N.size&&b.value.remove(...N),N.clear(),U.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=U.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 U)t.push(e[1]),e[0]===Q[0]&&e[1].forEach((e=>{(U.get(Q[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],p=n[i-1],c=n[i+1],d=o[r-1],f=o[r+1];if(p&&d){if(p[0]!==d[0]){const e=Math.max(p[0],d[0]);l.push([p,d].find((t=>t[0]===e)))}}else p?l.push(p):d&&s.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const v=Math.max(a[1],u[1]);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 n,l,s,r,a,u;const p=t.map((e=>({x:e[0],y:e[1]}))),c=new e.Polygon(p,{...i,...(null==(n=o.shadow)?void 0:n.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=A(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,{...i,...(null==(t=o.shadow)?void 0:t.style)||{}}),N.add(e)})),b.value.add(...e)}N.add(c),b.value.add(c)}))}}function oe(){var e;const t=ie.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 o=Object.assign({},p,D.overlap||{}),l=[];Z.size&&[...Z].forEach((e=>{[...ee].forEach((t=>{if(t.origin&&e.left===t.left&&e.top===t.top){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...i,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(n(r,{...o[e]||{},...s}))}}}))})),setTimeout((()=>{b.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),te.add(e)}))}))}function le(e,s,r){var a;const{type:u,riseStyle:p={},noRiseStyle:c={},verifiedStyle:f={},reduceStyle:g={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:L={},nonePainPointStyle:k={},dataList:S=[]}=r,$=[],T=[],M=[];null==(a=e.list)||a.forEach(((a,P)=>{const O=d(u)?S.find((e=>e.key===a.key)):e,I=ae(a,r),A={};A.value=function(e,t,i){if(!(null==e?void 0:e.length)||!J.showValue)return;const{lineAttr:n={}}=i,l=e[1]<=q.originY+X?e[1]+X:e[1]-X,s=o([e[0],l],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return M.push(s),{obj:s,top:-X}}(I,a,O),function(e,s,a,d){var v,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(u))return;const{lineAttr:m={}}=a,{value:b}=d;let x,w,L,k,Y,S;if(s.noRise&&c.show)if(c.text)L=o([e[0],e[1]+5],{value:c.text.split("").join("\n"),originY:"top",...c.style||{}}),M.push(L);else{const t=e[1]+2*X;k=l([e[0],e[1],t],c.style||{}),M.push(k)}s.rise&&p.show&&p.text&&(Y=o([e[0],e[1]-(b?X:0)-5],{value:p.text.split("").join("\n"),originY:"bottom",...p.style||{}}),M.push(Y));s.verified&&(S=o([e[0],e[1]-(b?X:0)-5],{value:"v",originX:"center",originY:"bottom",...f}),M.push(S));if(h(s.physicsReduce)||h(s.drugReduce)){const o=j(u,r.list,null!=(v=s.physicsReduce)?v:s.drugReduce);x=t([...e,e[0],o],{...m,...g.line,...i}),w=n((null==(y=null==g?void 0:g.point)?void 0:y.type)||"circle",{left:e[0],top:o,...g.point,...i,originY:o===K?"bottom":"center"}),x&&M.push(x),w&&M.push(w)}Object.assign(d,{reduceLine:{obj:x,type:"line"},noRiseText:{obj:L,top:5},arrowGroup:{obj:k,top:2*X},riseText:{obj:Y,top:(b?-X:0)-5},verifiedText:{obj:S,top:(b?-X:0)-5},reducePoint:{obj:w,type:"reduce"}})}(I,a,O,A),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(u))return;let s,a;const{upArrowShow:p=!1,limitValueShow:c=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*X,i=[e[1]-X/2,t];t<q.originY&&(t=e[1]+2.5*X,i=[t,e[1]+X/2]),s=l([e[0],i[0],i[1]],m,"up"),M.push(s)}if(c){const i={value:t.value,originX:"center",originY:"center",...L};if(+t.value>Math.max(...r.list)){const t=s?e[1]+X/2+s.height:e[1]+X;a=o([e[0],t],i),M.push(a)}+t.value<Math.min(...r.list)&&(a=o([e[0],e[1]-X],i),M.push(a))}Object.assign(n,{upArrow:{obj:s},limitValue:{obj:a,top:-X}})}(I,a,O,A),function(i,o,l,a,p){let c,d;const{pointAttr:f={},lineAttr:h={},title:g="",key:m,type:L="circle"}=a,j=e.list[l+1],S=ae(j,r),M=se(u,e.list[l].value),P=S&&se(u,j.value);!i||!S||o.breakpoint||M||P||i[0]===S[0]||(d=t([...i,...S],{...h}));const O=o.pacemakerShow&&"pulse"==u?y.value:M?0:L,I=T[l-1],A={origin:{data:o,title:g,key:m||"",unit:r.unit,type:u,_type:v(g,u),dataIndex:s,index:l},leftLine:I,rightLine:d,otherObj:p,lockMovementX:!0,...o.pacemakerShow&&"pulse"==u?y.style:f,...x.event.hovered?x.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:x.event,...M?{selectable:!1,evented:!1,...k}:{}};if(I){const e=I.get("y2");c=n(O,{left:I.get("x2"),top:M?e-5:e,...A})}else i&&(A.leftLine=null,c=n(O,{left:i[0],top:M?i[1]-5:i[1],...A}));T.push(d),c&&(g.includes("脉搏")?Z.add(c):ee.add(c),function(e){H.hovered&&(e.on("mouseover",(()=>{re(e)})),e.on("mouseout",(()=>{E.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?W: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}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):null==i||i.setCoords().set({left:e.left,top:e.top+o}))})),ne(e)}(e),H.hovered&&re(e)})),e.on("mouseup",(t=>{if(E.show=!1,1===t.button){const{type:t}=e.origin,i=Y(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};b.value.discardActiveObject(),w("change",n),pe(n,"change")}}))}(c),$.push(c),te.add(c))}(I,a,P,O,A)})),"pulse"===u&&Q.forEach((e=>{U.set(e,$.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all($).then((e=>{const t=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(M).then((i=>{b.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&&b.value.remove(e.leftLine),e.rightLine&&b.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function re(e){const{title:t,unit:i,type:n,data:o}=e.origin;E.point={x:e.left,y:e.top},E.list=[function(){const{drugReduce:l,physicsReduce:s}=o||{},r=Y(n,e.top);if(h(l))return`药物降${"pain"==n?"痛":"温"} ${r}—>${l}${i||""}`;if(h(s))return`物理降${"pain"==n?"痛":"温"} ${r}—>${s}${i||""}`;return`${t} ${r}${i||""}`}(),`时间 ${((null==o?void 0:o.time)||k(e.left)).slice(-5)}`],E.show=!0}function ae(e,t){const i="pain"===t.type?W:q;if(g(e)&&function(e){const[t]=R,i=R.at(-1),n=t.start,o=i.end,l=new Date(e).getTime();return l>=n&&l<=o}(e.time)){const n=L(e.time),o=j(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ue(e){const t=new Date,i=`00${t.getMonth()+1}`.slice(-2),n=`00${t.getDate()}`.slice(-2),o=new Date(`${t.getFullYear()}-${i}-${n} 23:59:59`).getTime(),l=new Date(`${k(e)}:00`).getTime();return B&&l<new Date(B).getTime()?(I(),!1):!(l>o)||(O(),!1)}function pe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ie.find((e=>e.type===i));if("add"===t){const e=d(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=y(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;ce()}function ce(){var e;te.size&&(null==(e=b.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}([...te]))),U.clear(),te.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{e.dataList.forEach(((t,i)=>{d(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe()}return U.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const i=j(e.type,e.list,e.positionLine.value),n=t([z,i,V,i],e.positionLine);b.value.add(n)}(e),e.dataList.forEach(((t,i)=>{d(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe(),x.event.evented&&b.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=z&&i<=V&&n>=F&&n<=_){$.point={x:i,y:n},$.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&($.list=[...a]),"pain"===o&&($.list=[...u]),$.target=e.target;else{$.target=null,$.list=["新增节点"],G.forEach((t=>{if(!M(i,"_type",C).includes(t.bigType)){const i=["pain"].includes(t.bigType)?W:q;n>=i.originY&&n<=i.endY&&$.list.push({renderItem:S?S(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:f(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ue(i);t&&1!==$.list.length||($.show=!1,1===$.list.length&&t&&P())}}}})),{pointTipProps:E,pointMenuProps:$,clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=m(i,[...a,...u]);s[`${e.type}`]=e.value,d(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};w("change",r),pe(r,"change")}else{const t={data:{time:k(e.pointer.x),value:Y(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};w("add",t),pe(t)}},setPopup:re,isAddPoint:ue,updateData:pe,redrawPoints:ce}}export{b as useCenter};
1
+ import{fabric as e}from"../utils/index.js";import{drawLine as t,defaultStyle as i,drawPoint as n,drawText as o,drawArrow as l}from"./useDraw.js";import s from"./useGrid.js";import{useShadow as r}from"./useShadow.js";import{useCommon as a}from"./useCommon.js";import{TEMPERATURE_MENU as u,PAIN_MENU as c,OVERLAP as p}from"./constant.js";import{cloneDeep as d}from"lodash-es";import{isOneLine as f,getType as h,isOverlapPoint as v,isValidValue as g,setOtherType as y,isEffectiveNode as m,getIndex as x,deleteProperty as b}from"../utils/utils.js";function w(w,j,L,k,Y,S,E,$,M,T){s(w,j);const{getEqualXTypes:P,handleAddPrevent:O}=a(w,L),{createShadowLines:A}=r(),{left:I,xScaleList:C,xCellWidth:D,yCellHeight:R,originX:X,endX:z,originY:V,endY:F,itemList:_,event:G,vitalSignsOriginY:H,painOriginY:q,hospitalizationDate:W,config:B,canvasHeight:J}=j,K=new Set,N=["xinmai","mai"],Q=new Map,U=new Set,Z=new Set,ee=new Set,te=d(I.yScaleValue);function ie(t){var n;const o=te.find((e=>"pulse"===e.type));if(o&&(null==(n=o.dataList)?void 0:n.length)&&(K.size&&w.value.remove(...K),K.clear(),Q.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=Q.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 Q)t.push(e[1]),e[0]===N[0]&&e[1].forEach((e=>{(Q.get(N[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),a=n[i],u=o[r],c=n[i-1],p=n[i+1],d=o[r-1],f=o[r+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&&s.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const v=Math.max(a[1],u[1]);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(p&&f){if(p[0]!==f[0]){const e=Math.min(p[0],f[0]);l.push([p,f].find((t=>t[0]===e))),g()}}else p?(l.push(p),g()):f?(s.push(f),g()):g()})),e})().forEach((t=>{var n,l,s,r,a,u;const c=t.map((e=>({x:e[0],y:e[1]}))),p=new e.Polygon(c,{...i,...(null==(n=o.shadow)?void 0:n.style)||{}});if("slash"==(null==(l=o.shadow)?void 0:l.mode)){p.set({fill:"transparent",stroke:(null==(r=null==(s=o.shadow)?void 0:s.style)?void 0:r.stroke)||"#f00"});const e=A(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,{...i,...(null==(t=o.shadow)?void 0:t.style)||{}}),K.add(e)})),w.value.add(...e)}K.add(p),w.value.add(p)}))}}function ne(){var e;const t=te.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 o=Object.assign({},p,I.overlap||{}),l=[];U.size&&[...U].forEach((e=>{[...Z].forEach((t=>{if(t.origin&&v(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...i,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(n(r,{...o[e]||{},...s}))}}}))})),setTimeout((()=>{w.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ee.add(e)}))}))}function oe(e,s,r){var a;const{type:u,riseStyle:c={},noRiseStyle:p={},verifiedStyle:d={},reduceStyle:h={},pacemaker:v={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:k=[]}=r,S=[],$=[],T=[];null==(a=e.list)||a.forEach(((a,P)=>{const O=f(u)?k.find((e=>e.key===a.key)):e,A=re(a,r),I={};I.value=function(e,t,i){if(!(null==e?void 0:e.length)||!B.showValue)return;const{lineAttr:n={}}=i,l=e[1]<=H.originY+R?e[1]+R:e[1]-R,s=o([e[0],l],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return T.push(s),{obj:s,top:-R}}(A,a,O),function(e,s,a,f){var v,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(u))return;const{lineAttr:m={}}=a,{value:x}=f;let b,w,j,L,k,S;if(s.noRise&&p.show)if(p.text)j=o([e[0],e[1]+5],{value:p.text.split("").join("\n"),originY:"top",...p.style||{}}),T.push(j);else{const t=e[1]+2*R;L=l([e[0],e[1],t],p.style||{}),T.push(L)}s.rise&&c.show&&c.text&&(k=o([e[0],e[1]-(x?R:0)-5],{value:c.text.split("").join("\n"),originY:"bottom",...c.style||{}}),T.push(k));s.verified&&(S=o([e[0],e[1]-(x?R:0)-5],{value:"v",originX:"center",originY:"bottom",...d}),T.push(S));if(g(s.physicsReduce)||g(s.drugReduce)){const o=Y(u,r.list,null!=(v=s.physicsReduce)?v:s.drugReduce);b=t([...e,e[0],o],{...m,...h.line,...i}),w=n((null==(y=null==h?void 0:h.point)?void 0:y.type)||"circle",{left:e[0],top:o,...h.point,...i,originY:o===J?"bottom":"center"}),b&&T.push(b),w&&T.push(w)}Object.assign(f,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:j,top:5},arrowGroup:{obj:L,top:2*R},riseText:{obj:k,top:(x?-R:0)-5},verifiedText:{obj:S,top:(x?-R:0)-5},reducePoint:{obj:w,type:"reduce"}})}(A,a,O,I),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(u))return;let s,a;const{upArrowShow:c=!1,limitValueShow:p=!1}=i;if(c&&+t.value>180){let t=e[1]-2.5*R,i=[e[1]-R/2,t];t<H.originY&&(t=e[1]+2.5*R,i=[t,e[1]+R/2]),s=l([e[0],i[0],i[1]],m,"up"),T.push(s)}if(p){const i={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...r.list)){const t=s?e[1]+R/2+s.height:e[1]+R;a=o([e[0],t],i),T.push(a)}+t.value<Math.min(...r.list)&&(a=o([e[0],e[1]-R],i),T.push(a))}Object.assign(n,{upArrow:{obj:s},limitValue:{obj:a,top:-R}})}(A,a,O,I),function(i,o,l,a,c){let p,d;const{pointAttr:f={},lineAttr:h={},title:g="",key:m,type:x="circle"}=a,k=e.list[l+1],Y=re(k,r),T=le(u,e.list[l].value),P=Y&&le(u,k.value);!i||!Y||o.breakpoint||T||P||i[0]===Y[0]||(d=t([...i,...Y],{...h}));const O=o.pacemakerShow&&"pulse"==u?v.value:T?0:x,A=$[l-1],I={origin:{data:o,title:g,key:m||"",unit:r.unit,type:u,_type:y(g,u),dataIndex:s,index:l},leftLine:A,rightLine:d,otherObj:c,lockMovementX:!0,...o.pacemakerShow&&"pulse"==u?v.style:f,...j.event.hovered?j.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:j.event,...T?{selectable:!1,evented:!1,...b}:{}};if(A){const e=A.get("y2");p=n(O,{left:A.get("x2"),top:T?e-5:e,...I})}else i&&(I.leftLine=null,p=n(O,{left:i[0],top:T?i[1]-5:i[1],...I}));$.push(d),p&&(g.includes("脉搏")?U.add(p):Z.add(p),function(e){G.hovered&&(e.on("mouseover",(()=>{se(e,"hover")})),e.on("mouseout",(()=>{M.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?q:H;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}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):null==i||i.setCoords().set({left:e.left,top:e.top+o}))})),ie(e)}(e),G.hovered&&se(e)})),e.on("mouseup",(t=>{if(M.show=!1,1===t.button){const{type:t}=e.origin,i=E(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};w.value.discardActiveObject(),L("change",n),ue(n,"change")}}))}(p),S.push(p),ee.add(p))}(A,a,P,O,I)})),"pulse"===u&&N.forEach((e=>{Q.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(T).then((i=>{w.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&&w.value.remove(e.leftLine),e.rightLine&&w.value.remove(e.rightLine))}}(t,e)}))}))}))}function le(e,t){return"pain"===e&&0==t}function se(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;M.point={x:e.left,y:e.top},M.list=[function(){const{drugReduce:s,physicsReduce:r}=l||{},a="hover"===t?l.value:E(o,e.top);if(g(s))return`药物降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;if(g(r))return`物理降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||S(e.left)).slice(-5)}`],M.show=!0}function re(e,t){const i="pain"===t.type?q:H;if(m(e)&&function(e){const[t]=C,i=C.at(-1),n=t.start,o=i.end,l=new Date(e).getTime();return l>=n&&l<=o}(e.time)){const n=k(e.time),o=Y(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ae(e){const t=new Date,i=`00${t.getMonth()+1}`.slice(-2),n=`00${t.getDate()}`.slice(-2),o=new Date(`${t.getFullYear()}-${i}-${n} 23:59:59`).getTime(),l=new Date(`${S(e)}:00`).getTime();return W&&l<new Date(W).getTime()?(O("exceedMin"),!1):!(l>o)||(O("exceedMax"),!1)}function ue(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=te.find((e=>e.type===i));if("add"===t){const e=f(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=x(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;ce()}function ce(){var e;ee.size&&(null==(e=w.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}([...ee]))),Q.clear(),ee.clear(),U.clear(),Z.clear(),te.forEach((e=>{e.dataList.forEach(((t,i)=>{f(e.type)&&!t.enable||oe(t,i,e)}))})),ie(),ne()}return Q.clear(),U.clear(),Z.clear(),te.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const i=Y(e.type,e.list,e.positionLine.value),n=t([X,i,z,i],e.positionLine);w.value.add(n)}(e),e.dataList.forEach(((t,i)=>{f(e.type)&&!t.enable||oe(t,i,e)}))})),ie(),ne(),j.event.evented&&w.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=X&&i<=z&&n>=V&&n<=F){T.point={x:i,y:n},T.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(T.list=[...u]),"pain"===o&&(T.list=[...c]),T.target=e.target;else{T.target=null,T.list=["新增节点"],_.forEach((t=>{if(!P(i,"_type",D).includes(t.bigType)){const i=["pain"].includes(t.bigType)?q:H;n>=i.originY&&n<=i.endY&&T.list.push({renderItem:$?$(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:h(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ae(i);t&&1!==T.list.length||(T.show=!1,1===T.list.length&&t&&O("repeat"))}}}})),{pointTipProps:M,pointMenuProps:T,clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=b(i,[...u,...c]);s[`${e.type}`]=e.value,f(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};L("change",r),ue(r,"change")}else{const t={data:{time:S(e.pointer.x),value:E(e.origin.type,e.pointer.y),...f(e.origin.type)?{key:e.origin.key}:{}},...e.origin};L("add",t),ue(t)}},setPopup:se,isAddPoint:ae,updateData:ue,redrawPoints:ce}}export{w as useCenter};
@@ -1,8 +1,6 @@
1
1
  import { Ref } from 'vue';
2
2
  import { fabric } from '../utils';
3
- export declare function useCommon(canvas: Ref<fabric.Canvas>): {
3
+ export declare function useCommon(canvas: Ref<fabric.Canvas>, emits: Function): {
4
4
  getEqualXTypes: (pointX: number, field: string, range?: number) => string[];
5
- repeatTip: () => void;
6
- maxLimitTip: () => void;
7
- minLimitTip: () => void;
5
+ handleAddPrevent: (type: 'repeat' | 'exceedMax' | 'exceedMin') => void;
8
6
  };
@@ -1 +1 @@
1
- import{useMessage as n}from"naive-ui";function i(i){const t=n();return{getEqualXTypes:function(n,t,e=6){const r=[],o=e/2;return i.value.forEachObject((i=>{i.origin&&!i.origin.isMenu&&i.left>=n-o&&i.left<=n+o&&r.push(i.origin[t])})),[...new Set(r)]},repeatTip:function(){t.warning("该时段已存在数值不能新增")},maxLimitTip:function(){t.warning("未来时间不允许录入")},minLimitTip:function(){t.warning("不允许小于入院时间")}}}export{i as useCommon};
1
+ const e={repeat:"该时段已存在数值不能新增",exceedMax:"未来时间不允许录入",exceedMin:"不允许小于入院时间"};function n(n,t){return{getEqualXTypes:function(e,t,r=6){const i=[],o=r/2;return n.value.forEachObject((n=>{n.origin&&!n.origin.isMenu&&n.left>=e-o&&n.left<=e+o&&i.push(n.origin[t])})),[...new Set(i)]},handleAddPrevent:function(n){t("add:prevent",{type:n,message:e[n]})}}}export{n as useCommon};
@@ -1 +1 @@
1
- import{format as n}from"date-fns";function t(t){const{xScaleList:e,originX:i,endY:l,xCellWidth:r,left:u,vitalSignsOriginY:o,painOriginY:a,canvasWidth:c}=t;return{cumputedX:function(n,t=!1){const i=new Date(n).getTime(),[l]=e,r=e.at(-1);if(i<l.start)return 0;if(i>r.end)return c;const u=e.findIndex((n=>n.end>=i));if(u>-1){return e[u].center}},cumputedY:function(n,e,i){const l=t[`${n}YCell`],r=+i-Math.min(...e);return("pain"===n?a.endY:o.endY)-l*r},getXValue:function(t){const i=e.findIndex((n=>n.left+r>=t));if(i>-1){const l=e[i],r=t-l.left,u=l.scaleCell*r,o=l.start+u;return n(new Date(o),"yyyy-MM-dd HH:mm")}},getYValue:function(n,e){var i;const l=t[`${n}YCell`],r=(null==(i=u.yScaleValue.find((t=>t.type===n)))?void 0:i.list)||[],c=r.length?Math.min(...r):0,d=(("pain"===n?a.endY:o.endY)-e)/l+c,f=Math.floor(100*d)/100,s=f.toString().split(".");return!(null==s?void 0:s[1])||+s[1]<99?f:+s[0]+1}}}function e(t){const{xAxis:e,originX:i,originY:l,xCellWidth:r,endY:u,timeXCell:o,startTime:a,scaleValues:c}=t;return{cumputedX:function(n){return(new Date(n).getTime()-a)/o+i},cumputedY:function(n,e,i){const[l]=e;return u-(+i-l)/t[`${n}YCell`]},getXValue:function(t){return n(new Date((t-i)*o+a),"yyyy-MM-dd HH:mm")},getYValue:function(n,e){const i=c.find((t=>n===t.key)),[l]=(null==i?void 0:i.range)||[0],r=(u-e)*t[`${n}YCell`]+l;return Math.floor(100*r)/100}}}export{e as useBirthProcessCumputedPoint,t as useCumputedPoint};
1
+ import{format as n}from"date-fns";import{getFloorNumber as t}from"../utils/utils.js";function e(e){const{xScaleList:i,originX:r,endY:u,xCellWidth:l,left:c,vitalSignsOriginY:o,painOriginY:a,canvasWidth:d}=e;return{cumputedX:function(n,t=!1){const e=new Date(n).getTime(),[r]=i,u=i.at(-1);if(e<r.start)return 0;if(e>u.end)return d;const l=i.findIndex((n=>n.end>=e));if(l>-1){return i[l].center}},cumputedY:function(n,t,i){const r=e[`${n}YCell`],u=+i-Math.min(...t);return("pain"===n?a.endY:o.endY)-r*u},getXValue:function(t){const e=i.findIndex((n=>n.left+l>=t));if(e>-1){const r=i[e],u=t-r.left,l=r.scaleCell*u,c=r.start+l;return n(new Date(c),"yyyy-MM-dd HH:mm")}},getYValue:function(n,i){var r;const u=e[`${n}YCell`],l=(null==(r=c.yScaleValue.find((t=>t.type===n)))?void 0:r.list)||[],d=l.length?Math.min(...l):0,s="pain"===n?a.endY:o.endY;return t((s-i)/u+d)}}}function i(e){const{xAxis:i,originX:r,originY:u,xCellWidth:l,endY:c,timeXCell:o,startTime:a,scaleValues:d}=e;return{cumputedX:function(n){return(new Date(n).getTime()-a)/o+r},cumputedY:function(n,t,i){const[r]=t;return c-(+i-r)/e[`${n}YCell`]},getXValue:function(t){return n(new Date((t-r)*o+a),"yyyy-MM-dd HH:mm")},getYValue:function(n,i){const r=d.find((t=>n===t.key)),[u]=(null==r?void 0:r.range)||[0],l=(c-i)*e[`${n}YCell`]+u;return t(l)}}}export{i as useBirthProcessCumputedPoint,e as useCumputedPoint};
@@ -2,6 +2,6 @@ import { Ref } from 'vue';
2
2
  import { fabric } from '../utils';
3
3
  import { IPropItems } from '../interface';
4
4
  import { AnyObject } from '../../../../../es/shared/types';
5
- export declare function useLeft(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: Function, setPopup: Function, pointTipProps: AnyObject, cumputedX: Function, cumputedY: Function, getXValue: Function, getYValue: Function, isAddPoint: Function, updateData: Function, useCommon: AnyObject): {
5
+ export declare function useLeft(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: Function, setPopup: Function, pointTipProps: AnyObject, cumputedX: Function, cumputedY: Function, getXValue: Function, getYValue: Function, isAddPoint: Function, updateData: Function): {
6
6
  drawScaleValue: (yScaleValueList: any[]) => void;
7
7
  };
@@ -1 +1 @@
1
- import{fabric as t}from"../utils/index.js";import{defaultBorderStyle as e,defaultTextStyle as i,defaultStyle as n,drawPoint as o,drawTextGroup as l,defaultRectStyle as r}from"./useDraw.js";import{getScaleInfo as s,drawScaleNumber as u,drawScaleLine as a}from"./useScaleColumn.js";import{getType as h,isOneLine as g}from"../utils/utils.js";function c(c,p,d,f,y,w,v,m,S,Y,b,x){var T,X;const{getEqualXTypes:C,repeatTip:N}=x,{originY:V,endY:j,originX:L,endX:M,xCellWidth:k,yCellHeight:E,left:I,vitalSignsOriginY:G,painOriginY:H,painHeight:O,iconsWidth:W,itemList:A,painIndex:R,right:_,canvasWidth:B,canvasHeight:J,getRightInfo:$}=p;function q(o){var h;if(!(null==o?void 0:o.length))return;const{layout:g}=o[0];let p=W,d=L;"right"===g&&(p=M,d=M+(null!=(h=null==_?void 0:_.width)?h:0));const f=[],y=O&&"right"!==g?o.length-1:o.length,w=(d-p)/y,v=w+(d-p)%y;o.forEach(((o,h)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:a=5,showScale:h,showNumber:g,position:p,showMaxMinNumber:d,style:f,title:y}=n,w=l({width:L-W,height:O,...r},{value:`${y}`,...i,...f||{}},{left:W,top:H.originY}),v=[];if(h||g){const{lineXMain:i,textLeft:l}=s(p,W,L-W),r=o.length;o.forEach(((o,s)=>{let c=H.endY-s*E*a;if(0===s&&(c=j-5),!g||(0===s||s===r-1)&&!d||v.push(u(o,n,l,c)),h&&0!==s){const[n,o]=i,l=new t.Line([n,c,o,c],{...e,...f});v.push(l)}}))}c.value.add(w,...v),w.sendToBack()}(o);const d=[],y=0===h?v:w,m=0===h?p:v+p+(h-1)*w,S="right"===g?0:G.originY,Y="right"===g?J:G.endY,b=h>0?new t.Line([m,S,m,Y],{...e}):null;b&&d.push(b);const x=m+y/2,{list:T=[],spaceGridNumber:X=5,showScale:C,showNumber:N,position:V,showMaxMinNumber:M}=o;if(C||N){const{lineXMain:t,lineXSub:e,textLeft:i}=s(V,m,y),n=T.length;T.forEach(((l,r)=>{const s=G.endY-r*E*X;if(N&&(!(0===r||r===n-1)||M)){const t=0==r?s-5:s,e=u(l,o,i,t),n=G.originY+e.height/2;t<n&&e.set({top:n}),d.push(e)}d.push(...a(o,r,t,e,s,E,G.originY))}))}let k=o.title||"";o.unit&&(k+="\n"+o.unit),k&&d.push(new t.Text(String(k),{...i,left:x,top:G.originY+E*X/2,textAlign:"center",...o.style}));const I=new t.Group(d,{...n,objectCaching:!1});f.push(I)}));const m=f.length>0?new t.Group([...f],{...n,objectCaching:!1}):null;m&&c.value.add(m),m&&m.sendToBack()}function z(t){return t.left>=L&&t.left<M&&t.top>=V&&t.top<=j}W&&function(){const e=JSON.parse(JSON.stringify(A));let i=j;const l=W-I.icons.marginRight;e.reverse().forEach((e=>{i-=10;let r=e.title.replace(/(.{2})/g,"$1\n");r.endsWith("\n")&&(r=r.slice(0,r.length-1));const s=new t.Text(String(r),{...n,objectCaching:!1,...e.titleStyle||{},originX:"right",originY:"bottom",left:l-(e.pointAttr.width||10)-5,top:i,lineHeight:1,fontSize:12}),u=o(e.type,{left:l,top:i-(s.height||30)/2-1,...e.pointAttr,originY:"center",originX:"right",origin:{title:e.title,unit:e.unit,type:h(e.bigType),_type:e.bigType,dataIndex:e.dataIndex,key:e.key,isMenu:!0},originLeft:l,originTop:i-(s.height||30)/2-1,...p.event});var a;i-=s.height||30,(a=u).on("moving",(()=>{a.set("originX","center"),function(t){if(t.left>=L&&t.left<=M){t.setCoords();const e="pain"===t.origin.type?H:G;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(a),z(a)?f(a):y.show=!1})),a.on("mouseup:before",(t=>{if(y.show=!1,0===t.e.button&&z(a)){const t=C(a.left,"_type",k).includes(a.origin._type),e=Y(a.left);if(!e||t)t&&e&&N();else{const t={data:{time:m(a.left),value:S(a.origin.type,a.top),...g(a.origin.type)?{key:a.origin.key}:{}},...a.origin};d("add",t),b(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(a)})),c.value.add(s,u)}))}();const D=I.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==_?void 0:_.width)&&"left"===(null==(T=null==_?void 0:_.yScaleValue)?void 0:T.layout)&&(null==(X=null==_?void 0:_.yScaleValue)?void 0:X.show)&&D.push($),R>0&&I.yScaleValue[R].show){const t=I.yScaleValue[R];0===R&&I.yScaleValue.length>1&&D.unshift(t),R==I.yScaleValue.length-1&&D.push(t)}const F=D.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),K=D[F];return F>-1&&D.splice(F,0,{...K,title:(null==K?void 0:K.doubleTitle)||(null==K?void 0:K.title)}),q(D),c.value.add(new t.Rect({left:W,top:0,width:B-W-1,height:J-1,fill:"transparent",...e})),{drawScaleValue:q}}export{c as useLeft};
1
+ import{fabric as t}from"../utils/index.js";import{defaultBorderStyle as e,defaultTextStyle as i,defaultStyle as n,drawPoint as o,drawTextGroup as l,defaultRectStyle as r}from"./useDraw.js";import{useCommon as s}from"./useCommon.js";import{getScaleInfo as u,drawScaleNumber as a,drawScaleLine as h}from"./useScaleColumn.js";import{getType as g,isOneLine as c}from"../utils/utils.js";function p(p,d,f,y,w,v,m,S,Y,b,x){var T,X;const{getEqualXTypes:C,handleAddPrevent:j}=s(p,f),{originY:N,endY:V,originX:L,endX:M,xCellWidth:k,yCellHeight:E,left:I,vitalSignsOriginY:A,painOriginY:G,painHeight:H,iconsWidth:O,itemList:W,painIndex:R,right:_,canvasWidth:B,canvasHeight:J,getRightInfo:$}=d;function q(o){var s;if(!(null==o?void 0:o.length))return;const{layout:g}=o[0];let c=O,d=L;"right"===g&&(c=M,d=M+(null!=(s=null==_?void 0:_.width)?s:0));const f=[],y=H&&"right"!==g?o.length-1:o.length,w=(d-c)/y,v=w+(d-c)%y;o.forEach(((o,s)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:s=5,showScale:h,showNumber:g,position:c,showMaxMinNumber:d,style:f,title:y}=n,w=l({width:L-O,height:H,...r},{value:`${y}`,...i,...f||{}},{left:O,top:G.originY}),v=[];if(h||g){const{lineXMain:i,textLeft:l}=u(c,O,L-O),r=o.length;o.forEach(((o,u)=>{let c=G.endY-u*E*s;if(0===u&&(c=V-5),!g||(0===u||u===r-1)&&!d||v.push(a(o,n,l,c)),h&&0!==u){const[n,o]=i,l=new t.Line([n,c,o,c],{...e,...f});v.push(l)}}))}p.value.add(w,...v),w.sendToBack()}(o);const d=[],y=0===s?v:w,m=0===s?c:v+c+(s-1)*w,S="right"===g?0:A.originY,Y="right"===g?J:A.endY,b=s>0?new t.Line([m,S,m,Y],{...e}):null;b&&d.push(b);const x=m+y/2,{list:T=[],spaceGridNumber:X=5,showScale:C,showNumber:j,position:N,showMaxMinNumber:M}=o;if(C||j){const{lineXMain:t,lineXSub:e,textLeft:i}=u(N,m,y),n=T.length;T.forEach(((l,r)=>{const s=A.endY-r*E*X;if(j&&(!(0===r||r===n-1)||M)){const t=0==r?s-5:s,e=a(l,o,i,t),n=A.originY+e.height/2;t<n&&e.set({top:n}),d.push(e)}d.push(...h(o,r,t,e,s,E,A.originY))}))}let k=o.title||"";o.unit&&(k+="\n"+o.unit),k&&d.push(new t.Text(String(k),{...i,left:x,top:A.originY+E*X/2,textAlign:"center",...o.style}));const I=new t.Group(d,{...n,objectCaching:!1});f.push(I)}));const m=f.length>0?new t.Group([...f],{...n,objectCaching:!1}):null;m&&p.value.add(m),m&&m.sendToBack()}function z(t){return t.left>=L&&t.left<M&&t.top>=N&&t.top<=V}O&&function(){const e=JSON.parse(JSON.stringify(W));let i=V;const l=O-I.icons.marginRight;e.reverse().forEach((e=>{i-=10;let r=e.title.replace(/(.{2})/g,"$1\n");r.endsWith("\n")&&(r=r.slice(0,r.length-1));const s=new t.Text(String(r),{...n,objectCaching:!1,...e.titleStyle||{},originX:"right",originY:"bottom",left:l-(e.pointAttr.width||10)-5,top:i,lineHeight:1,fontSize:12}),u=o(e.type,{left:l,top:i-(s.height||30)/2-1,...e.pointAttr,originY:"center",originX:"right",origin:{title:e.title,unit:e.unit,type:g(e.bigType),_type:e.bigType,dataIndex:e.dataIndex,key:e.key,isMenu:!0},originLeft:l,originTop:i-(s.height||30)/2-1,...d.event});var a;i-=s.height||30,(a=u).on("moving",(()=>{a.set("originX","center"),function(t){if(t.left>=L&&t.left<=M){t.setCoords();const e="pain"===t.origin.type?G:A;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(a),z(a)?y(a):w.show=!1})),a.on("mouseup:before",(t=>{if(w.show=!1,0===t.e.button&&z(a)){const t=C(a.left,"_type",k).includes(a.origin._type),e=b(a.left);if(!e||t)t&&e&&j("repeat");else{const t={data:{time:S(a.left),value:Y(a.origin.type,a.top),...c(a.origin.type)?{key:a.origin.key}:{}},...a.origin};f("add",t),x(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(a)})),p.value.add(s,u)}))}();const D=I.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==_?void 0:_.width)&&"left"===(null==(T=null==_?void 0:_.yScaleValue)?void 0:T.layout)&&(null==(X=null==_?void 0:_.yScaleValue)?void 0:X.show)&&D.push($),R>0&&I.yScaleValue[R].show){const t=I.yScaleValue[R];0===R&&I.yScaleValue.length>1&&D.unshift(t),R==I.yScaleValue.length-1&&D.push(t)}const P=D.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),F=D[P];return P>-1&&D.splice(P,0,{...F,title:(null==F?void 0:F.doubleTitle)||(null==F?void 0:F.title)}),q(D),p.value.add(new t.Rect({left:O,top:0,width:B-O-1,height:J-1,fill:"transparent",...e})),{drawScaleValue:q}}export{p as useLeft};
@@ -1 +1 @@
1
- import{ref as e,reactive as t,computed as a,onMounted as l,nextTick as u}from"vue";import{defaultBorderStyle as i}from"./useDraw.js";import{useCumputedPoint as n}from"./useCumputedPoint.js";import{useTop as r}from"./useTop.js";import{useLeft as o}from"./useLeft.js";import{useRight as s}from"./useRight.js";import{useCenter as d}from"./useCenter.js";import{useBottom as v}from"./useBottom.js";import{useOther as c}from"./useOther.js";import{useEvent as p,useCanvasEvent as h}from"./useEvent.js";import"../utils/index.js";import{setOtherType as g}from"../utils/utils.js";import"lodash-es";import"date-fns";import{useCommon as m}from"./useCommon.js";function f(f,y,Y,S){const w=15,b=e(),C=e(),x=e(),j=t({show:!1,point:{x:0,y:0},list:[]}),D=t({show:!1,point:{x:0,y:0},list:[],target:null}),V=a((()=>{const{top:e}=y.data;return e.date.show&&(e.date.height||w)||0})),X=a((()=>{var e;const{top:t}=y.data;return(null==(e=t.hospitalDays)?void 0:e.show)&&(t.hospitalDays.height||w)||0})),H=a((()=>{var e;const{top:t}=y.data;return(null==(e=t.operationDays)?void 0:e.show)&&(t.operationDays.height||w)||0})),L=a((()=>{var e,t,a;const{top:l}=y.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||w)||0)+((null==(t=l.xScalevalue)?void 0:t.show)&&null!=(a=l.dayHeight)?a:0)})),P=a((()=>{var e;const{bottom:t}=y.data;return(null==(e=null==t?void 0:t.breathing)?void 0:e.show)&&(t.breathing.height||30)||0})),$=a((()=>{const{grid:e}=y.data;return e.mainXCell*e.subXCell+e.surplusXCell})),I=a((()=>{const{grid:e}=y.data;return e.mainYCell*e.subYCell+e.surplusYCell})),N=a((()=>{var e;const{width:t,right:a=null,top:l}=y.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),T=a((()=>{const{grid:e}=y.data;return N.value-e.surplusXCell*G.value})),M=a((()=>{const{top:e,left:t}=y.data;return e.titleWidth+q.value})),O=a((()=>{const{bottom:e=null,height:t}=y.data;if(!e)return t;return t-(e.height||30)})),W=a((()=>{var e;const{top:t}=y.data,a=t.xScalevalue.show&&(null!=(e=t.dayHeight)?e:0)||0,l=t.xScalevalue.show&&(t.xScalevalue.height||w)||0;return V.value+a+l+X.value+H.value})),k=a((()=>{const{grid:e}=y.data;return W.value+e.surplusYCell*R.value})),G=a((()=>(N.value-M.value)/$.value)),R=a((()=>(O.value-W.value)/I.value)),q=a((()=>{var e,t;const{left:a}=y.data;return(null==(e=a.icons)?void 0:e.show)&&((null==(t=a.icons)?void 0:t.width)||100)||0})),z=a((()=>{var e,t;const{top:a,grid:l}=y.data,u=(null==(t=null==(e=a.date.list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],i=a.xScalevalue.times;let n=M.value-G.value;function r(e){const[t="2022",a="01",l="01"]=String(e).match(/\d+/g)||[];return`20${t}`.slice(-4)+"-"+`00${a}`.slice(-2)+"-"+`00${l}`.slice(-2)}return u.map((e=>i.map((t=>{n+=G.value;const a=new Date(`${r(e)} ${t.start}`).getTime(),l=new Date(`${r(e)} ${t.end}`).getTime();return{start:a,end:l,left:n,center:n+G.value/2,scaleCell:(l-a)/G.value}})))).flat()})),A=a((()=>le("breathe"))),B=a((()=>le("pulse"))),E=a((()=>le("temperature"))),F=a((()=>le("pain"))),J=a((()=>{var e;return(null==(e=y.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),K=a((()=>{const{left:e}=y.data;return e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:g(t.title,e.type),unit:e.unit,dataIndex:a}))))).flat()})),Q=a((()=>{const{left:e}=y.data;return e.yScaleValue.findIndex((e=>"pain"===e.type))})),U=a((()=>{const{grid:e}=y.data;return-1===Q.value?0:R.value*e.subYCell})),Z=a((()=>{const{left:e}=y.data,t={originY:O.value,endY:O.value};return 0===Q.value&&e.yScaleValue.length>1?(t.originY=k.value,t.endY=k.value+U.value):Q.value===e.yScaleValue.length-1&&(t.originY=O.value-U.value,t.endY=O.value),t})),_=a((()=>{const{left:e}=y.data,t={originY:W.value,endY:O.value};return 0===Q.value&&e.yScaleValue.length>1?(t.originY=k.value+U.value,t.endY=O.value):Q.value===e.yScaleValue.length-1&&(t.originY=k.value,t.endY=O.value-U.value),t})),ee=a((()=>{var e,t;const{top:a,grid:l}=y.data,u=[];for(const i in a)a[i].show&&u.push({...a[i],list:(null==(t=null==(e=a[i].list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,t)=>e.seq-t.seq))})),te=a((()=>{var e;const{left:t,right:a}=y.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=>Math.floor(100*(1.8*e+32))/100)),spaceGridNumber:l.spaceGridNumber}),u})),ae=t({canvasWidth:y.data.width,canvasHeight:y.data.height,borderStyle:y.data.borderStyle||i,selectionStyle:y.data.selectionStyle||{},dateHeight:V.value,hospitalDaysHeight:X.value,operationDaysHeight:H.value,xScalevalueHeight:L.value,topList:ee.value,breathingHeight:P.value,hospitalizationDate:y.data.hospitalizationDate,grid:y.data.grid,top:y.data.top,left:y.data.left,right:y.data.right,bottom:y.data.bottom,other:y.data.other,painIndex:Q.value,painHeight:U.value,painOriginY:Z.value,vitalSignsOriginY:_.value,gridXNumber:$.value,gridYNumber:I.value,iconsWidth:q.value,originX:M.value,originY:W.value,originYLimit:k.value,endX:N.value,endXLimit:T.value,endY:O.value,xCellWidth:G.value,yCellHeight:R.value,xScaleList:z.value,breatheYCell:A.value,pulseYCell:B.value,temperatureYCell:E.value,painYCell:F.value,event:J.value,itemList:K.value,getRightInfo:te.value,config:y.data.config||{}});function le(e){const{yScaleValue:t}=y.data.left,a=t.find((t=>t.type===e)),l=(null==a?void 0:a.list)||[];return l.length?R.value/((l[1]-l[0])/a.spaceGridNumber):0}const{cumputedX:ue,cumputedY:ie,getXValue:ne,getYValue:re}=n(ae),oe=m(f);return l((()=>{u((()=>{r(f,ae);const{setPopup:e,isAddPoint:t,updateData:a,redrawPoints:l,clickMenu:u}=d(f,ae,Y,ue,ie,ne,re,y.addRenderItem,j,D,oe);C.value=l,x.value=u;const{drawScaleValue:i}=o(f,ae,Y,e,j,ue,ie,ne,re,t,a,oe);s(f,ae,i),v(f,ae),c(f,ae,ue),p(S.value);const{select:n}=h(f,ae,Y);b.value=n}))})),{propItems:ae,redrawPoints:C,select:b,pointTipProps:j,pointMenuProps:D,clickMenu:x}}export{f as default};
1
+ import{ref as e,reactive as t,computed as a,onMounted as l,nextTick as u}from"vue";import{defaultBorderStyle as i}from"./useDraw.js";import{useCumputedPoint as n}from"./useCumputedPoint.js";import{useTop as r}from"./useTop.js";import{useLeft as o}from"./useLeft.js";import{useRight as s}from"./useRight.js";import{useCenter as d}from"./useCenter.js";import{useBottom as v}from"./useBottom.js";import{useOther as c}from"./useOther.js";import{useEvent as p,useCanvasEvent as h}from"./useEvent.js";import"../utils/index.js";import{setOtherType as g,getFloorNumber as m}from"../utils/utils.js";import"lodash-es";import"date-fns";function f(f,y,Y,S){const w=15,b=e(),C=e(),x=e(),j=t({show:!1,point:{x:0,y:0},list:[]}),D=t({show:!1,point:{x:0,y:0},list:[],target:null}),V=a((()=>{const{top:e}=y.data;return e.date.show&&(e.date.height||w)||0})),X=a((()=>{var e;const{top:t}=y.data;return(null==(e=t.hospitalDays)?void 0:e.show)&&(t.hospitalDays.height||w)||0})),H=a((()=>{var e;const{top:t}=y.data;return(null==(e=t.operationDays)?void 0:e.show)&&(t.operationDays.height||w)||0})),L=a((()=>{var e,t,a;const{top:l}=y.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||w)||0)+((null==(t=l.xScalevalue)?void 0:t.show)&&null!=(a=l.dayHeight)?a:0)})),P=a((()=>{var e;const{bottom:t}=y.data;return(null==(e=null==t?void 0:t.breathing)?void 0:e.show)&&(t.breathing.height||30)||0})),$=a((()=>{const{grid:e}=y.data;return e.mainXCell*e.subXCell+e.surplusXCell})),I=a((()=>{const{grid:e}=y.data;return e.mainYCell*e.subYCell+e.surplusYCell})),N=a((()=>{var e;const{width:t,right:a=null,top:l}=y.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),T=a((()=>{const{grid:e}=y.data;return N.value-e.surplusXCell*M.value})),O=a((()=>{const{top:e,left:t}=y.data;return e.titleWidth+q.value})),W=a((()=>{const{bottom:e=null,height:t}=y.data;if(!e)return t;return t-(e.height||30)})),k=a((()=>{var e;const{top:t}=y.data,a=t.xScalevalue.show&&(null!=(e=t.dayHeight)?e:0)||0,l=t.xScalevalue.show&&(t.xScalevalue.height||w)||0;return V.value+a+l+X.value+H.value})),G=a((()=>{const{grid:e}=y.data;return k.value+e.surplusYCell*R.value})),M=a((()=>(N.value-O.value)/$.value)),R=a((()=>(W.value-k.value)/I.value)),q=a((()=>{var e,t;const{left:a}=y.data;return(null==(e=a.icons)?void 0:e.show)&&((null==(t=a.icons)?void 0:t.width)||100)||0})),z=a((()=>{var e,t;const{top:a,grid:l}=y.data,u=(null==(t=null==(e=a.date.list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],i=a.xScalevalue.times;let n=O.value-M.value;function r(e){const[t="2022",a="01",l="01"]=String(e).match(/\d+/g)||[];return`20${t}`.slice(-4)+"-"+`00${a}`.slice(-2)+"-"+`00${l}`.slice(-2)}return u.map((e=>i.map((t=>{n+=M.value;const a=new Date(`${r(e)} ${t.start}`).getTime(),l=new Date(`${r(e)} ${t.end}`).getTime();return{start:a,end:l,left:n,center:n+M.value/2,scaleCell:(l-a)/M.value}})))).flat()})),A=a((()=>le("breathe"))),B=a((()=>le("pulse"))),E=a((()=>le("temperature"))),F=a((()=>le("pain"))),J=a((()=>{var e;return(null==(e=y.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),K=a((()=>{const{left:e}=y.data;return e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:g(t.title,e.type),unit:e.unit,dataIndex:a}))))).flat()})),Q=a((()=>{const{left:e}=y.data;return e.yScaleValue.findIndex((e=>"pain"===e.type))})),U=a((()=>{const{grid:e}=y.data;return-1===Q.value?0:R.value*e.subYCell})),Z=a((()=>{const{left:e}=y.data,t={originY:W.value,endY:W.value};return 0===Q.value&&e.yScaleValue.length>1?(t.originY=G.value,t.endY=G.value+U.value):Q.value===e.yScaleValue.length-1&&(t.originY=W.value-U.value,t.endY=W.value),t})),_=a((()=>{const{left:e}=y.data,t={originY:k.value,endY:W.value};return 0===Q.value&&e.yScaleValue.length>1?(t.originY=G.value+U.value,t.endY=W.value):Q.value===e.yScaleValue.length-1&&(t.originY=G.value,t.endY=W.value-U.value),t})),ee=a((()=>{var e,t;const{top:a,grid:l}=y.data,u=[];for(const i in a)a[i].show&&u.push({...a[i],list:(null==(t=null==(e=a[i].list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,t)=>e.seq-t.seq))})),te=a((()=>{var e;const{left:t,right:a}=y.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=>m(1.8*e+32))),spaceGridNumber:l.spaceGridNumber}),u})),ae=t({canvasWidth:y.data.width,canvasHeight:y.data.height,borderStyle:y.data.borderStyle||i,selectionStyle:y.data.selectionStyle||{},dateHeight:V.value,hospitalDaysHeight:X.value,operationDaysHeight:H.value,xScalevalueHeight:L.value,topList:ee.value,breathingHeight:P.value,hospitalizationDate:y.data.hospitalizationDate,grid:y.data.grid,top:y.data.top,left:y.data.left,right:y.data.right,bottom:y.data.bottom,other:y.data.other,painIndex:Q.value,painHeight:U.value,painOriginY:Z.value,vitalSignsOriginY:_.value,gridXNumber:$.value,gridYNumber:I.value,iconsWidth:q.value,originX:O.value,originY:k.value,originYLimit:G.value,endX:N.value,endXLimit:T.value,endY:W.value,xCellWidth:M.value,yCellHeight:R.value,xScaleList:z.value,breatheYCell:A.value,pulseYCell:B.value,temperatureYCell:E.value,painYCell:F.value,event:J.value,itemList:K.value,getRightInfo:te.value,config:y.data.config||{}});function le(e){const{yScaleValue:t}=y.data.left,a=t.find((t=>t.type===e)),l=(null==a?void 0:a.list)||[];return l.length?R.value/((l[1]-l[0])/a.spaceGridNumber):0}const{cumputedX:ue,cumputedY:ie,getXValue:ne,getYValue:re}=n(ae);return l((()=>{u((()=>{r(f,ae);const{setPopup:e,isAddPoint:t,updateData:a,redrawPoints:l,clickMenu:u}=d(f,ae,Y,ue,ie,ne,re,y.addRenderItem,j,D);C.value=l,x.value=u;const{drawScaleValue:i}=o(f,ae,Y,e,j,ue,ie,ne,re,t,a);s(f,ae,i),v(f,ae),c(f,ae,ue),p(S.value);const{select:n}=h(f,ae,Y);b.value=n}))})),{propItems:ae,redrawPoints:C,select:b,pointTipProps:j,pointMenuProps:D,clickMenu:x}}export{f as default};
@@ -12,3 +12,5 @@ export declare function isOneLine(type: string): boolean;
12
12
  export declare function setOtherType(title: string, type: string): string;
13
13
  export declare function getType(type: string): string;
14
14
  export declare function isValidValue(value: number | string): boolean;
15
+ export declare function isOverlapPoint(pointObj1: any, pointObj2: any): boolean;
16
+ export declare function getFloorNumber(value: number, n?: number): number;
@@ -1 +1 @@
1
- import{isNull as n}from"lodash-es";function e(n){return(null==n?void 0:n.time)&&((null==n?void 0:n.value)||0===(null==n?void 0:n.value))}function t(n,e){const t={};for(const u in n)e.map((n=>n.type)).includes(u)||(t[u]=n[u]);return t}function u(n,e){const t=e.findIndex((e=>new Date(e.time).getTime()>new Date(n).getTime()));return~t?t:e.length}function i(n){return["temperature","pulse"].includes(n)}function r(n,e){return n.includes("心率")?"pulse_other":e}function o(n){return n.includes("_other")?n.split("_")[0]:n}function l(e){return!Number.isNaN(+e)&&!n(e)}export{t as deleteProperty,u as getIndex,o as getType,e as isEffectiveNode,i as isOneLine,l as isValidValue,r as setOtherType};
1
+ import{isNull as n}from"lodash-es";function t(n){return(null==n?void 0:n.time)&&((null==n?void 0:n.value)||0===(null==n?void 0:n.value))}function e(n,t){const e={};for(const u in n)t.map((n=>n.type)).includes(u)||(e[u]=n[u]);return e}function u(n,t){const e=t.findIndex((t=>new Date(t.time).getTime()>new Date(n).getTime()));return~e?e:t.length}function r(n){return["temperature","pulse"].includes(n)}function o(n,t){return n.includes("心率")?"pulse_other":t}function i(n){return n.includes("_other")?n.split("_")[0]:n}function l(t){return!Number.isNaN(+t)&&!n(t)}function c(n,t){return f(n.left,1)===f(t.left,1)&&f(n.top,1)===f(t.top,1)}function f(n,t=100){return Math.floor(n*t)/t}export{e as deleteProperty,f as getFloorNumber,u as getIndex,i as getType,t as isEffectiveNode,r as isOneLine,c as isOverlapPoint,l as isValidValue,o as setOtherType};
@@ -1 +1 @@
1
- function n(n,l,u=[]){const a=n[l.columnName];return Array.isArray(a)?a.map((n=>i(n))).join(","):i(a);function i(n){return l=r(u)||[],(null==(a=null==l?void 0:l.find((r=>r.value==n)))?void 0:a.label)||n||"";var l,a}}function r(n){return Array.isArray(n)&&!n.length?null:n}export{r as getArray,n as getDefaultValue};
1
+ function n(n,l,u=[]){const a=n[l.columnName];return Array.isArray(a)?a.map((n=>i(n))).join(","):i(a);function i(n){return l=r(u)||[],null!=(i=null==(a=null==l?void 0:l.find((r=>r.value==n)))?void 0:a.label)?i:n;var l,a,i}}function r(n){return Array.isArray(n)&&!n.length?null:n}export{r as getArray,n as getDefaultValue};
@@ -1 +1 @@
1
- import{defineComponent as e,reactive as t,ref as a,watch as o,nextTick as i,openBlock as l,createElementBlock as n,createCommentVNode as s,Fragment as r,unref as u,createBlock as c,mergeProps as p,createElementVNode as d,normalizeClass as m,normalizeStyle as v,createVNode as f,withCtx as g,renderList as y,toDisplayString as b,createTextVNode as k,resolveDynamicComponent as C,h as S}from"vue";import h from"./hooks/use-noData.js";import{getScaleViewState as w}from"./hooks/scaleview-state.js";import{ScaleViewComputed as E}from"./hooks/scaleview-computed.js";import{ScaleViewInit as _}from"./hooks/scaleview-init.js";import{ScaleViewSubmit as A}from"./hooks/scaleview-submit.js";import{handleQueryParams as O,isCollection as j,isEvaluation as T}from"./utils/judge-types.js";import{useEvent as L}from"./hooks/use-event.js";import P from"./components/NoData.vue.js";import D from"./components/EvaluateCountdown.vue.js";import F from"./components/EvaluatePage.vue.js";import B from"./components/AnswerParse.vue.js";import N from"./components/ScaleScore.js";import{useDialog as x,useMessage as I,NForm as q,NFormItem as M,NButton as R}from"naive-ui";import K from"../../../_virtual/plugin-vue_export-helper.js";const V={class:"c-scale-view-block"},H=["innerHTML"],U={key:0,class:"required-text"},W={key:1,class:"evalute-label"},J=["onClick"],Y=d("i",{class:"scale-view-iconfont icon-scale-view-dengpao"},null,-1),X={key:1,class:"footer"};var G=K(e({__name:"ScaleView",props:{guageData:{type:Object,default:()=>({})},styleSetting:{type:Object,default:()=>({})},ids:{type:Object,default:()=>({guage_id:"",db_id:void 0})},params:{default:()=>({}),type:Object},noBtn:{type:[Boolean,String,Number],default:!1},hideBtn:{type:[Boolean,String,Number],default:!1},isLock:{type:[Boolean,String,Number],default:!1},type:{type:String,default:""},openType:{type:String,default:""},scaleApiConfig:{type:Object,default:()=>({})},getSelectOptions:{type:Function,default:()=>Promise.resolve([])},getSearchOptions:{type:Function,default:()=>Promise.resolve([])},getCascadeOptions:{type:Function,default:()=>Promise.resolve([])},getLabelList:{type:Function,default:()=>Promise.resolve([])},deleteLabel:{type:Function,default:()=>Promise.resolve({status:!0})},saveLabelItem:{type:Function,default:()=>Promise.resolve({status:!0})},uploadPictureUrl:{type:String,default:""},uploadFileUrl:{type:String,default:""},ak:{type:String,default:"KP3BZ-OAC3W-PY6RY-OJ6DV-JYKN3-H6F72"},sourceType:{type:String,default:""},getChunkUploadConfig:{type:Function,default:()=>Promise.resolve({})}},emits:["onCloseSetting","submitNoRequest","onSubmit","startWriteScale"],setup(e,{expose:K,emit:G}){const Q=e,{ScaleViewState:Z}=w(),$=t(Z),z=x(),ee=I(),te=a(null),ae=a(null),{noDataState:oe,setNoData:ie,resetNodata:le}=h(),ne=O(),{showEvatip:se,isFormBoldOpen:re,scaleStyle:ue,handlePageClass:ce,isShowItem:pe,handleShowQuestionNumber:de,hasScore:me,isPreviewScale:ve,showEvaluateEntry:fe,showEvaluateCoundownPage:ge,showSaveBtn:ye,showEvaluateLabel:be,showAnswerParse:ke,propsConfig:Ce,evaluatePageProps:Se,evaluateCountdownProps:he,skipCover:we,scaleEdit:Ee}=E(Q,$,{query:ne}),{initForm:_e}=_(Q,$,G,{query:ne}),{submitMethod:Ae}=A(Q,$,G,{query:ne}),{nextLogicEvent:Oe,handleDynamicDataRelation:je}=L(Q,$);(()=>{let{id:e}=ne;e&&($.shareId=e)})();const Te=e=>{try{le(),_e(e)}catch(e){console.log(e,"--error"),$.spinning=!1,$.hasFrontAddress=!1,ie(!0,null==e?void 0:e.resultMsg,null==e?void 0:e.result)}};o((()=>Q.ids),((e,t)=>{t?e.guage_id&&e.guage_id!=t.guage_id&&Te(e):e.guage_id&&Te(e)}),{immediate:!0}),o((()=>Q.guageData),(e=>{if(!e||!Object.keys(e||{}).length)return;$.form={},$.formArray=[];const t=JSON.parse(JSON.stringify(e));i((()=>{_e(t)}))}),{immediate:!0});const Le=e=>{$.showEvaluateSettingWrap=!1,$.showEvaluateCountdown=!!e,G("startWriteScale")},Pe=()=>{console.log("----closeEvaluateCountdown"),$.showEvaluateCountdown=!1,ve.value||($.banSubmit=!0,Ae(),z.warning({title:"温馨提示",content:"测评时间到了,结束测评!",maskClosable:!1,positiveText:"确定",onPositiveClick:()=>({})}))},De=e=>{z.warning({title:"提示",content:()=>S("div",{class:"evatip-container"},[S("span","答案解析:"),S("p",e)]),class:"c-evatip-dialog-wrap",showIcon:!1,positiveText:"确定",negativeText:"关闭",maskClosable:!1,onPositiveClick(){},onNegativeClick(){}})},Fe=(e,t,a)=>{console.log(e,"--val");let{choiceObj:o,isSetObj:i}=a||{};switch(t.type.includes("SELECT")||($.form[t.val_key]=e),t.type){case"SELECT":case"EVALUATE_SELECT":{let{value:a,list:o=[]}=e;$.form[t.val_key]=a,Oe(e,t,$.formArray),je(o,t,$.formArray)}break;case"RADIO_BLOCK":case"CHECKBOX_BLOCK":i&&($.choiceComObj[t.val_key]=o),Oe(e,t,$.formArray);break;case"EVALUATE_RADIO_BLOCK":case"EVALUATE_CHECKBOX_BLOCK":Oe(e,t,$.formArray);break;case"DATE":case"TIME":case"DATETIME":case"SEARCH_CASCADE":$.submitForm[t.val_key]=e}},Be=(e,t)=>{console.log(t),$.form[t.val_key]=e},Ne=e=>{if(!e||!e.length)return{labelStr:"",labels:[]};const t=e||[],a=[],o=[];return t.forEach((e=>{o.push(e),a.push(e.labelName)})),$.labelSelectedList=t,{labelStr:a.join(","),labels:o}},xe=()=>{var e;if(!$.formArray.find((e=>T(e.type))))return void Ie("确认要提交吗?");let{evaluateResultSetting:t}=$.config;if(!t||!Object.keys(t).length&&!fe.value||Ee.value)return void Ie("确认要结束测评吗?");if("formIframe"==Q.openType&&fe.value)return void G("submitNoRequest");let a="确定要提前结束测评吗?";if(ge.value&&(null==(e=te.value)?void 0:e.getCountdownObj)){const e=te.value.getCountdownObj(),{setAnswered:t,totalLen:o}=e;t<o?a="存在未作答的题目,确定要提前结束测评吗?":!(null==$?void 0:$.showEvaluateCountdown)&&(a="确认要结束测评吗?")}Ie(a)},Ie=e=>{z.warning({title:"温馨提示",content:()=>S("div",{style:{paddingLeft:"30px"}},e),positiveText:"确定",negativeText:"取消",maskClosable:!1,closable:!1,positiveButtonProps:{type:"primary"},onPositiveClick:async()=>{const e=await qe();G("onSubmit",e)},onNegativeClick(){}})},qe=()=>new Promise(((e,t)=>{var a;null==(a=ae.value)||a.validate((t=>{var a;if(t){console.log(t);let o=(null==(a=t[0])?void 0:a[0])||{},i=o.field,l=o.message,n=$.formArray.find((e=>e.databaseTitle===i));return n&&(i=n.title),ee.error(i+l),e(!1),!1}{const t=Ae();e(t)}}))})),Me=()=>{G("onCloseSetting")};return K({getScaleData:()=>({...$}),onSubmitForm:qe,cancel:Me}),(e,t)=>(l(),n("div",V,[s(' <template v-if="state.spinning">\n <n-spin :show="state.spinning" description="加载中"></n-spin>\n </template> '),$.spinning||$.hasFrontAddress?s("v-if",!0):(l(),n(r,{key:0},[u(oe).noData?(l(),c(P,{key:0,noDataImg:u(oe).noDataImg,noDataTip:u(oe).noDataTip},null,8,["noDataImg","noDataTip"])):(l(),n(r,{key:1},[u(fe)&&!u(we)?(l(),c(F,p({key:0},u(Se),{onWriteGuage:Le}),null,16)):(l(),n(r,{key:1},[u(ge)?(l(),c(D,p({key:0,ref_key:"countdownDom",ref:te},u(he),{onCloseEvaluateCountdown:Pe}),null,16)):s("v-if",!0),d("div",{class:m(["scale-container",{"scale-container-nopadding":u(ce),"scale-container-hasfooter":u(ye)}]),style:v(u(ue))},[u(me)?(l(),c(u(N),{key:0,config:$.config,maxScore:$.maxScore},null,8,["config","maxScore"])):s("v-if",!0),f(u(q),{ref_key:"formRef",ref:ae,model:$.form,rules:$.rules,"require-mark-placement":"left",class:"main"},{default:g((()=>[(l(!0),n(r,null,y($.formArray,((e,t)=>(l(),n(r,{key:(e.id||e.seq)+t},[u(pe)(e)?(l(),c(u(M),{key:0,path:e.val_key,"show-label":!u(j)(e.type),class:"c-scle-form-item"},{label:g((()=>[d("span",{class:m({"scale-label-required":u(re)(e)}),innerHTML:u(de)(e)},null,10,H),u(re)(e)?(l(),n("span",U,"(必填)")):s("v-if",!0),u(be)(e)?(l(),n("span",W,b(u(be)(e)),1)):s("v-if",!0),u(se)(e)?(l(),n("span",{key:2,class:"evalute-tip",onClick:t=>(async e=>{var t;if($.evatipMap[e.id])return void De($.evatipMap[e.id]);let a="getSubjectAnswer";const o=(null==(t=Q.scaleApiConfig)?void 0:t[a])||null;if(!o||"function"!=typeof o)return void ee.error(`${a} Is not a function`);let i=await o(e.id);i&&($.evatipMap[e.id]||($.evatipMap[e.id]=i,De(i)))})(e)},[Y,k(" 查看提示 ")],8,J)):s("v-if",!0)])),default:g((()=>[(l(),c(C(e.renderCom),p(u(Ce)(e,t),{key:(e.id||e.seq)+t,onScaleChange:Fe,onOnChange:t=>((e,t)=>{$.form[t.val_key]=Ne(e)})(t,e),onVodFileList:Be}),null,16,["onOnChange"])),u(ke)(e)?(l(),c(B,{key:0,item:e},null,8,["item"])):s("v-if",!0)])),_:2},1032,["path","show-label"])):s("v-if",!0)],64)))),128))])),_:1},8,["model","rules"])],6),u(ye)?(l(),n("div",X,[s(" 分享的链接 隐藏取消按钮 "),"guage"!==Q.sourceType?(l(),c(u(R),{key:0,onClick:Me},{default:g((()=>[k("取消")])),_:1})):s("v-if",!0),Q.isLock?s("v-if",!0):(l(),c(u(R),{key:1,onClick:xe,disabled:$.banSubmit,type:"primary"},{default:g((()=>[k("保存")])),_:1},8,["disabled"]))])):s("v-if",!0)],64))],64))],64))]))}}),[["__file","ScaleView.vue"]]);export{G as default};
1
+ import{defineComponent as e,reactive as t,ref as a,watch as o,nextTick as i,openBlock as l,createElementBlock as n,createCommentVNode as s,Fragment as r,unref as u,createBlock as c,mergeProps as p,createElementVNode as d,normalizeClass as m,normalizeStyle as v,createVNode as f,withCtx as g,renderList as y,toDisplayString as b,createTextVNode as k,resolveDynamicComponent as C,h as S}from"vue";import h from"./hooks/use-noData.js";import{getScaleViewState as w}from"./hooks/scaleview-state.js";import{ScaleViewComputed as E}from"./hooks/scaleview-computed.js";import{ScaleViewInit as _}from"./hooks/scaleview-init.js";import{ScaleViewSubmit as A}from"./hooks/scaleview-submit.js";import{handleQueryParams as O,isCollection as j,isEvaluation as T}from"./utils/judge-types.js";import{useEvent as L}from"./hooks/use-event.js";import P from"./components/NoData.vue.js";import D from"./components/EvaluateCountdown.vue.js";import F from"./components/EvaluatePage.vue.js";import B from"./components/AnswerParse.vue.js";import N from"./components/ScaleScore.js";import{useDialog as x,useMessage as I,NForm as q,NFormItem as M,NButton as R}from"naive-ui";import K from"../../../_virtual/plugin-vue_export-helper.js";const V={class:"c-scale-view-block"},H=["innerHTML"],U={key:0,class:"required-text"},W={key:1,class:"evalute-label"},J=["onClick"],Y=d("i",{class:"scale-view-iconfont icon-scale-view-dengpao"},null,-1),X={key:1,class:"footer"};var G=K(e({__name:"ScaleView",props:{guageData:{type:Object,default:()=>({})},styleSetting:{type:Object,default:()=>({})},ids:{type:Object,default:()=>({guage_id:"",db_id:void 0})},params:{default:()=>({}),type:Object},noBtn:{type:[Boolean,String,Number],default:!1},hideBtn:{type:[Boolean,String,Number],default:!1},isLock:{type:[Boolean,String,Number],default:!1},type:{type:String,default:""},openType:{type:String,default:""},scaleApiConfig:{type:Object,default:()=>({})},getSelectOptions:{type:Function,default:()=>Promise.resolve([])},getSearchOptions:{type:Function,default:()=>Promise.resolve([])},getCascadeOptions:{type:Function,default:()=>Promise.resolve([])},getLabelList:{type:Function,default:()=>Promise.resolve([])},deleteLabel:{type:Function,default:()=>Promise.resolve({status:!0})},saveLabelItem:{type:Function,default:()=>Promise.resolve({status:!0})},uploadPictureUrl:{type:String,default:""},uploadFileUrl:{type:String,default:""},ak:{type:String,default:"KP3BZ-OAC3W-PY6RY-OJ6DV-JYKN3-H6F72"},sourceType:{type:String,default:""},getChunkUploadConfig:{type:Function,default:()=>Promise.resolve({})}},emits:["onCloseSetting","submitNoRequest","onSubmit","startWriteScale"],setup(e,{expose:K,emit:G}){const Q=e,{ScaleViewState:Z}=w(),$=t(Z),z=x(),ee=I(),te=a(null),ae=a(null),{noDataState:oe,setNoData:ie,resetNodata:le}=h(),ne=O(),{showEvatip:se,isFormBoldOpen:re,scaleStyle:ue,handlePageClass:ce,isShowItem:pe,handleShowQuestionNumber:de,hasScore:me,isPreviewScale:ve,showEvaluateEntry:fe,showEvaluateCoundownPage:ge,showSaveBtn:ye,showEvaluateLabel:be,showAnswerParse:ke,propsConfig:Ce,evaluatePageProps:Se,evaluateCountdownProps:he,skipCover:we,scaleEdit:Ee}=E(Q,$,{query:ne}),{initForm:_e}=_(Q,$,G,{query:ne}),{submitMethod:Ae}=A(Q,$,G,{query:ne}),{nextLogicEvent:Oe,handleDynamicDataRelation:je}=L(Q,$);(()=>{let{id:e}=ne;e&&($.shareId=e)})();const Te=e=>{try{le(),_e(e)}catch(e){console.log(e,"--error"),$.spinning=!1,$.hasFrontAddress=!1,ie(!0,null==e?void 0:e.resultMsg,null==e?void 0:e.result)}};o((()=>Q.ids),((e,t)=>{t?e.guage_id&&e.guage_id!=t.guage_id&&Te(e):e.guage_id&&Te(e)}),{immediate:!0}),o((()=>Q.guageData),(e=>{if(!e||!Object.keys(e||{}).length)return;$.form={},$.formArray=[];const t=JSON.parse(JSON.stringify(e));i((()=>{_e(t)}))}),{immediate:!0});const Le=e=>{$.showEvaluateSettingWrap=!1,$.showEvaluateCountdown=!!e,G("startWriteScale")},Pe=()=>{console.log("----closeEvaluateCountdown"),$.showEvaluateCountdown=!1,ve.value||($.banSubmit=!0,Ae(),z.warning({title:"温馨提示",content:"测评时间到了,结束测评!",maskClosable:!1,positiveText:"确定",onPositiveClick:()=>({})}))},De=e=>{z.warning({title:"提示",content:()=>S("div",{class:"evatip-container"},[S("span","答案解析:"),S("p",e)]),class:"c-evatip-dialog-wrap",showIcon:!1,positiveText:"确定",negativeText:"关闭",maskClosable:!1,onPositiveClick(){},onNegativeClick(){}})},Fe=(e,t,a)=>{console.log(e,"--val");let{choiceObj:o,isSetObj:i}=a||{};switch(t.type.includes("SELECT")||($.form[t.val_key]=e),t.type){case"SELECT":case"EVALUATE_SELECT":{let{value:a,list:o=[]}=e;$.form[t.val_key]=a,Oe(e,t,$.formArray),je(o,t,$.formArray)}break;case"RADIO_BLOCK":case"CHECKBOX_BLOCK":i&&($.choiceComObj[t.val_key]=o),Oe(e,t,$.formArray);break;case"EVALUATE_RADIO_BLOCK":case"EVALUATE_CHECKBOX_BLOCK":Oe(e,t,$.formArray);break;case"DATE":case"TIME":case"DATETIME":case"SEARCH_CASCADE":$.submitForm[t.val_key]=e}},Be=(e,t)=>{console.log(t),$.form[t.val_key]=e},Ne=e=>{if(!e||!e.length)return{labelStr:"",labels:[]};const t=e||[],a=[],o=[];return t.forEach((e=>{o.push(e),a.push(e.labelName)})),$.labelSelectedList=t,{labelStr:a.join(","),labels:o}},xe=()=>{var e;if(!$.formArray.find((e=>T(e.type))))return void Ie("确认要提交吗?");let{evaluateResultSetting:t}=$.config;if(!t||!Object.keys(t).length&&!fe.value||Ee.value)return void Ie("确认要结束测评吗?");if("formIframe"==Q.openType&&fe.value)return void G("submitNoRequest");let a="确定要提前结束测评吗?";if(ge.value&&(null==(e=te.value)?void 0:e.getCountdownObj)){const e=te.value.getCountdownObj(),{setAnswered:t,totalLen:o}=e;t<o?a="存在未作答的题目,确定要提前结束测评吗?":!(null==$?void 0:$.showEvaluateCountdown)&&(a="确认要结束测评吗?")}Ie(a)},Ie=e=>{z.warning({title:"温馨提示",content:()=>S("div",{style:{paddingLeft:"30px"}},e),positiveText:"确定",negativeText:"取消",maskClosable:!1,closable:!1,positiveButtonProps:{type:"primary"},onPositiveClick:async()=>{const e=await qe();G("onSubmit",e)},onNegativeClick(){}})},qe=()=>new Promise(((e,t)=>{var a;null==(a=ae.value)||a.validate((t=>{var a;if(t){console.log(t);let o=(null==(a=t[0])?void 0:a[0])||{},i=o.field,l=o.message,n=$.formArray.find((e=>e.databaseTitle===i));return n&&(i=n.title),ee.error(i+l),e(!1),!1}{const t=Ae();e(t)}}))})),Me=()=>{G("onCloseSetting")};return K({getScaleData:()=>({...$}),onSubmitForm:qe,cancel:Me}),(e,t)=>(l(),n("div",V,[s(' <template v-if="state.spinning">\r\n <n-spin :show="state.spinning" description="加载中"></n-spin>\r\n </template> '),$.spinning||$.hasFrontAddress?s("v-if",!0):(l(),n(r,{key:0},[u(oe).noData?(l(),c(P,{key:0,noDataImg:u(oe).noDataImg,noDataTip:u(oe).noDataTip},null,8,["noDataImg","noDataTip"])):(l(),n(r,{key:1},[u(fe)&&!u(we)?(l(),c(F,p({key:0},u(Se),{onWriteGuage:Le}),null,16)):(l(),n(r,{key:1},[u(ge)?(l(),c(D,p({key:0,ref_key:"countdownDom",ref:te},u(he),{onCloseEvaluateCountdown:Pe}),null,16)):s("v-if",!0),d("div",{class:m(["scale-container",{"scale-container-nopadding":u(ce),"scale-container-hasfooter":u(ye)}]),style:v(u(ue))},[u(me)?(l(),c(u(N),{key:0,config:$.config,maxScore:$.maxScore},null,8,["config","maxScore"])):s("v-if",!0),f(u(q),{ref_key:"formRef",ref:ae,model:$.form,rules:$.rules,"require-mark-placement":"left",class:"main"},{default:g((()=>[(l(!0),n(r,null,y($.formArray,((e,t)=>(l(),n(r,{key:(e.id||e.seq)+t},[u(pe)(e)?(l(),c(u(M),{key:0,path:e.val_key,"show-label":!u(j)(e.type),class:"c-scle-form-item"},{label:g((()=>[d("span",{class:m({"scale-label-required":u(re)(e)}),innerHTML:u(de)(e)},null,10,H),u(re)(e)?(l(),n("span",U,"(必填)")):s("v-if",!0),u(be)(e)?(l(),n("span",W,b(u(be)(e)),1)):s("v-if",!0),u(se)(e)?(l(),n("span",{key:2,class:"evalute-tip",onClick:t=>(async e=>{var t;if($.evatipMap[e.id])return void De($.evatipMap[e.id]);let a="getSubjectAnswer";const o=(null==(t=Q.scaleApiConfig)?void 0:t[a])||null;if(!o||"function"!=typeof o)return void ee.error(`${a} Is not a function`);let i=await o(e.id);i&&($.evatipMap[e.id]||($.evatipMap[e.id]=i,De(i)))})(e)},[Y,k(" 查看提示 ")],8,J)):s("v-if",!0)])),default:g((()=>[(l(),c(C(e.renderCom),p(u(Ce)(e,t),{key:(e.id||e.seq)+t,onScaleChange:Fe,onOnChange:t=>((e,t)=>{$.form[t.val_key]=Ne(e)})(t,e),onVodFileList:Be}),null,16,["onOnChange"])),u(ke)(e)?(l(),c(B,{key:0,item:e},null,8,["item"])):s("v-if",!0)])),_:2},1032,["path","show-label"])):s("v-if",!0)],64)))),128))])),_:1},8,["model","rules"])],6),u(ye)?(l(),n("div",X,[s(" 分享的链接 隐藏取消按钮 "),"guage"!==Q.sourceType?(l(),c(u(R),{key:0,onClick:Me},{default:g((()=>[k("取消")])),_:1})):s("v-if",!0),Q.isLock?s("v-if",!0):(l(),c(u(R),{key:1,onClick:xe,disabled:$.banSubmit,type:"primary"},{default:g((()=>[k("保存")])),_:1},8,["disabled"]))])):s("v-if",!0)],64))],64))],64))]))}}),[["__file","ScaleView.vue"]]);export{G as default};