@truedat/core 7.5.10 → 7.5.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/core",
3
- "version": "7.5.10",
3
+ "version": "7.5.12",
4
4
  "description": "Truedat Web Core",
5
5
  "sideEffects": false,
6
6
  "module": "src/index.js",
@@ -46,43 +46,45 @@
46
46
  "devDependencies": {
47
47
  "@testing-library/dom": "^10.4.0",
48
48
  "@testing-library/jest-dom": "^6.6.3",
49
- "@testing-library/react": "^16.2.0",
49
+ "@testing-library/react": "^16.3.0",
50
50
  "@testing-library/user-event": "^14.6.1",
51
- "@truedat/test": "7.5.10",
51
+ "@truedat/test": "7.5.12",
52
52
  "identity-obj-proxy": "^3.0.0",
53
53
  "jest": "^29.7.0",
54
54
  "redux-saga-test-plan": "^4.0.6"
55
55
  },
56
56
  "dependencies": {
57
- "@apollo/client": "^3.13.5",
58
- "axios": "^1.8.4",
59
- "graphql": "^16.10.0",
60
- "immutable": "^4.1.0",
57
+ "@apollo/client": "^3.13.8",
58
+ "@xyflow/react": "^12.6.4",
59
+ "axios": "^1.9.0",
60
+ "elkjs": "^0.10.0",
61
+ "graphql": "^16.11.0",
62
+ "immutable": "^4.3.7",
61
63
  "is-hotkey": "^0.2.0",
62
64
  "is-url": "^1.2.4",
63
65
  "lodash": "^4.17.21",
64
66
  "moment": "^2.30.1",
65
67
  "path-to-regexp": "^8.2.0",
66
68
  "prop-types": "^15.8.1",
67
- "query-string": "^7.1.2",
68
- "react": "^19.0.0",
69
+ "query-string": "^7.1.3",
70
+ "react": "^19.1.0",
69
71
  "react-csv": "^2.2.2",
70
- "react-dom": "^19.0.0",
72
+ "react-dom": "^19.1.0",
71
73
  "react-dropzone": "^14.3.8",
72
- "react-hook-form": "^7.54.2",
73
- "react-intl": "^7.1.10",
74
+ "react-hook-form": "^7.56.4",
75
+ "react-intl": "^7.1.11",
74
76
  "react-moment": "^1.1.3",
75
77
  "react-redux": "^9.2.0",
76
- "react-router": "^7.4.0",
78
+ "react-router": "^7.6.0",
77
79
  "redux": "^5.0.1",
78
80
  "redux-saga": "^1.3.0",
79
81
  "redux-saga-routines": "^3.2.3",
80
82
  "reselect": "^5.1.1",
81
83
  "semantic-ui-calendar-react": "^0.15.3",
82
84
  "semantic-ui-react": "^3.0.0-beta.2",
83
- "slate": "^0.47.3",
84
- "slate-react": "^0.22.3",
85
+ "slate": "^0.47.9",
86
+ "slate-react": "^0.22.10",
85
87
  "swr": "^2.3.3"
86
88
  },
87
- "gitHead": "8a8c49e9d5d6bb4e5f2b503b063bfd6dd20a503d"
89
+ "gitHead": "1476061ceb9ed15e0bacec71e20d695a0cd57986"
88
90
  }
