@yuku123/z-cognition-component 2.0.0 → 2.0.1
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-lib/ApartmentOutlined-M6qSurnE.js +12 -0
- package/dist-lib/ArrowLeftOutlined-DowsrSUj.js +12 -0
- package/dist-lib/{ConceptsPage-DOf_CJlz.js → ConceptsPage-BOeKdDKI.js} +16 -13
- package/dist-lib/{DocsPage-CiC7TU96.js → DocsPage-BZOBFp3c.js} +4 -4
- package/dist-lib/EvidenceFormList-DXqqSpPV.js +91 -0
- package/dist-lib/{EyeOutlined-CH-5UdnC.js → EyeOutlined-DGSrX-0M.js} +1 -1
- package/dist-lib/ImpactPage-DyhUR6fT.js +71 -0
- package/dist-lib/{LeftOutlined-DQTflZ6D.js → LeftOutlined-Cgo6Izj-.js} +1 -1
- package/dist-lib/{OntologyDetailPage-mgK_NQxP.js → OntologyDetailPage-B8DyU8WW.js} +93 -99
- package/dist-lib/{OntologyInferPage-NUaoaQpN.js → OntologyInferPage-CvcjxpBB.js} +40 -38
- package/dist-lib/{OntologyListPage-C9wH01y0.js → OntologyListPage-Cb0XfpWE.js} +49 -47
- package/dist-lib/OntologyMaterializePage-B0f9TnJa.js +136 -0
- package/dist-lib/OntologyNodesPage-D4MWlm6q.js +1268 -0
- package/dist-lib/{OntologyValidatePage-DtkYK_l4.js → OntologyValidatePage-abQVJwzV.js} +52 -49
- package/dist-lib/{Pagination-Ds8VKQIT.js → Pagination-Dxslodkq.js} +258 -260
- package/dist-lib/PlusOutlined-B_dXo_97.js +12 -0
- package/dist-lib/{ReloadOutlined-B26pDoyV.js → ReloadOutlined-CS-e-TmN.js} +10 -19
- package/dist-lib/{ResolvePage-Cz9HORZ3.js → ResolvePage-rbQ-8nNZ.js} +33 -31
- package/dist-lib/{RotateRightOutlined-B575hEBK.js → RotateRightOutlined-q7zp2e47.js} +1 -1
- package/dist-lib/SearchOutlined-puH6bCY6.js +979 -0
- package/dist-lib/Skeleton-DXcERb5r.js +557 -0
- package/dist-lib/{Table-D8pPXolZ.js → Table-CDagah-g.js} +452 -450
- package/dist-lib/TagsOutlined-B4_qkn6-.js +20 -0
- package/dist-lib/TermDetailPage-CP0D6OvA.js +242 -0
- package/dist-lib/{TermsPage-BuzCMYov.js → TermsPage-CuufAyuL.js} +31 -28
- package/dist-lib/TextArea-DTpTS5HL.js +1897 -0
- package/dist-lib/ThunderboltOutlined-Bf54AaFE.js +20 -0
- package/dist-lib/{agents-DS0rPJGV.js → agents-mAJW3cEN.js} +46 -46
- package/dist-lib/{ai-CQ67aRC4.js → ai-BcYmZiRo.js} +30 -30
- package/dist-lib/{ai-chat-share-AOB7rEOb.js → ai-chat-share-DO7GXjG4.js} +14 -13
- package/dist-lib/{approval-LLVR3fMa.js → approval-RPDUKg9-.js} +26 -25
- package/dist-lib/{approvals-D1DSA-Mw.js → approvals-CNjxJUpR.js} +43 -42
- package/dist-lib/{assistant-DpabpWKV.js → assistant-FIQQziCn.js} +50 -49
- package/dist-lib/{assistant-history-ChvhtZwX.js → assistant-history-DsEGBJnq.js} +5 -5
- package/dist-lib/{assistant-summary-B0ksF8CX.js → assistant-summary-B-f3k55y.js} +1 -1
- package/dist-lib/{audit-DeU1XEgQ.js → audit-NwnH1hm5.js} +1 -1
- package/dist-lib/{bios-Bk36bVhw.js → bios-CRwKtcit.js} +130 -125
- package/dist-lib/callSuper-DZEfdkXG.js +7 -0
- package/dist-lib/{changelog-CCMDMI4R.js → changelog-Dj_Pv2nc.js} +1 -1
- package/dist-lib/{changelog-xEt2qnho.js → changelog-DlL5u9o4.js} +2 -2
- package/dist-lib/chunk-YDNE64FV-DGyyfCo0.js +2004 -0
- package/dist-lib/colors-sdAcAcU3.js +24 -0
- package/dist-lib/context-Buz0ggsK.js +710 -0
- package/dist-lib/context-DpmyNOn3.js +21 -0
- package/dist-lib/createForOfIteratorHelper-DEx_aTey.js +51 -0
- package/dist-lib/d3-force-CZK-Rgd6.js +598 -0
- package/dist-lib/{dayjs.min-DoEf5yCX.js → dayjs.min-BauDENhn.js} +1 -1
- package/dist-lib/{detail-Xtof0GoK.js → detail-Cfb-zdr9.js} +50 -49
- package/dist-lib/{detail-BW6dD_YP.js → detail-Dcfg3W8B.js} +89 -88
- package/dist-lib/{docx-preview-D4v2g8Yg.js → docx-preview-B5nQuTwk.js} +1 -1
- package/dist-lib/{downloads-Dj4DgBSS.js → downloads-MkyxiHxi.js} +4 -3
- package/dist-lib/{edit-nZ7siGuW.js → edit-DLGAM-Vo.js} +265 -259
- package/dist-lib/{editor-BuhZwEsv.js → editor-BtiheUpe.js} +21 -20
- package/dist-lib/embed-DwLg9RDW.js +31148 -0
- package/dist-lib/{evaluation-B-igEqQ9.js → evaluation-Dz9bUuhS.js} +15 -14
- package/dist-lib/{focus-set-DfRWcq91.js → focus-set-h0YtOUB2.js} +34 -33
- package/dist-lib/{format-CWI99NCN.js → format-UGmYKemG.js} +1 -1
- package/dist-lib/index-9aQ4BzIK.js +500 -0
- package/dist-lib/index-B57Fj7Y0.js +1169 -0
- package/dist-lib/{index-D_-8dmug.js → index-BEjXaDfk.js} +23 -22
- package/dist-lib/{index-BJ2Gpcbi.js → index-BGB6NawZ.js} +2 -2
- package/dist-lib/index-Bc-Vin3j.js +256 -0
- package/dist-lib/{index-g9uC_rON.js → index-BwVZgt5s.js} +129 -146
- package/dist-lib/{index-CZipVp1G.js → index-C3AMwzIi.js} +1 -1
- package/dist-lib/{index-SAPKyv8e.js → index-CJSTTgTM.js} +10 -10
- package/dist-lib/{index-CnLkqTRm.js → index-CaXylbQR.js} +175 -173
- package/dist-lib/index-Cfu1W1H6.js +535 -0
- package/dist-lib/index-CrMcNEAZ.js +9656 -0
- package/dist-lib/index-Cy9i4Kx7.js +699 -0
- package/dist-lib/index-CyKWCYMK.js +218 -0
- package/dist-lib/{index-CjwzwBTy.js → index-D3GHtSlM.js} +94 -93
- package/dist-lib/{index-B8l4PAGJ.js → index-DBlG9uXV.js} +112 -108
- package/dist-lib/index-DBtGE89a.js +168 -0
- package/dist-lib/{index-CS5YTpdI.js → index-DMTPsTna.js} +4 -3
- package/dist-lib/{index-rtSfQuYs.js → index-D_Qey9G8.js} +12 -12
- package/dist-lib/index-DjFPRXl5.js +1484 -0
- package/dist-lib/{index-Bu6udiyN.js → index-DsuUGhTA.js} +123 -121
- package/dist-lib/{index-B5jr3A7f.js → index-DuI4K5e1.js} +19 -19
- package/dist-lib/index-DvWHYX81.js +450 -0
- package/dist-lib/{index-D5V4bZ4e.js → index-HieOUSwH.js} +8 -8
- package/dist-lib/index-Vu6sPBci.js +1884 -0
- package/dist-lib/index-bOY1cBol.js +4890 -0
- package/dist-lib/{index-DzrH4RQ7.js → index-c2HokEFp.js} +11 -10
- package/dist-lib/{index-BFRg0cn3.js → index-g16g7A4k.js} +6 -6
- package/dist-lib/index-nQSVLWfW.js +356 -0
- package/dist-lib/{index-pcUZcUIA.js → index-o65vKUwa.js} +48 -47
- package/dist-lib/{index-K7z38Ybg.js → index-ounfql2z.js} +33 -31
- package/dist-lib/{index-B1rpIXU7.js → index-y7jVGGI0.js} +23 -21
- package/dist-lib/index.js +3 -1
- package/dist-lib/{jszip.min-dcaDnWUw.js → jszip.min-DcEHhn-b.js} +1 -1
- package/dist-lib/{kb-form-modal-9L0AUHVG.js → kb-form-modal-BNoIhw6B.js} +71 -71
- package/dist-lib/{kbTeam-BECePvJe.js → kbTeam-EgcbWseM.js} +3 -3
- package/dist-lib/{knowledge-base-C8gHP0dj.js → knowledge-base-C023dnJ-.js} +104 -103
- package/dist-lib/{knowledge-hub-C9KkDv1A.js → knowledge-hub-B4fGCn8m.js} +52 -51
- package/dist-lib/{markdown-lite-BABX4bcl.js → markdown-lite-EvJ9Fw7X.js} +181 -177
- package/dist-lib/{material-preview-docx-lp_xPipj.js → material-preview-docx-CH-09KeC.js} +1 -1
- package/dist-lib/{material-preview-pptx-6Byitp0J.js → material-preview-pptx-D8XGDF-u.js} +1 -1
- package/dist-lib/{member-B5WF3FCj.js → member-BUg2QYlE.js} +1 -1
- package/dist-lib/{message-kHyjuooj.js → message-Cwj8dO78.js} +25 -24
- package/dist-lib/{message-D2MSaOMq.js → message-GF-w8HuR.js} +1 -1
- package/dist-lib/{messages-D_VDuKK7.js → messages-JID13L8-.js} +16 -15
- package/dist-lib/{meta-CEf_DYcU.js → meta-DPp5L3Uc.js} +1 -1
- package/dist-lib/{metrics-hONGW0KG.js → metrics-CT4eLzrq.js} +2 -2
- package/dist-lib/{monitor-DFmEu6rH.js → monitor-Bs9BfJOj.js} +4 -4
- package/dist-lib/{monitor-DF3WVsVV.js → monitor-CmS65YSu.js} +8 -8
- package/dist-lib/{my-access-j53lA6T6.js → my-access-1Yj7UloI.js} +3 -3
- package/dist-lib/{my-permissions-C5L8ZN2d.js → my-permissions-yQDHPLYI.js} +23 -22
- package/dist-lib/{new-DfZ61nMQ.js → new-BgkoBnZV.js} +14 -12
- package/dist-lib/{ontology-CUH5qslO.js → ontology-BPrbXPor.js} +145 -142
- package/dist-lib/{ontology-domains-CRC1ZRit.js → ontology-domains-Cbqnm-po.js} +88 -84
- package/dist-lib/{ontology-modeling-DaSk5fsh.js → ontology-modeling-6k-m8fzr.js} +2125 -2117
- package/dist-lib/ontology-modeling-BT-EuDCs.js +1039 -0
- package/dist-lib/{ontology-scenarios-DAbyoKV6.js → ontology-scenarios-D3xy6IZL.js} +703 -712
- package/dist-lib/ontology-scenarios-DWYC2yxd.js +660 -0
- package/dist-lib/pages-CsexFuEz.js +73 -0
- package/dist-lib/pages.js +3 -3
- package/dist-lib/{permission-CklDU2kO.js → permission-fTfxpEhV.js} +31 -31
- package/dist-lib/{pptx-preview.es-D4ODiBv2.js → pptx-preview.es-AUrdYKu3.js} +2 -2
- package/dist-lib/{preset-Bp_mvsJm.js → preset-gh5SGoYT.js} +9810 -10199
- package/dist-lib/{quota-DLe9so2b.js → quota-BlHnhkAT.js} +4 -4
- package/dist-lib/{row-CE051ClO.js → row-B5MnGm9M.js} +63 -61
- package/dist-lib/{save-blob-qKrc8-z6.js → save-blob-B-pzX8eT.js} +2 -2
- package/dist-lib/{scenario-mapping-preview-CSDqIN3R.js → scenario-mapping-preview-DByQXh0y.js} +48 -46
- package/dist-lib/{scenario-simple-form-CAkhVgeV.js → scenario-simple-form-Bw-6n9Kh.js} +425 -423
- package/dist-lib/{schedule-B_ujtL3h.js → schedule-H4_9KnRj.js} +8 -8
- package/dist-lib/{settings-BIkKTQjc.js → settings-C3PI8KYa.js} +147 -146
- package/dist-lib/{shared-Dfz1X4Mq.js → shared-DqeN-Wbb.js} +1 -1
- package/dist-lib/{shared-utils-BeRiAkbe.js → shared-utils-DN3zT9P-.js} +2 -2
- package/dist-lib/{skills-BzpcX5fN.js → skills-eGlCExr0.js} +40 -39
- package/dist-lib/{source-selection-DOL5LBrV.js → source-selection-BCvClzc-.js} +16 -16
- package/dist-lib/{task-config-D0a7TOYt.js → task-config-DEJVJ7zK.js} +4 -4
- package/dist-lib/{tech-CH01ekZ5.js → tech-C-4uM9bS.js} +4 -3
- package/dist-lib/{tools-YnTN61uE.js → tools-le6miafZ.js} +14 -14
- package/dist-lib/{use-domain-access-CXx1YzE5.js → use-domain-access-B3pDp3s5.js} +13 -13
- package/dist-lib/use-g6-graph-WLX0PweO.js +1119 -0
- package/dist-lib/{use-graph-layers-CowyyYcb.js → use-graph-layers-Dmp7uMHO.js} +50 -48
- package/dist-lib/useClosable-BY7FgWKy.js +59 -0
- package/dist-lib/useForm-Byp1LopG.js +145 -0
- package/dist-lib/{version-control-panel-CLy2ZXI_.js → version-control-panel-WT1PobuV.js} +27 -26
- package/dist-lib/{version-management-C_v8w1E4.js → version-management-DC0k1DRg.js} +7 -6
- package/dist-lib/{welcome-ChEcA4Ej.js → welcome-VyWLrbth.js} +4 -3
- package/package.json +2 -3
- package/dist-lib/EvidenceFormList-CrE2FzHk.js +0 -90
- package/dist-lib/ImpactPage-CYiuqy0S.js +0 -68
- package/dist-lib/OntologyMaterializePage-D_fDqYHY.js +0 -134
- package/dist-lib/OntologyNodesPage-5kH7RHwE.js +0 -2844
- package/dist-lib/PlusOutlined-BSTPGLOH.js +0 -21
- package/dist-lib/Skeleton-CxFsInYI.js +0 -671
- package/dist-lib/Table-Civ838nE.js +0 -20514
- package/dist-lib/TermDetailPage-BtkOpbPT.js +0 -263
- package/dist-lib/_commonjsHelpers-DaMA6jEr.js +0 -8
- package/dist-lib/callSuper-CwIeyYoc.js +0 -7
- package/dist-lib/chunk-6KYCQHYJ-DcgZQlO5.js +0 -1627
- package/dist-lib/context-T27uno74.js +0 -54
- package/dist-lib/d3-force-Cr_oBTiR.js +0 -647
- package/dist-lib/embed-Bs3Hmsyy.js +0 -51377
- package/dist-lib/index-0TvzCTD7.js +0 -2336
- package/dist-lib/index-4tbtbcAt.js +0 -550
- package/dist-lib/index-B1wh6i1C.js +0 -1308
- package/dist-lib/index-BVgdmf6r.js +0 -2487
- package/dist-lib/index-CSnvcFg-.js +0 -543
- package/dist-lib/index-D35Ry0PG.js +0 -1162
- package/dist-lib/index-DC57_dnh.js +0 -604
- package/dist-lib/index-DQ16Zb7x.js +0 -546
- package/dist-lib/index-DRcTwC17.js +0 -418
- package/dist-lib/index-Dd9pPAT3.js +0 -2192
- package/dist-lib/index-DxzorPvG.js +0 -13960
- package/dist-lib/index-If4xc1-H.js +0 -559
- package/dist-lib/index-R71k3nB_.js +0 -710
- package/dist-lib/index-mUlorJxp.js +0 -3279
- package/dist-lib/ontology-modeling-CvJIImxt.js +0 -3612
- package/dist-lib/ontology-scenarios-BRDkk3uA.js +0 -675
- package/dist-lib/pages-CticGC6S.js +0 -512
- package/dist-lib/use-g6-graph-SwJtPLce.js +0 -57552
|
@@ -0,0 +1,1268 @@
|
|
|
1
|
+
import { jsx as O, jsxs as U, Fragment as He } from "react/jsx-runtime";
|
|
2
|
+
import * as pe from "react";
|
|
3
|
+
import { useRef as G, useState as ne, useEffect as le, useCallback as L, useMemo as $e } from "react";
|
|
4
|
+
import { o as be } from "./api-BVrIcAFp.js";
|
|
5
|
+
import { G as kt } from "./preset-gh5SGoYT.js";
|
|
6
|
+
import { s as Ye, l as qe, m as Xe, x as Ue, y as Je, c as Qe } from "./d3-force-CZK-Rgd6.js";
|
|
7
|
+
import { b as bt } from "./chunk-YDNE64FV-DGyyfCo0.js";
|
|
8
|
+
import { s as we } from "./index-DBtGE89a.js";
|
|
9
|
+
import { a4 as Fe, B as he, S as St } from "./index-CrMcNEAZ.js";
|
|
10
|
+
import { T as _e } from "./index-Bc-Vin3j.js";
|
|
11
|
+
import { R as ze } from "./ApartmentOutlined-M6qSurnE.js";
|
|
12
|
+
import { I as Nt } from "./index-DvWHYX81.js";
|
|
13
|
+
import { R as Dt } from "./ReloadOutlined-CS-e-TmN.js";
|
|
14
|
+
import { I as Te, _ as Ae } from "./SearchOutlined-puH6bCY6.js";
|
|
15
|
+
import { D as xt } from "./index-Cy9i4Kx7.js";
|
|
16
|
+
import { D as ge } from "./index-9aQ4BzIK.js";
|
|
17
|
+
var Rt = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M855 160.1l-189.2 23.5c-6.6.8-9.3 8.8-4.7 13.5l54.7 54.7-153.5 153.5a8.03 8.03 0 000 11.3l45.1 45.1c3.1 3.1 8.2 3.1 11.3 0l153.6-153.6 54.7 54.7a7.94 7.94 0 0013.5-4.7L863.9 169a7.9 7.9 0 00-8.9-8.9zM416.6 562.3a8.03 8.03 0 00-11.3 0L251.8 715.9l-54.7-54.7a7.94 7.94 0 00-13.5 4.7L160.1 855c-.6 5.2 3.7 9.5 8.9 8.9l189.2-23.5c6.6-.8 9.3-8.8 4.7-13.5l-54.7-54.7 153.6-153.6c3.1-3.1 3.1-8.2 0-11.3l-45.2-45z" } }] }, name: "arrows-alt", theme: "outlined" }, Ot = function(n, c) {
|
|
18
|
+
return /* @__PURE__ */ pe.createElement(Te, Ae({}, n, {
|
|
19
|
+
ref: c,
|
|
20
|
+
icon: Rt
|
|
21
|
+
}));
|
|
22
|
+
}, Me = /* @__PURE__ */ pe.forwardRef(Ot);
|
|
23
|
+
process.env.NODE_ENV !== "production" && (Me.displayName = "ArrowsAltOutlined");
|
|
24
|
+
var wt = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M342 88H120c-17.7 0-32 14.3-32 32v224c0 8.8 7.2 16 16 16h48c8.8 0 16-7.2 16-16V168h174c8.8 0 16-7.2 16-16v-48c0-8.8-7.2-16-16-16zm578 576h-48c-8.8 0-16 7.2-16 16v176H682c-8.8 0-16 7.2-16 16v48c0 8.8 7.2 16 16 16h222c17.7 0 32-14.3 32-32V680c0-8.8-7.2-16-16-16zM342 856H168V680c0-8.8-7.2-16-16-16h-48c-8.8 0-16 7.2-16 16v224c0 17.7 14.3 32 32 32h222c8.8 0 16-7.2 16-16v-48c0-8.8-7.2-16-16-16zM904 88H682c-8.8 0-16 7.2-16 16v48c0 8.8 7.2 16 16 16h174v176c0 8.8 7.2 16 16 16h48c8.8 0 16-7.2 16-16V120c0-17.7-14.3-32-32-32z" } }] }, name: "expand", theme: "outlined" }, _t = function(n, c) {
|
|
25
|
+
return /* @__PURE__ */ pe.createElement(Te, Ae({}, n, {
|
|
26
|
+
ref: c,
|
|
27
|
+
icon: wt
|
|
28
|
+
}));
|
|
29
|
+
}, Le = /* @__PURE__ */ pe.forwardRef(_t);
|
|
30
|
+
process.env.NODE_ENV !== "production" && (Le.displayName = "ExpandOutlined");
|
|
31
|
+
var It = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M793 242H366v-74c0-6.7-7.7-10.4-12.9-6.3l-142 112a8 8 0 000 12.6l142 112c5.2 4.1 12.9.4 12.9-6.3v-74h415v470H175c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h618c35.3 0 64-28.7 64-64V306c0-35.3-28.7-64-64-64z" } }] }, name: "rollback", theme: "outlined" }, Ct = function(n, c) {
|
|
32
|
+
return /* @__PURE__ */ pe.createElement(Te, Ae({}, n, {
|
|
33
|
+
ref: c,
|
|
34
|
+
icon: It
|
|
35
|
+
}));
|
|
36
|
+
}, et = /* @__PURE__ */ pe.forwardRef(Ct);
|
|
37
|
+
process.env.NODE_ENV !== "production" && (et.displayName = "RollbackOutlined");
|
|
38
|
+
const Ie = "#3d7dd4", Mt = "#89b4e8", Be = "#1e4f8f", Lt = "#94a3b8", Tt = "#64748b", At = "#94a3b8", We = "#64748b", tt = "#0052d9", nt = "#003cab", Pt = "rgba(0, 82, 217, 0.25)", Pe = 52, Ht = "#fff", $t = 11, ve = "__uncategorized__", Ge = [
|
|
39
|
+
{ fill: "#722ed1", stroke: "#531cd3" },
|
|
40
|
+
// 紫
|
|
41
|
+
{ fill: "#1890ff", stroke: "#006cd4" },
|
|
42
|
+
// 蓝
|
|
43
|
+
{ fill: "#13c2c2", stroke: "#08979b" },
|
|
44
|
+
// 青
|
|
45
|
+
{ fill: "#52c41a", stroke: "#389e0d" },
|
|
46
|
+
// 绿
|
|
47
|
+
{ fill: "#fa8c16", stroke: "#d4670c" },
|
|
48
|
+
// 橙
|
|
49
|
+
{ fill: "#f5222d", stroke: "#cf1717" },
|
|
50
|
+
// 红
|
|
51
|
+
{ fill: "#eb2f96", stroke: "#c41d78" },
|
|
52
|
+
// 粉
|
|
53
|
+
{ fill: "#faad14", stroke: "#d48806" },
|
|
54
|
+
// 金
|
|
55
|
+
{ fill: "#2f54eb", stroke: "#1d39c4" },
|
|
56
|
+
// 极客蓝
|
|
57
|
+
{ fill: "#a0d911", stroke: "#7cb305" }
|
|
58
|
+
// 青柠
|
|
59
|
+
], Se = { fill: tt, stroke: nt };
|
|
60
|
+
function Ve(o, n) {
|
|
61
|
+
const c = o.replace("#", ""), u = parseInt(c.slice(0, 2), 16), e = parseInt(c.slice(2, 4), 16), h = parseInt(c.slice(4, 6), 16);
|
|
62
|
+
return `rgba(${u}, ${e}, ${h}, ${n})`;
|
|
63
|
+
}
|
|
64
|
+
function Ft(o) {
|
|
65
|
+
const n = /* @__PURE__ */ new Map();
|
|
66
|
+
return [...o].sort(
|
|
67
|
+
(u, e) => (u.sortOrder ?? 0) - (e.sortOrder ?? 0)
|
|
68
|
+
).forEach((u, e) => {
|
|
69
|
+
const h = u.categoryCode || ve;
|
|
70
|
+
if (n.has(h)) return;
|
|
71
|
+
const E = h === ve ? Se : Ge[e % Ge.length];
|
|
72
|
+
n.set(h, {
|
|
73
|
+
fill: E.fill,
|
|
74
|
+
stroke: E.stroke,
|
|
75
|
+
shadowColor: Ve(E.fill, 0.25)
|
|
76
|
+
});
|
|
77
|
+
}), n.has(ve) || n.set(ve, {
|
|
78
|
+
fill: Se.fill,
|
|
79
|
+
stroke: Se.stroke,
|
|
80
|
+
shadowColor: Ve(Se.fill, 0.25)
|
|
81
|
+
}), n;
|
|
82
|
+
}
|
|
83
|
+
const zt = "#f59e0b", Bt = 2, Wt = "#64748b", Gt = 10, Vt = "#2563eb", jt = "#ffffff", Kt = "#f59e0b";
|
|
84
|
+
function Zt(o, n, c) {
|
|
85
|
+
const u = o.data.name || o.data.code || o.data.id || "", e = n != null ? `${u}
|
|
86
|
+
${n}` : u, h = (c == null ? void 0 : c.fill) ?? tt, E = (c == null ? void 0 : c.stroke) ?? nt, b = (c == null ? void 0 : c.shadowColor) ?? Pt;
|
|
87
|
+
return {
|
|
88
|
+
// ─── 对应 ECharts itemStyle ───
|
|
89
|
+
fill: h,
|
|
90
|
+
stroke: E,
|
|
91
|
+
lineWidth: 1,
|
|
92
|
+
// opacity 基线必须显式声明:G6 v5 移除 state 时只回退「基线有值」的属性,
|
|
93
|
+
// 缺省时 focusDim 写入的 opacity 0.2 会永久残留(emphasis 节点变半透明)
|
|
94
|
+
opacity: 1,
|
|
95
|
+
shadowColor: b,
|
|
96
|
+
shadowBlur: 8,
|
|
97
|
+
// ─── 对应 ECharts symbolSize ───
|
|
98
|
+
size: Pe,
|
|
99
|
+
// 节点渲染在边之上,避免边线覆盖节点
|
|
100
|
+
zIndex: 10,
|
|
101
|
+
// ─── 对应 ECharts label ───
|
|
102
|
+
labelText: e,
|
|
103
|
+
labelFill: Ht,
|
|
104
|
+
labelFontSize: $t,
|
|
105
|
+
labelFontWeight: "bold",
|
|
106
|
+
// G6 v5 用 labelPlacement 控制标签位置(非 labelPosition),默认 'bottom'
|
|
107
|
+
labelPlacement: "center"
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function Yt(o, n) {
|
|
111
|
+
const c = o.data.displayName || "", u = n != null ? `${c}
|
|
112
|
+
${n}` : c, e = o.data.isSelfAssoc;
|
|
113
|
+
return {
|
|
114
|
+
stroke: zt,
|
|
115
|
+
lineWidth: Bt,
|
|
116
|
+
opacity: 0.7,
|
|
117
|
+
// 边渲染在节点之下
|
|
118
|
+
zIndex: 1,
|
|
119
|
+
...e ? { endArrow: !0, endArrowSize: 8 } : {},
|
|
120
|
+
// 边 label(对应 ECharts edgeLabel)
|
|
121
|
+
labelText: u,
|
|
122
|
+
labelFill: Wt,
|
|
123
|
+
labelFontSize: Gt,
|
|
124
|
+
labelFontWeight: "bold",
|
|
125
|
+
// 标签沿连线方向自动旋转(参考图中边上文字斜排)
|
|
126
|
+
labelAutoRotate: !0,
|
|
127
|
+
// 白底衬底:边标签直接压在连线上会与中线文字互相穿透,衬底隔开
|
|
128
|
+
labelBackground: !0,
|
|
129
|
+
labelBackgroundFill: "#fff",
|
|
130
|
+
labelBackgroundOpacity: 0.85,
|
|
131
|
+
labelBackgroundRadius: 4,
|
|
132
|
+
labelPadding: [2, 4]
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
const re = {
|
|
136
|
+
// hover/选中 emphasis
|
|
137
|
+
emphasis: {
|
|
138
|
+
node: {
|
|
139
|
+
fill: Vt,
|
|
140
|
+
stroke: jt,
|
|
141
|
+
lineWidth: 3,
|
|
142
|
+
// 显式覆盖 focusDim 残留的 0.2(G6 v5 state opacity 不随移除回退)
|
|
143
|
+
opacity: 1,
|
|
144
|
+
shadowColor: "rgba(37, 99, 235, 0.55)",
|
|
145
|
+
shadowBlur: 16
|
|
146
|
+
},
|
|
147
|
+
edge: {
|
|
148
|
+
stroke: Kt,
|
|
149
|
+
lineWidth: 4,
|
|
150
|
+
shadowColor: "rgba(245, 158, 11, 0.45)",
|
|
151
|
+
shadowBlur: 8
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
// 路径高亮节点(对应 PATH_HL_COLOR 等)
|
|
155
|
+
pathHighlight: {
|
|
156
|
+
node: {
|
|
157
|
+
fill: Ie,
|
|
158
|
+
stroke: Mt,
|
|
159
|
+
lineWidth: 2,
|
|
160
|
+
shadowColor: "rgba(61, 125, 212, 0.75)",
|
|
161
|
+
shadowBlur: 20,
|
|
162
|
+
labelFill: "#fff",
|
|
163
|
+
labelFontWeight: "bold"
|
|
164
|
+
},
|
|
165
|
+
edge: {
|
|
166
|
+
stroke: Ie,
|
|
167
|
+
lineWidth: 4,
|
|
168
|
+
opacity: 1,
|
|
169
|
+
shadowColor: "rgba(61, 125, 212, 0.55)",
|
|
170
|
+
shadowBlur: 12,
|
|
171
|
+
labelFill: "#1e3a5f",
|
|
172
|
+
labelFontWeight: "bold"
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
// 路径末尾节点(对应 PATH_HL_DEEP)
|
|
176
|
+
pathLast: {
|
|
177
|
+
node: {
|
|
178
|
+
fill: Ie,
|
|
179
|
+
stroke: Be,
|
|
180
|
+
lineWidth: 4,
|
|
181
|
+
shadowColor: "rgba(61, 125, 212, 0.75)",
|
|
182
|
+
shadowBlur: 20,
|
|
183
|
+
labelFill: "#fff",
|
|
184
|
+
labelFontWeight: "bold"
|
|
185
|
+
},
|
|
186
|
+
edge: {
|
|
187
|
+
stroke: Be,
|
|
188
|
+
lineWidth: 4,
|
|
189
|
+
opacity: 1,
|
|
190
|
+
shadowColor: "rgba(61, 125, 212, 0.55)",
|
|
191
|
+
shadowBlur: 12,
|
|
192
|
+
labelFill: "#1e3a5f",
|
|
193
|
+
labelFontWeight: "bold"
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
// 路径弱化节点(对应 PATH_DIM_NODE_COLOR 等)
|
|
197
|
+
pathDim: {
|
|
198
|
+
node: {
|
|
199
|
+
fill: Lt,
|
|
200
|
+
stroke: Tt,
|
|
201
|
+
lineWidth: 1,
|
|
202
|
+
opacity: 1,
|
|
203
|
+
labelFill: We
|
|
204
|
+
},
|
|
205
|
+
edge: {
|
|
206
|
+
stroke: At,
|
|
207
|
+
lineWidth: 1,
|
|
208
|
+
opacity: 0.9,
|
|
209
|
+
labelFill: We
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
// 聚焦弱化节点(概览右栏聚焦态:非相关节点整体压暗突出焦点邻域,不动配色)
|
|
213
|
+
focusDim: {
|
|
214
|
+
node: {
|
|
215
|
+
opacity: 0.2
|
|
216
|
+
},
|
|
217
|
+
// 与 pathDim.edge 对齐:邻接弱化节点的边同步降透明,避免亮边穿插弱化区
|
|
218
|
+
edge: {
|
|
219
|
+
opacity: 0.2
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
function rt(o, n) {
|
|
224
|
+
const c = /* @__PURE__ */ new Map();
|
|
225
|
+
o.forEach((h) => c.set(h.id, /* @__PURE__ */ new Set())), n.forEach((h) => {
|
|
226
|
+
var v, w;
|
|
227
|
+
const E = String(h.source), b = String(h.target);
|
|
228
|
+
(v = c.get(E)) == null || v.add(b), (w = c.get(b)) == null || w.add(E);
|
|
229
|
+
});
|
|
230
|
+
const u = /* @__PURE__ */ new Map();
|
|
231
|
+
let e = 0;
|
|
232
|
+
return o.forEach((h) => {
|
|
233
|
+
var b;
|
|
234
|
+
if (u.has(h.id)) return;
|
|
235
|
+
const E = [h.id];
|
|
236
|
+
for (u.set(h.id, e); E.length > 0; ) {
|
|
237
|
+
const v = E.shift();
|
|
238
|
+
(b = c.get(v)) == null || b.forEach((w) => {
|
|
239
|
+
u.has(w) || (u.set(w, e), E.push(w));
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
e += 1;
|
|
243
|
+
}), u;
|
|
244
|
+
}
|
|
245
|
+
function st(o, n, c, u = !1) {
|
|
246
|
+
const e = /* @__PURE__ */ new Map();
|
|
247
|
+
o.forEach((S) => {
|
|
248
|
+
e.set(S, (e.get(S) ?? 0) + 1);
|
|
249
|
+
});
|
|
250
|
+
const h = Array.from(e.keys()).sort(
|
|
251
|
+
(S, I) => (e.get(I) ?? 0) - (e.get(S) ?? 0)
|
|
252
|
+
), E = n / 2, b = c / 2, v = /* @__PURE__ */ new Map();
|
|
253
|
+
if (h.length === 1)
|
|
254
|
+
return v.set(h[0], { x: E, y: b }), v;
|
|
255
|
+
const w = h.filter((S) => (e.get(S) ?? 0) === 1), k = h.filter((S) => (e.get(S) ?? 0) > 1);
|
|
256
|
+
if (u && (k.length === 0 || w.length > 12)) {
|
|
257
|
+
const S = Math.min(n, c) * 0.08, I = Math.ceil(Math.sqrt(w.length)), N = Math.ceil(w.length / I), H = (n - S * 2) / I, $ = (c - S * 2) / N;
|
|
258
|
+
return w.forEach((T, Z) => {
|
|
259
|
+
v.set(T, {
|
|
260
|
+
x: S + (Z % I + 0.5) * H,
|
|
261
|
+
y: S + (Math.floor(Z / I) + 0.5) * $
|
|
262
|
+
});
|
|
263
|
+
}), k.length === 0 || k.forEach((T, Z) => {
|
|
264
|
+
if (Z === 0) {
|
|
265
|
+
v.set(T, { x: E, y: b });
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
const g = (Z - 1) / Math.max(k.length - 1, 1) * Math.PI * 2 - Math.PI / 2, M = Math.min(n, c) * 0.3;
|
|
269
|
+
v.set(T, {
|
|
270
|
+
x: E + Math.cos(g) * M,
|
|
271
|
+
y: b + Math.sin(g) * M
|
|
272
|
+
});
|
|
273
|
+
}), v;
|
|
274
|
+
}
|
|
275
|
+
if (w.length === h.length) {
|
|
276
|
+
const S = Math.min(n, c) * 0.32;
|
|
277
|
+
return h.forEach((I, N) => {
|
|
278
|
+
const H = N / h.length * Math.PI * 2 - Math.PI / 2;
|
|
279
|
+
v.set(I, {
|
|
280
|
+
x: E + Math.cos(H) * S,
|
|
281
|
+
y: b + Math.sin(H) * S
|
|
282
|
+
});
|
|
283
|
+
}), v;
|
|
284
|
+
}
|
|
285
|
+
return h.forEach((S, I) => {
|
|
286
|
+
if (!v.has(S))
|
|
287
|
+
if (!v.size)
|
|
288
|
+
v.set(S, { x: E, y: b });
|
|
289
|
+
else {
|
|
290
|
+
const N = I / (h.length - 1) * Math.PI * 2, H = Math.min(n, c) * 0.28;
|
|
291
|
+
v.set(S, {
|
|
292
|
+
x: E + Math.cos(N) * H,
|
|
293
|
+
y: b + Math.sin(N) * H
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
}), v;
|
|
297
|
+
}
|
|
298
|
+
const qt = 0.55, Xt = 1.2;
|
|
299
|
+
function ot(o, n, c, u, e, h, E) {
|
|
300
|
+
if (!E || o === 0)
|
|
301
|
+
return { collideRadius: u * 1.3, linkDistance: e, chargeStrength: h };
|
|
302
|
+
const b = u * 1.15, v = Math.max(n - b * 2, 1), w = Math.max(c - b * 2, 1), k = v * w, P = Math.min(
|
|
303
|
+
u * 1.3,
|
|
304
|
+
Math.max(
|
|
305
|
+
u * 0.4,
|
|
306
|
+
Math.sqrt(k * qt / (Math.PI * o))
|
|
307
|
+
)
|
|
308
|
+
), S = Math.min(
|
|
309
|
+
1,
|
|
310
|
+
Math.sqrt(k * Xt ** 2 / o) / e
|
|
311
|
+
);
|
|
312
|
+
return {
|
|
313
|
+
collideRadius: P,
|
|
314
|
+
linkDistance: Math.max(u * 0.75, e * S),
|
|
315
|
+
chargeStrength: h * S * S
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
function Ut(o, n, c, u) {
|
|
319
|
+
const {
|
|
320
|
+
nodeSize: e = Pe,
|
|
321
|
+
linkDistance: h = 140,
|
|
322
|
+
chargeStrength: E = -450,
|
|
323
|
+
spreadIsolated: b = !1,
|
|
324
|
+
adaptiveDensity: v = !1,
|
|
325
|
+
seed: w
|
|
326
|
+
} = u ?? {}, { nodes: k, edges: P } = o;
|
|
327
|
+
if (k.length === 0) return;
|
|
328
|
+
const S = Math.min(n, c) * 0.14, I = k.map((x, R) => {
|
|
329
|
+
const W = w == null ? void 0 : w[x.id];
|
|
330
|
+
return {
|
|
331
|
+
id: x.id,
|
|
332
|
+
x: (W == null ? void 0 : W.x) ?? n / 2 + Math.cos(R / Math.max(k.length, 1) * Math.PI * 2) * S,
|
|
333
|
+
y: (W == null ? void 0 : W.y) ?? c / 2 + Math.sin(R / Math.max(k.length, 1) * Math.PI * 2) * S,
|
|
334
|
+
vx: 0,
|
|
335
|
+
vy: 0,
|
|
336
|
+
...W ? { fx: W.x, fy: W.y } : {}
|
|
337
|
+
};
|
|
338
|
+
}), N = P.filter((x) => x.source !== x.target).map((x) => ({
|
|
339
|
+
source: x.source,
|
|
340
|
+
target: x.target
|
|
341
|
+
})), H = rt(I, N), $ = st(
|
|
342
|
+
H,
|
|
343
|
+
n,
|
|
344
|
+
c,
|
|
345
|
+
b
|
|
346
|
+
), T = ot(
|
|
347
|
+
k.length,
|
|
348
|
+
n,
|
|
349
|
+
c,
|
|
350
|
+
e,
|
|
351
|
+
h,
|
|
352
|
+
E,
|
|
353
|
+
v
|
|
354
|
+
), Z = (x) => {
|
|
355
|
+
const R = H.get(x);
|
|
356
|
+
return R === void 0 ? void 0 : $.get(R);
|
|
357
|
+
}, g = Ye(I).force(
|
|
358
|
+
"link",
|
|
359
|
+
qe(N).id((x) => x.id).distance(T.linkDistance)
|
|
360
|
+
).force("charge", Xe().strength(T.chargeStrength)).force(
|
|
361
|
+
"x",
|
|
362
|
+
Ue((x) => {
|
|
363
|
+
var R;
|
|
364
|
+
return ((R = Z(x.id)) == null ? void 0 : R.x) ?? n / 2;
|
|
365
|
+
}).strength(0.1)
|
|
366
|
+
).force(
|
|
367
|
+
"y",
|
|
368
|
+
Je((x) => {
|
|
369
|
+
var R;
|
|
370
|
+
return ((R = Z(x.id)) == null ? void 0 : R.y) ?? c / 2;
|
|
371
|
+
}).strength(0.1)
|
|
372
|
+
).force("collide", Qe(T.collideRadius)).velocityDecay(0.3).alphaDecay(0.0228).stop();
|
|
373
|
+
for (let x = 0; x < 500; x++)
|
|
374
|
+
g.tick();
|
|
375
|
+
const M = e * 1.15, B = (x, R, W) => Math.max(R, Math.min(W, x));
|
|
376
|
+
k.forEach((x, R) => {
|
|
377
|
+
x.style || (x.style = {}), x.style.x = v ? I[R].x ?? n / 2 : B(I[R].x ?? n / 2, M, Math.max(M, n - M)), x.style.y = v ? I[R].y ?? c / 2 : B(I[R].y ?? c / 2, M, Math.max(M, c - M));
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
function je(o, n, c, u, e) {
|
|
381
|
+
const {
|
|
382
|
+
nodeSize: h = Pe,
|
|
383
|
+
linkDistance: E = 140,
|
|
384
|
+
chargeStrength: b = -450,
|
|
385
|
+
spreadIsolated: v = !1,
|
|
386
|
+
adaptiveDensity: w = !1
|
|
387
|
+
} = e ?? {}, { nodes: k, edges: P } = o;
|
|
388
|
+
if (k.length === 0) return null;
|
|
389
|
+
const S = k.map((g) => {
|
|
390
|
+
var M, B;
|
|
391
|
+
return {
|
|
392
|
+
id: g.id,
|
|
393
|
+
x: ((M = g.style) == null ? void 0 : M.x) ?? n / 2,
|
|
394
|
+
y: ((B = g.style) == null ? void 0 : B.y) ?? c / 2,
|
|
395
|
+
vx: 0,
|
|
396
|
+
vy: 0
|
|
397
|
+
};
|
|
398
|
+
}), I = P.filter((g) => g.source !== g.target).map((g) => ({ source: g.source, target: g.target })), N = rt(S, I), H = st(
|
|
399
|
+
N,
|
|
400
|
+
n,
|
|
401
|
+
c,
|
|
402
|
+
v
|
|
403
|
+
), $ = (g) => {
|
|
404
|
+
const M = N.get(g);
|
|
405
|
+
return M === void 0 ? void 0 : H.get(M);
|
|
406
|
+
}, T = ot(
|
|
407
|
+
k.length,
|
|
408
|
+
n,
|
|
409
|
+
c,
|
|
410
|
+
h,
|
|
411
|
+
E,
|
|
412
|
+
b,
|
|
413
|
+
w
|
|
414
|
+
);
|
|
415
|
+
return { simulation: Ye(S).force(
|
|
416
|
+
"link",
|
|
417
|
+
qe(I).id((g) => g.id).distance(T.linkDistance)
|
|
418
|
+
).force("charge", Xe().strength(T.chargeStrength)).force(
|
|
419
|
+
"x",
|
|
420
|
+
Ue((g) => {
|
|
421
|
+
var M;
|
|
422
|
+
return ((M = $(g.id)) == null ? void 0 : M.x) ?? n / 2;
|
|
423
|
+
}).strength(0.1)
|
|
424
|
+
).force(
|
|
425
|
+
"y",
|
|
426
|
+
Je((g) => {
|
|
427
|
+
var M;
|
|
428
|
+
return ((M = $(g.id)) == null ? void 0 : M.y) ?? c / 2;
|
|
429
|
+
}).strength(0.1)
|
|
430
|
+
).force("collide", Qe(T.collideRadius)).velocityDecay(0.3).alphaDecay(0.0228).on("tick", u).alpha(0).stop(), d3Nodes: S };
|
|
431
|
+
}
|
|
432
|
+
const Jt = [
|
|
433
|
+
// 滚轮缩放(对应 scaleLimit: { min: 0.5, max: 3 })
|
|
434
|
+
{
|
|
435
|
+
type: "zoom-canvas",
|
|
436
|
+
key: "zoom-canvas",
|
|
437
|
+
zoomRange: [0.2, 3]
|
|
438
|
+
},
|
|
439
|
+
// 画布平移(对应 roam: true 的平移部分)
|
|
440
|
+
{
|
|
441
|
+
type: "drag-canvas",
|
|
442
|
+
key: "drag-canvas"
|
|
443
|
+
},
|
|
444
|
+
// 节点拖拽(对应 draggable: true)
|
|
445
|
+
{
|
|
446
|
+
type: "drag-element",
|
|
447
|
+
key: "drag-element"
|
|
448
|
+
},
|
|
449
|
+
// hover 高亮(对应 ECharts emphasis)
|
|
450
|
+
{
|
|
451
|
+
type: "hover-activate",
|
|
452
|
+
key: "hover-activate",
|
|
453
|
+
degree: 0,
|
|
454
|
+
state: "emphasis"
|
|
455
|
+
}
|
|
456
|
+
];
|
|
457
|
+
function Qt(o, n, c, u) {
|
|
458
|
+
return {
|
|
459
|
+
nodes: o.data.map((e) => {
|
|
460
|
+
const h = e.id, E = e.code ?? h, b = e.name ?? "", v = e.categoryCode || ve;
|
|
461
|
+
return {
|
|
462
|
+
id: h,
|
|
463
|
+
data: {
|
|
464
|
+
...e,
|
|
465
|
+
code: E,
|
|
466
|
+
name: b,
|
|
467
|
+
...e.categoryCode ? { categoryCode: e.categoryCode } : {}
|
|
468
|
+
},
|
|
469
|
+
style: Zt(
|
|
470
|
+
{ data: { code: E, name: b } },
|
|
471
|
+
n == null ? void 0 : n[E.toLowerCase()],
|
|
472
|
+
u == null ? void 0 : u.get(v)
|
|
473
|
+
)
|
|
474
|
+
};
|
|
475
|
+
}),
|
|
476
|
+
edges: o.links.map((e, h) => {
|
|
477
|
+
const E = e.code || e.value, b = `edge-${e.source}-${e.target}-${E}-${h}`, v = E ?? "", w = e.displayName || e.value || "", k = e.sourceName || "", P = e.targetName || "";
|
|
478
|
+
return {
|
|
479
|
+
id: b,
|
|
480
|
+
source: e.source,
|
|
481
|
+
// source===target 时 G6 原生渲染自关联 loop edge
|
|
482
|
+
target: e.target,
|
|
483
|
+
data: {
|
|
484
|
+
...e,
|
|
485
|
+
code: v,
|
|
486
|
+
displayName: w,
|
|
487
|
+
sourceName: k,
|
|
488
|
+
targetName: P
|
|
489
|
+
},
|
|
490
|
+
style: Yt(
|
|
491
|
+
{
|
|
492
|
+
source: e.source,
|
|
493
|
+
target: e.target,
|
|
494
|
+
data: {
|
|
495
|
+
code: v,
|
|
496
|
+
displayName: w,
|
|
497
|
+
sourceName: k,
|
|
498
|
+
targetName: P,
|
|
499
|
+
isSelfAssoc: e.isSelfAssoc
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
c == null ? void 0 : c[v.toLowerCase()]
|
|
503
|
+
)
|
|
504
|
+
};
|
|
505
|
+
})
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
const Ke = 120, en = [10, 10, 10, 10];
|
|
509
|
+
async function Ne(o) {
|
|
510
|
+
if (await o.fitView(), !o.destroyed && o.getZoom() > 1) {
|
|
511
|
+
if (await o.zoomTo(1), o.destroyed) return;
|
|
512
|
+
await o.fitCenter();
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
function De(o) {
|
|
516
|
+
return o.context;
|
|
517
|
+
}
|
|
518
|
+
function K(o) {
|
|
519
|
+
return typeof o == "object" && o !== null ? o : {};
|
|
520
|
+
}
|
|
521
|
+
function F(o) {
|
|
522
|
+
return typeof o == "string" ? o : "";
|
|
523
|
+
}
|
|
524
|
+
function se(o, n = 0) {
|
|
525
|
+
return typeof o == "number" && Number.isFinite(o) ? o : n;
|
|
526
|
+
}
|
|
527
|
+
function ct(o) {
|
|
528
|
+
const n = K(o).preventDefault;
|
|
529
|
+
typeof n == "function" && n.call(o);
|
|
530
|
+
}
|
|
531
|
+
function me(o, n, c) {
|
|
532
|
+
const u = K(o), e = F(K(u.target).id) || F(u.itemId);
|
|
533
|
+
let h = {};
|
|
534
|
+
if (c && e)
|
|
535
|
+
try {
|
|
536
|
+
const P = n === "node" ? c.getNodeData([e]) : c.getEdgeData([e]);
|
|
537
|
+
h = K(P == null ? void 0 : P[0]);
|
|
538
|
+
} catch {
|
|
539
|
+
}
|
|
540
|
+
const E = K(h.data), b = {
|
|
541
|
+
...E,
|
|
542
|
+
id: F(h.id) || e,
|
|
543
|
+
code: F(E.code) || F(E.value) || F(h.id) || e,
|
|
544
|
+
name: F(E.name) || F(E.displayName) || ""
|
|
545
|
+
};
|
|
546
|
+
F(h.source) && (b.source = F(h.source)), F(h.target) && (b.target = F(h.target));
|
|
547
|
+
const v = K(u.viewport ?? u.canvasPoint ?? u.point), w = K(u.client ?? u.clientPoint), k = K(u.nativeEvent);
|
|
548
|
+
return {
|
|
549
|
+
dataType: n,
|
|
550
|
+
data: b,
|
|
551
|
+
name: F(E.name) || F(E.displayName) || e,
|
|
552
|
+
event: {
|
|
553
|
+
event: {
|
|
554
|
+
offsetX: se(v.x),
|
|
555
|
+
offsetY: se(v.y),
|
|
556
|
+
clientX: se(w.x, se(k.clientX)),
|
|
557
|
+
clientY: se(w.y, se(k.clientY)),
|
|
558
|
+
metaKey: !!(u.metaKey ?? K(u.originalEvent).metaKey ?? k.metaKey),
|
|
559
|
+
ctrlKey: !!(u.ctrlKey ?? K(u.originalEvent).ctrlKey ?? k.ctrlKey),
|
|
560
|
+
preventDefault: () => ct(o)
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
function tn(o) {
|
|
566
|
+
const {
|
|
567
|
+
// layout 已移除:G6 v5 animation:false 时 preLayout 同步失效,
|
|
568
|
+
// 改用 computeForceLayout 预计算位置写入 style.x/y
|
|
569
|
+
zoomRange: n = [0.2, 3],
|
|
570
|
+
onNodeClick: c,
|
|
571
|
+
onNodeDoubleClick: u,
|
|
572
|
+
onEdgeClick: e,
|
|
573
|
+
onNodeContextMenu: h,
|
|
574
|
+
onNodeHover: E,
|
|
575
|
+
onEdgeHover: b,
|
|
576
|
+
onHoverLeave: v,
|
|
577
|
+
onCanvasClick: w,
|
|
578
|
+
onViewportChange: k,
|
|
579
|
+
tooltipFormatter: P,
|
|
580
|
+
forceLayoutOptions: S,
|
|
581
|
+
ctxMenuOpenRef: I,
|
|
582
|
+
nodeInstanceCountRef: N,
|
|
583
|
+
edgeInstanceCountRef: H
|
|
584
|
+
} = o, $ = G(null), [T, Z] = ne(!1), g = G(null), [M, B] = ne(!1), x = G(!1), R = G(null), W = G(null), Q = G(null), oe = G(null), ke = G(() => {
|
|
585
|
+
}), te = G(null), V = G(!1), j = G(null), ie = G([]), de = G(null), ye = G(!1), ue = G(void 0);
|
|
586
|
+
le(() => {
|
|
587
|
+
ue.current = S;
|
|
588
|
+
});
|
|
589
|
+
const fe = G(0), q = G({
|
|
590
|
+
onNodeClick: c,
|
|
591
|
+
onNodeDoubleClick: u,
|
|
592
|
+
onEdgeClick: e,
|
|
593
|
+
onNodeContextMenu: h,
|
|
594
|
+
onNodeHover: E,
|
|
595
|
+
onEdgeHover: b,
|
|
596
|
+
onHoverLeave: v,
|
|
597
|
+
onCanvasClick: w,
|
|
598
|
+
onViewportChange: k,
|
|
599
|
+
tooltipFormatter: P,
|
|
600
|
+
ctxMenuOpenRef: I,
|
|
601
|
+
nodeInstanceCountRef: N,
|
|
602
|
+
edgeInstanceCountRef: H
|
|
603
|
+
});
|
|
604
|
+
le(() => {
|
|
605
|
+
q.current = {
|
|
606
|
+
onNodeClick: c,
|
|
607
|
+
onNodeDoubleClick: u,
|
|
608
|
+
onEdgeClick: e,
|
|
609
|
+
onNodeContextMenu: h,
|
|
610
|
+
onNodeHover: E,
|
|
611
|
+
onEdgeHover: b,
|
|
612
|
+
onHoverLeave: v,
|
|
613
|
+
onCanvasClick: w,
|
|
614
|
+
onViewportChange: k,
|
|
615
|
+
tooltipFormatter: P,
|
|
616
|
+
ctxMenuOpenRef: I,
|
|
617
|
+
nodeInstanceCountRef: N,
|
|
618
|
+
edgeInstanceCountRef: H
|
|
619
|
+
};
|
|
620
|
+
});
|
|
621
|
+
const m = L((l) => {
|
|
622
|
+
l ? ($.current = l, Z(!0)) : ($.current = null, Z(!1));
|
|
623
|
+
}, []);
|
|
624
|
+
le(() => {
|
|
625
|
+
if (!T) return;
|
|
626
|
+
const l = $.current;
|
|
627
|
+
if (!l || g.current) return;
|
|
628
|
+
let r = !0;
|
|
629
|
+
const f = {
|
|
630
|
+
container: l,
|
|
631
|
+
autoResize: !0,
|
|
632
|
+
animation: !1,
|
|
633
|
+
data: { nodes: [], edges: [] },
|
|
634
|
+
padding: en,
|
|
635
|
+
// 不设置 G6 内置 layout — 使用 computeForceLayout 预计算位置
|
|
636
|
+
// 避免 G6 preLayout 在 animation:false 时与预计算位置冲突
|
|
637
|
+
zoomRange: n,
|
|
638
|
+
behaviors: Jt,
|
|
639
|
+
// 处理平行边和自环边:分散模式自动将多条自环分配到 8 个位置
|
|
640
|
+
transforms: [{ type: "process-parallel-edges" }],
|
|
641
|
+
node: {
|
|
642
|
+
type: "circle",
|
|
643
|
+
state: {
|
|
644
|
+
emphasis: re.emphasis.node,
|
|
645
|
+
pathHighlight: re.pathHighlight.node,
|
|
646
|
+
pathLast: re.pathLast.node,
|
|
647
|
+
pathDim: re.pathDim.node,
|
|
648
|
+
focusDim: re.focusDim.node
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
edge: {
|
|
652
|
+
type: "quadratic",
|
|
653
|
+
state: {
|
|
654
|
+
emphasis: re.emphasis.edge,
|
|
655
|
+
pathHighlight: re.pathHighlight.edge,
|
|
656
|
+
pathLast: re.pathLast.edge,
|
|
657
|
+
pathDim: re.pathDim.edge,
|
|
658
|
+
focusDim: re.focusDim.edge
|
|
659
|
+
}
|
|
660
|
+
},
|
|
661
|
+
plugins: [
|
|
662
|
+
{
|
|
663
|
+
type: "tooltip",
|
|
664
|
+
key: "tooltip",
|
|
665
|
+
getContent: (a, s) => {
|
|
666
|
+
var C;
|
|
667
|
+
const t = q.current;
|
|
668
|
+
if (!t.tooltipFormatter || (C = t.ctxMenuOpenRef) != null && C.current || !(s != null && s[0])) return "";
|
|
669
|
+
const i = K(s[0]), y = "source" in i ? "edge" : "node", D = {
|
|
670
|
+
...K(i.data),
|
|
671
|
+
id: F(i.id)
|
|
672
|
+
};
|
|
673
|
+
return F(i.source) && (D.source = F(i.source)), F(i.target) && (D.target = F(i.target)), t.tooltipFormatter(D, y);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
]
|
|
677
|
+
};
|
|
678
|
+
try {
|
|
679
|
+
const a = new kt(f);
|
|
680
|
+
g.current = a, a.on("node:click", (s) => {
|
|
681
|
+
var i, y;
|
|
682
|
+
const t = me(s, "node", a);
|
|
683
|
+
(y = (i = q.current).onNodeClick) == null || y.call(i, t);
|
|
684
|
+
}), a.on("node:dblclick", (s) => {
|
|
685
|
+
var i, y;
|
|
686
|
+
const t = me(s, "node", a);
|
|
687
|
+
(y = (i = q.current).onNodeDoubleClick) == null || y.call(i, t);
|
|
688
|
+
}), a.on("edge:click", (s) => {
|
|
689
|
+
var i, y;
|
|
690
|
+
const t = me(s, "edge", a);
|
|
691
|
+
(y = (i = q.current).onEdgeClick) == null || y.call(i, t);
|
|
692
|
+
}), a.on("node:contextmenu", (s) => {
|
|
693
|
+
var i, y;
|
|
694
|
+
ct(s);
|
|
695
|
+
const t = me(s, "node", a);
|
|
696
|
+
(y = (i = q.current).onNodeContextMenu) == null || y.call(i, t);
|
|
697
|
+
}), a.on("canvas:click", () => {
|
|
698
|
+
var s, t;
|
|
699
|
+
(t = (s = q.current).onCanvasClick) == null || t.call(s);
|
|
700
|
+
}), a.on("aftertransform", () => {
|
|
701
|
+
var s, t;
|
|
702
|
+
fe.current > 0 || (t = (s = q.current).onViewportChange) == null || t.call(s);
|
|
703
|
+
}), a.on("node:pointerenter", (s) => {
|
|
704
|
+
var i, y;
|
|
705
|
+
const t = me(s, "node", a);
|
|
706
|
+
(y = (i = q.current).onNodeHover) == null || y.call(i, t);
|
|
707
|
+
}), a.on("edge:pointerenter", (s) => {
|
|
708
|
+
var i, y;
|
|
709
|
+
const t = me(s, "edge", a);
|
|
710
|
+
(y = (i = q.current).onEdgeHover) == null || y.call(i, t);
|
|
711
|
+
}), a.on("node:pointerleave", () => {
|
|
712
|
+
var s, t;
|
|
713
|
+
(t = (s = q.current).onHoverLeave) == null || t.call(s);
|
|
714
|
+
}), a.on("edge:pointerleave", () => {
|
|
715
|
+
var s, t;
|
|
716
|
+
(t = (s = q.current).onHoverLeave) == null || t.call(s);
|
|
717
|
+
}), a.on("node:dragstart", (s) => {
|
|
718
|
+
var z;
|
|
719
|
+
const t = K(s), i = F(K(t.target).id) || F(t.itemId);
|
|
720
|
+
if (!i) return;
|
|
721
|
+
const y = ie.current.find((ee) => ee.id === i);
|
|
722
|
+
if (!y || !j.current) return;
|
|
723
|
+
de.current = i;
|
|
724
|
+
const D = (z = a.getNodeData([i])) == null ? void 0 : z[0], C = se(K(D == null ? void 0 : D.style).x, y.x ?? 0), _ = se(K(D == null ? void 0 : D.style).y, y.y ?? 0);
|
|
725
|
+
y.fx = C, y.fy = _, j.current.alphaTarget(0.3).alpha(0.3).restart();
|
|
726
|
+
}), a.on("node:drag", (s) => {
|
|
727
|
+
const t = de.current;
|
|
728
|
+
if (!t || !j.current) return;
|
|
729
|
+
const i = ie.current.find((z) => z.id === t);
|
|
730
|
+
if (!i) return;
|
|
731
|
+
const y = K(s), D = a.getZoom(), C = se(y.dx) / D, _ = se(y.dy) / D;
|
|
732
|
+
i.fx = (i.fx ?? i.x ?? 0) + C, i.fy = (i.fy ?? i.y ?? 0) + _;
|
|
733
|
+
}), a.on("node:dragend", () => {
|
|
734
|
+
j.current && j.current.alphaTarget(0), de.current = null;
|
|
735
|
+
}), queueMicrotask(() => {
|
|
736
|
+
r && B(!0);
|
|
737
|
+
});
|
|
738
|
+
} catch (a) {
|
|
739
|
+
console.error("[G6] Failed to create graph:", a);
|
|
740
|
+
}
|
|
741
|
+
return () => {
|
|
742
|
+
r = !1, j.current && (j.current.stop(), j.current = null), Q.current && (clearTimeout(Q.current), Q.current = null), W.current = null, g.current && (g.current.destroy(), g.current = null, V.current = !1, R.current = null, B(!1));
|
|
743
|
+
};
|
|
744
|
+
}, [T]), le(() => {
|
|
745
|
+
if (!T) return;
|
|
746
|
+
const l = $.current;
|
|
747
|
+
if (!l) return;
|
|
748
|
+
const r = new ResizeObserver(() => {
|
|
749
|
+
var f;
|
|
750
|
+
if (W.current) {
|
|
751
|
+
ke.current();
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
(f = te.current) == null || f.call(te);
|
|
755
|
+
});
|
|
756
|
+
return r.observe(l), oe.current = r, () => {
|
|
757
|
+
r.disconnect(), oe.current === r && (oe.current = null);
|
|
758
|
+
};
|
|
759
|
+
}, [T]);
|
|
760
|
+
const d = L(() => {
|
|
761
|
+
var f;
|
|
762
|
+
const l = g.current;
|
|
763
|
+
if (!l || l.destroyed) return;
|
|
764
|
+
const r = (f = De(l)) == null ? void 0 : f.canvas;
|
|
765
|
+
r != null && r.getLayers && Object.values(r.getLayers()).forEach((a) => {
|
|
766
|
+
var t;
|
|
767
|
+
const s = (t = a.getRenderingService) == null ? void 0 : t.call(a);
|
|
768
|
+
s != null && s.dirty && s.dirty(), !a.frameId && typeof a.run == "function" && a.run(), typeof a.render == "function" && a.render();
|
|
769
|
+
});
|
|
770
|
+
}, []), p = L(
|
|
771
|
+
async (l) => {
|
|
772
|
+
fe.current += 1;
|
|
773
|
+
try {
|
|
774
|
+
await l();
|
|
775
|
+
} finally {
|
|
776
|
+
fe.current -= 1;
|
|
777
|
+
}
|
|
778
|
+
},
|
|
779
|
+
[]
|
|
780
|
+
), A = L(() => {
|
|
781
|
+
const l = g.current;
|
|
782
|
+
if (!l || l.destroyed) return;
|
|
783
|
+
const r = ie.current;
|
|
784
|
+
if (!r.length) return;
|
|
785
|
+
const f = r.filter((a) => a.fx == null && a.fy == null).map((a) => ({ id: a.id, style: { x: a.x, y: a.y } }));
|
|
786
|
+
f.length !== 0 && (l.updateData({ nodes: f, edges: [] }), d());
|
|
787
|
+
}, [d]), X = G({ emphasisNodes: /* @__PURE__ */ new Set(), emphasisEdgeCodes: /* @__PURE__ */ new Set(), dimmedNodes: /* @__PURE__ */ new Set() }), Y = L(
|
|
788
|
+
(l) => {
|
|
789
|
+
const r = l ?? g.current;
|
|
790
|
+
if (!r || r.destroyed || !V.current) return;
|
|
791
|
+
const { emphasisNodes: f, emphasisEdgeCodes: a, dimmedNodes: s } = X.current, t = {};
|
|
792
|
+
r.getNodeData().forEach((i) => {
|
|
793
|
+
const y = String(i.id), C = (r.getElementState(y) ?? []).filter((_) => _ !== "emphasis" && _ !== "focusDim");
|
|
794
|
+
f.has(y) && C.push("emphasis"), s.has(y) && C.push("focusDim"), t[y] = C;
|
|
795
|
+
}), r.getEdgeData().forEach((i) => {
|
|
796
|
+
var z, ee;
|
|
797
|
+
const y = String(i.id), C = (r.getElementState(y) ?? []).filter((J) => J !== "emphasis" && J !== "focusDim"), _ = String(((z = i.data) == null ? void 0 : z.code) ?? ((ee = i.data) == null ? void 0 : ee.value) ?? "");
|
|
798
|
+
_ && a.has(_) && C.push("emphasis"), (s.has(String(i.source)) || s.has(String(i.target))) && C.push("focusDim"), t[y] = C;
|
|
799
|
+
}), Promise.resolve(r.setElementState(t)).then(() => d()).catch(() => {
|
|
800
|
+
});
|
|
801
|
+
},
|
|
802
|
+
[d]
|
|
803
|
+
), lt = L(
|
|
804
|
+
(l, r, f) => {
|
|
805
|
+
X.current = {
|
|
806
|
+
emphasisNodes: new Set(l),
|
|
807
|
+
emphasisEdgeCodes: new Set(r),
|
|
808
|
+
dimmedNodes: new Set(f)
|
|
809
|
+
}, Y();
|
|
810
|
+
},
|
|
811
|
+
[Y]
|
|
812
|
+
), ce = L(
|
|
813
|
+
(l, r, f, a, s) => {
|
|
814
|
+
var y, D, C;
|
|
815
|
+
const t = g.current;
|
|
816
|
+
if (!t || t.destroyed)
|
|
817
|
+
return;
|
|
818
|
+
let i;
|
|
819
|
+
if (s && R.current) {
|
|
820
|
+
const _ = {};
|
|
821
|
+
R.current.nodes.forEach((z) => {
|
|
822
|
+
var ae, Ee;
|
|
823
|
+
const ee = (ae = z.style) == null ? void 0 : ae.x, J = (Ee = z.style) == null ? void 0 : Ee.y;
|
|
824
|
+
typeof ee == "number" && typeof J == "number" && (_[z.id] = { x: ee, y: J });
|
|
825
|
+
}), Object.keys(_).length && (i = _);
|
|
826
|
+
}
|
|
827
|
+
Ut(l, r, f, {
|
|
828
|
+
...ue.current,
|
|
829
|
+
...i ? { seed: i } : {}
|
|
830
|
+
}), t.setData(l), (C = (D = (y = De(t)) == null ? void 0 : y.model) == null ? void 0 : D.refreshData) == null || C.call(D), V.current = !1, !R.current || R.current.nodes.length === 0 ? t.render().then(async () => {
|
|
831
|
+
if (g.current !== t || t.destroyed || (await p(() => Ne(t)), g.current !== t || t.destroyed)) return;
|
|
832
|
+
d(), j.current && j.current.stop();
|
|
833
|
+
const _ = je(
|
|
834
|
+
l,
|
|
835
|
+
r,
|
|
836
|
+
f,
|
|
837
|
+
A,
|
|
838
|
+
ue.current
|
|
839
|
+
);
|
|
840
|
+
_ && (j.current = _.simulation, ie.current = _.d3Nodes), V.current = !0, Y(t);
|
|
841
|
+
}).catch((_) => {
|
|
842
|
+
console.error("[G6] render failed:", _), g.current === t && (V.current = !0);
|
|
843
|
+
}) : t.draw().then(async () => {
|
|
844
|
+
var ee, J, ae;
|
|
845
|
+
if (g.current !== t || t.destroyed) return;
|
|
846
|
+
const _ = ye.current;
|
|
847
|
+
ye.current = !1, _ || d(), j.current && j.current.stop();
|
|
848
|
+
const z = je(
|
|
849
|
+
l,
|
|
850
|
+
r,
|
|
851
|
+
f,
|
|
852
|
+
A,
|
|
853
|
+
ue.current
|
|
854
|
+
);
|
|
855
|
+
z && (j.current = z.simulation, ie.current = z.d3Nodes), !(a && !_ && (await p(() => Ne(t)), g.current !== t || t.destroyed)) && (V.current = !0, _ ? ((ae = (J = (ee = De(t)) == null ? void 0 : ee.model) == null ? void 0 : J.refreshData) == null || ae.call(J), t.draw().then(async () => {
|
|
856
|
+
g.current !== t || t.destroyed || (await p(() => Ne(t)), !(g.current !== t || t.destroyed) && (d(), Y(t)));
|
|
857
|
+
}).catch(() => {
|
|
858
|
+
g.current === t && d();
|
|
859
|
+
})) : Y(t));
|
|
860
|
+
}).catch((_) => {
|
|
861
|
+
console.error("[G6] draw failed:", _), g.current === t && (V.current = !0);
|
|
862
|
+
}), R.current = l;
|
|
863
|
+
},
|
|
864
|
+
[d, A, p, Y]
|
|
865
|
+
), Oe = L(() => {
|
|
866
|
+
Q.current && clearTimeout(Q.current), Q.current = setTimeout(() => {
|
|
867
|
+
const l = W.current, r = $.current;
|
|
868
|
+
if (!l || !r) return;
|
|
869
|
+
const f = r.clientWidth, a = r.clientHeight;
|
|
870
|
+
f <= 0 || a <= 0 || (W.current = null, ce(l, f, a));
|
|
871
|
+
}, Ke);
|
|
872
|
+
}, [ce]);
|
|
873
|
+
le(() => {
|
|
874
|
+
ke.current = Oe;
|
|
875
|
+
});
|
|
876
|
+
const dt = L(() => {
|
|
877
|
+
Q.current && clearTimeout(Q.current), Q.current = setTimeout(() => {
|
|
878
|
+
const l = $.current, r = R.current;
|
|
879
|
+
if (!l || !r || r.nodes.length === 0) return;
|
|
880
|
+
const f = l.clientWidth, a = l.clientHeight;
|
|
881
|
+
f <= 0 || a <= 0 || ce(r, f, a, !0);
|
|
882
|
+
}, Ke);
|
|
883
|
+
}, [ce]);
|
|
884
|
+
le(() => {
|
|
885
|
+
te.current = dt;
|
|
886
|
+
});
|
|
887
|
+
const ut = L(
|
|
888
|
+
(l, r) => {
|
|
889
|
+
const f = g.current;
|
|
890
|
+
if (!f || f.destroyed)
|
|
891
|
+
return;
|
|
892
|
+
if (r != null && r.settle && (ye.current = !0), !R.current || R.current.nodes.length === 0) {
|
|
893
|
+
W.current = l, Oe();
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
const s = $.current, t = (s == null ? void 0 : s.clientWidth) || 800, i = (s == null ? void 0 : s.clientHeight) || 600;
|
|
897
|
+
ce(l, t, i, r == null ? void 0 : r.fit, r == null ? void 0 : r.keepPositions);
|
|
898
|
+
},
|
|
899
|
+
[ce, Oe]
|
|
900
|
+
), ft = L(
|
|
901
|
+
(l) => {
|
|
902
|
+
const r = g.current;
|
|
903
|
+
if (!r || r.destroyed) return;
|
|
904
|
+
const f = r.getNodeData(), a = r.getEdgeData(), s = {};
|
|
905
|
+
f.forEach((i) => {
|
|
906
|
+
s[String(i.id)] = [];
|
|
907
|
+
}), a.forEach((i) => {
|
|
908
|
+
s[String(i.id)] = [];
|
|
909
|
+
});
|
|
910
|
+
const t = f.some((i) => String(i.id) === l);
|
|
911
|
+
!V.current || f.length === 0 || Promise.resolve(r.setElementState(s)).then(() => {
|
|
912
|
+
if (t)
|
|
913
|
+
return r.setElementState(l, "emphasis");
|
|
914
|
+
}).then(() => d()).catch(() => {
|
|
915
|
+
});
|
|
916
|
+
},
|
|
917
|
+
[d]
|
|
918
|
+
), ht = L(
|
|
919
|
+
(l, r, f, a) => {
|
|
920
|
+
const s = g.current;
|
|
921
|
+
if (!s || s.destroyed) return;
|
|
922
|
+
const t = {}, i = s.getNodeData();
|
|
923
|
+
i.forEach((D) => {
|
|
924
|
+
var z;
|
|
925
|
+
const C = String(D.id), _ = String(((z = D.data) == null ? void 0 : z.code) || D.id);
|
|
926
|
+
l.has(_) || l.has(C) ? _ === f || C === f ? t[C] = ["pathLast"] : t[C] = ["pathHighlight"] : t[C] = ["pathDim"];
|
|
927
|
+
}), s.getEdgeData().forEach((D) => {
|
|
928
|
+
var ae, Ee;
|
|
929
|
+
const C = String(D.id), _ = String(((ae = D.data) == null ? void 0 : ae.value) ?? ((Ee = D.data) == null ? void 0 : Ee.code) ?? ""), z = String(D.source), ee = String(D.target), J = `${z}->${ee}::${_}`;
|
|
930
|
+
r.has(J) || r.has(_) ? J === a || _ === a ? t[C] = ["pathLast"] : t[C] = ["pathHighlight"] : t[C] = ["pathDim"];
|
|
931
|
+
}), !(!V.current || i.length === 0) && (x.current = !0, Promise.resolve(s.setElementState(t)).then(() => d()).catch(() => {
|
|
932
|
+
}));
|
|
933
|
+
},
|
|
934
|
+
[d]
|
|
935
|
+
), gt = L(() => {
|
|
936
|
+
const l = g.current;
|
|
937
|
+
if (!l || l.destroyed || !x.current || !V.current) return;
|
|
938
|
+
const r = l.getNodeData(), f = l.getEdgeData(), a = {};
|
|
939
|
+
r.forEach((s) => {
|
|
940
|
+
a[String(s.id)] = [];
|
|
941
|
+
}), f.forEach((s) => {
|
|
942
|
+
a[String(s.id)] = [];
|
|
943
|
+
}), x.current = !1, Promise.resolve(l.setElementState(a)).then(() => d()).catch(() => {
|
|
944
|
+
});
|
|
945
|
+
}, [d]), mt = L(() => {
|
|
946
|
+
const l = g.current;
|
|
947
|
+
if (!l || l.destroyed) return;
|
|
948
|
+
const r = R.current;
|
|
949
|
+
if (!r || r.nodes.length === 0) {
|
|
950
|
+
p(() => Ne(l)).then(
|
|
951
|
+
() => d()
|
|
952
|
+
);
|
|
953
|
+
return;
|
|
954
|
+
}
|
|
955
|
+
const f = $.current, a = (f == null ? void 0 : f.clientWidth) || 800, s = (f == null ? void 0 : f.clientHeight) || 600;
|
|
956
|
+
ce(r, a, s, !0);
|
|
957
|
+
}, [ce, d, p]), pt = L(
|
|
958
|
+
(l) => {
|
|
959
|
+
const r = g.current;
|
|
960
|
+
if (!r || r.destroyed || !V.current) return;
|
|
961
|
+
const f = Math.max(r.getZoom(), 1);
|
|
962
|
+
p(async () => {
|
|
963
|
+
await r.focusElement(l, { duration: 300 }), !(r.destroyed || r.getZoom() === f) && await r.zoomTo(f, { duration: 250 });
|
|
964
|
+
}).then(() => d()).catch(() => {
|
|
965
|
+
});
|
|
966
|
+
},
|
|
967
|
+
[d, p]
|
|
968
|
+
), yt = L(
|
|
969
|
+
(l) => {
|
|
970
|
+
const r = g.current;
|
|
971
|
+
if (!r || r.destroyed || !V.current) return;
|
|
972
|
+
const f = new Set(l), a = {};
|
|
973
|
+
r.getNodeData().forEach((s) => {
|
|
974
|
+
const t = String(s.id), y = (r.getElementState(t) ?? []).filter((D) => D !== "focusDim");
|
|
975
|
+
f.has(t) && y.push("focusDim"), a[t] = y;
|
|
976
|
+
}), r.getEdgeData().forEach((s) => {
|
|
977
|
+
const t = String(s.id), y = (r.getElementState(t) ?? []).filter((D) => D !== "focusDim");
|
|
978
|
+
(f.has(String(s.source)) || f.has(String(s.target))) && y.push("focusDim"), a[t] = y;
|
|
979
|
+
}), Promise.resolve(r.setElementState(a)).then(() => d()).catch(() => {
|
|
980
|
+
});
|
|
981
|
+
},
|
|
982
|
+
[d]
|
|
983
|
+
), Et = L(() => {
|
|
984
|
+
var r, f, a;
|
|
985
|
+
const l = g.current;
|
|
986
|
+
if (!(!l || l.destroyed))
|
|
987
|
+
try {
|
|
988
|
+
const s = (a = (f = (r = De(l)) == null ? void 0 : r.plugin) == null ? void 0 : f.get) == null ? void 0 : a.call(f, "tooltip");
|
|
989
|
+
s && typeof s.hide == "function" && s.hide();
|
|
990
|
+
} catch {
|
|
991
|
+
}
|
|
992
|
+
}, []), vt = L(() => g.current, []);
|
|
993
|
+
return {
|
|
994
|
+
containerRef: m,
|
|
995
|
+
setData: ut,
|
|
996
|
+
highlightNode: ft,
|
|
997
|
+
applyPathStyle: ht,
|
|
998
|
+
resetPathStyle: gt,
|
|
999
|
+
fitView: mt,
|
|
1000
|
+
focusNode: pt,
|
|
1001
|
+
setNodeDim: yt,
|
|
1002
|
+
setViewState: lt,
|
|
1003
|
+
hideTooltip: Et,
|
|
1004
|
+
ready: M,
|
|
1005
|
+
getGraph: vt
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
const at = "class", it = "instance";
|
|
1009
|
+
function nn() {
|
|
1010
|
+
return Ft([
|
|
1011
|
+
{ categoryCode: at },
|
|
1012
|
+
{ categoryCode: it }
|
|
1013
|
+
]);
|
|
1014
|
+
}
|
|
1015
|
+
function xe(o) {
|
|
1016
|
+
return (o.labels || []).includes("OntologyClass");
|
|
1017
|
+
}
|
|
1018
|
+
function Ze(o) {
|
|
1019
|
+
return (o.labels || []).includes("OntologyIndividual");
|
|
1020
|
+
}
|
|
1021
|
+
function Re(o) {
|
|
1022
|
+
const n = o.properties && o.properties.name;
|
|
1023
|
+
return n != null && String(n).trim() ? String(n) : o.key;
|
|
1024
|
+
}
|
|
1025
|
+
function rn(o, n) {
|
|
1026
|
+
const c = (o.nodes || []).map((e) => ({
|
|
1027
|
+
id: e.key,
|
|
1028
|
+
code: e.key,
|
|
1029
|
+
name: Re(e),
|
|
1030
|
+
fullName: e.key,
|
|
1031
|
+
categoryCode: xe(e) ? at : it,
|
|
1032
|
+
objectCode: e.key,
|
|
1033
|
+
objectName: Re(e),
|
|
1034
|
+
labels: e.labels || [],
|
|
1035
|
+
props: e.properties || {}
|
|
1036
|
+
})), u = (o.edges || []).map((e) => ({
|
|
1037
|
+
source: e.from_key,
|
|
1038
|
+
target: e.to_key,
|
|
1039
|
+
code: e.type,
|
|
1040
|
+
value: e.type,
|
|
1041
|
+
displayName: e.type,
|
|
1042
|
+
edgeKey: e.key,
|
|
1043
|
+
isSelfAssoc: e.from_key === e.to_key
|
|
1044
|
+
}));
|
|
1045
|
+
return Qt({ data: c, links: u }, void 0, void 0, n);
|
|
1046
|
+
}
|
|
1047
|
+
function sn(o, n) {
|
|
1048
|
+
const c = new Map((o.nodes || []).map((e) => [e.key, e])), u = new Map((o.edges || []).map((e) => [e.key || `${e.from_key}|${e.type}|${e.to_key}`, e]));
|
|
1049
|
+
return (n.nodes || []).forEach((e) => c.set(e.key, e)), (n.edges || []).forEach((e) => u.set(e.key || `${e.from_key}|${e.type}|${e.to_key}`, e)), { nodes: [...c.values()], edges: [...u.values()] };
|
|
1050
|
+
}
|
|
1051
|
+
function bn() {
|
|
1052
|
+
const [o] = bt(), n = o.get("id") || "", [c, u] = ne("default"), [e, h] = ne("structure"), [E, b] = ne(""), [v, w] = ne([]), [k, P] = ne({ nodes: [], edges: [] }), [S, I] = ne(!1), [N, H] = ne(null), [$, T] = ne([]), [Z, g] = ne(!1), M = $e(() => nn(), []), B = G(0), x = L(
|
|
1053
|
+
(m) => (k.nodes || []).find((d) => d.key === m) || null,
|
|
1054
|
+
[k.nodes]
|
|
1055
|
+
), R = L(() => (k.nodes || []).map((m) => m.key), [k.nodes]), { containerRef: W, setData: Q, setViewState: oe, ready: ke } = tn({
|
|
1056
|
+
onNodeClick: (m) => {
|
|
1057
|
+
var A, X;
|
|
1058
|
+
const d = ((A = m.data) == null ? void 0 : A.code) || ((X = m.data) == null ? void 0 : X.id);
|
|
1059
|
+
if (!d) return;
|
|
1060
|
+
const p = x(d);
|
|
1061
|
+
H(p || { key: d, labels: [], properties: {} }), T([d]), oe([d], [], R().filter((Y) => Y !== d));
|
|
1062
|
+
},
|
|
1063
|
+
onNodeDoubleClick: (m) => {
|
|
1064
|
+
var A, X;
|
|
1065
|
+
const d = ((A = m.data) == null ? void 0 : A.code) || ((X = m.data) == null ? void 0 : X.id), p = x(d);
|
|
1066
|
+
p && xe(p) && j(p.key);
|
|
1067
|
+
},
|
|
1068
|
+
onCanvasClick: () => {
|
|
1069
|
+
H(null), T([]), oe([], [], []);
|
|
1070
|
+
},
|
|
1071
|
+
tooltipFormatter: (m, d) => {
|
|
1072
|
+
if (d !== "node") return "";
|
|
1073
|
+
const p = Array.isArray(m.labels) ? m.labels.join(" / ") : "";
|
|
1074
|
+
return `<div><b>${Ce(m.name || m.code || "")}</b>${p ? `<div style="color:#888;font-size:12px">${Ce(p)}</div>` : ""}<div style="color:#999;font-size:12px">${Ce(m.code || "")}</div></div>`;
|
|
1075
|
+
}
|
|
1076
|
+
}), te = L(
|
|
1077
|
+
(m, d = {}) => {
|
|
1078
|
+
const p = rn(m, M);
|
|
1079
|
+
Q(p, { fit: d.fit !== !1, keepPositions: !!d.keepPositions });
|
|
1080
|
+
},
|
|
1081
|
+
[Q, M]
|
|
1082
|
+
), V = L(
|
|
1083
|
+
async (m = c) => {
|
|
1084
|
+
if (!n) return;
|
|
1085
|
+
const d = ++B.current;
|
|
1086
|
+
I(!0);
|
|
1087
|
+
try {
|
|
1088
|
+
const p = await be.listClasses(n, m);
|
|
1089
|
+
if (d !== B.current) return;
|
|
1090
|
+
w(p || []);
|
|
1091
|
+
const A = (p || []).map((Y) => Y.key), X = await be.subgraph(n, A, 1, m);
|
|
1092
|
+
if (d !== B.current) return;
|
|
1093
|
+
P(X || { nodes: [], edges: [] }), h("structure"), b(""), H(null), T([]), te(X || { nodes: [], edges: [] });
|
|
1094
|
+
} catch (p) {
|
|
1095
|
+
d === B.current && (we.error(`图谱取数失败:${p.message}`), P({ nodes: [], edges: [] }), w([]));
|
|
1096
|
+
} finally {
|
|
1097
|
+
d === B.current && I(!1);
|
|
1098
|
+
}
|
|
1099
|
+
},
|
|
1100
|
+
[n, c, te]
|
|
1101
|
+
);
|
|
1102
|
+
le(() => (n && V("default"), () => {
|
|
1103
|
+
B.current += 1;
|
|
1104
|
+
}), [n]);
|
|
1105
|
+
const j = L(
|
|
1106
|
+
async (m) => {
|
|
1107
|
+
if (!n) return;
|
|
1108
|
+
const d = ++B.current;
|
|
1109
|
+
I(!0);
|
|
1110
|
+
try {
|
|
1111
|
+
const p = await be.subgraph(n, [m], 1, c);
|
|
1112
|
+
if (d !== B.current) return;
|
|
1113
|
+
P(p || { nodes: [], edges: [] }), h("instance"), b(m), H(null), T([]), te(p || { nodes: [], edges: [] });
|
|
1114
|
+
} catch (p) {
|
|
1115
|
+
d === B.current && we.error(`实例图取数失败:${p.message}`);
|
|
1116
|
+
} finally {
|
|
1117
|
+
d === B.current && I(!1);
|
|
1118
|
+
}
|
|
1119
|
+
},
|
|
1120
|
+
[n, c, te]
|
|
1121
|
+
), ie = L(() => V(), [V]), de = L(
|
|
1122
|
+
async (m) => {
|
|
1123
|
+
const d = m || N;
|
|
1124
|
+
if (!(!d || !n)) {
|
|
1125
|
+
g(!0);
|
|
1126
|
+
try {
|
|
1127
|
+
const p = await be.listNeighbors(n, d.key, 1, c), A = { nodes: [], edges: [] };
|
|
1128
|
+
(p || []).forEach((Y) => {
|
|
1129
|
+
Y.node && A.nodes.push(Y.node), Y.edge && A.edges.push(Y.edge);
|
|
1130
|
+
});
|
|
1131
|
+
const X = sn(k, A);
|
|
1132
|
+
P(X), te(X, { keepPositions: !0 });
|
|
1133
|
+
} catch (p) {
|
|
1134
|
+
we.error(`邻居展开失败:${p.message}`);
|
|
1135
|
+
} finally {
|
|
1136
|
+
g(!1);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
},
|
|
1140
|
+
[N, n, c, k, te]
|
|
1141
|
+
), ye = L(
|
|
1142
|
+
(m) => {
|
|
1143
|
+
const d = $.includes(m) ? $.filter((p) => p !== m) : [...$, m];
|
|
1144
|
+
T(d), oe(d, [], d.length ? R().filter((p) => !d.includes(p)) : []);
|
|
1145
|
+
},
|
|
1146
|
+
[$, oe, R]
|
|
1147
|
+
), ue = $e(() => {
|
|
1148
|
+
const m = {}, d = new Set((v || []).map((p) => p.key));
|
|
1149
|
+
return (k.nodes || []).forEach((p) => {
|
|
1150
|
+
d.has(p.key) ? m[p.key] = m[p.key] || { instances: 0 } : Ze(p) && (p.labels || []).filter((A) => d.has(A)).forEach((A) => {
|
|
1151
|
+
m[A] = m[A] || { instances: 0 }, m[A].instances += 1;
|
|
1152
|
+
});
|
|
1153
|
+
}), m;
|
|
1154
|
+
}, [v, k.nodes]);
|
|
1155
|
+
if (!n)
|
|
1156
|
+
return /* @__PURE__ */ O(Fe, { description: "缺少本体 ID(?id=xxx)", style: { padding: 48 } });
|
|
1157
|
+
const fe = e === "structure", q = !!(k.nodes || []).length;
|
|
1158
|
+
return /* @__PURE__ */ U("div", { className: "view", children: [
|
|
1159
|
+
/* @__PURE__ */ U("div", { className: "view-bar", children: [
|
|
1160
|
+
/* @__PURE__ */ U(_e, { icon: /* @__PURE__ */ O(ze, {}), color: "purple", children: [
|
|
1161
|
+
"本体 ",
|
|
1162
|
+
n
|
|
1163
|
+
] }),
|
|
1164
|
+
/* @__PURE__ */ O(
|
|
1165
|
+
Nt.Search,
|
|
1166
|
+
{
|
|
1167
|
+
style: { width: 200 },
|
|
1168
|
+
placeholder: "工作空间(默认 default)",
|
|
1169
|
+
value: c,
|
|
1170
|
+
onChange: (m) => u(m.target.value),
|
|
1171
|
+
onSearch: () => V()
|
|
1172
|
+
}
|
|
1173
|
+
),
|
|
1174
|
+
fe ? /* @__PURE__ */ O(he, { icon: /* @__PURE__ */ O(Dt, {}), onClick: () => V(), children: "刷新" }) : /* @__PURE__ */ U(He, { children: [
|
|
1175
|
+
/* @__PURE__ */ O(he, { icon: /* @__PURE__ */ O(et, {}), onClick: ie, children: "返回结构层" }),
|
|
1176
|
+
/* @__PURE__ */ U(_e, { color: "blue", children: [
|
|
1177
|
+
"实例层:",
|
|
1178
|
+
E
|
|
1179
|
+
] })
|
|
1180
|
+
] }),
|
|
1181
|
+
N ? /* @__PURE__ */ O(he, { icon: /* @__PURE__ */ O(Le, {}), loading: Z, onClick: () => de(N), children: "展开邻居" }) : null,
|
|
1182
|
+
/* @__PURE__ */ O("span", { className: "spacer hint", children: "双击类节点进入实例层 · 点击节点查看详情 · 空白点击取消" })
|
|
1183
|
+
] }),
|
|
1184
|
+
/* @__PURE__ */ U("div", { style: { display: "flex", gap: 12, alignItems: "stretch", height: "calc(100vh - 220px)" }, children: [
|
|
1185
|
+
/* @__PURE__ */ U("div", { className: "side-rail", children: [
|
|
1186
|
+
/* @__PURE__ */ U("div", { className: "rail-head", children: [
|
|
1187
|
+
"类型(",
|
|
1188
|
+
v.length,
|
|
1189
|
+
")"
|
|
1190
|
+
] }),
|
|
1191
|
+
v.length ? /* @__PURE__ */ O("ul", { className: "rail-list", children: v.map((m) => {
|
|
1192
|
+
const d = ue[m.key] || { instances: 0 }, p = $.includes(m.key);
|
|
1193
|
+
return /* @__PURE__ */ U(
|
|
1194
|
+
"li",
|
|
1195
|
+
{
|
|
1196
|
+
className: `rail-item${p ? " active" : ""}`,
|
|
1197
|
+
onClick: () => ye(m.key),
|
|
1198
|
+
title: "点击高亮该类型",
|
|
1199
|
+
children: [
|
|
1200
|
+
/* @__PURE__ */ O(ze, { style: { color: "#722ed1" } }),
|
|
1201
|
+
/* @__PURE__ */ O("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: Re(m) }),
|
|
1202
|
+
/* @__PURE__ */ U(_e, { style: { fontSize: 11 }, children: [
|
|
1203
|
+
d.instances,
|
|
1204
|
+
" 实例"
|
|
1205
|
+
] }),
|
|
1206
|
+
/* @__PURE__ */ O(
|
|
1207
|
+
he,
|
|
1208
|
+
{
|
|
1209
|
+
type: "link",
|
|
1210
|
+
size: "small",
|
|
1211
|
+
style: { padding: 0 },
|
|
1212
|
+
icon: /* @__PURE__ */ O(Me, {}),
|
|
1213
|
+
title: "进入实例层",
|
|
1214
|
+
onClick: (A) => {
|
|
1215
|
+
A.stopPropagation(), j(m.key);
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
)
|
|
1219
|
+
]
|
|
1220
|
+
},
|
|
1221
|
+
m.key
|
|
1222
|
+
);
|
|
1223
|
+
}) }) : /* @__PURE__ */ O("div", { className: "empty-note", children: "暂无类定义(可先登记 schema 或物化)" })
|
|
1224
|
+
] }),
|
|
1225
|
+
/* @__PURE__ */ U("div", { ref: W, className: "graph-canvas", children: [
|
|
1226
|
+
S ? /* @__PURE__ */ O("div", { className: "canvas-overlay", children: /* @__PURE__ */ O(St, { tip: "图谱加载中", children: /* @__PURE__ */ O("div", { style: { width: 80, height: 80 } }) }) }) : null,
|
|
1227
|
+
!S && ke && !q ? /* @__PURE__ */ O("div", { className: "canvas-overlay", children: /* @__PURE__ */ O(Fe, { description: fe ? "本体内无物化图数据" : "该类型暂无实例" }) }) : null
|
|
1228
|
+
] })
|
|
1229
|
+
] }),
|
|
1230
|
+
/* @__PURE__ */ O(
|
|
1231
|
+
xt,
|
|
1232
|
+
{
|
|
1233
|
+
open: !!N,
|
|
1234
|
+
width: 380,
|
|
1235
|
+
title: N ? Re(N) : "",
|
|
1236
|
+
onClose: () => {
|
|
1237
|
+
H(null), T([]);
|
|
1238
|
+
},
|
|
1239
|
+
destroyOnHidden: !0,
|
|
1240
|
+
children: N ? /* @__PURE__ */ U(He, { children: [
|
|
1241
|
+
/* @__PURE__ */ U(ge, { column: 1, size: "small", bordered: !0, children: [
|
|
1242
|
+
/* @__PURE__ */ O(ge.Item, { label: "key", children: N.key }),
|
|
1243
|
+
/* @__PURE__ */ O(ge.Item, { label: "类型", children: xe(N) ? "类" : Ze(N) ? "实例" : (N.labels || []).join(" / ") || "节点" }),
|
|
1244
|
+
/* @__PURE__ */ O(ge.Item, { label: "标签", children: (N.labels || []).join(" / ") || "-" })
|
|
1245
|
+
] }),
|
|
1246
|
+
/* @__PURE__ */ O("div", { style: { marginTop: 16, fontWeight: 600, marginBottom: 8 }, children: "属性" }),
|
|
1247
|
+
Object.keys(N.properties || {}).length ? /* @__PURE__ */ O(ge, { column: 1, size: "small", children: Object.entries(N.properties).map(([m, d]) => /* @__PURE__ */ O(ge.Item, { label: m, children: String(d) }, m)) }) : /* @__PURE__ */ O("div", { style: { color: "#999", fontSize: 12 }, children: "(无属性)" }),
|
|
1248
|
+
/* @__PURE__ */ U("div", { style: { marginTop: 16, display: "flex", gap: 8 }, children: [
|
|
1249
|
+
/* @__PURE__ */ O(he, { icon: /* @__PURE__ */ O(Le, {}), loading: Z, onClick: () => de(N), children: "展开 1 跳邻居" }),
|
|
1250
|
+
xe(N) ? /* @__PURE__ */ O(he, { type: "primary", icon: /* @__PURE__ */ O(Me, {}), onClick: () => j(N.key), children: "查看实例" }) : null
|
|
1251
|
+
] })
|
|
1252
|
+
] }) : null
|
|
1253
|
+
}
|
|
1254
|
+
)
|
|
1255
|
+
] });
|
|
1256
|
+
}
|
|
1257
|
+
function Ce(o) {
|
|
1258
|
+
return String(o).replace(/[&<>"']/g, (n) => ({
|
|
1259
|
+
"&": "&",
|
|
1260
|
+
"<": "<",
|
|
1261
|
+
">": ">",
|
|
1262
|
+
'"': """,
|
|
1263
|
+
"'": "'"
|
|
1264
|
+
})[n]);
|
|
1265
|
+
}
|
|
1266
|
+
export {
|
|
1267
|
+
bn as default
|
|
1268
|
+
};
|