cnhis-design-vue 3.2.7-beta.5 → 3.2.7-beta.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. package/README.md +87 -87
  2. package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
  3. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
  4. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcess.js +1 -1
  5. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  6. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  7. package/es/components/fabric-chart/src/hooks/useScaleColumn.d.ts +1 -1
  8. package/es/components/fabric-chart/src/hooks/useScaleColumn.js +1 -1
  9. package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
  10. package/es/components/form-config/index.d.ts +3 -3
  11. package/es/components/form-config/src/FormConfig.vue.d.ts +3 -3
  12. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +3 -3
  13. package/es/components/form-render/src/hooks/useFormValidator.js +1 -1
  14. package/es/components/form-render/src/types/fieldItem.d.ts +1 -2
  15. package/es/components/iho-chat/index.d.ts +1 -1
  16. package/es/components/iho-chat/src/Index.vue.d.ts +1 -1
  17. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
  18. package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +1 -1
  19. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  20. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  21. package/es/components/shortcut-setter/index.d.ts +1 -1
  22. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -1
  23. package/es/env.d.ts +25 -25
  24. package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
  25. package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
  26. package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
  27. package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
  28. package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
  29. package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
  30. package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
  31. package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
  32. package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
  33. package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
  34. package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
  35. package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
  36. package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
  37. package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
  38. package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
  39. package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
  40. package/es/shared/assets/img/failure.png.js +1 -1
  41. package/es/shared/assets/img/no-permission.png.js +1 -1
  42. package/es/shared/assets/img/nodata.png.js +1 -1
  43. package/es/shared/assets/img/notfound.png.js +1 -1
  44. package/es/shared/assets/img/qr.png.js +1 -1
  45. package/es/shared/assets/img/success.png.js +1 -1
  46. package/es/shared/assets/img/table_style_2.png.js +1 -1
  47. package/es/shared/assets/img/video.png.js +1 -1
  48. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  49. package/es/shared/assets/img/xb_big.png.js +1 -1
  50. package/es/shared/assets/img/xb_small.png.js +1 -1
  51. package/es/shared/package.json.js +1 -1
  52. package/package.json +2 -2
  53. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  54. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  55. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  56. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  57. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  58. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  59. package/es/shared/utils/tapable/index.d.ts +0 -139
