@cyber-harbour/ui 1.0.26 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Graph2D/Graph2D.tsx +19 -2
package/dist/index.mjs
CHANGED
|
@@ -387,7 +387,7 @@ import bo,{createGlobalStyle,styled,ThemeProvider,useTheme}from'styled-component
|
|
|
387
387
|
align-items: center;
|
|
388
388
|
justify-content: flex-end;
|
|
389
389
|
gap: 6px;
|
|
390
|
-
`;var ko=t(({isOpen:o,onClickOutside:e,onClick:s,anchor:i,size:a="medium",disabled:l,fullWidth:b,className:f,positions:m=["bottom"],align:h="start",children:C,hasBorder:w=true,maxHeight:S=500})=>{let P=useRef(null)
|
|
390
|
+
`;var ko=t(({isOpen:o,onClickOutside:e,onClick:s,anchor:i,size:a="medium",disabled:l,fullWidth:b,className:f,positions:m=["bottom"],align:h="start",children:C,hasBorder:w=true,maxHeight:S=500})=>{let P=useRef(null),$=useTheme();return jsx(Popover,{padding:$.contextMenu.padding,isOpen:o,positions:m,align:h,onClickOutside:e,content:C,containerStyle:{backgroundColor:$.colors.background,border:`1px solid ${$.colors.stroke.light}`,boxShadow:"0px 0px 10px 0px rgba(0, 0, 0, 0.25)",borderRadius:"5px",overflow:"auto",maxHeight:`${S}px`,zIndex:"9999"},children:jsxs(Pt,{ref:P,onClick:s,$disabled:l,$fullWidth:b,$size:a,className:f,type:"button",disabled:l,$hasBorder:w,children:[jsx("div",{children:i}),o?jsx(V1,{width:$.contextMenu.icon.size,height:$.contextMenu.icon.size}):jsx(B1,{width:$.contextMenu.icon.size,height:$.contextMenu.icon.size})]})})},"ContextMenu"),Pt=styled.button`
|
|
391
391
|
${({$size:o,$disabled:e,$fullWidth:s,theme:i,$hasBorder:a})=>{let l=L(i,o);return `
|
|
392
392
|
background: ${i.contextMenu.button.default.background};
|
|
393
393
|
color: ${i.contextMenu.button.default.text};
|
|
@@ -481,7 +481,7 @@ import bo,{createGlobalStyle,styled,ThemeProvider,useTheme}from'styled-component
|
|
|
481
481
|
cursor: not-allowed;
|
|
482
482
|
}
|
|
483
483
|
`}}
|
|
484
|
-
`;var F7=t(({size:o="small",disabled:e,className:s,positions:i=["bottom"],align:a="end",items:l})=>{let b=useRef(null),{isOpen:f,closeMenu:m,toggleMenu:h}=Eo(),C=useTheme();return jsx(Popover,{padding:C.contextMenu.padding,isOpen:f,positions:i,align:a,onClickOutside:m,content:jsx(Ft,{children:l.map(({label:w,onClick:S,color:P}
|
|
484
|
+
`;var F7=t(({size:o="small",disabled:e,className:s,positions:i=["bottom"],align:a="end",items:l})=>{let b=useRef(null),{isOpen:f,closeMenu:m,toggleMenu:h}=Eo(),C=useTheme();return jsx(Popover,{padding:C.contextMenu.padding,isOpen:f,positions:i,align:a,onClickOutside:m,content:jsx(Ft,{children:l.map(({label:w,onClick:S,color:P},$)=>jsx(U1,{variant:"empty",color:P,fullWidth:true,size:o,onClick:()=>{S(),m();},children:w},`row-action-${$}`))}),containerStyle:{backgroundColor:C.colors.background,border:`1px solid ${C.colors.stroke.light}`,boxShadow:"0px 0px 10px 0px rgba(0, 0, 0, 0.25)",borderRadius:"5px",zIndex:"9999"},children:jsx(zt,{ref:b,onClick:h,$disabled:e,$size:o,className:s,type:"button",disabled:e,children:jsx(G1,{width:C.rowActionsMenu.icon.size,height:C.rowActionsMenu.icon.size})})})},"RowActionsMenu"),zt=styled.button`
|
|
485
485
|
${({$size:o,$disabled:e,theme:s})=>{let i=L(s,o);return `
|
|
486
486
|
background: ${s.rowActionsMenu.button.default.background};
|
|
487
487
|
color: ${s.rowActionsMenu.button.default.text};
|
|
@@ -636,7 +636,7 @@ import bo,{createGlobalStyle,styled,ThemeProvider,useTheme}from'styled-component
|
|
|
636
636
|
}
|
|
637
637
|
`),Ot=styled.main`
|
|
638
638
|
min-width: 0;
|
|
639
|
-
`;var zo="./eye_light-EQXRQBFN.png";var Fo="./eye_light_hover-5XFRPJS4.png";var Lo="./cross_light-JTZWFLSV.png";var Zo="./cross_light_hover-UQZ7E3CW.png";var To=new Image;To.src=zo;var Ro=new Image;Ro.src=Fo;var Ao=new Image;Ao.src=Lo;var No=new Image;No.src=Zo;var Vi=t(({graphData:o,width:e,height:s,linkTarget:i,linkSource:a,config:l={fontSize:3,nodeSizeBase:30,nodeAreaFactor:2,textPaddingFactor:.9,gridSpacing:20,dotSize:1,maxZoom:4},onNodeClick:b,onLinkClick:f})=>{let[m,h]=useState(new Set),[C,w]=useState(new Set),[S,P]=useState(null),[
|
|
639
|
+
`;var zo="./eye_light-EQXRQBFN.png";var Fo="./eye_light_hover-5XFRPJS4.png";var Lo="./cross_light-JTZWFLSV.png";var Zo="./cross_light_hover-UQZ7E3CW.png";var To=new Image;To.src=zo;var Ro=new Image;Ro.src=Fo;var Ao=new Image;Ao.src=Lo;var No=new Image;No.src=Zo;var Vi=t(({graphData:o,width:e,height:s,linkTarget:i,linkSource:a,config:l={fontSize:3,nodeSizeBase:30,nodeAreaFactor:2,textPaddingFactor:.9,gridSpacing:20,dotSize:1,maxZoom:4},onNodeClick:b,onLinkClick:f})=>{let[m,h]=useState(new Set),[C,w]=useState(new Set),[S,P]=useState(null),[$,Xo]=useState(new Set),[r1,Wo]=useState(new Set),[A,T1]=useState(false),[N,R1]=useState(false),y=useRef(null),G=useRef(null),A1=t(n=>{let c=Math.min(n,l.maxZoom)/l.maxZoom;return Math.max(l.fontSize*c,l.fontSize)},"calculateFontSize"),Ko=useCallback((n,r)=>{let c=new Set,d=new Set;n&&(c.add(n),n.neighbors&&n.neighbors.forEach(p=>c.add(p)),n.links&&n.links.forEach(p=>d.add(p))),P(n||null),h(c),w(d);},[]),Jo=useCallback(n=>{let r=new Set,c=new Set;n&&(c.add(n),r.add(n.source),r.add(n.target)),h(r),w(c);},[]);useEffect(()=>{if(o&&(o.links.forEach(n=>{let r=typeof n.source=="object"?n.source:o.nodes.find(d=>d.id===n.source),c=typeof n.target=="object"?n.target:o.nodes.find(d=>d.id===n.target);!r||!c||(!r.neighbors&&(r.neighbors=[]),!c.neighbors&&(c.neighbors=[]),r.neighbors.push(c),c.neighbors.push(r),!r.links&&(r.links=[]),!c.links&&(c.links=[]),r.links.push(n),c.links.push(n));}),y.current?.d3Force("link")?.distance(n=>{let r=n.source,c=n.target,d=l.nodeSizeBase*2,p=r.size||l.nodeSizeBase,g=c.size||l.nodeSizeBase;return d+(p+g)}),y.current)){let n=y.current.d3Force("charge");n&&n.strength(-100).distanceMax(100);let r=y.current.d3Force("center");r&&r.strength(.05);try{let c=forceCollide().radius(d=>(d.size||l.nodeSizeBase)*1.5).iterations(3).strength(1);y.current.d3Force("collide",c);}catch{}y.current.resumeAnimation();}},[o]);let Uo=useCallback((n,r,c)=>{let d=l.nodeSizeBase*l.nodeAreaFactor*.75/2;r.beginPath(),r.arc(n.x,n.y,d,0,2*Math.PI,false),r.fillStyle="rgba(255, 165, 0, 0.3)",r.fill();},[l]),Yo=useCallback((n,r,c)=>{let{x:d,y:p}=n,g=l.nodeSizeBase*l.nodeAreaFactor/2;r.save(),r.beginPath(),r.arc(d,p,g,Math.PI,Math.PI*2,false),r.lineWidth=1,r.strokeStyle="#e5e5e5",r.stroke(),r.fillStyle=A?"rgba(230, 230, 230, 0.9)":"rgba(255, 255, 255, 0.8)",r.fill(),r.beginPath(),r.moveTo(d-g,p),r.lineTo(d+g,p),r.lineWidth=1,r.strokeStyle="#e5e5e5",r.stroke(),r.beginPath(),r.arc(d,p,g,Math.PI*2,Math.PI,false),r.lineWidth=1,r.strokeStyle="#e5e5e5",r.stroke(),r.fillStyle=N?"rgba(230, 230, 230, 0.9)":"rgba(255, 255, 255, 0.8)",r.fill();let u=g*.3,x=A?No:Ao,M=t(()=>{try{r.drawImage(x,d-u/2,p-g*2/4-u-1,u,u);}catch{}},"renderCrossIcon");x.complete?M():(x.onload=()=>{M();},x.onerror=()=>{});let I=N?Ro:To,v=t(()=>{try{r.drawImage(I,d-u/2,p+g*2/4+1,u,u);}catch{}},"renderEyeIcon");I.complete?v():(I.onload=()=>{v();},I.onerror=()=>{}),r.restore();},[l,A,N]),m1=t((n,r)=>{r&&r.id&&!n.has(`${r.id}`)&&o&&o.links.filter(d=>d.source.id===r.id&&d.label!=="MATCH").forEach(d=>{n.add(`${d.target.id}`),m1(n,d.target);});},"collapseNode"),qo=t(n=>{let r=new Set($);m1(r,n),r.add(n.id),Xo(r);},"handleHideNode"),Qo=t(n=>{let r=new Set(r1);m1(r,n),Wo(r);},"handleCollapseChildren"),X=useCallback((n,r,c,d,p,g,u)=>{let x=n-c,M=r-d,I=Math.sqrt(x*x+M*M),v=Math.atan2(M,x);v<0&&(v+=2*Math.PI);let E=I>=p*.5&&I<=p*1.5,D=false;return g===Math.PI&&u===Math.PI*2?D=v>=Math.PI&&v<=Math.PI*2:g===0&&u===Math.PI?D=v>=0&&v<=Math.PI:D=g<=u&&v>=g&&v<=u||g>u&&(v>=g||v<=u),E&&D},[]);useEffect(()=>{let n=t(r=>{if(!S||!y.current||!G.current){A&&T1(false),N&&R1(false);return}l.nodeSizeBase;let d=l.nodeSizeBase*l.nodeAreaFactor/2,p=y.current.zoom()||1,g=S.x,u=S.y,x=G.current.getBoundingClientRect(),M=r.clientX-x.left,I=r.clientY-x.top,v=G.current.clientWidth/x.width,k=G.current.clientHeight/x.height,z=M*v,E=I*k,D={x:G.current.clientWidth/2,y:G.current.clientHeight/2},B,V;if(typeof y.current.graph2ScreenCoords=="function"){let S1=y.current.graph2ScreenCoords(g,u);S1&&(B=S1.x,V=S1.y);}(B===void 0||V===void 0)&&(B=D.x+g*p,V=D.y+u*p);let W=X(z,E,B,V,d*p,Math.PI,Math.PI*2),n0=X(z,E,B,V,d*p,0,Math.PI);T1(W),R1(n0);},"handleCanvasMouseMove");return G.current&&G.current.addEventListener("mousemove",n),()=>{G.current&&G.current.removeEventListener("mousemove",n);}},[S,l,X,A,N]);let jo=t((n,r,c)=>{if(!n)return "";if(c.measureText(n).width<=r)return n;let p=n,g="...";for(;c.measureText(p+g).width>r&&p.length>0;)p=p.slice(0,-1);return p+g},"truncateText"),o0=t((n,r)=>{n.getTransform(),n.save(),n.setTransform(1,0,0,1,0,0);let{width:c,height:d}=n.canvas,p=l.gridSpacing,g=l.dotSize;n.fillStyle="rgba(0, 0, 0, 0.5)";for(let u=0;u<c;u+=p)for(let x=0;x<d;x+=p)n.beginPath(),n.arc(u,x,g,0,2*Math.PI),n.fill();n.restore();},"renderGrid"),e0=t((n,r,c,d)=>{let{x:p,y:g}=n,u=l.nodeSizeBase;c.beginPath(),c.arc(p,g,u,0,2*Math.PI),c.fillStyle=r,c.fill();},"renderNodePointerAreaPaint"),t0=t((n,r,c)=>{m.has(n)&&(n===S?Yo(n,r,c):Uo(n,r,c));let{x:d,y:p,color:g,label:u}=n,x=l.nodeSizeBase,M=l.nodeSizeBase/2;r.beginPath(),r.arc(d,p,M,0,2*Math.PI),r.fillStyle=g,r.fill(),r.save(),r.translate(d,p);let I=A1(c),v=x*l.textPaddingFactor;r.font=`${I}px Sans-Serif`,r.textAlign="center",r.textBaseline="middle",r.fillStyle="black";let k=jo(u,v,r);r.fillText(k,0,0),r.restore();},"renderNodeCanvasObject"),r0=t((n,r,c)=>{let{source:d,target:p,label:g}=n;if(!g)return;let u={x:d.x,y:d.y},x={x:p.x,y:p.y},M=u.x+(x.x-u.x)/2,I=u.y+(x.y-u.y)/2,v=A1(c);r.font=`${v}px Sans-Serif`,r.fillStyle="#666",r.textAlign="center",r.textBaseline="middle";let k=Math.atan2(x.y-u.y,x.x-u.x);r.save(),r.translate(M,I),Math.abs(k)>Math.PI/2?(r.rotate(k+Math.PI),r.textAlign="center"):(r.rotate(k),r.textAlign="center");let z=r.measureText(g).width,E=2;r.fillStyle=C.has(n)?"rgba(255, 230, 204, 0.9)":"rgba(255, 255, 255, 0.8)",r.fillRect(-z/2-E,-v/2-E,z+E*2,v+E*2),r.fillStyle=C.has(n)?"#663300":"#666",r.fillText(g,0,0),r.restore();},"renderLinkCanvasObject");return jsx(Yt,{ref:G,children:jsx(Kt,{ref:y,width:e,height:s,graphData:o,linkTarget:i,linkSource:a,onLinkClick:f,onNodeClick:t((n,r)=>{if(!n||!y.current)return;let c=l.nodeSizeBase*l.nodeAreaFactor/2,d=y.current.zoom()||1,p=r.target,g=n.x,u=n.y,x=p.getBoundingClientRect(),M=r.clientX-x.left,I=r.clientY-x.top,v=p.width/x.width,k=p.height/x.height,z=M*v,E=I*k,D={x:p.width/2,y:p.height/2},B,V;if(typeof y.current.graph2ScreenCoords=="function"){let W=y.current.graph2ScreenCoords(g,u);W&&(B=W.x,V=W.y);}if((B===void 0||V===void 0)&&(B=D.x+g*d,V=D.y+u*d),X(z,E,B,V,c*d,Math.PI,Math.PI*2)){qo(S),r.stopPropagation();return}if(X(z,E,B,V,c*d,0,Math.PI)){Qo(S),r.stopPropagation();return}b&&b(n);},"handleNodeClick"),nodeLabel:n=>`${n.label||""}`,linkLabel:n=>n.label,nodeAutoColorBy:"label",linkDirectionalArrowLength:3.5,linkDirectionalArrowRelPos:1,linkCurvature:0,maxZoom:l.maxZoom,minZoom:1,onNodeHover:Ko,onLinkHover:Jo,linkWidth:n=>C.has(n)?3:1,linkColor:n=>C.has(n)?"#ff9900":"#999",onRenderFramePre:o0,nodePointerAreaPaint:e0,nodeCanvasObject:t0,linkCanvasObjectMode:()=>"after",linkCanvasObject:r0,linkVisibility:n=>!($.has(n.source.id)||$.has(n.target.id)||r1.has(n.source.id)||r1.has(n.target.id)),nodeVisibility:n=>!($.has(n.id)||r1.has(n.id))})})},"Graph2D"),Yt=styled.div`
|
|
640
640
|
display: inline-block;
|
|
641
641
|
`;export{f0 as AlertIcon,b0 as ApiIcon,m0 as ArrowCircleTopRightIcon,S0 as ArrowRightIcon,G1 as BallsMenu,v0 as BugReportIcon,U1 as Button,w0 as CalendarIcon,me as CheckIcon,B1 as ChevronDownIcon,C1 as ChevronLeftIcon,v1 as ChevronRightIcon,V1 as ChevronUpIcon,$0 as ClosedLockIcon,ko as ContextMenu,n7 as ContextMenuDelimiter,Ie as CrossIcon,k0 as DataSetsIcon,G0 as DeepSearchIcon,B0 as DisabledVisibleIcon,D0 as DocsIcon,F0 as DownloadIcon,Z0 as EditUserIcon,H0 as EnableVisibleIcon,T0 as EnterArrowLeftIcon,R0 as FiltersIcon,N1 as GlobalStyle,Vi as Graph2D,e5 as Header,s5 as HeaderDelimeter,p5 as HeaderSection,N0 as HomepageIcon,D1 as InfoCircleFilledIcon,X0 as InfoCircleIcon,A7 as Input,L4 as ListMenu,T4 as ListMenuItem,W4 as ListMenuSection,K0 as MapRadarIcon,U0 as MoonIcon,Y0 as OpenLockIcon,Q0 as OrganizationIcon,ci as PageLayout,O5 as Pagination,oe as PasswordFinderIcon,te as PhonebookIcon,Se as PlusIcon,ne as PrintIcon,ie as Profiler2Icon,le as ProfilerIcon,F7 as RowActionsMenu,ce as SandBoxIcon,m7 as Select,q3 as Sidebar,T as SidebarContext,h4 as SidebarDelimeter,i4 as SidebarItem,m4 as SidebarSection,de as StatisticIcon,Ht as StyledContainer,he as SunIcon,E5 as Table,hr as ThemeProvider,Ae as Typography,Pe as UnfoldIcon,ue as UpRightArrowCircleIcon,ve as UsersIcon,be as VectorIcon,n1 as convertPaletteToRem,lr as darkTheme,tr as getBreakpoint,L as getButtonSizeStyles,K as getButtonStyles,er as getTypographyStyles,J1 as lightTheme,K1 as lightThemePx,X1 as pxToRem,W1 as resolveThemeColor,Eo as useContextMenuControl};//# sourceMappingURL=index.mjs.map
|
|
642
642
|
//# sourceMappingURL=index.mjs.map
|