react-kggraph 0.0.3 → 0.0.5
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/lib/index.es.js +5 -0
- package/lib/{index17.esm.js → index18.es.js} +12 -12
- package/lib/{index2.esm.js → index2.es.js} +2 -5
- package/lib/index22.es.js +70 -0
- package/lib/index24.es.js +68 -0
- package/lib/index26.es.js +72 -0
- package/lib/{index29.esm.js → index27.es.js} +1 -1
- package/lib/{index30.esm.js → index28.es.js} +239 -239
- package/lib/index33.es.js +100 -0
- package/lib/{index37.esm.js → index34.es.js} +93 -93
- package/lib/index35.es.js +47 -0
- package/lib/{index39.esm.js → index36.es.js} +134 -136
- package/lib/index37.es.js +12 -0
- package/package.json +13 -8
- package/lib/components/Graph/components/PathAnalysisLevel/index.css +0 -1
- package/lib/index.cjs.js +0 -1
- package/lib/index.esm.js +0 -3
- package/lib/index10.cjs.js +0 -1
- package/lib/index11.cjs.js +0 -1
- package/lib/index12.cjs.js +0 -1
- package/lib/index13.cjs.js +0 -1
- package/lib/index14.cjs.js +0 -1
- package/lib/index15.cjs.js +0 -1
- package/lib/index16.cjs.js +0 -1
- package/lib/index17.cjs.js +0 -1
- package/lib/index18.cjs.js +0 -1
- package/lib/index19.cjs.js +0 -1
- package/lib/index2.cjs.js +0 -1
- package/lib/index21.cjs.js +0 -1
- package/lib/index21.esm.js +0 -27
- package/lib/index22.cjs.js +0 -16
- package/lib/index22.esm.js +0 -453
- package/lib/index23.cjs.js +0 -1
- package/lib/index23.esm.js +0 -10
- package/lib/index24.cjs.js +0 -1
- package/lib/index24.esm.js +0 -70
- package/lib/index26.cjs.js +0 -1
- package/lib/index26.esm.js +0 -68
- package/lib/index28.cjs.js +0 -1
- package/lib/index28.esm.js +0 -72
- package/lib/index29.cjs.js +0 -1
- package/lib/index30.cjs.js +0 -1
- package/lib/index32.cjs.js +0 -1
- package/lib/index33.cjs.js +0 -1
- package/lib/index34.cjs.js +0 -1
- package/lib/index36.cjs.js +0 -1
- package/lib/index36.esm.js +0 -100
- package/lib/index37.cjs.js +0 -1
- package/lib/index38.cjs.js +0 -1
- package/lib/index38.esm.js +0 -47
- package/lib/index39.cjs.js +0 -1
- package/lib/index4.cjs.js +0 -95
- package/lib/index40.cjs.js +0 -1
- package/lib/index5.cjs.js +0 -1
- package/lib/index6.cjs.js +0 -1
- package/lib/index7.cjs.js +0 -1
- package/lib/index8.cjs.js +0 -1
- package/lib/index9.cjs.js +0 -1
- /package/lib/{index9.esm.js → index10.es.js} +0 -0
- /package/lib/{index10.esm.js → index11.es.js} +0 -0
- /package/lib/{index11.esm.js → index12.es.js} +0 -0
- /package/lib/{index12.esm.js → index13.es.js} +0 -0
- /package/lib/{index13.esm.js → index14.es.js} +0 -0
- /package/lib/{index14.esm.js → index15.es.js} +0 -0
- /package/lib/{index15.esm.js → index16.es.js} +0 -0
- /package/lib/{index16.esm.js → index17.es.js} +0 -0
- /package/lib/{index18.esm.js → index19.es.js} +0 -0
- /package/lib/{index19.esm.js → index20.es.js} +0 -0
- /package/lib/{index32.esm.js → index29.es.js} +0 -0
- /package/lib/{index33.esm.js → index30.es.js} +0 -0
- /package/lib/{index34.esm.js → index31.es.js} +0 -0
- /package/lib/{index40.esm.js → index38.es.js} +0 -0
- /package/lib/{index4.esm.js → index5.es.js} +0 -0
- /package/lib/{index5.esm.js → index6.es.js} +0 -0
- /package/lib/{index6.esm.js → index7.es.js} +0 -0
- /package/lib/{index7.esm.js → index8.es.js} +0 -0
- /package/lib/{index8.esm.js → index9.es.js} +0 -0
package/lib/index28.esm.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { GraphContext as e } from "./index18.esm.js";
|
|
2
|
-
import { require_jsx_runtime as t } from "./index23.esm.js";
|
|
3
|
-
/* empty css */
|
|
4
|
-
import { forwardRef as n, useContext as r, useImperativeHandle as i, useState as a } from "react";
|
|
5
|
-
import { CloseOutlined as o } from "@ant-design/icons";
|
|
6
|
-
import { Button as s, Form as c, Input as l, Select as u } from "antd";
|
|
7
|
-
import d from "antd/es/form/FormItem";
|
|
8
|
-
//#region src/components/Graph/components/PathAnalysisLevel/index.tsx
|
|
9
|
-
var f = t(), p = n(({ onLevelClick: t }, n) => {
|
|
10
|
-
let [p, m] = a(!1), { graphData: h } = r(e), [g, _] = a({ level: 1 });
|
|
11
|
-
i(n, () => ({
|
|
12
|
-
open: (e) => {
|
|
13
|
-
m(!0);
|
|
14
|
-
},
|
|
15
|
-
close: () => m(!1)
|
|
16
|
-
}));
|
|
17
|
-
let v = () => {
|
|
18
|
-
m(!1);
|
|
19
|
-
}, y = (e) => {
|
|
20
|
-
t(e.name, e.level);
|
|
21
|
-
}, b = h.filter((e) => e.group === "nodes").map((e) => e.data);
|
|
22
|
-
return /* @__PURE__ */ (0, f.jsx)(f.Fragment, { children: p && /* @__PURE__ */ (0, f.jsxs)("div", {
|
|
23
|
-
className: "query-node z-10",
|
|
24
|
-
children: [/* @__PURE__ */ (0, f.jsxs)("div", {
|
|
25
|
-
className: "title",
|
|
26
|
-
children: [/* @__PURE__ */ (0, f.jsx)("span", { children: "分析N层关系" }), /* @__PURE__ */ (0, f.jsx)(o, { onClick: () => v() })]
|
|
27
|
-
}), /* @__PURE__ */ (0, f.jsxs)(c, {
|
|
28
|
-
onFinish: y,
|
|
29
|
-
initialValues: g,
|
|
30
|
-
children: [
|
|
31
|
-
/* @__PURE__ */ (0, f.jsx)(d, {
|
|
32
|
-
label: "节点名称",
|
|
33
|
-
labelCol: { span: 6 },
|
|
34
|
-
name: "name",
|
|
35
|
-
wrapperCol: { span: 14 },
|
|
36
|
-
children: /* @__PURE__ */ (0, f.jsx)(u, {
|
|
37
|
-
showSearch: !0,
|
|
38
|
-
style: { width: "200px" },
|
|
39
|
-
options: b.map((e) => ({
|
|
40
|
-
value: e.name,
|
|
41
|
-
label: e.name
|
|
42
|
-
}))
|
|
43
|
-
})
|
|
44
|
-
}),
|
|
45
|
-
/* @__PURE__ */ (0, f.jsx)(d, {
|
|
46
|
-
id: "level",
|
|
47
|
-
label: "层级",
|
|
48
|
-
labelCol: { span: 6 },
|
|
49
|
-
name: "level",
|
|
50
|
-
wrapperCol: { span: 14 },
|
|
51
|
-
children: /* @__PURE__ */ (0, f.jsx)(l, {
|
|
52
|
-
placeholder: "请输入",
|
|
53
|
-
style: { width: 200 },
|
|
54
|
-
type: "number",
|
|
55
|
-
min: 1
|
|
56
|
-
})
|
|
57
|
-
}),
|
|
58
|
-
/* @__PURE__ */ (0, f.jsx)(d, {
|
|
59
|
-
label: null,
|
|
60
|
-
style: { textAlign: "center" },
|
|
61
|
-
children: /* @__PURE__ */ (0, f.jsx)(s, {
|
|
62
|
-
type: "primary",
|
|
63
|
-
htmlType: "submit",
|
|
64
|
-
children: "查询"
|
|
65
|
-
})
|
|
66
|
-
})
|
|
67
|
-
]
|
|
68
|
-
})]
|
|
69
|
-
}) });
|
|
70
|
-
});
|
|
71
|
-
//#endregion
|
|
72
|
-
export { p as default };
|
package/lib/index29.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=require(`./index2.cjs.js`).__commonJSMin(((e,t)=>{(function(){"use strict";var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()}));Object.defineProperty(exports,`default`,{enumerable:!0,get:function(){return e()}});
|
package/lib/index30.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./index2.cjs.js`);;/* empty css */const t=require(`./index4.cjs.js`),n=require(`./index16.cjs.js`),r=require(`./index17.cjs.js`),i=require(`./index18.cjs.js`),a=require(`./index19.cjs.js`),o=require(`./index23.cjs.js`),s=require(`./index24.cjs.js`),c=require(`./index26.cjs.js`),l=require(`./index28.cjs.js`),u=require(`./index29.cjs.js`);let d=require(`react`);d=e.__toESM(d,1);let f=require(`@ant-design/icons`),p=require(`antd`);var m=e.__toESM(u.default,1),h=o.default,g=(e,t)=>n=>{n.stopPropagation(),e?.(t||``)},_=(0,d.forwardRef)(({graphInfo:e,cyRef:o,initNodeScale:u,typeObj:_,relationObj:b},x)=>{let{layoutType:ee,setLayoutType:te}=(0,d.useContext)(i.GraphContext),[S,C]=(0,d.useState)(``),[w,T]=(0,d.useState)(!1),[E,D]=(0,d.useState)(u),[O,k]=(0,d.useState)(!1),[ne,A]=(0,d.useState)(!1),[j,re]=(0,d.useState)(null),[M,N]=(0,d.useState)(!1),[P,F]=(0,d.useState)(!1),[I,L]=(0,d.useState)(`node`),R=(0,d.useRef)(null),[z,B]=(0,d.useState)(!0),[V,H]=(0,d.useState)(new Set),[U,W]=(0,d.useState)(new Set);(0,d.useImperativeHandle)(x,()=>({onPathAnalysis:()=>{J()}})),(0,d.useEffect)(()=>{G(S)},[S]);let G=async e=>{let t=o.current;if(!t||!S){t?.nodes().removeClass(`highlight`),t?.fit();return}let n=t.nodes().filter(e=>{let t=(e.data(`name`)||``).toLowerCase(),n=(e.data(`role`)||``).toLowerCase(),r=(e.data(`dept`)||``).toLowerCase(),i=String(e.data(`id`)||``).toLowerCase();return t.includes(S.toLowerCase())||n.includes(S.toLowerCase())||r.includes(S.toLowerCase())||i.includes(S.toLowerCase())});t.nodes().removeClass(`highlight`),n.addClass(`highlight`),n.length===1?(console.log(`matchedNodes:::`,n),t.animate({center:{eles:n},duration:500})):alert(`未找到对应节点`)},K=e=>{let t=o.current;if(!t)return;let n=t.zoom();console.log(999,n);let r=0;switch(e){case`out`:r=Math.max(n*.8,.1);break;case`in`:r=Math.min(n*1.2,3);break}t.zoom(r),t.center()},q=()=>{console.log(`查询节点`),k(!0),A(!1),R.current.close()},J=()=>{console.log(`路径分析`),k(!1),A(!0),R.current.close()},Y=t=>{te(t);let n=o.current;n&&(n.nodes().unlock(),a.layout(o,t),t===`cose-bilkent`&&e?.searchNodes?.length===2&&a.fixNodesToEdges(n,e.searchNodes[0],e.searchNodes[1]))},X=()=>{let e=o.current;e&&r.donwnGraphData(e)},ie=()=>{let e=o.current;e&&(re(r.getCyData(e)),N(!0))},Z=(e,t)=>{let r=e.current;r&&(t===`downloadPng`?n.downloadFile(r.png({scale:2,bg:`transparent`,full:!0,quality:1}),`graph_${Date.now()}.png`):t===`downloadJpg`&&n.downloadFile(r.jpg({scale:2,bg:`#ffffff`,full:!0,quality:1}),`graph_${Date.now()}.jpg`))},ae=()=>{let e=o.current;if(!e)return;let{nodes:n=[],edges:i=[]}=r.getCyData(e),a=n.map(e=>{let t=e.data||{},n=t.properties||{};return{节点名称:t.name||t.label||``,节点ID:t.id||``,节点类型:t.types||``,URI:t.label||``,X坐标:e.position?.x||``,Y坐标:e.position?.y||``,层级:t.level||``,宽度:t.baseWidth||``,高度:t.baseHeight||``,图片:t.image||``,属性ID:n.id||``,属性值:n.value||``}}),s=i.map(e=>{let t=e.data||{};return{源节点:t.source?.split(`/#`)[0]?.split(`/`).pop()||t.source,目标节点:t.target?.split(`/#`)[0]?.split(`/`).pop()||t.target,源URI:t.source||``,目标URI:t.target||``,关系名称:t.name||t.label||``,关系ID:t.id||``}}),c=t.utils.book_new();if(a.length>0){let e=t.utils.json_to_sheet(a);e[`!cols`]=[{wch:30},{wch:60},{wch:15},{wch:50},{wch:12},{wch:12},{wch:8},{wch:8},{wch:8},{wch:40},{wch:50},{wch:40}],t.utils.book_append_sheet(c,e,`节点`)}if(s.length>0){let e=t.utils.json_to_sheet(s);e[`!cols`]=[{wch:30},{wch:30},{wch:60},{wch:60},{wch:15},{wch:40}],t.utils.book_append_sheet(c,e,`关系`)}t.writeFileSync(c,`graph_${Date.now()}.xlsx`)},oe=(e,t)=>{switch(e.stopPropagation(),t){case`downloadJson`:X();break;case`previewJsonList`:ie();break;case`downloadExcel`:ae();break;case`previewDataList`:break;case`downloadJpg`:Z(o,t);break;case`downloadPng`:Z(o,t);break}},se=()=>{k(!1),A(!1),R.current.open()},ce=e=>{let t=o.current;if(t)if(t.panningEnabled(!0),e===`all`)t.nodes().addClass(`selected`),t.nodes().select(),t.elements().select();else if(e===`reverse`){let e=t.elements().filter(`:selected`),n=t.elements().not(`:selected`);e.length>0?(e.unselect(),n.select(),e.removeClass(`selected`),n.addClass(`selected`)):(t.elements().select(),t.elements().addClass(`selected`))}else e===`click`?(t.off(`click`,`node`),t.on(`click`,`node`,e=>{let n=e.target;t.nodes().removeClass(`selected grayed highlighted`),t.edges().removeClass(`selected grayed highlighted`),n.addClass(`selected`);let r=n.neighborhood().nodes().add(n),i=r.edgesWith(r);console.log(`cy.nodes().not(relatedNodes):::`,r),t.nodes().not(r).addClass(`grayed`),t.edges().not(i).addClass(`grayed`),r.addClass(`highlighted`),i.addClass(`highlighted`)})):e===`box`&&(console.log(`进入框选模式`),t.nodes().removeClass(`selected`),t.nodes().unselect(),t.elements().unselect(),t.boxSelectionEnabled(!0),t.panningEnabled(!1),t.on(`boxselectstart`,()=>{console.log(`开始框选...`)}),t.on(`boxselect`,e=>{let n=t.elements(`:selected`);console.log(`框选完成,选中元素数:`,n.length),t.elements().removeClass(`selected`),n.addClass(`selected`)}),t.on(`boxselectend`,()=>{console.log(`框选结束`),t.zoomingEnabled(!0),t.panningEnabled(!0)}))},le=()=>{let e=o.current;if(console.log(`isShow::::`),w)T(!1),e.nodes(`[types="typed-literal" ]`).style(`visibility`,`visible`),e.edges().style(`visibility`,`visible`);else{T(!0);let t=e.nodes(`[types="typed-literal" ]`);t.style(`visibility`,`hidden`),t.connectedEdges().style(`visibility`,`hidden`)}},Q=e=>{let t=o.current;if(!t)return;let n=e===`out`?Math.max(E*.8,.1):Math.min(E*1.2,5);D(n);let r=t.nodes();r.style(`width`,e=>(e.data(`baseWidth`)||80)*n),r.style(`height`,e=>(e.data(`baseHeight`)||80)*n)},$=e=>{C(e.content),G(e.content)},ue=(e=`刘强东`,t=`1`)=>{let n=o.current;if(!n)return;n.elements().removeClass(`level-highlight level-selected level-grayed level-highlightedge`);let r=n.nodes().filter(t=>(t.data(`name`)||t.data(`id`)||``).toString().includes(e));if(r.length===0){p.message.warning(`未找到节点: ${e}`);return}let i=parseInt(t)||1,a=n.collection(),s=[];r.forEach(e=>{e.addClass(`level-selected`),a.merge(e);let t=n.collection(),r=new Set;r.add(e.id()),i>=1&&(t=e.neighborhood().nodes(),t.forEach(e=>{r.add(e.id()),a.merge(e)}),s.push(t));for(let e=2;e<=i;e++){let e=n.collection();t.forEach(t=>{t.neighborhood().nodes().forEach(t=>{r.has(t.id())||(r.add(t.id()),e.merge(t))})}),e.forEach(e=>a.merge(e)),s.push(e),t=e}}),s.forEach(e=>{e.addClass(`level-highlight`)}),n.edges().filter(e=>{let t=e.source(),n=e.target();return a.contains(t)&&a.contains(n)}).addClass(`level-highlightedge`);let c=n.elements().filter(`.level-selected, .level-highlight, .level-highlightedge`);n.elements().not(c).addClass(`level-grayed`),p.message.success(`已高亮 "${e}" 及其 ${i} 度关联节点和连线`)},de=e=>{let t=o.current;if(!t)return;let n=new Set(V);n.has(e)?(n.delete(e),t.nodes().filter(t=>t.data(`type`)===e).show()):(n.add(e),t.nodes().filter(t=>t.data(`type`)===e).hide()),H(n)},fe=e=>{let t=o.current;if(!t)return;let n=new Set(U);n.has(e)?(n.delete(e),t.edges().filter(t=>t.data(`name`)===e).show()):(n.add(e),t.edges().filter(t=>t.data(`name`)===e).hide()),W(n)},pe=()=>{let e=o.current;e.remove(e.elements())},me=()=>{F(!0)};return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:`graph-bar`,children:(0,h.jsxs)(`div`,{className:`graph-bar-min`,children:[(0,h.jsxs)(p.Flex,{wrap:!0,align:`center`,justify:`center`,className:`hover:text-[#145afd] cursor`,onClick:()=>B(!z),children:[(0,h.jsx)(f.AppstoreOutlined,{}),(0,h.jsx)(p.Flex,{className:`w-100% `,justify:`center`,children:`查询统计`})]}),(0,h.jsx)(p.Dropdown,{menu:{items:r.layoutCongig?.map(e=>({...e,label:(0,h.jsx)(`div`,{className:(0,m.default)({"text-[#145afd]":ee===e.key}),onClick:g(Y,e.key),children:e.label})}))},children:(0,h.jsxs)(p.Flex,{wrap:!0,align:`center`,justify:`center`,className:`hover:text-[#145afd] cursor`,children:[(0,h.jsx)(f.TableOutlined,{}),(0,h.jsx)(p.Flex,{className:`w-100% `,justify:`center`,children:`布局`})]})}),(0,h.jsxs)(p.Flex,{wrap:!0,align:`center`,justify:`center`,className:`hover:text-[#145afd] cursor`,onClick:()=>me(),children:[(0,h.jsx)(f.RobotOutlined,{}),(0,h.jsx)(p.Flex,{className:`w-100% `,justify:`center`,children:`图显示设置`})]}),(0,h.jsx)(p.Dropdown,{menu:{items:r.linkAnalysis.map(e=>({...e,label:(0,h.jsx)(`div`,{onClick:t=>{switch(t.stopPropagation(),e.key){case`query`:q();break;case`link`:se();break;case`path`:J();break}},children:e.label})}))},children:(0,h.jsxs)(p.Flex,{wrap:!0,align:`center`,justify:`center`,className:`hover:text-[#145afd] cursor`,children:[(0,h.jsx)(f.LineChartOutlined,{}),(0,h.jsx)(p.Flex,{className:`w-100% `,justify:`center`,children:`分析`})]})}),(0,h.jsx)(p.Dropdown,{menu:{items:r.choiceConfig?.map(e=>({...e,label:(0,h.jsx)(`div`,{onClick:g(ce,e.key),children:e.label})}))},children:(0,h.jsxs)(p.Flex,{wrap:!0,align:`center`,justify:`center`,className:`hover:text-[#145afd] cursor`,children:[(0,h.jsx)(f.SelectOutlined,{}),(0,h.jsx)(p.Flex,{className:`w-100% `,justify:`center`,children:`选择`})]})}),(0,h.jsx)(p.Dropdown,{menu:{items:r.downloadData?.map(e=>({...e,label:(0,h.jsx)(`div`,{onClick:t=>oe(t,e.key),children:e.label})}))},children:(0,h.jsxs)(p.Flex,{wrap:!0,align:`center`,justify:`center`,className:`hover:text-[#145afd] cursor`,children:[(0,h.jsx)(f.SaveOutlined,{}),(0,h.jsx)(p.Flex,{className:`w-100% `,justify:`center`,children:`下载数据`})]})}),(0,h.jsxs)(p.Flex,{wrap:!0,align:`center`,justify:`center`,className:`hover:text-[#145afd] cursor`,onClick:()=>le(),children:[(0,h.jsx)(f.BorderOuterOutlined,{}),(0,h.jsx)(p.Flex,{className:`w-100% `,justify:`center`,children:`隐藏属性`})]}),(0,h.jsx)(p.Dropdown,{menu:{items:r.textPositionConfig?.map(e=>({...e,label:(0,h.jsx)(`div`,{onClick:g(()=>r.textLayout(o,e.key),e.key),children:e.label})}))},children:(0,h.jsxs)(p.Flex,{wrap:!0,align:`center`,justify:`center`,className:`hover:text-[#145afd] cursor`,children:[(0,h.jsx)(f.LineHeightOutlined,{}),(0,h.jsx)(p.Flex,{className:`w-100% `,justify:`center`,children:`文字位置`})]})}),(0,h.jsxs)(p.Flex,{wrap:!0,align:`center`,justify:`center`,className:`hover:text-[#145afd] cursor`,onClick:()=>pe(),children:[(0,h.jsx)(f.ClearOutlined,{}),(0,h.jsx)(p.Flex,{className:`w-100% `,justify:`center`,children:`清空画布`})]}),(0,h.jsxs)(p.Flex,{wrap:!0,align:`center`,justify:`center`,className:`hover:text-[#145afd] cursor`,children:[(0,h.jsxs)(p.Flex,{gap:`5px`,children:[(0,h.jsx)(f.PlusCircleOutlined,{onClick:()=>Q(`in`)}),(0,h.jsx)(f.MinusCircleOutlined,{onClick:()=>Q(`out`)})]}),(0,h.jsx)(p.Flex,{className:`w-100% `,justify:`center`,children:`节点缩放`})]}),(0,h.jsxs)(p.Flex,{wrap:!0,align:`center`,justify:`center`,className:`hover:text-[#145afd] cursor`,children:[(0,h.jsxs)(p.Flex,{gap:`5px`,children:[(0,h.jsx)(f.PlusSquareOutlined,{onClick:()=>K(`in`)}),(0,h.jsx)(f.MinusSquareOutlined,{onClick:()=>K(`out`)})]}),(0,h.jsx)(p.Flex,{className:`w-100% `,justify:`center`,children:`画布缩放`})]})]})}),(0,h.jsx)(s.default,{isVisible:O,searchChange:e=>$(e),closeQuery:()=>k(!1)}),(0,h.jsx)(c.default,{isVisible:ne,analysis:e=>r.handleCalcPath(o,{pathNodes:e}),closePath:()=>A(!1)}),(0,h.jsx)(l.default,{ref:R,onLevelClick:ue}),(0,h.jsx)(p.Modal,{title:`JSON预览`,open:M,onCancel:()=>N(!1),footer:null,width:800,children:(0,h.jsx)(`pre`,{style:{maxHeight:`60vh`,overflow:`auto`,background:`#f5f5f5`,padding:`16px`,borderRadius:`4px`},children:j?JSON.stringify(j,null,2):`暂无数据`})}),(0,h.jsx)(p.Drawer,{title:`图显示设置`,placement:`right`,open:P,onClose:()=>F(!1),mask:!1,width:350,getContainer:!1,children:(0,h.jsx)(p.Tabs,{activeKey:I,onChange:L,items:[{label:`节点设置`,key:`node`,children:(0,h.jsx)(v,{onSave:e=>{let t=o.current;t&&(t.nodes().forEach(t=>{t.style({width:e.nodeSize,height:e.nodeSize,"font-size":e.fontSize,color:e.fontColor,"font-weight":e.fontWeight,"font-style":e.fontStyle,"text-valign":e.textPosition,"text-halign":`center`,"text-margin-y":e.textOffset,label:e.showLabel===`show`?t.data(`name`)||t.data(`label`):``})}),p.message.success(`节点配置保存成功`))}})},{label:`连线设置`,key:`edge`,children:(0,h.jsx)(y,{onSave:e=>{let t=o.current;t&&(t.edges().forEach(t=>{t.style({width:e.edgeWidth,"line-color":e.edgeColorType===`custom`?e.customColor:`#a29e9e`,"target-arrow-color":e.edgeColorType===`custom`?e.customColor:`#a29e9e`,"target-arrow-shape":e.showArrow===`show`?`triangle`:`none`,"font-size":e.fontSize,color:e.fontColor,"font-weight":e.fontWeight,"font-style":e.fontStyle,label:e.showLabel===`show`?t.data(`label`)||t.data(`name`):``,"text-background-color":e.labelBgColor||`transparent`,"text-background-opacity":+!!e.labelBgColor,"text-background-padding":`2px`})}),p.message.success(`连线配置保存成功`))}})}]})}),(0,h.jsx)(`div`,{className:(0,m.default)(`absolute right-0px z-1 bg-#fff p-10px rounded-10px shadow-[0_4px_20px_0px_rgba(12,95,218,0.33)] w-200px`,{hidden:!z}),children:(0,h.jsx)(p.Tabs,{items:[{label:`实体`,key:`entity`,children:(0,h.jsx)(h.Fragment,{children:Object.keys(_).length>0?(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`p`,{children:[`实体数量:`,Object.values(_).reduce((e,t)=>e+t.count,0)]}),(0,h.jsxs)(`p`,{className:`my-4px`,children:[`实体类型:`,Object.keys(_).length]}),(0,h.jsx)(p.Flex,{gap:`5px`,justify:`start`,className:`w-100%`,wrap:!0,children:Object.keys(_).map(e=>(0,h.jsxs)(p.Flex,{gap:`4px`,justify:`start`,className:`w-100% cursor ${V.has(e)?`opacity-30`:``}`,onClick:()=>de(e),children:[(0,h.jsx)(`img`,{className:`w-20px rounded-50%`,src:_[e].img,alt:``}),e,`:`,_[e].count]},e))})]}):(0,h.jsx)(`span`,{className:`text-[#666]`,children:`暂无实体统计!`})})},{label:`关系`,key:`relation`,children:(0,h.jsx)(h.Fragment,{children:Object.keys(b)?.length>0?(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`div`,{children:[`关系数量:`,Object.keys(b)?.length]}),(0,h.jsxs)(`div`,{className:`my-4px`,children:[`关系类型:`,Object.values(b)?.reduce((e,t)=>e+t,0)]}),(0,h.jsx)(p.Flex,{gap:`5px`,justify:`start`,className:`w-100%`,wrap:!0,children:Object.keys(b).map(e=>(0,h.jsxs)(p.Flex,{gap:`4px`,className:`w-100% cursor ${U.has(e)?`opacity-30`:``}`,onClick:()=>fe(e),children:[e,`:`,b[e]]},e))})]}):(0,h.jsx)(`span`,{className:`text-[#666]`,children:`暂无关系统计!`})})}]})})]})}),v=({onSave:e})=>{let[t]=p.Form.useForm();return(0,h.jsxs)(p.Form,{form:t,layout:`vertical`,onFinish:e,children:[(0,h.jsx)(p.Form.Item,{label:`节点大小`,name:`nodeSize`,initialValue:80,children:(0,h.jsx)(p.Input,{type:`number`,placeholder:`请输入节点大小`})}),(0,h.jsx)(p.Form.Item,{label:`显示标签`,name:`showLabel`,initialValue:`show`,children:(0,h.jsxs)(p.Select,{children:[(0,h.jsx)(p.Select.Option,{value:`show`,children:`显示`}),(0,h.jsx)(p.Select.Option,{value:`hide`,children:`隐藏`})]})}),(0,h.jsx)(p.Form.Item,{label:`字体位置`,name:`textPosition`,initialValue:`bottom`,children:(0,h.jsx)(p.Select,{children:r.textPositionConfig.map(e=>(0,h.jsx)(p.Select.Option,{value:e.key,children:e.label},e.item))})}),(0,h.jsx)(p.Form.Item,{label:`字体偏移`,name:`textOffset`,initialValue:5,children:(0,h.jsx)(p.Input,{type:`number`,placeholder:`请输入字体偏移量`})}),(0,h.jsx)(p.Form.Item,{label:`字体颜色`,name:`fontColor`,initialValue:`rgb(50,50,50)`,children:(0,h.jsx)(p.Input,{placeholder:`请输入字体颜色`})}),(0,h.jsx)(p.Form.Item,{label:`字体大小`,name:`fontSize`,initialValue:18,children:(0,h.jsx)(p.Input,{type:`number`,placeholder:`请输入字体大小`})}),(0,h.jsx)(p.Form.Item,{label:`字体粗细`,name:`fontWeight`,initialValue:`normal`,children:(0,h.jsxs)(p.Select,{children:[(0,h.jsx)(p.Select.Option,{value:`normal`,children:`常规`}),(0,h.jsx)(p.Select.Option,{value:`bold`,children:`粗体`}),(0,h.jsx)(p.Select.Option,{value:`lighter`,children:`细体`})]})}),(0,h.jsx)(p.Form.Item,{label:`字体样式`,name:`fontStyle`,initialValue:`normal`,children:(0,h.jsxs)(p.Select,{children:[(0,h.jsx)(p.Select.Option,{value:`normal`,children:`默认`}),(0,h.jsx)(p.Select.Option,{value:`italic`,children:`斜体`})]})}),(0,h.jsx)(p.Form.Item,{children:(0,h.jsx)(p.Button,{type:`primary`,htmlType:`submit`,block:!0,children:`保存节点配置`})})]})},y=({onSave:e})=>{let[t]=p.Form.useForm(),[n,r]=(0,d.useState)(`default`);return(0,h.jsxs)(p.Form,{form:t,layout:`vertical`,onFinish:e,children:[(0,h.jsx)(p.Form.Item,{label:`类型`,name:`edgeType`,initialValue:`straight`,children:(0,h.jsxs)(p.Select,{children:[(0,h.jsx)(p.Select.Option,{value:`straight`,children:`直线`}),(0,h.jsx)(p.Select.Option,{value:`curve`,children:`曲线`})]})}),(0,h.jsx)(p.Form.Item,{label:`连线宽度`,name:`edgeWidth`,initialValue:2,children:(0,h.jsx)(p.Input,{type:`number`,placeholder:`请输入连线宽度`})}),(0,h.jsx)(p.Form.Item,{label:`连线箭头`,name:`showArrow`,initialValue:`show`,children:(0,h.jsxs)(p.Select,{children:[(0,h.jsx)(p.Select.Option,{value:`show`,children:`显示`}),(0,h.jsx)(p.Select.Option,{value:`hide`,children:`隐藏`})]})}),(0,h.jsx)(p.Form.Item,{label:`连线颜色`,name:`edgeColorType`,initialValue:`default`,children:(0,h.jsxs)(p.Select,{onChange:r,children:[(0,h.jsx)(p.Select.Option,{value:`default`,children:`默认`}),(0,h.jsx)(p.Select.Option,{value:`custom`,children:`自定义色`})]})}),n===`custom`&&(0,h.jsx)(p.Form.Item,{label:`自定义颜色`,name:`customColor`,initialValue:`rgb(20,20,20)`,children:(0,h.jsx)(p.Input,{placeholder:`请输入自定义颜色`})}),(0,h.jsx)(p.Form.Item,{label:`显示标签`,name:`showLabel`,initialValue:`show`,children:(0,h.jsxs)(p.Select,{children:[(0,h.jsx)(p.Select.Option,{value:`show`,children:`显示`}),(0,h.jsx)(p.Select.Option,{value:`hide`,children:`隐藏`})]})}),(0,h.jsx)(p.Form.Item,{label:`字体大小`,name:`fontSize`,initialValue:14,children:(0,h.jsx)(p.Input,{type:`number`,placeholder:`请输入字体大小`})}),(0,h.jsx)(p.Form.Item,{label:`字体粗细`,name:`fontWeight`,initialValue:`normal`,children:(0,h.jsxs)(p.Select,{children:[(0,h.jsx)(p.Select.Option,{value:`normal`,children:`常规`}),(0,h.jsx)(p.Select.Option,{value:`bold`,children:`粗体`})]})}),(0,h.jsx)(p.Form.Item,{label:`字体样式`,name:`fontStyle`,initialValue:`normal`,children:(0,h.jsxs)(p.Select,{children:[(0,h.jsx)(p.Select.Option,{value:`normal`,children:`默认`}),(0,h.jsx)(p.Select.Option,{value:`italic`,children:`斜体`})]})}),(0,h.jsx)(p.Form.Item,{label:`字体颜色`,name:`fontColor`,initialValue:`rgb(50,50,50)`,children:(0,h.jsx)(p.Input,{placeholder:`请输入字体颜色`})}),(0,h.jsx)(p.Form.Item,{label:`标签背色`,name:`labelBgColor`,initialValue:``,children:(0,h.jsx)(p.Input,{placeholder:`请选择颜色`})}),(0,h.jsx)(p.Form.Item,{children:(0,h.jsx)(p.Button,{type:`primary`,htmlType:`submit`,block:!0,children:`保存连线配置`})})]})};exports.default=_;
|
package/lib/index32.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=e=>{},t=e=>{};exports.fullSearchDetail=t,exports.stepNext=e;
|
package/lib/index33.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=[{selector:`node`,style:{"text-margin-y":`5px`}},{selector:`edge`,style:{"line-color":`#a29e9e`,"target-arrow-color":`#a29e9e`,opacity:1,"target-arrow-shape":`triangle`,width:2,"curve-style":`bezier`,"transition-property":`line-color, target-arrow-color, opacity`,"transition-duration":`0.2s`,label:`data(name)`,"z-index":9999,"text-opacity":1,"font-size":18,color:`#666`,"text-background-color":`#fff`,"text-background-opacity":1,"text-background-shape":`roundrectangle`,"text-background-padding":`3px`}},{selector:`.highlight`,style:{"border-color":`rgba(174, 255, 45, 0.2)`,"border-width":4}},{selector:`.path-node`,style:{"background-color":`#145AFD`,"border-color":`#FFEB3B`}},{selector:`.path-edge`,style:{"line-color":`#145AFD`,"target-arrow-color":`#145AFD`,width:4}},{selector:`.grayed`,style:{opacity:.15,"text-opacity":.15}},{selector:`node.selected, edge.selected`,style:{"border-color":`rgba(174, 255, 45, 0.2)`,"border-width":4}},{selector:`.correlationStyle`,style:{width:60,height:60,"outline-width":`10px`,"outline-color":`rgba(188, 220, 255, 0.4)`,"outline-style":`solid`,"line-opacity":`0.2`,"outline-offset":`2px`,filter:`blur(20px)`,"z-index":9999}},{selector:`.hover`,style:{"border-width":3,"border-color":`#0d6ac2`}},{selector:`.level-selected`,style:{"background-color":`#f8bbd0`,"border-color":`#e91e63`,"border-width":4,color:`#880e4f`}},{selector:`.level-highlight`,style:{"background-color":`#bbdefb`,"border-color":`#2196f3`,"border-width":3,color:`#0d47a1`}},{selector:`.level-highlightedge`,style:{"line-color":`#1976d2`,"target-arrow-color":`#1976d2`,width:3,opacity:1}},{selector:`.level-grayed`,style:{opacity:.15,"text-opacity":.15}}],t=({elements:t})=>{let n=[];t.map(e=>{!n.includes(e?.data?.type)&&e?.data?.type&&n.push(e.data?.type)});let r=[];return r.push({selector:`[properties-type="uri"]`,style:{"background-color":`#f7de63`,"background-image":`data(image)`,"background-fit":`cover`,width:80,height:80,label:`data(name)`,color:`black`,"text-valign":`bottom`,"font-size":18,"text-max-width":`250px`,"text-wrap":`ellipsis`,"text-overflow-wrap":`anywhere`}}),r.push({selector:`[properties-type!="uri"]`,style:{"background-color":`#1890FF`,"background-image":`data(image)`,"background-fit":`cover`,width:80,height:80,label:`data(name)`,color:`black`,"text-valign":`bottom`,"font-size":18,"text-max-width":`250px`,"text-wrap":`ellipsis`,"text-overflow-wrap":`anywhere`}}),r.concat(e)};exports.edgeNodeStyles=t;
|
package/lib/index34.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=({cyRef:e,setContextMenu:t,onPathAnalysis:n,setPathNodes:r})=>[{label:`展收实体`,ids:`contract`,action:t=>{let n=e.current;console.log(`新增属性`,n)}},{label:`展收属性`,ids:`expanded`,action:t=>{if(console.log(`展开`,t),!e.current){console.error(`Cytoscape instance is not available`);return}console.log(`New node and edge added`)}},{label:`节点信息`,ids:`nodeInfo`,action:e=>{console.log(`节点信息:`,e)}},{label:`知识卡片`,ids:`knowledgeCard`,action:t=>{let n=e.current;console.log(`知识卡片`,n)}},{label:`选中关联`,ids:`selRelate`,action:n=>{let r=e.current;if(!r||!n||n.removed()){console.error(`节点或Cytoscape实例无效`),t(e=>({...e,visible:!1}));return}let i=n,a=i.neighborhood().nodes().add(i);a.edgesWith(a),r.nodes().not(a).removeClass(`correlationStyle`),a.addClass(`correlationStyle`),t(e=>({...e,visible:!1}))}},{label:`路径分析`,action:t=>{e.current,console.log(11,t.data(`name`)),n?.(),r([t.data(`name`),``])}},{label:`删除节点`,action:t=>{let n=e.current;console.log(`删除节点cy::::`,n),t&&!t.removed()&&t.remove()}}];exports.menuItemsConfig=e;
|
package/lib/index36.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./index2.cjs.js`),t=require(`./index23.cjs.js`);;/* empty css */let n=require(`react`);n=e.__toESM(n,1);var r=t.default,i=({items:e=[],centerImage:t,size:i=200,onClick:a})=>{let o=i/2,s=i/2-10,c=360/e.length,l=(0,n.useMemo)(()=>e.map((e,t)=>{let n=(t*c-90)*(Math.PI/180),r=((t+1)*c-90)*(Math.PI/180),i=((t+.5)*c-90)*(Math.PI/180),a=o+s*Math.cos(n),l=o+s*Math.sin(n),u=o+s*Math.cos(r),d=o+s*Math.sin(r),f=o+30*Math.cos(r),p=o+30*Math.sin(r),m=o+30*Math.cos(n),h=o+30*Math.sin(n),g=+(c>180),_=`M ${m} ${h} L ${a} ${l} A ${s} ${s} 0 ${g} 1 ${u} ${d} L ${f} ${p} A 30 30 0 ${g} 0 ${m} ${h}`,v=(s+30)/2+5,y=o+v*Math.cos(i),b=o+v*Math.sin(i);return{...e,path:_,textX:y,textY:b,rotation:(t+.5)*c-90}}),[e,c,o,s,30]);return(0,r.jsxs)(`div`,{className:`radial-menu`,style:{width:i,height:i},children:[(0,r.jsxs)(`svg`,{width:i,height:i,className:`radial-svg`,children:[(0,r.jsx)(`defs`,{children:(0,r.jsx)(`filter`,{id:`shadow`,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,children:(0,r.jsx)(`feDropShadow`,{dx:`0`,dy:`2`,stdDeviation:`3`,floodOpacity:`0.3`})})}),(0,r.jsx)(`circle`,{cx:o,cy:o,r:s,fill:`#f5f5f5`,stroke:`#ddd`,strokeWidth:`1`}),l.map((e,t)=>(200+t*25,(0,r.jsxs)(`g`,{onClick:()=>a(e),className:`sector-group`,children:[(0,r.jsx)(`path`,{d:e.path,fill:`#333`,stroke:`rgb(185, 185, 185)`,strokeWidth:`1`,filter:`url(#shadow)`,className:`sector-path`}),(0,r.jsx)(`text`,{x:e.textX,y:e.textY,textAnchor:`middle`,dominantBaseline:`middle`,fill:`#fff`,fontSize:`12`,fontWeight:`500`,className:`sector-label`,children:e.label})]},t))),(0,r.jsx)(`circle`,{cx:o,cy:o,r:32,fill:`#fff`})]}),(0,r.jsx)(`div`,{className:`center-avatar`,style:{width:60,height:60},children:t?(0,r.jsx)(`img`,{src:t,alt:`avatar`}):(0,r.jsx)(`span`,{className:`center-text`,children:`菜单`})})]})};exports.default=i;
|
package/lib/index36.esm.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { require_jsx_runtime as e } from "./index23.esm.js";
|
|
2
|
-
/* empty css */
|
|
3
|
-
import { useMemo as t } from "react";
|
|
4
|
-
//#region src/components/Graph/components/SettingCircle/index.tsx
|
|
5
|
-
var n = e(), r = ({ items: e = [], centerImage: r, size: i = 200, onClick: a }) => {
|
|
6
|
-
let o = i / 2, s = i / 2 - 10, c = 360 / e.length, l = t(() => e.map((e, t) => {
|
|
7
|
-
let n = (t * c - 90) * (Math.PI / 180), r = ((t + 1) * c - 90) * (Math.PI / 180), i = ((t + .5) * c - 90) * (Math.PI / 180), a = o + s * Math.cos(n), l = o + s * Math.sin(n), u = o + s * Math.cos(r), d = o + s * Math.sin(r), f = o + 30 * Math.cos(r), p = o + 30 * Math.sin(r), m = o + 30 * Math.cos(n), h = o + 30 * Math.sin(n), g = +(c > 180), _ = `M ${m} ${h} L ${a} ${l} A ${s} ${s} 0 ${g} 1 ${u} ${d} L ${f} ${p} A 30 30 0 ${g} 0 ${m} ${h}`, v = (s + 30) / 2 + 5, y = o + v * Math.cos(i), b = o + v * Math.sin(i);
|
|
8
|
-
return {
|
|
9
|
-
...e,
|
|
10
|
-
path: _,
|
|
11
|
-
textX: y,
|
|
12
|
-
textY: b,
|
|
13
|
-
rotation: (t + .5) * c - 90
|
|
14
|
-
};
|
|
15
|
-
}), [
|
|
16
|
-
e,
|
|
17
|
-
c,
|
|
18
|
-
o,
|
|
19
|
-
s,
|
|
20
|
-
30
|
|
21
|
-
]);
|
|
22
|
-
return /* @__PURE__ */ (0, n.jsxs)("div", {
|
|
23
|
-
className: "radial-menu",
|
|
24
|
-
style: {
|
|
25
|
-
width: i,
|
|
26
|
-
height: i
|
|
27
|
-
},
|
|
28
|
-
children: [/* @__PURE__ */ (0, n.jsxs)("svg", {
|
|
29
|
-
width: i,
|
|
30
|
-
height: i,
|
|
31
|
-
className: "radial-svg",
|
|
32
|
-
children: [
|
|
33
|
-
/* @__PURE__ */ (0, n.jsx)("defs", { children: /* @__PURE__ */ (0, n.jsx)("filter", {
|
|
34
|
-
id: "shadow",
|
|
35
|
-
x: "-20%",
|
|
36
|
-
y: "-20%",
|
|
37
|
-
width: "140%",
|
|
38
|
-
height: "140%",
|
|
39
|
-
children: /* @__PURE__ */ (0, n.jsx)("feDropShadow", {
|
|
40
|
-
dx: "0",
|
|
41
|
-
dy: "2",
|
|
42
|
-
stdDeviation: "3",
|
|
43
|
-
floodOpacity: "0.3"
|
|
44
|
-
})
|
|
45
|
-
}) }),
|
|
46
|
-
/* @__PURE__ */ (0, n.jsx)("circle", {
|
|
47
|
-
cx: o,
|
|
48
|
-
cy: o,
|
|
49
|
-
r: s,
|
|
50
|
-
fill: "#f5f5f5",
|
|
51
|
-
stroke: "#ddd",
|
|
52
|
-
strokeWidth: "1"
|
|
53
|
-
}),
|
|
54
|
-
l.map((e, t) => (200 + t * 25, /* @__PURE__ */ (0, n.jsxs)("g", {
|
|
55
|
-
onClick: () => a(e),
|
|
56
|
-
className: "sector-group",
|
|
57
|
-
children: [/* @__PURE__ */ (0, n.jsx)("path", {
|
|
58
|
-
d: e.path,
|
|
59
|
-
fill: "#333",
|
|
60
|
-
stroke: "rgb(185, 185, 185)",
|
|
61
|
-
strokeWidth: "1",
|
|
62
|
-
filter: "url(#shadow)",
|
|
63
|
-
className: "sector-path"
|
|
64
|
-
}), /* @__PURE__ */ (0, n.jsx)("text", {
|
|
65
|
-
x: e.textX,
|
|
66
|
-
y: e.textY,
|
|
67
|
-
textAnchor: "middle",
|
|
68
|
-
dominantBaseline: "middle",
|
|
69
|
-
fill: "#fff",
|
|
70
|
-
fontSize: "12",
|
|
71
|
-
fontWeight: "500",
|
|
72
|
-
className: "sector-label",
|
|
73
|
-
children: e.label
|
|
74
|
-
})]
|
|
75
|
-
}, t))),
|
|
76
|
-
/* @__PURE__ */ (0, n.jsx)("circle", {
|
|
77
|
-
cx: o,
|
|
78
|
-
cy: o,
|
|
79
|
-
r: 32,
|
|
80
|
-
fill: "#fff"
|
|
81
|
-
})
|
|
82
|
-
]
|
|
83
|
-
}), /* @__PURE__ */ (0, n.jsx)("div", {
|
|
84
|
-
className: "center-avatar",
|
|
85
|
-
style: {
|
|
86
|
-
width: 60,
|
|
87
|
-
height: 60
|
|
88
|
-
},
|
|
89
|
-
children: r ? /* @__PURE__ */ (0, n.jsx)("img", {
|
|
90
|
-
src: r,
|
|
91
|
-
alt: "avatar"
|
|
92
|
-
}) : /* @__PURE__ */ (0, n.jsx)("span", {
|
|
93
|
-
className: "center-text",
|
|
94
|
-
children: "菜单"
|
|
95
|
-
})
|
|
96
|
-
})]
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
//#endregion
|
|
100
|
-
export { r as default };
|
package/lib/index37.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./index2.cjs.js`),t=require(`./index23.cjs.js`);let n=require(`react`);n=e.__toESM(n,1);let r=require(`antd`);var i=t.default,a=(0,n.forwardRef)((e,t)=>{let[a,o]=(0,n.useState)(!1),[s,c]=(0,n.useState)({style:{},data:{}});(0,n.useImperativeHandle)(t,()=>({open:e=>{o(!0),c(e)},close:()=>o(!1)}));let l=()=>{o(!1)},u=e=>{let{name:t,value:n}=e.target;c(e=>({...e,[t]:n}))};return(0,i.jsx)(r.Drawer,{title:`节点配置`,closable:{"aria-label":`Close Button`},onClose:l,open:a,getContainer:!1,children:(0,i.jsx)(`div`,{className:`h-full overflow-y-auto z-50`,children:(0,i.jsxs)(`div`,{className:`space-y-4`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-4 !mb-20px`,children:[(0,i.jsx)(`label`,{className:`w-40`,children:`名称`}),(0,i.jsx)(`input`,{name:`name`,value:s.data.name,onChange:u,readOnly:!0,className:`flex-1 px-3 py-1.5 border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-blue-500`})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-4 !mb-20px`,children:[(0,i.jsx)(`label`,{className:`w-40`,children:`类型`}),(0,i.jsxs)(`select`,{name:`type`,value:s.type,disabled:!0,onChange:u,className:`flex-1 px-3 py-1.5 border border-gray-300 rounded bg-white`,children:[(0,i.jsx)(`option`,{value:`圆形`,children:`圆形`}),(0,i.jsx)(`option`,{value:`矩形`,children:`矩形`})]})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-4 !mb-20px`,children:[(0,i.jsx)(`label`,{className:`w-40`,children:`颜色`}),(0,i.jsxs)(`div`,{className:`flex-1 flex gap-2 items-center`,children:[(0,i.jsx)(`input`,{name:`color`,readOnly:!0,value:s.style.color,onChange:u,className:`flex-1 px-3 py-1.5 border border-gray-300 rounded h-30px`}),(0,i.jsx)(`input`,{type:`color`,readOnly:!0,value:s.style.color,onChange:e=>c({...s,color:e.target.value}),className:`h-20px w-20px rounded cursor-pointer border`})]})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-4 !mb-20px`,children:[(0,i.jsx)(`label`,{className:`w-40`,children:`大小`}),(0,i.jsx)(`input`,{type:`number`,name:`size`,readOnly:!0,value:parseInt(s.style.height),onChange:u,className:`flex-1 px-3 py-1.5 border border-gray-300 rounded `})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-4 !mb-20px`,children:[(0,i.jsx)(`label`,{className:`w-40`,children:`边框宽度`}),(0,i.jsx)(`input`,{type:`number`,name:`borderWidth`,readOnly:!0,value:parseInt(s.style.borderWidth),onChange:u,className:`flex-1 px-3 py-1.5 border border-gray-300 rounded `})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-4 !mb-20px`,children:[(0,i.jsx)(`label`,{className:`w-40`,children:`边框虚线`}),(0,i.jsxs)(`select`,{name:`borderDash`,value:s.style.borderDash,disabled:!0,onChange:u,className:`flex-1 px-3 py-1.5 border border-gray-300 rounded bg-white`,children:[(0,i.jsx)(`option`,{value:`否`,children:`否`}),(0,i.jsx)(`option`,{value:`是`,children:`是`})]})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-4 !mb-20px`,children:[(0,i.jsx)(`label`,{className:`w-40`,children:`边框颜色`}),(0,i.jsxs)(`div`,{className:`flex-1 flex gap-2 items-center`,children:[(0,i.jsx)(`input`,{name:`borderColor`,value:s.style.borderColor,readOnly:!0,onChange:u,className:`flex-1 px-3 py-1.5 border border-gray-300 rounded h-30px`}),(0,i.jsx)(`input`,{type:`color`,value:s.borderColor,readOnly:!0,onChange:e=>c({...s,borderColor:e.target.value}),className:`h-20px w-20px rounded cursor-pointer border`})]})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-4 !mb-20px`,children:[(0,i.jsx)(`label`,{className:`w-40`,children:`字体位置`}),(0,i.jsxs)(`select`,{name:`fontPosition`,value:s.style.textValign,disabled:!0,onChange:u,className:`flex-1 px-3 py-1.5 border border-gray-300 rounded bg-white`,children:[(0,i.jsx)(`option`,{value:`center`,children:`居中`}),(0,i.jsx)(`option`,{value:`bottom`,children:`底部`}),(0,i.jsx)(`option`,{value:`top`,children:`顶部`})]})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-4 !mb-20px`,children:[(0,i.jsx)(`label`,{className:`w-40`,children:`字体样式`}),(0,i.jsx)(`input`,{name:`fontStyle`,value:s.style.fontStyle,readOnly:!0,onChange:u,className:`flex-1 px-3 py-1.5 border border-gray-300 rounded `})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-4 !mb-20px`,children:[(0,i.jsx)(`label`,{className:`w-40`,children:`字体颜色`}),(0,i.jsxs)(`div`,{className:`flex-1 flex gap-2 items-center`,children:[(0,i.jsx)(`input`,{name:`fontColor`,readOnly:!0,value:s.style.textBorderColor,onChange:u,className:`flex-1 px-3 py-1.5 border border-gray-300 rounded h-30px`}),(0,i.jsx)(`input`,{type:`color`,readOnly:!0,value:s.style[`font-color`],onChange:e=>c({...s,fontColor:e.target.value}),className:`h-20px w-20px rounded cursor-pointer border`})]})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-4 !mb-20px`,children:[(0,i.jsx)(`label`,{className:`w-40`,children:`字体背色`}),(0,i.jsx)(`input`,{type:`text`,readOnly:!0,value:s.style.textBackgroundColor,className:`flex-1 px-3 py-1.5 border border-gray-300 rounded bg-gray-50 text-gray-400 cursor-not-allowed`})]})]})})})});exports.default=a;
|
package/lib/index38.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./index2.cjs.js`),t=require(`./index18.cjs.js`),n=require(`./index23.cjs.js`),r=require(`./index32.cjs.js`);let i=require(`react`);i=e.__toESM(i,1);let a=require(`antd`);var o=n.default,s=(0,i.forwardRef)((e,n)=>{let{graphInfo:s}=(0,i.useContext)(t.GraphContext),[c,l]=(0,i.useState)(!1),[u,d]=(0,i.useState)(!1),[f,p]=(0,i.useState)(!1),[m,h]=(0,i.useState)({style:{},data:{}}),g=(0,i.useRef)(null);(0,i.useEffect)(()=>{c&&g.current&&(g.current.scrollTop=0)},[c]),(0,i.useImperativeHandle)(n,()=>({open:e=>{l(!0),h(e),_(e)},close:()=>l(!1)}));let _=async e=>{d(!0);let t=await r.fullSearchDetail({kgId:s.kgId,uri:e.id});console.log(44,e),p(t.data),d(!1)};return(0,o.jsx)(a.Drawer,{title:`知识卡片`,onClose:()=>{l(!1)},open:c,getContainer:!1,className:`knowledge-card-drawer`,bodyStyle:{padding:`0 20px`,overflow:`auto`},children:(0,o.jsx)(`div`,{ref:g,style:{height:`100%`}})})});exports.default=s;
|
package/lib/index38.esm.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { GraphContext as e } from "./index18.esm.js";
|
|
2
|
-
import { require_jsx_runtime as t } from "./index23.esm.js";
|
|
3
|
-
import { fullSearchDetail as n } from "./index32.esm.js";
|
|
4
|
-
import { forwardRef as r, useContext as i, useEffect as a, useImperativeHandle as o, useRef as s, useState as c } from "react";
|
|
5
|
-
import { Drawer as l } from "antd";
|
|
6
|
-
//#region src/components/Graph/components/KnowledgeCard/index.tsx
|
|
7
|
-
var u = t(), d = r((t, r) => {
|
|
8
|
-
let { graphInfo: d } = i(e), [f, p] = c(!1), [m, h] = c(!1), [g, _] = c(!1), [v, y] = c({
|
|
9
|
-
style: {},
|
|
10
|
-
data: {}
|
|
11
|
-
}), b = s(null);
|
|
12
|
-
a(() => {
|
|
13
|
-
f && b.current && (b.current.scrollTop = 0);
|
|
14
|
-
}, [f]), o(r, () => ({
|
|
15
|
-
open: (e) => {
|
|
16
|
-
p(!0), y(e), x(e);
|
|
17
|
-
},
|
|
18
|
-
close: () => p(!1)
|
|
19
|
-
}));
|
|
20
|
-
let x = async (e) => {
|
|
21
|
-
h(!0);
|
|
22
|
-
let t = await n({
|
|
23
|
-
kgId: d.kgId,
|
|
24
|
-
uri: e.id
|
|
25
|
-
});
|
|
26
|
-
console.log(44, e), _(t.data), h(!1);
|
|
27
|
-
};
|
|
28
|
-
return /* @__PURE__ */ (0, u.jsx)(l, {
|
|
29
|
-
title: "知识卡片",
|
|
30
|
-
onClose: () => {
|
|
31
|
-
p(!1);
|
|
32
|
-
},
|
|
33
|
-
open: f,
|
|
34
|
-
getContainer: !1,
|
|
35
|
-
className: "knowledge-card-drawer",
|
|
36
|
-
bodyStyle: {
|
|
37
|
-
padding: "0 20px",
|
|
38
|
-
overflow: "auto"
|
|
39
|
-
},
|
|
40
|
-
children: /* @__PURE__ */ (0, u.jsx)("div", {
|
|
41
|
-
ref: b,
|
|
42
|
-
style: { height: "100%" }
|
|
43
|
-
})
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
//#endregion
|
|
47
|
-
export { d as default };
|
package/lib/index39.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./index2.cjs.js`),t=require(`./index16.cjs.js`),n=require(`./index17.cjs.js`),r=require(`./index18.cjs.js`),i=require(`./index19.cjs.js`),a=require(`./index23.cjs.js`),o=require(`./index30.cjs.js`);;/* empty css */const s=require(`./index32.cjs.js`),c=require(`./index33.cjs.js`),l=require(`./index34.cjs.js`),u=require(`./index36.cjs.js`),d=require(`./index37.cjs.js`),f=require(`./index38.cjs.js`);let p=require(`react`),m=require(`cytoscape`);m=e.__toESM(m,1);let h=require(`cytoscape-cose-bilkent`);h=e.__toESM(h,1);let g=require(`cytoscape-cise`);g=e.__toESM(g,1);let _=require(`cytoscape-fcose`);_=e.__toESM(_,1);let v=require(`storm-layout`);v=e.__toESM(v,1);let y=require(`antd`),b=require(`cytoscape-layout-utilities`);b=e.__toESM(b,1);var x=a.default;m.default.use(b.default),m.default.use(g.default),m.default.use(_.default),m.default.use(v.default),m.default.use(h.default);var S=({data:e,getAllGraphData:a,searchType:h,highPathAnalysis:g=[],graphInfo:_})=>{let v=(0,p.useRef)(null),[b,S]=(0,p.useState)([]),C=(0,p.useRef)(null),w=(0,p.useRef)(null),[T,E]=(0,p.useState)(!1),[D,O]=(0,p.useState)({}),[k,A]=(0,p.useState)({}),[j,M]=(0,p.useState)(`cose-bilkent`),N=(0,p.useRef)(null),P=(0,p.useRef)(null),[F,I]=(0,p.useState)([``,``]),[L,R]=(0,p.useState)({visible:!1,x:0,y:0,targetNode:null,bgColor:``}),[z,B]=(0,p.useState)({visible:!1,x:0,y:0,content:``}),V=l.menuItemsConfig({cyRef:C,setContextMenu:R,onPathAnalysis:w.current?.onPathAnalysis,setPathNodes:I});(0,p.useEffect)(()=>{g?.length>1&&n.handleCalcPath(C,{pathNodes:g,isGrayed:!1})},[t.jsonStringify(g),t.jsonStringify(b)]),(0,p.useEffect)(()=>{a?.({graphData:b,nodeStatic:D,relationStatic:k})},[t.jsonStringify(b),t.jsonStringify(D),t.jsonStringify(k)]),(0,p.useEffect)(()=>{if(!v.current||C.current)return;let{elements:t,typeListObj:r,relationListObj:a}=n.resDetailData(e,{typeObj:D,relationObj:k,graphInfo:_});O(r),S(t),A(a),document.addEventListener(`contextmenu`,function(e){e.preventDefault()});let o=(0,m.default)({container:v.current,elements:t,style:c.edgeNodeStyles({elements:t}),autounselectify:!1,autolock:!1,layout:{name:`preset`}});if(C.current=o,_?.searchNodes?.length===2)i.fixNodesToEdges(o,_.searchNodes[0],_.searchNodes[1]);else{let e=o.layout(i.coseBilkentLayout());e.run(),e.on(`layoutstop`,()=>{o.fit(void 0,50),o.center()})}return o.on(`mouseover`,`edge`,e=>{e.target.hasClass(`path-edge`)||e.target.style({"line-color":`#1890ff`,"target-arrow-color":`#1890ff`,opacity:.8})}),o.on(`mouseout`,`edge`,e=>{e.target.hasClass(`path-edge`)||e.target.style({"line-color":`#ccc`,"target-arrow-color":`#ccc`,opacity:1})}),o.on(`mouseover`,`node`,e=>{let t=e.target;t.hasClass(`selected`)||t.addClass(`hover`)}),o.on(`mouseover`,`node`,e=>{let t=e.target,n=t.renderedPosition(),r=t.data(`name`)||``;t.addClass(`hover`),B({visible:!0,x:n.x,y:n.y-60,content:r})}),o.on(`mouseout`,`node`,e=>{e.target.removeClass(`hover`),B(e=>({...e,visible:!1}))}),o.on(`cxttap`,`node`,e=>{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),e.originalEvent.stopImmediatePropagation());let t=e.target,n=t.renderedPosition();console.log(`renderedPos:::`,t.data(),t.style(`background-color`)),R({visible:!0,x:n.x-90,y:n.y-90,targetNode:t,bgColor:t.style(`background-color`)})}),C.current=o,o.on(`click`,`node`,e=>{let t=e.target;o.nodes().removeClass(`selected grayed highlighted`),o.edges().removeClass(`selected grayed highlighted`),t.addClass(`selected`);let n=t.neighborhood().nodes().add(t),r=n.edgesWith(n);console.log(`cy.nodes().not(relatedNodes):::`,n),o.nodes().not(n).addClass(`grayed`),o.edges().not(r).addClass(`grayed`),n.addClass(`highlighted`),r.addClass(`highlighted`)}),o.on(`tap`,e=>{e.target===o&&(R(e=>({...e,visible:!1})),o.nodes().removeClass(`grayed highlighted highlight selected correlationStyle path-node level-highlight level-selected level-grayed`),o.edges().removeClass(`grayed highlighted highlight selected correlationStyle path-edge level-highlightedge level-grayed`))}),()=>{C.current&&=(C.current.destroy(),null)}},[]);let H=async e=>{let{id:t,kgId:r}=e,a=C.current;if(!a)return;let o=a.$(`#${t}`);if(!o||o.length===0){console.error(`当前节点不存在`);return}let c=a.nodes().filter(n=>n.data(`parentId`)?(n.data(`parentId`)===t||n.data(`idLabel`)===`${t}-${n.data(`name`)}`)&&n.data(`zktype`)===e.zktype:!1);if(c.length>0){let r=c.map(e=>e.id()),i=c.connectedEdges(),s=a.edges().filter(e=>e.data(`source`)===t&&r.includes(e.data(`target`))),l=a.edges().filter(e=>e.data(`appendedBy`)===t),u=i.merge(s).merge(l).filter(t=>t.data().zktype===e.zktype);c.animate({style:{opacity:0}},{duration:200,complete:()=>{a.remove(c),a.remove(u),S(i=>{let a=i.filter(n=>{let i=n.data.zktype;if(n.group===`nodes`&&r.includes(n.data?.id)&&i&&i===e.zktype)return!1;if(n.group===`edges`&&i&&i===e.zktype){let e=Array.from(l).map(e=>{let t=e.data();return`${t.source}-${t.target}-${t.label}`}),r=n.data,i=e.includes(`${r.source}-${r.target}-${r.label}`),a=n.data?.appendedBy===t;return!i&&!a}return!0}),{typeListObj:o,relationListObj:s}=n.resDetailData({},{graphData:a,typeObj:{},relationObj:{},isOnlyStatic:!0});return O(o),A(s),a}),o.data(`appendedNodes`,[]),o.data(`isExpanded`,!1)}}),setTimeout(()=>{o.removed()||(o.style(`border-width`,``),o.style(`border-color`,``))},300)}else{try{E(!0),y.message.open({type:`loading`,content:`正在展开...`,duration:0});let{elements:c,typeListObj:l,relationListObj:u}=n.resDetailData((await s.stepNext({uri:t,queryType:1,kgId:r,zktype:e.zktype})).data,{graphData:b,typeObj:D,relationObj:k,zktype:e.zktype});if(O(l),A(u),console.log(555e3,c),!(c?.length>0)){y.message.warning(`暂无数据`),setTimeout(()=>{y.message.destroy()},2e3);return}if(c?.length>0){let n=a.layoutUtilities({...i.coseBilkentLayout(),idealEdgeLength:80,offset:30}),r=c.map(n=>n.group===`nodes`?{...n,style:{opacity:0,width:80,height:80},data:{...n.data,parentId:t,appendedBy:t,idLabel:t+`-`+n.data.label,zktype:e.zktype,isAppended:!0,baseWidth:80,baseHeight:80}}:{...n,data:{...n.data,appendedBy:t,zktype:e.zktype}}),s=a.add(r);S([...b,...r]);let l=s.filter(`:node`),u=l.map(e=>e.id());o.data(`appendedNodes`,u),o.data(`isExpanded`,!0);let d=a.nodes().difference(l);d.forEach(e=>e.lock()),n.placeNewNodes(l),a.layout({name:`cose-bilkent`,randomize:!1,animate:!0,animationDuration:500,fit:!1,nodeRepulsion:1005e3,idealEdgeLength:100,edgeElasticity:.3,numIter:800,gravity:.6}).run(),setTimeout(()=>{d.forEach(e=>e.unlock())},2e3),l.animate({style:{opacity:1,width:20,height:30}},{duration:400,easing:`ease-out`,complete:()=>{l.style(`opacity`,``),l.style(`width`,``),l.style(`height`,``)}}),setTimeout(()=>{o.removed()||(o.style(`border-width`,``),o.style(`border-color`,``),a.center(o),a.zoom(a.zoom()))},600)}else console.log(`没有找到相关节点数据`)}catch(e){console.error(`请求接口失败:`,e)}E(!1),y.message.destroy()}R({visible:!1})},U={expanded:`typed-literal`,contract:`uri`},W=e=>{if(console.log(`handleMenuAction:::`,e),L.targetNode){let t=e.ids,n=L.targetNode.data();if([`expanded`,`contract`].includes(t))H({kgId:3,...n,zktype:U[t]});else if(t===`nodeInfo`){let e=L.targetNode,t={id:e.id(),data:e.data(),position:e.position(),degree:e.degree(),inDegree:e.degree(!0),outDegree:e.degree(!1),classes:e.classes(),style:e.style()};N.current.open(t)}else if(t===`knowledgeCard`){let e=L.targetNode;P.current.open(e.data())}e.action(L.targetNode),R({visible:!1,x:0,y:0,targetNode:null})}};return(0,x.jsx)(r.GraphProvider,{value:{pathNodes:F,setPathNodes:I,graphInfo:_,graphData:b,layoutType:j,setLayoutType:M},children:(0,x.jsxs)(`div`,{className:`cytoscape-container`,style:{position:`relative`},children:[(0,x.jsx)(`div`,{className:`btn-group`}),(0,x.jsx)(o.default,{ref:w,cyRef:C,graphInfo:_,initNodeScale:1,cyContainerRef:v,typeObj:D,relationObj:k}),(0,x.jsxs)(`div`,{style:{position:`relative`},children:[(0,x.jsx)(`div`,{ref:v,className:`cy-container`}),L.visible&&L.targetNode&&(0,x.jsx)(`div`,{style:{position:`absolute`,left:`${L.x}px`,top:`${L.y}px`,zIndex:1e4,minWidth:`120px`,padding:`4px 0`,pointerEvents:`auto`,width:`200px`,height:`200px`,overflow:`hidden`},onClick:e=>e.stopPropagation(),children:(0,x.jsx)(u.default,{items:V,centerImage:L?.targetNode?.data().image,onClick:e=>W(e)})}),z.visible&&(0,x.jsx)(`div`,{style:{position:`absolute`,left:`${z.x}px`,top:`${z.y}px`,transform:`translateX(-50%)`,backgroundColor:`rgba(0, 0, 0, 0.85)`,color:`#fff`,padding:`6px 12px`,borderRadius:`4px`,fontSize:`14px`,whiteSpace:`nowrap`,zIndex:9999,pointerEvents:`none`,maxWidth:`1000px`,overflow:`hidden`,textOverflow:`ellipsis`},children:z.content})]}),(0,x.jsx)(d.default,{ref:N}),(0,x.jsx)(f.default,{ref:P})]})})};exports.default=S;
|