cnhis-design-vue 3.1.41-beta.25 → 3.1.41-beta.27

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 (49) hide show
  1. package/README.md +87 -87
  2. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  3. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
  4. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
  5. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
  6. package/es/components/date-picker/index.d.ts +20 -0
  7. package/es/components/date-picker/index.js +1 -0
  8. package/es/components/date-picker/src/DatePicker.vue.d.ts +20 -0
  9. package/es/components/date-picker/src/DatePicker.vue.js +1 -0
  10. package/es/components/fabric-chart/src/hooks/useBirthProcess.js +1 -1
  11. package/es/components/fabric-chart/src/hooks/useBirthProcessChart.js +1 -1
  12. package/es/components/fabric-chart/src/utils/index.d.ts +6823 -0
  13. package/es/components/form-config/index.d.ts +5 -5
  14. package/es/components/form-config/src/FormConfig.vue.d.ts +5 -5
  15. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +3 -3
  16. package/es/components/index.css +1 -1
  17. package/es/components/index.d.ts +3 -1
  18. package/es/components/index.js +1 -1
  19. package/es/components/scale-view/src/ScaleView.vue.js +1 -1
  20. package/es/components/shortcut-setter/index.d.ts +1 -1
  21. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -1
  22. package/es/components/table-filter/index.d.ts +64 -452
  23. package/es/components/table-filter/src/base-search-com/BaseSearch.vue.d.ts +19 -88
  24. package/es/components/table-filter/src/base-search-com/BaseSearch.vue.js +1 -1
  25. package/es/components/table-filter/src/classification/Classification-com.vue.d.ts +37 -253
  26. package/es/components/table-filter/src/classification/Classification-com.vue.js +1 -1
  27. package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +0 -42
  28. package/es/components/table-filter/src/components/classify-filter/index.vue.js +1 -1
  29. package/es/components/table-filter/src/components/render-widget/index.vue.d.ts +2 -1
  30. package/es/components/table-filter/src/components/render-widget/index.vue.js +1 -1
  31. package/es/components/table-filter/src/components/search-filter/index.vue.d.ts +0 -84
  32. package/es/components/table-filter/src/components/search-filter/index.vue.js +1 -1
  33. package/es/components/table-filter/src/components/set-classification/index.vue.d.ts +4 -130
  34. package/es/components/table-filter/src/components/set-classification/index.vue.js +1 -1
  35. package/es/components/table-filter/src/components/table-modal/index.vue.d.ts +3 -43
  36. package/es/components/table-filter/src/components/table-modal/index.vue.js +1 -1
  37. package/es/components/table-filter/src/quick-search/QuickSearch.vue.d.ts +10 -113
  38. package/es/components/table-filter/src/quick-search/QuickSearch.vue.js +1 -1
  39. package/es/components/table-filter/src/types/index.d.ts +6 -162
  40. package/es/components/table-filter/style/iconfont.ttf +0 -0
  41. package/es/components/table-filter/style/index.css +1 -1
  42. package/es/components/time-picker/index.d.ts +18 -0
  43. package/es/components/time-picker/index.js +1 -0
  44. package/es/components/time-picker/src/TimePicker.vue.d.ts +18 -0
  45. package/es/components/time-picker/src/TimePicker.vue.js +1 -0
  46. package/es/env.d.ts +24 -24
  47. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
  48. package/es/shared/utils/tapable/index.d.ts +139 -0
  49. package/package.json +65 -65
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
+ ```
@@ -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';
@@ -0,0 +1,20 @@
1
+ import { SFCWithInstall } from '../../../es/shared/types';
2
+ declare const DatePicker: SFCWithInstall<import("vue").DefineComponent<{}, {
3
+ attrs: {
4
+ [x: string]: unknown;
5
+ };
6
+ emits: (event: "update:formattedValue", ...args: any[]) => void;
7
+ datePickerRef: import("vue").Ref<null>;
8
+ __formattedValue: import("vue").Ref<any>;
9
+ keyupValue: import("vue").Ref<string>;
10
+ inputIndex: number;
11
+ placeholder: string;
12
+ formatRef: import("vue").ComputedRef<unknown>;
13
+ updateFormattedValue: (value: any) => void;
14
+ onBlur: () => void;
15
+ onKeyUp: (event: import("../../../es/shared/types").AnyObject) => any;
16
+ NDatePicker: any;
17
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:formattedValue"[], "update:formattedValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>> & {
18
+ "onUpdate:formattedValue"?: ((...args: any[]) => any) | undefined;
19
+ }, {}>>;
20
+ export default DatePicker;
@@ -0,0 +1 @@
1
+ import{COMPONENT_NAMESPACE as r}from"../../shared/global/variable.js";import{safeComponentRegister as e}from"../../shared/utils/index.js";import t from"./src/DatePicker.vue.js";const a=t;a.install=function(t){e(t,a,r+"DatePicker")};export{a as default};
@@ -0,0 +1,20 @@
1
+ import { AnyObject } from '../../../../es/shared/types';
2
+ declare const _default: import("vue").DefineComponent<{}, {
3
+ attrs: {
4
+ [x: string]: unknown;
5
+ };
6
+ emits: (event: "update:formattedValue", ...args: any[]) => void;
7
+ datePickerRef: import("vue").Ref<null>;
8
+ __formattedValue: import("vue").Ref<any>;
9
+ keyupValue: import("vue").Ref<string>;
10
+ inputIndex: number;
11
+ placeholder: string;
12
+ formatRef: import("vue").ComputedRef<unknown>;
13
+ updateFormattedValue: (value: any) => void;
14
+ onBlur: () => void;
15
+ onKeyUp: (event: AnyObject) => any;
16
+ NDatePicker: any;
17
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:formattedValue"[], "update:formattedValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>> & {
18
+ "onUpdate:formattedValue"?: ((...args: any[]) => any) | undefined;
19
+ }, {}>;
20
+ export default _default;
@@ -0,0 +1 @@
1
+ import{defineComponent as e,useAttrs as t,ref as a,computed as l,watch as u,openBlock as r,createBlock as o,unref as n,mergeProps as i,createSlots as v,renderList as d,withCtx as m,renderSlot as f}from"vue";import{NDatePicker as s}from"naive-ui";import{parse as c,isValid as y,format as p}from"date-fns";import _ from"../../../_virtual/plugin-vue_export-helper.js";var g=_(e({__name:"DatePicker",emits:["update:formattedValue"],setup(e,{expose:_,emit:g}){const k=t(),M=a(null),h=a(),P=a("");let $=-1,b="";const x=l((()=>{if(k.format)return k.format;const e=k.type||"";return["datetime","datetimerange"].includes(e)?"yyyy-MM-dd HH:mm:ss":"month"===e?"yyyy-MM":"year"===e?"yyyy":"yyyy-MM-dd"}));function D(e){g("update:formattedValue",e)}function V(){var e;const t=c(P.value,null==(e=x.value.match(/[a-zA-Z]/g))?void 0:e.join(""),new Date);if(y(t)){const e=p(t,x.value);~$?h.value?h.value[$]=e:h.value=[e,e]:h.value=e,D(h.value)}}function j(e){var t,a,l,u;const{keyCode:r=0}=e;if((k.type||"").includes("range")&&(b=(null==(t=e.target)?void 0:t.placeholder)||b,$=b.includes("开始")?0:1),13==r)return null==(l=null==(a=M.value)?void 0:a.blur)?void 0:l.call(a);P.value=(null==(u=e.target)?void 0:u.value)||""}return u((()=>k["formatted-value"]),(e=>{h.value=e}),{immediate:!0}),_({$datePicker:M,focus:()=>{var e,t;return null==(t=null==(e=M.value)?void 0:e.focus)?void 0:t.call(e)},blur:()=>{var e,t;return null==(t=null==(e=M.value)?void 0:e.blur)?void 0:t.call(e)}}),(e,t)=>(r(),o(n(s),i({ref_key:"datePickerRef",ref:M},e.$attrs,{"formatted-value":h.value,"onUpdate:formattedValue":D,onBlur:V,onKeyup:j}),v({_:2},[d(e.$slots,((t,a)=>({name:a,fn:m((()=>[f(e.$slots,a)]))})))]),1040,["formatted-value"]))}}),[["__file","DatePicker.vue"]]);export{g as default};
@@ -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{fabric as u}from"../utils/index.js";import{getIndex as c,isEffectiveNode as f}from"../utils/utils.js";import{cloneDeep as p}from"lodash-es";import{format as d}from"date-fns";function h(h,g,m,v,y,k){const{cumputedX:w,cumputedY:x,getXValue:b,getYValue:T}=t(g),{getEqualXTypes:j,repeatTip:C}=k,{xAxis:E,grid:P,originX:S,originY:G,xCellWidth:L,endY:Y,startTime:A,leftAddAreaWidth:I,leftScales:M,rightScales:X,yCellHeight:D,endX:H,scaleValues:O,canvasWidth:V,borderStyle:W,rightAddAreaWidth:$,event:R,originYCervix:q,other:z}=g,B=p(O),F=new Set;function J(){B.forEach(((t,e)=>{var s;const a=[],u=[],c=[];null==(s=t.data)||s.forEach(((s,f)=>{!function(s,f,p){let d,y;const{pointAttr:k={},lineAttr:w={},title:x="",key:j,type:C="circle",childbirth:E={}}=t,P=t.data[p+1],S=U(P,t);if(s&&S&&!f.breakpoint)y=n([...s,...S],{...w});else if(s&&!S&&!f.breakpoint){const e=U(P,t);y=e?n([...s,...e],{...w}):null}let G,Y;if(f.childbirth){const t=s[1]+D;G=o([s[0],s[1],t],E.style||{}),c.push(G),E.text&&(Y=i([s[0]+L/2,t-D/2],{value:String(E.text),...r,originX:"left",originY:"center",...E.style||{}}),c.push(Y))}const A=u[p-1],I={origin:{data:f,title:x,key:j||"",dataIndex:e,index:p},leftLine:A,rightLine:y,arrowGroup:G,arrowGroupText:Y,...k,...g.event};A?d=l(C,{left:A.get("x2"),top:A.get("y2"),...I}):s&&(I.leftLine=null,d=l(C,{left:s[0],top:s[1],...I}));u.push(y),d&&(!function(t){R.hovered&&(t.on("mouseover",(()=>{Q(t)})),t.on("mouseout",(()=>{v.show=!1})));t.on("moving",(()=>{N(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+L/2,top:t.top+D/2})}(t),R.hovered&&Q(t)})),t.on("mouseup",(e=>{if(v.show=!1,1===e.button){const{key:e}=t.origin,n={...t.origin,data:{...t.origin.data,time:b(t.left),value:T(e,t.top)}};h.value.discardActiveObject(),m("change",n),K(n,"change")}}))}(d),a.push(d),F.add(d))}(U(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=>{h.value.add(...e,...t,...n),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function K(t,e="add"){const{dataIndex:n,data:o,index:i,key:r}=t,l=B.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=c(o.time,l.data);l.data.splice(t,0,o);break}}var s;F.size&&(null==(s=h.value)||s.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}([...F]))),F.clear(),J()}function N(t){const e=t.prevPoint?t.prevPoint.left:S,n=t.nextPoint?t.nextPoint.left:H;t.setCoords(),["cervix","fetalPresentation"].includes(t.origin.key)&&t.top<q&&t.set("top",q),t.top<G&&t.set("top",G),t.top>Y&&t.set("top",Y),t.left<e&&t.set("left",e),t.left>n&&t.set("left",n)}function Q(t){const{title:e,key:n}=t.origin;v.point={x:t.left,y:t.top},v.list=[`${e} ${T(n,t.top)}`,`时间 ${b(t.left).slice(-5)}`],v.show=!0}function U(t,e){if(f(t)&&function(t){const e=A+864e5,n=new Date(t).getTime();return n>=A&&n<=e}(t.time)){const n=w(t.time),o=x(e.key,e.range,t.value);return[n,o<G?G:o>Y?Y:o]}}function Z(t,e){return t+1>e[1]?e[0]:t+1}return e(h,g,!0),function(){const t=new u.Rect({...W,width:V-I-$,height:Y,left:I,top:0,fill:"transparent"});h.value.add(t)}(),function(){let t=I;[...M,...X].forEach(((e,n)=>{const{range:o,spaceValue:l,width:c,title:f,titleStyle:p,layout:d}=e,g=[];"right"===d&&(t=H);const m=t+c/2,v=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);v.forEach(((t,e)=>{const n=0===e?Y-8:Y-e*D;g.push(i([m,n],{value:String(t),...r}))}));const y=new u.Rect({...a,width:c,height:Y,left:m,top:Y/2}),k=G>0?i([m,G-D/2],{value:String(f),...r,...p}):null,w=new u.Group([...g,y,...k?[k]:[]],{objectCaching:!1,...s});h.value.add(w),t+=c}))}(),function(){const{show:t,startTime:e,range:n=[0,23],position:o="top",style:l}=E.time,{show:a,range:c=[0,23],style:f}=E.processTime;if(t||a){const p=[],d=[],g=[],m=[],v=S+L/2;for(let s=0;s<P.mainXCell;s++){if(t){const t=0===s?+e.slice(11,13):Z(p.at(-1),n);p.push(t);const a="top"==o?G-15:Y+15;g.push(i([v+s*L,a],{value:String(t),...r,...l||{}}))}if(a){const t=0===s?c[0]:d.at(-1)+1;d.push(t);const e="top"==o?Y+15:G-15;m.push(i([v+s*L,e],{value:String(t),...r,...f||{}}))}}const y=new u.Group([...g,...m],{objectCaching:!1,...s});h.value.add(y),h.value.sendToBack(y)}}(),function(){const t=Object.values(z),e=[],o={},i=B.find((t=>"cervix"===t.key)),r=i.data.find((t=>3==+t.value));function l(t,e){const{key:n,range:o}=i||{},r=x(n,o,10),l=[0,e],s=[-e/t,0],a=[(Y-r-e)/t,Y-r],u=[H-S,t*(H-S)+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>=S&&n<=H&&o>=r&&o<=Y}function h([t,e]){return[S+t,Y-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]}t.forEach((t=>{if(!t.show)return;const{key:s}=t;switch(s){case"fetalPresentation":{const{range:o}=B.find((t=>t.key===s)),i=x(s,o,0);e.push(n([S,i,H,i],{...t}));break}case"alert":if(r){const{key:s,range:a}=i||{},u=216e5,c={time:d(new Date(new Date(r.time).getTime()+u),"yyyy-MM-dd HH:mm"),value:10},[f,p]=[w(r.time)-S,Y-x(s,a,r.value)],[h,g]=[w(c.time)-S,Y-x(s,a,c.value)],m=(g-p)/(h-f),v=p-f*m,y=l(m,v);y.length>0&&(e.push(n(y,{...t})),Object.assign(o,{k:m,b:v}))}break;case"handling":if(r){const{k:i,b:s}=o,a=144e5,u=l(i,s-(w(d(new Date(new Date(r.time).getTime()+a),"yyyy-MM-dd HH:mm"))-w(r.time))*i);u.length>0&&e.push(n(u,{...t}))}}})),h.value.add(...e)}(),J(),function(){function t(t,e){const n=B.findIndex((e=>e.key===t.key));return{renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,dataIndex:n,key:t.key},pointer:e}}g.event.evented&&h.value.on("mouse:up",(e=>{if(3===e.button){const{x:n=0,y:o=0}=e.pointer||{};n>=S&&n<=H&&o>=G&&o<=Y&&(y.point={x:n,y:o},y.show=!0,e.target?(y.target=e.target,y.list=["删除节点"],h.value.forEachObject((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&y.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(y.target=null,y.list=["新增节点"],B.forEach((i=>{if(!j(n,"key",L).includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<q)return;y.list.push(t(i,e.pointer))}})),1===y.list.length&&(y.show=!1,C(),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const t=V-$/2;function e(t,e){if(!t.length)return;let o=G;const i=[];t.forEach((t=>{const n=t.title.split("").join("\n"),s=O.findIndex((e=>e.key===t.key)),a=new u.Text(String(n),{...r,...t.titleStyle||{},originY:"top",left:e,top:o,lineHeight:1}),c=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,...g.event});o+=a.height+c.height+15,function(t){function e(t){const{left:e,top:n}=t;return e>=S&&e<=H&&n>=G&&n<=Y}t.on("moving",(()=>{t.set("originY","center"),e(t)?(N(t),Q(t)):v.show=!1})),t.on("mouseup:before",(n=>{if(v.show=!1,0===n.e.button&&e(t))if(j(t.left,"key",L).includes(t.origin.key))C();else{const e={data:{time:b(t.left),value:T(t.origin.key,t.top)},...t.origin};m("add",e),K(e)}!function(t){t.setCoords().set({originY:"top",left:t.originLeft,top:t.originTop})}(t)}))}(c),i.push(a,c)})),n(i),h.value.add(...i)}function n(t){const e=t.at(-1),n=(Y-G)/2,o=(e.height+e.top-G)/2;t.forEach((t=>{const e=t.top+n-o;t.set({top:e,originTop:e})}))}e(M,I/2),e(X,t)}(),{clickMenu:function({item:t,target:e}){const n={...t.origin};"remove"===t.mode?(m("remove",n),K(n,"remove")):(Object.assign(n,{data:{time:b(t.pointer.x),value:T(t.origin.key,t.pointer.y)}}),m("add",n),K(n))}}}export{h 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{fabric as u}from"../utils/index.js";import{getIndex as c,isEffectiveNode as f}from"../utils/utils.js";import{cloneDeep as d}from"lodash-es";import{format as p}from"date-fns";function h(h,g,v,m,y,k){const{cumputedX:w,cumputedY:x,getXValue:b,getYValue:T}=t(g),{getEqualXTypes:j,repeatTip:C}=k,{xAxis:E,grid:P,originX:S,originY:Y,xCellWidth:G,endY:L,startTime:M,leftAddAreaWidth:A,leftScales:X,rightScales:I,yCellHeight:D,endX:H,scaleValues:O,canvasWidth:V,borderStyle:W,rightAddAreaWidth:$,event:R,originYCervix:q,other:z}=g,B=d(O),F=new Set;function J(){B.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,y;const{pointAttr:k={},lineAttr:w={},title:x="",key:j,type:C="circle",childbirth:E={}}=t,P=t.data[d+1],S=U(P,t);if(s&&S&&!f.breakpoint)y=n([...s,...S],{...w});else if(s&&!S&&!f.breakpoint){const e=U(P,t);y=e?n([...s,...e],{...w}):null}let Y,L;if(f.childbirth){const t=s[1]+D;Y=o([s[0],s[1],t],E.style||{}),c.push(Y),E.text&&(L=i([s[0]+G/2,t-D/2],{value:String(E.text),...r,originX:"left",originY:"center",...E.style||{}}),c.push(L))}const M=u[d-1],A={origin:{data:f,title:x,key:j||"",dataIndex:e,index:d},leftLine:M,rightLine:y,arrowGroup:Y,arrowGroupText:L,...k,...g.event.hovered?g.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:g.event};M?p=l(C,{left:M.get("x2"),top:M.get("y2"),...A}):s&&(A.leftLine=null,p=l(C,{left:s[0],top:s[1],...A}));u.push(y),p&&(!function(t){R.hovered&&(t.on("mouseover",(()=>{Q(t)})),t.on("mouseout",(()=>{m.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;t.on("moving",(()=>{N(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+G/2,top:t.top+D/2})}(t),R.hovered&&Q(t)})),t.on("mouseup",(e=>{if(m.show=!1,1===e.button){const{key:e}=t.origin,n={...t.origin,data:{...t.origin.data,time:b(t.left),value:T(e,t.top)}};h.value.discardActiveObject(),v("change",n),K(n,"change")}}))}(p),a.push(p),F.add(p))}(U(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=>{h.value.add(...e,...t,...n),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function K(t,e="add"){const{dataIndex:n,data:o,index:i,key:r}=t,l=B.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=c(o.time,l.data);l.data.splice(t,0,o);break}}var s;F.size&&(null==(s=h.value)||s.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}([...F]))),F.clear(),J()}function N(t){const e=t.prevPoint?t.prevPoint.left:S,n=t.nextPoint?t.nextPoint.left:H;t.setCoords(),["cervix","fetalPresentation"].includes(t.origin.key)&&t.top<q&&t.set("top",q),t.top<Y&&t.set("top",Y),t.top>L&&t.set("top",L),t.left<e&&t.set("left",e),t.left>n&&t.set("left",n)}function Q(t){const{title:e,key:n}=t.origin;m.point={x:t.left,y:t.top},m.list=[`${e} ${T(n,t.top)}`,`时间 ${b(t.left).slice(-5)}`],m.show=!0}function U(t,e){if(f(t)&&function(t){const e=M+864e5,n=new Date(t).getTime();return n>=M&&n<=e}(t.time)){const n=w(t.time),o=x(e.key,e.range,t.value);return[n,o<Y?Y:o>L?L:o]}}function Z(t,e){return t+1>e[1]?e[0]:t+1}return e(h,g,!0),function(){const t=new u.Rect({...W,width:V-A-$-1,height:L,left:A,top:0,fill:"transparent"});h.value.add(t)}(),function(){let t=A;[...X,...I].forEach(((e,n)=>{const{range:o,spaceValue:l,width:c,title:f,titleStyle:d,layout:p}=e,g=[];"right"===p&&(t=H);const v=t+c/2,m=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);m.forEach(((t,e)=>{const n=0===e?L-8:L-e*D;g.push(i([v,n],{value:String(t),...r}))}));const y=new u.Rect({...a,width:c,height:L,left:v,top:L/2}),k=Y>0?i([v,Y-D/2],{value:String(f),...r,...d}):null,w=new u.Group([...g,y,...k?[k]:[]],{objectCaching:!1,...s});h.value.add(w),t+=c}))}(),function(){const{show:t,startTime:e,range:n=[0,23],position:o="top",style:l}=E.time,{show:a,range:c=[0,23],style:f}=E.processTime;if(t||a){const d=[],p=[],g=[],v=[],m=S+G/2;for(let s=0;s<P.mainXCell;s++){if(t){const t=0===s?+e.slice(11,13):Z(d.at(-1),n);d.push(t);const a="top"==o?Y-15:L+15;g.push(i([m+s*G,a],{value:String(t),...r,...l||{}}))}if(a){const t=0===s?c[0]:p.at(-1)+1;p.push(t);const e="top"==o?L+15:Y-15;v.push(i([m+s*G,e],{value:String(t),...r,...f||{}}))}}const y=new u.Group([...g,...v],{objectCaching:!1,...s});h.value.add(y),h.value.sendToBack(y)}}(),function(){var t;const e=Object.values(z),o=[],i={},r=B.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=x(n,o,10),l=[0,e],s=[-e/t,0],a=[(L-i-e)/t,L-i],u=[H-S,t*(H-S)+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>=S&&n<=H&&o>=i&&o<=L}function h([t,e]){return[S+t,L-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}=B.find((t=>t.key===e));if(r){const r=x(e,i,0);o.push(n([S,r,H,r],{...t}))}break}case"alert":if(l){const{key:e,range:a}=r||{},u=216e5,c={time:p(new Date(new Date(l.time).getTime()+u),"yyyy-MM-dd HH:mm"),value:10},[f,d]=[w(l.time)-S,L-x(e,a,l.value)],[h,g]=[w(c.time)-S,L-x(e,a,c.value)],v=(g-d)/(h-f),m=d-f*v,y=s(v,m);y.length>0&&(o.push(n(y,{...t})),Object.assign(i,{k:v,b:m}))}break;case"handling":if(l){const{k:e,b:r}=i,a=144e5,u=s(e,r-(w(p(new Date(new Date(l.time).getTime()+a),"yyyy-MM-dd HH:mm"))-w(l.time))*e);u.length>0&&o.push(n(u,{...t}))}}})),h.value.add(...o)}(),J(),function(){function t(t,e){const n=B.findIndex((e=>e.key===t.key));return{renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,dataIndex:n,key:t.key},pointer:e}}g.event.evented&&h.value.on("mouse:up",(e=>{if(3===e.button){const{x:n=0,y:o=0}=e.pointer||{};n>=S&&n<=H&&o>=Y&&o<=L&&(y.point={x:n,y:o},y.show=!0,e.target?(y.target=e.target,y.list=["删除节点"],h.value.forEachObject((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&y.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(y.target=null,y.list=["新增节点"],B.filter((t=>t.show)).forEach((i=>{if(!j(n,"key",G).includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<q)return;y.list.push(t(i,e.pointer))}})),1===y.list.length&&(y.show=!1,C(),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const t=V-$/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=O.findIndex((e=>e.key===t.key)),a=new u.Text(String(n),{...r,...t.titleStyle||{},originY:"top",left:e,top:o,lineHeight:1}),c=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,...g.event});o+=a.height+c.height+15,function(t){function e(t){const{left:e,top:n}=t;return e>=S&&e<=H&&n>=Y&&n<=L}t.on("moving",(()=>{t.set("originY","center"),e(t)?(N(t),Q(t)):m.show=!1})),t.on("mouseup:before",(n=>{if(m.show=!1,0===n.e.button&&e(t))if(j(t.left,"key",G).includes(t.origin.key))C();else{const e={data:{time:b(t.left),value:T(t.origin.key,t.top)},...t.origin};v("add",e),K(e)}!function(t){t.setCoords().set({originY:"top",left:t.originLeft,top:t.originTop})}(t)}))}(c),i.push(a,c)})),n(i),h.value.add(...i)}function n(t){const e=t.at(-1),n=(L-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(X,A/2),e(I,t)}(),{clickMenu:function({item:t,target:e}){const n={...t.origin};"remove"===t.mode?(v("remove",n),K(n,"remove")):(Object.assign(n,{data:{time:b(t.pointer.x),value:T(t.origin.key,t.pointer.y)}}),v("add",n),K(n))}}}export{h as useBirthProcess};
@@ -1 +1 @@
1
- import{ref as e,reactive as a,computed as l,onMounted as t,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 n}from"./useBirthProcess.js";import{useCommon as d}from"./useCommon.js";function o(o,v,c,h){const m=e(),p=e(),g=e(),f=a({show:!1,point:{x:0,y:0},list:[]}),x=a({show:!1,point:{x:0,y:0},list:[],target:null}),y=l((()=>v.data.scaleValues.filter((e=>"left"===e.layout)))),V=l((()=>v.data.scaleValues.filter((e=>"right"===e.layout)))),w=l((()=>{var e;return(null==(e=V.value)?void 0:e.length)?30:0})),C=l((()=>{var e;return 30+(null==(e=y.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),A=l((()=>{var e;const{width:a}=v.data,l=null==(e=V.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-w.value-l})),Y=l((()=>v.data.grid.mainXCell)),j=l((()=>v.data.grid.mainYCell)),S=l((()=>(A.value-C.value)/Y.value)),b=l((()=>{const{xAxis:e,height:a}=v.data,l=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(j.value+l)})),k=l((()=>b.value)),P=l((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"cervix"===e.key)),[,l]=(null==a?void 0:a.range)||[0,10],t=(null==a?void 0:a.spaceValue)||1;return X.value-l*t*b.value})),X=l((()=>{const{height:e}=v.data;return e-b.value})),H=l((()=>new Date(v.data.xAxis.time.startTime).getTime())),T=l((()=>36e5/S.value)),W=l((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"cervix"===e.key));return((null==a?void 0:a.spaceValue)||1)/b.value})),M=l((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"FHR"===e.key));return((null==a?void 0:a.spaceValue)||10)/b.value})),D=l((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"fetalPresentation"===e.key));return((null==a?void 0:a.spaceValue)||1)/b.value})),F=l((()=>{var e;return(null==(e=v.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),N=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:C.value,endX:A.value,originY:k.value,endY:X.value,xCellWidth:S.value,yCellHeight:b.value,gridXNumber:Y.value,gridYNumber:j.value,xAxis:v.data.xAxis,leftScales:y.value,rightScales:V.value,leftAddAreaWidth:30,rightAddAreaWidth:w.value,startTime:H.value,timeXCell:T.value,cervixYCell:W.value,FHRYCell:M.value,fetalPresentationYCell:D.value,scaleValues:v.data.scaleValues,event:F.value,originYCervix:P.value}),R=d(o);return t((()=>{u((()=>{const{clickMenu:e}=n(o,N,c,f,x,R);g.value=e,i(h.value);const{select:a}=s(o,N,c);m.value=a}))})),{propItems:N,redrawPoints:p,select:m,pointTipProps:f,pointMenuProps:x,clickMenu:g}}export{o as default};
1
+ import{ref as e,reactive as a,computed as l,onMounted as t,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 n}from"./useBirthProcess.js";import{useCommon as d}from"./useCommon.js";function o(o,v,c,h){const m=e(),p=e(),g=e(),f=a({show:!1,point:{x:0,y:0},list:[]}),x=a({show:!1,point:{x:0,y:0},list:[],target:null}),w=l((()=>v.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),y=l((()=>v.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),V=l((()=>{var e;return(null==(e=y.value)?void 0:e.length)?30:0})),C=l((()=>{var e;return 30+(null==(e=w.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),A=l((()=>{var e;const{width:a}=v.data,l=null==(e=y.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-V.value-l})),Y=l((()=>v.data.grid.mainXCell)),j=l((()=>v.data.grid.mainYCell)),S=l((()=>(A.value-C.value)/Y.value)),b=l((()=>{const{xAxis:e,height:a}=v.data,l=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(j.value+l)})),k=l((()=>b.value)),P=l((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"cervix"===e.key)),[,l]=(null==a?void 0:a.range)||[0,10],t=(null==a?void 0:a.spaceValue)||1;return X.value-l*t*b.value})),X=l((()=>{const{height:e}=v.data;return e-b.value})),H=l((()=>new Date(v.data.xAxis.time.startTime).getTime())),T=l((()=>36e5/S.value)),W=l((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"cervix"===e.key));return((null==a?void 0:a.spaceValue)||1)/b.value})),M=l((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"FHR"===e.key));return((null==a?void 0:a.spaceValue)||10)/b.value})),D=l((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"fetalPresentation"===e.key));return((null==a?void 0:a.spaceValue)||1)/b.value})),F=l((()=>{var e;return(null==(e=v.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),N=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:C.value,endX:A.value,originY:k.value,endY:X.value,xCellWidth:S.value,yCellHeight:b.value,gridXNumber:Y.value,gridYNumber:j.value,xAxis:v.data.xAxis,leftScales:w.value,rightScales:y.value,leftAddAreaWidth:30,rightAddAreaWidth:V.value,startTime:H.value,timeXCell:T.value,cervixYCell:W.value,FHRYCell:M.value,fetalPresentationYCell:D.value,scaleValues:v.data.scaleValues,event:F.value,originYCervix:P.value}),R=d(o);return t((()=>{u((()=>{const{clickMenu:e}=n(o,N,c,f,x,R);g.value=e,i(h.value);const{select:a}=s(o,N,c);m.value=a}))})),{propItems:N,redrawPoints:p,select:m,pointTipProps:f,pointMenuProps:x,clickMenu:g}}export{o as default};