@@ -0,0 +1,101 @@
1
+ import _ from "lodash/fp";
2
+ import { useCallback, useEffect } from "react";
3
+ import PropTypes from "prop-types";
4
+ import {
5
+ ReactFlow,
6
+ ReactFlowProvider,
7
+ useNodesState,
8
+ useEdgesState,
9
+ useReactFlow,
10
+ Position,
11
+ MarkerType,
12
+ } from "@xyflow/react";
13
+ import ELK from "elkjs/lib/elk.bundled.js";
14
+ import "@xyflow/react/dist/style.css";
15
+
16
+ const elk = new ELK();
17
+
18
+ const LayoutFlow = ({ initialNodes, initialEdges, onNodeClick }) => {
19
+ const { getNodes, setNodes, getEdges, fitView } = useReactFlow();
20
+ const parsedNodes = initialNodes.map((node) => ({
21
+ ...node,
22
+ position: { x: 0, y: 0 },
23
+ sourcePosition: Position.Right,
24
+ targetPosition: Position.Left,
25
+ }));
26
+ const parsedEdges = initialEdges.map((edge) => ({
27
+ ...edge,
28
+ markerEnd: {
29
+ type: MarkerType.ArrowClosed,
30
+ width: 15,
31
+ height: 15,
32
+ },
33
+ style: {
34
+ strokeWidth: 2,
35
+ },
36
+ }));
37
+ const [nodes, , onNodesChange] = useNodesState(parsedNodes);
38
+ const [edges, , onEdgesChange] = useEdgesState(parsedEdges);
39
+
40
+ const getLayoutedElements = useCallback(() => {
41
+ const layoutOptions = {
42
+ "elk.algorithm": "layered",
43
+ "elk.direction": "RIGHT",
44
+ "elk.algorithm": "layered",
45
+ "elk.layered.spacing.nodeNodeBetweenLayers": 100,
46
+ "elk.spacing.nodeNode": 80,
47
+ };
48
+ const graph = {
49
+ id: "root",
50
+ layoutOptions: layoutOptions,
51
+ children: getNodes().map((node) => ({
52
+ ...node,
53
+ width: node.measured.width,
54
+ height: node.measured.height,
55
+ })),
56
+ edges: getEdges(),
57
+ };
58
+
59
+ elk.layout(graph).then(({ children }) => {
60
+ children.forEach((node) => {
61
+ node.position = { x: node.x, y: node.y };
62
+ });
63
+
64
+ setNodes(children);
65
+ fitView();
66
+ });
67
+ }, []);
68
+
69
+ return (
70
+ <ReactFlow
71
+ nodes={nodes}
72
+ edges={edges}
73
+ onNodesChange={onNodesChange}
74
+ onEdgesChange={onEdgesChange}
75
+ onInit={getLayoutedElements}
76
+ fitView
77
+ onNodeClick={onNodeClick}
78
+ nodesConnectable={false}
79
+ ></ReactFlow>
80
+ );
81
+ };
82
+
83
+ export const Graph = ({ nodes, edges, onNodeClick }) => (
84
+ <div style={{ height: "640px" }}>
85
+ <ReactFlowProvider>
86
+ <LayoutFlow
87
+ initialNodes={nodes}
88
+ initialEdges={edges}
89
+ onNodeClick={onNodeClick}
90
+ />
91
+ </ReactFlowProvider>
92
+ </div>
93
+ );
94
+
95
+ Graph.propTypes = {
96
+ nodes: PropTypes.array,
97
+ edges: PropTypes.array,
98
+ onNodeClick: PropTypes.function,
99
+ };
100
+
101
+ export default Graph;
@@ -3,7 +3,6 @@ import AdminMenu from "./AdminMenu";
3
3
  import Alert from "./Alert";
4
4
  import Authorized from "./Authorized";
5
5
  import AvailableFilters from "./AvailableFilters";
6
- import HierarchyNodeFinder from "./HierarchyNodeFinder";
7
6
  import CardGroupsAccordion from "./CardGroupsAccordion";
8
7
  import CatalogMenu from "./CatalogMenu";
9
8
  import Comments from "./Comments";
@@ -24,7 +23,9 @@ import FieldLabel from "./FieldLabel";
24
23
  import FiltersLoader from "./FiltersLoader";
25
24
  import GlossaryMenu from "./GlossaryMenu";
26
25
  import GrantMenu from "./GrantMenu";
26
+ import Graph from "./Graph";
27
27
  import GroupActions from "./GroupActions";
28
+ import HierarchyNodeFinder from "./HierarchyNodeFinder";
28
29
  import HierarchySelector from "./HierarchySelector";
29
30
  import HistoryBackButton from "./HistoryBackButton";
30
31
  import IngestMenu from "./IngestMenu";
@@ -61,7 +62,6 @@ export {
61
62
  Alert,
62
63
  Authorized,
63
64
  AvailableFilters,
64
- HierarchyNodeFinder,
65
65
  CardGroupsAccordion,
66
66
  CatalogMenu,
67
67
  Comments,
@@ -82,7 +82,9 @@ export {
82
82
  FiltersLoader,
83
83
  GlossaryMenu,
84
84
  GrantMenu,
85
+ Graph,
85
86
  GroupActions,
87
+ HierarchyNodeFinder,
86
88
  HierarchySelector,
87
89
  HistoryBackButton,
88
90
  IngestMenu,