cnhis-design-vue 3.2.14-beta.6 → 3.2.14-beta.8

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.
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t,drawLine as n,drawPoint as i}from"../useDraw.js";import{useGrid as o}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import{bus as r}from"../useEvent.js";import{useCommon as s}from"../useCommon.js";import"vue";import{getPointRange as a,getIndex as f,isEffectiveNode as u,getTime as c}from"../../utils/index.js";import{cloneDeep as p,last as d,omit as m,flatten as v}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import{useIntervalFn as g}from"@vueuse/core";function y(y,h,k,x,L,P){const{computedX:w,computedY:b,getXValue:A,getYValue:I}=l(h),{xCellWidth:C,pointSelectionStyle:K,originX:E,endX:j,originY:T,endY:X,event:V,scaleValues:Y,xAxis:M,startTime:S,timeXCell:D,itemList:F,dialog:O,topGridOriginY:$,topGridEndY:_}=h,z=new Map,G=new Set,N=p(Y);let J=[],q=null;const R=new Set;o(y,h);const{getEqualXTypes:W,handleAddPrevent:B,setPrevAndNextPoint:H,getPointEventProps:Q}=s(y,k,h),{pause:U,resume:Z}=g((()=>{!function(){if(!R.size)return;for(const e of R)e.set("opacity",1===e.opacity?.5:1);y.value.renderAll()}()}),800);function ee(){N.forEach((e=>{const{range:t=[],spaceValue:i}=e;i&&(t[0]||t[1])&&e.dataList.forEach(((t,i)=>{t.show&&(!function(e,t){const{max:i={},min:o={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function s({show:e=!1,value:i,name:o,lineStyle:l}){if(!e||!i)return;const r=b(t.type,t.range,i),s=n([E,r,j,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});V.hovered&&o&&(s.on("mousemove",(({pointer:e})=>{x.point={...e||{x:s.left,y:s.top}},x.list=[`${o} ${i}${t.unit||""}`],x.show=!0})),s.on("mouseout",(()=>{x.show=!1}))),y.value.add(s)}s(i),s(o),s(l),s(r)}(t,e),oe(t,i,e))}))}))}function te(e=[]){if(!(null==q?void 0:q.areaPos))return[];const{startPos:t,endPos:n}=q.areaPos,[i,o]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:de()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=r))}function ne(e){O.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),ie()},onNegativeClick:()=>ie(),onClose:()=>ie()})}function ie(){q&&y.value.remove(q),q=null}function oe(e,t,o){var l;const{type:r,unit:s,dataList:a=[]}=o,f=[];z.set(e.key,[]),function(e,t){R.size&&[...R].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&R.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,u)=>{!function(e,l,u,c){var p;let v,g,h=c;l.key&&(h=a.find((e=>e.key===l.key)));const{pointAttr:L={},lineAttr:P={},title:w="",key:b,type:K="circle"}=h,E=pe(c.list[u+1],o);e&&E&&!l.breakpoint&&e[0]!==E[0]&&(g=n([...e,...E],P));const j=f[u-1],T={origin:{data:l,title:w,key:c.key,selfKey:b,unit:s,type:r,dataIndex:t,index:u,lineAttr:P},__type:"main",leftLine:j,rightLine:g,...L,...Q()};e&&(j||(T.leftLine=null),v=i(K,{left:e[0],top:e[1],...T}));f.push(g),v&&(v.originLeft=v.left,v.originTop=v.top,function(e){V.hovered&&(e.on("mouseover",(()=>{ue(e,"hover")})),e.on("mouseout",(()=>{x.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ce(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),V.hovered&&ue(e),function(e){var t,n,i,o;const{originLeft:l,originTop:r,left:s,top:a,origin:f}=e,u=~~((s-l)/C);if(s>l+C){if(0===J.length){re(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[l,r],l,r]),null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,"stroke","transparent"),null==(o=null==(i=e.rightLine)?void 0:i.set)||o.call(i,"stroke","transparent")}const c=l+C*u;if(J.every((e=>e.left!==c))){const t=A(c),n=I(f.type,a);J.push({data:{time:t,value:n,...f.selfKey!==f.key?{key:f.selfKey}:{}},left:c,top:a}),re(e,[...e.prevPointer,c,a])}if(J.length<u&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+C*l,r=J.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=J.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const s=JSON.parse(JSON.stringify(r)),a=J[l-1]||{left:n,top:i},f=~~((r.left-(t-C))/C),u=(r.top-a.top)/f;s.top=a.top+u,s.left=t,s.data={time:A(t),value:I(o.type,s.top),...o.selfKey!==o.key?{key:o.selfKey}:{}},J.splice(l,0,s),re(e,[a.left,a.top,s.left,s.top])}}l++}}(e,u),e.nextPoint){const t=z.get(f.key);!function(e,t){const{left:n,top:i,origin:o}=t,l=C/2,r=e.findIndex((e=>Math.abs(n-e.left)<l&&Math.abs(i-e.top)<l&&o.index!==e.origin.index));r>-1?(t.set({scaleX:2.5,scaleY:2.5}),t.coincidePoint=e[r]):t.set({scaleX:t.scale,scaleY:t.scale})}(t,e),null==t||t.forEach((e=>{e.left<=l||f.index===e.origin.index||(e.left<s?le(e,"#999"):le(e,e.origin.lineAttr.stroke))}))}}!function(e){var t,n;const{left:i}=e;if(J.length>0&&i<J[J.length-1].left){for(const e of G)e.left>i&&(e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e));if(J=J.filter((e=>e.left<=i)),0===J.length){null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,e.origin.lineAttr);for(const e of G)e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e)}if(J.length>0){const t=d(J);e.prevPointer=[t.left,t.top]}}}(e)}(e)})),e.on("mouseup",(t=>{if(x.show=!1,1===t.button){const{type:t,selfKey:n,dataIndex:i}=e.origin,o={...e.origin,data:{...e.origin.data,time:A(e.left),value:I(t,e.top)}};if(y.value.discardActiveObject(),J.length>0){const l=N.find((e=>e.type===t));let r=-1;const s=J.map((e=>e.data));if(e.nextPoint){if(2.5!==e.scaleX)return void ae({dataIndex:i,scaleValue:l});const t=e.coincidePoint.origin,n=t.data;r=t.index;const o=s.findIndex((e=>e.time===n.time));o>-1?s[o].value=n.value:s.push({...d(s),time:n.time,value:n.value})}const a=l.dataList.findIndex((e=>e.key===n));k("add",{...m(o,["index","selfKey","lineAttr"]),dataIndex:a,key:n,data:s}),se({...o,data:s,coincideIndex:r})}else k("change",{...m(o,["selfKey","lineAttr"]),key:n}),se(o,"change")}}))}(v),null==(p=z.get(c.key))||p.push(v))}(pe(l,o),l,u,e)})),Promise.all(z.get(e.key)).then((t=>{const n=f.filter((e=>e));H(t),y.value.add(...n,...t),function(e,t){const{max:n={},min:i={}}=t.panicValue||{},{max:o={},min:l={}}=t.diffValue||{};function r({show:t=!1,value:n,flickerable:i},o){!t&&n&&i&&e.forEach((e=>{const t=e.origin.data.value;"max"===o&&t<n||"min"===o&&t>n||R.add(e)}))}r(n,"max"),r(i,"min"),r(o,"max"),r(l,"min")}(t,e)}))}function le(e,t){["stroke","fill"].forEach((n=>{const i=e[n];i&&!["transparent","#fff","#ffffff","#FFFFFF"].includes(i)&&i!==t&&e.set(n,t)})),e.rightLine&&e.rightLine.stroke!==t&&e.rightLine.set("stroke",t)}function re(e,t){const[,,i,o]=t;e.clone((l=>{l.set({left:i,top:o,scaleX:1,scaleY:1}),e.prevPointer=[i,o];const r=n(t,e.origin.lineAttr);l.leftLine=r,G.add(l),y.value.add(r,l)}))}function se(e,t="add",n=1){const{data:i,index:o,key:l,type:r,coincideIndex:s}=e;let{dataIndex:a}=e;const u=N.find((e=>e.type===r)),c=u.dataList.find(((e,t)=>(a=t,e.key===l)));switch(t){case"remove":c.list.splice(o,n),c.list[o-1]&&(c.list[o-1].breakpoint=!0);break;case"change":c.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=f(e,c.list),n=Array.isArray(i)?i:[i];c.list.splice(t,s>-1?s-t+1:0,...n);break}}ae({dataIndex:a,scaleValue:u})}function ae(e){var t,n,i;if(G.size&&(null==(t=y.value)||t.remove(...fe([...G]))),G.clear(),J=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=y.value)||n.remove(...fe(z.get(o.key))),z.delete(o.key),oe(o,t,i)}else z.size&&(null==(i=y.value)||i.remove(...fe(de()))),z.clear(),ee()}function fe(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 ue(e,t="moving"){const{title:n,type:i,data:o,unit:l,selfKey:r}=e.origin;x.point={x:e.left,y:e.top};const s=A(e.left),a=`${"hover"===t?o.value:I(i,e.top)}`;x.list=[`${n} ${a}${l||""}`,`时间 ${s.slice(-5)}`],x.sourceData=[{type:i,title:n,unit:l,key:r,time:s,value:a}],x.isTarget=!0,x.show=!0}function ce(e){e.setCoords();const t=6e4/D,n=e.prevPoint?e.prevPoint.left+t:E,i=j;e.top<T&&e.set("top",T),e.top>X&&e.set("top",X),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}function pe(e,t){if(u(e)&&function(e){const t=Date.parse(d(M.list)),n=c(e);return n>=S&&n<=t}(e.time)){const n=w(e.time),i=b(t.type,t.range,e.value);return[n,i<T?T:i>X?X:i]}}function de(){return v(Array.from(z.values()))}return ee(),function(){if(!V.evented)return;let n=!1,i={x:0,y:0};y.value.on("mouse:up",(e=>{if(3===e.button&&function(e){x.show=!1;const{x:t=0,y:n=0}=e.pointer||{};if(t>=E&&t<=j&&n>=T&&n<=X)if(e.target){if("main"!==e.target.__type)return;i(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:o,maxTop:l}=a(e.target);de().forEach((i=>{"main"===i.__type&&i.left>t&&i.left<n&&i.top>o&&i.top<l&&L.list.push({renderItem:()=>i.origin.title,origin:{...i.origin},mode:"remove",pointer:e.pointer})})),1===L.list.length&&(L.show=!1,console.log("当前时间段内无可删除节点"))}else i(e.pointer,null,["新增节点"]),F.forEach((n=>{W(de(),t,"key",2*C).includes(n.linkKey||n.key)||L.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,linkKey:n.linkKey},pointer:e.pointer})})),1===L.list.length&&(L.show=!1,B("repeat"),console.log("当前时间段内无可新增节点"));function i(e,t,n){Object.assign(L,{point:e,show:!0,target:t,list:n})}}(e),1===e.button&&n){n=!1;const e=te();e.length>0?ne((()=>{const t=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return se(n[0],"remove",n.length),n.map((e=>({...m(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(e);k("remove",t)})):r.emit(q)}})),y.value.on("mouse:down",(e=>{1!==e.button||e.target||(n=!0,i=e.pointer)})),y.value.on("mouse:move",(o=>{if(function(e){if(!P||L.show)return;const{target:t,pointer:n}=e,{x:i=0,y:o=0}=n;x.movable=!1,(i<E||i>j)&&(x.show=!1);if(!t&&i>=E&&i<=j){const e=o>=T&&o<=X,l=o>=$&&o<=_;if(e||l){const l=A(i);x.sourceData=e?N.map((e=>{const{type:t,title:n,unit:i}=e;return{type:t,title:n,unit:i,time:l,value:I(t,o)}})):[{type:"tree",time:l}],x.isTarget=!!t,x.point=n,x.movable=!0}else x.show=!1}}(o),!n)return;const{x:l,y:r}=i,{x:s,y:a}=o.pointer;q&&y.value.remove(q),q=new e.Rect({...t,fill:"#CAF982",opacity:.4,...K,left:l,top:r,width:s-l,height:a-r,objectCaching:!0}),q.areaPos={startPos:i,endPos:o.pointer},y.value.add(q)}))}(),{redrawPoints:ae,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(k("remove",n),se(n,"remove")):(Object.assign(n,{data:{time:A(e.pointer.x),value:I(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),k("add",n),se({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:ce,setPopup:ue,updateData:se,getGridPoints:de,getContainPoints:te,showDialog:ne,removeCurrentSelection:ie,pauseFlickerPoint:U}}export{y as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t,drawLine as n,drawPoint as i}from"../useDraw.js";import{useGrid as o}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import{bus as r}from"../useEvent.js";import{useCommon as a}from"../useCommon.js";import"vue";import{getPointRange as s,getIndex as f,isEffectiveNode as u,getTime as c}from"../../utils/index.js";import{cloneDeep as p,last as d,omit as m,flatten as v}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import{useIntervalFn as g}from"@vueuse/core";function y(y,h,k,x,L,P){const{computedX:w,computedY:b,getXValue:A,getYValue:I}=l(h),{xCellWidth:C,pointSelectionStyle:K,originX:E,endX:j,originY:T,endY:X,event:M,scaleValues:V,xAxis:Y,startTime:S,timeXCell:D,itemList:F,dialog:O,topGridOriginY:$,topGridEndY:_}=h,z=new Map,G=new Set,N=p(V);let J=[],q=null;const R=new Set;o(y,h);const{getEqualXTypes:W,handleAddPrevent:B,setPrevAndNextPoint:H,getPointEventProps:Q}=a(y,k,h),{pause:U,resume:Z}=g((()=>{!function(){if(!R.size)return;for(const e of R)e.set("opacity",1===e.opacity?.5:1);y.value.renderAll()}()}),800);function ee(){N.forEach((e=>{const{range:t=[],spaceValue:i}=e;i&&(t[0]||t[1])&&e.dataList.forEach(((t,i)=>{t.show&&(!function(e,t){const{max:i={},min:o={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function a({show:e=!1,value:i,name:o,lineStyle:l}){if(!e||!i)return;const r=b(t.type,t.range,i),a=n([E,r,j,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});M.hovered&&o&&(a.on("mousemove",(({pointer:e})=>{x.point={...e||{x:a.left,y:a.top}},x.list=[`${o} ${i}${t.unit||""}`],x.show=!0})),a.on("mouseout",(()=>{x.show=!1}))),y.value.add(a)}a(i),a(o),a(l),a(r)}(t,e),oe(t,i,e))}))}))}function te(e=[]){if(!(null==q?void 0:q.areaPos))return[];const{startPos:t,endPos:n}=q.areaPos,[i,o]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:de()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=r))}function ne(e){O.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),ie()},onNegativeClick:()=>ie(),onClose:()=>ie()})}function ie(){q&&y.value.remove(q),q=null}function oe(e,t,o){var l;const{type:r,unit:a,dataList:s=[]}=o,f=[];z.set(e.key,[]),function(e,t){R.size&&[...R].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&R.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,u)=>{!function(e,l,u,c){var p;let v,g,h=c;l.key&&(h=s.find((e=>e.key===l.key)));const{pointAttr:L={},lineAttr:P={},title:w="",key:b,type:K="circle"}=h,E=pe(c.list[u+1],o);e&&E&&!l.breakpoint&&e[0]!==E[0]&&(g=n([...e,...E],P));const j=f[u-1],T={origin:{data:l,title:w,key:c.key,selfKey:b,unit:a,type:r,dataIndex:t,index:u,lineAttr:P},__type:"main",leftLine:j,rightLine:g,...L,...Q()};e&&(j||(T.leftLine=null),v=i(K,{left:e[0],top:e[1],...T}));f.push(g),v&&(v.originLeft=v.left,v.originTop=v.top,function(e){M.hovered&&(e.on("mouseover",(()=>{ue(e,"hover")})),e.on("mouseout",(()=>{x.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ce(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),M.hovered&&ue(e),function(e){var t,n,i,o;const{originLeft:l,originTop:r,left:a,top:s,origin:f}=e,u=~~((a-l)/C);if(a>l+C){if(0===J.length){re(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[l,r],l,r]),null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,"stroke","transparent"),null==(o=null==(i=e.rightLine)?void 0:i.set)||o.call(i,"stroke","transparent")}const c=l+C*u;if(J.every((e=>e.left!==c))){const t=A(c),n=I(f.type,s);J.push({data:{time:t,value:n,...f.selfKey!==f.key?{key:f.selfKey}:{}},left:c,top:s}),re(e,[...e.prevPointer,c,s])}if(J.length<u&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+C*l,r=J.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=J.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=J[l-1]||{left:n,top:i},f=~~((r.left-(t-C))/C),u=(r.top-s.top)/f;a.top=s.top+u,a.left=t,a.data={time:A(t),value:I(o.type,a.top),...o.selfKey!==o.key?{key:o.selfKey}:{}},J.splice(l,0,a),re(e,[s.left,s.top,a.left,a.top])}}l++}}(e,u),e.nextPoint){const t=z.get(f.key);!function(e,t){const{left:n,top:i,origin:o}=t,l=C/2,r=e.findIndex((e=>Math.abs(n-e.left)<l&&Math.abs(i-e.top)<l&&o.index!==e.origin.index));r>-1?(t.set({scaleX:2.5,scaleY:2.5}),t.coincidePoint=e[r]):t.set({scaleX:t.scale,scaleY:t.scale})}(t,e),null==t||t.forEach((e=>{e.left<=l||f.index===e.origin.index||(e.left<a?le(e,"#999"):le(e,e.origin.lineAttr.stroke))}))}}!function(e){var t,n;const{left:i}=e;if(J.length>0&&i<J[J.length-1].left){for(const e of G)e.left>i&&(e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e));if(J=J.filter((e=>e.left<=i)),0===J.length){null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,e.origin.lineAttr);for(const e of G)e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e)}if(J.length>0){const t=d(J);e.prevPointer=[t.left,t.top]}}}(e)}(e)})),e.on("mouseup",(t=>{if(x.show=!1,1===t.button){const{type:t,selfKey:n,dataIndex:i}=e.origin,o={...e.origin,data:{...e.origin.data,time:A(e.left),value:I(t,e.top)}};if(y.value.discardActiveObject(),J.length>0){const l=N.find((e=>e.type===t));let r=-1;const a=J.map((e=>e.data));if(e.nextPoint){if(2.5!==e.scaleX)return void se({dataIndex:i,scaleValue:l});const t=e.coincidePoint.origin,n=t.data;r=t.index;const o=a.findIndex((e=>e.time===n.time));o>-1?a[o].value=n.value:a.push({...d(a),time:n.time,value:n.value})}const s=l.dataList.findIndex((e=>e.key===n));k("add",{...m(o,["index","selfKey","lineAttr"]),dataIndex:s,key:n,data:a}),ae({...o,data:a,coincideIndex:r})}else k("change",{...m(o,["selfKey","lineAttr"]),key:n}),ae(o,"change")}}))}(v),null==(p=z.get(c.key))||p.push(v))}(pe(l,o),l,u,e)})),Promise.all(z.get(e.key)).then((t=>{const n=f.filter((e=>e));H(t),y.value.add(...n,...t),function(e,t){const{max:n={},min:i={}}=t.panicValue||{},{max:o={},min:l={}}=t.diffValue||{};function r({show:t=!1,value:n,flickerable:i},o){!t&&n&&i&&e.forEach((e=>{const t=e.origin.data.value;"max"===o&&t<n||"min"===o&&t>n||R.add(e)}))}r(n,"max"),r(i,"min"),r(o,"max"),r(l,"min")}(t,e)}))}function le(e,t){["stroke","fill"].forEach((n=>{const i=e[n];i&&!["transparent","#fff","#ffffff","#FFFFFF"].includes(i)&&i!==t&&e.set(n,t)})),e.rightLine&&e.rightLine.stroke!==t&&e.rightLine.set("stroke",t)}function re(e,t){const[,,i,o]=t;e.clone((l=>{l.set({left:i,top:o,scaleX:1,scaleY:1}),e.prevPointer=[i,o];const r=n(t,e.origin.lineAttr);l.leftLine=r,G.add(l),y.value.add(r,l)}))}function ae(e,t="add",n=1){const{data:i,index:o,key:l,type:r,coincideIndex:a}=e;let{dataIndex:s}=e;const u=N.find((e=>e.type===r)),c=u.dataList.find(((e,t)=>(s=t,e.key===l)));switch(t){case"remove":c.list.splice(o,n),c.list[o-1]&&(c.list[o-1].breakpoint=!0);break;case"change":c.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=f(e,c.list),n=Array.isArray(i)?i:[i];c.list.splice(t,a>-1?a-t+1:0,...n);break}}se({dataIndex:s,scaleValue:u})}function se(e){var t,n,i;if(G.size&&(null==(t=y.value)||t.remove(...fe([...G]))),G.clear(),J=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=y.value)||n.remove(...fe(z.get(o.key))),z.delete(o.key),oe(o,t,i)}else z.size&&(null==(i=y.value)||i.remove(...fe(de()))),z.clear(),ee()}function fe(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 ue(e,t="moving"){const{title:n,type:i,data:o,unit:l,selfKey:r}=e.origin;x.point={x:e.left,y:e.top};const a=A(e.left),s=`${"hover"===t?o.value:I(i,e.top)}`;x.list=[`${n} ${s}${l||""}`,`时间 ${a.slice(-5)}`],x.sourceData=[{type:i,title:n,unit:l,key:r,time:a,value:s}],x.isTarget=!0,x.show=!0}function ce(e){e.setCoords();const t=6e4/D,n=e.prevPoint?e.prevPoint.left+t:E,i=j;e.top<T&&e.set("top",T),e.top>X&&e.set("top",X),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}function pe(e,t){if(u(e)&&function(e){const t=Date.parse(d(Y.list)),n=c(e);return n>=S&&n<=t}(e.time)){const n=w(e.time),i=b(t.type,t.range,e.value);return[n,i<T?T:i>X?X:i]}}function de(){return v(Array.from(z.values()))}return ee(),function(){if(!M.evented)return;let n=!1,i={x:0,y:0};y.value.on("mouse:up",(e=>{if(3===e.button&&function(e){x.show=!1;const{x:t=0,y:n=0}=e.pointer||{};if(t>=E&&t<=j&&n>=T&&n<=X)if(e.target){if("main"!==e.target.__type)return;i(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:o,maxTop:l}=s(e.target);de().forEach((i=>{"main"===i.__type&&i.left>t&&i.left<n&&i.top>o&&i.top<l&&L.list.push({renderItem:()=>i.origin.title,origin:{...i.origin},mode:"remove",pointer:e.pointer})})),1===L.list.length&&(L.show=!1,console.log("当前时间段内无可删除节点"))}else i(e.pointer,null,["新增节点"]),F.forEach((n=>{W(de(),t,"key",2*C).includes(n.linkKey||n.key)||L.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,linkKey:n.linkKey},pointer:e.pointer})})),1===L.list.length&&(L.show=!1,B("repeat"),console.log("当前时间段内无可新增节点"));function i(e,t,n){Object.assign(L,{point:e,show:!0,target:t,list:n})}}(e),1===e.button&&n){n=!1;const e=te();e.length>0?ne((()=>{const t=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return ae(n[0],"remove",n.length),n.map((e=>({...m(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(e);k("remove",t)})):r.emit(q)}})),y.value.on("mouse:down",(e=>{1!==e.button||e.target||(n=!0,i=e.pointer)})),y.value.on("mouse:move",(o=>{if(function(e){if(!P||L.show)return;const{target:t,pointer:n}=e,{x:i=0,y:o=0}=n;x.movable=!1,(i<E||i>j)&&(x.show=!1);if(!t&&i>=E&&i<=j){const e=o>=T&&o<=X,l=o>=$&&o<=_;if(e||l){const l=A(i);x.sourceData=e?N.map((e=>{const{type:t,title:n,unit:i}=e;return{type:t,title:n,unit:i,time:l,value:I(t,o)}})):[{type:"tree",time:l}],x.isTarget=!!t,x.point=n,x.movable=!0}else x.show=!1}}(o),!n)return;const{x:l,y:r}=i,{x:a,y:s}=o.pointer;q&&y.value.remove(q),q=new e.Rect({...t,fill:"#CAF982",opacity:.4,...K,left:l>a?a:l,top:r>s?s:r,width:Math.abs(a-l),height:Math.abs(s-r),objectCaching:!0}),q.areaPos={startPos:i,endPos:o.pointer},y.value.add(q)}))}(),{redrawPoints:se,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(k("remove",n),ae(n,"remove")):(Object.assign(n,{data:{time:A(e.pointer.x),value:I(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),k("add",n),ae({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:ce,setPopup:ue,updateData:ae,getGridPoints:de,getContainPoints:te,showDialog:ne,removeCurrentSelection:ie,pauseFlickerPoint:U}}export{y as useCenter};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i}from"../useDraw.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import{bus as n}from"../useEvent.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getIndex as a}from"../../utils/index.js";import{cloneDeep as l,flatten as s}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as d}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function c(c,u,f,h,m,g,p,v,x){const{computedX:k,getXValue:y}=o(u),{getEqualXTypes:X,handleAddPrevent:P,isGridLimit:b,getPointEventProps:w}=r(c,f,u),{other:E,yCellHeight:j,xCellWidth:z,endX:A,originX:C,originY:L,endY:M,markHeight:S,event:T,topGridYCellHeight:I}=u,H=new Map,Y=l(E);function W(){var o;if(!(null==(o=null==Y?void 0:Y.horizontal)?void 0:o.length))return;const n="horizontal";H.set(n,[]);const{horizontal:r}=Y;let a=L+j/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:d={},textStyle:c={},data:u}=o;let f=null;u.forEach(((o,u)=>{const{time:h,value:m}=o,g=k(h);if(!$(g))return;const p=e(s,{...d,left:g,top:a}),v=g+p.width/2+2,x=i([v,a],{value:m,...c,originX:"left"}),y=new t.Group([p,x],{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer",...w()});Object.assign(y,{originLeft:g,iconHalfWidth:p.width/2,origin:{type:"other",key:n,dataIndex:r,index:u,data:o,title:l},limitX:{x1:C,x2:A-y.width}}),f&&(y.limitX.x1=f.left,f.limitX.x2=y.left,y.prevPoint=f,f.nextPoint=y),f=y,q(y),H.get(n).push(y)})),a+=j})),c.value.add(...H.get(n))}function V(){var t;if(!(null==(t=null==Y?void 0:Y.vertical)?void 0:t.length))return;const i="vertical";H.set(i,[]);const{vertical:o}=Y;o.forEach(((t,o)=>{const{show:n=!0,marginTop:r=0,textStyle:a={},data:l,time:s}=t,d=k(s);if(!n||!$(d))return;const{lineHeight:c=j}=a;let u=L+r+c/2;l.forEach(((t,n)=>{const r=e(String(t),{...a,lockMovementY:!0,left:d,originX:"left",top:u,origin:{type:"other",key:i,dataIndex:o,index:n,data:{value:t}},...w()});u+=c,q(r),H.get(i).push(r)}));const f=H.get(i).filter((t=>t.origin.dataIndex===o)),h=Math.max(...f.map((t=>t.width))),m=d>A-h;f.forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=h,m&&t.set("originX","right")}))})),c.value.add(...H.get(i))}function G(t,e="add"){const{dataIndex:i,data:o,index:n,key:r}=t,l=Y[r],s=["mark"].includes(r)?l.dataList[i]:l[i];switch(e){case"remove":s.data.splice(n,1);break;case"change":s.data[n]=o;break;default:{const t=Array.isArray(o)?o[0].time:o.time,e=a(t,s.data),i=Array.isArray(o)?o:[o];s.data.splice(e,0,...i);break}}O(t)}function O(t){var e;const{key:i}=t;switch(null==(e=c.value)||e.remove(...H.get(i)),H.delete(i),i){case"horizontal":W();break;case"vertical":V();break;case"mark":D()}}function D(){if(!(null==E?void 0:E.mark)||!S)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=E.mark,a=i([C-5,M+S/2],{value:t,...o,originX:"right"});c.value.add(a);const l=M+S,s=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=k(i);if(!$(r))return;let a=M;o.forEach((t=>{let i=!1;const o=e("circleAndText",{...n,text:t.text,left:r,top:a,origin:{data:t,key:"mark",type:"other"}}),d=o.height;a+d<=l&&a>=M?(o.set("top",a+d/2),a+=d):(i||(a=M,i=!0),o.set("top",a-d/2),a-=d),s.push(o),q(o),c.value.add(o)}))})),function(t){const e=t=>{var e,i;return null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart},i=t.find((t=>e(t))),o=t.find((t=>!e(t)&&t.left>i.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:C,x2:A};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(s)}function q(t){if(T.hovered&&(t.on("mouseover",(()=>{B(t)})),t.on("mouseout",(()=>{h.show=!1}))),t.lockMovementX&&t.lockMovementY)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e);t.on("moving",(()=>{i?function(t){const e=t.origin.key,i="horizontal"===e;t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1+(i?1:0));t.left>t.limitX.x2&&t.set("left",t.limitX.x2+(i?-1:0));if("mark"===e){t.top<L&&t.set("top",L);const e=M+S-t.height/2;t.top>e&&t.set("top",e)}i&&(t.originLeft=t.left+t.iconHalfWidth)}(t):(g(t),function(t){const e=t.left+t.maxTextWidth>A?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((i=>i.setCoords().set({originX:e,left:t.left})))}(t)),T.hovered&&B(t)})),t.on("mouseup",(n=>{var r;if(h.show=!1,1===n.button){i&&function(t){var e,i;if("mark"===t.origin.key){if((null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),i=Math.min(...e);t.startPoint.limitX.x2=i}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=y(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};c.value.discardActiveObject(),f("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(m.point={x:t.left,y:t.top},m.show=!0,m.target=t,m.list=d.map((t=>({...t,renderItem:()=>t.label}))))}))}function B(t){const{key:e,data:i={}}=t.origin||{};let o=i.value;h.point={x:t.left,y:"mark"===e?t.top:t.top+I/2};const n=!t.origin.isMenu&&t.originLeft?t.originLeft:t.left,r=y(n);h.list=[`时间 ${r.slice(-5)}`],"mark"===e&&(o=i.name,h.list.unshift(o+" ")),h.sourceData=[{type:"other",key:e,time:r,value:o}],h.isTarget=!0,h.show=!0}function $(t){return t>=C&&t<=A}return function(){var t;if(!(null==(t=null==Y?void 0:Y.horizontal)?void 0:t.length))return;const{horizontal:i}=Y,o=C-5;let n=L+j/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l}=t,s=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r,isMenu:!0},originLeft:o,originTop:n});var d;(d=s).on("moving",(()=>{d.set("originX","center"),b(d)?B(d):h.show=!1})),d.on("mouseup:before",(t=>{if(h.show=!1,0===t.e.button&&b(d))if(X(H.get("horizontal"),d.left,"key",z).includes(d.origin.key))P("repeat"),console.log("重复节点");else{const t={data:{time:y(d.left),value:d.origin.defaultAddValue},...d.origin};f("add",t),G(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(d)})),c.value.add(s),n+=j}))}(),W(),V(),D(),n.on((()=>{const t="horizontal",e=p(H.get(t));e.length>0?v((()=>{const i=function(t){const e=t.reduce(((t,e)=>{const{dataIndex:i}=e.origin;return t[i]=t[i]?t[i].concat(e.origin):[e.origin],t}),{});return s(Object.keys(e).map((t=>{const i=e[t];return Y.horizontal[t].data.splice(i[0].index,i.length),i})))}(e);O({key:t}),f("remove",i)})):x()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};f(i,o),"remove"===i&&G(o,i)}}}export{c as useOther};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i}from"../useDraw.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import{bus as n}from"../useEvent.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getIndex as a}from"../../utils/index.js";import{cloneDeep as l,flatten as s}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as d}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function c(c,u,f,h,m,g,p,v,x){const{computedX:k,getXValue:y}=o(u),{getEqualXTypes:X,handleAddPrevent:P,isGridLimit:b,getPointEventProps:w}=r(c,f,u),{other:E,yCellHeight:j,xCellWidth:z,endX:A,originX:C,originY:L,endY:M,markHeight:S,event:T,topGridYCellHeight:I}=u,H=new Map,Y=l(E);function W(){var o;if(!(null==(o=null==Y?void 0:Y.horizontal)?void 0:o.length))return;const n="horizontal";H.set(n,[]);const{horizontal:r}=Y;let a=L+j/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:d={},textStyle:c={},data:u}=o;let f=null;u.forEach(((o,u)=>{const{time:h,value:m}=o,g=k(h);if(!$(g))return;const p=e(s,{...d,left:g,top:a}),v=g+p.width/2+2,x=i([v,a],{value:m,...c,originX:"left"}),y=new t.Group([p,x],{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer",...w()});Object.assign(y,{originLeft:g,iconHalfWidth:p.width/2,origin:{type:"other",key:n,dataIndex:r,index:u,data:o,title:l},limitX:{x1:C,x2:A-y.width}}),f&&(y.limitX.x1=f.left,f.limitX.x2=y.left,y.prevPoint=f,f.nextPoint=y),f=y,q(y),H.get(n).push(y)})),a+=j})),c.value.add(...H.get(n))}function V(){var t;if(!(null==(t=null==Y?void 0:Y.vertical)?void 0:t.length))return;const i="vertical";H.set(i,[]);const{vertical:o}=Y;o.forEach(((t,o)=>{const{show:n=!0,marginTop:r=0,textStyle:a={},data:l,time:s}=t,d=k(s);if(!n||!$(d))return;const{lineHeight:c=j}=a;let u=L+r+c/2;l.forEach(((t,n)=>{const r=e(String(t),{...a,lockMovementY:!0,left:d,originX:"left",top:u,origin:{type:"other",key:i,dataIndex:o,index:n,data:{value:t}},...w()});u+=c,q(r),H.get(i).push(r)}));const f=H.get(i).filter((t=>t.origin.dataIndex===o)),h=Math.max(...f.map((t=>t.width))),m=d>A-h;f.forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=h,m&&t.set("originX","right")}))})),c.value.add(...H.get(i))}function G(t,e="add"){const{dataIndex:i,data:o,index:n,key:r}=t,l=Y[r],s=["mark"].includes(r)?l.dataList[i]:l[i];switch(e){case"remove":s.data.splice(n,1);break;case"change":s.data[n]=o;break;default:{const t=Array.isArray(o)?o[0].time:o.time,e=a(t,s.data),i=Array.isArray(o)?o:[o];s.data.splice(e,0,...i);break}}O(t)}function O(t){var e;const{key:i}=t;switch(null==(e=c.value)||e.remove(...H.get(i)),H.delete(i),i){case"horizontal":W();break;case"vertical":V();break;case"mark":D()}}function D(){if(!(null==E?void 0:E.mark)||!S)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=E.mark,a=i([C-5,M+S/2],{value:t,...o,originX:"right"});c.value.add(a);const l=M+S,s=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=k(i);if(!$(r))return;let a=M;o.forEach((t=>{const{style:i}=t;let o=!1;const d=e((null==i?void 0:i.type)||"circleAndText",{...(null==i?void 0:i.pointAttr)||n,text:t.text,left:r,top:a,origin:{data:t,key:"mark",type:"other"}}),u=d.height;a+u<=l&&a>=M?(d.set("top",a+u/2),a+=u):(o||(a=M,o=!0),d.set("top",a-u/2),a-=u),s.push(d),q(d),c.value.add(d)}))})),function(t){const e=t=>{var e,i;return null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart},i=t.find((t=>e(t))),o=t.find((t=>!e(t)&&t.left>i.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:C,x2:A};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(s)}function q(t){if(T.hovered&&(t.on("mouseover",(()=>{B(t)})),t.on("mouseout",(()=>{h.show=!1}))),t.lockMovementX&&t.lockMovementY)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e);t.on("moving",(()=>{i?function(t){const e=t.origin.key,i="horizontal"===e;t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1+(i?1:0));t.left>t.limitX.x2&&t.set("left",t.limitX.x2+(i?-1:0));if("mark"===e){t.top<L&&t.set("top",L);const e=M+S-t.height/2;t.top>e&&t.set("top",e)}i&&(t.originLeft=t.left+t.iconHalfWidth)}(t):(g(t),function(t){const e=t.left+t.maxTextWidth>A?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((i=>i.setCoords().set({originX:e,left:t.left})))}(t)),T.hovered&&B(t)})),t.on("mouseup",(n=>{var r;if(h.show=!1,1===n.button){i&&function(t){var e,i;if("mark"===t.origin.key){if((null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),i=Math.min(...e);t.startPoint.limitX.x2=i}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=y(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};c.value.discardActiveObject(),f("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(m.point={x:t.left,y:t.top},m.show=!0,m.target=t,m.list=d.map((t=>({...t,renderItem:()=>t.label}))))}))}function B(t){const{key:e,data:i={}}=t.origin||{};let o=i.value;h.point={x:t.left,y:"mark"===e?t.top:t.top+I/2};const n=!t.origin.isMenu&&t.originLeft?t.originLeft:t.left,r=y(n);h.list=[`时间 ${r.slice(-5)}`],"mark"===e&&(o=i.name,h.list.unshift(o+" ")),h.sourceData=[{type:"other",key:e,time:r,value:o}],h.isTarget=!0,h.show=!0}function $(t){return t>=C&&t<=A}return function(){var t;if(!(null==(t=null==Y?void 0:Y.horizontal)?void 0:t.length))return;const{horizontal:i}=Y,o=C-5;let n=L+j/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l}=t,s=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r,isMenu:!0},originLeft:o,originTop:n});var d;(d=s).on("moving",(()=>{d.set("originX","center"),b(d)?B(d):h.show=!1})),d.on("mouseup:before",(t=>{if(h.show=!1,0===t.e.button&&b(d))if(X(H.get("horizontal"),d.left,"key",z).includes(d.origin.key))P("repeat"),console.log("重复节点");else{const t={data:{time:y(d.left),value:d.origin.defaultAddValue},...d.origin};f("add",t),G(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(d)})),c.value.add(s),n+=j}))}(),W(),V(),D(),n.on((()=>{const t="horizontal",e=p(H.get(t));e.length>0?v((()=>{const i=function(t){const e=t.reduce(((t,e)=>{const{dataIndex:i}=e.origin;return t[i]=t[i]?t[i].concat(e.origin):[e.origin],t}),{});return s(Object.keys(e).map((t=>{const i=e[t];return Y.horizontal[t].data.splice(i[0].index,i.length),i})))}(e);O({key:t}),f("remove",i)})):x()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};f(i,o),"remove"===i&&G(o,i)}}}export{c as useOther};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,watch as a,openBlock as t,createElementBlock as s,createCommentVNode as i,withDirectives as r,createElementVNode as o,normalizeClass as c,createVNode as d,unref as n,withCtx as f,Fragment as y,renderList as p,createBlock as b,createTextVNode as u,toDisplayString as m,vShow as g}from"vue";import{NAnchor as h,NAnchorLink as v}from"naive-ui";import C from"./iho-label-classify.vue.js";const w={key:0,class:"label-disable-wrap"},L=[o("p",{class:"label-disable-title"},"无可选标签",-1),o("p",{class:"label-disable-desc"},"请联系管理员进行标签管理设置",-1)],I={style:{height:"100%"}},x={class:"label-wrap"},k=["id"];var N=e({__name:"IhoLabelFormContent",props:{selectedList:{type:Array,default:()=>[]},categoryList:{type:Array,default:()=>[]},isChangeWindow:{type:Boolean,default:!1},explicit:{type:Boolean,default:!1}},emits:["explicitOnChange"],setup(e,{expose:N,emit:S}){const A=e,O=l(),$=l(null),_=()=>{var e;return null==(e=$.value)?void 0:e.querySelector(".right-label-wrap")},F=e=>{e.preventDefault()},W=(e,l,a)=>{let t=O.value||[];if(e)t.push({classifyId:a.classifyId,classifyName:a.classifyName,labelCode:l.labelCode,labelShowText:l.labelShowText,backgroundColor:l.backgroundColor});else{const e=t.findIndex((e=>e.classifyId===a.classifyId&&e.labelCode===l.labelCode));e>-1&&t.splice(e,1)}O.value=t,A.explicit&&S("explicitOnChange",t)};return a((()=>A.selectedList),(e=>{if(e){let l=Array.isArray(e)?e:[];O.value=JSON.parse(JSON.stringify(l))}}),{immediate:!0,deep:!0}),N({handleLabelForm:e=>{e([...O.value||[]])}}),(l,a)=>(t(),s("div",{class:"c-label-form-content",ref_key:"labelFormContent",ref:$},[e.categoryList.length?i("v-if",!0):(t(),s("div",w,L)),r(o("div",I,[o("div",x,[o("div",{class:c(["left-label-wrap",{"total-left-label-wrap":e.isChangeWindow}])},[d(n(h),{"offset-target":_,type:"block",onClick:F},{default:f((()=>[(t(!0),s(y,null,p(e.categoryList,(e=>(t(),b(n(v),{key:e.classifyId,href:`#${e.classifyId}-${e.classifyName}`,title:e.classifyName},null,8,["href","title"])))),128))])),_:1})],2),o("div",{class:c(["right-label-wrap",{"total-right-label-wrap":e.isChangeWindow}])},[(t(!0),s(y,null,p(e.categoryList,((e,l)=>(t(),s("div",{key:l,class:"edit-label-content"},[o("div",{class:"edit-label",id:`${e.classifyId}-${e.classifyName}`},[u(m(e.classifyName),1),i(" <span class=\"edit-label-type\">({{ v.multipleChoice == 2 ? '单' : '多' }}选)</span> ")],8,k),d(C,{categoryItem:e,selectedList:O.value,handleLabelChange:W},null,8,["categoryItem","selectedList"])])))),128))],2)])],512),[[g,e.categoryList.length>0]])],512))}});export{N as default};
1
+ import{defineComponent as e,ref as l,watch as a,openBlock as t,createElementBlock as s,createCommentVNode as i,withDirectives as o,createElementVNode as r,normalizeClass as c,createVNode as d,unref as n,withCtx as f,Fragment as y,renderList as p,createBlock as u,createTextVNode as b,toDisplayString as v,vShow as m}from"vue";import{NAnchor as g,NAnchorLink as h}from"naive-ui";import C from"./iho-label-classify.vue.js";const x={key:0,class:"label-disable-wrap"},w=[r("p",{class:"label-disable-title"},"无可选标签",-1),r("p",{class:"label-disable-desc"},"请联系管理员进行标签管理设置",-1)],L={style:{height:"100%"}},I={class:"label-wrap"},k=["id"];var N=e({__name:"IhoLabelFormContent",props:{selectedList:{type:Array,default:()=>[]},categoryList:{type:Array,default:()=>[]},isChangeWindow:{type:Boolean,default:!1},explicit:{type:Boolean,default:!1}},emits:["explicitOnChange"],setup(e,{expose:N,emit:S}){const A=e,O=l(),$=l(null),_=()=>{var e;return null==(e=$.value)?void 0:e.querySelector(".right-label-wrap")},F=e=>{e.preventDefault()},W=(e,l,a)=>{let t=O.value||[];if(e)l.exclusiveCode&&(t=t.filter((e=>e.exclusiveCode!=l.exclusiveCode))),t.push({classifyId:a.classifyId,classifyName:a.classifyName,labelCode:l.labelCode,labelShowText:l.labelShowText,backgroundColor:l.backgroundColor,fontColor:l.fontColor,exclusiveCode:l.exclusiveCode});else{const e=t.findIndex((e=>e.classifyId===a.classifyId&&e.labelCode===l.labelCode));e>-1&&t.splice(e,1)}O.value=t,A.explicit&&S("explicitOnChange",t)};return a((()=>A.selectedList),(e=>{if(e){let l=Array.isArray(e)?e:[];O.value=JSON.parse(JSON.stringify(l))}}),{immediate:!0,deep:!0}),N({handleLabelForm:e=>{e([...O.value||[]])}}),(l,a)=>(t(),s("div",{class:"c-label-form-content",ref_key:"labelFormContent",ref:$},[e.categoryList.length?i("v-if",!0):(t(),s("div",x,w)),o(r("div",L,[r("div",I,[r("div",{class:c(["left-label-wrap",{"total-left-label-wrap":e.isChangeWindow}])},[d(n(g),{"offset-target":_,type:"block",onClick:F},{default:f((()=>[(t(!0),s(y,null,p(e.categoryList,(e=>(t(),u(n(h),{key:e.classifyId,href:`#${e.classifyId}-${e.classifyName}`,title:e.classifyName},null,8,["href","title"])))),128))])),_:1})],2),r("div",{class:c(["right-label-wrap",{"total-right-label-wrap":e.isChangeWindow}])},[(t(!0),s(y,null,p(e.categoryList,((e,l)=>(t(),s("div",{key:l,class:"edit-label-content"},[r("div",{class:"edit-label",id:`${e.classifyId}-${e.classifyName}`},[b(v(e.classifyName),1),i(" <span class=\"edit-label-type\">({{ v.multipleChoice == 2 ? '单' : '多' }}选)</span> ")],8,k),d(C,{categoryItem:e,selectedList:O.value,handleLabelChange:W},null,8,["categoryItem","selectedList"])])))),128))],2)])],512),[[m,e.categoryList.length>0]])],512))}});export{N as default};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,reactive as i,watch as a,openBlock as o,createElementBlock as t,Fragment as n,createElementVNode as s,createBlock as d,unref as c,withCtx as r,renderList as p,normalizeStyle as h,createVNode as g,toDisplayString as m,createTextVNode as u,createCommentVNode as x,normalizeClass as b}from"vue";import{NSpace as f,NTag as C,NTooltip as y,NIcon as v,NModal as w}from"naive-ui";import{AddCircleOutline as L}from"@vicons/ionicons5";import W from"./IhoLabelFormContent.vue.js";const k={class:"c-select-label"},H={key:1,class:"outexplicit"},_=s("span",null,"选择标签",-1),z={class:"svg-wrap"};var I=e({__name:"IhoSelectLabel",props:{selectedList:{type:Array,default:()=>[]},categoryList:{type:Array,default:()=>[]},explicit:{type:Boolean,default:!1}},emits:["onChange"],setup(e,{emit:I}){const S=e,V=l(null),A=l(),F=i({labelVisible:!1,isChangeWindow:!1,modalWidth:"763px",modalHeight:"404px",maxHeight:"404px"}),O=()=>{S.explicit||(F.labelVisible=!0)},N=()=>{S.explicit||(F.modalWidth="763px",F.modalHeight="404px",F.maxHeight="404px",F.isChangeWindow=!1,F.labelVisible=!1)},E=()=>{F.isChangeWindow=!F.isChangeWindow;let e=document.body.clientHeight;F.modalWidth="763px"===F.modalWidth?"100%":"763px",F.modalHeight="404px"===F.modalHeight?e-110+"px":"404px",F.maxHeight="auto"===F.modalHeight?"404px":"none"},J=()=>{var e;null==(e=V.value)||e.handleLabelForm((e=>{I("onChange",[...e]),A.value=e,N()}))},R=()=>{J()};return a((()=>S.selectedList),(e=>{if(e){let l=Array.isArray(e)?e:[];A.value=JSON.parse(JSON.stringify(l))}}),{immediate:!0,deep:!0}),(l,i)=>(o(),t(n,null,[s("div",k,[e.explicit?x("v-if",!0):(o(),d(c(f),{key:0,align:"center"},{default:r((()=>[(o(!0),t(n,null,p(A.value,(e=>{return o(),d(c(C),{bordered:!1,key:`${e.classifyId}-${e.labelCode}`,class:"select-label-active",style:h((l=e,{background:l.backgroundColor,color:(null==l?void 0:l.fontColor)||"#fff",borderColor:l.backgroundColor})),size:"small",closable:"",onClose:l=>(e=>{const l=A.value||[],i=l.findIndex((l=>l.classifyId==e.classifyId&&l.labelCode==e.labelCode));i>-1&&l.splice(i,1),A.value=l,I("onChange",[...l])})(e)},{default:r((()=>[g(c(y),{placement:"top-start",duration:0},{trigger:r((()=>[s("span",null,m(e.labelShowText),1)])),default:r((()=>[s("span",null,m(e.labelShowText),1)])),_:2},1024)])),_:2},1032,["style","onClose"]);var l})),128)),e.explicit?x("v-if",!0):(o(),t("span",{key:0,class:"form-add-icon form-add-icon-label",onClick:O},[g(c(v),{class:"add-icon",component:c(L)},null,8,["component"]),u(" 新增 ")]))])),_:1})),e.explicit?(o(),t("div",H,[g(W,{ref_key:"labelFormContentRef",ref:V,categoryList:e.categoryList,selectedList:e.selectedList,isChangeWindow:F.isChangeWindow,explicit:e.explicit,onExplicitOnChange:R},null,8,["categoryList","selectedList","isChangeWindow","explicit"])])):x("v-if",!0)]),x(" 弹窗 "),g(c(w),{preset:"dialog",class:b(["label-form-modal-wrap modal-wrap standard-modal standard-modal-white",{"modal-screen":F.isChangeWindow}]),show:F.labelVisible,"onUpdate:show":i[0]||(i[0]=e=>F.labelVisible=e),onPositiveClick:J,onNegativeClick:N,onClose:N,"mask-closable":!1,"close-on-esc":!1,"show-icon":!1,"negative-text":"取消","positive-text":"确定",style:h({width:F.modalWidth})},{header:r((()=>[_,s("div",z,[s("i",{onClick:E,class:b(["iconfont-select-label",F.isChangeWindow?"icon-select-label-menzhenyishengzhanxitongtubiaozuixiaohua2":"icon-select-label-menzhenyishengzhanxitongtubiaozuidahua"])},null,2)])])),default:r((()=>[g(W,{ref_key:"labelFormContentRef",ref:V,categoryList:e.categoryList,selectedList:A.value,isChangeWindow:F.isChangeWindow,explicit:e.explicit,onExplicitOnChange:R},null,8,["categoryList","selectedList","isChangeWindow","explicit"])])),_:1},8,["show","class","style"])],64))}});export{I as default};
1
+ import{defineComponent as e,ref as l,reactive as i,watch as a,openBlock as o,createElementBlock as t,Fragment as n,createElementVNode as s,createBlock as d,unref as c,withCtx as r,renderList as p,normalizeStyle as h,createVNode as m,toDisplayString as g,createTextVNode as u,createCommentVNode as x,normalizeClass as b}from"vue";import{NSpace as f,NTag as C,NTooltip as y,NIcon as v,NModal as w}from"naive-ui";import{AddCircleOutline as L}from"@vicons/ionicons5";import{cloneDeep as W}from"lodash-es";import k from"./IhoLabelFormContent.vue.js";const H={class:"c-select-label"},_={key:1,class:"outexplicit"},z=s("span",null,"选择标签",-1),I={class:"svg-wrap"};var V=e({__name:"IhoSelectLabel",props:{selectedList:{type:Array,default:()=>[]},categoryList:{type:Array,default:()=>[]},explicit:{type:Boolean,default:!1}},emits:["onChange"],setup(e,{emit:V}){const A=e,F=l(null),S=l(),E=i({labelVisible:!1,isChangeWindow:!1,modalWidth:"763px",modalHeight:"404px",maxHeight:"404px"}),O=()=>{A.explicit||(E.labelVisible=!0)},R=()=>{A.explicit||(E.modalWidth="763px",E.modalHeight="404px",E.maxHeight="404px",E.isChangeWindow=!1,E.labelVisible=!1)},T=()=>{E.isChangeWindow=!E.isChangeWindow;let e=document.body.clientHeight;E.modalWidth="763px"===E.modalWidth?"100%":"763px",E.modalHeight="404px"===E.modalHeight?e-110+"px":"404px",E.maxHeight="auto"===E.modalHeight?"404px":"none"},$=()=>{var e;null==(e=F.value)||e.handleLabelForm((e=>{V("onChange",[...e]),S.value=e,R()}))},j=()=>{$()};return a((()=>A.selectedList),(e=>{if(e){let l=Array.isArray(e)?e:[];S.value=W(l)}}),{immediate:!0,deep:!0}),(l,i)=>(o(),t(n,null,[s("div",H,[e.explicit?x("v-if",!0):(o(),d(c(f),{key:0,align:"center"},{default:r((()=>[(o(!0),t(n,null,p(S.value,(e=>{return o(),d(c(C),{bordered:!1,key:`${e.classifyId}-${e.labelCode}`,class:"select-label-active",style:h((l=e,{background:l.backgroundColor,color:(null==l?void 0:l.fontColor)||"#fff",borderColor:l.backgroundColor})),size:"small",closable:"",onClose:l=>(e=>{const l=S.value||[],i=l.findIndex((l=>l.classifyId==e.classifyId&&l.labelCode==e.labelCode));i>-1&&l.splice(i,1),S.value=l,V("onChange",[...l])})(e)},{default:r((()=>[m(c(y),{placement:"top-start",duration:0},{trigger:r((()=>[s("span",null,g(e.labelShowText),1)])),default:r((()=>[s("span",null,g(e.labelShowText),1)])),_:2},1024)])),_:2},1032,["style","onClose"]);var l})),128)),e.explicit?x("v-if",!0):(o(),t("span",{key:0,class:"form-add-icon form-add-icon-label",onClick:O},[m(c(v),{class:"add-icon",component:c(L)},null,8,["component"]),u(" 新增 ")]))])),_:1})),e.explicit?(o(),t("div",_,[m(k,{ref_key:"labelFormContentRef",ref:F,categoryList:e.categoryList,selectedList:e.selectedList,isChangeWindow:E.isChangeWindow,explicit:e.explicit,onExplicitOnChange:j},null,8,["categoryList","selectedList","isChangeWindow","explicit"])])):x("v-if",!0)]),x(" 弹窗 "),m(c(w),{preset:"dialog",class:b(["label-form-modal-wrap modal-wrap standard-modal standard-modal-white",{"modal-screen":E.isChangeWindow}]),show:E.labelVisible,"onUpdate:show":i[0]||(i[0]=e=>E.labelVisible=e),onPositiveClick:$,onNegativeClick:R,onClose:R,"mask-closable":!1,"close-on-esc":!1,"show-icon":!1,"negative-text":"取消","positive-text":"确定",style:h({width:E.modalWidth})},{header:r((()=>[z,s("div",I,[s("i",{onClick:T,class:b(["iconfont-select-label",E.isChangeWindow?"icon-select-label-menzhenyishengzhanxitongtubiaozuixiaohua2":"icon-select-label-menzhenyishengzhanxitongtubiaozuidahua"])},null,2)])])),default:r((()=>[m(k,{ref_key:"labelFormContentRef",ref:F,categoryList:e.categoryList,selectedList:S.value,isChangeWindow:E.isChangeWindow,explicit:e.explicit,onExplicitOnChange:j},null,8,["categoryList","selectedList","isChangeWindow","explicit"])])),_:1},8,["show","class","style"])],64))}});export{V as default};
@@ -1 +1 @@
1
- var e="@cnhis-design-vue/shared",i="3.2.14-beta.6",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.2.14-beta.6",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};
1
+ var e="@cnhis-design-vue/shared",i="3.2.14-beta.8",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.2.14-beta.8",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.2.14-beta.6",
3
+ "version": "3.2.14-beta.8",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -72,5 +72,5 @@
72
72
  "iOS 7",
73
73
  "last 3 iOS versions"
74
74
  ],
75
- "gitHead": "79a9183fed1541ea5804fe4873c43c87acbdbf1b"
75
+ "gitHead": "ccb305d1aa11f4d63c00b3e8b6d5d563efeaf595"
76
76
  }