@owox/web 0.35.0 → 0.37.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/dist/assets/ModelCanvas-By1wBUBL.js +2 -0
- package/dist/assets/RelationshipCanvas-HaHLbPRS.js +1 -0
- package/dist/assets/erd-fields-section-CDkC1Pzu.js +12 -0
- package/dist/assets/index-DPgXWGfA.css +1 -0
- package/dist/assets/index-Dr0TbJRt.js +46 -0
- package/dist/assets/index-IRYqNEd8.js +1758 -0
- package/dist/assets/lucide-icon-catalog-BIDsv2NX.js +6591 -0
- package/dist/assets/pencil-line-BP_bhkzs.js +6 -0
- package/dist/assets/zoom-out-CcoidGXK.js +16 -0
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/ModelCanvas-BmvwRtKX.js +0 -2
- package/dist/assets/RelationshipCanvas-BJwnmPDj.js +0 -1
- package/dist/assets/erd-fields-section-w0MuCbrx.js +0 -27
- package/dist/assets/index-BobN8jFh.js +0 -46
- package/dist/assets/index-CHid1y1x.js +0 -1457
- package/dist/assets/index-OJoOSyiH.css +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{ac as e}from"./index-IRYqNEd8.js";/**
|
|
2
|
+
* @license lucide-react v0.475.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const a=[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]],t=e("PencilLine",a);export{t as P};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{ac as e}from"./index-IRYqNEd8.js";/**
|
|
2
|
+
* @license lucide-react v0.475.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const y=[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}]],n=e("Locate",y);/**
|
|
7
|
+
* @license lucide-react v0.475.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const c=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],i=e("ZoomIn",c);/**
|
|
12
|
+
* @license lucide-react v0.475.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const o=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],k=e("ZoomOut",o);export{n as L,i as Z,k as a};
|
package/dist/index.html
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<link rel="icon" type="image/png" href="/favicon.png" />
|
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
8
8
|
<title>OWOX</title>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-IRYqNEd8.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DPgXWGfA.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body translate="no" class="notranslate">
|
|
13
13
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BobN8jFh.js","assets/erd-fields-section-w0MuCbrx.js","assets/index-CHid1y1x.js","assets/index-OJoOSyiH.css","assets/erd-fields-section-BnuhLJ6X.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as a,j as t,k as Ne,S as nt,l as oe,P as st,m as at,D as re,n as it,o as ot,p as rt,L as lt,q as ct,s as dt,T as Re,a as Oe,R as ut,H as ft,b as _e,t as pt,v as ht,w as gt,I as mt,E as xt,x as bt,y as N,z as wt,A as Et,_ as Ct,F as Te,G as le,c as ce}from"./index-CHid1y1x.js";import{I as vt,J as jt,K as St,s as yt,v as Dt,w as Lt,W as It,o as fe,t as Nt,B as Rt,D as Pe,x as Ot,y as _t,z as Tt,A as Pt,u as kt,P as X,n as de,H as we,S as Ee,Q as At,a as Mt,b as $t,N as Ft,R as Ut,c as Ht,d as ue,e as Qt,f as Ce,p as Gt,r as Vt,h as ve,T as Bt,U as qt,i as zt,L as Wt,Z as Kt,j as Jt,C as Yt,k as Zt,M as Xt,l as en,q as tn}from"./erd-fields-section-w0MuCbrx.js";const nn=(n,e)=>[n,e].sort().join("->"),sn=56;function an(n,e=sn){const r=new Map;for(const i of n){if(i.sourceId===i.targetId)continue;const d=nn(i.sourceId,i.targetId),h=r.get(d);h?h.push(i):r.set(d,[i])}const u=new Map;for(const i of n)i.sourceId===i.targetId&&u.set(i.id,0);for(const i of r.values()){const d=[...i].sort((m,b)=>m.id.localeCompare(b.id)),h=d.length;d.forEach((m,b)=>{u.set(m.id,(b-(h-1)/2)*e)})}return u}const on=212,je=116,rn=256,ln=88;function pe(n){return n==="erd"?rn:on}function ke(n,e,r=!1,u=!1){const i=(r?-36:0)+(u?-30:0);if(e!=="erd")return je+i;const d=n.fields??[];if(d.length===0)return je+i;const h=vt(d),m=d.length>h;return ln+i+h*jt+(m?St:0)}function cn(n,e,r,u,i,d){let h,m,b,y;if(d==="vertical"){const g=Math.max(40,Math.abs(u-e)*.3);h=n+i,m=e+g,b=r+i,y=u-g}else{const g=Math.max(40,Math.abs(r-n)*.3);h=n+g,m=e+i,b=r-g,y=u+i}return{path:`M ${n} ${e} C ${h} ${m}, ${b} ${y}, ${r} ${u}`,labelX:(n+3*h+3*b+r)/8,labelY:(e+3*m+3*y+u)/8}}function dn({id:n,sourceX:e,sourceY:r,targetX:u,targetY:i,sourcePosition:d,targetPosition:h,selected:m,data:b}){const{bowOffset:y,warning:g,joinLabel:x,dimmed:E,direction:w,bidirectional:R}=b;let v;if(y!==0)v=cn(e,r,u,i,y,w);else{const[O,I,M]=yt({sourceX:e,sourceY:r,sourcePosition:d,targetX:u,targetY:i,targetPosition:h});v={path:O,labelX:I,labelY:M}}const j=g?It:m?fe:Nt,D=a.useId(),L=Dt("mc-arrow",D);return t.jsxs(t.Fragment,{children:[t.jsx(Lt,{markerId:L,color:j,withStart:R}),t.jsx(Rt,{id:n,path:v.path,markerEnd:`url(#${L}-end)`,markerStart:R?`url(#${L}-start)`:void 0,style:{stroke:j,strokeWidth:m?_t:Tt,strokeDasharray:g?Ot:void 0,opacity:E?Pe:1,transition:"opacity 0.2s, stroke 0.2s"}}),t.jsx(Pt,{x:v.labelX,y:v.labelY,lines:x,selected:m??!1,dimmed:E})]})}const un=100,fn=200;function B(n,e){return`${n} ${e}${n===1?"":"s"}`}function pn({dataMartTitle:n,summary:e,onOpenQuality:r,onRunQuality:u}){const[i,d]=a.useState(!1),[h,m]=a.useState(!1),b=a.useRef(null),y=a.useRef(null),g=a.useRef(null),x=a.useRef(null),E=a.useRef(null),w=a.useRef(!1),R=a.useRef(!1),v=a.useRef(!1),j=Ne(e),D=j.icon,L=[{count:e.errorChecks,singular:"execution error",tone:"error",icon:nt},{count:e.errorFindings,singular:"critical finding",tone:"error",icon:oe},{count:e.warningFindings,singular:"warning finding",tone:"warning",icon:oe},{count:e.noticeFindings,singular:"notice finding",tone:"notice",icon:oe}].filter(l=>l.count>0),O=(e.state==="ISSUES"||e.state==="EXECUTION_FAILED")&&L.length>0,I=L.map(l=>B(l.count,l.singular)).join(", "),M=`Open Data Quality for ${n}: ${j.label}${O?`, ${I}`:""}`,C=j.isActive,te=e.state==="QUEUED"?"Queued":e.state==="RUNNING"?"Started":"Last checked";function H(){x.current!==null&&(clearTimeout(x.current),x.current=null)}function q(){E.current!==null&&(clearTimeout(E.current),E.current=null)}function A(){H(),q()}function K(){q(),!(i||w.current||x.current!==null)&&(x.current=setTimeout(()=>{x.current=null,!w.current&&d(!0)},un))}function _(){H(),!(!i||w.current||E.current!==null)&&(E.current=setTimeout(()=>{E.current=null,!w.current&&d(!1)},fn))}function P(l){if(l.stopPropagation(),l.preventDefault(),A(),w.current&&i){w.current=!1,d(!1);return}w.current=!0,d(!0),l.detail===0&&queueMicrotask(()=>{var S;(S=g.current)==null||S.focus()})}function ne(l){if(A(),l){w.current=!0,d(!0);return}w.current=!1,d(!1)}function se(l){l.stopPropagation(),l.preventDefault(),r()}async function ae(l){if(l.stopPropagation(),l.preventDefault(),!(C||h)){m(!0);try{await u()}finally{m(!1)}}}return a.useEffect(()=>()=>{x.current!==null&&clearTimeout(x.current),E.current!==null&&clearTimeout(E.current)},[]),a.useEffect(()=>{if(!i)return;function l(S){var Q,$;const T=S.target;T instanceof Node&&((Q=b.current)!=null&&Q.contains(T)||($=y.current)!=null&&$.contains(T)||(x.current!==null&&(clearTimeout(x.current),x.current=null),E.current!==null&&(clearTimeout(E.current),E.current=null),w.current=!1,d(!1)))}return document.addEventListener("pointerdown",l,!0),()=>{document.removeEventListener("pointerdown",l,!0)}},[i]),t.jsxs(st,{open:i,onOpenChange:ne,children:[t.jsx(at,{asChild:!0,children:t.jsx("button",{ref:b,type:"button",className:`${O?"":re[j.tone]} -ml-0.5 inline-flex shrink-0 cursor-pointer items-center rounded p-0.5 transition-colors ${O?"gap-1.5":""}`,"aria-label":M,onPointerDown:l=>{l.stopPropagation()},onPointerEnter:()=>{K()},onPointerLeave:()=>{_()},onFocus:()=>{if(v.current){v.current=!1;return}K()},onBlur:()=>{_()},onClick:P,children:O?L.map(l=>{const S=B(l.count,l.singular),T=l.icon;return t.jsxs("span",{role:"img","aria-label":S,className:`${re[l.tone]} inline-flex items-center gap-0.5`,children:[t.jsx(T,{className:"size-4","aria-hidden":!0}),t.jsx("span",{className:"leading-none font-medium tabular-nums",children:l.count})]},l.singular)}):t.jsx(D,{className:`size-4 ${e.state==="RUNNING"?"animate-spin":""}`,"aria-hidden":!0})})}),t.jsxs(it,{ref:y,side:"top",align:"center",role:"region","aria-label":`Data Quality checks for ${n}`,className:"w-72 max-w-72 p-3 text-xs sm:w-72 sm:max-w-72",onOpenAutoFocus:l=>{l.preventDefault()},onCloseAutoFocus:l=>{var S;l.preventDefault(),R.current&&(R.current=!1,v.current=!0,(S=b.current)==null||S.focus({preventScroll:!0}),queueMicrotask(()=>{v.current=!1}))},onEscapeKeyDown:()=>{R.current=!0},onPointerEnter:()=>{q()},onPointerLeave:()=>{_()},onPointerDown:l=>{l.stopPropagation()},children:[t.jsxs("div",{className:"border-border flex items-center justify-between gap-3 border-b pb-2",children:[t.jsx(ot,{className:"text-sm font-semibold whitespace-nowrap",children:"Data Quality checks"}),t.jsx("span",{className:`${re[j.tone]} shrink-0 font-medium whitespace-nowrap`,children:j.label})]}),t.jsxs("div",{className:"text-muted-foreground space-y-1 py-2",children:[e.enabledChecks>0&&t.jsxs("p",{children:[e.enabledChecks," enabled"]}),C?t.jsx("p",{children:"Terminal results will be available after this run finishes."}):t.jsxs(t.Fragment,{children:[e.passedChecks>0&&t.jsxs("p",{children:[e.passedChecks," passed"]}),e.notApplicableChecks>0&&t.jsxs("p",{children:[e.notApplicableChecks," not applicable"]}),e.errorChecks>0&&t.jsx("p",{children:B(e.errorChecks,"execution error")}),e.errorFindings>0&&t.jsx("p",{children:B(e.errorFindings,"critical finding")}),e.warningFindings>0&&t.jsx("p",{children:B(e.warningFindings,"warning finding")}),e.noticeFindings>0&&t.jsx("p",{children:B(e.noticeFindings,"notice finding")})]}),e.lastRunAt&&t.jsx("p",{className:"text-foreground pt-2 pb-1 font-medium",children:`${te} ${rt(e.lastRunAt)}`})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsx("button",{ref:g,type:"button",className:"border-input bg-background hover:bg-muted inline-flex cursor-pointer items-center justify-center rounded-md border px-3 py-1.5 font-medium transition-colors","aria-label":`Open Data Quality page for ${n}`,onPointerDown:l=>{l.stopPropagation()},onClick:se,children:"Open"}),t.jsxs("button",{type:"button",className:"bg-primary text-primary-foreground hover:bg-primary/90 inline-flex cursor-pointer items-center justify-center gap-1.5 rounded-md px-3 py-1.5 font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50","aria-label":`Run Quality for ${n}`,title:C?"A Data Quality run is already active":void 0,disabled:C||h,onPointerDown:l=>{l.stopPropagation()},onClick:l=>{ae(l)},children:[h?t.jsx(lt,{className:"size-3.5 animate-spin","aria-hidden":"true"}):t.jsx(ct,{className:"size-3.5","aria-hidden":"true"}),h?"Starting…":"Run checks"]})]})]})]})}function hn({dataMartTitle:n,block:e,isChecking:r=!1}){const u=r?"checking…":dt(e);return t.jsxs(Re,{children:[t.jsx(Oe,{asChild:!0,children:t.jsx("button",{type:"button",className:`nodrag inline-flex cursor-default items-center rounded p-0.5 transition-colors ${r||e!=null&&e.dataLastUpdatedAt?"text-muted-foreground hover:text-foreground":"text-muted-foreground/50 hover:text-muted-foreground"}`,"aria-label":`Data Last Updated for ${n}: ${u}`,onPointerDown:i=>{i.stopPropagation()},children:r?t.jsx(ut,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":"true"}):t.jsx(ft,{className:"h-3.5 w-3.5","aria-hidden":"true"})})}),t.jsx(_e,{side:"top",align:"start",role:"tooltip",className:"max-w-xs",children:r?t.jsx("div",{className:"text-xs",children:"Checking Data Last Updated…"}):e?t.jsx(pt,{block:e}):t.jsx("div",{className:"text-xs",children:"Data Last Updated has not been checked yet. Use Actions → Check Data Last Updated to measure the visible Data Marts."})})]})}function gn({id:n,data:e,selected:r}){const[u,i]=a.useState(!1),d=kt();a.useEffect(()=>{d(n)},[u,n,d]);const h=ht[Ne(e.qualitySummary).tone],m=e.viewMode==="erd",b=e.fields,y=m&&b.length>0,g=e.objectLabels??gt,x=!g.source,E=!g.fields,w=!g.status,R=x&&!!e.definitionType,v=w&&R,j=g.source&&g.fields&&g.status,D=j?"pl-3.5":"pl-[16px]",L=e.direction==="vertical"?X.Top:X.Left,O=e.direction==="vertical"?X.Bottom:X.Right,I=`Open ${e.title} in new tab`;function M(C){C.stopPropagation(),C.preventDefault(),e.onOpenExternal()}return t.jsxs("div",{className:"bg-background relative flex cursor-grab flex-col overflow-hidden rounded-sm border shadow-sm active:cursor-grabbing",style:{width:pe(e.viewMode),borderColor:e.highlighted?de:r?fe:void 0,boxShadow:e.highlighted?`0 0 0 3px ${de}40, 0 0 12px ${de}60`:r?`0 0 0 1px ${fe}`:void 0,opacity:e.dimmed?Pe:1,filter:e.dimmed?"grayscale(0.8)":void 0,animation:e.highlighted?"node-pulse 1.5s ease-in-out infinite":void 0,transition:"opacity 0.2s, filter 0.2s"},children:[!j&&t.jsx("span",{className:`absolute inset-y-0 top-0 bottom-0 left-0 w-1 rounded-tr-full rounded-br-full ${h}`,"aria-hidden":"true"}),e.hasIncoming&&t.jsx(we,{type:"target",position:L,isConnectable:!1,style:Ee}),t.jsxs("div",{className:`flex items-center gap-2 pt-3 pr-3.5 ${D} ${j?"pb-3":"pb-1"}`,children:[t.jsx("span",{className:"text-foreground flex-1 truncate text-[13px] font-semibold",title:e.title,children:e.title}),e.description&&t.jsxs(Re,{children:[t.jsx(Oe,{asChild:!0,children:t.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground nodrag inline-flex cursor-default rounded p-0.5 transition-colors","aria-label":`Description for ${e.title}`,onPointerDown:C=>{C.stopPropagation()},children:t.jsx(mt,{className:"h-3.5 w-3.5","aria-hidden":"true"})})}),t.jsx(_e,{side:"top",align:"center",role:"tooltip",className:"max-w-xs",children:e.description})]}),t.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground nodrag shrink-0 cursor-pointer rounded p-0.5 transition-colors",onPointerDown:C=>{C.stopPropagation()},onClick:M,title:I,"aria-label":I,children:t.jsx(xt,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]}),(w||x)&&t.jsxs("div",{className:`text-muted-foreground flex items-center ${v?"gap-0":"gap-1"} pt-1 pr-3.5 text-[11px] ${D}`,children:[w&&t.jsx(At,{isDraft:e.isDraft,joined:v}),x&&t.jsx(Mt,{type:e.definitionType,joined:v})]}),!j&&t.jsxs("div",{className:`text-muted-foreground flex items-center gap-1 pt-1.5 pr-3.5 pb-3 text-[11px] ${D}`,children:[t.jsx(pn,{dataMartTitle:e.title,summary:e.qualitySummary,onOpenQuality:e.onOpenQuality,onRunQuality:e.onRunQuality}),t.jsx(hn,{dataMartTitle:e.title,block:e.dataLastUpdated,isChecking:e.isCheckingDataLastUpdated}),E&&t.jsxs("span",{className:"ml-auto shrink-0",children:[e.fieldCount," field",e.fieldCount!==1?"s":""]})]}),y&&t.jsx($t,{fields:b,expanded:u,onToggleExpanded:()=>{i(C=>!C)}}),e.hasOutgoing&&t.jsx(we,{type:"source",position:O,isConnectable:!1,style:Ee})]})}const Se="model-canvas-layout",ye="model-canvas-show-join-fields",De="model-canvas-view-mode",Le="model-canvas-object-labels",mn="model-canvas-positions";function ee(n){return`${mn}:${n}`}function xn(n){if(!n)return{};const e=N.get(ee(n),"json");if(!e)return{};const r={};for(const[u,i]of Object.entries(e)){const d=i;d&&typeof d.x=="number"&&typeof d.y=="number"&&(r[u]={x:d.x,y:d.y})}return r}const W=.2,bn=150,wn={modelCanvasNode:gn},En={modelCanvasEdge:dn};function Cn(n){return JSON.stringify(n.map(({id:e,title:r,status:u,description:i,fieldCount:d,definitionType:h,fields:m})=>({id:e,title:r,status:u,description:i,fieldCount:d,definitionType:h,fields:m})))}function vn(n){return JSON.stringify(n)}function Ie(n,e){const r=e(n),u=a.useRef({signature:r,value:n});return u.current.signature!==r&&(u.current={signature:r,value:n}),u.current.value}function jn(n){const{node:e,highlight:r,viewMode:u,objectLabels:i}=n,d=i.source&&i.status,h=i.source&&i.fields&&i.status;return{id:e.id,type:"modelCanvasNode",position:n.position,width:pe(u),height:ke(e,u,d,h),draggable:!0,selectable:!1,focusable:!1,deletable:!1,style:tn,data:{title:e.title,isDraft:e.status===Te.DRAFT,fieldCount:e.fieldCount,description:e.description,definitionType:e.definitionType??null,fields:e.fields??[],viewMode:u,objectLabels:i,dataLastUpdated:e.dataLastUpdated,isCheckingDataLastUpdated:n.isCheckingDataLastUpdated,hasIncoming:n.hasIncoming,hasOutgoing:n.hasOutgoing,highlighted:r.highlighted,dimmed:r.dimmed,direction:n.direction,onOpenExternal:n.onOpenExternal,qualitySummary:e.qualitySummary,onOpenQuality:n.onOpenQuality,onRunQuality:n.onRunQuality}}}function Sn(n){return n.joinConditions.map(e=>`${e.sourceFieldName} = ${e.targetFieldName}`)}function yn(n){const{edge:e,warning:r}=n;return{id:e.id,type:"modelCanvasEdge",source:e.sourceId,target:e.targetId,focusable:!1,selectable:!0,deletable:!1,data:{bowOffset:n.bowOffset,warning:r,joinLabel:n.joinLabel,dimmed:n.dimmed,direction:n.direction,bidirectional:e.bidirectional}}}function Dn({nodes:n,edges:e,searchQuery:r,onOpenDataMart:u,onOpenQuality:i,onRunQuality:d,isCheckingDataLastUpdated:h=!1,storageId:m,storageTitle:b,exportApiRef:y}){const g=Ht(),x=ue(o=>o.width),E=ue(o=>o.height),w=ue(o=>o.domNode),R=a.useRef(u);R.current=u;const v=a.useRef(i);v.current=i;const j=a.useRef(d);j.current=d;const D=a.useRef(n);D.current=n;const L=a.useRef(r);L.current=r;const O=a.useRef(h);O.current=h;const[I,M]=a.useState(()=>bt(N.get(Se))),[C,te]=a.useState(()=>wt(N.get(De))),[H,q]=a.useState(()=>N.get(ye,"boolean")??!1),[A,K]=a.useState(()=>Et(N.get(Le))),_=a.useRef(null),P=a.useRef(m);(_.current===null||P.current!==m)&&(P.current=m,_.current=xn(m));const[ne,se]=a.useState(0),[ae,l]=a.useState(!1),[S,T]=a.useState([]),[Q,$]=a.useState([]),he=a.useMemo(()=>Qt(S),[S]),G=Ie(n,Cn),F=Ie(e,vn);a.useImperativeHandle(y,()=>({exportCanvas:async o=>{const{exportModelCanvas:p}=await Ct(async()=>{const{exportModelCanvas:c}=await import("./index-BobN8jFh.js");return{exportModelCanvas:c}},__vite__mapDeps([0,1,2,3,4]));return p(o,{viewport:(w==null?void 0:w.querySelector(".react-flow__viewport"))??null,flowNodes:S,nodes:n,edges:e,storageTitle:b})}}),[w,S,n,e,b]),a.useEffect(()=>{const o=new Set(F.map(s=>s.targetId)),p=new Set(F.map(s=>s.sourceId)),c=new Map(G.map(s=>[s.id,s.status===Te.DRAFT])),f=Ce(G,L.current,s=>s.id,s=>s.title),k=A.source&&A.status,V=G.map(s=>({id:s.id,width:pe(C),height:ke(s,C,k)})),z=H?new Map(F.map(s=>[s.id,Sn(s)])):new Map,J=F.map(s=>({id:s.id,sourceId:s.sourceId,targetId:s.targetId,label:Gt(z.get(s.id)??[])})),{positions:Y}=Vt(V,J,I),Ke=an(F),Je=new Set(G.map(s=>s.id)),ge=Object.entries(_.current??{}),Z=Object.fromEntries(ge.filter(([s])=>Je.has(s)));ge.length!==Object.keys(Z).length&&(_.current=Z,P.current&&N.set(ee(P.current),Z));const Ye=new Map(D.current.map(s=>[s.id,s.qualitySummary])),Ze=new Map(D.current.map(s=>[s.id,s.dataLastUpdated]));T(G.map(s=>jn({node:{...s,qualitySummary:Ye.get(s.id)??s.qualitySummary,dataLastUpdated:Ze.get(s.id)??s.dataLastUpdated},position:Z[s.id]??Y.get(s.id)??{x:0,y:0},hasIncoming:o.has(s.id),hasOutgoing:p.has(s.id),highlight:f.get(s.id)??ve,direction:I,viewMode:C,objectLabels:A,onOpenExternal:()=>{R.current(s.id)},onOpenQuality:()=>{v.current(s.id)},onRunQuality:()=>j.current(s.id),isCheckingDataLastUpdated:O.current}))),$(F.map(s=>{var xe,be;const et=((xe=f.get(s.sourceId))==null?void 0:xe.dimmed)??!1,tt=((be=f.get(s.targetId))==null?void 0:be.dimmed)??!1;return yn({edge:s,joinLabel:z.get(s.id)??[],bowOffset:Ke.get(s.id)??0,warning:s.joinNotConfigured||(c.get(s.sourceId)??!1)||(c.get(s.targetId)??!1),dimmed:et&&tt,direction:I})})),l(!0);const me=[...f.entries()].filter(([,s])=>s.highlighted).map(([s])=>s),Xe=requestAnimationFrame(()=>{g.fitView(me.length>0?{nodes:me.map(s=>({id:s})),duration:300,padding:W}:{padding:W,duration:300})});return()=>{cancelAnimationFrame(Xe)}},[G,F,I,ne,C,H,A,g]);const Ae=a.useCallback(o=>{T(p=>Bt(o,p))},[]),Me=a.useCallback(o=>{$(p=>qt(o,p))},[]),[U,ie]=a.useState(null),$e=a.useCallback((o,p)=>{ie(c=>c===p.id?null:p.id),$(c=>c.some(f=>f.selected)?c.map(f=>f.selected?{...f,selected:!1}:f):c)},[]),Fe=a.useCallback(()=>{ie(null)},[]),Ue=a.useCallback(()=>{ie(null)},[]),He=a.useMemo(()=>U?S.map(o=>o.id===U?{...o,selected:!0}:o):S,[S,U]),Qe=a.useMemo(()=>U?Q.map(o=>o.source===U||o.target===U?{...o,selected:!0}:o):Q,[Q,U]),Ge=a.useCallback((o,p)=>{const c=_.current??{};c[p.id]={x:p.position.x,y:p.position.y},_.current=c,P.current&&N.set(ee(P.current),c)},[]);a.useEffect(()=>{const o=new Map(n.map(c=>[c.id,c.qualitySummary])),p=new Map(n.map(c=>[c.id,c.dataLastUpdated]));T(c=>c.map(f=>{const k=o.get(f.id)??f.data.qualitySummary,V=p.has(f.id)?p.get(f.id)??null:f.data.dataLastUpdated;return f.data.qualitySummary!==k||f.data.dataLastUpdated!==V?{...f,data:{...f.data,qualitySummary:k,dataLastUpdated:V}}:f}))},[n]),a.useEffect(()=>{T(o=>o.map(p=>p.data.isCheckingDataLastUpdated===h?p:{...p,data:{...p.data,isCheckingDataLastUpdated:h}}))},[h]),a.useEffect(()=>{const o=Ce(D.current,r,c=>c.id,c=>c.title);T(c=>c.map(f=>{const k=o.get(f.id)??ve;return f.data.highlighted===k.highlighted&&f.data.dimmed===k.dimmed?f:{...f,data:{...f.data,...k}}})),$(c=>c.map(f=>{var J,Y;const k=((J=o.get(f.source))==null?void 0:J.dimmed)??!1,V=((Y=o.get(f.target))==null?void 0:Y.dimmed)??!1,z=k&&V;return f.data.dimmed===z?f:{...f,data:{...f.data,dimmed:z}}}));const p=[...o.entries()].filter(([,c])=>c.highlighted).map(([c])=>c);p.length>0&&g.fitView({nodes:p.map(c=>({id:c})),duration:300,padding:W})},[r,g]);const Ve=a.useCallback(o=>{M(o),N.set(Se,o),_.current={},P.current&&N.remove(ee(P.current)),se(p=>p+1)},[]),Be=a.useCallback(o=>{K(p=>le(p)===le(o)?p:(N.set(Le,le(o)),o))},[]),qe=a.useCallback(o=>{te(o),N.set(De,o)},[]),ze=a.useCallback(o=>{q(o),N.set(ye,o)},[]),We=a.useCallback((o,p)=>{if(x===0||E===0)return;const c=zt(p,he,x,E,bn);c.x===p.x&&c.y===p.y||g.setViewport(c)},[he,E,x,g]);return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"absolute top-3 right-3 z-10 flex flex-col gap-1.5",children:[t.jsx(ce,{variant:"outline",size:"icon",className:"h-12 w-12",onClick:()=>{g.fitView({padding:W,duration:300})},"aria-label":"Fit to view",children:t.jsx(Wt,{className:"h-6 w-6"})}),t.jsx(ce,{variant:"outline",size:"icon",className:"h-12 w-12",onClick:()=>{g.zoomIn({duration:150})},"aria-label":"Zoom in",children:t.jsx(Kt,{className:"h-6 w-6"})}),t.jsx(ce,{variant:"outline",size:"icon",className:"h-12 w-12",onClick:()=>{g.zoomOut({duration:150})},"aria-label":"Zoom out",children:t.jsx(Jt,{className:"h-6 w-6"})}),t.jsx(Yt,{viewMode:C,onViewModeChange:qe,direction:I,onDirectionChange:Ve,showJoinFields:H,onShowJoinFieldsChange:ze,objectLabels:A,onObjectLabelsChange:Be})]}),ae&&t.jsx(Zt,{nodes:He,edges:Qe,nodeTypes:wn,edgeTypes:En,onNodesChange:Ae,onEdgesChange:Me,onNodeDragStop:Ge,onNodeClick:$e,onEdgeClick:Ue,onPaneClick:Fe,deleteKeyCode:null,nodesDraggable:!0,nodesConnectable:!1,elementsSelectable:!0,edgesFocusable:!1,minZoom:.05,maxZoom:2,onMove:We,fitView:!0,fitViewOptions:{padding:W},proOptions:{hideAttribution:!0},style:{width:"100%",height:"100%"},children:t.jsx(Xt,{pannable:!0,zoomable:!0,style:{width:140,height:100},nodeColor:en})})]})}function Nn({nodes:n,edges:e,searchQuery:r,onOpenDataMart:u,onOpenQuality:i,onRunQuality:d,isCheckingDataLastUpdated:h,storageId:m,storageTitle:b,exportApiRef:y,className:g,style:x}){return n.length===0?null:t.jsxs("div",{className:`relative overflow-hidden ${g??""}`,style:x??{height:480},children:[t.jsx("style",{children:Ft}),t.jsx(Ut,{children:t.jsx(Dn,{nodes:n,edges:e,searchQuery:r,onOpenDataMart:u,onOpenQuality:i,onRunQuality:d,isCheckingDataLastUpdated:h,storageId:m,storageTitle:b,exportApiRef:y})})]})}export{Nn as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as De,r,j as s,C as Se,N as Oe,T as _e,a as ve,I as Ae,b as Me,E as Re,B as ke,c as U,M as Pe,g as Te,d as Le,e as He,h as Fe,i as ue,f as Ge}from"./index-CHid1y1x.js";import{g as We,N as Ke,R as ze,u as Be,P as J,E as ge,H as Q,S as ee,a as $e,b as Ye,c as Ze,d as he,e as Ve,f as Xe,h as Ue,i as Je,L as qe,Z as Qe,j as et,C as tt,k as st,M as it,l as nt,O as at,W as ne,m as ot,D as xe,n as te,o as ie,p as rt,r as lt,q as ct,s as dt,t as ut,v as gt,w as ht,B as ft,x as mt,y as pt,z as xt,A as bt,F as Nt,G as Ct}from"./erd-fields-section-w0MuCbrx.js";const $=3,be=.05,Et=1e-4,fe=1;function yt(i,e,l,p){const c=i.maxX-i.minX,h=i.maxY-i.minY;return c<=0||h<=0||e<=0||l<=0?null:We({x:i.minX,y:i.minY,width:c,height:h},e,l,be,$,p)}function It(i){const e=Number.isFinite(i)&&i>0?Math.min(i,$):fe;return{min:e>=$?fe:e,max:$}}function jt(i,e,l){if(!Number.isFinite(i)||i<=0)return null;const p=i*(1+e),c=Math.min(Math.max(p,l.min),l.max);return!Number.isFinite(c)||Math.abs(c-i)<Et||e>0!=c>i?null:{zoom:c,delta:c/i-1}}const Y=240,Ne=48,q=92,wt=.85,se=1/wt-1,Dt=150,St=ot;function me({data:i}){const e=Te(i);if(!e)return null;const l=e.kind==="attention";return s.jsxs("span",{title:l?Le:void 0,style:{position:"absolute",top:-18,right:4,display:"inline-flex",alignItems:"center",gap:2,fontSize:10,fontWeight:600,color:l?at:ne,lineHeight:1,whiteSpace:"nowrap"},children:[l&&s.jsx(He,{style:{width:12,height:12,color:St}}),e.label]})}function Ce(i){return i==="erd"?Nt:Y}function pe(i,e){return{width:i.isSource?Y:Ce(i.viewMode),borderColor:i.highlighted?te:Fe(i)?ne:e?ie:void 0,boxShadow:i.highlighted?`0 0 0 3px ${te}40, 0 0 12px ${te}60`:e?`0 0 0 1px ${ie}`:void 0,opacity:i.dimmed?xe:1,filter:i.dimmed?"grayscale(0.8)":void 0,animation:i.highlighted?"node-pulse 1.5s ease-in-out infinite":void 0,transition:"opacity 0.2s, filter 0.2s",cursor:"pointer"}}function Ot({id:i,data:e,selected:l}){const[p,c]=r.useState(!1),h=Be();r.useEffect(()=>{h(i)},[p,i,h]);const b=e.objectLabels,N=!b.source,d=!b.fields,S=!b.status,O=e.direction==="vertical"?J.Top:J.Left,C=e.direction==="vertical"?J.Bottom:J.Right;function _(f){f.stopPropagation(),f.preventDefault(),e.onOpenExternal()}if(e.isSource)return s.jsxs("div",{className:"bg-primary/5 relative flex items-center gap-2 rounded-xl border shadow-sm",style:{...pe(e,l),height:Ne,padding:"0 14px"},children:[s.jsx(me,{data:e}),s.jsx("span",{className:"text-foreground flex-1 truncate text-[13px] font-semibold",title:e.label,children:e.label}),S&&s.jsx(ge,{isDraft:e.isDraft,decorative:!0}),e.hasOutgoing&&s.jsx(Q,{type:"source",position:C,isConnectable:!1,style:ee})]});const y=`Open ${e.label} in new tab`,I=e.viewMode==="erd"&&e.fields.length>0;return s.jsxs("div",{title:e.isCycleStub?Se:void 0,className:"bg-background relative flex flex-col rounded-xl border shadow-sm",style:pe(e,l),children:[s.jsx(me,{data:e}),s.jsx(Q,{type:"target",position:O,isConnectable:!1,style:ee}),s.jsxs("div",{className:"flex items-center gap-2 px-3.5 pt-3 pb-1",children:[s.jsx("span",{className:"text-foreground flex-1 truncate text-[13px] font-semibold",title:e.label,children:e.label}),S&&s.jsx(ge,{isDraft:e.isDraft,decorative:!0}),!e.userHasAccess&&s.jsx(Oe,{}),e.description&&s.jsxs(_e,{children:[s.jsx(ve,{asChild:!0,children:s.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground inline-flex cursor-default rounded p-0.5 transition-colors","aria-label":`Description for ${e.label}`,onPointerDown:f=>{f.stopPropagation()},children:s.jsx(Ae,{className:"h-3.5 w-3.5","aria-hidden":"true"})})}),s.jsx(Me,{side:"top",align:"center",role:"tooltip",className:"max-w-xs",children:e.description})]}),s.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground shrink-0 cursor-pointer rounded p-0.5 transition-colors",onPointerDown:f=>{f.stopPropagation()},onClick:_,title:y,"aria-label":y,children:s.jsx(Re,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]}),s.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-3.5 pt-1 pb-3",children:[N&&s.jsx($e,{type:e.definitionType}),e.targetAlias&&s.jsx(ke,{variant:"secondary",className:"inline-block max-w-[90px] truncate px-1.5 py-0 text-[10px]",title:e.targetAlias,children:e.targetAlias}),d&&s.jsxs("span",{className:"text-muted-foreground ml-auto shrink-0 text-[11px]",children:[e.fieldCount??0," field",e.fieldCount!==1?"s":""]})]}),I&&s.jsx(Ye,{fields:e.fields,expanded:p,onToggleExpanded:()=>{c(f=>!f)}}),e.hasOutgoing&&s.jsx(Q,{type:"source",position:C,isConnectable:!1,style:ee})]})}function _t({id:i,sourceX:e,sourceY:l,targetX:p,targetY:c,sourcePosition:h,targetPosition:b,selected:N,data:d}){const[S,O,C]=dt({sourceX:e,sourceY:l,sourcePosition:h,targetX:p,targetY:c,targetPosition:b}),_=d.warning?ne:N?ie:ut,y=r.useId(),I=gt("rel-arrow",y);return s.jsxs(s.Fragment,{children:[s.jsx(ht,{markerId:I,color:_,withStart:!1}),s.jsx(ft,{id:i,path:S,markerEnd:`url(#${I}-end)`,style:{stroke:_,strokeWidth:N?pt:xt,strokeDasharray:d.warning?mt:void 0,opacity:d.dimmed?xe:1,transition:"opacity 0.2s, stroke 0.2s"}}),s.jsx(bt,{x:O,y:C,lines:d.joinLabel,selected:N??!1,dimmed:d.dimmed})]})}const vt={relationshipNode:Ot},At={relationshipEdge:_t};function Mt(i){return JSON.stringify([i.nodes.map(e=>[e.id,e.data.isSource,e.data.label,e.data.targetAlias,e.data.fieldCount,e.data.description,e.data.isDraft,e.data.isBlocked,e.data.isJoinNotConfigured,e.data.isCycleStub,e.data.isMissingPrimaryKey,e.data.userHasAccess,e.data.hasOutgoing]),i.edges.map(e=>[e.id,e.source,e.target,e.data.warning])])}function Rt(i,e,l){return i?Ne:l!=="erd"?q:q+Ct(e)}function kt({dataMartId:i,dataMartTitle:e,dataMartDescription:l,dataMartStatus:p,rootDefinitionType:c,definitionTypes:h,initialRelationships:b,graph:N,fieldCounts:d,showLooped:S,statusFilter:O,viewMode:C,objectLabels:_,direction:y,showJoinFields:I,fieldsByAliasPath:f,onOpenExternal:P}){let F=0;const R=(t,a)=>a&&!S||O!=="all"&&t!==O?(F++,!1):!0,v=new Map,A=[],G=new Set,T=p==="DRAFT";v.set(i,{dmId:i,title:e,description:l,depth:0,isSource:!0,isDraft:T,userHasAccess:!0});const u=new Map;u.set("",i);function E(t,a,w,x,K){const D=`path:${x}`;A.push({sourceId:t,targetId:D,joinLabel:I?K.map(V=>`${V.sourceFieldName} = ${V.targetFieldName}`):[]}),G.add(t),v.set(D,{dmId:a,aliasPath:x,...w}),u.set(x,D)}if(N)for(const t of N.nodes){const a=t.aliasPath.lastIndexOf("."),w=a===-1?"":t.aliasPath.slice(0,a),x=u.get(w);x&&R(t.relationship.targetDataMart.status,t.isCycleStub)&&E(x,t.relationship.targetDataMart.id,{title:t.relationship.targetDataMart.title,description:t.relationship.targetDataMart.description,depth:t.depth,isSource:!1,targetAlias:t.relationship.targetAlias,fieldCount:(d==null?void 0:d.get(t.relationship.id))??0,isDraft:t.relationship.targetDataMart.status==="DRAFT",isBlocked:t.isBlocked,isJoinNotConfigured:t.relationship.joinConditions.length===0,isCycleStub:t.isCycleStub,isMissingPrimaryKey:ue(t.relationship.targetDataMart.hasPrimaryKey,t.relationship.joinConditions.length),userHasAccess:t.relationship.targetDataMart.userHasAccess},t.aliasPath,t.relationship.joinConditions)}else for(const t of b)R(t.targetDataMart.status,t.targetDataMart.id===i)&&E(i,t.targetDataMart.id,{title:t.targetDataMart.title,description:t.targetDataMart.description,depth:1,isSource:!1,targetAlias:t.targetAlias,fieldCount:(d==null?void 0:d.get(t.id))??0,isDraft:t.targetDataMart.status==="DRAFT",isBlocked:T,isJoinNotConfigured:t.joinConditions.length===0,isCycleStub:t.targetDataMart.id===i,isMissingPrimaryKey:ue(t.targetDataMart.hasPrimaryKey,t.joinConditions.length),userHasAccess:t.targetDataMart.userHasAccess},t.targetAlias,t.joinConditions);const j=new Map,k=new Map,L=new Map;for(const[t,a]of v){const w=a.isSource||a.aliasPath===void 0?[]:(f==null?void 0:f.get(a.aliasPath))??[];j.set(t,w),k.set(t,a.isSource?Y:Ce(C)),L.set(t,Rt(a.isSource,w,C))}const g=[...v.keys()].map(t=>({id:t,width:k.get(t)??Y,height:L.get(t)??q})),Z=A.map(t=>({id:`${t.sourceId}->${t.targetId}`,sourceId:t.sourceId,targetId:t.targetId,label:rt(t.joinLabel)})),{positions:W}=lt(g,Z,y),M=[];for(const[t,a]of v)M.push({id:t,type:"relationshipNode",position:W.get(t)??{x:0,y:0},width:k.get(t)??Y,height:L.get(t)??q,draggable:!1,selectable:!1,focusable:!1,style:ct,data:{isSource:a.isSource,label:a.title,targetAlias:a.targetAlias,fieldCount:a.fieldCount,description:a.description,definitionType:a.isSource?c:(h==null?void 0:h.get(a.dmId))??null,isDraft:a.isDraft??!1,isBlocked:a.isBlocked??!1,isJoinNotConfigured:a.isJoinNotConfigured??!1,isCycleStub:a.isCycleStub??!1,isMissingPrimaryKey:a.isMissingPrimaryKey??!1,userHasAccess:a.userHasAccess,hasOutgoing:G.has(t)&&!a.isCycleStub,highlighted:!1,dimmed:!1,fields:j.get(t)??[],viewMode:C,objectLabels:_,direction:y,onOpenExternal:()=>{P(a.dmId)}}});const H=[];for(const t of A){const a=v.get(t.sourceId),w=v.get(t.targetId);if(!a||!w)continue;const x=Ge(a,w);H.push({id:`${t.sourceId}->${t.targetId}`,type:"relationshipEdge",source:t.sourceId,target:t.targetId,focusable:!1,selectable:!1,data:{warning:x,dimmed:!1,joinLabel:t.joinLabel}})}return{nodes:M,edges:H,filteredOutCount:F}}function Pt({dataMartId:i,dataMartTitle:e,dataMartDescription:l,dataMartStatus:p,dataMartDefinitionType:c,definitionTypes:h,relationships:b,relationshipGraph:N,connectedFieldCounts:d,searchQuery:S,onRequestFullscreen:O,onOpenExternal:C,showLooped:_,statusFilter:y,viewMode:I,onViewModeChange:f,direction:P,onDirectionChange:F,showJoinFields:R,onShowJoinFieldsChange:v,objectLabels:A,onObjectLabelsChange:G,fieldsByAliasPath:T}){const u=Ze(),E=he(n=>n.width),j=he(n=>n.height),k=r.useRef(!1),L=r.useRef(!1),g=r.useMemo(()=>kt({dataMartId:i,dataMartTitle:e,dataMartDescription:l,dataMartStatus:p,rootDefinitionType:c??null,definitionTypes:h,initialRelationships:b,graph:N,fieldCounts:d,showLooped:_,statusFilter:y,viewMode:I,objectLabels:A,direction:P,showJoinFields:R,fieldsByAliasPath:T,onOpenExternal:C}),[i,e,l,p,c,h,b,N,d,_,y,I,A,P,R,T,C]),[Z,W]=r.useState(null),[M,H]=r.useState(null),t=r.useMemo(()=>Mt(g),[g]),a=r.useMemo(()=>Ve(g.nodes),[g.nodes]),w=r.useRef(t),x=r.useMemo(()=>yt(a,E,j,se),[a,E,j]),K=r.useMemo(()=>It((x==null?void 0:x.zoom)??Number.NaN),[x]);r.useEffect(()=>{w.current!==t&&(w.current=t,L.current=!1,H(n=>n!==null&&g.nodes.some(o=>o.id===n)?n:null),W(n=>n!==null&&g.edges.some(o=>o.id===n)?n:null))},[t,g]);const D=r.useMemo(()=>Xe(g.nodes,S,n=>n.id,n=>n.data.label),[g.nodes,S]),V=r.useMemo(()=>g.nodes.map(n=>{const o=D.get(n.id)??Ue,m=n.id===M;return n.data.highlighted===o.highlighted&&n.data.dimmed===o.dimmed&&(n.selected??!1)===m?n:{...n,selected:m,data:{...n.data,...o}}}),[g.nodes,D,M]),Ee=r.useMemo(()=>g.edges.map(n=>{var ce,de;const o=(((ce=D.get(n.source))==null?void 0:ce.dimmed)??!1)&&(((de=D.get(n.target))==null?void 0:de.dimmed)??!1),m=n.id===Z||M!==null&&(n.source===M||n.target===M);return n.data.dimmed===o&&(n.selected??!1)===m?n:{...n,selected:m,data:{...n.data,dimmed:o}}}),[g.edges,D,Z,M]),ye=r.useCallback((n,o)=>{W(m=>m===o.id?null:o.id),H(null)},[]),Ie=r.useCallback((n,o)=>{H(m=>m===o.id?null:o.id),W(null)},[]),je=r.useCallback(()=>{W(null),H(null)},[]),ae=r.useRef(D);ae.current=D;const X=r.useCallback(()=>{const n=[...ae.current.entries()].filter(([,o])=>o.highlighted).map(([o])=>o);n.length!==0&&u.fitView({nodes:n.map(o=>({id:o})),duration:300,padding:se})},[u]),B=r.useCallback(()=>u.fitView({minZoom:be,maxZoom:$,padding:se}),[u]),oe=r.useRef(x);oe.current=x;const re=r.useCallback(()=>{const n=oe.current;return n?u.setViewport(n):B()},[B,u]),z=r.useCallback(()=>{L.current=!0},[]);r.useEffect(()=>{E===0||j===0||L.current||re().then(()=>{k.current=!0,X()})},[E,j,t,re,X]),r.useEffect(()=>{k.current&&X()},[D,X]);const le=r.useCallback(n=>{z();const o=u.getZoom();if(!Number.isFinite(o)||o<=0){B();return}const m=jt(o,n,K);m&&u.zoomTo(m.zoom,{duration:150})},[B,z,u,K]),we=r.useCallback((n,o)=>{if(E===0||j===0||!Number.isFinite(o.zoom))return;const m=Je(o,a,E,j,Dt);m.x===o.x&&m.y===o.y||u.setViewport(m)},[a,j,E,u]);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"absolute top-3 right-3 z-10 flex items-start gap-2",children:s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(U,{variant:"outline",size:"icon",className:"h-12 w-12",onClick:()=>{z(),B()},"aria-label":"Fit to view",children:s.jsx(qe,{className:"h-6 w-6"})}),s.jsx(U,{variant:"outline",size:"icon",className:"h-12 w-12",onClick:()=>{le(.25)},"aria-label":"Zoom in",children:s.jsx(Qe,{className:"h-6 w-6"})}),s.jsx(U,{variant:"outline",size:"icon",className:"h-12 w-12",onClick:()=>{le(-.25)},"aria-label":"Zoom out",children:s.jsx(et,{className:"h-6 w-6"})}),O&&s.jsx(U,{variant:"outline",size:"icon",className:"h-12 w-12",onClick:O,"aria-label":"Expand diagram",children:s.jsx(Pe,{className:"h-6 w-6"})}),s.jsx(tt,{viewMode:I,onViewModeChange:f,direction:P,onDirectionChange:F,showJoinFields:R,onShowJoinFieldsChange:v,objectLabels:A,onObjectLabelsChange:G})]})}),s.jsxs("div",{className:"h-full w-full",onPointerDownCapture:z,onWheelCapture:z,children:[s.jsx(st,{nodes:V,edges:Ee,nodeTypes:vt,edgeTypes:At,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,edgesFocusable:!1,zoomOnDoubleClick:!1,minZoom:K.min,maxZoom:K.max,onEdgeClick:ye,onNodeClick:Ie,onPaneClick:je,deleteKeyCode:null,panActivationKeyCode:null,onMove:we,onMoveStart:n=>{n&&z()},proOptions:{hideAttribution:!0},style:{width:"100%",height:"100%"},children:s.jsx(it,{pannable:!0,zoomable:!0,style:{width:140,height:100},nodeColor:nt})}),g.nodes.length===1&&g.filteredOutCount>0&&s.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-6 flex justify-center",children:s.jsx("span",{className:"bg-background text-muted-foreground rounded-md border px-3 py-1.5 text-sm shadow-sm",children:"No related data marts match the current filters"})})]})]})}function Ht({dataMartId:i,dataMartTitle:e,dataMartDescription:l,dataMartStatus:p,dataMartDefinitionType:c,definitionTypes:h,relationships:b,relationshipGraph:N,connectedFieldCounts:d,searchQuery:S,onRequestFullscreen:O,showLooped:C,statusFilter:_,viewMode:y,onViewModeChange:I,direction:f,onDirectionChange:P,showJoinFields:F,onShowJoinFieldsChange:R,objectLabels:v,onObjectLabelsChange:A,fieldsByAliasPath:G,className:T,style:u}){const{scope:E}=De(),j=r.useCallback(k=>{window.open(E(`/data-marts/${k}/data-setup`),"_blank","noopener,noreferrer")},[E]);return b.length===0?null:s.jsxs("div",{className:`relative overflow-hidden rounded-lg border ${T??""}`,style:u??{height:480},children:[s.jsx("style",{children:Ke}),s.jsx(ze,{children:s.jsx(Pt,{dataMartId:i,dataMartTitle:e,dataMartDescription:l,dataMartStatus:p,dataMartDefinitionType:c,definitionTypes:h,relationships:b,relationshipGraph:N,connectedFieldCounts:d,searchQuery:S,onRequestFullscreen:O,onOpenExternal:j,showLooped:C,statusFilter:_,viewMode:y,onViewModeChange:I,direction:f,onDirectionChange:P,showJoinFields:F,onShowJoinFieldsChange:R,objectLabels:v,onObjectLabelsChange:A,fieldsByAliasPath:G})})]})}export{Ht as RelationshipCanvas,Ot as RelationshipFlowNode};
|