package/README.md CHANGED
@@ -1,87 +1,87 @@
1
- # 安装
2
-
3
- ```shell
4
- npm i cnhis-design-vue@[版本号]
5
- # or
6
- yarn add cnhis-design-vue@[版本号] #推荐
7
- ```
8
-
9
- ## 1.全局引入
10
-
11
- ```typescript
12
- // main.ts
13
- import { createApp } from 'vue';
14
- import App from './App.vue';
15
- import 'cnhis-design-vue/es/packages/index.css';
16
- import cui from 'cnhis-design-vue';
17
-
18
- const app = createApp(App);
19
- app.use(cui).mount('#app');
20
- ```
21
-
22
- ## 2. 按需引入
23
-
24
- 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
-
26
- ### 2.1 样式处理方式1 (按需引入样式)
27
-
28
- ```shell
29
- # 安装自动导入样式的插件
30
- npm i -d vite-plugin-style-import
31
- ```
32
-
33
- ```typescript
34
- // vite.config.ts
35
- import { defineConfig } from 'vite';
36
- import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
-
38
- export default defineConfig({
39
- plugins: [
40
- // ...otherPlugins
41
- createStyleImportPlugin({
42
- libs: [
43
- {
44
- libraryName: 'cnhis-design-vue',
45
- esModule: true,
46
- ensureStyleFile: true,
47
- resolveStyle: name => {
48
- return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
- }
50
- }
51
- ]
52
- })
53
- ]
54
- });
55
- ```
56
-
57
- ### 2.2 样式处理方式2 (全局引入样式)
58
-
59
- ```typescript
60
- // main.ts
61
- import 'cnhis-design-vue/es/components/index.css';
62
- ```
63
-
64
- ## 3.FAQ
65
-
66
- ### 3.1 项目打包后样式丢失
67
-
68
- 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
-
70
- ```typescript
71
- // vite.config.ts
72
- import { defineConfig } from 'vite';
73
-
74
- export default defineConfig({
75
- build: {
76
- rollupOptions: {
77
- // ..otherOptions
78
- output: {
79
- dir: './dist',
80
- manualChunks: {
81
- 'cnhis-vendor': ['cnhis-design-vue']
82
- }
83
- }
84
- }
85
- }
86
- });
87
- ```
1
+ # 安装
2
+
3
+ ```shell
4
+ npm i cnhis-design-vue@[版本号]
5
+ # or
6
+ yarn add cnhis-design-vue@[版本号] #推荐
7
+ ```
8
+
9
+ ## 1.全局引入
10
+
11
+ ```typescript
12
+ // main.ts
13
+ import { createApp } from 'vue';
14
+ import App from './App.vue';
15
+ import 'cnhis-design-vue/es/packages/index.css';
16
+ import cui from 'cnhis-design-vue';
17
+
18
+ const app = createApp(App);
19
+ app.use(cui).mount('#app');
20
+ ```
21
+
22
+ ## 2. 按需引入
23
+
24
+ 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
+
26
+ ### 2.1 样式处理方式1 (按需引入样式)
27
+
28
+ ```shell
29
+ # 安装自动导入样式的插件
30
+ npm i -d vite-plugin-style-import
31
+ ```
32
+
33
+ ```typescript
34
+ // vite.config.ts
35
+ import { defineConfig } from 'vite';
36
+ import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
+
38
+ export default defineConfig({
39
+ plugins: [
40
+ // ...otherPlugins
41
+ createStyleImportPlugin({
42
+ libs: [
43
+ {
44
+ libraryName: 'cnhis-design-vue',
45
+ esModule: true,
46
+ ensureStyleFile: true,
47
+ resolveStyle: name => {
48
+ return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
+ }
50
+ }
51
+ ]
52
+ })
53
+ ]
54
+ });
55
+ ```
56
+
57
+ ### 2.2 样式处理方式2 (全局引入样式)
58
+
59
+ ```typescript
60
+ // main.ts
61
+ import 'cnhis-design-vue/es/components/index.css';
62
+ ```
63
+
64
+ ## 3.FAQ
65
+
66
+ ### 3.1 项目打包后样式丢失
67
+
68
+ 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
+
70
+ ```typescript
71
+ // vite.config.ts
72
+ import { defineConfig } from 'vite';
73
+
74
+ export default defineConfig({
75
+ build: {
76
+ rollupOptions: {
77
+ // ..otherOptions
78
+ output: {
79
+ dir: './dist',
80
+ manualChunks: {
81
+ 'cnhis-vendor': ['cnhis-design-vue']
82
+ }
83
+ }
84
+ }
85
+ }
86
+ });
87
+ ```
@@ -175,6 +175,9 @@ declare const _default: import("vue").DefineComponent<{
175
175
  modelValue: unknown[];
176
176
  componentData: Record<string, any>;
177
177
  } & {
178
+ /**
179
+ * 改变弹窗大小
180
+ */
178
181
  itemKey?: string | Function | undefined;
179
182
  }>, {
180
183
  move: Function;
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,drawArrow as o,drawText as n,defaultTextStyle as i,drawPoint as r,drawTextAndIconGroup as s,defaultStyle as l,defaultRectStyle as a}from"../useDraw.js";import{useGrid as u}from"../useGrid.js";import{useBirthProcessCumputedPoint as c}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as d,drawScaleNumber as f,drawScaleLine as p}from"../useScaleColumn.js";import{useCommon as h}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as m,getTime as v,getScaleNumberList as y}from"../../utils/index.js";import{cloneDeep as k,last as w}from"lodash-es";import"../temperature/useShadow.js";import"@vueuse/shared";import{format as x}from"date-fns";import"naive-ui";import"@vueuse/core";function b(b,j,P,C,E){const{computedX:S,computedY:G,getXValue:T,getYValue:L}=c(j),{getEqualXTypes:Y,handleAddPrevent:M,isGridLimit:A,setPrevAndNextPoint:X,getPointEventProps:I}=h(b,P,j),{xAxis:H,grid:W,originX:N,originY:O,xCellWidth:V,endY:D,startTime:R,leftAddAreaWidth:$,leftScales:B,rightScales:F,yCellHeight:q,endX:z,scaleValues:J,canvasWidth:K,borderStyle:Q,rightAddAreaWidth:U,event:Z,originYCervix:_,other:tt,canvasHeight:et}=j,ot=k(J),nt=new Set;function it(){ot.filter((t=>t.show)).forEach(((t,s)=>{var l;const a=[],u=[],c=[];null==(l=t.data)||l.forEach(((l,d)=>{!function(l,d,f){let p,h;const{pointAttr:g={},lineAttr:m={},title:v="",key:y,type:k="circle",childbirthStyle:w={}}=t,x=t.data[f+1],j=ut(x,t);if(l&&j&&!d.breakpoint)h=e([...l,...j],{...m});else if(l&&!j&&!d.breakpoint){const o=ut(x,t);h=o?e([...l,...o],{...m}):null}let E,S;if(d.childbirth){const t=l[1]+q;E=o([l[0],l[1],t],w),c.push(E),S=n([l[0]+V/2,t-q/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(S)}const G=u[f-1],Y={origin:{data:d,title:v,key:y||"",dataIndex:s,index:f},leftLine:G,rightLine:h,arrowGroup:E,arrowGroupText:S,...g,...I()};l&&(G||(Y.leftLine=null),p=r(k,{left:l[0],top:l[1],...Y}));u.push(h),p&&(!function(t){Z.hovered&&(t.on("mouseover",(()=>{at(t,"hover")})),t.on("mouseout",(()=>{C.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;t.on("moving",(()=>{lt(t),function(t){var e,o,n,i;null==(e=t.leftLine)||e.setCoords().set({x2:t.left,y2:t.top}),null==(o=t.rightLine)||o.setCoords().set({x1:t.left,y1:t.top}),null==(n=t.arrowGroup)||n.setCoords().set({left:t.left,top:t.top}),null==(i=t.arrowGroupText)||i.setCoords().set({left:t.left+V/2,top:t.top+q/2})}(t),Z.hovered&&at(t)})),t.on("mouseup",(e=>{if(C.show=!1,1===e.button){const{key:e}=t.origin,o={...t.origin,data:{...t.origin.data,time:T(t.left),value:L(e,t.top)}};b.value.discardActiveObject(),P("change",o),rt(o,"change")}}))}(p),a.push(p),nt.add(p))}(ut(l,t),l,d)})),Promise.all(a).then((t=>{const e=u.filter((t=>t));X(t),Promise.all(c).then((o=>{b.value.add(...e,...t,...o),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function rt(t,e="add"){const{dataIndex:o,data:n,index:i,key:r}=t,s=ot.find((t=>t.key===r));switch(e){case"remove":s.data.splice(i,1);break;case"change":s.data[i]=n;break;default:{const t=g(n.time,s.data);s.data.splice(t,0,n);break}}st()}function st(){var t;nt.size&&(null==(t=b.value)||t.remove(...function(t){const e=[];return t.forEach((t=>{t&&e.push(t),(null==t?void 0:t.leftLine)&&e.push(null==t?void 0:t.leftLine),(null==t?void 0:t.rightLine)&&e.push(null==t?void 0:t.rightLine),(null==t?void 0:t.arrowGroup)&&e.push(null==t?void 0:t.arrowGroup),(null==t?void 0:t.arrowGroupText)&&e.push(null==t?void 0:t.arrowGroupText)})),e}([...nt]))),nt.clear(),it()}function lt(t){const e=t.prevPoint?t.prevPoint.left:N,o=t.nextPoint?t.nextPoint.left:z;t.setCoords(),["cervix","fetalPresentation"].includes(t.origin.key)&&t.top<_&&t.set("top",_),t.top<O&&t.set("top",O),t.top>D&&t.set("top",D),t.left<e&&t.set("left",e),t.left>o&&t.set("left",o)}function at(t,e="moving"){const{title:o,key:n,data:i}=t.origin;C.point={x:t.left,y:t.top},C.list=[`${o} ${"hover"===e?i.value:L(n,t.top)}`,`时间 ${T(t.left).slice(-5)}`],C.show=!0}function ut(t,e){if(m(t)&&function(t){const e=R+864e5,o=v(t);return o>=R&&o<=e}(t.time)){const o=S(t.time),n=G(e.key,e.range,t.value);return[o,n<O?O:n>D?D:n]}}function ct(t,e){return t+1>e[1]?e[0]:t+1}return u(b,j),function(){const e=new t.Rect({...Q,width:K-$-U-1,height:D-1,left:$,top:0,fill:"transparent"});b.value.add(e)}(),function(){function e(e,o="left"){let r="left"===o?$:z;e.forEach(((e,o)=>{const{range:s,spaceValue:u,width:c,title:h,titleStyle:g,key:m,position:v="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:x}=e,j=[],P=[],C=r+c/2,E=y(s,u),S=E.length,{lineXMain:G,lineXSub:T,textLeft:L}=d(v,r,c);E.forEach(((t,o)=>{const n=D-o*q*k,i=0===o?D-8:o!==E.length-1||O||_&&"FHR"!==m?n:O+8;!w||(0===o||o===S-1)&&!x||j.push(f(String(t),e,L,i)),P.push(...p(e,o,G,T,n,q,O,S))}));const Y=new t.Rect({...a,strokeWidth:.5,width:c,height:D,left:C,top:D/2}),M=n([C,O>0?O-q/2:q/2],{value:String(h),...i,...g}),A=new t.Group([...P,...j,Y,...M?[M]:[]],{objectCaching:!1,...l});b.value.add(A),A.sendToBack(),r+=c}))}e(B),e(F,"right")}(),function(){const{show:e,startTime:o,range:r=[0,23],position:s="top",style:a}=H.time,{show:u,range:c=[0,23],position:d,style:f}=H.processTime;if(e||u){const p=[],h=[],g=[],m=[],v=N+V/2,y=q/2;for(let t=0;t<W.mainXCell;t++){if(e){const e=0===t?+o.slice(11,13):ct(w(p),r);p.push(e);const l="top"===s?O-y:D+y;g.push(n([v+t*V,l],{value:String(e),...i,...a||{}}))}if(u){const e=0===t?c[0]:w(h)+1;h.push(e);const o="top"===d?y:et-y;m.push(n([v+t*V,o],{value:String(e),...i,...f||{}}))}}const k=new t.Group([...g,...m],{objectCaching:!1,...l});b.value.add(k),b.value.sendToBack(k)}}(),function(){var t;const o=Object.values(tt),n=[],i={},r=ot.find((t=>"cervix"===t.key&&t.show)),s=null==(t=null==r?void 0:r.data)?void 0:t.find((t=>3==+t.value));function l(t,e){const{key:o,range:n}=r||{},i=G(o,n,10),s=[0,e],l=[-e/t,0],a=[(D-i-e)/t,D-i],u=[z-N,t*(z-N)+e];let c=[],d=[];function f([o,n]){return Math.abs(n-t*o-e)<=1}function p([t,e]){const[o,n]=[...h([t,e])];return o>=N&&o<=z&&n>=i&&n<=D}function h([t,e]){return[N+t,D-e]}return f(s)&&p(s)&&(c=h(s)),f(l)&&p(l)&&(c=h(l)),f(a)&&p(a)&&(d=h(a)),f(u)&&p(u)&&(d=h(u)),[...c,...d]}o.forEach((t=>{if(!t.show)return;const{key:o}=t;switch(o){case"fetalPresentation":{const{range:i,show:r}=ot.find((t=>t.key===o));if(r){const r=G(o,i,0);n.push(e([N,r,z,r],{...t}))}break}case"alert":if(s){const{key:o,range:a}=r||{},u=216e5,c={time:x(new Date(v(s.time)+u),"yyyy-MM-dd HH:mm"),value:10},[d,f]=[S(s.time)-N,D-G(o,a,s.value)],[p,h]=[S(c.time)-N,D-G(o,a,c.value)],g=(h-f)/(p-d),m=f-d*g,y=l(g,m);y.length>0&&(n.push(e(y,{...t})),Object.assign(i,{k:g,b:m}))}break;case"handling":if(s){const{k:o,b:r}=i,a=144e5,u=l(o,r-(S(x(new Date(v(s.time)+a),"yyyy-MM-dd HH:mm"))-S(s.time))*o);u.length>0&&n.push(e(u,{...t}))}}})),b.value.add(...n)}(),it(),function(){function t(t,e){const o=ot.findIndex((e=>e.key===t.key));return{renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,dataIndex:o,key:t.key},pointer:e}}j.event.evented&&b.value.on("mouse:up",(e=>{if(3===e.button){const{x:o=0,y:n=0}=e.pointer||{};o>=N&&o<=z&&n>=O&&n<=D&&(E.point={x:o,y:n},E.show=!0,e.target?(E.target=e.target,E.list=["删除节点"],[...nt].forEach((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&E.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(E.target=null,E.list=["新增节点"],ot.filter((t=>t.show)).forEach((i=>{if(!Y([...nt],o,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&n<_)return;E.list.push(t(i,e.pointer))}})),1===E.list.length&&(E.show=!1,M("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const t=K-U/2;function e(t,e){if(!t.length)return;let n=O;const i=[];t.forEach((t=>{const o=t.title.split("").join("\n"),r=J.findIndex((e=>e.key===t.key)),{text:l,icon:a}=s(o,t,{text:{originY:"top",left:e,top:n},icon:{left:e,topY:n,originY:"top",origin:{type:t.type,dataIndex:r},...j.event}},"vertical");var u;n+=l.height+a.height+15,(u=a).on("moving",(()=>{u.set("originY","center"),A(u)?(lt(u),at(u)):C.show=!1})),u.on("mouseup:before",(t=>{if(C.show=!1,0===t.e.button&&A(u))if(Y([...nt],u.left,"key").includes(u.origin.key))M("repeat");else{const t={data:{time:T(u.left),value:L(u.origin.key,u.top)},...u.origin};P("add",t),rt(t)}!function(t){t.setCoords().set({originY:"top",left:t.originLeft,top:t.originTop})}(u)})),i.push(l,a)})),o(i),b.value.add(...i)}function o(t){const e=w(t),o=(D-O)/2,n=(e.height+e.top-O)/2;t.forEach((t=>{const e=t.top+o-n;t.set({top:e,originTop:e})}))}e(B,$/2),e(F,t)}(),{clickMenu:function({item:t,target:e}){const o={...t.origin};"remove"===t.mode?(P("remove",o),rt(o,"remove")):(Object.assign(o,{data:{time:T(t.pointer.x),value:L(t.origin.key,t.pointer.y)}}),P("add",o),rt(o))},redrawPoints:st}}export{b as useBirthProcess};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,drawArrow as o,drawText as n,defaultTextStyle as i,drawPoint as r,drawTextAndIconGroup as s,defaultStyle as l,defaultRectStyle as a}from"../useDraw.js";import{useGrid as u}from"../useGrid.js";import{useBirthProcessCumputedPoint as c}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as d,drawScaleNumber as f,drawScaleLine as p}from"../useScaleColumn.js";import{useCommon as h}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as m,getTime as v,getScaleNumberList as y}from"../../utils/index.js";import{cloneDeep as k,last as w}from"lodash-es";import"../temperature/useShadow.js";import"@vueuse/shared";import{format as x}from"date-fns";import"naive-ui";import"@vueuse/core";function b(b,j,P,C,E){const{computedX:S,computedY:G,getXValue:T,getYValue:L}=c(j),{getEqualXTypes:Y,handleAddPrevent:M,isGridLimit:A,setPrevAndNextPoint:X,getPointEventProps:I}=h(b,P,j),{xAxis:H,grid:W,originX:N,originY:O,xCellWidth:V,endY:D,startTime:R,leftAddAreaWidth:$,leftScales:B,rightScales:F,yCellHeight:q,endX:z,scaleValues:J,canvasWidth:K,borderStyle:Q,rightAddAreaWidth:U,event:Z,originYCervix:_,other:tt,canvasHeight:et}=j,ot=k(J),nt=new Set;function it(){ot.filter((t=>t.show)).forEach(((t,s)=>{var l;const a=[],u=[],c=[];null==(l=t.data)||l.forEach(((l,d)=>{!function(l,d,f){let p,h;const{pointAttr:g={},lineAttr:m={},title:v="",key:y,type:k="circle",childbirthStyle:w={}}=t,x=t.data[f+1],j=ut(x,t);if(l&&j&&!d.breakpoint)h=e([...l,...j],{...m});else if(l&&!j&&!d.breakpoint){const o=ut(x,t);h=o?e([...l,...o],{...m}):null}let E,S;if(d.childbirth){const t=l[1]+q;E=o([l[0],l[1],t],w),c.push(E),S=n([l[0]+V/2,t-q/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(S)}const G=u[f-1],Y={origin:{data:d,title:v,key:y||"",dataIndex:s,index:f},leftLine:G,rightLine:h,arrowGroup:E,arrowGroupText:S,...g,...I()};l&&(G||(Y.leftLine=null),p=r(k,{left:l[0],top:l[1],...Y}));u.push(h),p&&(!function(t){Z.hovered&&(t.on("mouseover",(()=>{at(t,"hover")})),t.on("mouseout",(()=>{C.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;t.on("moving",(()=>{lt(t),function(t){var e,o,n,i;null==(e=t.leftLine)||e.setCoords().set({x2:t.left,y2:t.top}),null==(o=t.rightLine)||o.setCoords().set({x1:t.left,y1:t.top}),null==(n=t.arrowGroup)||n.setCoords().set({left:t.left,top:t.top}),null==(i=t.arrowGroupText)||i.setCoords().set({left:t.left+V/2,top:t.top+q/2})}(t),Z.hovered&&at(t)})),t.on("mouseup",(e=>{if(C.show=!1,1===e.button){const{key:e}=t.origin,o={...t.origin,data:{...t.origin.data,time:T(t.left),value:L(e,t.top)}};b.value.discardActiveObject(),P("change",o),rt(o,"change")}}))}(p),a.push(p),nt.add(p))}(ut(l,t),l,d)})),Promise.all(a).then((t=>{const e=u.filter((t=>t));X(t),Promise.all(c).then((o=>{b.value.add(...e,...t,...o),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function rt(t,e="add"){const{dataIndex:o,data:n,index:i,key:r}=t,s=ot.find((t=>t.key===r));switch(e){case"remove":s.data.splice(i,1);break;case"change":s.data[i]=n;break;default:{const t=g(n.time,s.data);s.data.splice(t,0,n);break}}st()}function st(){var t;nt.size&&(null==(t=b.value)||t.remove(...function(t){const e=[];return t.forEach((t=>{t&&e.push(t),(null==t?void 0:t.leftLine)&&e.push(null==t?void 0:t.leftLine),(null==t?void 0:t.rightLine)&&e.push(null==t?void 0:t.rightLine),(null==t?void 0:t.arrowGroup)&&e.push(null==t?void 0:t.arrowGroup),(null==t?void 0:t.arrowGroupText)&&e.push(null==t?void 0:t.arrowGroupText)})),e}([...nt]))),nt.clear(),it()}function lt(t){const e=t.prevPoint?t.prevPoint.left:N,o=t.nextPoint?t.nextPoint.left:z;t.setCoords(),["cervix","fetalPresentation"].includes(t.origin.key)&&t.top<_&&t.set("top",_),t.top<O&&t.set("top",O),t.top>D&&t.set("top",D),t.left<e&&t.set("left",e),t.left>o&&t.set("left",o)}function at(t,e="moving"){const{title:o,key:n,data:i}=t.origin;C.point={x:t.left,y:t.top},C.list=[`${o} ${"hover"===e?i.value:L(n,t.top)}`,`时间 ${T(t.left).slice(-5)}`],C.show=!0}function ut(t,e){if(m(t)&&function(t){const e=R+864e5,o=v(t);return o>=R&&o<=e}(t.time)){const o=S(t.time),n=G(e.key,e.range,t.value);return[o,n<O?O:n>D?D:n]}}function ct(t,e){return t+1>e[1]?e[0]:t+1}return u(b,j),function(){const e=new t.Rect({...Q,width:K-$-U-1,height:D-1,left:$,top:0,fill:"transparent"});b.value.add(e)}(),function(){function e(e,o="left"){let r="left"===o?$:z;e.forEach(((e,o)=>{const{range:s,spaceValue:u,width:c,title:h,titleStyle:g,key:m,position:v="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:x}=e,j=[],P=[],C=r+c/2,E=y(s,u),S=E.length,{lineXMain:G,lineXSub:T,textLeft:L}=d(v,r,c);E.forEach(((t,o)=>{const n=D-o*q*k,i=0===o?D-8:o!==E.length-1||O||_&&"FHR"!==m?n:O+8;!w||(0===o||o===S-1)&&!x||j.push(f(String(t),e,L,i)),P.push(...p(e,o,G,T,n,q,O,S,1))}));const Y=new t.Rect({...a,strokeWidth:.5,width:c,height:D,left:C,top:D/2}),M=n([C,O>0?O-q/2:q/2],{value:String(h),...i,...g}),A=new t.Group([...P,...j,Y,...M?[M]:[]],{objectCaching:!1,...l});b.value.add(A),A.sendToBack(),r+=c}))}e(B),e(F,"right")}(),function(){const{show:e,startTime:o,range:r=[0,23],position:s="top",style:a}=H.time,{show:u,range:c=[0,23],position:d,style:f}=H.processTime;if(e||u){const p=[],h=[],g=[],m=[],v=N+V/2,y=q/2;for(let t=0;t<W.mainXCell;t++){if(e){const e=0===t?+o.slice(11,13):ct(w(p),r);p.push(e);const l="top"===s?O-y:D+y;g.push(n([v+t*V,l],{value:String(e),...i,...a||{}}))}if(u){const e=0===t?c[0]:w(h)+1;h.push(e);const o="top"===d?y:et-y;m.push(n([v+t*V,o],{value:String(e),...i,...f||{}}))}}const k=new t.Group([...g,...m],{objectCaching:!1,...l});b.value.add(k),b.value.sendToBack(k)}}(),function(){var t;const o=Object.values(tt),n=[],i={},r=ot.find((t=>"cervix"===t.key&&t.show)),s=null==(t=null==r?void 0:r.data)?void 0:t.find((t=>3==+t.value));function l(t,e){const{key:o,range:n}=r||{},i=G(o,n,10),s=[0,e],l=[-e/t,0],a=[(D-i-e)/t,D-i],u=[z-N,t*(z-N)+e];let c=[],d=[];function f([o,n]){return Math.abs(n-t*o-e)<=1}function p([t,e]){const[o,n]=[...h([t,e])];return o>=N&&o<=z&&n>=i&&n<=D}function h([t,e]){return[N+t,D-e]}return f(s)&&p(s)&&(c=h(s)),f(l)&&p(l)&&(c=h(l)),f(a)&&p(a)&&(d=h(a)),f(u)&&p(u)&&(d=h(u)),[...c,...d]}o.forEach((t=>{if(!t.show)return;const{key:o}=t;switch(o){case"fetalPresentation":{const{range:i,show:r}=ot.find((t=>t.key===o));if(r){const r=G(o,i,0);n.push(e([N,r,z,r],{...t}))}break}case"alert":if(s){const{key:o,range:a}=r||{},u=216e5,c={time:x(new Date(v(s.time)+u),"yyyy-MM-dd HH:mm"),value:10},[d,f]=[S(s.time)-N,D-G(o,a,s.value)],[p,h]=[S(c.time)-N,D-G(o,a,c.value)],g=(h-f)/(p-d),m=f-d*g,y=l(g,m);y.length>0&&(n.push(e(y,{...t})),Object.assign(i,{k:g,b:m}))}break;case"handling":if(s){const{k:o,b:r}=i,a=144e5,u=l(o,r-(S(x(new Date(v(s.time)+a),"yyyy-MM-dd HH:mm"))-S(s.time))*o);u.length>0&&n.push(e(u,{...t}))}}})),b.value.add(...n)}(),it(),function(){function t(t,e){const o=ot.findIndex((e=>e.key===t.key));return{renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,dataIndex:o,key:t.key},pointer:e}}j.event.evented&&b.value.on("mouse:up",(e=>{if(3===e.button){const{x:o=0,y:n=0}=e.pointer||{};o>=N&&o<=z&&n>=O&&n<=D&&(E.point={x:o,y:n},E.show=!0,e.target?(E.target=e.target,E.list=["删除节点"],[...nt].forEach((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&E.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(E.target=null,E.list=["新增节点"],ot.filter((t=>t.show)).forEach((i=>{if(!Y([...nt],o,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&n<_)return;E.list.push(t(i,e.pointer))}})),1===E.list.length&&(E.show=!1,M("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const t=K-U/2;function e(t,e){if(!t.length)return;let n=O;const i=[];t.forEach((t=>{const o=t.title.split("").join("\n"),r=J.findIndex((e=>e.key===t.key)),{text:l,icon:a}=s(o,t,{text:{originY:"top",left:e,top:n},icon:{left:e,topY:n,originY:"top",origin:{type:t.type,dataIndex:r},...j.event}},"vertical");var u;n+=l.height+a.height+15,(u=a).on("moving",(()=>{u.set("originY","center"),A(u)?(lt(u),at(u)):C.show=!1})),u.on("mouseup:before",(t=>{if(C.show=!1,0===t.e.button&&A(u))if(Y([...nt],u.left,"key").includes(u.origin.key))M("repeat");else{const t={data:{time:T(u.left),value:L(u.origin.key,u.top)},...u.origin};P("add",t),rt(t)}!function(t){t.setCoords().set({originY:"top",left:t.originLeft,top:t.originTop})}(u)})),i.push(l,a)})),o(i),b.value.add(...i)}function o(t){const e=w(t),o=(D-O)/2,n=(e.height+e.top-O)/2;t.forEach((t=>{const e=t.top+o-n;t.set({top:e,originTop:e})}))}e(B,$/2),e(F,t)}(),{clickMenu:function({item:t,target:e}){const o={...t.origin};"remove"===t.mode?(P("remove",o),rt(o,"remove")):(Object.assign(o,{data:{time:T(t.pointer.x),value:L(t.origin.key,t.pointer.y)}}),P("add",o),rt(o))},redrawPoints:st}}export{b as useBirthProcess};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultTextStyle as i,defaultStyle as n,drawPoint as o}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as s,drawScaleNumber as u,drawScaleLine as a}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import{isEffectiveNode as d,getTime as h,getScaleNumberList as f}from"../../utils/index.js";import{cloneDeep as p,last as m}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function v(v,g,x,y,b){const{computedX:w,computedY:S,getXValue:E,getYValue:L}=l(g),{getEqualXTypes:j,handleAddPrevent:k,isGridLimit:X,setPrevAndNextPoint:P,getPointEventProps:A}=c(v,x,g),{xAxis:C,grid:T,originX:G,originY:Y,xCellWidth:N,endY:V,startTime:H,leftScales:M,rightScales:$,yCellHeight:B,endX:W,scaleValues:q,canvasWidth:z,borderStyle:D,event:F,other:I,timeXAxisHeight:R,canvasHeight:J,extraTimeXAxisList:K}=g,O=p(q),Q=new Set;function U(){O.filter((t=>t.show)).forEach(((t,r)=>{var l;const s=[],u=[],a=[];null==(l=t.data)||l.forEach(((l,c)=>{!function(l,c,d){if(!l&&!c.childbirth||!(null==c?void 0:c.time)||!tt(c.time))return;let h,f;const{pointAttr:v={},lineAttr:g={},title:x="",key:b,type:S="circle",childbirthStyle:j={}}=t,k=p(t.data[d+1]);k&&!k.value&&k.childbirth&&(k.value=c.value);const X=_(k,t);l&&X&&!c.breakpoint&&(f=Z([...l,...X],g));if(c.childbirth){const t=l?l[0]:w(c.time),n=l?l[1]:m(s).top,o=n+B/2,r=Z([t,n,t,o],g);a.push(r);const u=e([t,o],{value:String(c.childbirth),...i,...j,backgroundColor:"#fff"});a.push(u)}const P=u[d-1],C={origin:{data:c,title:x,key:b||"",dataIndex:r,index:d},leftLine:P,rightLine:f,...v,...A(),...n};l&&(P||(C.leftLine=null),h=o(S,{left:l[0],top:l[1],...C}));f&&u.push(f),h&&(!function(t){F.hovered&&(t.on("mouseover",(()=>{!function(t,e="moving"){const{title:i,key:n,data:o}=t.origin;y.point={x:t.left,y:t.top},y.list=[`${i} ${"hover"===e?o.value:L(n,t.top)}`,`时间 ${E(t.left).slice(-5)}`],y.show=!0}(t,"hover")})),t.on("mouseout",(()=>{y.show=!1})))}(h),s.push(h),Q.add(h))}(_(l,t),l,c)})),Promise.all(s).then((t=>{P(t),Promise.all(a).then((e=>{v.value.add(...u,...t,...e),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function Z([e,i,o,r],l){return new t.Polyline([{x:e,y:i},{x:o,y:i},{x:o,y:r}],{...l,fill:"transparent",...n})}function _(t,e){if(d(t)&&tt(t.time)){const i=w(t.time),n=S(e.key,e.range,t.value);return[i,n<Y?Y:n>V?V:n]}}function tt(t){var e,i;const n=(null==(i=null==(e=null==C?void 0:C.time)?void 0:e.range)?void 0:i[1])||20,o=H+60*n*60*1e3,r=h(t);return r>=H&&r<=o}return r(v,g),function(){const e=new t.Rect({...D,width:W-G,height:V-Y,left:G,top:Y,fill:"transparent"});v.value.add(e)}(),function(){function o(o,r="left"){const l=10;let c="left"===r?0:W;o.forEach(((o,r)=>{const{range:d,spaceValue:h,width:p,title:m,titleStyle:g,unit:x,key:y,position:b="center",spaceGridNumber:w=1,showNumber:S,showMaxMinNumber:E}=o,L=[],j=[],k=f(d,h),X=k.length,{lineXMain:P,lineXSub:A,textLeft:C}=s(b,c,p);k.forEach(((t,e)=>{const i=V-e*B*w;!S||(0===e||e===X-1)&&!E||L.push(u(String(t),o,C,i)),j.push(...a(o,e,P,A,i,B,Y,X))}));const T=e([c+l,Y+(V-Y)/2],{value:String(m+"("+x+")"),...i,originX:"center",angle:-90,...g}),G=new t.Group([...j,...L,...T?[T]:[]],{objectCaching:!1,...n});v.value.add(G),G.sendToBack(),c+=p}))}o(M),o($,"right")}(),function(){const{show:o,range:r=[0,20],position:l="top",style:s,spaceGridNumber:u=2,spaceValue:a=2}=C.time;if(o){const o=[],c=B/2;f(r,a).forEach(((t,n)=>{const r="top"===l?Y-c:V+R+c;o.push(e([G+n*N*u,r],{value:0===n?"Admission":String(t),...i,...s}))}));const d=new t.Group(o,{objectCaching:!1,...n});v.value.add(d),v.value.sendToBack(d)}!function(){if((null==K?void 0:K.length)>0){const t=[];K.forEach((n=>{const o=w(n),r=V+R;t.push(e([o,r],{value:String(n.slice(11,16)),...i,originY:"bottom"}))})),v.value.add(...t)}}()}(),function(){const{alertLineList:t=[],alertLineTitle:n="入院时宫颈扩张不同情况"}=I;if(t.length<1)return;const o=e([W,0],{value:n,...i,originX:"right",originY:"top"});v.value.add(o),t.forEach((t=>{const{style:i,data:n=[]}=t;if(n.length<1)return;const o=[],r=O.find((t=>"cervix"===t.key));n.map((t=>({...t,time:H+60*t.time*60*1e3}))).forEach(((t,n,l)=>{const s=_(t,r),u=_(l[n+1],r);s&&!u&&o.push(e([s[0],Y-10],{value:l[0].value+(r.unit||"cm"),fill:i.stroke||"#000"})),s&&u&&o.push(Z([...s,...u],i))})),v.value.add(...o)}))}(),U(),{redrawPoints:function(){var t;Q.size&&(null==(t=v.value)||t.remove(...function(t){const e=[];return t.forEach((t=>{t&&e.push(t),(null==t?void 0:t.leftLine)&&e.push(null==t?void 0:t.leftLine),(null==t?void 0:t.rightLine)&&e.push(null==t?void 0:t.rightLine)})),e}([...Q]))),Q.clear(),U()}}}export{v as useNewBirthProcess};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultTextStyle as i,defaultStyle as n,drawPoint as o}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as s,drawScaleNumber as u,drawScaleLine as a}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import{isEffectiveNode as d,getTime as h,getScaleNumberList as f}from"../../utils/index.js";import{cloneDeep as p,last as m}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function v(v,g,x,y,b){const{computedX:w,computedY:S,getXValue:E,getYValue:L}=l(g),{getEqualXTypes:j,handleAddPrevent:k,isGridLimit:X,setPrevAndNextPoint:P,getPointEventProps:A}=c(v,x,g),{xAxis:C,grid:T,originX:G,originY:Y,xCellWidth:N,endY:V,startTime:H,leftScales:M,rightScales:$,yCellHeight:B,endX:W,scaleValues:q,canvasWidth:z,borderStyle:D,event:F,other:I,timeXAxisHeight:R,canvasHeight:J,extraTimeXAxisList:K}=g,O=p(q),Q=new Set;function U(){O.filter((t=>t.show)).forEach(((t,r)=>{var l;const s=[],u=[],a=[];null==(l=t.data)||l.forEach(((l,c)=>{!function(l,c,d){if(!l&&!c.childbirth||!(null==c?void 0:c.time)||!tt(c.time))return;let h,f;const{pointAttr:v={},lineAttr:g={},title:x="",key:b,type:S="circle",childbirthStyle:j={}}=t,k=p(t.data[d+1]);k&&!k.value&&k.childbirth&&(k.value=c.value);const X=_(k,t);l&&X&&!c.breakpoint&&(f=Z([...l,...X],g));if(c.childbirth){const t=l?l[0]:w(c.time),n=l?l[1]:m(s).top,o=n+B/2,r=Z([t,n,t,o],g);a.push(r);const u=e([t,o],{value:String(c.childbirth),...i,...j,backgroundColor:"#fff"});a.push(u)}const P=u[d-1],C={origin:{data:c,title:x,key:b||"",dataIndex:r,index:d},leftLine:P,rightLine:f,...v,...A(),...n};l&&(P||(C.leftLine=null),h=o(S,{left:l[0],top:l[1],...C}));f&&u.push(f),h&&(!function(t){F.hovered&&(t.on("mouseover",(()=>{!function(t,e="moving"){const{title:i,key:n,data:o}=t.origin;y.point={x:t.left,y:t.top},y.list=[`${i} ${"hover"===e?o.value:L(n,t.top)}`,`时间 ${E(t.left).slice(-5)}`],y.show=!0}(t,"hover")})),t.on("mouseout",(()=>{y.show=!1})))}(h),s.push(h),Q.add(h))}(_(l,t),l,c)})),Promise.all(s).then((t=>{P(t),Promise.all(a).then((e=>{v.value.add(...u,...t,...e),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function Z([e,i,o,r],l){return new t.Polyline([{x:e,y:i},{x:o,y:i},{x:o,y:r}],{...l,fill:"transparent",...n})}function _(t,e){if(d(t)&&tt(t.time)){const i=w(t.time),n=S(e.key,e.range,t.value);return[i,n<Y?Y:n>V?V:n]}}function tt(t){var e,i;const n=(null==(i=null==(e=null==C?void 0:C.time)?void 0:e.range)?void 0:i[1])||20,o=H+60*n*60*1e3,r=h(t);return r>=H&&r<=o}return r(v,g),function(){const e=new t.Rect({...D,width:W-G,height:V-Y,left:G,top:Y,fill:"transparent"});v.value.add(e)}(),function(){function o(o,r="left"){const l=10;let c="left"===r?0:W;o.forEach(((o,r)=>{const{range:d,spaceValue:h,width:p,title:m,titleStyle:g,unit:x,key:y,position:b="center",spaceGridNumber:w=1,showNumber:S,showMaxMinNumber:E}=o,L=[],j=[],k=f(d,h),X=k.length,{lineXMain:P,lineXSub:A,textLeft:C}=s(b,c,p);k.forEach(((t,e)=>{const i=V-e*B*w;!S||(0===e||e===X-1)&&!E||L.push(u(String(t),o,C,i)),j.push(...a(o,e,P,A,i,B,Y,X,1))}));const T=e([c+l,Y+(V-Y)/2],{value:String(m+"("+x+")"),...i,originX:"center",angle:-90,...g}),G=new t.Group([...j,...L,...T?[T]:[]],{objectCaching:!1,...n});v.value.add(G),G.sendToBack(),c+=p}))}o(M),o($,"right")}(),function(){const{show:o,range:r=[0,20],position:l="top",style:s,spaceGridNumber:u=2,spaceValue:a=2}=C.time;if(o){const o=[],c=B/2;f(r,a).forEach(((t,n)=>{const r="top"===l?Y-c:V+R+c;o.push(e([G+n*N*u,r],{value:0===n?"Admission":String(t),...i,...s}))}));const d=new t.Group(o,{objectCaching:!1,...n});v.value.add(d),v.value.sendToBack(d)}!function(){if((null==K?void 0:K.length)>0){const t=[];K.forEach((n=>{const o=w(n),r=V+R;t.push(e([o,r],{value:String(n.slice(11,16)),...i,originY:"bottom"}))})),v.value.add(...t)}}()}(),function(){const{alertLineList:t=[],alertLineTitle:n="入院时宫颈扩张不同情况"}=I;if(t.length<1)return;const o=e([W,0],{value:n,...i,originX:"right",originY:"top"});v.value.add(o),t.forEach((t=>{const{style:i,data:n=[]}=t;if(n.length<1)return;const o=[],r=O.find((t=>"cervix"===t.key));n.map((t=>({...t,time:H+60*t.time*60*1e3}))).forEach(((t,n,l)=>{const s=_(t,r),u=_(l[n+1],r);s&&!u&&o.push(e([s[0],Y-10],{value:l[0].value+(r.unit||"cm"),fill:i.stroke||"#000"})),s&&u&&o.push(Z([...s,...u],i))})),v.value.add(...o)}))}(),U(),{redrawPoints:function(){var t;Q.size&&(null==(t=v.value)||t.remove(...function(t){const e=[];return t.forEach((t=>{t&&e.push(t),(null==t?void 0:t.leftLine)&&e.push(null==t?void 0:t.leftLine),(null==t?void 0:t.rightLine)&&e.push(null==t?void 0:t.rightLine)})),e}([...Q]))),Q.clear(),U()}}}export{v as useNewBirthProcess};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{format as u}from"date-fns";import{getType as a,getTime as c,isOneLine as d,isOverlapPoint as p,getFloorNumber as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,deleteProperty as y,getIndex as m}from"../../utils/index.js";import{cloneDeep as x,flatten as b,last as j}from"lodash-es";import"../useEvent.js";import{useCommon as w}from"../useCommon.js";import"vue";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as k,PAIN_MENU as L,OVERLAP as S}from"../../constants/index.js";import{promiseTimeout as Y}from"@vueuse/shared";function E(E,$,O,T,V,P,C,A,R,I){r(E,$);const{getEqualXTypes:X,handleAddPrevent:D,getPointEventProps:H}=w(E,O,$),{createShadowLines:z}=t(),{left:F,xScaleList:_,xCellWidth:W,yCellHeight:q,originX:G,endX:N,originY:B,endY:J,itemList:K,event:Q,vitalSignsOriginY:U,painOriginY:Z,hospitalizationDate:ee,config:te,canvasHeight:ie}=$,ne=new Set,oe=["xinmai","mai"],le=new Map,se=new Set,re=new Set,ue=new Set,ae=x(F.yScaleValue),ce=new Set;function de(t){var o;const l=ae.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(ne.size&&E.value.remove(...ne),ne.clear(),le.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=le.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of le)t.push(e[1]),e[0]===oe[0]&&e[1].forEach((e=>{(le.get(oe[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)),u=n[i],a=o[r],c=n[i-1],d=n[i+1],p=o[r-1],f=o[r+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&s.push(p);const h=Math.min(u[1],a[1]);l.push([u,a].find((e=>e[1]===h)));const v=Math.max(u[1],a[1]);s.push([u,a].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=j(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(s.push(f),g()):g()})),e}();o.length>0&&function(e){Y(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(ue).forEach((n=>{var o,l;"pulse"===(null==(o=null==n?void 0:n.origin)?void 0:o.type)&&e.find((e=>Math.abs(n.left-e[0])<=1&&Math.abs(n.top-e[1])<=1))&&((null==(l=null==n?void 0:n.origin)?void 0:l.key)===oe[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{t>0&&e.leftLine&&E.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:s,style:r={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...r,strokeWidth:1});if(["slash","line"].includes(s)){l.set({fill:"transparent",stroke:r.stroke||"#f00"});const e=[];if(["slash"].includes(s))e.push(...z(t,r._angle,r.space)),e.forEach((e=>{Object.assign(e,{...n,...r}),ne.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...b(t)],{...r,originX:"center"});e.push(n),ne.add(n)}))}E.value.add(...e)}ne.add(l),E.value.add(l)}))}}function pe(e,t,r){var u;const{type:a,riseStyle:c={},noRiseStyle:p={},verifiedStyle:g={},reduceStyle:y={},pacemaker:m={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:w={},respiratorStyle:k={},dataList:L=[],list:S=[]}=r,{type:Y,textStyle:$,showConnectLine:P=!1}=j,A=[],I=[],X=[];let D=null;const z=e=>"breathe"==a&&e.respirator&&k.type&&k.fixedValue&&!e.value&&ve(e.time);if(null==(u=e.list)||u.forEach(((u,j)=>{const F=d(a)?L.find((e=>e.key===u.key)):e,_=ge(z(u)?{...u,value:k.fixedValue}:u,r),G=e.list[j+1],N=G?ge(z(G)?{...G,value:k.fixedValue}:G,r):void 0,B=G?d(a)?L.find((e=>e.key===G.key)):e:{},{title:J=""}=F;if("脉搏"===J&&"脉搏"!==B.title||"脉搏"!==J&&"脉搏"===B.title||!_||!N||f(_[0],1)!==f(N[0],1))_&&D&&(_[0]=D),D=null;else{const e=_[0]-W/2;_[0]=e+W/4,N[0]=D=_[0]+W/2}const K={};K.value=function(e,t,i){if(!(null==e?void 0:e.length)||!te.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=U.originY+q?e[1]+q:e[1]-q,s=l([e[0],o],{value:z(t)?k.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(s),{obj:s,top:-q}}(_,u,F),function(e,t,r,u){var d,f;if(!["temperature","pain","breathe"].includes(a))return;if(!(null==e?void 0:e.length)&&"temperature"===a&&!ve(t.time))return;if(!(null==e?void 0:e.length)&&"pain"===a)return;if(!t.value&&"breathe"===a)return;const{lineAttr:v={}}=r,{value:m}=u,x=T(t.time);let b,j,w,L,Y,E;if(t.noRise&&p.show){const i=M(p,t)?V(a,S,35):(null==e?void 0:e[1])||0;if(p.text)w=l([x,M(p,t)?i:i+5],{value:p.text.split("").join("\n"),originY:"top",...p.style}),t.value||ue.add(w);else if(t.value){w=s([x,i,i+2*q],{...p.style})}w&&X.push(w),w&&M(p,t)&&ce.add(w)}if(null==e?void 0:e[1]){if(t.rise&&c.show&&c.text&&(L=l([x,e[1]-(m?q:0)-5],{value:c.text.split("").join("\n"),originY:"bottom",...c.style}),X.push(L)),t.verified&&(Y=l([x,e[1]-(m?q:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(Y)),h(t.physicsReduce)||h(t.drugReduce)){const l=V(a,S,null!=(d=t.physicsReduce)?d:t.drugReduce),s=l<e[1]&&(null==te?void 0:te.hypothermyViewCustom)?x+W/2:x;b=i([...e,s,l],{...v,...y.line,...n}),j=o((null==(f=null==y?void 0:y.point)?void 0:f.type)||"circle",{left:s,top:l,...y.point,...n,originY:l===ie?"bottom":"center"}),b&&X.push(b),j&&X.push(j)}t.respirator&&(E=o(k.type,{left:x,top:e[1]-(m?q:0)-5,originX:"center",originY:"bottom",...k.style}),X.push(E))}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:w,top:p.text?5:2*q,isFixed:M(p,t)},riseText:{obj:L,top:(m?-q:0)-5},verifiedText:{obj:Y,top:(m?-q:0)-5},reducePoint:{obj:j,type:"reduce"},respirator:{obj:E,top:(m?-q:0)-5}})}(_,u,F,K),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(a))return;const o=Math.max(...S),r=Math.min(...S);let u,c,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*q,i=[e[1]-q/2,t];t<U.originY&&(t=e[1]+2.5*q,i=[t,e[1]+q/2]),u=s([e[0],i[0],i[1]],x,"up"),X.push(u)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>o){const t=u?e[1]+q/2+u.height:e[1]+q;c=l([e[0],t],i),X.push(c)}+t.value<r&&(c=l([e[0],e[1]-q],i),X.push(c))}if(w.show&&+t.value<r){const t=e[1];if(w.text)d=l([e[0],e[1]+5],{value:w.text.split("").join("\n"),originY:"top",...w.style});else{const i=t+2*q;d=s([e[0],t,i],{...w.style})}X.push(d)}Object.assign(n,{upArrow:{obj:u},limitValue:{obj:c,top:-q},belowMinValue:{obj:d,top:w.text?5:2*q,moveHide:!0}})}(_,u,F,K),function(n,l,s,u,c,d){let p,f;const{pointAttr:h={},lineAttr:g={},title:y="",key:x,type:b="circle"}=c,j=e.list[u+1],w=fe(a,e.list[u].value),L=l&&fe(a,j.value),S=()=>"pulse"==a&&s.pacemakerShow?m.value:z(s)?k.type:w&&"number"===Y?0:b;if(n&&l&&!s.breakpoint&&(!w&&!L||P)){f=i([...n,...l],{...g});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if((null==e?void 0:e.top)<n[1]&&(null==te?void 0:te.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...g});X.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),f.set("stroke","transparent")}}const M=S(),T=I[u-1],V={origin:{data:z(s)?{...s,value:k.fixedValue}:s,title:y,key:x||"",unit:r.unit,type:a,_type:v(y,a),dataIndex:t,index:u},leftLine:T,rightLine:f,otherObj:d,...s.pacemakerShow&&"pulse"==a?m.style:z(s)?k.style:h,lockMovementX:!0,...H(),...w?{selectable:!1,evented:!1,..."number"===Y?$:{}}:{}};n&&(T?V.leftLine.set("x2",n[0]):V.leftLine=null,p=o(M,{left:n[0],top:w?n[1]-5:n[1],...V}));I.push(f),p&&(x===oe[1]?se.add(p):re.add(p),function(e){Q.hovered&&(e.on("mouseover",(()=>{he(e,"hover")})),e.on("mouseout",(()=>{R.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?Z:U;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:s=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),s&&(E.value.remove(i),delete e.otherObj.obj)))})),de(e)}(e),Q.hovered&&he(e)})),e.on("mouseup",(t=>{if(R.show=!1,1===t.button){const{type:t}=e.origin,i=C(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};E.value.discardActiveObject(),O("change",n),me(n,"change")}}))}(p),A.push(p),ue.add(p))}(_,N,u,j,F,K)})),"pulse"===a){const{key:t}=e;let i=null;le.set(t,A.map(((e,t,n)=>{var o,l;const s=n[t+1];if(s&&f(e.left,1)===f(s.left,1)){const t=e.left-W/2;e.set("left",t+W/4),null==(o=e.rightLine)||o.set("x1",e.left),i=e.left+W/2,s.set("left",i)}else i&&(null==(l=e.leftLine)||l.set("x2",i),e.set("left",i)),i=null;return[e.left,e.top]})))}const F=I.filter((e=>e));E.value.add(...F,...A,...X)}function fe(e,t){return"pain"===e&&0==t}function he(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;R.point={x:e.left,y:e.top};let s=`时间 ${((null==l?void 0:l.time)||P(e.left)).slice(-5)}`;R.list=[function(){const{drugReduce:r,physicsReduce:u}=l||{},a="hover"===t?l.value:C(o,e.top);if(h(r))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(h(u))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${a}—>${u}${n||""}`;return`${i} ${a}${n||""}`}(),s],R.show=!0}function ve(e){const[t]=_,i=j(_),n=t.start,o=i.end,l=c(e);return l>=n&&l<=o}function ge(e,t){const i="pain"===t.type?Z:U;if(!g(e)||!ve(e.time))return;const n=T(e.time),o=V(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function ye(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=c(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=c(`${P(e)}:00`);return ee&&l<c(ee)?(D("exceedMin"),!1):!(l>o)||(D("exceedMax"),!1)}function me(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ae.find((e=>e.type===i));if("add"===t){const e=d(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=m(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;xe()}function xe(){var e;ue.size&&(null==(e=E.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}([...ue]))),ue.clear(),be()}function be(e){le.clear(),ue.clear(),se.clear(),ce.clear(),re.clear(),ae.forEach((t=>{null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||d(t.type)&&!e.enable||pe(e,i,t)}))})),de(),[...ue].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=ae.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},S,F.overlap||{}),l=[];se.size&&[...se].forEach((e=>{[...re].forEach((t=>{if(t.origin&&p(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),l.push(o(r,{...i[e],...s}))}}}))})),setTimeout((()=>{E.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ue.add(e)}))}))}()}return be((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const t=V(e.type,e.list,e.positionLine.value),n=i([G,t,N,t],e.positionLine);E.value.add(n)}(e))),E.value.on("mouse:up",(e=>{const{button:t,target:i,pointer:n={}}=e;if(3===t){if(!$.event.evented)return;const{x:e=0,y:t=0}=n;if(e>=G&&e<=N&&t>=B&&t<=J){I.point={x:e,y:t},I.show=!0;const{type:o}=(null==i?void 0:i.origin)||{};if(i&&["temperature","pain"].includes(o))"temperature"===o&&(I.list=[...k]),"pain"===o&&(I.list=[...L]),I.target=i;else{I.target=null,I.list=["新增节点"],K.forEach((i=>{if(!X([...ue],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?Z:U;t>=e.originY&&t<=e.endY&&I.list.push({renderItem:A?A(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:a(i.bigType),dataIndex:i.dataIndex,key:i.key},pointer:n})}}));const i=ye(e);i&&1!==I.list.length||(I.show=!1,1===I.list.length&&i&&D("repeat"))}}}if(1===t){if(i)return;const{x:e=0,y:t=0}=n;e>=G&&e<=N&&t>0&&t<ie&&O("click:grid",{x:e,y:t,time:P(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=y(i,[...k,...L]);s[`${e.type}`]=e.value,s.changeTime=u(new Date,"yyyy-MM-dd HH:mm"),d(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};O("change",r),me(r,"change")}else{const t={data:{time:P(e.pointer.x),value:C(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};O("add",t),me(t)}},setPopup:he,isAddPoint:ye,updateData:me,redrawPoints:xe,gridPoints:ue,fixedNoRisePoints:ce}}function M(e,t){return e.fixed||!t.value&&0!==t.value}export{E as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{format as u}from"date-fns";import{getType as a,getTime as c,isOneLine as d,isOverlapPoint as p,getFloorNumber as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,deleteProperty as y,getIndex as m}from"../../utils/index.js";import{cloneDeep as x,flatten as b,last as j}from"lodash-es";import"../useEvent.js";import{useCommon as w}from"../useCommon.js";import"vue";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as k,PAIN_MENU as L,OVERLAP as S}from"../../constants/index.js";import{promiseTimeout as Y}from"@vueuse/shared";function E(E,$,O,T,V,P,C,A,R,I){r(E,$);const{getEqualXTypes:X,handleAddPrevent:D,getPointEventProps:H}=w(E,O,$),{createShadowLines:z}=t(),{left:F,xScaleList:_,xCellWidth:W,yCellHeight:q,originX:G,endX:N,originY:B,endY:J,itemList:K,event:Q,vitalSignsOriginY:U,painOriginY:Z,hospitalizationDate:ee,config:te,canvasHeight:ie}=$,ne=new Set,oe=["xinmai","mai"],le=new Map,se=new Set,re=new Set,ue=new Set,ae=x(F.yScaleValue),ce=new Set;function de(t){var o;const l=ae.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(ne.size&&E.value.remove(...ne),ne.clear(),le.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=le.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of le)t.push(e[1]),e[0]===oe[0]&&e[1].forEach((e=>{(le.get(oe[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)),u=n[i],a=o[r],c=n[i-1],d=n[i+1],p=o[r-1],f=o[r+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&s.push(p);const h=Math.min(u[1],a[1]);l.push([u,a].find((e=>e[1]===h)));const v=Math.max(u[1],a[1]);s.push([u,a].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=j(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(s.push(f),g()):g()})),e}();o.length>0&&function(e){Y(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(ue).forEach((n=>{var o,l;"pulse"===(null==(o=null==n?void 0:n.origin)?void 0:o.type)&&e.find((e=>Math.abs(n.left-e[0])<=1&&Math.abs(n.top-e[1])<=1))&&((null==(l=null==n?void 0:n.origin)?void 0:l.key)===oe[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{t>0&&e.leftLine&&E.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:s,style:r={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...r,strokeWidth:1});if(["slash","line"].includes(s)){l.set({fill:"transparent",stroke:r.stroke||"#f00"});const e=[];if(["slash"].includes(s))e.push(...z(t,r._angle,r.space)),e.forEach((e=>{Object.assign(e,{...n,...r}),ne.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...b(t)],{...r,originX:"center"});e.push(n),ne.add(n)}))}E.value.add(...e)}ne.add(l),E.value.add(l)}))}}function pe(e,t,r){var u;const{type:a,riseStyle:c={},noRiseStyle:p={},verifiedStyle:g={},reduceStyle:y={},pacemaker:m={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:w={},respiratorStyle:k={},dataList:L=[],list:S=[]}=r,{type:Y,textStyle:$,showConnectLine:P=!1}=j,A=[],I=[],X=[];let D=null;const z=e=>"breathe"==a&&e.respirator&&k.type&&k.fixedValue&&!e.value&&ve(e.time);if(null==(u=e.list)||u.forEach(((u,j)=>{const F=d(a)?L.find((e=>e.key===u.key)):e,_=ge(z(u)?{...u,value:k.fixedValue}:u,r),G=e.list[j+1],N=G?ge(z(G)?{...G,value:k.fixedValue}:G,r):void 0,B=G?d(a)?L.find((e=>e.key===G.key)):e:{},{title:J=""}=F;if("脉搏"===J&&"脉搏"!==B.title||"脉搏"!==J&&"脉搏"===B.title||!_||!N||f(_[0],1)!==f(N[0],1))_&&D&&(_[0]=D),D=null;else{const e=_[0]-W/2;_[0]=e+W/4,N[0]=D=_[0]+W/2}const K={};K.value=function(e,t,i){if(!(null==e?void 0:e.length)||!te.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=U.originY+q?e[1]+q:e[1]-q,s=l([e[0],o],{value:z(t)?k.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(s),{obj:s,top:-q}}(_,u,F),function(e,t,r,u){var d,f;if(!["temperature","pain","breathe"].includes(a))return;if(!(null==e?void 0:e.length)&&"temperature"===a&&!ve(t.time))return;if(!(null==e?void 0:e.length)&&"pain"===a)return;if(!t.value&&"breathe"===a)return;const{lineAttr:v={}}=r,{value:m}=u,x=T(t.time);let b,j,w,L,Y,E;if(t.noRise&&p.show){const i=M(p,t)?V(a,S,35):(null==e?void 0:e[1])||0;if(p.text)w=l([x,M(p,t)?i:i+5],{value:p.text.split("").join("\n"),originY:"top",...p.style}),t.value||ue.add(w);else if(t.value){w=s([x,i,i+2*q],{...p.style})}w&&X.push(w),w&&M(p,t)&&ce.add(w)}if(null==e?void 0:e[1]){if(t.rise&&c.show&&c.text&&(L=l([x,e[1]-(m?q:0)-5],{value:c.text.split("").join("\n"),originY:"bottom",...c.style}),X.push(L)),t.verified&&(Y=l([x,e[1]-(m?q:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(Y)),h(t.physicsReduce)||h(t.drugReduce)){const l=V(a,S,null!=(d=t.physicsReduce)?d:t.drugReduce),s=l<e[1]&&(null==te?void 0:te.hypothermyViewCustom)?x+W/2:x;b=i([...e,s,l],{...v,...y.line,...n}),j=o((null==(f=null==y?void 0:y.point)?void 0:f.type)||"circle",{left:s,top:l,...y.point,...n,originY:l===ie?"bottom":"center"}),b&&X.push(b),j&&X.push(j)}t.respirator&&(E=o(k.type,{left:x,top:e[1]-(m?q:0)-5,originX:"center",originY:"bottom",...k.style}),X.push(E))}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:w,top:p.text?5:2*q,isFixed:M(p,t)},riseText:{obj:L,top:(m?-q:0)-5},verifiedText:{obj:Y,top:(m?-q:0)-5},reducePoint:{obj:j,type:"reduce"},respirator:{obj:E,top:(m?-q:0)-5}})}(_,u,F,K),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(a))return;const o=Math.max(...S),r=Math.min(...S);let u,c,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*q,i=[e[1]-q/2,t];t<U.originY&&(t=e[1]+2.5*q,i=[t,e[1]+q/2]),u=s([e[0],i[0],i[1]],x,"up"),X.push(u)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>o){const t=u?e[1]+q/2+u.height:e[1]+q;c=l([e[0],t],i),X.push(c)}+t.value<r&&(c=l([e[0],e[1]-q],i),X.push(c))}if(w.show&&+t.value<r){const t=e[1];if(w.text)d=l([e[0],e[1]+5],{value:w.text.split("").join("\n"),originY:"top",...w.style});else{const i=t+2*q;d=s([e[0],t,i],{...w.style})}X.push(d)}Object.assign(n,{upArrow:{obj:u},limitValue:{obj:c,top:-q},belowMinValue:{obj:d,top:w.text?5:2*q,moveHide:!0}})}(_,u,F,K),function(n,l,s,u,c,d){let p,f;const{pointAttr:h={},lineAttr:g={},title:y="",key:x,type:b="circle"}=c,j=e.list[u+1],w=fe(a,e.list[u].value),L=l&&fe(a,j.value),S=()=>"pulse"==a&&s.pacemakerShow?m.value:z(s)?k.type:w&&"number"===Y?0:b;if(n&&l&&!s.breakpoint&&(!w&&!L||P)){f=i([...n,...l],{...g});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if((null==e?void 0:e.top)<n[1]&&(null==te?void 0:te.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...g});X.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),f.set("stroke","transparent")}}const M=S(),T=I[u-1],V={origin:{data:z(s)?{...s,value:k.fixedValue}:s,title:y,key:x||"",unit:r.unit,type:a,_type:v(y,a),dataIndex:t,index:u},leftLine:T,rightLine:f,otherObj:d,...s.pacemakerShow&&"pulse"==a?m.style:z(s)?k.style:h,lockMovementX:!0,...H(),...w?{selectable:!1,evented:!1,..."number"===Y?$:{}}:{}};n&&(T?V.leftLine.set("x2",n[0]):V.leftLine=null,p=o(M,{left:n[0],top:w?n[1]-5:n[1],...V}));I.push(f),p&&(x===oe[1]?se.add(p):z(s)||re.add(p),function(e){Q.hovered&&(e.on("mouseover",(()=>{he(e,"hover")})),e.on("mouseout",(()=>{R.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?Z:U;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:s=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),s&&(E.value.remove(i),delete e.otherObj.obj)))})),de(e)}(e),Q.hovered&&he(e)})),e.on("mouseup",(t=>{if(R.show=!1,1===t.button){const{type:t}=e.origin,i=C(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};E.value.discardActiveObject(),O("change",n),me(n,"change")}}))}(p),A.push(p),ue.add(p))}(_,N,u,j,F,K)})),"pulse"===a){const{key:t}=e;let i=null;le.set(t,A.map(((e,t,n)=>{var o,l;const s=n[t+1];if(s&&f(e.left,1)===f(s.left,1)){const t=e.left-W/2;e.set("left",t+W/4),null==(o=e.rightLine)||o.set("x1",e.left),i=e.left+W/2,s.set("left",i)}else i&&(null==(l=e.leftLine)||l.set("x2",i),e.set("left",i)),i=null;return[e.left,e.top]})))}const F=I.filter((e=>e));E.value.add(...F,...A,...X)}function fe(e,t){return"pain"===e&&0==t}function he(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;R.point={x:e.left,y:e.top};let s=`时间 ${((null==l?void 0:l.time)||P(e.left)).slice(-5)}`;R.list=[function(){const{drugReduce:r,physicsReduce:u}=l||{},a="hover"===t?l.value:C(o,e.top);if(h(r))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(h(u))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${a}—>${u}${n||""}`;return`${i} ${a}${n||""}`}(),s],R.show=!0}function ve(e){const[t]=_,i=j(_),n=t.start,o=i.end,l=c(e);return l>=n&&l<=o}function ge(e,t){const i="pain"===t.type?Z:U;if(!g(e)||!ve(e.time))return;const n=T(e.time),o=V(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function ye(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=c(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=c(`${P(e)}:00`);return ee&&l<c(ee)?(D("exceedMin"),!1):!(l>o)||(D("exceedMax"),!1)}function me(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ae.find((e=>e.type===i));if("add"===t){const e=d(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=m(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;xe()}function xe(){var e;ue.size&&(null==(e=E.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}([...ue]))),ue.clear(),be()}function be(e){le.clear(),ue.clear(),se.clear(),ce.clear(),re.clear(),ae.forEach((t=>{null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||d(t.type)&&!e.enable||pe(e,i,t)}))})),de(),[...ue].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=ae.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},S,F.overlap||{}),l=[];se.size&&[...se].forEach((e=>{[...re].forEach((t=>{if(t.origin&&p(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),l.push(o(r,{...i[e],...s}))}}}))})),setTimeout((()=>{E.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ue.add(e)}))}))}()}return be((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const t=V(e.type,e.list,e.positionLine.value),n=i([G,t,N,t],e.positionLine);E.value.add(n)}(e))),E.value.on("mouse:up",(e=>{const{button:t,target:i,pointer:n={}}=e;if(3===t){if(!$.event.evented)return;const{x:e=0,y:t=0}=n;if(e>=G&&e<=N&&t>=B&&t<=J){I.point={x:e,y:t},I.show=!0;const{type:o}=(null==i?void 0:i.origin)||{};if(i&&["temperature","pain"].includes(o))"temperature"===o&&(I.list=[...k]),"pain"===o&&(I.list=[...L]),I.target=i;else{I.target=null,I.list=["新增节点"],K.forEach((i=>{if(!X([...ue],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?Z:U;t>=e.originY&&t<=e.endY&&I.list.push({renderItem:A?A(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:a(i.bigType),dataIndex:i.dataIndex,key:i.key},pointer:n})}}));const i=ye(e);i&&1!==I.list.length||(I.show=!1,1===I.list.length&&i&&D("repeat"))}}}if(1===t){if(i)return;const{x:e=0,y:t=0}=n;e>=G&&e<=N&&t>0&&t<ie&&O("click:grid",{x:e,y:t,time:P(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=y(i,[...k,...L]);s[`${e.type}`]=e.value,s.changeTime=u(new Date,"yyyy-MM-dd HH:mm"),d(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};O("change",r),me(r,"change")}else{const t={data:{time:P(e.pointer.x),value:C(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};O("add",t),me(t)}},setPopup:he,isAddPoint:ye,updateData:me,redrawPoints:xe,gridPoints:ue,fixedNoRisePoints:ce}}function M(e,t){return e.fixed||!t.value&&0!==t.value}export{E as useCenter};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as s,isOneLine as r}from"../../utils/index.js";import"lodash-es";import"../useEvent.js";import{getScaleInfo as u,drawScaleNumber as a,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"./useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function p(p,d,g,f,m,v,y,w,S,b,Y,x){var j,C;const{getEqualXTypes:X,handleAddPrevent:N,isGridLimit:T}=c(p,g,d),{originY:V,endY:L,originX:k,endX:E,xCellWidth:M,yCellHeight:W,left:G,vitalSignsOriginY:O,painOriginY:R,painHeight:A,iconsWidth:H,itemList:I,painIndex:_,right:B,canvasWidth:J,canvasHeight:$,getRightInfo:q,borderStyle:D,surplusCell:P,painSurplusCell:z}=d;function F(o){var s;if(!(null==o?void 0:o.length))return;const{layout:r}=o[0];let c=H,d=k;"right"===r&&(c=E,d=E+(null!=(s=null==B?void 0:B.width)?s:0));const g=[],f=A&&"right"!==r?o.length-1:o.length,m=(d-c)/f,v=m+(d-c)%f;o.forEach(((o,s)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:s=5,showScale:r,showNumber:h,position:c,showMaxMinNumber:d,style:g,title:f}=n,m=R.originY-z[0]*W,v=l({width:k-H,height:A+(z[0]+z[1])*W,...D},{value:`${f}`,...i,...g||{}},{left:H,top:m}),y=t([H,m,k,m],D),w=[];if(r||h){const{lineXMain:t,textLeft:i}=u(c,H,k-H),l=o.length;o.forEach(((o,u)=>{let c=R.endY-u*W*s;if(0===u&&0===z[1]&&(c=L-5),h&&(!(0===u||u===l-1)||d||0===u&&z[1]>0||u===l-1&&z[0]>0)&&w.push(a(o,n,i,c)),r&&(0!==u||z[1]>0)){const[i,n]=t,o=new e.Line([i,c,n,c],{...D,...g});w.push(o)}}))}p.value.add(y,v,...w),v.sendToBack()}(o);const d=[],f=0===s?v:m,y=0===s?c:v+c+(s-1)*m,w="right"===r?0:O.originY,S="right"===r?$:O.endY,b=s>0?t([y,w,y,S],{objectCaching:!1,...D}):null;b&&d.push(b);const Y=y+f/2,{list:x=[],spaceGridNumber:j=5,showScale:C,showNumber:X,position:N,showMaxMinNumber:T,detailedList:E=[],showdetailedScale:M,showRange:G=[]}=o;if(C||X){const[e,t]=G,{lineXMain:i,lineXSub:n,textLeft:l}=u(N,y,f),s=(x[1]-x[0])/2,r=M&&!E.length?x.reduce(((e,t,i)=>{const n=e[e.length-1];return 0===i?[t]:e.concat([n+s,n+2*s])}),[]):M&&(null==E?void 0:E.length)?E:x,c=r.length;r.forEach(((s,r)=>{if(e&&+s<e)return;if(t&&+s>t)return;const u=O.endY-r*W*(M?j/2:j);if(X&&(!(0===r||r===c-1)||T)&&e!==+s){const e=0==r?u-5:u,t=a(s,o,l,e),i=O.originY+t.height/2;e<i&&t.set({top:i}),d.push(t)}d.push(...h(o,r,i,n,u,W,O.originY))}))}let I=o.title||"";o.unit&&(I+="\n"+o.unit);let B=O.originY+W;0!==_&&P[0]>1&&(B=V+W*P[0]/2),I&&d.push(new e.Text(String(I),{...i,left:Y,top:B,textAlign:"center",...o.style}));const J=new e.Group(d,{...n,objectCaching:!1});g.push(J)}));const y=g.length>0?new e.Group([...g],{...n,objectCaching:!1}):null;y&&p.value.add(y),y&&y.sendToBack()}H&&function(){const e=JSON.parse(JSON.stringify(I));let t=L;const i=H-G.icons.marginRight;e.reverse().forEach((e=>{t-=10;let n=e.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:u}=o(n,e,{text:{left:i-(e.pointAttr.width||10)-5,top:t,originX:"right"},icon:{originX:"right",left:i,topY:t,origin:{type:s(e.bigType),_type:e.bigType},...d.event}});var a;t-=l.height||30,(a=u).on("moving",(()=>{a.set("originX","center"),function(e){if(e.left>=k&&e.left<=E){e.setCoords();const t="pain"===e.origin.type?R:O;e.top<t.originY&&e.set("top",t.originY),e.top>t.endY&&e.set("top",t.endY)}}(a),T(a)?f(a):m.show=!1})),a.on("mouseup:before",(e=>{if(m.show=!1,0===e.e.button&&T(a)){const e=X([...x],a.left,"_type").includes(a.origin._type),t=b(a.left);if(!t||e)e&&t&&N("repeat");else{const e={data:{time:w(a.left),value:S(a.origin.type,a.top),...r(a.origin.type)?{key:a.origin.key}:{}},...a.origin};g("add",e),Y(e)}}!function(e){e.setCoords().set({originX:"right",left:e.originLeft,top:e.originTop})}(a)})),p.value.add(l,u)}))}();const K=G.yScaleValue.filter((e=>"left"===e.layout&&"pain"!==e.type&&e.show));if((null==B?void 0:B.width)&&"left"===(null==(j=null==B?void 0:B.yScaleValue)?void 0:j.layout)&&(null==(C=null==B?void 0:B.yScaleValue)?void 0:C.show)&&K.push(q),_>0&&G.yScaleValue[_].show){const e=G.yScaleValue[_];0===_&&G.yScaleValue.length>1&&K.unshift(e),_==G.yScaleValue.length-1&&K.push(e)}const Q=K.findIndex((e=>"pulse"===e.type&&e.show&&e.doubleShow)),U=K[Q];return Q>-1&&K.splice(Q,0,{...U,title:(null==U?void 0:U.doubleTitle)||(null==U?void 0:U.title)}),F(K),p.value.add(new e.Rect({left:H,top:0,width:J-H-D.strokeWidth,height:$-D.strokeWidth,fill:"transparent",...D})),{drawScaleValue:F}}export{p as useLeft};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as s,isOneLine as r}from"../../utils/index.js";import{last as u}from"lodash-es";import"../useEvent.js";import{getScaleInfo as a,drawScaleNumber as h,drawScaleLine as c}from"../useScaleColumn.js";import{useCommon as d}from"../useCommon.js";import"vue";import"./useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function p(p,g,f,m,v,y,w,S,b,Y,x,j){var C,X;const{getEqualXTypes:N,handleAddPrevent:T,isGridLimit:V}=d(p,f,g),{originY:L,endY:k,originX:E,endX:M,xCellWidth:W,yCellHeight:G,left:I,vitalSignsOriginY:O,painOriginY:R,painHeight:A,iconsWidth:H,itemList:_,painIndex:B,right:J,canvasWidth:$,canvasHeight:q,getRightInfo:D,borderStyle:P,surplusCell:z,painSurplusCell:F}=g;function K(o){var s;if(!(null==o?void 0:o.length))return;const{layout:r}=o[0];let d=H,g=E;"right"===r&&(d=M,g=M+(null!=(s=null==J?void 0:J.width)?s:0));const f=[],m=A&&"right"!==r?o.length-1:o.length,v=(g-d)/m,y=v+(g-d)%m;o.forEach(((o,s)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:s=5,showScale:r,showNumber:u,position:c,showMaxMinNumber:d,style:g,title:f}=n,m=R.originY-F[0]*G,v=l({width:E-H,height:A+(F[0]+F[1])*G,...P},{value:`${f}`,...i,...g||{}},{left:H,top:m}),y=t([H,m,E,m],P),w=[];if(r||u){const{lineXMain:t,textLeft:i}=a(c,H,E-H),l=o.length;o.forEach(((o,a)=>{let c=R.endY-a*G*s;if(0===a&&0===F[1]&&(c=k-5),u&&(!(0===a||a===l-1)||d||0===a&&F[1]>0||a===l-1&&F[0]>0)&&w.push(h(o,n,i,c)),r&&(0!==a||F[1]>0)){const[i,n]=t,o=new e.Line([i,c,n,c],{...P,...g});w.push(o)}}))}p.value.add(y,v,...w),v.sendToBack()}(o);const g=[],m=0===s?y:v,w=0===s?d:y+d+(s-1)*v,S="right"===r?0:O.originY,b="right"===r?q:O.endY,Y=s>0?t([w,S,w,b],{objectCaching:!1,...P}):null;Y&&g.push(Y);const x=w+m/2,{list:j=[],spaceGridNumber:C=5,showScale:X,showNumber:N,position:T,showMaxMinNumber:V,detailedList:M=[],showdetailedScale:W,showRange:I=[]}=o;if(X||N){const{lineXMain:e,lineXSub:t,textLeft:i}=a(T,w,m),n=(j[1]-j[0])/2,l=W&&!M.length?j.reduce(((e,t,i)=>{const o=e[e.length-1];return 0===i?[t]:e.concat([o+n,o+2*n])}),[]):W&&(null==M?void 0:M.length)?M:j,[s=l[0],r=u(l)]=I;l.forEach(((n,u)=>{if(s&&+n<+s)return;if(r&&+n>+r)return;const a=O.endY-u*G*(W?C/2:C),d=[s,r].includes(n);if(N&&(!d||V)){const e=0==u?a-5:a,t=h(n,o,i,e),l=O.originY+t.height/2;e<l&&t.set({top:l}),g.push(t)}g.push(...c(o,u,e,t,a,G,O.originY,l.findIndex((e=>e==r))+1))}))}let _=o.title||"";o.unit&&(_+="\n"+o.unit);let J=O.originY+G;0!==B&&z[0]>1&&(J=L+G*z[0]/2),_&&g.push(new e.Text(String(_),{...i,left:x,top:J,textAlign:"center",...o.style}));const $=new e.Group(g,{...n,objectCaching:!1});f.push($)}));const w=f.length>0?new e.Group([...f],{...n,objectCaching:!1}):null;w&&p.value.add(w),w&&w.sendToBack()}H&&function(){const e=JSON.parse(JSON.stringify(_));let t=k;const i=H-I.icons.marginRight;e.reverse().forEach((e=>{t-=10;let n=e.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:u}=o(n,e,{text:{left:i-(e.pointAttr.width||10)-5,top:t,originX:"right"},icon:{originX:"right",left:i,topY:t,origin:{type:s(e.bigType),_type:e.bigType},...g.event}});var a;t-=l.height||30,(a=u).on("moving",(()=>{a.set("originX","center"),function(e){if(e.left>=E&&e.left<=M){e.setCoords();const t="pain"===e.origin.type?R:O;e.top<t.originY&&e.set("top",t.originY),e.top>t.endY&&e.set("top",t.endY)}}(a),V(a)?m(a):v.show=!1})),a.on("mouseup:before",(e=>{if(v.show=!1,0===e.e.button&&V(a)){const e=N([...j],a.left,"_type").includes(a.origin._type),t=Y(a.left);if(!t||e)e&&t&&T("repeat");else{const e={data:{time:S(a.left),value:b(a.origin.type,a.top),...r(a.origin.type)?{key:a.origin.key}:{}},...a.origin};f("add",e),x(e)}}!function(e){e.setCoords().set({originX:"right",left:e.originLeft,top:e.originTop})}(a)})),p.value.add(l,u)}))}();const Q=I.yScaleValue.filter((e=>"left"===e.layout&&"pain"!==e.type&&e.show));if((null==J?void 0:J.width)&&"left"===(null==(C=null==J?void 0:J.yScaleValue)?void 0:C.layout)&&(null==(X=null==J?void 0:J.yScaleValue)?void 0:X.show)&&Q.push(D),B>0&&I.yScaleValue[B].show){const e=I.yScaleValue[B];0===B&&I.yScaleValue.length>1&&Q.unshift(e),B==I.yScaleValue.length-1&&Q.push(e)}const U=Q.findIndex((e=>"pulse"===e.type&&e.show&&e.doubleShow)),Z=Q[U];return U>-1&&Q.splice(U,0,{...Z,title:(null==Z?void 0:Z.doubleTitle)||(null==Z?void 0:Z.title)}),K(Q),p.value.add(new e.Rect({left:H,top:0,width:$-H-P.strokeWidth,height:q-P.strokeWidth,fill:"transparent",...P})),{drawScaleValue:K}}export{p as useLeft};
@@ -13,4 +13,4 @@ export declare function getScaleInfo(position: string | undefined, x: number, wi
13
13
  textLeft: number;
14
14
  };
15
15
  export declare function drawScaleNumber(text: string | number, item: AnyObject, left: number, top: number): fabric.Text;
16
- export declare function drawScaleLine(item: AnyObject, i: number, lineXMain: number[], lineXSub: number[], baseTop: number, yCellHeight: number, originY: number, _listLen?: number): Array<fabric.Object | fabric.Line>;
16
+ export declare function drawScaleLine(item: AnyObject, i: number, lineXMain: number[], lineXSub: number[], baseTop: number, yCellHeight: number, originY: number, _listLen?: number, _spaceGridNumber?: number): Array<fabric.Object | fabric.Line>;
@@ -1 +1 @@
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],l=[i-2.5,i+2.5],o=i;return"right"===e&&(i=t,r=[i,i+9],l=[i,i+5],o=r[1]),"left"===e&&(i=t+n,r=[i-9,i],l=[i-5,i],o=r[0]),{lineXMain:r,lineXSub:l,textLeft:o}}function r(n,i,r,l){const{position:o,style:s,scaleNumberStyle:c}=i;return new e.Text(String(n),{...t,originX:"left"==o?"right":"right"==o?"left":"center",left:r,top:l,...s||c||{}})}function l(t,i,r){const l=new e.Line(i,{...n,...t.style||t.scaleLineStyle||{}});r.push(l)}function o(e,t,n,i,r,o,s,c){var u,f;const a=[],h=c||(e.showdetailedScale?2*(null==(u=e.list)?void 0:u.length)-1:null==(f=e.list)?void 0:f.length),d=e.position||"center",p=((e.showdetailedScale?e.spaceGridNumber/2:e.spaceGridNumber)||(c?1:5))*o/5;if(e.showScale&&t!==h-1)for(let o=0;o<5;o++)if(o>0||!e.showNumber||"center"!==d){const c=0==o?n[0]:i[0],u=0==o?n[1]:i[1],f=r-o*p;f>s&&(l(e,[c,f,u,f],a),t==h-2&&4==o&&l(e,[n[0],f-p,n[1],f-p],a))}return a}export{o as drawScaleLine,r as drawScaleNumber,i as getScaleInfo};
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],l=[i-2.5,i+2.5],o=i;return"right"===e&&(i=t,r=[i,i+9],l=[i,i+5],o=r[1]),"left"===e&&(i=t+n,r=[i-9,i],l=[i-5,i],o=r[0]),{lineXMain:r,lineXSub:l,textLeft:o}}function r(n,i,r,l){const{position:o,style:s,scaleNumberStyle:c}=i;return new e.Text(String(n),{...t,originX:"left"==o?"right":"right"==o?"left":"center",left:r,top:l,...s||c||{}})}function l(t,i,r){const l=new e.Line(i,{...n,...t.style||t.scaleLineStyle||{}});r.push(l)}function o(e,t,n,i,r,o,s,c,u){var f,a;const h=[],d=c||(e.showdetailedScale?2*(null==(f=e.list)?void 0:f.length)-1:null==(a=e.list)?void 0:a.length),p=e.position||"center",m=((e.showdetailedScale?e.spaceGridNumber/2:e.spaceGridNumber)||u||5)*o/5;if(e.showScale&&t!==d-1)for(let o=0;o<5;o++)if(o>0||!e.showNumber||"center"!==p){const c=0==o?n[0]:i[0],u=0==o?n[1]:i[1],f=r-o*m;f>s&&(l(e,[c,f,u,f],h),t==d-2&&4==o&&l(e,[n[0],f-m,n[1],f-m],h))}return h}export{o as drawScaleLine,r as drawScaleNumber,i as getScaleInfo};
@@ -725,8 +725,8 @@ declare const _default: import("vue").DefineComponent<{
725
725
  showSeq: boolean;
726
726
  footerFlag: boolean;
727
727
  fieldDescribeMode: "column" | "tooltip";
728
- showSearch: boolean;
729
728
  customColumns: FieldSetColumnItem[];
729
+ showSearch: boolean;
730
730
  showSortPriority: boolean;
731
731
  showHeadFilter: boolean;
732
732
  }>;
@@ -1911,7 +1911,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
1911
1911
  wrapperStyle?: Record<string, string> | undefined;
1912
1912
  childFieldStrategy?: "checked" | "all" | undefined;
1913
1913
  childWidthMode?: "inner" | "outer" | undefined;
1914
- validator?: ((value: unknown, fieldItem: import("..").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
1914
+ validator?: ((value: unknown, fieldItem: import("..").FieldItem) => string | void) | undefined;
1915
1915
  reactions?: {
1916
1916
  [x: string]: any;
1917
1917
  dependencies?: string[] | undefined;
@@ -2158,7 +2158,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
2158
2158
  wrapperStyle?: Record<string, string> | undefined;
2159
2159
  childFieldStrategy?: "checked" | "all" | undefined;
2160
2160
  childWidthMode?: "inner" | "outer" | undefined;
2161
- validator?: ((value: unknown, fieldItem: import("..").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
2161
+ validator?: ((value: unknown, fieldItem: import("..").FieldItem) => string | void) | undefined;
2162
2162
  reactions?: {
2163
2163
  [x: string]: any;
2164
2164
  dependencies?: string[] | undefined;
@@ -2376,7 +2376,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
2376
2376
  wrapperStyle?: Record<string, string> | undefined;
2377
2377
  childFieldStrategy?: "checked" | "all" | undefined;
2378
2378
  childWidthMode?: "inner" | "outer" | undefined;
2379
- validator?: ((value: unknown, fieldItem: import("..").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
2379
+ validator?: ((value: unknown, fieldItem: import("..").FieldItem) => string | void) | undefined;
2380
2380
  reactions?: {
2381
2381
  [x: string]: any;
2382
2382
  dependencies?: string[] | undefined;
@@ -1914,7 +1914,7 @@ declare const _default: import("vue").DefineComponent<{
1914
1914
  wrapperStyle?: Record<string, string> | undefined;
1915
1915
  childFieldStrategy?: "checked" | "all" | undefined;
1916
1916
  childWidthMode?: "inner" | "outer" | undefined;
1917
- validator?: ((value: unknown, fieldItem: import("../../../components/form-render").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
1917
+ validator?: ((value: unknown, fieldItem: import("../../../components/form-render").FieldItem) => string | void) | undefined;
1918
1918
  reactions?: {
1919
1919
  [x: string]: any;
1920
1920
  dependencies?: string[] | undefined;
@@ -2161,7 +2161,7 @@ declare const _default: import("vue").DefineComponent<{
2161
2161
  wrapperStyle?: Record<string, string> | undefined;
2162
2162
  childFieldStrategy?: "checked" | "all" | undefined;
2163
2163
  childWidthMode?: "inner" | "outer" | undefined;
2164
- validator?: ((value: unknown, fieldItem: import("../../../components/form-render").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
2164
+ validator?: ((value: unknown, fieldItem: import("../../../components/form-render").FieldItem) => string | void) | undefined;
2165
2165
  reactions?: {
2166
2166
  [x: string]: any;
2167
2167
  dependencies?: string[] | undefined;
@@ -2379,7 +2379,7 @@ declare const _default: import("vue").DefineComponent<{
2379
2379
  wrapperStyle?: Record<string, string> | undefined;
2380
2380
  childFieldStrategy?: "checked" | "all" | undefined;
2381
2381
  childWidthMode?: "inner" | "outer" | undefined;
2382
- validator?: ((value: unknown, fieldItem: import("../../../components/form-render").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
2382
+ validator?: ((value: unknown, fieldItem: import("../../../components/form-render").FieldItem) => string | void) | undefined;
2383
2383
  reactions?: {
2384
2384
  [x: string]: any;
2385
2385
  dependencies?: string[] | undefined;
@@ -417,7 +417,7 @@ declare const _default: import("vue").DefineComponent<{
417
417
  wrapperStyle?: Record<string, string> | undefined;
418
418
  childFieldStrategy?: "checked" | "all" | undefined;
419
419
  childWidthMode?: "inner" | "outer" | undefined;
420
- validator?: ((value: unknown, fieldItem: FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
420
+ validator?: ((value: unknown, fieldItem: FieldItem) => string | void) | undefined;
421
421
  reactions?: {
422
422
  [x: string]: any;
423
423
  dependencies?: string[] | undefined;
@@ -664,7 +664,7 @@ declare const _default: import("vue").DefineComponent<{
664
664
  wrapperStyle?: Record<string, string> | undefined;
665
665
  childFieldStrategy?: "checked" | "all" | undefined;
666
666
  childWidthMode?: "inner" | "outer" | undefined;
667
- validator?: ((value: unknown, fieldItem: FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
667
+ validator?: ((value: unknown, fieldItem: FieldItem) => string | void) | undefined;
668
668
  reactions?: {
669
669
  [x: string]: any;
670
670
  dependencies?: string[] | undefined;
@@ -882,7 +882,7 @@ declare const _default: import("vue").DefineComponent<{
882
882
  wrapperStyle?: Record<string, string> | undefined;
883
883
  childFieldStrategy?: "checked" | "all" | undefined;
884
884
  childWidthMode?: "inner" | "outer" | undefined;
885
- validator?: ((value: unknown, fieldItem: FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
885
+ validator?: ((value: unknown, fieldItem: FieldItem) => string | void) | undefined;
886
886
  reactions?: {
887
887
  [x: string]: any;
888
888
  dependencies?: string[] | undefined;
@@ -1 +1 @@
1
- import{arrayed as e}from"../../../../shared/utils/index.js";import{once as a,isNumber as i,isString as m}from"lodash-es";import"vue";import{registerValidateLocale as r,registerValidateRules as s}from"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import{isFunction as l}from"@vueuse/core";import"naive-ui";import{isIdCard as u}from"../utils/business.js";function n(){const a=new Map([["mobile",({validate:e})=>({format:"phone",message:null==e?void 0:e.message})],["integer",({validate:e})=>({format:"integer",message:null==e?void 0:e.message})],["number",({validate:e})=>({format:"number",message:null==e?void 0:e.message})],["id_card",({validate:e})=>({validator(a){var i;if(null!=a&&""!==a)return m(a)&&u(a)?void 0:null!=(i=null==e?void 0:e.message)?i:"该字段不是合法的身份证格式"}})],["regular",({validate:e,regular_expression:a,regular_error_tip:i})=>({pattern:a||(null==e?void 0:e.regular_expression)||"",message:i||(null==e?void 0:e.regular_error_tip)||(null==e?void 0:e.message)||"格式错误"})]]),i={triggerType:"onBlur"};return{createValidatorSchema:function(m){const r=[],{validate:{vali_obj:s,max_length:u,min_length:n,message:o,max_value:t,min_value:g,decimal_length:v}={},validator:d}=m;if(d&&e(d).forEach((e=>{l(e)&&r.push({validator:(a,i,r)=>e(a,m,r)})})),u&&r.push({max:u,message:o}),n&&r.push({min:n,message:o}),t&&r.push({maximum:t,message:o}),g&&r.push({minimum:g,message:o}),null!=v&&r.push(((e,a)=>{const i=null!=a?a:`小数位数最多${e}位`;return{validator(a){var m;return(null==(m=String(a).split(".")[1])?void 0:m.length)>e?i:""}}})(+v,o)),s){const e=a.get(s)||(({validate:e})=>({format:s,message:null==e?void 0:e.message}));r.push(Object.assign({},i,e(m)))}return r}}}const o=a((()=>{r({"zh-CN":{required:"${alias||name}为必填"}}),s({maximum:(e,a)=>i(Number(a.maximum))&&null!=e&&""!==e&&"/"!==e?(m(e)&&(e=+e),!i(e)||isNaN(e)?"":e>Number(a.maximum)&&a.message||""):"",minimum:(e,a)=>i(Number(a.minimum))&&null!=e&&""!==e&&"/"!==e?(m(e)&&(e=+e),!i(e)||isNaN(e)?"":e<Number(a.minimum)&&a.message||""):""})}));export{n as useFormValidator,o as validateMessageLocale};
1
+ import{arrayed as e}from"../../../../shared/utils/index.js";import{once as a,isNumber as i,isString as m}from"lodash-es";import"vue";import{registerValidateLocale as r,registerValidateRules as s}from"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import{isFunction as l}from"@vueuse/core";import"naive-ui";import{isIdCard as u}from"../utils/business.js";function n(){const a=new Map([["mobile",({validate:e})=>({format:"phone",message:null==e?void 0:e.message})],["integer",({validate:e})=>({format:"integer",message:null==e?void 0:e.message})],["number",({validate:e})=>({format:"number",message:null==e?void 0:e.message})],["id_card",({validate:e})=>({validator(a){var i;if(null!=a&&""!==a)return m(a)&&u(a)?void 0:null!=(i=null==e?void 0:e.message)?i:"该字段不是合法的身份证格式"}})],["regular",({validate:e,regular_expression:a,regular_error_tip:i})=>({pattern:a||(null==e?void 0:e.regular_expression)||"",message:i||(null==e?void 0:e.regular_error_tip)||(null==e?void 0:e.message)||"格式错误"})]]),i={triggerType:"onBlur"};return{createValidatorSchema:function(m){const r=[],{validate:{vali_obj:s,max_length:u,min_length:n,message:o,max_value:t,min_value:g,decimal_length:v}={},validator:d}=m;if(d&&e(d).forEach((e=>{l(e)&&r.push({validator:a=>e(a,m)})})),u&&r.push({max:u,message:o}),n&&r.push({min:n,message:o}),t&&r.push({maximum:t,message:o}),g&&r.push({minimum:g,message:o}),null!=v&&r.push(((e,a)=>{const i=null!=a?a:`小数位数最多${e}位`;return{validator(a){var m;return(null==(m=String(a).split(".")[1])?void 0:m.length)>e?i:""}}})(+v,o)),s){const e=a.get(s)||(({validate:e})=>({format:s,message:null==e?void 0:e.message}));r.push(Object.assign({},i,e(m)))}return r}}}const o=a((()=>{r({"zh-CN":{required:"${alias||name}为必填"}}),s({maximum:(e,a)=>i(Number(a.maximum))&&null!=e&&""!==e&&"/"!==e?(m(e)&&(e=+e),!i(e)||isNaN(e)?"":e>Number(a.maximum)&&a.message||""):"",minimum:(e,a)=>i(Number(a.minimum))&&null!=e&&""!==e&&"/"!==e?(m(e)&&(e=+e),!i(e)||isNaN(e)?"":e<Number(a.minimum)&&a.message||""):""})}));export{n as useFormValidator,o as validateMessageLocale};
@@ -1,6 +1,5 @@
1
1
  import { FormRequestDefine } from '../../../../shared/hooks';
2
2
  import { AnyObject, ArrayAble, LowCodeTypes } from '../../../../shared/types';
3
- import { Field } from '@formily/core';
4
3
  import { SchemaEffectTypes, SchemaTypes } from '@formily/vue';
5
4
  import { VNode } from 'vue';
6
5
  import { DependKeyType, FormCommonState } from '../../../../components/form-render';
@@ -159,7 +158,7 @@ export type FieldItem = {
159
158
  * @param fieldItem 配置参数
160
159
  * @return {void|string} 返回校验信息
161
160
  */
162
- validator: (value: unknown, fieldItem: FieldItem, field: Field) => void | string;
161
+ validator: (value: unknown, fieldItem: FieldItem) => void | string;
163
162
  reactions: ArrayAble<ReactionType>;
164
163
  [key: string]: any;
165
164
  }>;
@@ -599,7 +599,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
599
599
  isGroupChat: import("vue").ComputedRef<boolean>;
600
600
  contextmenuRef: import("vue").Ref<any>;
601
601
  showMenu: import("vue").Ref<boolean>;
602
- contextmenuPosition: import("vue").Ref<import("../../shared/types").AnyObject>;
602
+ contextmenuPosition: any;
603
603
  pageInfo: {
604
604
  page: number;
605
605
  hasMore: boolean;
@@ -604,7 +604,7 @@ declare const _default: import("vue").DefineComponent<{
604
604
  isGroupChat: import("vue").ComputedRef<boolean>;
605
605
  contextmenuRef: import("vue").Ref<any>;
606
606
  showMenu: import("vue").Ref<boolean>;
607
- contextmenuPosition: import("vue").Ref<AnyObject>;
607
+ contextmenuPosition: any;
608
608
  pageInfo: {
609
609
  page: number;
610
610
  hasMore: boolean;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,watch as n,withDirectives as o,openBlock as i,createElementBlock as s,normalizeStyle as r,unref as a,createElementVNode as l,toDisplayString as c,createVNode as u,createCommentVNode as d,withCtx as f,Fragment as p,renderList as m,createBlock as g,createTextVNode as y,vShow as h}from"vue";import{NIcon as v,NPopover as M,NButton as k,NTooltip as C,NUpload as _,NUploadTrigger as x}from"naive-ui";import I from"./ChatAdd.vue.js";import{useState as b}from"../hooks/useState.js";import{useSession as w}from"../hooks/useSession.js";import{MESSAGE_TYPE as T,AV_STATUS as z}from"../constants/index.js";import"trtc-sdk-v5";import{simplifyMessage as E}from"../utils/index.js";import{emojis as j}from"../utils/emoji.js";import{uploadFileApi as R}from"../api/index.js";import{CloseCircleOutline as q,CallOutline as L,VideocamOutline as D}from"@vicons/ionicons5";import{xor as O,cloneDeep as A}from"lodash-es";import{uuidGenerator as U}from"../../../../shared/utils/index.js";const V={key:0,class:"reference-content-box"},F={class:"reference-content"},K=["innerHTML"],G={class:"tool-box"},S=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),H={class:"emoji-box"},N=l("span",null,"默认表情",-1),J={class:"list-box"},X=["src"],B=l("i",{class:"chat--iconfont chat--icon-good"},null,-1),P=l("i",{class:"chat--iconfont chat--icon-image"},null,-1),Q=l("i",{class:"chat--iconfont chat--icon-folder"},null,-1),W={class:"btn-box"},Y=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var Z=e({__name:"ChatFooter",setup(e){const Z=t(),$=t(""),{state:ee,sendMessage:te}=b(),{isGroupChat:ne}=w(ee),oe=t(!1);function ie(e,t=[]){const n=U(),o=[],i=t.length>0;ee.showVideo||ee.showMultipleVideo||(i?(o.push(...O(t,[ee.userInfo.id])),Object.assign(ee.currentAVMsg,{callMode:"call",checkedIds:o,strRoomId:n,chatMessageType:e}),ee.showMultipleVideo=!0):te({content:{chatMessageType:e,msg:"",avStatus:z.IN_CALL}}))}function se(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),le()))}function re(){var e,t;$.value=(null==(t=null==(e=Z.value)?void 0:e.innerText)?void 0:t.trim())||""}async function ae(e,t){const{file:n,name:o}=e.file,i=new FormData;i.append("sender",ee.userInfo.id),i.append("file",n);const s=await R(i);if(!s)return console.log("上传失败");ce({chatMessageType:t,msg:t===T.FILE?o:s,url:s})}function le(){if(!($.value.length>2e3))return $.value?void ce({msg:$.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function ce(e){const{chatMessageType:t=T.TEXT,msg:n,url:o}=e,i={msg:n,chatMessageType:t};t===T.FILE&&(i.fileUrl=o),[T.TEXT,T.BLEND].includes(t)&&(Z.value.innerHTML="",$.value=""),ee.currentReferenceMsg&&(i.referenceContent=A(ee.currentReferenceMsg),ee.currentReferenceMsg=null),te({content:i})}return n((()=>ee.currentReferenceMsg),(e=>{var t;e&&(null==(t=Z.value)||t.focus())})),(e,t)=>o((i(),s("section",{class:"chat-footer",style:r({cursor:a(ee).id?"default":"not-allowed"})},[a(ee).currentReferenceMsg?(i(),s("div",V,[l("div",F,[l("span",null,c(a(ee).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:a(E)(a(ee).currentReferenceMsg.content)},null,8,K)]),u(a(v),{component:a(q),onClick:t[0]||(t[0]=()=>a(ee).currentReferenceMsg=null)},null,8,["component"])])):d("v-if",!0),l("div",G,[u(a(M),{show:oe.value,"onUpdate:show":t[1]||(t[1]=e=>oe.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[S])),_:1})])),default:f((()=>[l("div",H,[d(' <span>最近使用</span>\n\t\t\t\t\t<div class="list-box">\n\t\t\t\t\t\t<template v-for="(img, index) in images" :key="index">\n\t\t\t\t\t\t\t<i>\n\t\t\t\t\t\t\t\t<img :src="img" />\n\t\t\t\t\t\t\t</i>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</div> '),N,l("div",J,[(i(!0),s(p,null,m(a(j).default,(([e,t])=>(i(),g(a(C),{key:e,"show-arrow":!1,trigger:"hover"},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny",onClick:()=>function(e){oe.value=!1,ce({chatMessageType:T.EMOJI,msg:e})}(e)},{icon:f((()=>[l("img",{src:t},null,8,X)])),_:2},1032,["onClick"])])),default:f((()=>[y(" "+c(e),1)])),_:2},1024)))),128))])])])),_:1},8,["show"]),u(a(k),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>ce({chatMessageType:a(T).EMOJI,msg:0}))},{icon:f((()=>[B])),_:1}),u(a(_),{abstract:"",multiple:"",accept:"image/*",onChange:t[3]||(t[3]=e=>ae(e,a(T).IMAGE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[P])),_:2},1032,["onClick"])])),_:1})])),_:1}),u(a(_),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:t[4]||(t[4]=e=>ae(e,a(T).FILE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[Q])),_:2},1032,["onClick"])])),_:1})])),_:1}),a(ne)?(i(),s(p,{key:0},[u(I,{options:a(ee).currentGroupUser,"default-value":[a(ee).userInfo.id],onComfirm:t[5]||(t[5]=e=>ie(a(T).AUDIO,e))},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[u(a(v),{size:"18",component:a(L)},null,8,["component"])])),_:1})])),_:1},8,["options","default-value"]),u(I,{options:a(ee).currentGroupUser,"default-value":[a(ee).userInfo.id],onComfirm:t[6]||(t[6]=e=>ie(a(T).VIDEO,e))},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[u(a(v),{size:"20",component:a(D)},null,8,["component"])])),_:1})])),_:1},8,["options","default-value"])],64)):(i(),s(p,{key:1},[u(a(k),{quaternary:"",size:"tiny",onClick:t[7]||(t[7]=()=>ie(a(T).AUDIO))},{icon:f((()=>[u(a(v),{size:"18",component:a(L)},null,8,["component"])])),_:1}),u(a(k),{quaternary:"",size:"tiny",onClick:t[8]||(t[8]=()=>ie(a(T).VIDEO))},{icon:f((()=>[u(a(v),{size:"20",component:a(D)},null,8,["component"])])),_:1})],64))]),o(l("div",{ref_key:"inputRef",ref:Z,class:"input-box",contenteditable:"",onKeydown:se,onInput:re},null,544),[[h,a(ee).id]]),l("div",W,[Y,u(a(k),{type:"primary",round:"",disabled:!$.value,onClick:le},{default:f((()=>[y("发送")])),_:1},8,["disabled"])])],4)),[[h,a(ee).id]])}});export{Z as default};
1
+ import{defineComponent as e,ref as t,watch as n,withDirectives as o,openBlock as i,createElementBlock as s,normalizeStyle as r,unref as a,createElementVNode as l,toDisplayString as c,createVNode as u,createCommentVNode as d,withCtx as f,Fragment as p,renderList as m,createBlock as g,createTextVNode as y,vShow as h}from"vue";import{NIcon as v,NPopover as M,NButton as k,NTooltip as C,NUpload as _,NUploadTrigger as x}from"naive-ui";import I from"./ChatAdd.vue.js";import{useState as b}from"../hooks/useState.js";import{useSession as w}from"../hooks/useSession.js";import{MESSAGE_TYPE as T,AV_STATUS as z}from"../constants/index.js";import"trtc-sdk-v5";import{simplifyMessage as E}from"../utils/index.js";import{emojis as j}from"../utils/emoji.js";import{uploadFileApi as R}from"../api/index.js";import{CloseCircleOutline as q,CallOutline as L,VideocamOutline as D}from"@vicons/ionicons5";import{xor as O,cloneDeep as A}from"lodash-es";import{uuidGenerator as U}from"../../../../shared/utils/index.js";const V={key:0,class:"reference-content-box"},F={class:"reference-content"},K=["innerHTML"],G={class:"tool-box"},S=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),H={class:"emoji-box"},N=l("span",null,"默认表情",-1),J={class:"list-box"},X=["src"],B=l("i",{class:"chat--iconfont chat--icon-good"},null,-1),P=l("i",{class:"chat--iconfont chat--icon-image"},null,-1),Q=l("i",{class:"chat--iconfont chat--icon-folder"},null,-1),W={class:"btn-box"},Y=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var Z=e({__name:"ChatFooter",setup(e){const Z=t(),$=t(""),{state:ee,sendMessage:te}=b(),{isGroupChat:ne}=w(ee),oe=t(!1);function ie(e,t=[]){const n=U(),o=[],i=t.length>0;ee.showVideo||ee.showMultipleVideo||(i?(o.push(...O(t,[ee.userInfo.id])),Object.assign(ee.currentAVMsg,{callMode:"call",checkedIds:o,strRoomId:n,chatMessageType:e}),ee.showMultipleVideo=!0):te({content:{chatMessageType:e,msg:"",avStatus:z.IN_CALL}}))}function se(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),le()))}function re(){var e,t;$.value=(null==(t=null==(e=Z.value)?void 0:e.innerText)?void 0:t.trim())||""}async function ae(e,t){const{file:n,name:o}=e.file,i=new FormData;i.append("sender",ee.userInfo.id),i.append("file",n);const s=await R(i);if(!s)return console.log("上传失败");ce({chatMessageType:t,msg:t===T.FILE?o:s,url:s})}function le(){if(!($.value.length>2e3))return $.value?void ce({msg:$.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function ce(e){const{chatMessageType:t=T.TEXT,msg:n,url:o}=e,i={msg:n,chatMessageType:t};t===T.FILE&&(i.fileUrl=o),[T.TEXT,T.BLEND].includes(t)&&(Z.value.innerHTML="",$.value=""),ee.currentReferenceMsg&&(i.referenceContent=A(ee.currentReferenceMsg),ee.currentReferenceMsg=null),te({content:i})}return n((()=>ee.currentReferenceMsg),(e=>{var t;e&&(null==(t=Z.value)||t.focus())})),(e,t)=>o((i(),s("section",{class:"chat-footer",style:r({cursor:a(ee).id?"default":"not-allowed"})},[a(ee).currentReferenceMsg?(i(),s("div",V,[l("div",F,[l("span",null,c(a(ee).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:a(E)(a(ee).currentReferenceMsg.content)},null,8,K)]),u(a(v),{component:a(q),onClick:t[0]||(t[0]=()=>a(ee).currentReferenceMsg=null)},null,8,["component"])])):d("v-if",!0),l("div",G,[u(a(M),{show:oe.value,"onUpdate:show":t[1]||(t[1]=e=>oe.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[S])),_:1})])),default:f((()=>[l("div",H,[d(' <span>最近使用</span>\r\n\t\t\t\t\t<div class="list-box">\r\n\t\t\t\t\t\t<template v-for="(img, index) in images" :key="index">\r\n\t\t\t\t\t\t\t<i>\r\n\t\t\t\t\t\t\t\t<img :src="img" />\r\n\t\t\t\t\t\t\t</i>\r\n\t\t\t\t\t\t</template>\r\n\t\t\t\t\t</div> '),N,l("div",J,[(i(!0),s(p,null,m(a(j).default,(([e,t])=>(i(),g(a(C),{key:e,"show-arrow":!1,trigger:"hover"},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny",onClick:()=>function(e){oe.value=!1,ce({chatMessageType:T.EMOJI,msg:e})}(e)},{icon:f((()=>[l("img",{src:t},null,8,X)])),_:2},1032,["onClick"])])),default:f((()=>[y(" "+c(e),1)])),_:2},1024)))),128))])])])),_:1},8,["show"]),u(a(k),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>ce({chatMessageType:a(T).EMOJI,msg:0}))},{icon:f((()=>[B])),_:1}),u(a(_),{abstract:"",multiple:"",accept:"image/*",onChange:t[3]||(t[3]=e=>ae(e,a(T).IMAGE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[P])),_:2},1032,["onClick"])])),_:1})])),_:1}),u(a(_),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:t[4]||(t[4]=e=>ae(e,a(T).FILE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[Q])),_:2},1032,["onClick"])])),_:1})])),_:1}),a(ne)?(i(),s(p,{key:0},[u(I,{options:a(ee).currentGroupUser,"default-value":[a(ee).userInfo.id],onComfirm:t[5]||(t[5]=e=>ie(a(T).AUDIO,e))},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[u(a(v),{size:"18",component:a(L)},null,8,["component"])])),_:1})])),_:1},8,["options","default-value"]),u(I,{options:a(ee).currentGroupUser,"default-value":[a(ee).userInfo.id],onComfirm:t[6]||(t[6]=e=>ie(a(T).VIDEO,e))},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[u(a(v),{size:"20",component:a(D)},null,8,["component"])])),_:1})])),_:1},8,["options","default-value"])],64)):(i(),s(p,{key:1},[u(a(k),{quaternary:"",size:"tiny",onClick:t[7]||(t[7]=()=>ie(a(T).AUDIO))},{icon:f((()=>[u(a(v),{size:"18",component:a(L)},null,8,["component"])])),_:1}),u(a(k),{quaternary:"",size:"tiny",onClick:t[8]||(t[8]=()=>ie(a(T).VIDEO))},{icon:f((()=>[u(a(v),{size:"20",component:a(D)},null,8,["component"])])),_:1})],64))]),o(l("div",{ref_key:"inputRef",ref:Z,class:"input-box",contenteditable:"",onKeydown:se,onInput:re},null,544),[[h,a(ee).id]]),l("div",W,[Y,u(a(k),{type:"primary",round:"",disabled:!$.value,onClick:le},{default:f((()=>[y("发送")])),_:1},8,["disabled"])])],4)),[[h,a(ee).id]])}});export{Z as default};
@@ -10,7 +10,7 @@ declare const _default: import("vue").DefineComponent<{}, {
10
10
  isGroupChat: import("vue").ComputedRef<boolean>;
11
11
  contextmenuRef: import("vue").Ref<any>;
12
12
  showMenu: import("vue").Ref<boolean>;
13
- contextmenuPosition: import("vue").Ref<AnyObject>;
13
+ contextmenuPosition: any;
14
14
  pageInfo: {
15
15
  page: number;
16
16
  hasMore: boolean;