cnhis-design-vue 3.1.44-beta.13 → 3.1.44-beta.14
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.
- package/README.md +87 -87
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
- package/es/components/fabric-chart/src/FabricChart.vue2.js +1 -1
- package/es/components/fabric-chart/src/hooks/useBirthProcess.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useBirthProcess.js +1 -1
- package/es/components/fabric-chart/src/hooks/useBirthProcessChart.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useBirthProcessChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/useBottom.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useBottom.js +1 -1
- package/es/components/fabric-chart/src/hooks/useCenter.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/useCommon.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useCumputedPoint.js +1 -1
- package/es/components/fabric-chart/src/hooks/useDraw.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useDraw.js +1 -1
- package/es/components/fabric-chart/src/hooks/useEvent.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useEvent.js +1 -1
- package/es/components/fabric-chart/src/hooks/useGrid.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useGrid.js +1 -1
- package/es/components/fabric-chart/src/hooks/useLeft.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useLeft.js +1 -1
- package/es/components/fabric-chart/src/hooks/useOther.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useOther.js +1 -1
- package/es/components/fabric-chart/src/hooks/useRight.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useRight.js +1 -1
- package/es/components/fabric-chart/src/hooks/useScaleColumn.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useScaleColumn.js +1 -1
- package/es/components/fabric-chart/src/hooks/useShadow.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useShadow.js +1 -1
- package/es/components/fabric-chart/src/hooks/useTemperatureChart.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useTemperatureChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/useTop.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useTop.js +1 -1
- package/es/components/fabric-chart/src/interface.d.ts +2 -2
- package/es/components/fabric-chart/src/utils/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/editSeparate.vue2.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/widgets/checkRendererPlugin.js +1 -1
- package/es/components/index.css +1 -1
- package/es/components/index.d.ts +2 -1
- package/es/components/index.js +1 -1
- package/es/components/picture-clipper/index.d.ts +53 -0
- package/es/components/picture-clipper/index.js +1 -0
- package/es/components/picture-clipper/src/PictureClipper.vue.d.ts +53 -0
- package/es/components/picture-clipper/src/PictureClipper.vue.js +1 -0
- package/es/components/picture-clipper/src/PictureClipper.vue2.js +1 -0
- package/es/components/picture-clipper/style/index.css +1 -0
- package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
- package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
- package/es/components/select-person/src/SearchMultiple.vue.d.ts +0 -6
- package/es/env.d.ts +25 -25
- package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
- package/es/shared/package.json.js +1 -1
- package/es/shared/utils/fabricjs/index.d.ts +6823 -0
- package/es/shared/utils/fabricjs/index.js +1 -0
- package/es/shared/utils/tapable/index.d.ts +139 -0
- package/package.json +2 -2
- package/es/components/fabric-chart/src/utils/utils.js +0 -1
- /package/es/components/fabric-chart/src/utils/{utils.d.ts → index.d.ts} +0 -0
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
|
+
```
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module 'bpmn-js/lib/Viewer';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module 'bpmn-js/lib/features/modeling';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module 'diagram-js/lib/navigation/movecanvas';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,computed as t,ref as r,onMounted as o,onBeforeUnmount as s,openBlock as a,createElementBlock as n,Fragment as p,createElementVNode as i,createBlock as u,mergeProps as
|
|
1
|
+
import{defineComponent as e,computed as t,ref as r,onMounted as o,onBeforeUnmount as s,openBlock as a,createElementBlock as n,Fragment as p,createElementVNode as i,createBlock as u,mergeProps as c,unref as l,createCommentVNode as m}from"vue";import{fabric as f}from"../../../shared/utils/fabricjs/index.js";import h from"./components/PopupTip.vue.js";import v from"./components/PopupMenu.js";import d from"./hooks/useTemperatureChart.js";import k from"./hooks/useBirthProcessChart.js";var w=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:w,emit:C}){const y=e,j=t((()=>"temperature"===y.type)),P=r(null),g=r(),{propItems:I,redrawPoints:b,select:M,pointTipProps:x,pointMenuProps:R,clickMenu:T}=function(){const e=[g,y,C,P];return j.value?d(...e):k(...e)}();return o((()=>{g.value=new f.Canvas(P.value,{width:I.canvasWidth,height:I.canvasHeight,backgroundColor:"#fff",selection:!1,containerClass:"c-fabric-chart",fireRightClick:!0})})),s((()=>{g.value.off(),g.value.clear()})),w({redrawPoints:b,select:M,canvas:g}),(e,t)=>(a(),n(p,null,[i("canvas",{ref_key:"canvasRef",ref:P},null,512),g.value?(a(),u(h,c({key:0,propItems:l(I)},l(x)),null,16,["propItems"])):m("v-if",!0),g.value?(a(),u(l(v),c({key:1,propItems:l(I)},l(R),{show:l(R).show,"onUpdate:show":t[0]||(t[0]=e=>l(R).show=e),onClickMenu:l(T)}),null,16,["propItems","show","onClickMenu"])):m("v-if",!0)],64))}});export{w as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Ref } from 'vue';
|
|
2
|
-
import { fabric } from '
|
|
2
|
+
import { fabric } from '../../../../../es/shared/utils/fabricjs';
|
|
3
3
|
import { AnyObject } from '../../../../../es/shared/types';
|
|
4
4
|
export declare function useBirthProcess(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: Function, pointTipProps: AnyObject, pointMenuProps: AnyObject): {
|
|
5
5
|
clickMenu: ({ item, target }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useBirthProcessCumputedPoint as
|
|
1
|
+
import{useBirthProcessCumputedPoint as e}from"./useCumputedPoint.js";import t 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"../../../../shared/utils/fabricjs/index.js";import{useCommon as p}from"./useCommon.js";import{getIndex as h,isEffectiveNode as g}from"../utils/index.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}=e(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((e=>e.show)).forEach(((e,t)=>{var s;const a=[],u=[],c=[];null==(s=e.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={}}=e,M=e.data[d+1],P=ne(M,e);if(s&&P&&!f.breakpoint)h=n([...s,...P],{...v});else if(s&&!P&&!f.breakpoint){const t=ne(M,e);h=t?n([...s,...t],{...v}):null}let E,G;if(f.childbirth){const e=s[1]+V;E=o([s[0],s[1],e],j),c.push(E),G=i([s[0]+X/2,e-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:t,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(e){F.hovered&&(e.on("mouseover",(()=>{te(e,"hover")})),e.on("mouseout",(()=>{x.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ee(e),function(e){var t,n,o,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top}),null==(o=e.arrowGroup)||o.setCoords().set({left:e.left,top:e.top}),null==(i=e.arrowGroupText)||i.setCoords().set({left:e.left+X/2,top:e.top+V/2})}(e),F.hovered&&te(e)})),e.on("mouseup",(t=>{if(x.show=!1,1===t.button){const{key:t}=e.origin,n={...e.origin,data:{...e.origin.data,time:C(e.left),value:S(t,e.top)}};y.value.discardActiveObject(),w("change",n),Z(n,"change")}}))}(p),a.push(p),Q.add(p))}(ne(s,e),s,f)})),Promise.all(a).then((e=>{const t=u.filter((e=>e));let n=null;e=e.filter((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),Promise.all(c).then((n=>{y.value.add(...t,...e,...n),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function Z(e,t="add"){const{dataIndex:n,data:o,index:i,key:r}=e,l=K.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const e=h(o.time,l.data);l.data.splice(e,0,o);break}}_()}function _(){var e;Q.size&&(null==(e=y.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),(null==e?void 0:e.arrowGroup)&&t.push(null==e?void 0:e.arrowGroup),(null==e?void 0:e.arrowGroupText)&&t.push(null==e?void 0:e.arrowGroupText)})),t}([...Q]))),Q.clear(),U()}function ee(e){const t=e.prevPoint?e.prevPoint.left:L,n=e.nextPoint?e.nextPoint.left:W;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<q&&e.set("top",q),e.top<Y&&e.set("top",Y),e.top>A&&e.set("top",A),e.left<t&&e.set("left",t),e.left>n&&e.set("left",n)}function te(e,t="moving"){const{title:n,key:o,data:i}=e.origin;x.point={x:e.left,y:e.top},x.list=[`${n} ${"hover"===t?i.value:S(o,e.top)}`,`时间 ${C(e.left).slice(-5)}`],x.show=!0}function ne(e,t){if(g(e)&&function(e){const t=H+864e5,n=new Date(e).getTime();return n>=H&&n<=t}(e.time)){const n=T(e.time),o=j(t.key,t.range,e.value);return[n,o<Y?Y:o>A?A:o]}}function oe(e,t){return e+1>t[1]?t[0]:e+1}return t(y,k,!0),function(){const e=new d.Rect({...$,width:R-I-B-1,height:A-1,left:I,top:0,fill:"transparent"});y.value.add(e)}(),function(){function e(e,t="left"){let n="left"===t?I:W;e.forEach(((e,t)=>{const{range:o,spaceValue:l,width:p,title:h,titleStyle:g,key:v,position:m="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:x}=e,b=[],T=[],j=n+p/2,C=function(e,t){const n=[],[o,i]=e;for(let e=o;t>0?e<=i:e>=i;e+=t)n.push(e);return n}(o,l),S=C.length;C.forEach(((t,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(t),e,l,a)),T.push(...f(e,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}))}e(D),e(O,"right")}(),function(){const{show:e,startTime:t,range:n=[0,23],position:o="top",style:l}=E.time,{show:a,range:u=[0,23],position:c,style:f}=E.processTime;if(e||a){const p=[],h=[],g=[],v=[],m=L+X/2,k=V/2;for(let s=0;s<G.mainXCell;s++){if(e){const e=0===s?+t.slice(11,13):oe(p.at(-1),n);p.push(e);const a="top"===o?Y-k:A+k;g.push(i([m+s*X,a],{value:String(e),...r,...l||{}}))}if(a){const e=0===s?u[0]:h.at(-1)+1;h.push(e);const t="top"===c?k:J-k;v.push(i([m+s*X,t],{value:String(e),...r,...f||{}}))}}const w=new d.Group([...g,...v],{objectCaching:!1,...s});y.value.add(w),y.value.sendToBack(w)}}(),function(){var e;const t=Object.values(z),o=[],i={},r=K.find((e=>"cervix"===e.key&&e.show)),l=null==(e=null==r?void 0:r.data)?void 0:e.find((e=>3==+e.value));function s(e,t){const{key:n,range:o}=r||{},i=j(n,o,10),l=[0,t],s=[-t/e,0],a=[(A-i-t)/e,A-i],u=[W-L,e*(W-L)+t];let c=[],f=[];function d([n,o]){return Math.abs(o-e*n-t)<=1}function p([e,t]){const[n,o]=[...h([e,t])];return n>=L&&n<=W&&o>=i&&o<=A}function h([e,t]){return[L+e,A-t]}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]}t.forEach((e=>{if(!e.show)return;const{key:t}=e;switch(t){case"fetalPresentation":{const{range:i,show:r}=K.find((e=>e.key===t));if(r){const r=j(t,i,0);o.push(n([L,r,W,r],{...e}))}break}case"alert":if(l){const{key:t,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(t,a,l.value)],[p,h]=[T(c.time)-L,A-j(t,a,c.value)],g=(h-d)/(p-f),v=d-f*g,y=s(g,v);y.length>0&&(o.push(n(y,{...e})),Object.assign(i,{k:g,b:v}))}break;case"handling":if(l){const{k:t,b:r}=i,a=144e5,u=s(t,r-(T(m(new Date(new Date(l.time).getTime()+a),"yyyy-MM-dd HH:mm"))-T(l.time))*t);u.length>0&&o.push(n(u,{...e}))}}})),y.value.add(...o)}(),U(),function(){function e(e,t){const n=K.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:n,key:e.key},pointer:t}}k.event.evented&&y.value.on("mouse:up",(t=>{if(3===t.button){const{x:n=0,y:o=0}=t.pointer||{};n>=L&&n<=W&&o>=Y&&o<=A&&(b.point={x:n,y:o},b.show=!0,t.target?(b.target=t.target,b.list=["删除节点"],y.value.forEachObject((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&b.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(b.target=null,b.list=["新增节点"],K.filter((e=>e.show)).forEach((i=>{if(!M(n,"key",X).includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<q)return;b.list.push(e(i,t.pointer))}})),1===b.list.length&&(b.show=!1,P("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=R-B/2;function t(e,t){if(!e.length)return;let o=Y;const i=[];e.forEach((e=>{const n=e.title.split("").join("\n"),s=N.findIndex((t=>t.key===e.key)),a=new d.Text(String(n),{...r,...e.titleStyle||{},originY:"top",left:t,top:o,lineHeight:1}),u=l(e.type,{left:t,top:o+a.height+3,...e.pointAttr,originY:"top",origin:{title:e.title,unit:e.unit,type:e.type,dataIndex:s,key:e.key,isMenu:!0},originLeft:t,originTop:o+a.height+3,...k.event});o+=a.height+u.height+15,function(e){function t(e){const{left:t,top:n}=e;return t>=L&&t<=W&&n>=Y&&n<=A}e.on("moving",(()=>{e.set("originY","center"),t(e)?(ee(e),te(e)):x.show=!1})),e.on("mouseup:before",(n=>{if(x.show=!1,0===n.e.button&&t(e))if(M(e.left,"key",X).includes(e.origin.key))P("repeat");else{const t={data:{time:C(e.left),value:S(e.origin.key,e.top)},...e.origin};w("add",t),Z(t)}!function(e){e.setCoords().set({originY:"top",left:e.originLeft,top:e.originTop})}(e)}))}(u),i.push(a,u)})),n(i),y.value.add(...i)}function n(e){const t=e.at(-1),n=(A-Y)/2,o=(t.height+t.top-Y)/2;e.forEach((e=>{const t=e.top+n-o;e.set({top:t,originTop:t})}))}t(D,I/2),t(O,e)}(),{clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(w("remove",n),Z(n,"remove")):(Object.assign(n,{data:{time:C(e.pointer.x),value:S(e.origin.key,e.pointer.y)}}),w("add",n),Z(n))},redrawPoints:_}}export{y as useBirthProcess};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
-
import { fabric } from '
|
|
2
|
+
import { fabric } from '../../../../../es/shared/utils/fabricjs';
|
|
3
3
|
import { AnyObject } from '../../../../../es/shared/types';
|
|
4
4
|
export default function useBirthProcessChart(canvas: Ref<fabric.Canvas>, props: AnyObject, emits: Function, canvasRef: Ref<HTMLCanvasElement | null>): {
|
|
5
5
|
propItems: any;
|
|
@@ -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"lodash-es";import"
|
|
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"../../../../shared/utils/fabricjs/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(),f=a({show:!1,point:{x:0,y:0},list:[]}),g=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))})),b=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})),A=t((()=>d.data.grid.mainXCell)),j=t((()=>{const e=d.data.grid.mainYCell||14;return d.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),C=t((()=>(b.value-V.value)/A.value)),k=t((()=>{const{xAxis:e,height:a}=d.data,t=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(j.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/C.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:b.value,originY:Y.value,endY:S.value,xCellWidth:C.value,yCellHeight:k.value,gridXNumber:A.value,gridYNumber:j.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,f,g);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:f,pointMenuProps:g,clickMenu:m}}export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"
|
|
1
|
+
import{fabric as t}from"../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultTextStyle as n,defaultStyle as i}from"./useDraw.js";function o(o,l){const{xScaleList:s,originX:a,endX:r,endY:c,xCellWidth:h,canvasWidth:d,canvasHeight:u,bottom:g,breathingHeight:f,iconsWidth:p,borderStyle:v}=l;!function(){var l,d,u;if(!f||!g){const e=new t.Line([p,c-1,r,c-1],v);return o.value.add(e),e.sendToBack(),!1}const b=f,m=(null==(l=g.breathing)?void 0:l.list)||[],w=[];let x=!0;s.forEach(((t,i)=>{const o=a+i*h;let l="";m.forEach(((e,n)=>{const i=new Date(e.time).getTime();i>=t&&i<+t+t.scaleCell&&(l=e.value)}));const s=x?{top:-(b/2-10)}:{top:b/2-10};l&&(x=!x);const r=e({width:h,height:b,...v},Object.assign({},{text:String(l),...n},l?s:{}),{left:o,top:c});w.push(r)}));const j=e({width:r,height:b,...v},{text:String((null==(d=g.breathing)?void 0:d.title)+(null==(u=g.breathing)?void 0:u.unit)),...n,left:-(r-a)/2},{left:0,top:c});w.push(j);const S=w.length>0?new t.Group([...w],{...i}):null;S&&S.sendToBack(),S&&o.value.add(S)}()}export{o as useBottom};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Ref } from 'vue';
|
|
2
|
-
import { fabric } from '
|
|
2
|
+
import { fabric } from '../../../../../es/shared/utils/fabricjs';
|
|
3
3
|
import { IPropItems } from '../interface';
|
|
4
4
|
import { AnyObject } from '../../../../../es/shared/types';
|
|
5
5
|
export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: Function, cumputedX: Function, cumputedY: Function, getXValue: Function, getYValue: Function, addRenderItem: Function | undefined, pointTipProps: AnyObject, pointMenuProps: AnyObject): {
|
|
@@ -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{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
|
+
import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";import{drawLine as t,defaultStyle as i,drawPoint as n,drawText as o,drawArrow as l}from"./useDraw.js";import 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/index.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,5 +1,5 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
-
import { fabric } from '
|
|
2
|
+
import { fabric } from '../../../../../es/shared/utils/fabricjs';
|
|
3
3
|
export declare function useCommon(canvas: Ref<fabric.Canvas>, emits: Function): {
|
|
4
4
|
getEqualXTypes: (pointX: number, field: string, range?: number) => string[];
|
|
5
5
|
handleAddPrevent: (type: 'repeat' | 'exceedMax' | 'exceedMin') => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{format as n}from"date-fns";import{getFloorNumber as
|
|
1
|
+
import{format as n}from"date-fns";import{getFloorNumber as e}from"../utils/index.js";function t(t){const{xScaleList:i,originX:r,endY:u,xCellWidth:l,left:c,vitalSignsOriginY:o,painOriginY:a,canvasWidth:d}=t;return{cumputedX:function(n,e=!1){const t=new Date(n).getTime(),[r]=i,u=i.at(-1);if(t<r.start)return 0;if(t>u.end)return d;const l=i.findIndex((n=>n.end>=t));if(l>-1){return i[l].center}},cumputedY:function(n,e,i){const r=t[`${n}YCell`],u=+i-Math.min(...e);return("pain"===n?a.endY:o.endY)-r*u},getXValue:function(e){const t=i.findIndex((n=>n.left+l>=e));if(t>-1){const r=i[t],u=e-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=t[`${n}YCell`],l=(null==(r=c.yScaleValue.find((e=>e.type===n)))?void 0:r.list)||[],d=l.length?Math.min(...l):0,f="pain"===n?a.endY:o.endY;return e((f-i)/u+d)}}}function i(t){const{xAxis:i,originX:r,originY:u,xCellWidth:l,endY:c,timeXCell:o,startTime:a,scaleValues:d}=t;return{cumputedX:function(n){return(new Date(n).getTime()-a)/o+r},cumputedY:function(n,e,i){const[r]=e;return c-(+i-r)/t[`${n}YCell`]},getXValue:function(e){return n(new Date((e-r)*o+a),"yyyy-MM-dd HH:mm")},getYValue:function(n,i){const r=d.find((e=>n===e.key)),[u]=(null==r?void 0:r.range)||[0],l=(c-i)*t[`${n}YCell`]+u;return e(l)}}}export{i as useBirthProcessCumputedPoint,t as useCumputedPoint};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as e}from"
|
|
1
|
+
import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";const t={evented:!1,selectable:!1},r={stroke:"#000",strokeWidth:1,...t},i={stroke:"#000",strokeWidth:1,strokeDashArray:[0,0],...t},n={fill:"transparent",stroke:"#000",strokeWidth:1,originX:"center",originY:"center",objectCaching:!1,...t},o={fontFamily:"微软雅黑",fontSize:12,fill:"#000",centeredRotation:!0,originX:"center",originY:"center",lineHeight:1,objectCaching:!1,...t};function c(t,r){return new e.Line(t,{...i,...r})}function s([t,r],i){return new e.Text(String(i.value),{...o,left:t,top:r,...i})}function l([r,i,n],o,l="down"){const a=c([r,i,r,n],{strokeWidth:1,stroke:o.fill}),u=s([r+.5,"up"===l?n-3:n+3],{value:"v",originX:"center",originY:"bottom",fontSize:16,angle:"up"===l?180:0,...o});return new e.Group([a,u],{...t,originX:"center",originY:"top"})}function a(r,i,c){const s=new e.Rect({...n,...r,strokeWidth:.5}),{value:l="标题",textAlign:a="center",verticalAlign:u="center"}=i,g=r.width/2,h=r.height/2,d=new e.Text(String(l),{...o,...i,..."left"==a||"right"==a?{originX:a,left:"left"==a?-g:g}:{},..."top"==u||"bottom"==u?{originY:u,top:"top"==u?-h:h}:{}});return new e.Group([s,d],{objectCaching:!1,...t,...c})}function u(t="circle",r){const i={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",objectCaching:!1,...r},n=()=>new e.Circle({objectCaching:!1,strokeWidth:r.strokeWidth||1,stroke:r.stroke||"red",radius:r.radius||5,fill:"#fff"});switch(t){case"triangle":return new e.Triangle({width:20,height:20,strokeWidth:1,scale:1,...i});case"circle":return new e.Circle({objectCaching:!1,strokeWidth:1,radius:5,scale:1,...i});case"image":return new e.Image(r.element,{...i,scale:1});case"yemai":{const t=()=>{const t=2*((r.radius||5)+(r.strokeWidth||1)),i={stroke:r.strokeX||"blue",strokeWidth:r.strokeWidthX||1,originX:"center",originY:"center"},n=new e.Line([0,t/2,t,t/2],i),o=new e.Line([t/2,0,t/2,t],i);return new e.Group([n,o])};return new e.Group([n(),t()],{scale:1,...i})}case"koumai":{const t=(r.radius||5)+(r.strokeWidth||1),o=new e.Circle({objectCaching:!1,radius:r.radiusCircle||2,fill:r.fillCircle||"#000",originX:"center",originY:"center",left:t,top:t});return new e.Group([n(),o],{scale:1,...i})}default:return r&&Reflect.deleteProperty(r,"stroke"),new e.Text(String(t),{fontFamily:"微软雅黑",scale:1,fontSize:14,fill:"#000",...i})}}export{r as defaultBorderStyle,i as defaultLineStyle,n as defaultRectStyle,t as defaultStyle,o as defaultTextStyle,l as drawArrow,c as drawLine,u as drawPoint,s as drawText,a as drawTextGroup};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
-
import { fabric } from '
|
|
2
|
+
import { fabric } from '../../../../../es/shared/utils/fabricjs';
|
|
3
3
|
import { IPropItems } from '../interface';
|
|
4
4
|
export declare function useEvent(element: HTMLCanvasElement | null): void;
|
|
5
5
|
export declare function useCanvasEvent(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: any): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEventListener as e}from"@vueuse/core";import{fabric as t}from"
|
|
1
|
+
import{useEventListener as e}from"@vueuse/core";import{fabric as t}from"../../../../shared/utils/fabricjs/index.js";function n(t){t&&e(t.nextSibling,"contextmenu",(e=>(e.preventDefault(),!1)))}function o(e,n,o){const{originY:i,originX:l,endX:s,endY:r,iconsWidth:d,selectionStyle:u,topList:h}=n;function c(n,o){const{left:i,top:l,width:s,height:r}=n,d=new t.Rect({key:o,left:null!=i?i:0,top:null!=l?l:0,width:s,height:r,stroke:"transparent",fill:"transparent",lockMovementX:!0,lockMovementY:!0,transparentCorners:!1,hasControls:!1,...u,strokeWidth:0});return e.value.add(d),d}let f=[];function a(e){k();p(null==f?void 0:f.find((t=>t.key===e)))}function k(){f.forEach((e=>{e.set("strokeWidth",0),e.key.endsWith("All")&&e.sendToBack()}))}function p(t){var n;e.value.discardActiveObject(),!(null==t?void 0:t.key.includes("grid"))&&(null==t||t.bringToFront()),null==t||t.set("strokeWidth",null!=(n=u.strokeWidth)?n:2)}return("boolean"!=typeof(null==u?void 0:u.evented)||(null==u?void 0:u.evented))&&(f=function(){const e=[];e.push(c({left:d,top:i+1,width:l-d,height:r-i-3},"left"));let t=0;return h.forEach(((o,i)=>{i>0&&(t+=n[`${h[i-1].key}Height`]);const r={top:t+1,height:n[`${o.key}Height`]-1};e.push(c({left:d,width:s-d,...r},o.key+"All")),e.push(c({left:d,width:l-d,...r},o.key+"Title")),e.push(c({left:l,width:s-l,...r},o.key))})),e.push(c({left:l,top:i+1,width:s-l,height:r-i-3},"grid")),e.forEach((e=>{e.key.endsWith("All")?(e.sendToBack(),e.on("mouseup",(t=>{const{button:n,pointer:i}=t;if(1==n){const t=e.key.replace("All",""),n=(null==i?void 0:i.x)&&(null==i?void 0:i.x)<=l?t+"Title":t;e.sendToBack(),a(n),o("select",n)}}))):e.on("mousedown",(()=>{k(),p(e),o("select",e.key)}))})),e}()),{select:a}}export{o as useCanvasEvent,n as useEvent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
-
import { fabric } from '
|
|
2
|
+
import { fabric } from '../../../../../es/shared/utils/fabricjs';
|
|
3
3
|
import { AnyObject } from '../../../../../es/shared/types';
|
|
4
4
|
export default function useGrid(canvas: Ref<fabric.Canvas>, propItems: AnyObject, isBirthProcess?: boolean): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as e}from"
|
|
1
|
+
import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";import{drawLine as l,defaultStyle as n}from"./useDraw.js";function i(i,s,t=!1){var o,r,u,d;const{gridYNumber:a,originY:c,grid:S,originX:b,endX:y,xCellWidth:m,yCellHeight:p,gridXNumber:f,endY:g,borderStyle:h}=s,v=[],C=[],L=new Set;for(let e=0;e<=a;e++){const n=c+parseInt(String(p*(a-e)));if(t){const e=l([b,n,y,n],{...h,...(null==(o=S.mainLineStyle)?void 0:o.x)||{}});v.push(e)}else{const i=e%S.subYCell==0?(null==(r=S.mainLineStyle)?void 0:r.x)||{}:S.subLineStyle||{},s=l([b,n,y,n],i);e%S.subYCell==0?L.add(s):v.push(s)}}for(let e=0;e<=f;e++){const n=b+parseInt(String(m*e));if(t){const e=l([n,c,n,g],{...h,...(null==(u=S.mainLineStyle)?void 0:u.y)||{}});C.push(e)}else{let i=S.subLineStyle||{};e%S.subSecondXCell==0&&(i=S.subSecondLineStyle||{}),e%S.subXCell==0&&(i=0!==e&&e!==f?(null==(d=S.mainLineStyle)?void 0:d.y)||{}:h);const s=l([n,c,n,g],i);e%S.subXCell==0&&0!==e&&e!==f?L.add(s):C.push(s)}}const X=new e.Group([...C,...v,...L],n);i.value.add(X),i.value.sendToBack(X)}export{i as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
-
import { fabric } from '
|
|
2
|
+
import { fabric } from '../../../../../es/shared/utils/fabricjs';
|
|
3
3
|
import { IPropItems } from '../interface';
|
|
4
4
|
import { AnyObject } from '../../../../../es/shared/types';
|
|
5
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): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"
|
|
1
|
+
import{fabric as t}from"../../../../shared/utils/fabricjs/index.js";import{defaultTextStyle as e,defaultStyle as i,drawPoint as n,drawTextGroup as o}from"./useDraw.js";import{useCommon as l}from"./useCommon.js";import{getScaleInfo as r,drawScaleNumber as s,drawScaleLine as a}from"./useScaleColumn.js";import{getType as u,isOneLine as h}from"../utils/index.js";function g(g,c,p,d,f,y,w,v,m,S,b){var Y,x;const{getEqualXTypes:T,handleAddPrevent:X}=l(g,p),{originY:j,endY:C,originX:N,endX:V,xCellWidth:L,yCellHeight:M,left:k,vitalSignsOriginY:E,painOriginY:I,painHeight:A,iconsWidth:G,itemList:H,painIndex:O,right:W,canvasWidth:R,canvasHeight:_,getRightInfo:B,borderStyle:J}=c;function $(n){var l;if(!(null==n?void 0:n.length))return;const{layout:u}=n[0];let h=G,c=N;"right"===u&&(h=V,c=V+(null!=(l=null==W?void 0:W.width)?l:0));const p=[],d=A&&"right"!==u?n.length-1:n.length,f=(c-h)/d,y=f+(c-h)%d;n.forEach(((n,l)=>{if("pain"===n.type)return void function(i){const{list:n=[],spaceGridNumber:l=5,showScale:a,showNumber:u,position:h,showMaxMinNumber:c,style:p,title:d}=i,f=o({width:N-G,height:A,...J},{value:`${d}`,...e,...p||{}},{left:G,top:I.originY}),y=[];if(a||u){const{lineXMain:e,textLeft:o}=r(h,G,N-G),g=n.length;n.forEach(((n,r)=>{let h=I.endY-r*M*l;if(0===r&&(h=C-5),!u||(0===r||r===g-1)&&!c||y.push(s(n,i,o,h)),a&&0!==r){const[i,n]=e,o=new t.Line([i,h,n,h],{...J,...p});y.push(o)}}))}g.value.add(f,...y),f.sendToBack()}(n);const c=[],d=0===l?y:f,w=0===l?h:y+h+(l-1)*f,v="right"===u?0:E.originY,m="right"===u?_:E.endY,S=l>0?new t.Line([w,v,w,m],{...J}):null;S&&c.push(S);const b=w+d/2,{list:Y=[],spaceGridNumber:x=5,showScale:T,showNumber:X,position:j,showMaxMinNumber:V}=n;if(T||X){const{lineXMain:t,lineXSub:e,textLeft:i}=r(j,w,d),o=Y.length;Y.forEach(((l,r)=>{const u=E.endY-r*M*x;if(X&&(!(0===r||r===o-1)||V)){const t=0==r?u-5:u,e=s(l,n,i,t),o=E.originY+e.height/2;t<o&&e.set({top:o}),c.push(e)}c.push(...a(n,r,t,e,u,M,E.originY))}))}let L=n.title||"";n.unit&&(L+="\n"+n.unit),L&&c.push(new t.Text(String(L),{...e,left:b,top:E.originY+M*x/2,textAlign:"center",...n.style}));const k=new t.Group(c,{...i,objectCaching:!1});p.push(k)}));const w=p.length>0?new t.Group([...p],{...i,objectCaching:!1}):null;w&&g.value.add(w),w&&w.sendToBack()}function q(t){return t.left>=N&&t.left<V&&t.top>=j&&t.top<=C}G&&function(){const e=JSON.parse(JSON.stringify(H));let o=C;const l=G-k.icons.marginRight;e.reverse().forEach((e=>{o-=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),{...i,objectCaching:!1,...e.titleStyle||{},originX:"right",originY:"bottom",left:l-(e.pointAttr.width||10)-5,top:o,lineHeight:1,fontSize:12}),a=n(e.type,{left:l,top:o-(s.height||30)/2-1,...e.pointAttr,originY:"center",originX:"right",origin:{title:e.title,unit:e.unit,type:u(e.bigType),_type:e.bigType,dataIndex:e.dataIndex,key:e.key,isMenu:!0},originLeft:l,originTop:o-(s.height||30)/2-1,...c.event});var y;o-=s.height||30,(y=a).on("moving",(()=>{y.set("originX","center"),function(t){if(t.left>=N&&t.left<=V){t.setCoords();const e="pain"===t.origin.type?I:E;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(y),q(y)?d(y):f.show=!1})),y.on("mouseup:before",(t=>{if(f.show=!1,0===t.e.button&&q(y)){const t=T(y.left,"_type",L).includes(y.origin._type),e=S(y.left);if(!e||t)t&&e&&X("repeat");else{const t={data:{time:v(y.left),value:m(y.origin.type,y.top),...h(y.origin.type)?{key:y.origin.key}:{}},...y.origin};p("add",t),b(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(y)})),g.value.add(s,a)}))}();const z=k.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==W?void 0:W.width)&&"left"===(null==(Y=null==W?void 0:W.yScaleValue)?void 0:Y.layout)&&(null==(x=null==W?void 0:W.yScaleValue)?void 0:x.show)&&z.push(B),O>0&&k.yScaleValue[O].show){const t=k.yScaleValue[O];0===O&&k.yScaleValue.length>1&&z.unshift(t),O==k.yScaleValue.length-1&&z.push(t)}const D=z.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),P=z[D];return D>-1&&z.splice(D,0,{...P,title:(null==P?void 0:P.doubleTitle)||(null==P?void 0:P.title)}),$(z),g.value.add(new t.Rect({left:G,top:0,width:R-G-1,height:_-1,fill:"transparent",...J})),{drawScaleValue:$}}export{g as useLeft};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
-
import { fabric } from '
|
|
2
|
+
import { fabric } from '../../../../../es/shared/utils/fabricjs';
|
|
3
3
|
import { IPropItems } from '../interface';
|
|
4
4
|
export declare function useOther(canvas: Ref<fabric.Canvas>, propItems: IPropItems, cumputedX: Function): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"
|
|
1
|
+
import{fabric as t}from"../../../../shared/utils/fabricjs/index.js";import{defaultStyle as e}from"./useDraw.js";function n(n,i,l){const{other:o,vitalSignsOriginY:r,xCellWidth:a,yCellHeight:s,endX:c}=i;let h=0;function u(n,i,l){const o=[];String(n.value).split("").forEach(((i,l)=>{const r=new t.Text(i,{left:0,top:s*l,originX:"center",...e,objectCaching:!1,...n.style||{}});h=(s-(r.height||0))/2,o.push(r)}));const r={originX:"center",left:i,top:l+h,baseTop:(n.baseTop||0)*s,trueLeft:i,trueHeight:o.length*s,objectCaching:!1};return new t.Group(o,r)}!function(){if(!(null==o?void 0:o.list))return!1;const i=[],h=[];o.list.forEach(((t,e)=>{const n=0===e?"vertical":t.align||"vertical",i=l(t.time,!0);if(i>c)return;const o=h.find((t=>t.left==i));if(o)o[n].push(t);else{const e={left:i,vertical:[],horizontal:[]};e[n].push(t),h.push(e)}})),h.forEach((t=>{let e=r.originY,n=t.left;t.vertical.forEach(((l,o)=>{var c,h;const f=(l.baseTop||0)*s,g=(null==(c=i.at(-1))?void 0:c.left)||0;0===o&&t.left<=g&&(n=g+a);if(i.filter((t=>t.trueLeft===n)).length){const t=String(l.value).length*s,o=(null==(h=i.at(-1))?void 0:h.trueHeight)||0;e+=o,e+t+f>r.endY&&(e=r.originY,n+=a)}e+=f,String(l.value).length&&i.push(u(l,n,e))})),t.horizontal.forEach(((e,l)=>{var o;const c=r.originY+(e.baseTop||0)*s,h=(null==(o=i.at(-1))?void 0:o.left)||0;t.left<=h&&(n=h+a),String(e.value).length&&i.push(u(e,n,c))}))}));const f=i.length>0?new t.Group([...i],{...e,objectCaching:!1}):null;f&&n.value.add(f)}()}export{n as useOther};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
-
import { fabric } from '
|
|
2
|
+
import { fabric } from '../../../../../es/shared/utils/fabricjs';
|
|
3
3
|
import { IPropItems } from '../interface';
|
|
4
4
|
export declare function useRight(canvas: Ref<fabric.Canvas>, propItems: IPropItems, drawScaleValue: Function): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as l}from"
|
|
1
|
+
import{fabric as l}from"../../../../shared/utils/fabricjs/index.js";function e(e,i,t){var o,n;const{left:d,right:u,getRightInfo:a,canvasWidth:s,endY:h,endX:r,originY:f,borderStyle:v}=i,c=d.yScaleValue.filter((l=>"right"===l.layout&&l.show));(null==u?void 0:u.width)&&"right"===(null==(o=null==u?void 0:u.yScaleValue)?void 0:o.layout)&&(null==(n=null==u?void 0:u.yScaleValue)?void 0:n.show)&&c.push(a);const w=c.findIndex((l=>"pulse"===l.type&&l.show&&l.doubleShow)),g=c[w];if(w>-1&&c.splice(w,0,{...g,title:(null==g?void 0:g.doubleTitle)||(null==g?void 0:g.title)}),(null==u?void 0:u.width)||c.length>0){const i=new l.Line([s-1,0,s-1,h],v),t=new l.Line([r+1,f,s-1,f],{...v,stroke:"#fff"});e.value.add(i,t)}t(c)}export{e as useRight};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as
|
|
1
|
+
import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";import{defaultTextStyle as t,defaultBorderStyle as n}from"./useDraw.js";function i(e="center",t,n){let i=t+n/2,r=[i-4.5,i+4.5],o=[i-2.5,i+2.5],s=i;return"right"===e&&(i=t,r=[i,i+9],o=[i,i+5],s=r[1]),"left"===e&&(i=t+n,r=[i-9,i],o=[i-5,i],s=r[0]),{lineXMain:r,lineXSub:o,textLeft:s}}function r(n,i,r,o){const{position:s,style:l,scaleNumberStyle:c}=i;return new e.Text(String(n),{...t,originX:"left"==s?"right":"right"==s?"left":"center",left:r,top:o,...l||c||{}})}function o(t,i,r){const o=new e.Line(i,{...n,...t.style||t.scaleLineStyle||{}});r.push(o)}function s(e,t,n,i,r,s,l,c){var f;const u=[],a=c||(null==(f=e.list)?void 0:f.length),h=e.position||"center",p=(e.spaceGridNumber||(c?1:5))*s/5;if(e.showScale&&t!==a-1)for(let s=0;s<5;s++)if(s>0||!e.showNumber||"center"!==h){const c=0==s?n[0]:i[0],f=0==s?n[1]:i[1],h=r-s*p;h>l&&(o(e,[c,h,f,h],u),t==a-2&&4==s&&o(e,[n[0],h-p,n[1],h-p],u))}return u}export{s as drawScaleLine,r as drawScaleNumber,i as getScaleInfo};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fabric } from '
|
|
1
|
+
import { fabric } from '../../../../../es/shared/utils/fabricjs';
|
|
2
2
|
declare type Point = [number, number];
|
|
3
3
|
export declare function useShadow(): {
|
|
4
4
|
createShadowLines: (coordinates: Point[], angle?: number, space?: number) => fabric.Line[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useMemoize as t}from"@vueuse/core";import{fabric as n}from"
|
|
1
|
+
import{useMemoize as t}from"@vueuse/core";import{fabric as n}from"../../../../shared/utils/fabricjs/index.js";const r=t((t=>+Math.tan(t*Math.PI/180)));function e(){return{createShadowLines:function(e,o=45,u=10){const a=[];var c;if(c=o,0===(o=c=(c=(c%=360)<0?180-c:c)>=180?c-180:c))return a;const i=Math.min(...e.map((([t])=>t))),s=Math.max(...e.map((([t])=>t))),h=Math.min(...e.map((([,t])=>t))),f=Math.max(...e.map((([,t])=>t))),m=(f-h)/r(o);let p=i,M=s;return o>0&&o<90||o>180&&o<270?M+=m:p+=m,function(t,n){const r=[l([t,h])];for(;t<n;)t+=u,r.push(l([t,h]));return r}(p,M).forEach((r=>{let o=[];var u,c,i,s,h,f;if((u=e,u.reduce(((t,n,r)=>{const e=u[r+1]||u[0];return t.push([n,e]),t}),[])).forEach((n=>{const e=function(n,r,e,o){const u=(r[1]-n[1])*(o[0]-e[0])-(n[0]-r[0])*(e[1]-o[1]);if(0===u)return!1;const a=((r[0]-n[0])*(o[0]-e[0])*(e[1]-n[1])+(r[1]-n[1])*(o[0]-e[0])*n[0]-(o[1]-e[1])*(r[0]-n[0])*e[0])/u,c=-((r[1]-n[1])*(o[1]-e[1])*(e[0]-n[0])+(r[0]-n[0])*(o[1]-e[1])*n[1]-(o[0]-e[0])*(r[1]-n[1])*e[1])/u;if(((a-n[0])*(a-r[0])<0||t(a,n[0])||t(a,r[0]))&&((c-n[1])*(c-r[1])<0||t(c,n[1])||t(c,r[1]))&&((a-e[0])*(a-o[0])<0||t(a,e[0])||t(a,o[0]))&&((c-e[1])*(c-o[1])<0||t(c,e[1])||t(c,o[1])))return[a,c];return!1}(r[0],r[1],n[0],n[1]);e&&o.push(e)})),c=function(n){return n.reduce(((t,n)=>(r(t,n)||t.push(n),t)),[]);function r(n,r){return n.some((n=>t(n[0],r[0])&&t(n[1],r[1])))}}(o),o=c.sort(((t,n)=>t[1]-n[1])),o.length>=2)for(let t=0;t<o.length;t++)o[t+1]&&(h=o[t],f=o[t+1],function(t,n){let r,e,o,u=0;const a=n.length;e=n[0];for(let c=1;c<=a;c++)o=n[c%a],t[0]>Math.min(e[0],o[0])&&t[0]<=Math.max(e[0],o[0])&&t[1]<=Math.max(e[1],o[1])&&e[0]!=o[0]&&(r=(t[0]-e[0])*(o[1]-e[1])/(o[0]-e[0])+e[1],(e[1]==o[1]||t[1]<=r)&&u++),e=o;return u%2!=0}([(h[0]+f[0])/2,(h[1]+f[1])/2],e))&&a.push((i=o[t],s=o[t+1],new n.Line([i[0],i[1],s[0],s[1]])))})),a;function l(t){return[t,[t[0]-m,f]]}}};function t(t,n){return Math.abs(t-n)<=1e-4}}export{e as useShadow};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Ref } from 'vue';
|
|
2
|
-
import { fabric } from '
|
|
2
|
+
import { fabric } from '../../../../../es/shared/utils/fabricjs';
|
|
3
3
|
import { AnyObject } from '../../../../../es/shared/types';
|
|
4
4
|
export default function useTemperatureChart(canvas: Ref<fabric.Canvas>, props: AnyObject, emits: Function, canvasRef: Ref<HTMLCanvasElement | null>): {
|
|
5
5
|
propItems: any;
|