@yuku123/z-cognition-component 1.0.2 → 1.0.3
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/{ConceptsPage-C8nsSzRc.js → ConceptsPage-CLEcHolu.js} +11 -10
- package/dist/{ConceptsPage-BH4lEiVn.cjs → ConceptsPage-DfloraCZ.cjs} +1 -1
- package/dist/OntologyDetailPage-BIZLIZ23.js +192 -0
- package/dist/OntologyDetailPage-CEGX8Ykd.cjs +1 -0
- package/dist/{OntologyInferPage-FoVA-toR.cjs → OntologyInferPage-Bzgd_iDk.cjs} +1 -1
- package/dist/{OntologyMaterializePage-CUPoItSa.cjs → OntologyMaterializePage-CjrmDG7j.cjs} +2 -2
- package/dist/OntologyNodesPage-CiGsZLSG.js +270 -0
- package/dist/OntologyNodesPage-Do8cnOwY.cjs +1 -0
- package/dist/{OntologyValidatePage-40ZvGGH4.cjs → OntologyValidatePage-Dqzp4hWg.cjs} +2 -2
- package/dist/{TermDetailPage-BiF5UVM5.js → TermDetailPage-CPPzVMdp.js} +20 -20
- package/dist/{TermDetailPage-DQcYkPdm.cjs → TermDetailPage-Dbl2_C80.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/ontology-graph.cjs +1 -0
- package/dist/ontology-graph.js +50 -0
- package/dist/pages.cjs +1 -1
- package/dist/pages.js +35 -35
- package/dist/use-g6-graph-2-Pr4oTs.js +1086 -0
- package/dist/use-g6-graph-B9K6IPJe.cjs +3 -0
- package/dist/z-cognition-component.css +1 -0
- package/package.json +9 -1
- package/dist/OntologyDetailPage-BnrMC9RD.cjs +0 -1
- package/dist/OntologyDetailPage-DIsWePGJ.js +0 -130
- package/dist/OntologyNodesPage-B93kbY3c.cjs +0 -1
- package/dist/OntologyNodesPage-C68cRXHu.js +0 -105
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";const Ke=require("@antv/g6"),p=require("react"),Y=require("d3-force"),pe="#3d7dd4",Ve="#89b4e8",ke="#1e4f8f",je="#94a3b8",qe="#64748b",Xe="#94a3b8",Ne="#64748b",Ee="#0052d9",be="#003cab",Ue="rgba(0, 82, 217, 0.25)",Se=52,Je="#fff",Qe=11,te="__uncategorized__",ve=[{fill:"#722ed1",stroke:"#531cd3"},{fill:"#1890ff",stroke:"#006cd4"},{fill:"#13c2c2",stroke:"#08979b"},{fill:"#52c41a",stroke:"#389e0d"},{fill:"#fa8c16",stroke:"#d4670c"},{fill:"#f5222d",stroke:"#cf1717"},{fill:"#eb2f96",stroke:"#c41d78"},{fill:"#faad14",stroke:"#d48806"},{fill:"#2f54eb",stroke:"#1d39c4"},{fill:"#a0d911",stroke:"#7cb305"}],ce={fill:Ee,stroke:be};function xe(a,i){const c=a.replace("#",""),d=parseInt(c.slice(0,2),16),o=parseInt(c.slice(2,4),16),t=parseInt(c.slice(4,6),16);return`rgba(${d}, ${o}, ${t}, ${i})`}function et(a){const i=new Map;return[...a].sort((d,o)=>(d.sortOrder??0)-(o.sortOrder??0)).forEach((d,o)=>{const t=d.categoryCode||te;if(i.has(t))return;const g=t===te?ce:ve[o%ve.length];i.set(t,{fill:g.fill,stroke:g.stroke,shadowColor:xe(g.fill,.25)})}),i.has(te)||i.set(te,{fill:ce.fill,stroke:ce.stroke,shadowColor:xe(ce.fill,.25)}),i}const tt="#f59e0b",nt=2,rt="#64748b",ot=10,st="#2563eb",ct="#ffffff",at="#f59e0b";function it(a,i,c){const d=a.data.name||a.data.code||a.data.id||"",o=i!=null?`${d}
|
|
2
|
+
${i}`:d,t=(c==null?void 0:c.fill)??Ee,g=(c==null?void 0:c.stroke)??be,y=(c==null?void 0:c.shadowColor)??Ue;return{fill:t,stroke:g,lineWidth:1,opacity:1,shadowColor:y,shadowBlur:8,size:Se,zIndex:10,labelText:o,labelFill:Je,labelFontSize:Qe,labelFontWeight:"bold",labelPlacement:"center"}}function lt(a,i){const c=a.data.displayName||"",d=i!=null?`${c}
|
|
3
|
+
${i}`:c,o=a.data.isSelfAssoc;return{stroke:tt,lineWidth:nt,opacity:.7,zIndex:1,...o?{endArrow:!0,endArrowSize:8}:{},labelText:d,labelFill:rt,labelFontSize:ot,labelFontWeight:"bold",labelAutoRotate:!0,labelBackground:!0,labelBackgroundFill:"#fff",labelBackgroundOpacity:.85,labelBackgroundRadius:4,labelPadding:[2,4]}}const K={emphasis:{node:{fill:st,stroke:ct,lineWidth:3,opacity:1,shadowColor:"rgba(37, 99, 235, 0.55)",shadowBlur:16},edge:{stroke:at,lineWidth:4,shadowColor:"rgba(245, 158, 11, 0.45)",shadowBlur:8}},pathHighlight:{node:{fill:pe,stroke:Ve,lineWidth:2,shadowColor:"rgba(61, 125, 212, 0.75)",shadowBlur:20,labelFill:"#fff",labelFontWeight:"bold"},edge:{stroke:pe,lineWidth:4,opacity:1,shadowColor:"rgba(61, 125, 212, 0.55)",shadowBlur:12,labelFill:"#1e3a5f",labelFontWeight:"bold"}},pathLast:{node:{fill:pe,stroke:ke,lineWidth:4,shadowColor:"rgba(61, 125, 212, 0.75)",shadowBlur:20,labelFill:"#fff",labelFontWeight:"bold"},edge:{stroke:ke,lineWidth:4,opacity:1,shadowColor:"rgba(61, 125, 212, 0.55)",shadowBlur:12,labelFill:"#1e3a5f",labelFontWeight:"bold"}},pathDim:{node:{fill:je,stroke:qe,lineWidth:1,opacity:1,labelFill:Ne},edge:{stroke:Xe,lineWidth:1,opacity:.9,labelFill:Ne}},focusDim:{node:{opacity:.2},edge:{opacity:.2}}};function _e(a,i){const c=new Map;a.forEach(t=>c.set(t.id,new Set)),i.forEach(t=>{var E,k;const g=String(t.source),y=String(t.target);(E=c.get(g))==null||E.add(y),(k=c.get(y))==null||k.add(g)});const d=new Map;let o=0;return a.forEach(t=>{var y;if(d.has(t.id))return;const g=[t.id];for(d.set(t.id,o);g.length>0;){const E=g.shift();(y=c.get(E))==null||y.forEach(k=>{d.has(k)||(d.set(k,o),g.push(k))})}o+=1}),d}function Ie(a,i,c,d=!1){const o=new Map;a.forEach(S=>{o.set(S,(o.get(S)??0)+1)});const t=Array.from(o.keys()).sort((S,C)=>(o.get(C)??0)-(o.get(S)??0)),g=i/2,y=c/2,E=new Map;if(t.length===1)return E.set(t[0],{x:g,y}),E;const k=t.filter(S=>(o.get(S)??0)===1),N=t.filter(S=>(o.get(S)??0)>1);if(d&&(N.length===0||k.length>12)){const S=Math.min(i,c)*.08,C=Math.ceil(Math.sqrt(k.length)),P=Math.ceil(k.length/C),H=(i-S*2)/C,F=(c-S*2)/P;return k.forEach((L,z)=>{E.set(L,{x:S+(z%C+.5)*H,y:S+(Math.floor(z/C)+.5)*F})}),N.length===0||N.forEach((L,z)=>{if(z===0){E.set(L,{x:g,y});return}const h=(z-1)/Math.max(N.length-1,1)*Math.PI*2-Math.PI/2,_=Math.min(i,c)*.3;E.set(L,{x:g+Math.cos(h)*_,y:y+Math.sin(h)*_})}),E}if(k.length===t.length){const S=Math.min(i,c)*.32;return t.forEach((C,P)=>{const H=P/t.length*Math.PI*2-Math.PI/2;E.set(C,{x:g+Math.cos(H)*S,y:y+Math.sin(H)*S})}),E}return t.forEach((S,C)=>{if(!E.has(S))if(!E.size)E.set(S,{x:g,y});else{const P=C/(t.length-1)*Math.PI*2,H=Math.min(i,c)*.28;E.set(S,{x:g+Math.cos(P)*H,y:y+Math.sin(P)*H})}}),E}const ut=.55,dt=1.2;function Oe(a,i,c,d,o,t,g){if(!g||a===0)return{collideRadius:d*1.3,linkDistance:o,chargeStrength:t};const y=d*1.15,E=Math.max(i-y*2,1),k=Math.max(c-y*2,1),N=E*k,A=Math.min(d*1.3,Math.max(d*.4,Math.sqrt(N*ut/(Math.PI*a)))),S=Math.min(1,Math.sqrt(N*dt**2/a)/o);return{collideRadius:A,linkDistance:Math.max(d*.75,o*S),chargeStrength:t*S*S}}function Me(a,i,c,d){const{nodeSize:o=Se,linkDistance:t=140,chargeStrength:g=-450,spreadIsolated:y=!1,adaptiveDensity:E=!1,seed:k}=d??{},{nodes:N,edges:A}=a;if(N.length===0)return;const S=Math.min(i,c)*.14,C=N.map((R,v)=>{const T=k==null?void 0:k[R.id];return{id:R.id,x:(T==null?void 0:T.x)??i/2+Math.cos(v/Math.max(N.length,1)*Math.PI*2)*S,y:(T==null?void 0:T.y)??c/2+Math.sin(v/Math.max(N.length,1)*Math.PI*2)*S,vx:0,vy:0,...T?{fx:T.x,fy:T.y}:{}}}),P=A.filter(R=>R.source!==R.target).map(R=>({source:R.source,target:R.target})),H=_e(C,P),F=Ie(H,i,c,y),L=Oe(N.length,i,c,o,t,g,E),z=R=>{const v=H.get(R);return v===void 0?void 0:F.get(v)},h=Y.forceSimulation(C).force("link",Y.forceLink(P).id(R=>R.id).distance(L.linkDistance)).force("charge",Y.forceManyBody().strength(L.chargeStrength)).force("x",Y.forceX(R=>{var v;return((v=z(R.id))==null?void 0:v.x)??i/2}).strength(.1)).force("y",Y.forceY(R=>{var v;return((v=z(R.id))==null?void 0:v.y)??c/2}).strength(.1)).force("collide",Y.forceCollide(L.collideRadius)).velocityDecay(.3).alphaDecay(.0228).stop();for(let R=0;R<500;R++)h.tick();const _=o*1.15,q=(R,v,T)=>Math.max(v,Math.min(T,R));N.forEach((R,v)=>{R.style||(R.style={}),R.style.x=E?C[v].x??i/2:q(C[v].x??i/2,_,Math.max(_,i-_)),R.style.y=E?C[v].y??c/2:q(C[v].y??c/2,_,Math.max(_,c-_))})}function ye(a,i,c,d,o){const{nodeSize:t=Se,linkDistance:g=140,chargeStrength:y=-450,spreadIsolated:E=!1,adaptiveDensity:k=!1}=o??{},{nodes:N,edges:A}=a;if(N.length===0)return null;const S=N.map(h=>{var _,q;return{id:h.id,x:((_=h.style)==null?void 0:_.x)??i/2,y:((q=h.style)==null?void 0:q.y)??c/2,vx:0,vy:0}}),C=A.filter(h=>h.source!==h.target).map(h=>({source:h.source,target:h.target})),P=_e(S,C),H=Ie(P,i,c,E),F=h=>{const _=P.get(h);return _===void 0?void 0:H.get(_)},L=Oe(N.length,i,c,t,g,y,k);return{simulation:Y.forceSimulation(S).force("link",Y.forceLink(C).id(h=>h.id).distance(L.linkDistance)).force("charge",Y.forceManyBody().strength(L.chargeStrength)).force("x",Y.forceX(h=>{var _;return((_=F(h.id))==null?void 0:_.x)??i/2}).strength(.1)).force("y",Y.forceY(h=>{var _;return((_=F(h.id))==null?void 0:_.y)??c/2}).strength(.1)).force("collide",Y.forceCollide(L.collideRadius)).velocityDecay(.3).alphaDecay(.0228).on("tick",d).alpha(0).stop(),d3Nodes:S}}const Le=[{type:"zoom-canvas",key:"zoom-canvas",zoomRange:[.2,3]},{type:"drag-canvas",key:"drag-canvas"},{type:"drag-element",key:"drag-element"},{type:"hover-activate",key:"hover-activate",degree:0,state:"emphasis"}];function ft(a,i,c,d){return{nodes:a.data.map(o=>{const t=o.id,g=o.code??t,y=o.name??"",E=o.categoryCode||te;return{id:t,data:{...o,code:g,name:y,...o.categoryCode?{categoryCode:o.categoryCode}:{}},style:it({data:{code:g,name:y}},i==null?void 0:i[g.toLowerCase()],d==null?void 0:d.get(E))}}),edges:a.links.map((o,t)=>{const g=o.code||o.value,y=`edge-${o.source}-${o.target}-${g}-${t}`,E=g??"",k=o.displayName||o.value||"",N=o.sourceName||"",A=o.targetName||"";return{id:y,source:o.source,target:o.target,data:{...o,code:E,displayName:k,sourceName:N,targetName:A},style:lt({source:o.source,target:o.target,data:{code:E,displayName:k,sourceName:N,targetName:A,isSelfAssoc:o.isSelfAssoc}},c==null?void 0:c[E.toLowerCase()])}})}}const le=["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc","#48b8d0"];function gt(a,i){const c=a.replace("#",""),d=c.length===3?c.split("").map(E=>E+E).join(""):c,o=parseInt(d,16),t=Math.round((o>>16&255)*(1-i)),g=Math.round((o>>8&255)*(1-i)),y=Math.round((o&255)*(1-i));return`#${((1<<24)+(t<<16)+(g<<8)+y).toString(16).slice(1)}`}function ht(a,i){const c=a.data.category??0,d=i[c%i.length]??le[0],o=a.data.value??0,t=Math.min(30+o*3,60);return{fill:d,stroke:gt(d,.22),lineWidth:2,shadowBlur:6,shadowColor:"rgba(0,0,0,0.1)",size:t,zIndex:10,labelText:a.data.name||a.id,labelFill:"#333",labelFontSize:10,labelPlacement:"right"}}function mt(a,i){var c;return{stroke:i??"#b0c4de",lineWidth:1.5,opacity:.6,zIndex:1,endArrow:!0,endArrowSize:8,labelText:((c=a.data)==null?void 0:c.label)||"",labelFill:"#888",labelFontSize:9,labelAutoRotate:!0}}function pt(a,i,c){const d=c.length>0?c.map(t=>{var g;return((g=t.itemStyle)==null?void 0:g.color)||le[0]}):le,o=new Map;return{nodes:a.map(t=>{const g=t.category??0,y=d[g%d.length]??le[0];return o.set(t.id,y),{id:t.id,data:{code:t.objectCode??"",name:t.name??"",...t.fullName?{fullName:t.fullName}:{},objectCode:t.objectCode,objectName:t.objectName,category:t.category,props:t.props,value:t.value,fillColor:y},style:ht({id:t.id,data:{name:t.name,category:t.category,value:t.value}},d)}}),edges:i.map((t,g)=>{const y=t.label??t.code??"";return{id:`edge-${t.source}-${t.target}-${y}-${g}`,source:t.source,target:t.target,data:{code:y,displayName:y,sourceName:"",targetName:"",label:y},style:mt({data:{label:t.label}},o.get(t.source))}})}}const Ce=120,yt=[10,10,10,10];async function ae(a){if(await a.fitView(),!a.destroyed&&a.getZoom()>1){if(await a.zoomTo(1),a.destroyed)return;await a.fitCenter()}}function ie(a){return a.context}function w(a){return typeof a=="object"&&a!==null?a:{}}function O(a){return typeof a=="string"?a:""}function V(a,i=0){return typeof a=="number"&&Number.isFinite(a)?a:i}function Te(a){const i=w(a).preventDefault;typeof i=="function"&&i.call(a)}function ee(a,i,c){const d=w(a),o=O(w(d.target).id)||O(d.itemId);let t={};if(c&&o)try{const A=i==="node"?c.getNodeData([o]):c.getEdgeData([o]);t=w(A==null?void 0:A[0])}catch{}const g=w(t.data),y={...g,id:O(t.id)||o,code:O(g.code)||O(g.value)||O(t.id)||o,name:O(g.name)||O(g.displayName)||""};O(t.source)&&(y.source=O(t.source)),O(t.target)&&(y.target=O(t.target));const E=w(d.viewport??d.canvasPoint??d.point),k=w(d.client??d.clientPoint),N=w(d.nativeEvent);return{dataType:i,data:y,name:O(g.name)||O(g.displayName)||o,event:{event:{offsetX:V(E.x),offsetY:V(E.y),clientX:V(k.x,V(N.clientX)),clientY:V(k.y,V(N.clientY)),metaKey:!!(d.metaKey??w(d.originalEvent).metaKey??N.metaKey),ctrlKey:!!(d.ctrlKey??w(d.originalEvent).ctrlKey??N.ctrlKey),preventDefault:()=>Te(a)}}}}function Et(a){const{zoomRange:i=[.2,3],onNodeClick:c,onNodeDoubleClick:d,onEdgeClick:o,onNodeContextMenu:t,onNodeHover:g,onEdgeHover:y,onHoverLeave:E,onCanvasClick:k,onViewportChange:N,tooltipFormatter:A,forceLayoutOptions:S,ctxMenuOpenRef:C,nodeInstanceCountRef:P,edgeInstanceCountRef:H}=a,F=p.useRef(null),[L,z]=p.useState(!1),h=p.useRef(null),[_,q]=p.useState(!1),R=p.useRef(!1),v=p.useRef(null),T=p.useRef(null),j=p.useRef(null),ue=p.useRef(null),De=p.useRef(()=>{}),oe=p.useRef(null),B=p.useRef(!1),G=p.useRef(null),ne=p.useRef([]),de=p.useRef(null),fe=p.useRef(!1),se=p.useRef(void 0);p.useEffect(()=>{se.current=S});const ge=p.useRef(0),$=p.useRef({onNodeClick:c,onNodeDoubleClick:d,onEdgeClick:o,onNodeContextMenu:t,onNodeHover:g,onEdgeHover:y,onHoverLeave:E,onCanvasClick:k,onViewportChange:N,tooltipFormatter:A,ctxMenuOpenRef:C,nodeInstanceCountRef:P,edgeInstanceCountRef:H});p.useEffect(()=>{$.current={onNodeClick:c,onNodeDoubleClick:d,onEdgeClick:o,onNodeContextMenu:t,onNodeHover:g,onEdgeHover:y,onHoverLeave:E,onCanvasClick:k,onViewportChange:N,tooltipFormatter:A,ctxMenuOpenRef:C,nodeInstanceCountRef:P,edgeInstanceCountRef:H}});const we=p.useCallback(u=>{u?(F.current=u,z(!0)):(F.current=null,z(!1))},[]);p.useEffect(()=>{if(!L)return;const u=F.current;if(!u||h.current)return;let n=!0;const f={container:u,autoResize:!0,animation:!1,data:{nodes:[],edges:[]},padding:yt,zoomRange:i,behaviors:Le,transforms:[{type:"process-parallel-edges"}],node:{type:"circle",state:{emphasis:K.emphasis.node,pathHighlight:K.pathHighlight.node,pathLast:K.pathLast.node,pathDim:K.pathDim.node,focusDim:K.focusDim.node}},edge:{type:"quadratic",state:{emphasis:K.emphasis.edge,pathHighlight:K.pathHighlight.edge,pathLast:K.pathLast.edge,pathDim:K.pathDim.edge,focusDim:K.focusDim.edge}},plugins:[{type:"tooltip",key:"tooltip",getContent:(s,r)=>{var x;const e=$.current;if(!e.tooltipFormatter||(x=e.ctxMenuOpenRef)!=null&&x.current||!(r!=null&&r[0]))return"";const l=w(r[0]),m="source"in l?"edge":"node",b={...w(l.data),id:O(l.id)};return O(l.source)&&(b.source=O(l.source)),O(l.target)&&(b.target=O(l.target)),e.tooltipFormatter(b,m)}}]};try{const s=new Ke.Graph(f);h.current=s,s.on("node:click",r=>{var l,m;const e=ee(r,"node",s);(m=(l=$.current).onNodeClick)==null||m.call(l,e)}),s.on("node:dblclick",r=>{var l,m;const e=ee(r,"node",s);(m=(l=$.current).onNodeDoubleClick)==null||m.call(l,e)}),s.on("edge:click",r=>{var l,m;const e=ee(r,"edge",s);(m=(l=$.current).onEdgeClick)==null||m.call(l,e)}),s.on("node:contextmenu",r=>{var l,m;Te(r);const e=ee(r,"node",s);(m=(l=$.current).onNodeContextMenu)==null||m.call(l,e)}),s.on("canvas:click",()=>{var r,e;(e=(r=$.current).onCanvasClick)==null||e.call(r)}),s.on("aftertransform",()=>{var r,e;ge.current>0||(e=(r=$.current).onViewportChange)==null||e.call(r)}),s.on("node:pointerenter",r=>{var l,m;const e=ee(r,"node",s);(m=(l=$.current).onNodeHover)==null||m.call(l,e)}),s.on("edge:pointerenter",r=>{var l,m;const e=ee(r,"edge",s);(m=(l=$.current).onEdgeHover)==null||m.call(l,e)}),s.on("node:pointerleave",()=>{var r,e;(e=(r=$.current).onHoverLeave)==null||e.call(r)}),s.on("edge:pointerleave",()=>{var r,e;(e=(r=$.current).onHoverLeave)==null||e.call(r)}),s.on("node:dragstart",r=>{var M;const e=w(r),l=O(w(e.target).id)||O(e.itemId);if(!l)return;const m=ne.current.find(Z=>Z.id===l);if(!m||!G.current)return;de.current=l;const b=(M=s.getNodeData([l]))==null?void 0:M[0],x=V(w(b==null?void 0:b.style).x,m.x??0),D=V(w(b==null?void 0:b.style).y,m.y??0);m.fx=x,m.fy=D,G.current.alphaTarget(.3).alpha(.3).restart()}),s.on("node:drag",r=>{const e=de.current;if(!e||!G.current)return;const l=ne.current.find(M=>M.id===e);if(!l)return;const m=w(r),b=s.getZoom(),x=V(m.dx)/b,D=V(m.dy)/b;l.fx=(l.fx??l.x??0)+x,l.fy=(l.fy??l.y??0)+D}),s.on("node:dragend",()=>{G.current&&G.current.alphaTarget(0),de.current=null}),queueMicrotask(()=>{n&&q(!0)})}catch(s){console.error("[G6] Failed to create graph:",s)}return()=>{n=!1,G.current&&(G.current.stop(),G.current=null),j.current&&(clearTimeout(j.current),j.current=null),T.current=null,h.current&&(h.current.destroy(),h.current=null,B.current=!1,v.current=null,q(!1))}},[L]),p.useEffect(()=>{if(!L)return;const u=F.current;if(!u)return;const n=new ResizeObserver(()=>{var f;if(T.current){De.current();return}(f=oe.current)==null||f.call(oe)});return n.observe(u),ue.current=n,()=>{n.disconnect(),ue.current===n&&(ue.current=null)}},[L]);const I=p.useCallback(()=>{var f;const u=h.current;if(!u||u.destroyed)return;const n=(f=ie(u))==null?void 0:f.canvas;n!=null&&n.getLayers&&Object.values(n.getLayers()).forEach(s=>{var e;const r=(e=s.getRenderingService)==null?void 0:e.call(s);r!=null&&r.dirty&&r.dirty(),!s.frameId&&typeof s.run=="function"&&s.run(),typeof s.render=="function"&&s.render()})},[]),X=p.useCallback(async u=>{ge.current+=1;try{await u()}finally{ge.current-=1}},[]),he=p.useCallback(()=>{const u=h.current;if(!u||u.destroyed)return;const n=ne.current;if(!n.length)return;const f=n.filter(s=>s.fx==null&&s.fy==null).map(s=>({id:s.id,style:{x:s.x,y:s.y}}));f.length!==0&&(u.updateData({nodes:f,edges:[]}),I())},[I]),Re=p.useRef({emphasisNodes:new Set,emphasisEdgeCodes:new Set,dimmedNodes:new Set}),Q=p.useCallback(u=>{const n=u??h.current;if(!n||n.destroyed||!B.current)return;const{emphasisNodes:f,emphasisEdgeCodes:s,dimmedNodes:r}=Re.current,e={};n.getNodeData().forEach(l=>{const m=String(l.id),x=(n.getElementState(m)??[]).filter(D=>D!=="emphasis"&&D!=="focusDim");f.has(m)&&x.push("emphasis"),r.has(m)&&x.push("focusDim"),e[m]=x}),n.getEdgeData().forEach(l=>{var M,Z;const m=String(l.id),x=(n.getElementState(m)??[]).filter(W=>W!=="emphasis"&&W!=="focusDim"),D=String(((M=l.data)==null?void 0:M.code)??((Z=l.data)==null?void 0:Z.value)??"");D&&s.has(D)&&x.push("emphasis"),(r.has(String(l.source))||r.has(String(l.target)))&&x.push("focusDim"),e[m]=x}),Promise.resolve(n.setElementState(e)).then(()=>I()).catch(()=>{})},[I]),Ae=p.useCallback((u,n,f)=>{Re.current={emphasisNodes:new Set(u),emphasisEdgeCodes:new Set(n),dimmedNodes:new Set(f)},Q()},[Q]),U=p.useCallback((u,n,f,s,r)=>{var m,b,x;const e=h.current;if(!e||e.destroyed)return;let l;if(r&&v.current){const D={};v.current.nodes.forEach(M=>{var J,re;const Z=(J=M.style)==null?void 0:J.x,W=(re=M.style)==null?void 0:re.y;typeof Z=="number"&&typeof W=="number"&&(D[M.id]={x:Z,y:W})}),Object.keys(D).length&&(l=D)}Me(u,n,f,{...se.current,...l?{seed:l}:{}}),e.setData(u),(x=(b=(m=ie(e))==null?void 0:m.model)==null?void 0:b.refreshData)==null||x.call(b),B.current=!1,!v.current||v.current.nodes.length===0?e.render().then(async()=>{if(h.current!==e||e.destroyed||(await X(()=>ae(e)),h.current!==e||e.destroyed))return;I(),G.current&&G.current.stop();const D=ye(u,n,f,he,se.current);D&&(G.current=D.simulation,ne.current=D.d3Nodes),B.current=!0,Q(e)}).catch(D=>{console.error("[G6] render failed:",D),h.current===e&&(B.current=!0)}):e.draw().then(async()=>{var Z,W,J;if(h.current!==e||e.destroyed)return;const D=fe.current;fe.current=!1,D||I(),G.current&&G.current.stop();const M=ye(u,n,f,he,se.current);M&&(G.current=M.simulation,ne.current=M.d3Nodes),!(s&&!D&&(await X(()=>ae(e)),h.current!==e||e.destroyed))&&(B.current=!0,D?((J=(W=(Z=ie(e))==null?void 0:Z.model)==null?void 0:W.refreshData)==null||J.call(W),e.draw().then(async()=>{h.current!==e||e.destroyed||(await X(()=>ae(e)),!(h.current!==e||e.destroyed)&&(I(),Q(e)))}).catch(()=>{h.current===e&&I()})):Q(e))}).catch(D=>{console.error("[G6] draw failed:",D),h.current===e&&(B.current=!0)}),v.current=u},[I,he,X,Q]),me=p.useCallback(()=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{const u=T.current,n=F.current;if(!u||!n)return;const f=n.clientWidth,s=n.clientHeight;f<=0||s<=0||(T.current=null,U(u,f,s))},Ce)},[U]);p.useEffect(()=>{De.current=me});const Pe=p.useCallback(()=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{const u=F.current,n=v.current;if(!u||!n||n.nodes.length===0)return;const f=u.clientWidth,s=u.clientHeight;f<=0||s<=0||U(n,f,s,!0)},Ce)},[U]);p.useEffect(()=>{oe.current=Pe});const He=p.useCallback((u,n)=>{const f=h.current;if(!f||f.destroyed)return;if(n!=null&&n.settle&&(fe.current=!0),!v.current||v.current.nodes.length===0){T.current=u,me();return}const r=F.current,e=(r==null?void 0:r.clientWidth)||800,l=(r==null?void 0:r.clientHeight)||600;U(u,e,l,n==null?void 0:n.fit,n==null?void 0:n.keepPositions)},[U,me]),Fe=p.useCallback(u=>{const n=h.current;if(!n||n.destroyed)return;const f=n.getNodeData(),s=n.getEdgeData(),r={};f.forEach(l=>{r[String(l.id)]=[]}),s.forEach(l=>{r[String(l.id)]=[]});const e=f.some(l=>String(l.id)===u);!B.current||f.length===0||Promise.resolve(n.setElementState(r)).then(()=>{if(e)return n.setElementState(u,"emphasis")}).then(()=>I()).catch(()=>{})},[I]),Ge=p.useCallback((u,n,f,s)=>{const r=h.current;if(!r||r.destroyed)return;const e={},l=r.getNodeData();l.forEach(b=>{var M;const x=String(b.id),D=String(((M=b.data)==null?void 0:M.code)||b.id);u.has(D)||u.has(x)?D===f||x===f?e[x]=["pathLast"]:e[x]=["pathHighlight"]:e[x]=["pathDim"]}),r.getEdgeData().forEach(b=>{var J,re;const x=String(b.id),D=String(((J=b.data)==null?void 0:J.value)??((re=b.data)==null?void 0:re.code)??""),M=String(b.source),Z=String(b.target),W=`${M}->${Z}::${D}`;n.has(W)||n.has(D)?W===s||D===s?e[x]=["pathLast"]:e[x]=["pathHighlight"]:e[x]=["pathDim"]}),!(!B.current||l.length===0)&&(R.current=!0,Promise.resolve(r.setElementState(e)).then(()=>I()).catch(()=>{}))},[I]),We=p.useCallback(()=>{const u=h.current;if(!u||u.destroyed||!R.current||!B.current)return;const n=u.getNodeData(),f=u.getEdgeData(),s={};n.forEach(r=>{s[String(r.id)]=[]}),f.forEach(r=>{s[String(r.id)]=[]}),R.current=!1,Promise.resolve(u.setElementState(s)).then(()=>I()).catch(()=>{})},[I]),ze=p.useCallback(()=>{const u=h.current;if(!u||u.destroyed)return;const n=v.current;if(!n||n.nodes.length===0){X(()=>ae(u)).then(()=>I());return}const f=F.current,s=(f==null?void 0:f.clientWidth)||800,r=(f==null?void 0:f.clientHeight)||600;U(n,s,r,!0)},[U,I,X]),Be=p.useCallback(u=>{const n=h.current;if(!n||n.destroyed||!B.current)return;const f=Math.max(n.getZoom(),1);X(async()=>{await n.focusElement(u,{duration:300}),!(n.destroyed||n.getZoom()===f)&&await n.zoomTo(f,{duration:250})}).then(()=>I()).catch(()=>{})},[I,X]),$e=p.useCallback(u=>{const n=h.current;if(!n||n.destroyed||!B.current)return;const f=new Set(u),s={};n.getNodeData().forEach(r=>{const e=String(r.id),m=(n.getElementState(e)??[]).filter(b=>b!=="focusDim");f.has(e)&&m.push("focusDim"),s[e]=m}),n.getEdgeData().forEach(r=>{const e=String(r.id),m=(n.getElementState(e)??[]).filter(b=>b!=="focusDim");(f.has(String(r.source))||f.has(String(r.target)))&&m.push("focusDim"),s[e]=m}),Promise.resolve(n.setElementState(s)).then(()=>I()).catch(()=>{})},[I]),Ze=p.useCallback(()=>{var n,f,s;const u=h.current;if(!(!u||u.destroyed))try{const r=(s=(f=(n=ie(u))==null?void 0:n.plugin)==null?void 0:f.get)==null?void 0:s.call(f,"tooltip");r&&typeof r.hide=="function"&&r.hide()}catch{}},[]),Ye=p.useCallback(()=>h.current,[]);return{containerRef:we,setData:He,highlightNode:Fe,applyPathStyle:Ge,resetPathStyle:We,fitView:ze,focusNode:Be,setNodeDim:$e,setViewState:Ae,hideTooltip:Ze,ready:_,getGraph:Ye}}exports.GRAPH_BEHAVIORS=Le;exports.NODE_FILL=Ee;exports.NODE_STROKE=be;exports.STATE_STYLES=K;exports.UNCATEGORIZED_CAT_CODE=te;exports.buildCategoryColorMap=et;exports.computeForceLayout=Me;exports.createLiveSimulation=ye;exports.toG6Data=ft;exports.toInstanceG6Data=pt;exports.useG6Graph=Et;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.view{display:flex;flex-direction:column;gap:12px;min-width:0;box-sizing:border-box}.view-bar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:4px 0}.view-bar .spacer{flex:1}.view-bar .hint{color:#8c8c8c;font-size:12px}.panel{border:1px solid #f0f0f0;border-radius:8px;background:#fff;overflow:hidden}.panel-head{display:flex;align-items:center;gap:8px;padding:10px 14px;font-weight:600;font-size:14px;border-bottom:1px solid #f5f5f5}.panel-head .toolbar{margin-left:auto;display:flex;align-items:center;gap:6px;font-weight:400}.panel-body{padding:12px 14px}.stat-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px}.stat-card{border:1px solid #f0f0f0;border-radius:8px;background:#fff;padding:14px 16px;display:flex;flex-direction:column;gap:6px}.stat-card .label{color:#8c8c8c;font-size:12px}.stat-card .value{font-size:24px;font-weight:600;line-height:1.2}.stat-card .sub{color:#bfbfbf;font-size:12px}.empty-note{color:#999;font-size:12px;padding:12px 0;text-align:center}.side-rail{width:260px;flex:0 0 260px;border:1px solid #f0f0f0;border-radius:8px;background:#fff;padding:8px;max-height:calc(100vh - 240px);overflow:auto}.side-rail .rail-head{font-weight:600;margin-bottom:8px;padding:0 4px}.side-rail ul.rail-list{list-style:none;margin:0;padding:0}.side-rail li.rail-item{display:flex;align-items:center;gap:6px;padding:5px 8px;margin-bottom:2px;border-radius:6px;cursor:pointer}.side-rail li.rail-item:hover{background:#f5f5f5}.side-rail li.rail-item.active{background:#f0f5ff}.graph-canvas{flex:1;min-height:480px;border:1px solid #f0f0f0;border-radius:8px;position:relative;background:#fafafa;overflow:hidden}.graph-canvas .canvas-overlay{position:absolute;top:0;right:0;bottom:0;left:0;display:grid;place-items:center;z-index:10}.md-lite{white-space:normal;font-size:14px;line-height:1.75;color:#595959;word-break:break-word}.md-lite p,.md-lite .md-para{margin:0 0 8px}.md-lite p:last-child,.md-lite .md-para:last-child{margin-bottom:0}.md-lite h3{margin:14px 0 7px;font-size:15px;font-weight:700;color:#1f1f1f}.md-lite h4{margin:11px 0 6px;font-size:14px;font-weight:700;color:#1f1f1f}.md-lite ul,.md-lite ol{display:flex;flex-direction:column;gap:4px;margin:0 0 8px;padding-left:18px}.md-lite li{line-height:1.65}.md-lite code{padding:0 4px;border-radius:4px;background:#f0f0f0;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;color:#262626}.md-lite blockquote{margin:8px 0;padding:6px 10px;border-left:2px solid #e8e8e8;background:#f7f7f7;color:#8c8c8c;font-size:12px}.md-lite a{color:#1677ff;text-decoration:none}.md-lite a:hover{text-decoration:underline}.md-lite hr{margin:10px 0;border:0;border-top:1px solid #e8e8e8}.md-table-wrap{margin:8px 0;border:1px solid #e8e8e8;border-radius:6px;background:#fff;overflow-x:auto}.md-table{width:100%;border-collapse:collapse;font-size:12.5px}.md-table th,.md-table td{padding:6px 10px;border-bottom:1px solid #e8e8e8;text-align:left;vertical-align:top;white-space:nowrap}.md-table th{background:#f7f7f7;color:#8c8c8c;font-weight:600}.md-table tbody tr:last-child td{border-bottom:0}.md-code{position:relative;margin:8px 0;padding:10px 12px;border:1px solid #e8e8e8;border-radius:6px;background:#f7f7f7;overflow-x:auto}.md-code code{padding:0;background:none;font-size:12px;line-height:1.6;white-space:pre}.md-code-lang{position:absolute;top:4px;right:8px;color:#bfbfbf;font-size:11px;text-transform:uppercase}.md-img{display:block;max-width:100%;border-radius:6px;margin:8px 0}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuku123/z-cognition-component",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "z-cognition 业务认知域共享组件层(library mode)—— 术语 / 概念 / 消歧 / 影响面",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"./pages": {
|
|
18
18
|
"import": "./dist/pages.js",
|
|
19
19
|
"require": "./dist/pages.cjs"
|
|
20
|
+
},
|
|
21
|
+
"./ontology-graph": {
|
|
22
|
+
"import": "./dist/ontology-graph.js",
|
|
23
|
+
"require": "./dist/ontology-graph.cjs"
|
|
20
24
|
}
|
|
21
25
|
},
|
|
22
26
|
"files": [
|
|
@@ -27,6 +31,10 @@
|
|
|
27
31
|
"build": "vite build",
|
|
28
32
|
"preview": "vite preview"
|
|
29
33
|
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@antv/g6": "^5.1.1",
|
|
36
|
+
"d3-force": "^3.0.0"
|
|
37
|
+
},
|
|
30
38
|
"peerDependencies": {
|
|
31
39
|
"@ant-design/icons": "^6.0.0",
|
|
32
40
|
"@yuku123/z-frontend-common": "^1.1.7",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),g=require("react-router-dom"),s=require("antd"),f=require("@ant-design/icons"),t=require("./api-D5Hgcud4.cjs");function y(){const[h]=g.useSearchParams(),r=h.get("id")||"",[l,m]=d.useState(null),[a,c]=d.useState(null),[p,o]=d.useState(!1),x=async()=>{if(r){o(!0);try{m(await t.ontologyApi.getSchema(r))}catch(i){s.message.error(i.message)}try{c(await t.ontologyApi.stats(r))}catch{c(null)}finally{o(!1)}}};if(d.useEffect(()=>{x()},[r]),!r)return e.jsx(s.Alert,{type:"warning",message:"缺少本体 ID(?id=xxx)"});const u=[{title:"类名",dataIndex:"name",key:"name",width:180},{title:"显示名",dataIndex:"label",key:"label",width:140},{title:"父类",key:"superClasses",render:(i,n)=>(t.field(n,"superClasses")||[]).join(", ")||"—"},{title:"互斥",key:"disjointWith",render:(i,n)=>(t.field(n,"disjointWith")||[]).join(", ")||"—"},{title:"描述",dataIndex:"description",ellipsis:!0}],j=[{title:"属性名",dataIndex:"name",key:"name",width:160},{title:"类型",dataIndex:"kind",key:"kind",width:100,render:i=>e.jsx(s.Tag,{children:i})},{title:"domain",dataIndex:"domain",width:120},{title:"range",dataIndex:"range",width:120},{title:"显示名",dataIndex:"label",width:120},{title:"特征",key:"traits",render:(i,n)=>e.jsxs(s.Space,{size:4,wrap:!0,children:[n.transitive?e.jsx(s.Tag,{color:"blue",children:"传递"}):null,n.symmetric?e.jsx(s.Tag,{color:"purple",children:"对称"}):null,t.field(n,"inverseOf")?e.jsxs(s.Tag,{children:["逆: ",t.field(n,"inverseOf")]}):null]})}];return e.jsx(s.Spin,{spinning:p,children:l?e.jsxs(e.Fragment,{children:[e.jsxs(s.Descriptions,{bordered:!0,size:"small",column:2,style:{marginBottom:16},children:[e.jsx(s.Descriptions.Item,{label:"本体 ID",children:l.id}),e.jsx(s.Descriptions.Item,{label:"名称",children:l.name}),e.jsx(s.Descriptions.Item,{label:"版本",children:l.version}),e.jsx(s.Descriptions.Item,{label:"更新时间",children:t.field(l,"updatedAt")||t.field(l,"createdAt")||"—"}),e.jsx(s.Descriptions.Item,{label:"描述",span:2,children:l.description||"—"}),e.jsx(s.Descriptions.Item,{label:"前缀",span:2,children:Object.entries(l.prefixes||{}).map(([i,n])=>e.jsxs(s.Tag,{children:[i," = ",n]},i))})]}),a?e.jsx(s.Card,{size:"small",title:"运行统计",style:{marginBottom:16},extra:e.jsx(s.Button,{size:"small",icon:e.jsx(f.ReloadOutlined,{}),onClick:x,children:"刷新"}),children:e.jsxs(s.Space,{size:"large",wrap:!0,children:[e.jsxs("span",{children:["类节点 ",e.jsx("b",{children:t.field(a,"classNodes")})]}),e.jsxs("span",{children:["实例节点 ",e.jsx("b",{children:t.field(a,"individualNodes")})]}),e.jsxs("span",{children:["节点总数 ",e.jsx("b",{children:t.field(a,"nodeCount")})]}),e.jsxs("span",{children:["关系总数 ",e.jsx("b",{children:t.field(a,"edgeCount")})]}),e.jsxs("span",{children:["显式陈述 ",e.jsx("b",{children:t.field(a,"explicitStatements")})]}),e.jsxs("span",{children:["推理陈述 ",e.jsx("b",{children:t.field(a,"inferredStatements")})]}),e.jsxs("span",{children:["工作空间 ",e.jsx("b",{children:t.field(a,"workspace")})]}),e.jsxs("span",{children:["最近物化 ",e.jsx("b",{children:t.field(a,"lastMaterializedAt")||"—"})]})]})}):null,e.jsx(s.Card,{size:"small",title:`类定义(${(l.classes||[]).length})`,style:{marginBottom:16},children:e.jsx(s.Table,{rowKey:i=>i.name,size:"small",columns:u,dataSource:l.classes||[],pagination:!1})}),e.jsx(s.Card,{size:"small",title:`属性定义(${(l.properties||[]).length})`,children:e.jsx(s.Table,{rowKey:i=>i.name,size:"small",columns:j,dataSource:l.properties||[],pagination:!1})})]}):e.jsx(s.Alert,{type:"info",message:"加载中或未找到该本体"})})}exports.default=y;
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as n, Fragment as z } from "react/jsx-runtime";
|
|
2
|
-
import { useState as c, useEffect as C } from "react";
|
|
3
|
-
import { useSearchParams as j } from "react-router-dom";
|
|
4
|
-
import { Alert as g, Spin as v, Descriptions as s, Tag as o, Card as m, Space as f, Button as A, Table as y, message as O } from "antd";
|
|
5
|
-
import { ReloadOutlined as B } from "@ant-design/icons";
|
|
6
|
-
import { f as l, o as b } from "./api-BVrIcAFp.js";
|
|
7
|
-
function W() {
|
|
8
|
-
const [x] = j(), d = x.get("id") || "", [i, I] = c(null), [r, h] = c(null), [w, p] = c(!1), u = async () => {
|
|
9
|
-
if (d) {
|
|
10
|
-
p(!0);
|
|
11
|
-
try {
|
|
12
|
-
I(await b.getSchema(d));
|
|
13
|
-
} catch (t) {
|
|
14
|
-
O.error(t.message);
|
|
15
|
-
}
|
|
16
|
-
try {
|
|
17
|
-
h(await b.stats(d));
|
|
18
|
-
} catch {
|
|
19
|
-
h(null);
|
|
20
|
-
} finally {
|
|
21
|
-
p(!1);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
if (C(() => {
|
|
26
|
-
u();
|
|
27
|
-
}, [d]), !d)
|
|
28
|
-
return /* @__PURE__ */ e(g, { type: "warning", message: "缺少本体 ID(?id=xxx)" });
|
|
29
|
-
const S = [
|
|
30
|
-
{ title: "类名", dataIndex: "name", key: "name", width: 180 },
|
|
31
|
-
{ title: "显示名", dataIndex: "label", key: "label", width: 140 },
|
|
32
|
-
{ title: "父类", key: "superClasses", render: (t, a) => (l(a, "superClasses") || []).join(", ") || "—" },
|
|
33
|
-
{ title: "互斥", key: "disjointWith", render: (t, a) => (l(a, "disjointWith") || []).join(", ") || "—" },
|
|
34
|
-
{ title: "描述", dataIndex: "description", ellipsis: !0 }
|
|
35
|
-
], k = [
|
|
36
|
-
{ title: "属性名", dataIndex: "name", key: "name", width: 160 },
|
|
37
|
-
{ title: "类型", dataIndex: "kind", key: "kind", width: 100, render: (t) => /* @__PURE__ */ e(o, { children: t }) },
|
|
38
|
-
{ title: "domain", dataIndex: "domain", width: 120 },
|
|
39
|
-
{ title: "range", dataIndex: "range", width: 120 },
|
|
40
|
-
{ title: "显示名", dataIndex: "label", width: 120 },
|
|
41
|
-
{ title: "特征", key: "traits", render: (t, a) => /* @__PURE__ */ n(f, { size: 4, wrap: !0, children: [
|
|
42
|
-
a.transitive ? /* @__PURE__ */ e(o, { color: "blue", children: "传递" }) : null,
|
|
43
|
-
a.symmetric ? /* @__PURE__ */ e(o, { color: "purple", children: "对称" }) : null,
|
|
44
|
-
l(a, "inverseOf") ? /* @__PURE__ */ n(o, { children: [
|
|
45
|
-
"逆: ",
|
|
46
|
-
l(a, "inverseOf")
|
|
47
|
-
] }) : null
|
|
48
|
-
] }) }
|
|
49
|
-
];
|
|
50
|
-
return /* @__PURE__ */ e(v, { spinning: w, children: i ? /* @__PURE__ */ n(z, { children: [
|
|
51
|
-
/* @__PURE__ */ n(s, { bordered: !0, size: "small", column: 2, style: { marginBottom: 16 }, children: [
|
|
52
|
-
/* @__PURE__ */ e(s.Item, { label: "本体 ID", children: i.id }),
|
|
53
|
-
/* @__PURE__ */ e(s.Item, { label: "名称", children: i.name }),
|
|
54
|
-
/* @__PURE__ */ e(s.Item, { label: "版本", children: i.version }),
|
|
55
|
-
/* @__PURE__ */ e(s.Item, { label: "更新时间", children: l(i, "updatedAt") || l(i, "createdAt") || "—" }),
|
|
56
|
-
/* @__PURE__ */ e(s.Item, { label: "描述", span: 2, children: i.description || "—" }),
|
|
57
|
-
/* @__PURE__ */ e(s.Item, { label: "前缀", span: 2, children: Object.entries(i.prefixes || {}).map(([t, a]) => /* @__PURE__ */ n(o, { children: [
|
|
58
|
-
t,
|
|
59
|
-
" = ",
|
|
60
|
-
a
|
|
61
|
-
] }, t)) })
|
|
62
|
-
] }),
|
|
63
|
-
r ? /* @__PURE__ */ e(
|
|
64
|
-
m,
|
|
65
|
-
{
|
|
66
|
-
size: "small",
|
|
67
|
-
title: "运行统计",
|
|
68
|
-
style: { marginBottom: 16 },
|
|
69
|
-
extra: /* @__PURE__ */ e(A, { size: "small", icon: /* @__PURE__ */ e(B, {}), onClick: u, children: "刷新" }),
|
|
70
|
-
children: /* @__PURE__ */ n(f, { size: "large", wrap: !0, children: [
|
|
71
|
-
/* @__PURE__ */ n("span", { children: [
|
|
72
|
-
"类节点 ",
|
|
73
|
-
/* @__PURE__ */ e("b", { children: l(r, "classNodes") })
|
|
74
|
-
] }),
|
|
75
|
-
/* @__PURE__ */ n("span", { children: [
|
|
76
|
-
"实例节点 ",
|
|
77
|
-
/* @__PURE__ */ e("b", { children: l(r, "individualNodes") })
|
|
78
|
-
] }),
|
|
79
|
-
/* @__PURE__ */ n("span", { children: [
|
|
80
|
-
"节点总数 ",
|
|
81
|
-
/* @__PURE__ */ e("b", { children: l(r, "nodeCount") })
|
|
82
|
-
] }),
|
|
83
|
-
/* @__PURE__ */ n("span", { children: [
|
|
84
|
-
"关系总数 ",
|
|
85
|
-
/* @__PURE__ */ e("b", { children: l(r, "edgeCount") })
|
|
86
|
-
] }),
|
|
87
|
-
/* @__PURE__ */ n("span", { children: [
|
|
88
|
-
"显式陈述 ",
|
|
89
|
-
/* @__PURE__ */ e("b", { children: l(r, "explicitStatements") })
|
|
90
|
-
] }),
|
|
91
|
-
/* @__PURE__ */ n("span", { children: [
|
|
92
|
-
"推理陈述 ",
|
|
93
|
-
/* @__PURE__ */ e("b", { children: l(r, "inferredStatements") })
|
|
94
|
-
] }),
|
|
95
|
-
/* @__PURE__ */ n("span", { children: [
|
|
96
|
-
"工作空间 ",
|
|
97
|
-
/* @__PURE__ */ e("b", { children: l(r, "workspace") })
|
|
98
|
-
] }),
|
|
99
|
-
/* @__PURE__ */ n("span", { children: [
|
|
100
|
-
"最近物化 ",
|
|
101
|
-
/* @__PURE__ */ e("b", { children: l(r, "lastMaterializedAt") || "—" })
|
|
102
|
-
] })
|
|
103
|
-
] })
|
|
104
|
-
}
|
|
105
|
-
) : null,
|
|
106
|
-
/* @__PURE__ */ e(m, { size: "small", title: `类定义(${(i.classes || []).length})`, style: { marginBottom: 16 }, children: /* @__PURE__ */ e(
|
|
107
|
-
y,
|
|
108
|
-
{
|
|
109
|
-
rowKey: (t) => t.name,
|
|
110
|
-
size: "small",
|
|
111
|
-
columns: S,
|
|
112
|
-
dataSource: i.classes || [],
|
|
113
|
-
pagination: !1
|
|
114
|
-
}
|
|
115
|
-
) }),
|
|
116
|
-
/* @__PURE__ */ e(m, { size: "small", title: `属性定义(${(i.properties || []).length})`, children: /* @__PURE__ */ e(
|
|
117
|
-
y,
|
|
118
|
-
{
|
|
119
|
-
rowKey: (t) => t.name,
|
|
120
|
-
size: "small",
|
|
121
|
-
columns: k,
|
|
122
|
-
dataSource: i.properties || [],
|
|
123
|
-
pagination: !1
|
|
124
|
-
}
|
|
125
|
-
) })
|
|
126
|
-
] }) : /* @__PURE__ */ e(g, { type: "info", message: "加载中或未找到该本体" }) });
|
|
127
|
-
}
|
|
128
|
-
export {
|
|
129
|
-
W as default
|
|
130
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),f=require("react-router-dom"),s=require("antd"),S=require("@ant-design/icons"),p=require("./api-D5Hgcud4.cjs");function k(){const[m]=f.useSearchParams(),n=m.get("id")||"",[i,x]=l.useState("default"),[o,c]=l.useState([]),[d,u]=l.useState([]),[h,y]=l.useState(!1),r=async(a=i)=>{if(n){y(!0);try{c(await p.ontologyApi.listClasses(n,a))}catch(t){s.message.error(`类列表取数失败:${t.message}`),c([])}try{u(await p.ontologyApi.listIndividuals(n,a))}catch(t){s.message.error(`实例列表取数失败:${t.message}`),u([])}finally{y(!1)}}};l.useEffect(()=>{r("default")},[n]);const g=[{title:"key",dataIndex:"key",key:"key",width:240},{title:"标签",dataIndex:"labels",key:"labels",width:200,render:a=>(a||[]).map(t=>e.jsx(s.Tag,{children:t},t))},{title:"属性",dataIndex:"properties",key:"properties",render:a=>e.jsx(s.Space,{size:4,wrap:!0,children:Object.entries(a||{}).map(([t,j])=>e.jsxs(s.Tag,{color:"default",children:[t,"=",String(j)]},t))})}];return n?e.jsxs(s.Spin,{spinning:h,children:[e.jsxs(s.Space,{style:{marginBottom:12},children:[e.jsx(s.Input,{style:{width:220},placeholder:"工作空间(默认 default)",value:i,onChange:a=>x(a.target.value),onPressEnter:()=>r()}),e.jsx(s.Button,{type:"primary",icon:e.jsx(S.ReloadOutlined,{}),onClick:()=>r(),children:"刷新"}),e.jsxs("span",{style:{color:"#999",fontSize:12},children:["本体 ",n]})]}),e.jsx(s.Tabs,{items:[{key:"classes",label:`类(${o.length})`,children:e.jsx(s.Card,{size:"small",children:e.jsx(s.Table,{rowKey:"key",size:"small",columns:g,dataSource:o,pagination:!1})})},{key:"individuals",label:`实例(${d.length})`,children:e.jsx(s.Card,{size:"small",children:e.jsx(s.Table,{rowKey:"key",size:"small",columns:g,dataSource:d,pagination:!1})})}]})]}):e.jsx(s.Alert,{type:"warning",message:"缺少本体 ID(?id=xxx)"})}exports.default=k;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as l } from "react/jsx-runtime";
|
|
2
|
-
import { useState as r, useEffect as v } from "react";
|
|
3
|
-
import { useSearchParams as z } from "react-router-dom";
|
|
4
|
-
import { Alert as C, Spin as $, Space as y, Input as j, Button as O, Tabs as P, Card as f, Table as g, message as h, Tag as k } from "antd";
|
|
5
|
-
import { ReloadOutlined as T } from "@ant-design/icons";
|
|
6
|
-
import { o as w } from "./api-BVrIcAFp.js";
|
|
7
|
-
function N() {
|
|
8
|
-
const [x] = z(), s = x.get("id") || "", [n, I] = r("default"), [o, d] = r([]), [c, m] = r([]), [S, p] = r(!1), i = async (a = n) => {
|
|
9
|
-
if (s) {
|
|
10
|
-
p(!0);
|
|
11
|
-
try {
|
|
12
|
-
d(await w.listClasses(s, a));
|
|
13
|
-
} catch (t) {
|
|
14
|
-
h.error(`类列表取数失败:${t.message}`), d([]);
|
|
15
|
-
}
|
|
16
|
-
try {
|
|
17
|
-
m(await w.listIndividuals(s, a));
|
|
18
|
-
} catch (t) {
|
|
19
|
-
h.error(`实例列表取数失败:${t.message}`), m([]);
|
|
20
|
-
} finally {
|
|
21
|
-
p(!1);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
v(() => {
|
|
26
|
-
i("default");
|
|
27
|
-
}, [s]);
|
|
28
|
-
const u = [
|
|
29
|
-
{ title: "key", dataIndex: "key", key: "key", width: 240 },
|
|
30
|
-
{
|
|
31
|
-
title: "标签",
|
|
32
|
-
dataIndex: "labels",
|
|
33
|
-
key: "labels",
|
|
34
|
-
width: 200,
|
|
35
|
-
render: (a) => (a || []).map((t) => /* @__PURE__ */ e(k, { children: t }, t))
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
title: "属性",
|
|
39
|
-
dataIndex: "properties",
|
|
40
|
-
key: "properties",
|
|
41
|
-
render: (a) => /* @__PURE__ */ e(y, { size: 4, wrap: !0, children: Object.entries(a || {}).map(([t, b]) => /* @__PURE__ */ l(k, { color: "default", children: [
|
|
42
|
-
t,
|
|
43
|
-
"=",
|
|
44
|
-
String(b)
|
|
45
|
-
] }, t)) })
|
|
46
|
-
}
|
|
47
|
-
];
|
|
48
|
-
return s ? /* @__PURE__ */ l($, { spinning: S, children: [
|
|
49
|
-
/* @__PURE__ */ l(y, { style: { marginBottom: 12 }, children: [
|
|
50
|
-
/* @__PURE__ */ e(
|
|
51
|
-
j,
|
|
52
|
-
{
|
|
53
|
-
style: { width: 220 },
|
|
54
|
-
placeholder: "工作空间(默认 default)",
|
|
55
|
-
value: n,
|
|
56
|
-
onChange: (a) => I(a.target.value),
|
|
57
|
-
onPressEnter: () => i()
|
|
58
|
-
}
|
|
59
|
-
),
|
|
60
|
-
/* @__PURE__ */ e(O, { type: "primary", icon: /* @__PURE__ */ e(T, {}), onClick: () => i(), children: "刷新" }),
|
|
61
|
-
/* @__PURE__ */ l("span", { style: { color: "#999", fontSize: 12 }, children: [
|
|
62
|
-
"本体 ",
|
|
63
|
-
s
|
|
64
|
-
] })
|
|
65
|
-
] }),
|
|
66
|
-
/* @__PURE__ */ e(
|
|
67
|
-
P,
|
|
68
|
-
{
|
|
69
|
-
items: [
|
|
70
|
-
{
|
|
71
|
-
key: "classes",
|
|
72
|
-
label: `类(${o.length})`,
|
|
73
|
-
children: /* @__PURE__ */ e(f, { size: "small", children: /* @__PURE__ */ e(
|
|
74
|
-
g,
|
|
75
|
-
{
|
|
76
|
-
rowKey: "key",
|
|
77
|
-
size: "small",
|
|
78
|
-
columns: u,
|
|
79
|
-
dataSource: o,
|
|
80
|
-
pagination: !1
|
|
81
|
-
}
|
|
82
|
-
) })
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
key: "individuals",
|
|
86
|
-
label: `实例(${c.length})`,
|
|
87
|
-
children: /* @__PURE__ */ e(f, { size: "small", children: /* @__PURE__ */ e(
|
|
88
|
-
g,
|
|
89
|
-
{
|
|
90
|
-
rowKey: "key",
|
|
91
|
-
size: "small",
|
|
92
|
-
columns: u,
|
|
93
|
-
dataSource: c,
|
|
94
|
-
pagination: !1
|
|
95
|
-
}
|
|
96
|
-
) })
|
|
97
|
-
}
|
|
98
|
-
]
|
|
99
|
-
}
|
|
100
|
-
)
|
|
101
|
-
] }) : /* @__PURE__ */ e(C, { type: "warning", message: "缺少本体 ID(?id=xxx)" });
|
|
102
|
-
}
|
|
103
|
-
export {
|
|
104
|
-
N as default
|
|
105
|
-
};
|