@cccsaurora/clue-ui 1.2.4 → 1.2.5-dev.298
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/ActionForm-D6gYuFRR.js +5970 -0
- package/AnnotationDetails-Zx4pjBiN.js +175 -0
- package/AnnotationPreview-Dmz7taAU.js +188 -0
- package/ClueEnrichContext-CJEJxrgs.js +541 -0
- package/FlexOne-BSYAhhtG.js +9 -0
- package/_MapCache-WmuDdwuH.js +222 -0
- package/_Uint8Array-B7JqpgFX.js +128 -0
- package/_baseAssignValue-CGTuELqU.js +25 -0
- package/_baseClone-CkNrTyhm.js +283 -0
- package/_baseExtremum-kob8QXyt.js +18 -0
- package/_baseFlatten-jIR_sN_-.js +92 -0
- package/_baseGet-Bx3A4Qfp.js +108 -0
- package/_baseIsEqual-C5OTWzTk.js +208 -0
- package/_baseIteratee-avi7MX2o.js +126 -0
- package/_baseSlice-GAv_YFTT.js +20 -0
- package/_baseSum-D0WC1dN0.js +13 -0
- package/_baseUniq-BI9GIHMF.js +115 -0
- package/_commonjsHelpers-DWwsNxpa.js +8 -0
- package/_createAggregator-QD8MzKwe.js +63 -0
- package/_getPrototype-CU0j_POw.js +5 -0
- package/_getTag-Ckxxfr88.js +126 -0
- package/_isIterateeCall-Ds3sw2SF.js +17 -0
- package/_setToArray-CaPKQhcz.js +33 -0
- package/cloneDeep-DJrLSw8W.js +8 -0
- package/components/AnnotationBody.js +49 -35
- package/components/AnnotationDetailPopover.js +36 -30
- package/components/AnnotationDetails.js +7 -7
- package/components/AnnotationEntry.js +35 -35
- package/components/AnnotationPreview.js +5 -5
- package/components/ClassificationChip.js +44 -23
- package/components/CountBadge.js +31 -26
- package/components/EnrichedCard.js +110 -97
- package/components/EnrichedChip.js +130 -105
- package/components/EnrichedTypography.js +133 -107
- package/components/ErrorBoundary.js +28 -24
- package/components/RetryFailedEnrichments.js +10 -9
- package/components/SourcePicker.js +57 -49
- package/components/actions/ActionForm.js +4 -4
- package/components/actions/ExecutePopover.js +75 -59
- package/components/actions/ResultModal.js +4 -4
- package/components/actions/form/schemaAdapter.js +39 -23
- package/components/actions/formats/FileResult.js +86 -59
- package/components/actions/formats/index.js +21 -10
- package/components/display/graph/ExpandMoreButton.js +10 -10
- package/components/display/graph/elements/NodeCard.js +111 -91
- package/components/display/graph/elements/NodeTag.js +15 -13
- package/components/display/graph/index.js +261 -202
- package/components/display/graph/visualizations/Leaf.js +88 -69
- package/components/display/graph/visualizations/cloud/index.js +98 -81
- package/components/display/graph/visualizations/icons/BaseIcon.js +26 -21
- package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
- package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
- package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
- package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
- package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
- package/components/display/graph/visualizations/icons/index.js +14 -13
- package/components/display/graph/visualizations/panels/NodePanel.js +10 -8
- package/components/display/graph/visualizations/tree/BundleLine.js +108 -81
- package/components/display/graph/visualizations/tree/Triangle.js +13 -13
- package/components/display/graph/visualizations/tree/index.js +408 -306
- package/components/display/icons/Iconified.js +27 -12
- package/components/display/json/index.js +4 -4
- package/components/display/markdown/index.js +8678 -5770
- package/components/enrichment/EnrichPopover.js +54 -46
- package/components/fetchers/Fetcher.js +158 -119
- package/components/fetchers/PreviewModal.js +20 -17
- package/components/fetchers/StatusChip.js +21 -17
- package/components/group/Entry.js +13 -11
- package/components/group/Group.js +13 -10
- package/components/group/GroupControl.js +76 -65
- package/components/stats/QueryStatus.js +43 -33
- package/countBy-c6S3dvSW.js +14 -0
- package/data/event.js +6 -4
- package/database/index.js +2 -2
- package/debounce-bV0h5FC5.js +92 -0
- package/get-DSsNkRQs.js +8 -0
- package/groupBy-xqz-n0Vd.js +14 -0
- package/hooks/ClueActionContext.d.ts +10 -2
- package/hooks/ClueActionContext.js +6 -6
- package/hooks/ClueComponentContext.js +29 -23
- package/hooks/ClueConfigProvider.js +14 -12
- package/hooks/ClueDatabaseContext.js +19 -13
- package/hooks/ClueEnrichContext.js +8 -8
- package/hooks/ClueFetcherContext.js +83 -56
- package/hooks/ClueGroupContext.js +17 -14
- package/hooks/CluePopupContext.js +5 -5
- package/hooks/ClueProvider.js +12 -10
- package/hooks/selectors.js +7 -7
- package/hooks/useActionResult.d.ts +1 -0
- package/hooks/useActionResult.js +3 -3
- package/hooks/useAnnotations.js +47 -31
- package/hooks/useClue.js +6 -4
- package/hooks/useClueActions.js +3 -3
- package/hooks/useClueConfig.js +6 -4
- package/hooks/useClueTypeConfig.js +3 -3
- package/hooks/useComparator.js +722 -435
- package/hooks/useErrors.js +22 -18
- package/hooks/useFetcherResult.d.ts +1 -0
- package/hooks/useFetcherResult.js +33 -24
- package/hooks/useMyHighlights.js +66 -36
- package/hooks/useMyLocalStorage.js +66 -37
- package/iconify-CXMreGTg.js +1782 -0
- package/icons/Action.js +66 -49
- package/icons/Assessment.js +85 -69
- package/icons/Context.js +77 -63
- package/icons/Opinion.js +76 -60
- package/icons/iconMap.js +2 -2
- package/identity-CPGTqrE4.js +6 -0
- package/index-AMfoEg_6.js +696 -0
- package/index-B6C2a_Lg.js +1172 -0
- package/index-C12gPw2W.js +17698 -0
- package/index-DCKkHTvx.js +15750 -0
- package/index-JcKyZeoY.js +465 -0
- package/isNil-CIubwp4T.js +6 -0
- package/isObject-FTY-5JQX.js +7 -0
- package/isObjectLike-OAgjjZye.js +48 -0
- package/isSymbol-Xd2FsJyp.js +8 -0
- package/last-CUCl67Im.js +7 -0
- package/main.js +60 -60
- package/maxBy-IKHzFrCS.js +8 -0
- package/package.json +1 -1
- package/sortBy-DfSj8IoJ.js +96 -0
- package/sumBy-D-hb_NY-.js +8 -0
- package/text/Frequency.js +42 -23
- package/toFinite-Bc55msYj.js +16 -0
- package/toNumber-DPxy1FBy.js +39 -0
- package/types/RunningActionData.d.ts +1 -0
- package/types/WithActionData.d.ts +1 -0
- package/useClueTypeConfig-Z1LFp01b.js +3289 -0
- package/utils/chain.js +92 -65
- package/utils/classificationParser.js +519 -256
- package/utils/constants.js +35 -10
- package/utils/graph.js +72 -45
- package/utils/hashUtil.js +7 -7
- package/utils/line.js +131 -81
- package/utils/loggerUtil.js +5 -3
- package/utils/sessionStorage.js +41 -27
- package/utils/time.js +423 -423
- package/utils/utils.js +9 -9
- package/utils/window.js +21 -10
- package/utils-HmNPuoDB.js +199 -0
- package/ActionForm-CwsfB99X.js +0 -4458
- package/AnnotationDetails-Bw2JdtTL.js +0 -160
- package/AnnotationPreview-BO7rVnOP.js +0 -140
- package/ClueEnrichContext-KqRuuWNS.js +0 -418
- package/FlexOne-BXWFOd1T.js +0 -6
- package/_MapCache-BiTi0iqu.js +0 -180
- package/_Uint8Array-BQNOM9Rr.js +0 -101
- package/_baseAssignValue-CNMLQZco.js +0 -20
- package/_baseClone-BnT-6pyM.js +0 -207
- package/_baseExtremum-Ca2EHgy2.js +0 -16
- package/_baseFlatten-Bfr_Molw.js +0 -72
- package/_baseGet-DSZygzyq.js +0 -79
- package/_baseIsEqual-VgvaAFZG.js +0 -147
- package/_baseIteratee-Dbfsw5z8.js +0 -95
- package/_baseSlice-M5RKzt1A.js +0 -10
- package/_baseSum-wEbgNeUs.js +0 -10
- package/_baseUniq-BJcj69PL.js +0 -79
- package/_commonjsHelpers-DaMA6jEr.js +0 -8
- package/_createAggregator-k3TuAnxT.js +0 -53
- package/_getPrototype-Cr1Mk7BC.js +0 -5
- package/_getTag-CK2Sffaq.js +0 -90
- package/_isIterateeCall-DkJP7Rbx.js +0 -13
- package/_setToArray-C7yMOeww.js +0 -29
- package/cloneDeep-CF8TtLHr.js +0 -8
- package/countBy-CdYegFSu.js +0 -8
- package/debounce-DryYcbJ4.js +0 -56
- package/get-CH7kz5Ix.js +0 -8
- package/groupBy-br8xmD2R.js +0 -8
- package/iconify-BBckr5AQ.js +0 -1263
- package/identity-ByMq8VxU.js +0 -6
- package/index-BHAe_V9n.js +0 -12768
- package/index-BK-zfYhR.js +0 -358
- package/index-CA5CUNZO.js +0 -975
- package/index-Dj5C04IX.js +0 -568
- package/index-p5_wX7q1.js +0 -11729
- package/isNil-CjWwlQS3.js +0 -6
- package/isObject-B53jY8Qg.js +0 -7
- package/isObjectLike-BatpeCIi.js +0 -29
- package/isSymbol-C3_SC0Qp.js +0 -8
- package/last-7CdUxN0r.js +0 -7
- package/maxBy-Bc0dYHcO.js +0 -8
- package/sortBy-DY2JBf9n.js +0 -75
- package/sumBy-DuMASLPd.js +0 -8
- package/toFinite-BMy6GObD.js +0 -14
- package/toNumber-YVhnnJv4.js +0 -31
- package/useClueTypeConfig-Ct9Ygter.js +0 -2292
- package/utils-DmwSUrum.js +0 -129
|
@@ -1,196 +1,255 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { useMemo
|
|
3
|
-
import { useTheme
|
|
4
|
-
import { p as
|
|
5
|
-
import { z as
|
|
6
|
-
import { ClueComponentContext
|
|
7
|
-
import
|
|
8
|
-
import { useMyLocalStorageItem
|
|
9
|
-
import { StorageKey
|
|
10
|
-
import { g as
|
|
11
|
-
import { u as
|
|
12
|
-
import { cssImportant
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
const
|
|
19
|
-
var
|
|
20
|
-
const { t
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useRef, useState, useEffect, useCallback, createElement } from "react";
|
|
3
|
+
import { useTheme, lighten, darken, Stack, Card, Typography, Autocomplete, TextField, FormControl, InputLabel, Select, MenuItem, alpha, IconButton, Collapse } from "@mui/material";
|
|
4
|
+
import { p as parseEvent } from "../../../index-JcKyZeoY.js";
|
|
5
|
+
import { z as zoom, i as identity, s as select, t as transform, p as pointer } from "../../../index-DCKkHTvx.js";
|
|
6
|
+
import { ClueComponentContext } from "../../../hooks/ClueComponentContext.js";
|
|
7
|
+
import useComparator from "../../../hooks/useComparator.js";
|
|
8
|
+
import { useMyLocalStorageItem } from "../../../hooks/useMyLocalStorage.js";
|
|
9
|
+
import { StorageKey } from "../../../utils/constants.js";
|
|
10
|
+
import { g as get } from "../../../get-DSsNkRQs.js";
|
|
11
|
+
import { u as useContextSelector } from "../../../index-AMfoEg_6.js";
|
|
12
|
+
import { cssImportant } from "../../../utils/graph.js";
|
|
13
|
+
import Iconified from "../icons/Iconified.js";
|
|
14
|
+
import ExpandMoreButton from "./ExpandMoreButton.js";
|
|
15
|
+
import Cloud from "./visualizations/cloud/index.js";
|
|
16
|
+
import NodePanel from "./visualizations/panels/NodePanel.js";
|
|
17
|
+
import Tree from "./visualizations/tree/index.js";
|
|
18
|
+
const Graph = ({ graph, sx = {} }) => {
|
|
19
|
+
var _a, _b, _c, _d, _e;
|
|
20
|
+
const { t } = useContextSelector(ClueComponentContext, (ctx) => ctx.i18next);
|
|
21
|
+
const theme = useTheme();
|
|
22
|
+
const isDark = useMemo(() => theme.palette.mode === "dark", [theme]);
|
|
23
|
+
const { runComparator } = useComparator();
|
|
24
|
+
const svgRef = useRef();
|
|
25
|
+
const pointRef = useRef();
|
|
26
|
+
const [showMousePos] = useMyLocalStorageItem(StorageKey.SHOW_MOUSE_POS, false);
|
|
27
|
+
const [showCoordinates] = useMyLocalStorageItem(StorageKey.SHOW_COORDINATES, false);
|
|
28
|
+
const [panelLocation] = useMyLocalStorageItem(StorageKey.PANEL_LOCATION, "vertical");
|
|
29
|
+
const [relativeMousePos, setRelativeMousePos] = useState(["0", "0"]);
|
|
30
|
+
const [absoluteMousePos, setAbsoluteMousePos] = useState(["0", "0"]);
|
|
31
|
+
const [showPanel, setShowPanel] = useState(false);
|
|
32
|
+
const nodeIds = useMemo(() => ((graph == null ? void 0 : graph.data) ?? []).flat(2).map((node) => node.id), [graph == null ? void 0 : graph.data]);
|
|
33
|
+
const zoom$1 = useMemo(() => zoom().scaleExtent([0.1, 6]), []);
|
|
34
|
+
const [currentZoom, setCurrentZoom] = useState(identity);
|
|
35
|
+
const [nodeId, setNodeId] = useState("");
|
|
36
|
+
const [selectedNodeIds, setSelectedNodeIds] = useState([]);
|
|
37
|
+
const [viz, setViz] = useState(
|
|
38
|
+
((_b = (_a = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a.visualization) == null ? void 0 : _b.type) ?? "tree"
|
|
39
|
+
);
|
|
40
|
+
const [hasError, setHasError] = useState(false);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
setShowPanel(selectedNodeIds.length > 0);
|
|
43
|
+
}, [selectedNodeIds]);
|
|
44
|
+
const labelKeys = useMemo(
|
|
27
45
|
() => {
|
|
28
|
-
var
|
|
29
|
-
return (
|
|
46
|
+
var _a2, _b2;
|
|
47
|
+
return (_b2 = (_a2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a2.displayField) == null ? void 0 : _b2.filter((entry) => (entry.zoom ?? Number.MAX_SAFE_INTEGER) > currentZoom.k);
|
|
30
48
|
},
|
|
31
|
-
[(
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
[(_c = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _c.displayField, currentZoom.k]
|
|
50
|
+
);
|
|
51
|
+
const onNodeChange = useCallback((node) => {
|
|
52
|
+
setNodeId(node);
|
|
53
|
+
}, []);
|
|
54
|
+
const checkForNode = useCallback((_nodeId) => {
|
|
55
|
+
const selector = _nodeId === "view" ? _nodeId : `node-${_nodeId ?? "will\\%never\\$ever\\*exist"}`;
|
|
56
|
+
return select(`#${selector}`);
|
|
57
|
+
}, []);
|
|
58
|
+
const selectNode = useCallback(() => {
|
|
59
|
+
if (!nodeId) {
|
|
60
|
+
setHasError(true);
|
|
40
61
|
return;
|
|
41
62
|
}
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
|
|
63
|
+
const nodeToGet = checkForNode(nodeId.replace(/[^A-Za-z0-9]*/g, ""));
|
|
64
|
+
if (nodeToGet.empty()) {
|
|
65
|
+
setHasError(true);
|
|
45
66
|
return;
|
|
46
67
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
68
|
+
setHasError(false);
|
|
69
|
+
setSelectedNodeIds([nodeId]);
|
|
70
|
+
const clientRect = svgRef.current.getBoundingClientRect();
|
|
71
|
+
const svg = select(svgRef.current);
|
|
72
|
+
const box = nodeToGet.node().getBBox();
|
|
73
|
+
svg.transition().duration(500).call(
|
|
74
|
+
zoom$1.transform,
|
|
75
|
+
identity.translate(clientRect.width / 2, clientRect.height / 2).scale(4).translate(-box.x, -box.y)
|
|
52
76
|
);
|
|
53
|
-
}, [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
77
|
+
}, [checkForNode, nodeId, zoom$1.transform]);
|
|
78
|
+
const onKeyPress = useCallback(
|
|
79
|
+
(event) => {
|
|
80
|
+
const parsedEvent = parseEvent(event);
|
|
81
|
+
if (parsedEvent.isCtrl && parsedEvent.isEnter) {
|
|
82
|
+
selectNode();
|
|
83
|
+
}
|
|
57
84
|
},
|
|
58
|
-
[
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
|
|
85
|
+
[selectNode]
|
|
86
|
+
);
|
|
87
|
+
const findNode = useCallback((id) => ((graph == null ? void 0 : graph.data) ?? []).flat().find((n) => n.id === id), [graph == null ? void 0 : graph.data]);
|
|
88
|
+
const resetZoom = useCallback(
|
|
89
|
+
(instant = false) => {
|
|
90
|
+
if (!graph) {
|
|
62
91
|
return;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
92
|
+
}
|
|
93
|
+
const box = select(svgRef.current).select("#view").node().getBBox();
|
|
94
|
+
const clientRect = svgRef.current.getBoundingClientRect();
|
|
95
|
+
const zoomLevel = Math.min(clientRect.width / (box.width + 25), (clientRect.height - 96) / box.height);
|
|
96
|
+
let selection = select(svgRef.current);
|
|
97
|
+
if (!instant) {
|
|
98
|
+
selection = selection.transition().duration(500);
|
|
99
|
+
}
|
|
100
|
+
selection.call(
|
|
101
|
+
zoom$1.transform,
|
|
102
|
+
identity.translate(clientRect.width / 2, (clientRect.height + 96) / 2).scale(zoomLevel).translate(-box.width / 2, -box.height / 2 - 10)
|
|
68
103
|
);
|
|
69
104
|
},
|
|
70
|
-
[
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
105
|
+
[zoom$1.transform, graph]
|
|
106
|
+
);
|
|
107
|
+
const onNodeSelectionChanged = useCallback((_nodeIds) => setSelectedNodeIds(_nodeIds), []);
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
if (!graph) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
pointRef.current = svgRef.current.createSVGPoint();
|
|
113
|
+
select(svgRef.current).call(
|
|
114
|
+
zoom$1.on("zoom", (event) => {
|
|
115
|
+
setCurrentZoom == null ? void 0 : setCurrentZoom(event.transform);
|
|
116
|
+
select(svgRef.current).select("#view").attr("transform", event.transform);
|
|
76
117
|
})
|
|
77
|
-
)
|
|
78
|
-
}, [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
118
|
+
);
|
|
119
|
+
}, [setCurrentZoom, zoom$1, viz, graph]);
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (showMousePos) {
|
|
122
|
+
select(svgRef.current).on("mousemove", (event) => {
|
|
123
|
+
const _zoom = transform(select(svgRef.current).select("#view").node());
|
|
124
|
+
setAbsoluteMousePos(_zoom.invert(pointer(event)).map((n) => n.toFixed(0)));
|
|
125
|
+
setRelativeMousePos(pointer(event).map((n) => n.toFixed(0)));
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}, [showMousePos, graph]);
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
resetZoom();
|
|
131
|
+
}, [viz, graph == null ? void 0 : graph.data]);
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
var _a2, _b2, _c2, _d2;
|
|
134
|
+
if ((_b2 = (_a2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a2.visualization) == null ? void 0 : _b2.type) {
|
|
135
|
+
setViz((_d2 = (_c2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _c2.visualization) == null ? void 0 : _d2.type);
|
|
136
|
+
}
|
|
137
|
+
}, [(_e = (_d = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _d.visualization) == null ? void 0 : _e.type]);
|
|
138
|
+
const treeOptions = useMemo(
|
|
90
139
|
() => ({
|
|
91
|
-
textColor:
|
|
92
|
-
backgroundColor:
|
|
140
|
+
textColor: theme.palette.text.primary,
|
|
141
|
+
backgroundColor: theme.palette.background.paper,
|
|
93
142
|
nodeColor: {
|
|
94
|
-
border: (
|
|
143
|
+
border: (isDark ? lighten : darken)(theme.palette.background.paper, 0.3),
|
|
95
144
|
center: "white"
|
|
96
145
|
}
|
|
97
146
|
}),
|
|
98
|
-
[
|
|
99
|
-
)
|
|
147
|
+
[isDark, theme.palette.background.paper, theme.palette.text.primary]
|
|
148
|
+
);
|
|
149
|
+
const cloudOptions = useMemo(
|
|
100
150
|
() => ({
|
|
101
|
-
textColor:
|
|
102
|
-
backgroundColor:
|
|
151
|
+
textColor: theme.palette.text.primary,
|
|
152
|
+
backgroundColor: theme.palette.background.paper,
|
|
103
153
|
nodeColor: {
|
|
104
|
-
border: (
|
|
154
|
+
border: (isDark ? lighten : darken)(theme.palette.background.paper, 0.3),
|
|
105
155
|
center: "white"
|
|
106
156
|
}
|
|
107
157
|
}),
|
|
108
|
-
[
|
|
109
|
-
)
|
|
158
|
+
[isDark, theme.palette.background.paper, theme.palette.text.primary]
|
|
159
|
+
);
|
|
160
|
+
const visualizations = useMemo(
|
|
110
161
|
() => ({
|
|
111
|
-
tree: () => /* @__PURE__ */
|
|
112
|
-
|
|
162
|
+
tree: () => /* @__PURE__ */ jsx(
|
|
163
|
+
Tree,
|
|
113
164
|
{
|
|
114
|
-
svgRef
|
|
115
|
-
graph
|
|
116
|
-
labelKeys
|
|
117
|
-
onNodeSelectionChanged
|
|
118
|
-
zoom:
|
|
119
|
-
options:
|
|
165
|
+
svgRef,
|
|
166
|
+
graph,
|
|
167
|
+
labelKeys,
|
|
168
|
+
onNodeSelectionChanged,
|
|
169
|
+
zoom: currentZoom,
|
|
170
|
+
options: treeOptions
|
|
120
171
|
}
|
|
121
172
|
),
|
|
122
|
-
cloud: () => /* @__PURE__ */
|
|
173
|
+
cloud: () => /* @__PURE__ */ jsx(Cloud, { svgRef, graph, options: cloudOptions })
|
|
123
174
|
}),
|
|
124
|
-
[
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
175
|
+
[cloudOptions, currentZoom, graph, labelKeys, onNodeSelectionChanged, treeOptions]
|
|
176
|
+
);
|
|
177
|
+
const suggestions = useMemo(() => {
|
|
178
|
+
return nodeIds.flatMap((id) => {
|
|
179
|
+
var _a2, _b2;
|
|
180
|
+
const node = (((_a2 = graph == null ? void 0 : graph.data) == null ? void 0 : _a2.flat()) ?? []).find((_node) => _node.id === id);
|
|
181
|
+
if (!node) {
|
|
182
|
+
return { id, value: id };
|
|
183
|
+
}
|
|
184
|
+
const key = ((_b2 = labelKeys == null ? void 0 : labelKeys.filter((comparator) => runComparator(comparator, node)).pop()) == null ? void 0 : _b2.label) ?? "id";
|
|
185
|
+
const value = key.split(",").map((_key) => {
|
|
186
|
+
var _a3;
|
|
187
|
+
return (_a3 = get(node, _key)) == null ? void 0 : _a3.toString();
|
|
188
|
+
}).filter((val) => !!val).map((_value) => ({ id, value: _value.trim() }));
|
|
189
|
+
return value;
|
|
190
|
+
});
|
|
191
|
+
}, [graph == null ? void 0 : graph.data, labelKeys, nodeIds, runComparator]);
|
|
192
|
+
return /* @__PURE__ */ jsxs(
|
|
193
|
+
Stack,
|
|
135
194
|
{
|
|
136
|
-
direction:
|
|
195
|
+
direction: panelLocation === "vertical" ? "row" : "column",
|
|
137
196
|
spacing: 1,
|
|
138
197
|
overflow: "hidden",
|
|
139
198
|
height: "100%",
|
|
140
199
|
width: "100%",
|
|
141
|
-
sx
|
|
200
|
+
sx,
|
|
142
201
|
children: [
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
-
|
|
202
|
+
/* @__PURE__ */ jsx(Stack, { direction: "column", spacing: 1, sx: { position: "relative", flex: 1 }, children: /* @__PURE__ */ jsxs(
|
|
203
|
+
Card,
|
|
145
204
|
{
|
|
146
205
|
variant: "outlined",
|
|
147
206
|
sx: {
|
|
148
207
|
flex: 1,
|
|
149
208
|
position: "relative",
|
|
150
|
-
maxHeight: `calc(100vh - 64px - ${
|
|
209
|
+
maxHeight: `calc(100vh - 64px - ${theme.spacing(1)})`,
|
|
151
210
|
"& #viz": {
|
|
152
|
-
maxHeight: `calc(100vh - 64px - ${
|
|
211
|
+
maxHeight: `calc(100vh - 64px - ${theme.spacing(1)})`,
|
|
153
212
|
width: "100%",
|
|
154
213
|
height: "100%",
|
|
155
|
-
backgroundColor:
|
|
214
|
+
backgroundColor: theme.palette.background.paper
|
|
156
215
|
},
|
|
157
216
|
"& .path": {
|
|
158
|
-
transition:
|
|
159
|
-
duration:
|
|
217
|
+
transition: theme.transitions.create(["opacity"], {
|
|
218
|
+
duration: theme.transitions.duration.short
|
|
160
219
|
})
|
|
161
220
|
},
|
|
162
221
|
"& .node": {
|
|
163
222
|
cursor: "pointer",
|
|
164
223
|
"& > path, & > text, & > polygon, & circle": {
|
|
165
|
-
transition:
|
|
166
|
-
duration:
|
|
224
|
+
transition: theme.transitions.create(["stroke", "fill", "fill-opacity", "stroke-opacity"], {
|
|
225
|
+
duration: theme.transitions.duration.short
|
|
167
226
|
})
|
|
168
227
|
},
|
|
169
228
|
"&.hover > .center": {
|
|
170
|
-
stroke:
|
|
229
|
+
stroke: cssImportant(theme.palette.primary.main)
|
|
171
230
|
},
|
|
172
231
|
"&.hover > .border": {
|
|
173
|
-
stroke:
|
|
232
|
+
stroke: cssImportant(theme.palette.primary.dark)
|
|
174
233
|
},
|
|
175
234
|
"&.selected > .center": {
|
|
176
|
-
stroke:
|
|
235
|
+
stroke: cssImportant(theme.palette.success.main)
|
|
177
236
|
},
|
|
178
237
|
"&.selected > .border": {
|
|
179
|
-
stroke:
|
|
238
|
+
stroke: cssImportant(theme.palette.success.dark)
|
|
180
239
|
},
|
|
181
240
|
"&.selected.hover > .center": {
|
|
182
|
-
stroke:
|
|
241
|
+
stroke: cssImportant(theme.palette.primary.main)
|
|
183
242
|
},
|
|
184
243
|
"&.selected.hover > .border": {
|
|
185
|
-
stroke:
|
|
244
|
+
stroke: cssImportant(theme.palette.primary.dark)
|
|
186
245
|
}
|
|
187
246
|
}
|
|
188
247
|
},
|
|
189
248
|
children: [
|
|
190
|
-
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
/* @__PURE__ */
|
|
193
|
-
|
|
249
|
+
graph ? visualizations[viz]() : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
250
|
+
/* @__PURE__ */ jsx("svg", { id: "viz", ref: svgRef, children: /* @__PURE__ */ jsx("g", { id: "view" }) }),
|
|
251
|
+
/* @__PURE__ */ jsx(
|
|
252
|
+
Typography,
|
|
194
253
|
{
|
|
195
254
|
variant: "h1",
|
|
196
255
|
color: "text.secondary",
|
|
@@ -201,23 +260,23 @@ const rt = ({ graph: t, sx: se = {} }) => {
|
|
|
201
260
|
opacity: 0.3,
|
|
202
261
|
transform: "translateX(-50%) translateY(-50%)"
|
|
203
262
|
},
|
|
204
|
-
children:
|
|
263
|
+
children: t("graph.no.dataset")
|
|
205
264
|
}
|
|
206
265
|
)
|
|
207
266
|
] }),
|
|
208
|
-
/* @__PURE__ */
|
|
209
|
-
|
|
267
|
+
/* @__PURE__ */ jsx(
|
|
268
|
+
Stack,
|
|
210
269
|
{
|
|
211
270
|
direction: "column",
|
|
212
271
|
spacing: 1,
|
|
213
272
|
sx: {
|
|
214
273
|
position: "absolute",
|
|
215
|
-
top:
|
|
216
|
-
left:
|
|
217
|
-
right:
|
|
274
|
+
top: theme.spacing(1),
|
|
275
|
+
left: theme.spacing(1),
|
|
276
|
+
right: theme.spacing(1)
|
|
218
277
|
},
|
|
219
|
-
children: /* @__PURE__ */
|
|
220
|
-
|
|
278
|
+
children: /* @__PURE__ */ jsxs(
|
|
279
|
+
Stack,
|
|
221
280
|
{
|
|
222
281
|
direction: "row",
|
|
223
282
|
spacing: 1,
|
|
@@ -225,55 +284,55 @@ const rt = ({ graph: t, sx: se = {} }) => {
|
|
|
225
284
|
"& > div:first-of-type": {
|
|
226
285
|
flex: 1,
|
|
227
286
|
maxWidth: "775px",
|
|
228
|
-
backgroundColor:
|
|
287
|
+
backgroundColor: alpha(theme.palette.background.paper, 0.8)
|
|
229
288
|
}
|
|
230
289
|
},
|
|
231
290
|
children: [
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
|
|
291
|
+
/* @__PURE__ */ jsx(
|
|
292
|
+
Autocomplete,
|
|
234
293
|
{
|
|
235
|
-
disablePortal:
|
|
236
|
-
onChange: (
|
|
237
|
-
onKeyDown:
|
|
238
|
-
options:
|
|
294
|
+
disablePortal: true,
|
|
295
|
+
onChange: (__, value) => onNodeChange(value.id),
|
|
296
|
+
onKeyDown: onKeyPress,
|
|
297
|
+
options: suggestions,
|
|
239
298
|
sx: { width: "400px" },
|
|
240
|
-
getOptionLabel: (
|
|
241
|
-
filterOptions: (
|
|
242
|
-
renderOption: (
|
|
243
|
-
renderInput: (
|
|
299
|
+
getOptionLabel: (option) => option.value,
|
|
300
|
+
filterOptions: (options, state) => options.filter((opt) => opt.value.toLowerCase().includes(state.inputValue)),
|
|
301
|
+
renderOption: (props, option) => /* @__PURE__ */ createElement("li", { ...props, key: option.id + option.value }, option.value),
|
|
302
|
+
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: hasError, label: t("graph.node.input.label") })
|
|
244
303
|
}
|
|
245
304
|
),
|
|
246
|
-
/* @__PURE__ */
|
|
247
|
-
/* @__PURE__ */
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
-
|
|
305
|
+
/* @__PURE__ */ jsxs(FormControl, { sx: { minWidth: "150px", backgroundColor: alpha(theme.palette.background.paper, 0.8) }, children: [
|
|
306
|
+
/* @__PURE__ */ jsx(InputLabel, { id: "viz-label", children: t("graph.visualization") }),
|
|
307
|
+
/* @__PURE__ */ jsx(
|
|
308
|
+
Select,
|
|
250
309
|
{
|
|
251
|
-
label:
|
|
310
|
+
label: t("graph.visualization"),
|
|
252
311
|
labelId: "viz-label",
|
|
253
|
-
value:
|
|
254
|
-
onChange: (
|
|
312
|
+
value: viz,
|
|
313
|
+
onChange: (event) => setViz(event.target.value),
|
|
255
314
|
sx: { textTransform: "capitalize" },
|
|
256
|
-
children: Object.keys(
|
|
315
|
+
children: Object.keys(visualizations).map((_viz) => /* @__PURE__ */ jsx(MenuItem, { value: _viz, sx: { textTransform: "capitalize" }, children: _viz }, _viz))
|
|
257
316
|
}
|
|
258
317
|
)
|
|
259
318
|
] }),
|
|
260
|
-
/* @__PURE__ */
|
|
261
|
-
|
|
319
|
+
/* @__PURE__ */ jsx(
|
|
320
|
+
ExpandMoreButton,
|
|
262
321
|
{
|
|
263
|
-
disabled:
|
|
264
|
-
expand:
|
|
265
|
-
onClick: () =>
|
|
266
|
-
"aria-expanded":
|
|
267
|
-
"aria-label":
|
|
322
|
+
disabled: selectedNodeIds.length < 1,
|
|
323
|
+
expand: showPanel,
|
|
324
|
+
onClick: () => setShowPanel(!showPanel),
|
|
325
|
+
"aria-expanded": showPanel,
|
|
326
|
+
"aria-label": t("graph.show.more"),
|
|
268
327
|
size: "small",
|
|
269
328
|
sx: {
|
|
270
329
|
marginLeft: "auto !important",
|
|
271
330
|
alignSelf: "center"
|
|
272
331
|
},
|
|
273
|
-
children: /* @__PURE__ */
|
|
274
|
-
|
|
332
|
+
children: /* @__PURE__ */ jsx(
|
|
333
|
+
Iconified,
|
|
275
334
|
{
|
|
276
|
-
icon:
|
|
335
|
+
icon: panelLocation === "vertical" ? "ic:baseline-chevron-left" : "ic:baseline-expand-more",
|
|
277
336
|
fontSize: "medium"
|
|
278
337
|
}
|
|
279
338
|
)
|
|
@@ -284,64 +343,64 @@ const rt = ({ graph: t, sx: se = {} }) => {
|
|
|
284
343
|
)
|
|
285
344
|
}
|
|
286
345
|
),
|
|
287
|
-
/* @__PURE__ */
|
|
288
|
-
|
|
346
|
+
/* @__PURE__ */ jsx(
|
|
347
|
+
Card,
|
|
289
348
|
{
|
|
290
|
-
variant:
|
|
291
|
-
elevation:
|
|
349
|
+
variant: showCoordinates ? "elevation" : "outlined",
|
|
350
|
+
elevation: showCoordinates ? 4 : 0,
|
|
292
351
|
sx: {
|
|
293
352
|
position: "absolute",
|
|
294
|
-
bottom:
|
|
295
|
-
right:
|
|
353
|
+
bottom: theme.spacing(0.5),
|
|
354
|
+
right: theme.spacing(0.5),
|
|
296
355
|
px: 1,
|
|
297
356
|
py: 0.5,
|
|
298
357
|
border: "none !important"
|
|
299
358
|
},
|
|
300
|
-
children: /* @__PURE__ */
|
|
301
|
-
|
|
302
|
-
|
|
359
|
+
children: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 0.5, alignItems: "center", children: [
|
|
360
|
+
showCoordinates && /* @__PURE__ */ jsxs("span", { children: [
|
|
361
|
+
currentZoom.x.toFixed(0),
|
|
303
362
|
", ",
|
|
304
|
-
|
|
363
|
+
currentZoom.y.toFixed(0),
|
|
305
364
|
" (",
|
|
306
|
-
|
|
365
|
+
currentZoom.k.toFixed(2),
|
|
307
366
|
"x",
|
|
308
367
|
")"
|
|
309
368
|
] }),
|
|
310
|
-
/* @__PURE__ */
|
|
311
|
-
|
|
369
|
+
/* @__PURE__ */ jsx(
|
|
370
|
+
IconButton,
|
|
312
371
|
{
|
|
313
|
-
size:
|
|
314
|
-
onClick: () =>
|
|
315
|
-
disabled:
|
|
316
|
-
children: /* @__PURE__ */
|
|
372
|
+
size: showCoordinates ? "small" : "medium",
|
|
373
|
+
onClick: () => resetZoom(),
|
|
374
|
+
disabled: currentZoom.k === identity.k && currentZoom.x === 0 && currentZoom.y === 0,
|
|
375
|
+
children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-refresh", fontSize: showCoordinates ? "small" : "medium" })
|
|
317
376
|
}
|
|
318
377
|
)
|
|
319
378
|
] })
|
|
320
379
|
}
|
|
321
380
|
),
|
|
322
|
-
|
|
323
|
-
|
|
381
|
+
showMousePos && /* @__PURE__ */ jsx(
|
|
382
|
+
Card,
|
|
324
383
|
{
|
|
325
384
|
variant: "elevation",
|
|
326
385
|
elevation: 4,
|
|
327
386
|
sx: {
|
|
328
387
|
position: "absolute",
|
|
329
|
-
bottom:
|
|
330
|
-
left:
|
|
388
|
+
bottom: theme.spacing(0.5),
|
|
389
|
+
left: theme.spacing(0.5),
|
|
331
390
|
px: 1,
|
|
332
391
|
py: 0.5
|
|
333
392
|
},
|
|
334
|
-
children: /* @__PURE__ */
|
|
335
|
-
/* @__PURE__ */
|
|
393
|
+
children: /* @__PURE__ */ jsx("code", { children: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, children: [
|
|
394
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
336
395
|
"(",
|
|
337
396
|
"abs: ",
|
|
338
|
-
|
|
397
|
+
absoluteMousePos.join(", "),
|
|
339
398
|
")"
|
|
340
399
|
] }),
|
|
341
|
-
/* @__PURE__ */
|
|
400
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
342
401
|
"(",
|
|
343
402
|
"rel: ",
|
|
344
|
-
|
|
403
|
+
relativeMousePos.join(", "),
|
|
345
404
|
")"
|
|
346
405
|
] })
|
|
347
406
|
] }) })
|
|
@@ -350,21 +409,21 @@ const rt = ({ graph: t, sx: se = {} }) => {
|
|
|
350
409
|
]
|
|
351
410
|
}
|
|
352
411
|
) }),
|
|
353
|
-
/* @__PURE__ */
|
|
354
|
-
|
|
412
|
+
/* @__PURE__ */ jsx(
|
|
413
|
+
Collapse,
|
|
355
414
|
{
|
|
356
|
-
in:
|
|
357
|
-
orientation:
|
|
358
|
-
appear:
|
|
359
|
-
unmountOnExit:
|
|
360
|
-
children: /* @__PURE__ */
|
|
361
|
-
|
|
415
|
+
in: showPanel && selectedNodeIds.length > 0,
|
|
416
|
+
orientation: panelLocation === "vertical" ? "horizontal" : "vertical",
|
|
417
|
+
appear: true,
|
|
418
|
+
unmountOnExit: true,
|
|
419
|
+
children: /* @__PURE__ */ jsx(
|
|
420
|
+
Stack,
|
|
362
421
|
{
|
|
363
422
|
direction: "column",
|
|
364
423
|
spacing: 1,
|
|
365
|
-
sx:
|
|
424
|
+
sx: panelLocation === "vertical" ? { width: "450px", height: "100%" } : { width: "100%", height: "300px" },
|
|
366
425
|
pb: 1,
|
|
367
|
-
children: /* @__PURE__ */
|
|
426
|
+
children: /* @__PURE__ */ jsx(NodePanel, { selectedNodeIds, findNode })
|
|
368
427
|
}
|
|
369
428
|
)
|
|
370
429
|
}
|
|
@@ -374,5 +433,5 @@ const rt = ({ graph: t, sx: se = {} }) => {
|
|
|
374
433
|
);
|
|
375
434
|
};
|
|
376
435
|
export {
|
|
377
|
-
|
|
436
|
+
Graph as default
|
|
378
437
|
};
|