cnhis-design-vue 3.1.48 → 3.1.49-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/fabric-chart/src/FabricChart.vue2.js +1 -1
- package/es/components/fabric-chart/src/components/PopupMenu.js +1 -1
- package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
- package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/index.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useLeft.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useBottom.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useTop.js +1 -1
- package/es/components/fabric-chart/src/hooks/useEvent.d.ts +0 -1
- package/es/components/fabric-chart/src/hooks/useEvent.js +1 -1
- package/es/components/form-config/index.d.ts +7 -0
- package/es/components/form-config/src/FormConfig.vue.d.ts +7 -0
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +3 -0
- package/es/components/form-render/src/components/renderer/inputNumber.d.ts +35 -0
- package/es/components/form-render/src/components/renderer/inputNumber.js +1 -1
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
- package/es/components/form-render/src/hooks/useFormValidator.js +1 -1
- package/es/components/form-render/src/types/fieldItem.d.ts +1 -0
- package/es/components/shortcut-setter/index.d.ts +1 -0
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -0
- package/es/shared/package.json.js +1 -1
- package/package.json +2 -2
- package/es/shared/utils/tapableLess.d.ts +0 -28
- package/es/shared/utils/tapableLess.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,ref as t,reactive as r,onMounted as s,onBeforeUnmount as o,openBlock as a,createElementBlock as
|
|
1
|
+
import{defineComponent as e,ref as t,reactive as r,onMounted as s,onBeforeUnmount as o,openBlock as a,createElementBlock as n,Fragment as i,createElementVNode as p,createBlock as u,mergeProps as l,unref as c,createCommentVNode as h}from"vue";import{fabric as m}from"../../../shared/utils/fabricjs/index.js";import f from"./components/PopupTip.vue.js";import d from"./components/PopupMenu.js";import"./hooks/useDraw.js";import"date-fns";import"lodash-es";import{useBirthProcessChart as v}from"./hooks/birthProcess/useBirthProcessChart.js";import{useTemperatureChart as w}from"./hooks/temperature/useTemperatureChart.js";import{useSurgicalAnesthesiaChart as k}from"./hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js";var g=e({__name:"FabricChart",props:{type:{type:String,default:"temperature"},data:{type:Object,required:!0},addRenderItem:{type:Function}},emits:["change","add","remove","select","add:prevent"],setup(e,{expose:g,emit:C}){const y=e,j=t(null),b=t(),P=r({show:!1,point:{x:0,y:0},list:[]}),x=r({show:!1,point:{x:0,y:0},list:[],target:null}),{propItems:I,redrawPoints:M,select:A,clickMenu:R}=function(){const e=[b,y,C,j,P,x];switch(y.type){case"birthProcess":return v(...e);case"surgicalAnesthesia":return k(...e);default:return w(...e)}}();return s((()=>{b.value=new m.Canvas(j.value,{width:I.canvasWidth,height:I.canvasHeight,backgroundColor:"#fff",selection:!1,containerClass:"c-fabric-chart",stopContextMenu:!0,fireRightClick:!0,allowTouchScrolling:!0})})),o((()=>{b.value.off(),b.value.clear()})),g({redrawPoints:M,select:A,canvas:b}),(e,t)=>(a(),n(i,null,[p("canvas",{ref_key:"canvasRef",ref:j},null,512),b.value?(a(),u(f,l({key:0,propItems:c(I)},P),null,16,["propItems"])):h("v-if",!0),b.value?(a(),u(c(d),l({key:1,propItems:c(I)},x,{show:x.show,"onUpdate:show":t[0]||(t[0]=e=>x.show=e),onClickMenu:c(R)}),null,16,["propItems","show","onClickMenu"])):h("v-if",!0)],64))}});export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,ref as t,watch as l,createVNode as a,Teleport as o,withDirectives as r,vShow as n}from"vue";import{NSpace as u,NInputNumber as i}from"naive-ui";import s from"./useStyle.js";import{onClickOutside as
|
|
1
|
+
import{defineComponent as e,ref as t,watch as l,createVNode as a,Teleport as o,withDirectives as r,vShow as n}from"vue";import{NSpace as u,NInputNumber as i}from"naive-ui";import s from"./useStyle.js";import{useEventListener as p,onClickOutside as c}from"@vueuse/core";var f=e({name:"PopupMenu",inheritAttrs:!1,props:{show:{type:Boolean,default:!1},list:{type:Array,default:()=>[]},point:{type:Object},propItems:{type:Object},target:{type:Object}},emits:["update:show","clickMenu"],setup(e,{attrs:f,slots:m,emit:d}){let v=!1;const h=t(null);p(h,"contextmenu",(e=>(e.preventDefault(),!1))),c(h,(e=>{!v&&d("update:show",!1),v=!1}));const{left:y}=e.propItems,b=s(e);function g(e){if("string"==typeof e&&(e.startsWith("新增")||e.startsWith("删除")))return!0}function w(t){var l;if("string"==typeof t)return t;if("boolean"==typeof t.value)return t.label;if(t.renderItem)return t.renderItem();const o=+((null==(l=y.yScaleValue.find((t=>t.type===e.target.origin.type)))?void 0:l.list[0])||0);return a(u,{inline:!0,align:"center"},{default:()=>[a("span",null,[t.label]),a(i,{style:"width: 110px",size:"small",value:t.value,"onUpdate:value":e=>t.value=e,clearable:!0,placeholder:"请输入数值",max:e.target.origin.data.value,min:o,showButton:!1,onFocus:()=>d("update:show",!0)},null)]})}return l((()=>e.show),(t=>{t&&(v=!0,e.list.forEach((e=>{"object"==typeof e&&Reflect.has(e,"value")&&"boolean"!=typeof e.value&&(e.value=void 0)})))})),()=>a(o,{to:".c-fabric-chart"},{default:()=>[r(a("ul",{ref:h,class:"c-fabric-chart-popup-menu",style:b.value},[e.list.map((t=>e.show?a("li",{class:{"no-click":g(t)},onClick:l=>function(t,l){g(l)||""===(null==t?void 0:t.target.className)&&(d("update:show",!1),d("clickMenu",{item:l,target:e.target}))}(l,t)},[w(t)]):null))]),[[n,e.show]])]})}});export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as
|
|
1
|
+
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as n,drawText as o,defaultTextStyle as i,drawPoint as r,drawTextAndIconGroup as l,defaultStyle as s,defaultRectStyle as a}from"../useDraw.js";import{useGrid as u}from"../useGrid.js";import{useBirthProcessCumputedPoint as c}from"../useCumputedPoint.js";import{getScaleInfo as d,drawScaleNumber as f,drawScaleLine as p}from"../useScaleColumn.js";import{useCommon as h}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as v,getTime as m,getScaleNumberList as y}from"../../utils/index.js";import"../temperature/useShadow.js";import{cloneDeep as k}from"lodash-es";import{format as w}from"date-fns";function x(x,b,j,C,P){const{cumputedX:S,cumputedY:G,getXValue:M,getYValue:T}=c(b),{getEqualXTypes:Y,handleAddPrevent:E,isGridLimit:L}=h(x,j,b),{xAxis:X,grid:A,originX:I,originY:H,xCellWidth:W,endY:O,startTime:V,leftAddAreaWidth:D,leftScales:N,rightScales:R,yCellHeight:$,endX:B,scaleValues:F,canvasWidth:q,borderStyle:z,rightAddAreaWidth:J,event:K,originYCervix:Q,other:U,canvasHeight:Z}=b,_=k(F),ee=new Set;function te(){_.filter((e=>e.show)).forEach(((e,l)=>{var s;const a=[],u=[],c=[];null==(s=e.data)||s.forEach(((s,d)=>{!function(s,d,f){let p,h;const{pointAttr:g={},lineAttr:v={},title:m="",key:y,type:k="circle",childbirthStyle:w={}}=e,P=e.data[f+1],S=le(P,e);if(s&&S&&!d.breakpoint)h=t([...s,...S],{...v});else if(s&&!S&&!d.breakpoint){const n=le(P,e);h=n?t([...s,...n],{...v}):null}let G,Y;if(d.childbirth){const e=s[1]+$;G=n([s[0],s[1],e],w),c.push(G),Y=o([s[0]+W/2,e-$/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(Y)}const E=u[f-1],L={origin:{data:d,title:m,key:y||"",dataIndex:l,index:f},leftLine:E,rightLine:h,arrowGroup:G,arrowGroupText:Y,...g,...b.event.hovered?b.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:b.event};E?p=r(k,{left:E.get("x2"),top:E.get("y2"),...L}):s&&(L.leftLine=null,p=r(k,{left:s[0],top:s[1],...L}));u.push(h),p&&(!function(e){K.hovered&&(e.on("mouseover",(()=>{re(e,"hover")})),e.on("mouseout",(()=>{C.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ie(e),function(e){var t,n,o,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top}),null==(o=e.arrowGroup)||o.setCoords().set({left:e.left,top:e.top}),null==(i=e.arrowGroupText)||i.setCoords().set({left:e.left+W/2,top:e.top+$/2})}(e),K.hovered&&re(e)})),e.on("mouseup",(t=>{if(C.show=!1,1===t.button){const{key:t}=e.origin,n={...e.origin,data:{...e.origin.data,time:M(e.left),value:T(t,e.top)}};x.value.discardActiveObject(),j("change",n),ne(n,"change")}}))}(p),a.push(p),ee.add(p))}(le(s,e),s,d)})),Promise.all(a).then((e=>{const t=u.filter((e=>e));let n=null;e=e.filter((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),Promise.all(c).then((n=>{x.value.add(...t,...e,...n),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function ne(e,t="add"){const{dataIndex:n,data:o,index:i,key:r}=e,l=_.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const e=g(o.time,l.data);l.data.splice(e,0,o);break}}oe()}function oe(){var e;ee.size&&(null==(e=x.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),(null==e?void 0:e.arrowGroup)&&t.push(null==e?void 0:e.arrowGroup),(null==e?void 0:e.arrowGroupText)&&t.push(null==e?void 0:e.arrowGroupText)})),t}([...ee]))),ee.clear(),te()}function ie(e){const t=e.prevPoint?e.prevPoint.left:I,n=e.nextPoint?e.nextPoint.left:B;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<Q&&e.set("top",Q),e.top<H&&e.set("top",H),e.top>O&&e.set("top",O),e.left<t&&e.set("left",t),e.left>n&&e.set("left",n)}function re(e,t="moving"){const{title:n,key:o,data:i}=e.origin;C.point={x:e.left,y:e.top},C.list=[`${n} ${"hover"===t?i.value:T(o,e.top)}`,`时间 ${M(e.left).slice(-5)}`],C.show=!0}function le(e,t){if(v(e)&&function(e){const t=V+864e5,n=m(e);return n>=V&&n<=t}(e.time)){const n=S(e.time),o=G(t.key,t.range,e.value);return[n,o<H?H:o>O?O:o]}}function se(e,t){return e+1>t[1]?t[0]:e+1}return u(x,b),function(){const t=new e.Rect({...z,width:q-D-J-1,height:O-1,left:D,top:0,fill:"transparent"});x.value.add(t)}(),function(){function t(t,n="left"){let r="left"===n?D:B;t.forEach(((t,n)=>{const{range:l,spaceValue:u,width:c,title:h,titleStyle:g,key:v,position:m="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:b}=t,j=[],C=[],P=r+c/2,S=y(l,u),G=S.length;S.forEach(((e,n)=>{const{lineXMain:o,lineXSub:i,textLeft:l}=d(m,r,c),s=O-n*$*k,a=0===n?O-8:n!==S.length-1||H||Q&&"FHR"!==v?s:H+8;!w||(0===n||n===G-1)&&!b||j.push(f(String(e),t,l,a)),C.push(...p(t,n,o,i,s,$,H,G))}));const M=new e.Rect({...a,strokeWidth:.5,width:c,height:O,left:P,top:O/2}),T=o([P,H>0?H-$/2:$/2],{value:String(h),...i,...g}),Y=new e.Group([...C,...j,M,...T?[T]:[]],{objectCaching:!1,...s});x.value.add(Y),Y.sendToBack(),r+=c}))}t(N),t(R,"right")}(),function(){const{show:t,startTime:n,range:r=[0,23],position:l="top",style:a}=X.time,{show:u,range:c=[0,23],position:d,style:f}=X.processTime;if(t||u){const p=[],h=[],g=[],v=[],m=I+W/2,y=$/2;for(let e=0;e<A.mainXCell;e++){if(t){const t=0===e?+n.slice(11,13):se(p.at(-1),r);p.push(t);const s="top"===l?H-y:O+y;g.push(o([m+e*W,s],{value:String(t),...i,...a||{}}))}if(u){const t=0===e?c[0]:h.at(-1)+1;h.push(t);const n="top"===d?y:Z-y;v.push(o([m+e*W,n],{value:String(t),...i,...f||{}}))}}const k=new e.Group([...g,...v],{objectCaching:!1,...s});x.value.add(k),x.value.sendToBack(k)}}(),function(){var e;const n=Object.values(U),o=[],i={},r=_.find((e=>"cervix"===e.key&&e.show)),l=null==(e=null==r?void 0:r.data)?void 0:e.find((e=>3==+e.value));function s(e,t){const{key:n,range:o}=r||{},i=G(n,o,10),l=[0,t],s=[-t/e,0],a=[(O-i-t)/e,O-i],u=[B-I,e*(B-I)+t];let c=[],d=[];function f([n,o]){return Math.abs(o-e*n-t)<=1}function p([e,t]){const[n,o]=[...h([e,t])];return n>=I&&n<=B&&o>=i&&o<=O}function h([e,t]){return[I+e,O-t]}return f(l)&&p(l)&&(c=h(l)),f(s)&&p(s)&&(c=h(s)),f(a)&&p(a)&&(d=h(a)),f(u)&&p(u)&&(d=h(u)),[...c,...d]}n.forEach((e=>{if(!e.show)return;const{key:n}=e;switch(n){case"fetalPresentation":{const{range:i,show:r}=_.find((e=>e.key===n));if(r){const r=G(n,i,0);o.push(t([I,r,B,r],{...e}))}break}case"alert":if(l){const{key:n,range:a}=r||{},u=216e5,c={time:w(new Date(m(l.time)+u),"yyyy-MM-dd HH:mm"),value:10},[d,f]=[S(l.time)-I,O-G(n,a,l.value)],[p,h]=[S(c.time)-I,O-G(n,a,c.value)],g=(h-f)/(p-d),v=f-d*g,y=s(g,v);y.length>0&&(o.push(t(y,{...e})),Object.assign(i,{k:g,b:v}))}break;case"handling":if(l){const{k:n,b:r}=i,a=144e5,u=s(n,r-(S(w(new Date(m(l.time)+a),"yyyy-MM-dd HH:mm"))-S(l.time))*n);u.length>0&&o.push(t(u,{...e}))}}})),x.value.add(...o)}(),te(),function(){function e(e,t){const n=_.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:n,key:e.key},pointer:t}}b.event.evented&&x.value.on("mouse:up",(t=>{if(3===t.button){const{x:n=0,y:o=0}=t.pointer||{};n>=I&&n<=B&&o>=H&&o<=O&&(P.point={x:n,y:o},P.show=!0,t.target?(P.target=t.target,P.list=["删除节点"],[...ee].forEach((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&P.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(P.target=null,P.list=["新增节点"],_.filter((e=>e.show)).forEach((i=>{if(!Y([...ee],n,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<Q)return;P.list.push(e(i,t.pointer))}})),1===P.list.length&&(P.show=!1,E("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=q-J/2;function t(e,t){if(!e.length)return;let o=H;const i=[];e.forEach((e=>{const n=e.title.split("").join("\n"),r=F.findIndex((t=>t.key===e.key)),{text:s,icon:a}=l(n,e,{text:{originY:"top",left:t,top:o},icon:{left:t,topY:o,originY:"top",origin:{type:e.type,dataIndex:r},...b.event}},"vertical");var u;o+=s.height+a.height+15,(u=a).on("moving",(()=>{u.set("originY","center"),L(u)?(ie(u),re(u)):C.show=!1})),u.on("mouseup:before",(e=>{if(C.show=!1,0===e.e.button&&L(u))if(Y([...ee],u.left,"key").includes(u.origin.key))E("repeat");else{const e={data:{time:M(u.left),value:T(u.origin.key,u.top)},...u.origin};j("add",e),ne(e)}!function(e){e.setCoords().set({originY:"top",left:e.originLeft,top:e.originTop})}(u)})),i.push(s,a)})),n(i),x.value.add(...i)}function n(e){const t=e.at(-1),n=(O-H)/2,o=(t.height+t.top-H)/2;e.forEach((e=>{const t=e.top+n-o;e.set({top:t,originTop:t})}))}t(N,D/2),t(R,e)}(),{clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(j("remove",n),ne(n,"remove")):(Object.assign(n,{data:{time:M(e.pointer.x),value:T(e.origin.key,e.pointer.y)}}),j("add",n),ne(n))},redrawPoints:oe}}export{x as useBirthProcess};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ref as e,computed as a,reactive as t,onMounted as l,nextTick as r}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{getTime as i}from"../../utils/index.js";import{
|
|
1
|
+
import{ref as e,computed as a,reactive as t,onMounted as l,nextTick as r}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{getTime as i}from"../../utils/index.js";import{useCanvasEvent as s}from"../useEvent.js";import"../temperature/useShadow.js";import"lodash-es";import{useBirthProcess as d}from"./useBirthProcess.js";function n(n,o,v,c,h,m){const f=e(),g=e(),p=e(),x=a((()=>o.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),w=a((()=>o.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),y=a((()=>{var e;return(null==(e=w.value)?void 0:e.length)?30:0})),V=a((()=>{var e;return 30+(null==(e=x.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),b=a((()=>{var e;const{width:a}=o.data,t=null==(e=w.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-y.value-t})),j=a((()=>o.data.grid.mainXCell)),A=a((()=>{const e=o.data.grid.mainYCell||14;return o.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),C=a((()=>(b.value-V.value)/j.value)),k=a((()=>{const{xAxis:e,height:a}=o.data,t=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(A.value+t)})),Y=a((()=>{const{xAxis:e}=o.data,a=Object.values(e).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0);return k.value*a})),S=a((()=>{var e;const{scaleValues:a}=o.data;if(!(null==(e=a.find((e=>"FHR"===e.key)))?void 0:e.show)&&!Y.value)return Y.value;const t=a.find((e=>"cervix"===e.key)),[,l]=(null==t?void 0:t.range)||[0,10],r=(null==t?void 0:t.spaceValue)||1;return H.value-l*r*k.value})),H=a((()=>{const{xAxis:e,height:a}=o.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-k.value*t})),P=a((()=>i(o.data.xAxis.time.startTime))),X=a((()=>36e5/C.value)),F=a((()=>{const{scaleValues:e}=o.data,a=e.find((e=>"cervix"===e.key));return k.value/((null==a?void 0:a.spaceValue)||1)})),R=a((()=>{const{scaleValues:e}=o.data,a=e.find((e=>"FHR"===e.key));return k.value/((null==a?void 0:a.spaceValue)||10)})),W=a((()=>{const{scaleValues:e}=o.data,a=e.find((e=>"fetalPresentation"===e.key));return k.value/((null==a?void 0:a.spaceValue)||1)})),O=a((()=>{var e;return(null==(e=o.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),M=t({canvasWidth:o.data.width,canvasHeight:o.data.height,borderStyle:{...u,...o.data.borderStyle||{}},selectionStyle:o.data.selectionStyle||{},grid:o.data.grid,other:o.data.other,originX:V.value,endX:b.value,originY:Y.value,endY:H.value,xCellWidth:C.value,yCellHeight:k.value,gridXNumber:j.value,gridYNumber:A.value,xAxis:o.data.xAxis,leftScales:x.value,rightScales:w.value,leftAddAreaWidth:30,rightAddAreaWidth:y.value,startTime:P.value,timeXCell:X.value,cervixYCell:F.value,FHRYCell:R.value,fetalPresentationYCell:W.value,scaleValues:o.data.scaleValues,event:O.value,originYCervix:S.value});return l((()=>{r((()=>{const{clickMenu:e,redrawPoints:a}=d(n,M,v,h,m);g.value=a,p.value=e;const{select:t}=s(n,M,v);f.value=t}))})),{propItems:M,redrawPoints:g,select:f,clickMenu:p}}export{n as useBirthProcessChart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{defaultBorderStyle,defaultLineStyle,defaultRectStyle,defaultStyle,defaultTextStyle,drawArrow,drawLine,drawPoint,drawText,drawTextAndIconGroup,drawTextGroup}from"./useDraw.js";export{useGrid}from"./useGrid.js";export{useBirthProcessCumputedPoint,useCumputedPoint}from"./useCumputedPoint.js";export{useCanvasEvent
|
|
1
|
+
export{defaultBorderStyle,defaultLineStyle,defaultRectStyle,defaultStyle,defaultTextStyle,drawArrow,drawLine,drawPoint,drawText,drawTextAndIconGroup,drawTextGroup}from"./useDraw.js";export{useGrid}from"./useGrid.js";export{useBirthProcessCumputedPoint,useCumputedPoint}from"./useCumputedPoint.js";export{useCanvasEvent}from"./useEvent.js";export{drawScaleLine,drawScaleNumber,getScaleInfo}from"./useScaleColumn.js";export{useCommon}from"./useCommon.js";export{useBirthProcessChart}from"./birthProcess/useBirthProcessChart.js";export{useTemperatureChart}from"./temperature/useTemperatureChart.js";export{useSurgicalAnesthesiaChart}from"./surgicalAnesthesia/useSurgicalAnesthesiaChart.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{drawLine as e,drawPoint as t}from"../useDraw.js";import{useGrid as n}from"../useGrid.js";import{useBirthProcessCumputedPoint as i}from"../useCumputedPoint.js";import"
|
|
1
|
+
import{drawLine as e,drawPoint as t}from"../useDraw.js";import{useGrid as n}from"../useGrid.js";import{useBirthProcessCumputedPoint as i}from"../useCumputedPoint.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCommon as o}from"../useCommon.js";import"vue";import{getPointRange as l,getIndex as r,isEffectiveNode as a,getTime as s}from"../../utils/index.js";import{cloneDeep as f}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";function u(u,p,c,d,m){const{cumputedX:v,cumputedY:g,getXValue:h,getYValue:y}=i(p),{xCellWidth:L,yCellHeight:x,originX:k,endX:b,originY:P,endY:A,event:w,scaleValues:j,xAxis:C,startTime:I,timeXCell:T,itemList:X}=p,E=new Map,M=new Set,Y=f(j);let _=[];n(u,p);const{getEqualXTypes:O,handleAddPrevent:V}=o(u,c,p);function $(){Y.forEach((e=>{e.dataList.forEach(((t,n)=>{S(t,n,e)}))})),function(){if(!w.evented)return;function e(e,t,n){Object.assign(m,{point:e,show:!0,target:t,list:n})}u.value.on("mouse:up",(t=>{if(3===t.button){const{x:n=0,y:i=0}=t.pointer||{};if(n>=k&&n<=b&&i>=P&&i<=A)if(t.target){if("main"!==t.target.__type)return;e(t.pointer,t.target,["删除节点"]);const{minLeft:n,maxLeft:i,minTop:o,maxTop:r}=l(t.target);H().forEach((e=>{"main"===e.__type&&e.left>n&&e.left<i&&e.top>o&&e.top<r&&m.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})})),1===m.list.length&&(m.show=!1,console.log("当前时间段内无可删除节点"))}else e(t.pointer,null,["新增节点"]),X.forEach((e=>{O(H(),n,"key").includes(e.key)||m.list.push({renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,type:e.bigType,dataIndex:e.dataIndex,key:e.key},pointer:t.pointer})})),1===m.list.length&&(m.show=!1,V("repeat"),console.log("当前时间段内无可新增节点"))}}))}()}function S(n,i,o){var l;const{type:r,unit:a,dataList:s=[]}=o,f=[];E.set(n.key,[]),null==(l=n.list)||l.forEach(((l,s)=>{!function(n,l,s,m){var v;let g,x;const{pointAttr:j={},lineAttr:C={},title:I="",key:X,type:Y="circle"}=m,O=G(m.list[s+1],o);n&&O&&!l.breakpoint&&n[0]!==O[0]&&(x=e([...n,...O],C));const V=f[s-1],$={origin:{data:l,title:I,key:X||"",unit:a,type:r,dataIndex:i,index:s,lineAttr:C},__type:"main",leftLine:V,rightLine:x,...j,...p.event.hovered?p.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:p.event};V?g=t(Y,{left:V.get("x2"),top:V.get("y2"),...$}):n&&($.leftLine=null,g=t(Y,{left:n[0],top:n[1],...$}));f.push(x),g&&(g.originLeft=g.left,g.originTop=g.top,function(e){w.hovered&&(e.on("mouseover",(()=>{q(e,"hover")})),e.on("mouseout",(()=>{d.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t=6e4/T,n=e.prevPoint?e.prevPoint.left+t:k,i=e.nextPoint?e.nextPoint.left-t:b;e.top<P&&e.set("top",P),e.top>A&&e.set("top",A),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),w.hovered&&q(e),function(e){const{originLeft:t,originTop:n,left:i,top:o,origin:l}=e,r=~~((i-t)/L);if(i>t+L&&!e.nextPoint){if(0===_.length){z(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[t,n],t,n]),e.leftLine&&e.leftLine.set({stroke:"transparent"})}const i=t+L*r;if(_.every((e=>e.left!==i))){const t=h(i),n=y(l.type,o);_.push({data:{time:t,value:n},left:i,top:o}),z(e,[...e.prevPointer,i,o])}_.length<r&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+L*l,r=_.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=_.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=_[l-1]||{left:n,top:i},f=~~((r.left-(t-L))/L),u=(r.top-s.top)/f;a.top=s.top+u,a.left=t,a.data={time:h(t),value:y(o.type,a.top)},_.splice(l,0,a),z(e,[s.left,s.top,a.left,a.top])}}l++}}(e,r)}if(_.length>0&&i<_[_.length-1].left){for(const e of M)e.left>i&&(e.leftLine&&u.value.remove(e.leftLine),u.value.remove(e));if(_=_.filter((e=>e.left<=i)),0===_.length){e.leftLine&&e.leftLine.set(e.origin.lineAttr);for(const e of M)e.leftLine&&u.value.remove(e.leftLine),u.value.remove(e)}if(_.length>0){const t=_.at(-1);e.prevPointer=[t.left,t.top]}}}(e)})),e.on("mouseup",(t=>{if(d.show=!1,1===t.button){const{key:t,type:n}=e.origin,i={...e.origin,data:{...e.origin.data,time:h(e.left),value:y(n,e.top)}};if(u.value.discardActiveObject(),_.length>0){const e=_.map((e=>e.data));c("add",{...i,data:e}),D({...i,data:e})}else c("change",i),D(i,"change")}}))}(g),null==(v=E.get(X))||v.push(g))}(G(l,o),l,s,n)})),Promise.all(E.get(n.key)).then((e=>{const t=f.filter((e=>e));let n=null;e=e.map((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),u.value.add(...t,...e)}))}function z(t,n){const[i,o,l,r]=n;t.clone((i=>{i.set({left:l,top:r}),t.prevPointer=[l,r];const o=e(n,t.origin.lineAttr);i.leftLine=o,M.add(i),u.value.add(o,i)}))}function D(e,t="add"){const{dataIndex:n,data:i,index:o,key:l,type:a}=e,s=Y.find((e=>e.type===a)),f=s.dataList.find((e=>e.key===l));switch(t){case"remove":f.list.splice(o,1);break;case"change":f.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=r(e,f.list),n=Array.isArray(i)?i:[i];f.list.splice(t,0,...n);break}}J({dataIndex:n,scaleValue:s})}function J(e){var t,n,i;if(M.size&&(null==(t=u.value)||t.remove(...N([...M]))),M.clear(),_=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=u.value)||n.remove(...N(E.get(o.key))),E.delete(o.key),S(o,t,i)}else E.size&&(null==(i=u.value)||i.remove(...N(H()))),E.clear(),$()}function N(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine)})),t}function q(e,t="moving"){const{title:n,type:i,data:o,unit:l}=e.origin;d.point={x:e.left,y:e.top};const r=`${"hover"===t?o.value:y(i,e.top)}`;d.list=[`${n} ${r}${l||""}`,`时间 ${h(e.left).slice(-5)}`],d.show=!0}function G(e,t){if(a(e)&&function(e){const t=Date.parse(C.list.at(-1)),n=s(e);return n>=I&&n<=t}(e.time)){const n=v(e.time),i=g(t.type,t.range,e.value);return[n,i<P?P:i>A?A:i]}}function H(){return Array.from(E.values()).flat()}return $(),{redrawPoints:J,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(c("remove",n),D(n,"remove")):(Object.assign(n,{data:{time:h(e.pointer.x),value:y(e.origin.type,e.pointer.y)}}),c("add",n),D(n))}}}export{u as useCenter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as l,defaultTextStyle as n,defaultStyle as r}from"../useDraw.js";import"date-fns";import{getScaleNumberList as a}from"../../utils/index.js";import
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as l,defaultTextStyle as n,defaultStyle as r}from"../useDraw.js";import"date-fns";import{getScaleNumberList as a}from"../../utils/index.js";import{drawScaleNumber as s}from"../useScaleColumn.js";import"vue";import"lodash-es";import"../temperature/useShadow.js";function d(d,h,u){const{originY:c,endY:p,borderStyle:f,left:m,itemList:g,scaleValues:v,originX:w,endX:j,yCellHeight:y,markHeight:S,canvasWidth:W,canvasHeight:b}=h;!function(){if(!m)return;const{title:t,titleWidth:i,titleStyle:o}=m,l=e({width:i,height:p-c+S,...f},{value:t.split("").join("\n"),...o||{}},{left:0,top:c},!0);d.value.add(l)}(),v.forEach(((e,i)=>{var o,h;const u="left"===e.layout?w-5:j+5,{range:c,spaceValue:f,title:g,unit:v,titleStyle:S,spaceGridNumber:b=1,showNumber:x,showMaxMinNumber:N}=e,k=[],X=a(c,f),Y=X.length;X.forEach(((t,i)=>{const o=0===i?p-5:p-i*y*b;!x||(0===i||i===Y-1)&&!N||k.push(s(String(t),{...e,position:e.layout},u,o))}));const C=g&&l(["left"===e.layout?m.width/2:j+(W-j)/2,(null!=(h=null==(o=k.at(-1))?void 0:o.top)?h:330)-y],{value:`${g}${v?"\n"+v:""}`,...n,...S}),E=new t.Group([...k,...C?[C]:[]],{objectCaching:!1,...r});d.value.add(E),E.sendToBack()})),function(){const e=new t.Rect({width:w-m.titleWidth,height:p-c+S,left:m.titleWidth,top:c,...i,originX:"left",originY:"top",...f});d.value.add(e);const l=JSON.parse(JSON.stringify(g));let n=p;const r=m.titleWidth+15;l.reverse().forEach((t=>{n-=10;const e=t.title,{text:i,icon:l}=o(e,t,{text:{left:r,top:n},icon:{leftX:r,topY:n}});n-=i.height||30,d.value.add(i,l)}))}(),d.value.add(new t.Rect({left:0,top:0,width:W-f.strokeWidth,height:b-f.strokeWidth,fill:"transparent",...f}))}export{d as useLeft};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as o}from"../useDraw.js";import{useBirthProcessCumputedPoint as i}from"../useCumputedPoint.js";import"
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as o}from"../useDraw.js";import{useBirthProcessCumputedPoint as i}from"../useCumputedPoint.js";import"vue";import"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as n}from"../../constants/index.js";function r(r,l,a,s,u){const{cumputedX:c,getXValue:f}=i(l),{other:d,yCellHeight:m,endX:h,originX:p,originY:v,endY:g,markHeight:x,event:y,topGridYCellHeight:X}=l;function k(t){y.hovered&&(t.on("mouseover",(()=>{_(t)})),t.on("mouseout",(()=>{s.show=!1}))),y.evented&&t.on("mouseup",(e=>{s.show=!1,3===e.button&&(u.point={x:t.left,y:t.top},u.show=!0,u.target=t,u.list=n.map((t=>({...t,renderItem:()=>t.label}))))}))}function _(t){s.point={x:t.left,y:"mark"===t.__type?t.top:t.top+X/2},s.list=[`时间 ${f(t.left).slice(-5)}`],"mark"===t.__type&&s.list.unshift(t.origin.name+" "),s.show=!0}function S(t){return t>=p&&t<=h}return function(){if(!(null==d?void 0:d.horizontal))return;const{horizontal:i}=d,n=p-5;let l=v+m/2;i.forEach(((i,a)=>{const{title:s,titleStyle:u={},type:f,pointAttr:d={},textStyle:h={},data:p}=i,v=s&&e(s,{...u,originX:"right",left:n,top:l});r.value.add(v),p.forEach(((i,n)=>{const{time:u,value:m}=i,p=c(u);if(!S(p))return;const v=e(f,{...d,left:p,top:l}),g=p+v.width/2+2,x=o([g,l],{value:m,...h,originX:"left"}),y=new t.Group([v,x],{lockMovementX:!0,lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer"});y.__type="other",y.origin={__type:"other",key:"horizontal",dataIndex:a,index:n,data:i,title:s},k(y),r.value.add(y)})),l+=m}))}(),function(){if(!(null==d?void 0:d.vertical))return;const{vertical:t}=d;t.forEach(((t,o)=>{const{textStyle:i={},data:n,time:l}=t,a=c(l);if(!S(a))return;let s=v+m/2;n.forEach(((t,n)=>{const u=e(String(t),{...i,lockMovementX:!0,lockMovementY:!0,left:a,originX:"left",top:s,__type:"other",origin:{key:"vertical",dataIndex:o,index:n,data:{time:l,value:t}}});s+=m,k(u),r.value.add(u)}))}))}(),function(){if(!(null==d?void 0:d.mark)||!x)return;const{title:t,titleStyle:i,pointAttr:n,dataList:l}=d.mark,u=o([p-5,g+x/2],{value:t,...i,originX:"right"});r.value.add(u);const m=g+x,X=[];l.forEach((t=>{const{time:o,list:i=[]}=t,l=c(o);if(!S(l))return;let u=g;i.forEach((t=>{let o=!1;const i=e("circleAndText",{...n,text:t.text,left:l,top:u,origin:t,__type:"mark"}),c=i.height;u+c<=m&&u>=g?(i.set("top",u+c/2),u+=c):(o||(u=g,o=!0),i.set("top",u-c/2),u-=c),X.push(i),function(t){y.hovered&&(t.on("mouseover",(()=>{_(t)})),t.on("mouseout",(()=>{s.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2);t.top<v&&t.set("top",v);const e=g+x-t.height/2;t.top>e&&t.set("top",e)}(t),y.hovered&&_(t)})),t.on("mouseup",(e=>{if(s.show=!1,1===e.button){!function(t){var e;if((null==(e=t.origin)?void 0:e.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left));console.log(e);const o=Math.min(...e);console.log(o,t.startPoint),t.startPoint.limitX.x2=o}}(t);const e={type:"mark",time:f(t.left),data:t.origin};r.value.discardActiveObject(),a("change",e)}}))}(i),r.value.add(i)}))})),function(t){const e=t.find((t=>{var e;return null==(e=t.origin)?void 0:e.isStart})),o=t.find((t=>{var o;return!(null==(o=t.origin)?void 0:o.isStart)&&t.left>e.left})),i=t.filter((t=>{var e;return!(null==(e=t.origin)?void 0:e.isStart)}));t.forEach((t=>{var n;const r={x1:p,x2:h};(null==(n=t.origin)?void 0:n.isStart)?(r.x2=o.left,t.otherPoints=i):(r.x1=e.left,t.startPoint=e),t.limitX=r}))}(X)}(),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:o}=t;a(o,{...e.origin,type:"other"})}}}export{r as useOther};
|
package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as l}from"vue";import{defaultBorderStyle as n}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as u}from"date-fns";import{getChildrenSize as s}from"../../utils/index.js";import{
|
|
1
|
+
import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as l}from"vue";import{defaultBorderStyle as n}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as u}from"date-fns";import{getChildrenSize as s}from"../../utils/index.js";import{cloneDeep as o,range as d}from"lodash-es";import"../temperature/useShadow.js";import{OTHER_MENU as c}from"../../constants/index.js";import{useTop as p}from"./useTop.js";import{useLeft as m}from"./useLeft.js";import{useCenter as h}from"./useCenter.js";import{useOther as v}from"./useOther.js";function f(f,g,y,x,w,b){const j=e(),Y=e(),C=e(),H=t((()=>g.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),A=t((()=>{var e;return null!=(e=g.data.left.width)?e:0})),D=t((()=>{const{grid:e}=g.data;return e.mainXCell*e.subXCell})),M=t((()=>{const{grid:e}=g.data;return e.mainYCell*e.subYCell})),T=t((()=>s(g.data.top.treeData))),X=t((()=>g.data.top.tree.cellHeight)),V=t((()=>X.value*T.value)),k=t((()=>$(U("drug")||"top"))),G=t((()=>k.value+V.value)),S=t((()=>{var e;return Date.parse((null==(e=g.data.xAxis)?void 0:e.startTime)||u(new Date,"yyyy-MM-dd HH:mm:ss"))})),N=t((()=>{const e=o(g.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=d(D.value/t+1).map((r=>0===r?e.startTime:u(new Date(S.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:A.value}})),O=function(){const e=o(g.data.top.treeData);let t=0;const{cellWidth:a,cellHeight:r}=g.data.top.tree;return function e(i,l=0){i.forEach((i=>{var n;const u={top:t*r+k.value,left:l*a,width:a,height:r};if(t++,null==(n=i.children)?void 0:n.length){t--;const a=s(i.children);u.height=a*r,e(i.children,l+1)}else u.width=A.value-u.left;Object.assign(i,u)}))}(e),e}(),L=t((()=>$(U("xAxis")||"center"))),W=t((()=>{var e;const{width:t,right:a}=g.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),E=t((()=>$(U("intraoperatively")||"bottom"))),I=t((()=>{var e;const{show:t=!0,height:a}=(null==(e=g.data.other)?void 0:e.mark)||{};return t&&a?a:0})),P=t((()=>E.value+(g.data.height-V.value-N.value.height-I.value))),q=t((()=>(W.value-A.value)/D.value)),z=t((()=>(P.value-E.value)/M.value)),B=t((()=>N.value.spaceTimeStamp/q.value)),F=t((()=>{const{scaleValues:e}=g.data;return e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))).flat()})),J=t((()=>_("pulse"))),K=t((()=>_("temperature"))),Q=t((()=>{var e;return(null==(e=g.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),R=a({canvasWidth:g.data.width,canvasHeight:g.data.height,borderStyle:{...n,...g.data.borderStyle||{}},grid:g.data.grid,top:g.data.top,left:g.data.left,other:g.data.other,topGridYNumber:r(T),topGridYCellHeight:r(X),topGridOriginY:r(k),topGridEndY:r(G),treeData:O,xAxis:r(N),originYXAxis:r(L),startTime:r(S),timeXCell:r(B),gridXNumber:r(D),gridYNumber:r(M),xCellWidth:r(q),yCellHeight:r(z),originX:r(A),endX:r(W),originY:r(E),endY:r(P),markHeight:r(I),itemList:r(F),scaleValues:g.data.scaleValues,pulseYCell:r(J),temperatureYCell:r(K),event:r(Q)});function U(e){let t="";return Object.entries(H.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function Z(e){const t=H.value[e],a=N.value.height;switch(t){case"drug":return V.value;case"xAxis":return a;default:return g.data.height-V.value-a}}function $(e){switch(e){case"top":return 0;case"center":return Z("top");default:return Z("top")+Z("center")}}function _(e){const{scaleValues:t}=g.data,a=t.find((t=>t.type===e));return z.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await l(),p(f,R,y,w),m(f,R);const{clickMenu:e}=v(f,R,y,w,b),{redrawPoints:t,clickMenu:a}=h(f,R,y,w,b);Y.value=t,C.value=t=>{const{item:r}=t;r.type&&c.map((e=>e.type)).includes(r.type)?e(t):a(t)}})),{propItems:R,redrawPoints:Y,select:j,clickMenu:C}}export{f as useSurgicalAnesthesiaChart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as f}from"../useCumputedPoint.js";import"
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as f}from"../useCumputedPoint.js";import"vue";import{cloneDeep as c}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";function a(a,d,u,m,h){const{cumputedX:p,getXValue:x}=f(d),{originX:L,endX:g,xCellWidth:v,originYXAxis:X,top:C,topList:w,canvasWidth:y,borderStyle:Y,treeData:S,xAxis:j,topGridYNumber:b,topGridOriginY:k,topGridYCellHeight:G,topGridEndY:I,event:z}=d,A=new Set;function M(t,e,i){let n;const{content:o}=t.value||{};if(o){const{lineStyle:l,textStyle:s,totalStyle:f}=C.data||{},{startLine:c,centerLine:a,endLine:d}=e;n=r(o,{fontSize:12,...s,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const u=$(n,e,i);n&&(n.set(u),n.origin={data:t},D(n),c&&(c.text=n),d&&(d.text=n))}return n}function $(t,e,i){const n=t.width+1,{startLine:o,centerLine:l,endLine:r}=e,s={top:i,originX:"center",originY:"center"};return l&&n<=l.width?s.left=l.x1+l.width/2:r&&n<=r.limitX.x2-r.left?(s.originX="left",s.left=r.left+1):o&&!r&&n<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&n<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):l?(s.originY="top",s.left=l.x1+l.width/2,s.top=i+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=i+1),s}function E(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:f,y2:c,halfY:a}=e;if(!s||s<L||s>g)return;const{lineStyle:d}=C.data||{};let u;const m={left:s,top:a};u=i?r("circle",{fill:d.stroke,...m}):n?r(">",{fill:d.stroke,...m,fontSize:18}):l([s,f,s,a],d);const h=new t.Rect({width:v,height:G,fill:"transparent",left:s-v/2,top:f}),p=new t.Group([u,h],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,hoverCursor:"pointer",lockMovementY:!0});return p.isLeft=o,p.isCustomIcon=i,D(p),p}function D(t){z.hovered&&(t.on("mouseover",(()=>{H(t,"hover")})),t.on("mouseout",(()=>{m.show=!1}))),t.lockMovementX&&t.lockMovementY||(t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(t),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=$(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(t),z.hovered&&H(t)})),t.on("mouseup",(e=>{if(1===e.button){!function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(t);const e={type:"tree",...t.origin};u("change",e)}})))}function H(t,e="moving"){var i,n,o;const{data:l}=t.origin;m.point={x:t.left,y:t.top};let[r="",s=""]=l.time||[];if("moving"===e){const e=x(t.left);t.isLeft?r=e:s=e,l.time=[r,s],t.text&&(t.text.origin.data.time=[r,s])}m.list=[`开始时间 ${r}`,`结束时间 ${s}`,`流速 ${(null==(i=l.value)?void 0:i.currentSpeed)||""}`,`浓度 ${(null==(n=l.value)?void 0:n.consistence)||""}`,`总量 ${(null==(o=l.value)?void 0:o.total)||""}`],m.show=!0}s(a,{...d,gridYNumber:b,originY:k,yCellHeight:G,endY:I}),function(){const{height:o,list:l,left:r,spaceValue:s}=j;if(!o)return;const f=[],c=X+o/2;l.forEach(((t,i)=>{const n=r+i*v*s;f.push(e([n,c],{value:t.slice(11,16)}))}));const d=f.length>0?new t.Group([...f],{...i,objectCaching:!1}):null;d&&a.value.add(d);const u=new t.Rect({width:y,height:o,left:0,top:X,...n,originX:"left",originY:"top",...Y});a.value.add(u)}(),function(){var e;const n=(null==(e=null==C?void 0:C.tree)?void 0:e.textStyle)||{},r=[];!function t(e){e.forEach((e=>{var i;const{width:s,height:f,left:a,top:d,title:u=""}=e,m={value:u,...n};(null==(i=e.children)?void 0:i.length)?(m.value=u.split("").join("\n"),t(e.children)):(m.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e,textStyle:i,totalStyle:n}=C.data||{},o=t.top,r=o+G,s=r-G/2,f={y1:o,y2:r,halfY:s},a=[],d=c(t);delete d.data,t.data.forEach(((t,i,n)=>{const{time:o,continue:r}=t,[c,u]=o,m=c&&p(c),h=u&&p(u),x=E({...f,x:m},{isCustomIcon:!h&&!r,isContinue:!1,isLeft:!0}),v=E({...f,x:h},{isCustomIcon:!1,isContinue:!!r});let X,C,w;if((x||m<L)&&(v||h>g)){X=l([x?m:L,s,v?h:g,s],e)}a.push({startLine:x,centerLine:X,endLine:v}),function(t,e,i){const{startLine:n,centerLine:o,endLine:l}=e[t],{startLine:r,endLine:s}=e[t-1]||{};if(n){n.origin=i;const t={x1:L,x2:l?l.left:g};s?(t.x1=s.left,s.limitX.x2=n.left,n.prevLine=s,s.nextLine=n):r&&(t.x1=r.left,r.limitX.x2=n.left,n.prevLine=r,r.nextLine=n),n.limitX=t,o&&(n.centerLine=o)}if(l){l.origin=i;const t={x1:n?n.left:L,x2:g};l.limitX=t,o&&(l.centerLine=o)}n&&l&&(n.nearLine=l,l.nearLine=n)}(i,a,Object.assign({},d,{data:t,index:i})),n[i-1]&&(C=M(n[i-1],a[i-1],s)),i===n.length-1&&(w=M(t,a[i],s)),X&&A.add(X),x&&A.add(x),v&&A.add(v),C&&A.add(C),w&&A.add(w)}))}(e)),r.push(o({width:s,height:f,...Y},m,{left:a,top:d},!0))}))}(S);const s=r.length>0?new t.Group([...r],{...i,objectCaching:!1}):null;s&&a.value.add(s),A.size&&a.value.add(...A)}()}export{a as useTop};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultTextStyle as i,defaultStyle as n}from"../useDraw.js";import"date-fns";import"lodash-es";import"
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultTextStyle as i,defaultStyle as n}from"../useDraw.js";import"date-fns";import"lodash-es";import"vue";import"./useShadow.js";function o(o,s){const{xScaleList:a,originX:l,endX:r,endY:h,xCellWidth:c,canvasWidth:d,canvasHeight:u,bottom:g,breathingHeight:p,iconsWidth:f,borderStyle:m}=s;!function(){var s,d,u;if(!p||!g){const e=new t.Line([f,h-1,r,h-1],m);return o.value.add(e),e.sendToBack(),!1}const v=p,b=(null==(s=g.breathing)?void 0:s.list)||[],w=[];let x=!0;a.forEach(((t,n)=>{const o=l+n*c;let s="";b.forEach(((e,i)=>{const n=new Date(e.time).getTime();n>=t&&n<+t+t.scaleCell&&(s=e.value)}));const a=x?{top:-(v/2-10)}:{top:v/2-10};s&&(x=!x);const r=e({width:c,height:v,...m},Object.assign({},{text:String(s),...i},s?a:{}),{left:o,top:h});w.push(r)}));const j=e({width:r,height:v,...m},{text:String((null==(d=g.breathing)?void 0:d.title)+(null==(u=g.breathing)?void 0:u.unit)),...i,left:-(r-l)/2},{left:0,top:h});w.push(j);const S=w.length>0?new t.Group([...w],{...n}):null;S&&S.sendToBack(),S&&o.value.add(S)}()}export{o as useBottom};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as n,defaultStyle as i,drawPoint as o,drawText as l,drawArrow as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as c,isValidValue as p,setOtherType as d,isEffectiveNode as f,getTime as h,getIndex as g,deleteProperty as v}from"../../utils/index.js";import"@vueuse/core";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as j}from"../../constants/index.js";function L(L,k,S,Y,E,M,$,O,P,A){s(L,k);const{getEqualXTypes:C,handleAddPrevent:I}=y(L,S,k),{createShadowLines:T}=t(),{left:R,xScaleList:X,xCellWidth:F,yCellHeight:z,originX:D,endX:V,originY:_,endY:G,itemList:H,event:W,vitalSignsOriginY:q,painOriginY:B,hospitalizationDate:J,config:K,canvasHeight:N}=k,Q=new Set,U=["xinmai","mai"],Z=new Map,ee=new Set,te=new Set,ne=new Set,ie=m(R.yScaleValue);function oe(t){var o;const l=ie.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(Q.size&&L.value.remove(...Q),Q.clear(),Z.size>1)){if(t){const{type:e,key:n}=t.origin||{};if("pulse"===e){const e=Z.get(n),i=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(i,1,[t.left,t.top])}}const o=function(){const e=[],t=[],n=[];for(const e of Z)t.push(e[1]),e[0]===U[0]&&e[1].forEach((e=>{(Z.get(U[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&n.push(e[0])}));const[i,o]=t;let l=[],r=[];return n.forEach((t=>{const n=i.findIndex((e=>e[0]===t)),s=o.findIndex((e=>e[0]===t)),a=i[n],u=o[s],c=i[n-1],p=i[n+1],d=o[s-1],f=o[s+1];if(c&&d){if(c[0]!==d[0]){const e=Math.max(c[0],d[0]);l.push([c,d].find((t=>t[0]===e)))}}else c?l.push(c):d&&r.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const g=Math.max(a[1],u[1]);r.push([a,u].find((e=>e[1]===g)));const v=()=>{const t=[...l,...r.reverse()],[n]=t,i=t.at(-1);n[0]===i[0]&&n[1]===i[1]&&t.splice(-1,1),e.push(t),l=[],r=[]};if(p&&f){if(p[0]!==f[0]){const e=Math.min(p[0],f[0]);l.push([p,f].find((t=>t[0]===e))),v()}}else p?(l.push(p),v()):f?(r.push(f),v()):v()})),e}(),{mode:r,style:s={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...i,...s,strokeWidth:1});if(["slash","line"].includes(r)){l.set({fill:"transparent",stroke:s.stroke||"#f00"});const e=[];if(["slash"].includes(r))e.push(...T(t,s._angle,s.space)),e.forEach((e=>{Object.assign(e,{...i,...s}),Q.add(e)}));else{const i=function(e){const t=e.reduce(((e,t)=>{const n=Math.trunc(t[0]);return e[n]=e[n]?e[n].concat(t):[t],e}),{}),n=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return n}(t);i.forEach((t=>{const i=n([...t.flat()],{...s,originX:"center"});e.push(i),Q.add(i)}))}L.value.add(...e)}Q.add(l),L.value.add(l)}))}}function le(){var e;const t=ie.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const n=Object.assign({},j,R.overlap||{}),l=[];ee.size&&[...ee].forEach((e=>{[...te].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key;if(e){const r={left:t.left,top:t.top,...i,hoverCursor:"default"};let s="koumai";"yemai"===e&&(s=e),"humai"===e&&(s="circle"),l.push(o(s,{...n[e]||{},...r}))}}}))})),setTimeout((()=>{L.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ne.add(e)}))}))}function re(e,t,s){var u;const{type:c,riseStyle:f={},noRiseStyle:h={},verifiedStyle:g={},reduceStyle:v={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:j=[]}=s,{type:Y,textStyle:M,showConnectLine:O=!1}=b,A=[],C=[],I=[];null==(u=e.list)||u.forEach(((u,b)=>{const T=a(c)?j.find((e=>e.key===u.key)):e,R=ue(u,s),X={};X.value=function(e,t,n){if(!(null==e?void 0:e.length)||!K.showValue)return;const{lineAttr:i={}}=n,o=e[1]<=q.originY+z?e[1]+z:e[1]-z,r=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:i.stroke||"#000"});return I.push(r),{obj:r,top:-z}}(R,u,T),function(e,t,s,a,u){var d,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(c))return;const{lineAttr:m={}}=s,{value:x}=a;let b,j,L,k,S,Y;if(t.noRise&&h.show){const t=w(h)?E(u.type,u.list,35):e[1];if(h.text)L=l([e[0],w(h)?t:t+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),I.push(L);else{const n=t+2*z;k=r([e[0],t,n],h.style||{}),I.push(k)}}t.rise&&f.show&&f.text&&(S=l([e[0],e[1]-(x?z:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style||{}}),I.push(S));t.verified&&(Y=l([e[0],e[1]-(x?z:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),I.push(Y));if(p(t.physicsReduce)||p(t.drugReduce)){const l=E(c,u.list,null!=(d=t.physicsReduce)?d:t.drugReduce);b=n([...e,e[0],l],{...m,...v.line,...i}),j=o((null==(y=null==v?void 0:v.point)?void 0:y.type)||"circle",{left:e[0],top:l,...v.point,...i,originY:l===N?"bottom":"center"}),b&&I.push(b),j&&I.push(j)}Object.assign(a,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:L,top:5,isFixed:w(h)},arrowGroup:{obj:k,top:2*z,isFixed:w(h)},riseText:{obj:S,top:(x?-z:0)-5},verifiedText:{obj:Y,top:(x?-z:0)-5},reducePoint:{obj:j,type:"reduce"}})}(R,u,T,X,s),function(e,t,n,i){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;let o,a;const{upArrowShow:u=!1,limitValueShow:p=!1}=n;if(u&&+t.value>180){let t=e[1]-2.5*z,n=[e[1]-z/2,t];t<q.originY&&(t=e[1]+2.5*z,n=[t,e[1]+z/2]),o=r([e[0],n[0],n[1]],m,"up"),I.push(o)}if(p){const n={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...s.list)){const t=o?e[1]+z/2+o.height:e[1]+z;a=l([e[0],t],n),I.push(a)}+t.value<Math.min(...s.list)&&(a=l([e[0],e[1]-z],n),I.push(a))}Object.assign(i,{upArrow:{obj:o},limitValue:{obj:a,top:-z}})}(R,u,T,X),function(i,l,r,a,u){let p,f;const{pointAttr:h={},lineAttr:g={},title:v="",key:m,type:x="circle"}=a,b=e.list[r+1],j=ue(b,s),w=se(c,e.list[r].value),E=j&&se(c,b.value);i&&j&&!l.breakpoint&&(!w&&!E||O)&&i[0]!==j[0]&&(f=n([...i,...j],{...g}));const I=l.pacemakerShow&&"pulse"==c?y.value:w&&"number"===Y?0:x,T=C[r-1],R={origin:{data:l,title:v,key:m||"",unit:s.unit,type:c,_type:d(v,c),dataIndex:t,index:r},leftLine:T,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==c?y.style:h,...k.event.hovered?k.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:k.event,...w?{selectable:!1,evented:!1,..."number"===Y?M:{}}:{}};if(T){const e=T.get("y2");p=o(I,{left:T.get("x2"),top:w?e-5:e,...R})}else i&&(R.leftLine=null,p=o(I,{left:i[0],top:w?i[1]-5:i[1],...R}));C.push(f),p&&(v.includes("脉搏")?ee.add(p):te.add(p),function(e){W.hovered&&(e.on("mouseover",(()=>{ae(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?B:q;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:n,type:i="",top:o=0,isFixed:l}=t||{};"reduce"!==i&&("line"===i?null==n||n.setCoords().set({x1:e.left,y1:e.top}):!l&&(null==n||n.setCoords().set({left:e.left,top:e.top+o})))})),oe(e)}(e),W.hovered&&ae(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{type:t}=e.origin,n=$(t,e.top),i={...e.origin,data:{...e.origin.data,value:n}};L.value.discardActiveObject(),S("change",i),pe(i,"change")}}))}(p),A.push(p),ne.add(p))}(R,u,b,T,X)})),"pulse"===c&&U.forEach((e=>{Z.set(e,A.filter((t=>{var n;return(null==(n=t.origin)?void 0:n.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(A).then((e=>{const t=C.filter((e=>e));let n=null;e=e.map((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),Promise.all(I).then((n=>{L.value.add(...t,...e,...n),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&L.value.remove(e.leftLine),e.rightLine&&L.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function ae(e,t="moving"){const{title:n,unit:i,type:o,data:l}=e.origin;P.point={x:e.left,y:e.top},P.list=[function(){const{drugReduce:r,physicsReduce:s}=l||{},a="hover"===t?l.value:$(o,e.top);if(p(r))return`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${i||""}`;if(p(s))return`物理降${"pain"==o?"痛":"温"} ${a}—>${s}${i||""}`;return`${n} ${a}${i||""}`}(),`时间 ${((null==l?void 0:l.time)||M(e.left)).slice(-5)}`],P.show=!0}function ue(e,t){const n="pain"===t.type?B:q;if(f(e)&&function(e){const[t]=X,n=X.at(-1),i=t.start,o=n.end,l=h(e);return l>=i&&l<=o}(e.time)){const i=Y(e.time),o=E(t.type,t.list,e.value);return[i,o<n.originY?n.originY:o>n.endY?n.endY:o]}}function ce(e){const t=new Date,n=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),o=h(`${t.getFullYear()}-${n}-${i} 23:59:59`),l=h(`${M(e)}:00`);return J&&l<h(J)?(I("exceedMin"),!1):!(l>o)||(I("exceedMax"),!1)}function pe(e,t="add"){const{type:n,dataIndex:i,index:o,data:l,key:r}=e,s=ie.find((e=>e.type===n));if("add"===t){const e=a(n)?s.dataList.find((e=>e.enable)):s.dataList[i],t=g(l.time,e.list);e.list.splice(t,0,l)}else s.dataList[i].list[o]=l;de()}function de(){var e;ne.size&&(null==(e=L.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...ne]))),Z.clear(),ne.clear(),ee.clear(),te.clear(),ie.forEach((e=>{e.dataList.forEach(((t,n)=>{a(e.type)&&!t.enable||re(t,n,e)}))})),oe(),le()}return Z.clear(),ee.clear(),te.clear(),ie.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=E(e.type,e.list,e.positionLine.value),i=n([D,t,V,t],e.positionLine);L.value.add(i)}(e),e.dataList.forEach(((t,n)=>{a(e.type)&&!t.enable||re(t,n,e)}))})),oe(),le(),k.event.evented&&L.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:n=0,y:i=0}=e.pointer||{};if(n>=D&&n<=V&&i>=_&&i<=G){A.point={x:n,y:i},A.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(A.list=[...x]),"pain"===o&&(A.list=[...b]),A.target=e.target;else{A.target=null,A.list=["新增节点"],H.forEach((t=>{if(!C([...ne],n,"_type").includes(t.bigType)){const n=["pain"].includes(t.bigType)?B:q;i>=n.originY&&i<=n.endY&&A.list.push({renderItem:O?O(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ce(n);t&&1!==A.list.length||(A.show=!1,1===A.list.length&&t&&I("repeat"))}}}})),{clickMenu:function({item:e,target:t}){if(t){const{data:n,type:i,dataIndex:o,index:l}=t.origin,r=v(n,[...x,...b]);r[`${e.type}`]=e.value,a(i)&&(r.key=t.origin.key);const s={...t.origin,data:r};S("change",s),pe(s,"change")}else{const t={data:{time:M(e.pointer.x),value:$(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};S("add",t),pe(t)}},setPopup:ae,isAddPoint:ce,updateData:pe,redrawPoints:de,gridPoints:ne}}function w(e){return"fixed"===e.position}export{L as useCenter};
|
|
1
|
+
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as n,defaultStyle as i,drawPoint as o,drawText as l,drawArrow as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as c,isValidValue as p,setOtherType as d,isEffectiveNode as f,getTime as h,getIndex as g,deleteProperty as v}from"../../utils/index.js";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as j}from"../../constants/index.js";function L(L,k,S,Y,E,M,$,O,P,A){s(L,k);const{getEqualXTypes:C,handleAddPrevent:I}=y(L,S,k),{createShadowLines:T}=t(),{left:R,xScaleList:X,xCellWidth:F,yCellHeight:z,originX:D,endX:V,originY:_,endY:G,itemList:H,event:W,vitalSignsOriginY:q,painOriginY:B,hospitalizationDate:J,config:K,canvasHeight:N}=k,Q=new Set,U=["xinmai","mai"],Z=new Map,ee=new Set,te=new Set,ne=new Set,ie=m(R.yScaleValue);function oe(t){var o;const l=ie.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(Q.size&&L.value.remove(...Q),Q.clear(),Z.size>1)){if(t){const{type:e,key:n}=t.origin||{};if("pulse"===e){const e=Z.get(n),i=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(i,1,[t.left,t.top])}}const o=function(){const e=[],t=[],n=[];for(const e of Z)t.push(e[1]),e[0]===U[0]&&e[1].forEach((e=>{(Z.get(U[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&n.push(e[0])}));const[i,o]=t;let l=[],r=[];return n.forEach((t=>{const n=i.findIndex((e=>e[0]===t)),s=o.findIndex((e=>e[0]===t)),a=i[n],u=o[s],c=i[n-1],p=i[n+1],d=o[s-1],f=o[s+1];if(c&&d){if(c[0]!==d[0]){const e=Math.max(c[0],d[0]);l.push([c,d].find((t=>t[0]===e)))}}else c?l.push(c):d&&r.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const g=Math.max(a[1],u[1]);r.push([a,u].find((e=>e[1]===g)));const v=()=>{const t=[...l,...r.reverse()],[n]=t,i=t.at(-1);n[0]===i[0]&&n[1]===i[1]&&t.splice(-1,1),e.push(t),l=[],r=[]};if(p&&f){if(p[0]!==f[0]){const e=Math.min(p[0],f[0]);l.push([p,f].find((t=>t[0]===e))),v()}}else p?(l.push(p),v()):f?(r.push(f),v()):v()})),e}(),{mode:r,style:s={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...i,...s,strokeWidth:1});if(["slash","line"].includes(r)){l.set({fill:"transparent",stroke:s.stroke||"#f00"});const e=[];if(["slash"].includes(r))e.push(...T(t,s._angle,s.space)),e.forEach((e=>{Object.assign(e,{...i,...s}),Q.add(e)}));else{const i=function(e){const t=e.reduce(((e,t)=>{const n=Math.trunc(t[0]);return e[n]=e[n]?e[n].concat(t):[t],e}),{}),n=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return n}(t);i.forEach((t=>{const i=n([...t.flat()],{...s,originX:"center"});e.push(i),Q.add(i)}))}L.value.add(...e)}Q.add(l),L.value.add(l)}))}}function le(){var e;const t=ie.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const n=Object.assign({},j,R.overlap||{}),l=[];ee.size&&[...ee].forEach((e=>{[...te].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key;if(e){const r={left:t.left,top:t.top,...i,hoverCursor:"default"};let s="koumai";"yemai"===e&&(s=e),"humai"===e&&(s="circle"),l.push(o(s,{...n[e]||{},...r}))}}}))})),setTimeout((()=>{L.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ne.add(e)}))}))}function re(e,t,s){var u;const{type:c,riseStyle:f={},noRiseStyle:h={},verifiedStyle:g={},reduceStyle:v={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:j=[]}=s,{type:Y,textStyle:M,showConnectLine:O=!1}=b,A=[],C=[],I=[];null==(u=e.list)||u.forEach(((u,b)=>{const T=a(c)?j.find((e=>e.key===u.key)):e,R=ue(u,s),X={};X.value=function(e,t,n){if(!(null==e?void 0:e.length)||!K.showValue)return;const{lineAttr:i={}}=n,o=e[1]<=q.originY+z?e[1]+z:e[1]-z,r=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:i.stroke||"#000"});return I.push(r),{obj:r,top:-z}}(R,u,T),function(e,t,s,a,u){var d,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(c))return;const{lineAttr:m={}}=s,{value:x}=a;let b,j,L,k,S,Y;if(t.noRise&&h.show){const t=w(h)?E(u.type,u.list,35):e[1];if(h.text)L=l([e[0],w(h)?t:t+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),I.push(L);else{const n=t+2*z;k=r([e[0],t,n],h.style||{}),I.push(k)}}t.rise&&f.show&&f.text&&(S=l([e[0],e[1]-(x?z:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style||{}}),I.push(S));t.verified&&(Y=l([e[0],e[1]-(x?z:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),I.push(Y));if(p(t.physicsReduce)||p(t.drugReduce)){const l=E(c,u.list,null!=(d=t.physicsReduce)?d:t.drugReduce);b=n([...e,e[0],l],{...m,...v.line,...i}),j=o((null==(y=null==v?void 0:v.point)?void 0:y.type)||"circle",{left:e[0],top:l,...v.point,...i,originY:l===N?"bottom":"center"}),b&&I.push(b),j&&I.push(j)}Object.assign(a,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:L,top:5,isFixed:w(h)},arrowGroup:{obj:k,top:2*z,isFixed:w(h)},riseText:{obj:S,top:(x?-z:0)-5},verifiedText:{obj:Y,top:(x?-z:0)-5},reducePoint:{obj:j,type:"reduce"}})}(R,u,T,X,s),function(e,t,n,i){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;let o,a;const{upArrowShow:u=!1,limitValueShow:p=!1}=n;if(u&&+t.value>180){let t=e[1]-2.5*z,n=[e[1]-z/2,t];t<q.originY&&(t=e[1]+2.5*z,n=[t,e[1]+z/2]),o=r([e[0],n[0],n[1]],m,"up"),I.push(o)}if(p){const n={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...s.list)){const t=o?e[1]+z/2+o.height:e[1]+z;a=l([e[0],t],n),I.push(a)}+t.value<Math.min(...s.list)&&(a=l([e[0],e[1]-z],n),I.push(a))}Object.assign(i,{upArrow:{obj:o},limitValue:{obj:a,top:-z}})}(R,u,T,X),function(i,l,r,a,u){let p,f;const{pointAttr:h={},lineAttr:g={},title:v="",key:m,type:x="circle"}=a,b=e.list[r+1],j=ue(b,s),w=se(c,e.list[r].value),E=j&&se(c,b.value);i&&j&&!l.breakpoint&&(!w&&!E||O)&&i[0]!==j[0]&&(f=n([...i,...j],{...g}));const I=l.pacemakerShow&&"pulse"==c?y.value:w&&"number"===Y?0:x,T=C[r-1],R={origin:{data:l,title:v,key:m||"",unit:s.unit,type:c,_type:d(v,c),dataIndex:t,index:r},leftLine:T,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==c?y.style:h,...k.event.hovered?k.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:k.event,...w?{selectable:!1,evented:!1,..."number"===Y?M:{}}:{}};if(T){const e=T.get("y2");p=o(I,{left:T.get("x2"),top:w?e-5:e,...R})}else i&&(R.leftLine=null,p=o(I,{left:i[0],top:w?i[1]-5:i[1],...R}));C.push(f),p&&(v.includes("脉搏")?ee.add(p):te.add(p),function(e){W.hovered&&(e.on("mouseover",(()=>{ae(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?B:q;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:n,type:i="",top:o=0,isFixed:l}=t||{};"reduce"!==i&&("line"===i?null==n||n.setCoords().set({x1:e.left,y1:e.top}):!l&&(null==n||n.setCoords().set({left:e.left,top:e.top+o})))})),oe(e)}(e),W.hovered&&ae(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{type:t}=e.origin,n=$(t,e.top),i={...e.origin,data:{...e.origin.data,value:n}};L.value.discardActiveObject(),S("change",i),pe(i,"change")}}))}(p),A.push(p),ne.add(p))}(R,u,b,T,X)})),"pulse"===c&&U.forEach((e=>{Z.set(e,A.filter((t=>{var n;return(null==(n=t.origin)?void 0:n.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(A).then((e=>{const t=C.filter((e=>e));let n=null;e=e.map((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),Promise.all(I).then((n=>{L.value.add(...t,...e,...n),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&L.value.remove(e.leftLine),e.rightLine&&L.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function ae(e,t="moving"){const{title:n,unit:i,type:o,data:l}=e.origin;P.point={x:e.left,y:e.top},P.list=[function(){const{drugReduce:r,physicsReduce:s}=l||{},a="hover"===t?l.value:$(o,e.top);if(p(r))return`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${i||""}`;if(p(s))return`物理降${"pain"==o?"痛":"温"} ${a}—>${s}${i||""}`;return`${n} ${a}${i||""}`}(),`时间 ${((null==l?void 0:l.time)||M(e.left)).slice(-5)}`],P.show=!0}function ue(e,t){const n="pain"===t.type?B:q;if(f(e)&&function(e){const[t]=X,n=X.at(-1),i=t.start,o=n.end,l=h(e);return l>=i&&l<=o}(e.time)){const i=Y(e.time),o=E(t.type,t.list,e.value);return[i,o<n.originY?n.originY:o>n.endY?n.endY:o]}}function ce(e){const t=new Date,n=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),o=h(`${t.getFullYear()}-${n}-${i} 23:59:59`),l=h(`${M(e)}:00`);return J&&l<h(J)?(I("exceedMin"),!1):!(l>o)||(I("exceedMax"),!1)}function pe(e,t="add"){const{type:n,dataIndex:i,index:o,data:l,key:r}=e,s=ie.find((e=>e.type===n));if("add"===t){const e=a(n)?s.dataList.find((e=>e.enable)):s.dataList[i],t=g(l.time,e.list);e.list.splice(t,0,l)}else s.dataList[i].list[o]=l;de()}function de(){var e;ne.size&&(null==(e=L.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...ne]))),Z.clear(),ne.clear(),ee.clear(),te.clear(),ie.forEach((e=>{e.dataList.forEach(((t,n)=>{a(e.type)&&!t.enable||re(t,n,e)}))})),oe(),le()}return Z.clear(),ee.clear(),te.clear(),ie.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=E(e.type,e.list,e.positionLine.value),i=n([D,t,V,t],e.positionLine);L.value.add(i)}(e),e.dataList.forEach(((t,n)=>{a(e.type)&&!t.enable||re(t,n,e)}))})),oe(),le(),k.event.evented&&L.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:n=0,y:i=0}=e.pointer||{};if(n>=D&&n<=V&&i>=_&&i<=G){A.point={x:n,y:i},A.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(A.list=[...x]),"pain"===o&&(A.list=[...b]),A.target=e.target;else{A.target=null,A.list=["新增节点"],H.forEach((t=>{if(!C([...ne],n,"_type").includes(t.bigType)){const n=["pain"].includes(t.bigType)?B:q;i>=n.originY&&i<=n.endY&&A.list.push({renderItem:O?O(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ce(n);t&&1!==A.list.length||(A.show=!1,1===A.list.length&&t&&I("repeat"))}}}})),{clickMenu:function({item:e,target:t}){if(t){const{data:n,type:i,dataIndex:o,index:l}=t.origin,r=v(n,[...x,...b]);r[`${e.type}`]=e.value,a(i)&&(r.key=t.origin.key);const s={...t.origin,data:r};S("change",s),pe(s,"change")}else{const t={data:{time:M(e.pointer.x),value:$(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};S("add",t),pe(t)}},setPopup:ae,isAddPoint:ce,updateData:pe,redrawPoints:de,gridPoints:ne}}function w(e){return"fixed"===e.position}export{L as useCenter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as s,isOneLine as r}from"../../utils/index.js";import
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as s,isOneLine as r}from"../../utils/index.js";import{getScaleInfo as a,drawScaleNumber as h,drawScaleLine as u}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"lodash-es";import"./useShadow.js";function g(g,p,d,f,y,m,v,w,S,Y,b,x){var j,X;const{getEqualXTypes:C,handleAddPrevent:N,isGridLimit:T}=c(g,d,p),{originY:V,endY:k,originX:L,endX:M,xCellWidth:W,yCellHeight:E,left:G,vitalSignsOriginY:O,painOriginY:A,painHeight:H,iconsWidth:I,itemList:R,painIndex:_,right:B,canvasWidth:J,canvasHeight:$,getRightInfo:q,borderStyle:D}=p;function P(o){var s;if(!(null==o?void 0:o.length))return;const{layout:r}=o[0];let c=I,p=L;"right"===r&&(c=M,p=M+(null!=(s=null==B?void 0:B.width)?s:0));const d=[],f=H&&"right"!==r?o.length-1:o.length,y=(p-c)/f,m=y+(p-c)%f;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:p,style:d,title:f}=n,y=l({width:L-I,height:H,...D},{value:`${f}`,...i,...d||{}},{left:I,top:A.originY}),m=e([I,A.originY,L,A.originY],D),v=[];if(r||u){const{lineXMain:e,textLeft:i}=a(c,I,L-I),l=o.length;o.forEach(((o,a)=>{let c=A.endY-a*E*s;if(0===a&&(c=k-5),!u||(0===a||a===l-1)&&!p||v.push(h(o,n,i,c)),r&&0!==a){const[i,n]=e,o=new t.Line([i,c,n,c],{...D,...d});v.push(o)}}))}g.value.add(m,y,...v),y.sendToBack()}(o);const p=[],f=0===s?m:y,v=0===s?c:m+c+(s-1)*y,w="right"===r?0:O.originY,S="right"===r?$:O.endY,Y=s>0?e([v,w,v,S],{objectCaching:!1,...D}):null;Y&&p.push(Y);const b=v+f/2,{list:x=[],spaceGridNumber:j=5,showScale:X,showNumber:C,position:N,showMaxMinNumber:T}=o;if(X||C){const{lineXMain:t,lineXSub:e,textLeft:i}=a(N,v,f),n=x.length;x.forEach(((l,s)=>{const r=O.endY-s*E*j;if(C&&(!(0===s||s===n-1)||T)){const t=0==s?r-5:r,e=h(l,o,i,t),n=O.originY+e.height/2;t<n&&e.set({top:n}),p.push(e)}p.push(...u(o,s,t,e,r,E,O.originY))}))}let V=o.title||"";o.unit&&(V+="\n"+o.unit),V&&p.push(new t.Text(String(V),{...i,left:b,top:O.originY+E*j/2,textAlign:"center",...o.style}));const M=new t.Group(p,{...n,objectCaching:!1});d.push(M)}));const v=d.length>0?new t.Group([...d],{...n,objectCaching:!1}):null;v&&g.value.add(v),v&&v.sendToBack()}I&&function(){const t=JSON.parse(JSON.stringify(R));let e=k;const i=I-G.icons.marginRight;t.reverse().forEach((t=>{e-=10;let n=t.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:a}=o(n,t,{text:{left:i-(t.pointAttr.width||10)-5,top:e,originX:"right"},icon:{originX:"right",left:i,topY:e,origin:{type:s(t.bigType),_type:t.bigType},...p.event}});var h;e-=l.height||30,(h=a).on("moving",(()=>{h.set("originX","center"),function(t){if(t.left>=L&&t.left<=M){t.setCoords();const e="pain"===t.origin.type?A:O;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(h),T(h)?f(h):y.show=!1})),h.on("mouseup:before",(t=>{if(y.show=!1,0===t.e.button&&T(h)){const t=C([...x],h.left,"_type").includes(h.origin._type),e=Y(h.left);if(!e||t)t&&e&&N("repeat");else{const t={data:{time:w(h.left),value:S(h.origin.type,h.top),...r(h.origin.type)?{key:h.origin.key}:{}},...h.origin};d("add",t),b(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(h)})),g.value.add(l,a)}))}();const z=G.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==B?void 0:B.width)&&"left"===(null==(j=null==B?void 0:B.yScaleValue)?void 0:j.layout)&&(null==(X=null==B?void 0:B.yScaleValue)?void 0:X.show)&&z.push(q),_>0&&G.yScaleValue[_].show){const t=G.yScaleValue[_];0===_&&G.yScaleValue.length>1&&z.unshift(t),_==G.yScaleValue.length-1&&z.push(t)}const F=z.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),K=z[F];return F>-1&&z.splice(F,0,{...K,title:(null==K?void 0:K.doubleTitle)||(null==K?void 0:K.title)}),P(z),g.value.add(new t.Rect({left:I,top:0,width:J-I-D.strokeWidth,height:$-D.strokeWidth,fill:"transparent",...D})),{drawScaleValue:P}}export{g as useLeft};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as e}from"../useDraw.js";import"date-fns";import"lodash-es";import"
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as e}from"../useDraw.js";import"date-fns";import"lodash-es";import"vue";import"./useShadow.js";function i(i,n,o){const{other:l,vitalSignsOriginY:r,xCellWidth:s,yCellHeight:a,endX:c}=n;let h=0;function u(i,n,o){const l=[];String(i.value).split("").forEach(((n,o)=>{const r=new t.Text(n,{left:0,top:a*o,originX:"center",...e,objectCaching:!1,...i.style||{}});h=(a-(r.height||0))/2,l.push(r)}));const r={originX:"center",left:n,top:o+h,baseTop:(i.baseTop||0)*a,trueLeft:n,trueHeight:l.length*a,objectCaching:!1};return new t.Group(l,r)}!function(){if(!(null==l?void 0:l.list))return!1;const n=[],h=[];l.list.forEach(((t,e)=>{const i=0===e?"vertical":t.align||"vertical",n=o(t.time,!0);if(n>c)return;const l=h.find((t=>t.left==n));if(l)l[i].push(t);else{const e={left:n,vertical:[],horizontal:[]};e[i].push(t),h.push(e)}})),h.forEach((t=>{let e=r.originY,i=t.left;t.vertical.forEach(((o,l)=>{var c,h;const f=(o.baseTop||0)*a,g=(null==(c=n.at(-1))?void 0:c.left)||0;0===l&&t.left<=g&&(i=g+s);if(n.filter((t=>t.trueLeft===i)).length){const t=String(o.value).length*a,l=(null==(h=n.at(-1))?void 0:h.trueHeight)||0;e+=l,e+t+f>r.endY&&(e=r.originY,i+=s)}e+=f,String(o.value).length&&n.push(u(o,i,e))})),t.horizontal.forEach(((e,o)=>{var l;const c=r.originY+(e.baseTop||0)*a,h=(null==(l=n.at(-1))?void 0:l.left)||0;t.left<=h&&(i=h+s),String(e.value).length&&n.push(u(e,i,c))}))}));const f=n.length>0?new t.Group([...n],{...e,objectCaching:!1}):null;f&&i.value.add(f)}()}export{i as useOther};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ref as e,computed as t,reactive as a,onMounted as l,nextTick as u}from"vue";import{defaultBorderStyle as i}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as r}from"../useCumputedPoint.js";import{
|
|
1
|
+
import{ref as e,computed as t,reactive as a,onMounted as l,nextTick as u}from"vue";import{defaultBorderStyle as i}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as r}from"../useCumputedPoint.js";import{useCanvasEvent as n}from"../useEvent.js";import{setOtherType as o,getFloorNumber as s}from"../../utils/index.js";import"lodash-es";import{format as d,addDays as v}from"date-fns";import{useTop as c}from"./useTop.js";import{useLeft as h}from"./useLeft.js";import{useRight as p}from"./useRight.js";import{useCenter as g}from"./useCenter.js";import{useBottom as m}from"./useBottom.js";import{useOther as f}from"./useOther.js";function y(y,Y,S,b,w,C){const x=15,D=e(),j=e(),V=e(),X=t((()=>{const{top:e}=Y.data;return e.date.show&&(e.date.height||x)||0})),H=t((()=>{var e;const{top:t}=Y.data;return(null==(e=t.hospitalDays)?void 0:e.show)&&(t.hospitalDays.height||x)||0})),L=t((()=>{var e;const{top:t}=Y.data;return(null==(e=t.operationDays)?void 0:e.show)&&(t.operationDays.height||x)||0})),I=t((()=>{var e,t,a;const{top:l}=Y.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||x)||0)+((null==(t=l.xScalevalue)?void 0:t.show)&&null!=(a=l.dayHeight)?a:0)})),M=t((()=>{var e;const{bottom:t}=Y.data;return(null==(e=null==t?void 0:t.breathing)?void 0:e.show)&&(t.breathing.height||30)||0})),P=t((()=>{const{grid:e}=Y.data;return e.mainXCell*e.subXCell+e.surplusXCell})),N=t((()=>{const{grid:e}=Y.data;return e.mainYCell*e.subYCell+e.surplusYCell})),O=t((()=>{var e;const{width:t,right:a=null,top:l}=Y.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),W=t((()=>{const{grid:e}=Y.data;return O.value-e.surplusXCell*q.value})),$=t((()=>{const{top:e,left:t}=Y.data;return e.titleWidth+T.value})),k=t((()=>{const{bottom:e=null,height:t}=Y.data;if(!e)return t;return t-(e.height||30)})),G=t((()=>{var e;const{top:t}=Y.data,a=t.xScalevalue.show&&(null!=(e=t.dayHeight)?e:0)||0,l=t.xScalevalue.show&&(t.xScalevalue.height||x)||0;return X.value+a+l+H.value+L.value})),R=t((()=>{const{grid:e}=Y.data;return G.value+e.surplusYCell*z.value})),q=t((()=>(O.value-$.value)/P.value)),z=t((()=>(k.value-G.value)/N.value)),T=t((()=>{var e,t;const{left:a}=Y.data;return(null==(e=a.icons)?void 0:e.show)&&((null==(t=a.icons)?void 0:t.width)||100)||0})),A=t((()=>{var e,t;const{top:a,grid:l}=Y.data,u=(null==(t=null==(e=a.date.list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],i=a.xScalevalue.times;let r=$.value-q.value;const n=a.date.startDate||d(new Date,"yyyy-MM-dd");return u.reduce(((e,t,a)=>0===a?e.concat(n):e.concat(d(v(new Date(n.replace(/-/g,"/")),a),"yyyy-MM-dd"))),[]).map((e=>i.map((t=>{r+=q.value;const a=Date.parse(`${e} ${t.start}`),l=Date.parse(`${e} ${t.end}`);return{start:a,end:l,left:r,center:r+q.value/2,scaleCell:(l-a)/q.value}})))).flat()})),B=t((()=>ue("breathe"))),E=t((()=>ue("pulse"))),F=t((()=>ue("temperature"))),J=t((()=>ue("pain"))),K=t((()=>{var e;return(null==(e=Y.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),Q=t((()=>{const{left:e}=Y.data;return e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:o(t.title,e.type),unit:e.unit,dataIndex:a}))))).flat()})),U=t((()=>{const{left:e}=Y.data;return e.yScaleValue.findIndex((e=>"pain"===e.type))})),Z=t((()=>{const{grid:e}=Y.data;return-1===U.value?0:z.value*e.subYCell})),_=t((()=>{const{left:e}=Y.data,t={originY:k.value,endY:k.value};return 0===U.value&&e.yScaleValue.length>1?(t.originY=R.value,t.endY=R.value+Z.value):U.value===e.yScaleValue.length-1&&(t.originY=k.value-Z.value,t.endY=k.value),t})),ee=t((()=>{const{left:e}=Y.data,t={originY:G.value,endY:k.value};return 0===U.value&&e.yScaleValue.length>1?(t.originY=R.value+Z.value,t.endY=k.value):U.value===e.yScaleValue.length-1&&(t.originY=R.value,t.endY=k.value-Z.value),t})),te=t((()=>{var e,t;const{top:a,grid:l}=Y.data,u=[];for(const i in a)a[i].show&&u.push({...a[i],list:(null==(t=null==(e=a[i].list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,t)=>e.seq-t.seq))})),ae=t((()=>{var e;const{left:t,right:a}=Y.data,l=t.yScaleValue.find((e=>"temperature"===e.type)),u=(null==a?void 0:a.yScaleValue)||{};return(null==(e=null==l?void 0:l.list)?void 0:e.length)&&Object.assign(u,{list:l.list.map((e=>s(1.8*e+32))),spaceGridNumber:l.spaceGridNumber}),u})),le=a({canvasWidth:Y.data.width,canvasHeight:Y.data.height,borderStyle:{...i,...Y.data.borderStyle||{}},selectionStyle:Y.data.selectionStyle||{},dateHeight:X.value,hospitalDaysHeight:H.value,operationDaysHeight:L.value,xScalevalueHeight:I.value,topList:te.value,breathingHeight:M.value,hospitalizationDate:Y.data.hospitalizationDate,grid:Y.data.grid,top:Y.data.top,left:Y.data.left,right:Y.data.right,bottom:Y.data.bottom,other:Y.data.other,painIndex:U.value,painHeight:Z.value,painOriginY:_.value,vitalSignsOriginY:ee.value,gridXNumber:P.value,gridYNumber:N.value,iconsWidth:T.value,originX:$.value,originY:G.value,originYLimit:R.value,endX:O.value,endXLimit:W.value,endY:k.value,xCellWidth:q.value,yCellHeight:z.value,xScaleList:A.value,breatheYCell:B.value,pulseYCell:E.value,temperatureYCell:F.value,painYCell:J.value,event:K.value,itemList:Q.value,getRightInfo:ae.value,config:Y.data.config||{}});function ue(e){const{yScaleValue:t}=Y.data.left,a=t.find((t=>t.type===e)),l=(null==a?void 0:a.list)||[];return l.length?z.value/((l[1]-l[0])/a.spaceGridNumber):0}const{cumputedX:ie,cumputedY:re,getXValue:ne,getYValue:oe}=r(le);return l((()=>{u((()=>{c(y,le);const{setPopup:e,isAddPoint:t,updateData:a,redrawPoints:l,clickMenu:u,gridPoints:i}=g(y,le,S,ie,re,ne,oe,Y.addRenderItem,w,C);j.value=l,V.value=u;const{drawScaleValue:r}=h(y,le,S,e,w,ie,re,ne,oe,t,a,i);p(y,le,r),m(y,le),f(y,le,ie);const{select:o}=n(y,le,S);D.value=o}))})),{propItems:le,redrawPoints:j,select:D,clickMenu:V}}export{y as useTemperatureChart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultStyle as l,drawTextGroup as s,defaultTextStyle as i}from"../useDraw.js";import"date-fns";import"lodash-es";import"
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultStyle as l,drawTextGroup as s,defaultTextStyle as i}from"../useDraw.js";import"date-fns";import"lodash-es";import"vue";import"./useShadow.js";function o(o,u){const{grid:h,originX:n,endX:a,xCellWidth:c,gridXNumber:r,top:p,xScalevalueHeight:d,iconsWidth:f,topList:g,endXLimit:v,canvasWidth:y,borderStyle:m}=u;!function(){const S=[];v&&S.push(new t.Line([v,0,y,0],m));let w=0;g.forEach(((t,l)=>{if(l>0&&(w+=u[`${g[l-1].key}Height`]),"xScalevalue"==t.key)!function(t,l,o){const u=p.dayHeight;if(!u)return;l.push(e([n,o+u,a,o+u],m));const d=c*h.subSecondXCell,f=(r-h.surplusXCell)/h.subSecondXCell;for(let h=0;h<f;h++){const a=n+h*d,c=h%2==0?"上午":"下午",r=s({width:d,height:u,...m},{value:c,...i,...t.style||{}},{left:a,top:o});l.push(r),l.push(e([a+d,o,a+d,o+u],m))}}(t,S,w),function(t,l,o){var u;const r=p.xScalevalue.show&&null!=(u=p.dayHeight)?u:0,g=d-r;if(!g)return;l.push(e([f,o+d,a,o+d],m));const v=s({width:n-f,height:d,...m},{value:p.xScalevalue.title,...i,...t.style||{},...t.titleStyle||{}},{left:f,top:o});l.push(v),l.push(e([n,o,n,o+d],m));const y=[];for(let t=0;t<h.mainXCell;t++)y.push(p.xScalevalue.list);y.flat().forEach(((u,h)=>{const a=n+h*c,p=s({width:c,height:g,...m},{value:u.value,...i,...t.style||{},...u.style||{}},{left:a,top:o+r});l.push(p),l.push(e([a+c,o+r,a+c,o+r+g],m))}))}(t,S,w);else{if(!u[`${t.key}Height`])return;const o=u[`${g[l].key}Height`];!function(t,l,o){const a=u[`${t.key}Height`],r=s({width:n-f,height:a,...m},{value:t.title,...i,...(null==t?void 0:t.style)||{},...t.titleStyle||{}},{left:f,top:o});l.push(r);const p=c*h.subXCell;t.list.forEach(((u,h)=>{const c=n+h*p,r=s({width:p,height:a,...m},{value:u,...i,...(null==t?void 0:t.style)||{}},{left:c,top:o});l.push(e([c+p,o,c+p,o+a],m)),l.push(r)}))}(t,S,w),S.push(e([f,w+o,a,w+o],m)),S.push(e([n,w,n,w+o],m))}}));const X=S.length>0?new t.Group([...S],{...l,objectCaching:!1}):null;X&&X.sendToBack(),X&&o.value.add(X)}()}export{o as useTop};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { fabric } from '../../../../../es/shared/utils/fabricjs';
|
|
3
3
|
import { IPropItems } from '../interface';
|
|
4
|
-
export declare function useEvent(element: HTMLCanvasElement | null): void;
|
|
5
4
|
export declare function useCanvasEvent(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: any): {
|
|
6
5
|
select: (key: string) => void;
|
|
7
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{fabric as t}from"../../../../shared/utils/fabricjs/index.js";function e(e,n,o){const{originY:l,originX:i,endX:s,endY:d,iconsWidth:r,selectionStyle:h,topList:u}=n;function c(n,o){const{left:l,top:i,width:s,height:d}=n,r=new t.Rect({key:o,left:null!=l?l:0,top:null!=i?i:0,width:s,height:d,stroke:"transparent",fill:"transparent",lockMovementX:!0,lockMovementY:!0,transparentCorners:!1,hasControls:!1,...h,strokeWidth:0});return e.value.add(r),r}let f=[];function a(t){k();p(null==f?void 0:f.find((e=>e.key===t)))}function k(){f.forEach((t=>{t.set("strokeWidth",0),t.key.endsWith("All")&&t.sendToBack()}))}function p(t){var n;e.value.discardActiveObject(),!(null==t?void 0:t.key.includes("grid"))&&(null==t||t.bringToFront()),null==t||t.set("strokeWidth",null!=(n=h.strokeWidth)?n:2)}return("boolean"!=typeof(null==h?void 0:h.evented)||(null==h?void 0:h.evented))&&(f=function(){const t=[];t.push(c({left:r,top:l+1,width:i-r,height:d-l-3},"left"));let e=0;return u.forEach(((o,l)=>{l>0&&(e+=n[`${u[l-1].key}Height`]);const d={top:e+1,height:n[`${o.key}Height`]-1};t.push(c({left:r,width:s-r,...d},o.key+"All")),t.push(c({left:r,width:i-r,...d},o.key+"Title")),t.push(c({left:i,width:s-i,...d},o.key))})),t.push(c({left:i,top:l+1,width:s-i,height:d-l-3},"grid")),t.forEach((t=>{t.key.endsWith("All")?(t.sendToBack(),t.on("mouseup",(e=>{const{button:n,pointer:l}=e;if(1==n){const e=t.key.replace("All",""),n=(null==l?void 0:l.x)&&(null==l?void 0:l.x)<=i?e+"Title":e;t.sendToBack(),a(n),o("select",n)}}))):t.on("mousedown",(()=>{k(),p(t),o("select",t.key)}))})),t}()),{select:a}}export{e as useCanvasEvent};
|
|
@@ -202,6 +202,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
202
202
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
203
203
|
prefix?: string | import("../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
204
204
|
suffix?: string | import("../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
205
|
+
allowSlash?: boolean | undefined;
|
|
205
206
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
206
207
|
content?: string | import("..").FormRenderer | Record<string, import("..").FormRenderer> | undefined;
|
|
207
208
|
lazyRequest?: boolean | undefined;
|
|
@@ -1929,6 +1930,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
1929
1930
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
1930
1931
|
prefix?: string | import("../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
1931
1932
|
suffix?: string | import("../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
1933
|
+
allowSlash?: boolean | undefined;
|
|
1932
1934
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
1933
1935
|
content?: string | import("..").FormRenderer | Record<string, import("..").FormRenderer> | undefined;
|
|
1934
1936
|
lazyRequest?: boolean | undefined;
|
|
@@ -3665,6 +3667,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
3665
3667
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
3666
3668
|
prefix?: string | import("../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
3667
3669
|
suffix?: string | import("../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
3670
|
+
allowSlash?: boolean | undefined;
|
|
3668
3671
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
3669
3672
|
content?: string | import("..").FormRenderer | Record<string, import("..").FormRenderer> | undefined;
|
|
3670
3673
|
lazyRequest?: boolean | undefined;
|
|
@@ -5392,6 +5395,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
5392
5395
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
5393
5396
|
prefix?: string | import("../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
5394
5397
|
suffix?: string | import("../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
5398
|
+
allowSlash?: boolean | undefined;
|
|
5395
5399
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
5396
5400
|
content?: string | import("..").FormRenderer | Record<string, import("..").FormRenderer> | undefined;
|
|
5397
5401
|
lazyRequest?: boolean | undefined;
|
|
@@ -8095,6 +8099,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
8095
8099
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
8096
8100
|
prefix?: string | import("../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
8097
8101
|
suffix?: string | import("../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
8102
|
+
allowSlash?: boolean | undefined;
|
|
8098
8103
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
8099
8104
|
content?: string | import("..").FormRenderer | Record<string, import("..").FormRenderer> | undefined;
|
|
8100
8105
|
lazyRequest?: boolean | undefined;
|
|
@@ -9833,6 +9838,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
9833
9838
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
9834
9839
|
prefix?: string | import("../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
9835
9840
|
suffix?: string | import("../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
9841
|
+
allowSlash?: boolean | undefined;
|
|
9836
9842
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
9837
9843
|
content?: string | import("..").FormRenderer | Record<string, import("..").FormRenderer> | undefined;
|
|
9838
9844
|
lazyRequest?: boolean | undefined;
|
|
@@ -11544,6 +11550,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
11544
11550
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
11545
11551
|
prefix?: string | import("../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
11546
11552
|
suffix?: string | import("../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
11553
|
+
allowSlash?: boolean | undefined;
|
|
11547
11554
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
11548
11555
|
content?: string | import("..").FormRenderer | Record<string, import("..").FormRenderer> | undefined;
|
|
11549
11556
|
lazyRequest?: boolean | undefined;
|
|
@@ -204,6 +204,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
204
204
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
205
205
|
prefix?: string | import("../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
206
206
|
suffix?: string | import("../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
207
|
+
allowSlash?: boolean | undefined;
|
|
207
208
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
208
209
|
content?: string | import("../../../../es/components/form-render").FormRenderer | Record<string, import("../../../../es/components/form-render").FormRenderer> | undefined;
|
|
209
210
|
lazyRequest?: boolean | undefined;
|
|
@@ -1931,6 +1932,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1931
1932
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
1932
1933
|
prefix?: string | import("../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
1933
1934
|
suffix?: string | import("../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
1935
|
+
allowSlash?: boolean | undefined;
|
|
1934
1936
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
1935
1937
|
content?: string | import("../../../../es/components/form-render").FormRenderer | Record<string, import("../../../../es/components/form-render").FormRenderer> | undefined;
|
|
1936
1938
|
lazyRequest?: boolean | undefined;
|
|
@@ -3667,6 +3669,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3667
3669
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
3668
3670
|
prefix?: string | import("../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
3669
3671
|
suffix?: string | import("../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
3672
|
+
allowSlash?: boolean | undefined;
|
|
3670
3673
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
3671
3674
|
content?: string | import("../../../../es/components/form-render").FormRenderer | Record<string, import("../../../../es/components/form-render").FormRenderer> | undefined;
|
|
3672
3675
|
lazyRequest?: boolean | undefined;
|
|
@@ -5394,6 +5397,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
5394
5397
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
5395
5398
|
prefix?: string | import("../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
5396
5399
|
suffix?: string | import("../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
5400
|
+
allowSlash?: boolean | undefined;
|
|
5397
5401
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
5398
5402
|
content?: string | import("../../../../es/components/form-render").FormRenderer | Record<string, import("../../../../es/components/form-render").FormRenderer> | undefined;
|
|
5399
5403
|
lazyRequest?: boolean | undefined;
|
|
@@ -8097,6 +8101,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
8097
8101
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
8098
8102
|
prefix?: string | import("../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
8099
8103
|
suffix?: string | import("../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
8104
|
+
allowSlash?: boolean | undefined;
|
|
8100
8105
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
8101
8106
|
content?: string | import("../../../../es/components/form-render").FormRenderer | Record<string, import("../../../../es/components/form-render").FormRenderer> | undefined;
|
|
8102
8107
|
lazyRequest?: boolean | undefined;
|
|
@@ -9835,6 +9840,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
9835
9840
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
9836
9841
|
prefix?: string | import("../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
9837
9842
|
suffix?: string | import("../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
9843
|
+
allowSlash?: boolean | undefined;
|
|
9838
9844
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
9839
9845
|
content?: string | import("../../../../es/components/form-render").FormRenderer | Record<string, import("../../../../es/components/form-render").FormRenderer> | undefined;
|
|
9840
9846
|
lazyRequest?: boolean | undefined;
|
|
@@ -11546,6 +11552,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
11546
11552
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
11547
11553
|
prefix?: string | import("../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
11548
11554
|
suffix?: string | import("../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
11555
|
+
allowSlash?: boolean | undefined;
|
|
11549
11556
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
11550
11557
|
content?: string | import("../../../../es/components/form-render").FormRenderer | Record<string, import("../../../../es/components/form-render").FormRenderer> | undefined;
|
|
11551
11558
|
lazyRequest?: boolean | undefined;
|
|
@@ -157,6 +157,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
157
157
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
158
158
|
prefix?: string | import("../../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
159
159
|
suffix?: string | import("../../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
160
|
+
allowSlash?: boolean | undefined;
|
|
160
161
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
161
162
|
content?: string | import("../../../../../es/components/form-render").FormRenderer | Record<string, import("../../../../../es/components/form-render").FormRenderer> | undefined;
|
|
162
163
|
lazyRequest?: boolean | undefined;
|
|
@@ -1895,6 +1896,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1895
1896
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
1896
1897
|
prefix?: string | import("../../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
1897
1898
|
suffix?: string | import("../../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
1899
|
+
allowSlash?: boolean | undefined;
|
|
1898
1900
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
1899
1901
|
content?: string | import("../../../../../es/components/form-render").FormRenderer | Record<string, import("../../../../../es/components/form-render").FormRenderer> | undefined;
|
|
1900
1902
|
lazyRequest?: boolean | undefined;
|
|
@@ -3606,6 +3608,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3606
3608
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
3607
3609
|
prefix?: string | import("../../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
3608
3610
|
suffix?: string | import("../../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
3611
|
+
allowSlash?: boolean | undefined;
|
|
3609
3612
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
3610
3613
|
content?: string | import("../../../../../es/components/form-render").FormRenderer | Record<string, import("../../../../../es/components/form-render").FormRenderer> | undefined;
|
|
3611
3614
|
lazyRequest?: boolean | undefined;
|
|
@@ -29,3 +29,38 @@ export declare const INPUT_NUMBER: import("vue").DefineComponent<{
|
|
|
29
29
|
type: (ObjectConstructor | StringConstructor | FunctionConstructor)[];
|
|
30
30
|
};
|
|
31
31
|
}>>, {}>;
|
|
32
|
+
export declare const INPUT_NUMBER_SLASH: import("vue").DefineComponent<{
|
|
33
|
+
value: {
|
|
34
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
35
|
+
};
|
|
36
|
+
onChange: {
|
|
37
|
+
type: PropType<Func<any[], any>>;
|
|
38
|
+
required: true;
|
|
39
|
+
};
|
|
40
|
+
prefix: {
|
|
41
|
+
type: (ObjectConstructor | StringConstructor | FunctionConstructor)[];
|
|
42
|
+
};
|
|
43
|
+
suffix: {
|
|
44
|
+
type: (ObjectConstructor | StringConstructor | FunctionConstructor)[];
|
|
45
|
+
};
|
|
46
|
+
precision: {
|
|
47
|
+
type: NumberConstructor;
|
|
48
|
+
};
|
|
49
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
50
|
+
value: {
|
|
51
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
52
|
+
};
|
|
53
|
+
onChange: {
|
|
54
|
+
type: PropType<Func<any[], any>>;
|
|
55
|
+
required: true;
|
|
56
|
+
};
|
|
57
|
+
prefix: {
|
|
58
|
+
type: (ObjectConstructor | StringConstructor | FunctionConstructor)[];
|
|
59
|
+
};
|
|
60
|
+
suffix: {
|
|
61
|
+
type: (ObjectConstructor | StringConstructor | FunctionConstructor)[];
|
|
62
|
+
};
|
|
63
|
+
precision: {
|
|
64
|
+
type: NumberConstructor;
|
|
65
|
+
};
|
|
66
|
+
}>>, {}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,watch as
|
|
1
|
+
import{defineComponent as e,watch as n,computed as t,createVNode as u,ref as l}from"vue";import{connect as i,mapProps as a}from"@formily/vue";import{isString as o,isNumber as r}from"lodash-es";import{NInputNumber as s,NInput as v}from"naive-ui";import{useCommonInjection as p}from"../../hooks/useCommonInjection.js";import{createInputSlot as c,parseNumberFromMaybeString as m}from"../../utils/index.js";import{assignUpdateValue as f,assignClearBindVisited as g}from"../../utils/schema.js";const d=i(e({props:{value:{type:[Number,String]},onChange:{type:Function,required:!0},prefix:{type:[String,Function,Object]},suffix:{type:[String,Function,Object]}},setup(e){const l=c(e);p().injectValueValidate((()=>e.value)),n((()=>e.value),(n=>{if(null!=n)return!o(n)&&!r(n)||Number.isNaN(+n)?e.onChange(null):void e.onChange(+n)}));const i=t({get:()=>m(e.value),set:n=>{var t;return null==(t=e.onChange)?void 0:t.call(e,n)}}),a=p().injectValueBindKey(i);return()=>u(s,{key:a.value,value:i.value,"onUpdate:value":e=>i.value=e,"show-button":!1},l.value)}}),a(f,g)),h=i(e({props:{value:{type:[Number,String]},onChange:{type:Function,required:!0},prefix:{type:[String,Function,Object]},suffix:{type:[String,Function,Object]},precision:{type:Number}},setup(e){const i=l(),a=t({get:()=>i.value,set(e){if(r(e))return i.value=e+"";o(e)&&(i.value=e.endsWith("/")?"/":e)}});function s(e=-1){const n=r(+e)&&e>=0?+e:null;return new RegExp(`^-?(0|[1-9][0-9]*)?${0===n?"":`(\\.[0-9]${r(n)?`{0,${n}}`:"*"})?`}$`)}n((()=>e.value),(e=>a.value=e),{immediate:!0});const c=s(),m=t((()=>s(e.precision)));function f(e){return!(null!=e&&""!==e&&"/"!==e&&o(e)&&!e.endsWith("/"))||m.value.test(e)&&"-."!==e&&!e.startsWith(".")}function g(){if(o(a.value)&&"-"!==a.value)if("/"===a.value)e.onChange(a.value);else if(c.test(a.value)){const n=a.value.endsWith(".")?a.value.slice(0,-1):a.value;e.onChange(a.value=n)}else a.value=e.value;else a.value=e.value}const d=p().injectValueBindKey(a);return()=>u(v,{value:a.value,"onUpdate:value":e=>a.value=e,key:d.value,"allow-input":f,onBlur:g},null)}}),a(f,g));export{d as INPUT_NUMBER,h as INPUT_NUMBER_SLASH};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,pick as n}from"lodash-es";import"../../index.js";import{parseNumberFromMaybeString as r,formRenderLog as i}from"../utils/index.js";import{useFieldNormalize as s}from"./useFieldNormalize.js";import{fieldKeyEscape as a,createLinebarId as p}from"../utils/schema.js";import{useFormValidator as l}from"./useFormValidator.js";import{transformDateFormat as c}from"../utils/business.js";function m(e,o){Object.assign(e["x-component-props"],{...n(o,["wordbook","autograph"])})}function d(e,o){Object.assign(e["x-component-props"],{...n(o,["urlConfig","wordbook"])})}function u(u){const{createValidatorSchema:f}=l(),x=e=>{var o;const t={name:e.val_key,type:null!=(o=e.fieldType)?o:"string",title:e.alias||e.name,"x-component":e.html_type,default:e.default_val,"x-component-props":{placeholder:e.placeholder,clearable:"0"===e.is_empty,...e.componentProps||{}},"x-content":e.slots,"x-display":"0"===e.is_show?"hidden":"visible","x-pattern":"0"===e.is_edit?"disabled":"editable","x-compile-omitted":["title","x-component-props","x-decorator-props"]};e.reactions&&(t["x-reactions"]=e.reactions),e.noDecorator||Object.assign(t,{"x-decorator":"FORM_ITEM","x-decorator-props":{fieldItem:e,span:2*(e.elem_width||3),showLabel:"1"!==e.hide_title,remark:e.remark,propertyKey:e.val_key,annotation:e.annotation,...e.decoratorProps||{}}});const n=f(e);return n&&(t["x-validator"]=n),"0"===e.is_null&&(t.required=!0),t},_=e=>{var o;const t=x(e);e.urlConfig?d(t,e):e.autograph&&m(t,e);const i=!!e.__multiple;return Object.assign(t["x-component-props"],{multiple:i,options:e.option||(null==(o=e.componentProps)?void 0:o.options),allowCreate:"1"===e.free_entry||!!t["x-component-props"].allowCreate,shouldSave:"1"===e.save_free_entry,maxTagCount:r(e.multi_select_value),...n(e,["lazyRequest","requestCache"])}),i&&(t.type="array"),t},h=e=>{const o=x(e);return Object.assign(o["x-component-props"],{options:e.option,childFieldStrategy:e.childFieldStrategy,vertical:e.__vertical}),e.urlConfig?d(o,e):e.autograph&&m(o,e),o},g=e=>{const t=x(e);return Object.assign(t["x-component-props"],{fieldItem:o(e,["reactions"])}),t},b=e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINEBAR","x-display":"visible","x-component-props":{disabled:"1"===e.is_not_fold,id:p(e.val_key),show:"0"!==e.is_show,remark:e.remark}}),y=new Map([["LINEBAR",b],["LINE_BREAKS",e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINE_BREAKS","x-display":"0"===e.is_show?"hidden":"visible"})],["INPUT",e=>{const o=x(e);return Object.assign(o["x-component-props"],{...n(e,["prefix","suffix"])}),o}],["TEXTAREA",e=>{const o=x(e);return Object.assign(o["x-component-props"],{rows:e.initialize_high||3}),o}],["INPUT_NUMBER",e=>{const o=x(e),{decimal_length:t,validate:n}=e;return Object.assign(o["x-component-props"],{precision:null!=t?t:null==n?void 0:n.decimal_length,prefix:e.prefix,suffix:e.suffix}),o}],["SELECT",_],["REMOTE_SEARCH",_],["DATE",e=>{const o=x(e);return Object.assign(o["x-component-props"],{valueFormat:e.date_format,type:c(e.date_format),validate:e.validate}),o}],["LEVEL_SEARCH_CASCADER",e=>{const o=x(e);return Object.assign(o["x-component-props"],{...n(e,["wordbook","lazyRequest","autograph"])}),"1"===e.is_allow_check_mid&&e.allow_check_mid_level&&(o["x-component-props"].checkAbleLevel=+e.allow_check_mid_level),o}],["SEARCH_CASCADER",e=>{var o;const t=x(e);return Object.assign(t["x-component-props"],{urlConfig:e.urlConfig,depth:null==(o=e.wordbook)?void 0:o.level_num,options:e.option}),t}],["COMBINATION",e=>{const o=x(e);return o.type="array",!1!==e.jsonCombination&&(o["x-component"]="JSON_COMBINATION"),Object.assign(o["x-decorator-props"],{showLabel:!1,showFeedback:!1}),Object.assign(o["x-component-props"],{title:e.alias||e.name,maxGroupNum:e.maxGroupNum,properties:e.children||[],combinationItemDeletable:e.combinationItemDeletable}),o}],["RADIO",h],["CHECKBOX",h],["SWITCH",e=>{const o=x(e);return Object.assign(o["x-component-props"],{openDescription:e.open,closeDescription:e.close}),o}],["SLIDER",e=>{const o=x(e);return Object.assign(o["x-component-props"],{step:r(e.step_length),max:r(e.max_length),min:r(e.min_length),option:e.option}),o}],["COMPLEX",e=>{const o=x(e);Array.isArray(e.properties)&&i("COMPLEX控件的properties属性已经废弃, 请使用children作为替代, 在之后的版本中properties属性将不再支持");const t=Array.isArray(e.properties||e.children)?E(e.properties||e.children):{};return o.type=e.fieldType||"void",o.properties=t,Object.assign(o["x-decorator-props"],{showFeedback:!1}),Object.assign(o["x-component-props"],n(e,["wrapperStyle","display"])),o}]]),v=e=>{if(e.suffixConfig)return C(e);return(y.get(e.html_type)||g)(e)},C=o=>{if(!o.suffixConfig&&!o.prefixConfig)return v(o);const t=o.suffixConfig?e(o.suffixConfig):[],n=[...(o.prefixConfig?e(o.prefixConfig):[]).map((e=>({...e,hide_title:"1",is_show:"1"}))),{...o,is_show:"1",hide_title:"1",suffixConfig:void 0,prefixConfig:void 0},...t.map((e=>({...e,hide_title:"1",is_show:"1"})))],r=x(o);return Object.assign(r,{type:"void",name:a(n),title:o.alias||o.name,"x-component":"INPUT_GROUP","x-component-props":{span:2*(o.elem_width||3)},"x-decorator-props":{...r["x-decorator-props"],showFeedback:!1,suffixFields:n.map((e=>e.val_key))},properties:E(n)}),r},{FieldNormalizeWaterfallHook:O,FieldListNormalizeWaterfallHook:j}=s();function E(o){let n=null;return j.call(t(o)).reduce(((e,o,s)=>{var a;const p=null==(a=(o=O.call(o)).validate)?void 0:a.obj_type;return p&&u&&u.collect(p,t(o)),"LINEBAR"===o.html_type?(e[i(o)]=r(b(o),s),n=e[i(o)].properties={}):n?n[i(o)]=r(v(o),s):(n=null,e[i(o)]=r(v(o),s)),e}),{});function r(e,o){return e["x-index"]=o,e}function i(o){return o.suffixConfig?a([o,...e(o.suffixConfig)]):o.val_key}}return{schemaAdaptor:E}}export{u as useFieldListAdaptor};
|
|
1
|
+
import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,pick as n}from"lodash-es";import"../../index.js";import{parseNumberFromMaybeString as r,formRenderLog as i}from"../utils/index.js";import{useFieldNormalize as s}from"./useFieldNormalize.js";import{fieldKeyEscape as a,createLinebarId as p}from"../utils/schema.js";import{useFormValidator as l}from"./useFormValidator.js";import{transformDateFormat as c}from"../utils/business.js";function m(e,o){Object.assign(e["x-component-props"],{...n(o,["wordbook","autograph"])})}function d(e,o){Object.assign(e["x-component-props"],{...n(o,["urlConfig","wordbook"])})}function u(u){const{createValidatorSchema:f}=l(),x=e=>{var o;const t={name:e.val_key,type:null!=(o=e.fieldType)?o:"string",title:e.alias||e.name,"x-component":e.html_type,default:e.default_val,"x-component-props":{placeholder:e.placeholder,clearable:"0"===e.is_empty,...e.componentProps||{}},"x-content":e.slots,"x-display":"0"===e.is_show?"hidden":"visible","x-pattern":"0"===e.is_edit?"disabled":"editable","x-compile-omitted":["title","x-component-props","x-decorator-props"]};e.reactions&&(t["x-reactions"]=e.reactions),e.noDecorator||Object.assign(t,{"x-decorator":"FORM_ITEM","x-decorator-props":{fieldItem:e,span:2*(e.elem_width||3),showLabel:"1"!==e.hide_title,remark:e.remark,propertyKey:e.val_key,annotation:e.annotation,...e.decoratorProps||{}}});const n=f(e);return n&&(t["x-validator"]=n),"0"===e.is_null&&(t.required=!0),t},_=e=>{var o;const t=x(e);e.urlConfig?d(t,e):e.autograph&&m(t,e);const i=!!e.__multiple;return Object.assign(t["x-component-props"],{multiple:i,options:e.option||(null==(o=e.componentProps)?void 0:o.options),allowCreate:"1"===e.free_entry||!!t["x-component-props"].allowCreate,shouldSave:"1"===e.save_free_entry,maxTagCount:r(e.multi_select_value),...n(e,["lazyRequest","requestCache"])}),i&&(t.type="array"),t},h=e=>{const o=x(e);return Object.assign(o["x-component-props"],{options:e.option,childFieldStrategy:e.childFieldStrategy,vertical:e.__vertical}),e.urlConfig?d(o,e):e.autograph&&m(o,e),o},g=e=>{const t=x(e);return Object.assign(t["x-component-props"],{fieldItem:o(e,["reactions"])}),t},b=e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINEBAR","x-display":"visible","x-component-props":{disabled:"1"===e.is_not_fold,id:p(e.val_key),show:"0"!==e.is_show,remark:e.remark}}),y=new Map([["LINEBAR",b],["LINE_BREAKS",e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINE_BREAKS","x-display":"0"===e.is_show?"hidden":"visible"})],["INPUT",e=>{const o=x(e);return Object.assign(o["x-component-props"],{...n(e,["prefix","suffix"])}),o}],["TEXTAREA",e=>{const o=x(e);return Object.assign(o["x-component-props"],{rows:e.initialize_high||3}),o}],["INPUT_NUMBER",e=>{const o=x(e),{decimal_length:t,validate:n,allowSlash:r}=e;return r&&(o["x-component"]="INPUT_NUMBER_SLASH",o.type="string"),Object.assign(o["x-component-props"],{precision:null!=t?t:null==n?void 0:n.decimal_length,prefix:e.prefix,suffix:e.suffix}),o}],["SELECT",_],["REMOTE_SEARCH",_],["DATE",e=>{const o=x(e);return Object.assign(o["x-component-props"],{valueFormat:e.date_format,type:c(e.date_format),validate:e.validate}),o}],["LEVEL_SEARCH_CASCADER",e=>{const o=x(e);return Object.assign(o["x-component-props"],{...n(e,["wordbook","lazyRequest","autograph"])}),"1"===e.is_allow_check_mid&&e.allow_check_mid_level&&(o["x-component-props"].checkAbleLevel=+e.allow_check_mid_level),o}],["SEARCH_CASCADER",e=>{var o;const t=x(e);return Object.assign(t["x-component-props"],{urlConfig:e.urlConfig,depth:null==(o=e.wordbook)?void 0:o.level_num,options:e.option}),t}],["COMBINATION",e=>{const o=x(e);return o.type="array",!1!==e.jsonCombination&&(o["x-component"]="JSON_COMBINATION"),Object.assign(o["x-decorator-props"],{showLabel:!1,showFeedback:!1}),Object.assign(o["x-component-props"],{title:e.alias||e.name,maxGroupNum:e.maxGroupNum,properties:e.children||[],combinationItemDeletable:e.combinationItemDeletable}),o}],["RADIO",h],["CHECKBOX",h],["SWITCH",e=>{const o=x(e);return Object.assign(o["x-component-props"],{openDescription:e.open,closeDescription:e.close}),o}],["SLIDER",e=>{const o=x(e);return Object.assign(o["x-component-props"],{step:r(e.step_length),max:r(e.max_length),min:r(e.min_length),option:e.option}),o}],["COMPLEX",e=>{const o=x(e);Array.isArray(e.properties)&&i("COMPLEX控件的properties属性已经废弃, 请使用children作为替代, 在之后的版本中properties属性将不再支持");const t=Array.isArray(e.properties||e.children)?E(e.properties||e.children):{};return o.type=e.fieldType||"void",o.properties=t,Object.assign(o["x-decorator-props"],{showFeedback:!1}),Object.assign(o["x-component-props"],n(e,["wrapperStyle","display"])),o}]]),v=e=>{if(e.suffixConfig)return C(e);return(y.get(e.html_type)||g)(e)},C=o=>{if(!o.suffixConfig&&!o.prefixConfig)return v(o);const t=o.suffixConfig?e(o.suffixConfig):[],n=[...(o.prefixConfig?e(o.prefixConfig):[]).map((e=>({...e,hide_title:"1",is_show:"1"}))),{...o,is_show:"1",hide_title:"1",suffixConfig:void 0,prefixConfig:void 0},...t.map((e=>({...e,hide_title:"1",is_show:"1"})))],r=x(o);return Object.assign(r,{type:"void",name:a(n),title:o.alias||o.name,"x-component":"INPUT_GROUP","x-component-props":{span:2*(o.elem_width||3)},"x-decorator-props":{...r["x-decorator-props"],showFeedback:!1,suffixFields:n.map((e=>e.val_key))},properties:E(n)}),r},{FieldNormalizeWaterfallHook:O,FieldListNormalizeWaterfallHook:j}=s();function E(o){let n=null;return j.call(t(o)).reduce(((e,o,s)=>{var a;const p=null==(a=(o=O.call(o)).validate)?void 0:a.obj_type;return p&&u&&u.collect(p,t(o)),"LINEBAR"===o.html_type?(e[i(o)]=r(b(o),s),n=e[i(o)].properties={}):n?n[i(o)]=r(v(o),s):(n=null,e[i(o)]=r(v(o),s)),e}),{});function r(e,o){return e["x-index"]=o,e}function i(o){return o.suffixConfig?a([o,...e(o.suffixConfig)]):o.val_key}}return{schemaAdaptor:E}}export{u as useFieldListAdaptor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{arrayed as e}from"../../../../shared/utils/index.js";import{once as
|
|
1
|
+
import{arrayed as e}from"../../../../shared/utils/index.js";import{once as a,isNumber as m,isString as r}from"lodash-es";import"vue";import{registerValidateLocale as i,registerValidateRules as s}from"@formily/core";import"@formily/path";import"@vue/shared";import{isFunction as l}from"@vueuse/core";import"../../index.js";import{isIdCard as u}from"../utils/business.js";function t(){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 m;if(null!=a&&""!==a)return r(a)&&u(a)?void 0:null!=(m=null==e?void 0:e.message)?m:"该字段不是合法的身份证格式"}})],["regular",({validate:e,regular_expression:a,regular_error_tip:m})=>({pattern:a||(null==e?void 0:e.regular_expression)||"",message:m||(null==e?void 0:e.regular_error_tip)||(null==e?void 0:e.message)||"格式错误"})]]),m={triggerType:"onBlur"};return{createValidatorSchema:function(r){const i=[],{validate:{vali_obj:s,max_length:u,min_length:t,message:n,max_value:o,min_value:g,decimal_length:d}={},validator:v}=r;if(v&&e(v).forEach((e=>{l(e)&&i.push({validator:a=>e(a,r)})})),u&&i.push({max:u,message:n}),t&&i.push({min:t,message:n}),o&&i.push({maximum:o,message:n}),g&&i.push({minimum:g,message:n}),null!=d&&i.push(((e,a)=>{const m=null!=a?a:`小数位数最多${e}位`;return{validator(a){var r;return(null==(r=String(a).split(".")[1])?void 0:r.length)>e?m:""}}})(+d,n)),s){const e=a.get(s)||(({validate:e})=>({format:s,message:null==e?void 0:e.message}));i.push(Object.assign({},m,e(r)))}return i}}}const n=a((()=>{i({"zh-CN":{required:"${alias||name}为必填"}}),s({maximum:(e,a)=>m(Number(a.maximum))&&null!=e&&""!==e&&"/"!==e?(r(e)&&(e=+e),!m(e)||isNaN(e)?a.message||"":e>Number(a.maximum)&&a.message||""):"",minimum:(e,a)=>m(Number(a.minimum))&&null!=e&&""!==e&&"/"!==e?(r(e)&&(e=+e),!m(e)||isNaN(e)?a.message||"":e<Number(a.minimum)&&a.message||""):""})}));export{t as useFormValidator,n as validateMessageLocale};
|
|
@@ -147,6 +147,7 @@ export declare type FieldItem = {
|
|
|
147
147
|
allow_check_mid_level: '1' | '2' | '3' | '4';
|
|
148
148
|
prefix: string | AnyObject | (() => any);
|
|
149
149
|
suffix: string | AnyObject | (() => any);
|
|
150
|
+
allowSlash: boolean;
|
|
150
151
|
fieldType: SchemaTypes;
|
|
151
152
|
content: string | FormRenderer | Record<string, FormRenderer>;
|
|
152
153
|
lazyRequest: boolean;
|
|
@@ -170,6 +170,7 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
170
170
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
171
171
|
prefix?: string | import("../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
172
172
|
suffix?: string | import("../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
173
|
+
allowSlash?: boolean | undefined;
|
|
173
174
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
174
175
|
content?: string | import("..").FormRenderer | Record<string, import("..").FormRenderer> | undefined;
|
|
175
176
|
lazyRequest?: boolean | undefined;
|
|
@@ -172,6 +172,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
172
172
|
allow_check_mid_level?: "1" | "2" | "3" | "4" | undefined;
|
|
173
173
|
prefix?: string | import("../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
174
174
|
suffix?: string | import("../../../../es/shared/types").AnyObject | (() => any) | undefined;
|
|
175
|
+
allowSlash?: boolean | undefined;
|
|
175
176
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
176
177
|
content?: string | import("../../../../es/components/form-render").FormRenderer | Record<string, import("../../../../es/components/form-render").FormRenderer> | undefined;
|
|
177
178
|
lazyRequest?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="@cnhis-design-vue/shared",i="3.1.
|
|
1
|
+
var e="@cnhis-design-vue/shared",i="3.1.49-beta.0",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.1.49-beta.0",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.49-beta.0",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"module": "./es/components/index.js",
|
|
6
6
|
"main": "./es/components/index.js",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"iOS 7",
|
|
64
64
|
"last 3 iOS versions"
|
|
65
65
|
],
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "934626c696a3d6d426c09387a3fe9946aaefbfa6"
|
|
67
67
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
declare type PluginName = string | {
|
|
2
|
-
name: string;
|
|
3
|
-
stage: number;
|
|
4
|
-
};
|
|
5
|
-
declare type WithStage<T extends (...p: any[]) => any> = {
|
|
6
|
-
stage: number;
|
|
7
|
-
callback: T;
|
|
8
|
-
};
|
|
9
|
-
declare type ReplaceWithString<T extends any[]> = T extends [infer A, ...infer R] ? [string, ...ReplaceWithString<R>] : T;
|
|
10
|
-
export declare class SyncHook<T extends any[]> {
|
|
11
|
-
private args;
|
|
12
|
-
constructor(args: ReplaceWithString<T>);
|
|
13
|
-
callbackList: WithStage<(...payload: T) => any>[];
|
|
14
|
-
tap(pluginName: PluginName, callback: (...payload: T) => any): void;
|
|
15
|
-
tapPromise(pluginName: PluginName, callback: (...payload: T) => any): void;
|
|
16
|
-
call(...payload: T): void;
|
|
17
|
-
}
|
|
18
|
-
export declare class SyncWaterfallHook<T extends any[]> extends SyncHook<T> {
|
|
19
|
-
callbackList: WithStage<(...payload: T) => T[0]>[];
|
|
20
|
-
call(...payload: T): T[0];
|
|
21
|
-
}
|
|
22
|
-
export declare class AsyncParallelHook<T extends any[]> extends SyncHook<T> {
|
|
23
|
-
promise(...payload: T): void;
|
|
24
|
-
}
|
|
25
|
-
export declare class AsyncSeriesHook<T extends any[]> extends SyncHook<T> {
|
|
26
|
-
promise(...payload: T): Promise<void>;
|
|
27
|
-
}
|
|
28
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{isObject as a}from"@vueuse/core";import{isString as s,sortBy as c}from"lodash-es";class l{constructor(a){this.args=a,this.callbackList=[]}tap(l,t){var i;if(s(l))this.callbackList.push({stage:0,callback:t});else{if(!a(l))return;this.callbackList.push({stage:null!=(i=l.stage)?i:0,callback:t})}this.callbackList=c(this.callbackList,(a=>a.stage))}tapPromise(l,t){var i;if(s(l))this.callbackList.push({stage:0,callback:t});else{if(!a(l))return;this.callbackList.push({stage:null!=(i=l.stage)?i:0,callback:t})}this.callbackList=c(this.callbackList,(a=>a.stage))}call(...a){this.callbackList.forEach((({callback:s})=>s(...a)))}}class t extends l{constructor(){super(...arguments),this.callbackList=[]}call(...a){return this.callbackList.reduce(((s,{callback:c})=>c(s,...a.slice(1))),a[0])}}class i extends l{promise(...a){this.callbackList.forEach((({callback:s})=>s(...a)))}}class e extends l{promise(...a){return this.callbackList.reduce((async(s,{callback:c})=>(await s,c(...a))),Promise.resolve())}}export{i as AsyncParallelHook,e as AsyncSeriesHook,l as SyncHook,t as SyncWaterfallHook};
|