@reltio/graph 1.4.1585 → 1.4.1586-mui5

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.
Files changed (164) hide show
  1. package/index.ts +1 -0
  2. package/package.json +26 -9
  3. package/public/bundle.js +205 -0
  4. package/public/bundle.js.LICENSE.txt +88 -0
  5. package/public/package.json +29 -0
  6. package/scripts/build/index.js +20 -0
  7. package/src/__tests__/GraphView.test.tsx +25 -0
  8. package/src/components/CircleLayout/CircleLayout.tsx +76 -0
  9. package/src/components/CircleLayout/__tests__/CircleLayout.test.tsx +194 -0
  10. package/src/components/GotoButton/GotoButton.tsx +23 -0
  11. package/src/components/GotoButton/__tests__/GotoButton.test.tsx +33 -0
  12. package/src/components/GotoButton/styles.ts +15 -0
  13. package/src/components/GraphArea/GraphArea.tsx +113 -0
  14. package/src/components/GraphArea/__tests__/GraphArea.test.tsx +202 -0
  15. package/src/components/GraphArea/styles.ts +30 -0
  16. package/src/components/GraphLayoutSelector/GraphLayoutSelector.tsx +43 -0
  17. package/src/components/GraphLayoutSelector/__tests__/GraphLayoutSelector.spec.tsx +44 -0
  18. package/src/components/GraphLayoutSelector/styles.ts +15 -0
  19. package/src/components/GraphPerspectiveView/GraphPerspectiveView.tsx +58 -0
  20. package/src/components/GraphPerspectiveView/__tests__/GraphPerspectiveView.test.tsx +115 -0
  21. package/src/components/GraphPerspectiveView/__tests__/useGraphLoader.test.tsx +1519 -0
  22. package/src/components/GraphPerspectiveView/__tests__/useRelationshipTable.test.tsx +1003 -0
  23. package/src/components/GraphPerspectiveView/__tests__/useSelectedEntity.test.tsx +373 -0
  24. package/src/components/GraphPerspectiveView/styles.ts +34 -0
  25. package/src/components/GraphRightSidePanel/GraphRightSidePanel.tsx +27 -0
  26. package/src/components/GraphRightSidePanel/__tests__/GraphRightSidePanel.test.tsx +18 -0
  27. package/src/components/GraphRightSidePanel/icons/relationship-icon.svg +3 -0
  28. package/src/components/GraphRightSidePanel/styles.ts +8 -0
  29. package/src/components/GraphTypeSelector/GraphTypeSelector.tsx +56 -0
  30. package/src/components/GraphTypeSelector/__tests__/GraphTypeSelector.test.tsx +109 -0
  31. package/src/components/GraphTypeSelector/styles.ts +17 -0
  32. package/src/components/HierarchyLayout/HierarchyLayout.ts +102 -0
  33. package/src/components/HierarchyLayout/__tests__/HierarchyLayout.spec.tsx +241 -0
  34. package/src/components/HierarchyLayout/__tests__/buildHierarchy.spec.ts +130 -0
  35. package/src/components/HierarchyLayout/__tests__/calculations.spec.ts +230 -0
  36. package/src/components/HierarchyLayout/buildHierarchy.ts +109 -0
  37. package/src/components/HierarchyLayout/calculations.ts +86 -0
  38. package/src/components/RightPanelEntityDetails/RightPanelEntityDetails.tsx +33 -0
  39. package/src/components/RightPanelEntityDetails/__tests__/RightPanelEntityDetails.test.tsx +39 -0
  40. package/src/components/RightPanelEntityDetails/styles.ts +12 -0
  41. package/src/components/RightPanelProfileBand/RightPanelProfileBand.tsx +33 -0
  42. package/src/components/RightPanelProfileBand/__tests__/RightPanelProfileBand.test.tsx +67 -0
  43. package/src/components/RightPanelProfileBand/styles.ts +8 -0
  44. package/src/components/RightPanelRelationship/RightPanelRelationship.tsx +25 -0
  45. package/src/components/RightPanelRelationship/__tests__/RightPanelRelationship.test.tsx +18 -0
  46. package/src/components/RightPanelRelationship/components/CollapsibleTable/CollapsibleTable.tsx +100 -0
  47. package/src/components/RightPanelRelationship/components/CollapsibleTable/TableHead.tsx +38 -0
  48. package/src/components/RightPanelRelationship/components/CollapsibleTable/__tests__/CollapsibleTable.test.tsx +169 -0
  49. package/src/components/RightPanelRelationship/components/CollapsibleTable/__tests__/TableHead.test.tsx +107 -0
  50. package/src/components/RightPanelRelationship/components/CollapsibleTable/styles.ts +38 -0
  51. package/src/components/RightPanelRelationship/components/CollapsibleTable/types.ts +20 -0
  52. package/src/components/RightPanelRelationship/components/DeleteRelationDialog/DeleteRelationDialog.tsx +34 -0
  53. package/src/components/RightPanelRelationship/components/DeleteRelationDialog/__tests__/DeleteRelationDialog.test.tsx +46 -0
  54. package/src/components/RightPanelRelationship/components/GraphAddRelationDialog/GraphAddRelationButton.tsx +43 -0
  55. package/src/components/RightPanelRelationship/components/GraphAddRelationDialog/GraphAddRelationDialog.tsx +121 -0
  56. package/src/components/RightPanelRelationship/components/GraphAddRelationDialog/__tests__/GraphAddRelationButton.test.tsx +80 -0
  57. package/src/components/RightPanelRelationship/components/GraphAddRelationDialog/__tests__/GraphAddRelationDialog.test.tsx +262 -0
  58. package/src/components/RightPanelRelationship/components/GraphAddRelationDialog/__tests__/mockdata.ts +75 -0
  59. package/src/components/RightPanelRelationship/components/GraphAddRelationDialog/styles.ts +25 -0
  60. package/src/components/RightPanelRelationship/components/GraphAddRelationDialog/useCreatableInOutRelationTypes.ts +13 -0
  61. package/src/components/RightPanelRelationship/components/RelationshipTable/RelationshipTable.tsx +126 -0
  62. package/src/components/RightPanelRelationship/components/RelationshipTable/__tests__/RelationshipTable.test.tsx +176 -0
  63. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/ControlsCellRenderer.tsx +59 -0
  64. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/DefaultCellRenderer.tsx +29 -0
  65. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/ExpandedRowRenderer.tsx +94 -0
  66. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/HeadCellRenderer.tsx +34 -0
  67. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/ProfileCellRenderer.tsx +41 -0
  68. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/__tests__/ControlsCellRenderer.test.tsx +80 -0
  69. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/__tests__/DefaultCellRenderer.test.tsx +47 -0
  70. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/__tests__/ExpandedRowRenderer.test.tsx +166 -0
  71. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/__tests__/HeadCellRenderer.test.tsx +23 -0
  72. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/__tests__/ProfileCellRenderer.test.tsx +47 -0
  73. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/components/DeleteRelationButton.tsx +32 -0
  74. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/components/__tests__/DeleteRelationButton.test.tsx +28 -0
  75. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/styles.ts +113 -0
  76. package/src/components/RightPanelRelationship/components/RelationshipTable/styles.ts +36 -0
  77. package/src/components/RightPanelRelationship/components/RelationshipsFilters/RelationshipsFilters.tsx +41 -0
  78. package/src/components/RightPanelRelationship/components/RelationshipsFilters/RelationshipsFiltersDialog/RelationshipsFiltersDialog.tsx +91 -0
  79. package/src/components/RightPanelRelationship/components/RelationshipsFilters/RelationshipsFiltersDialog/__tests__/RelationshipsFilterDialog.test.tsx +192 -0
  80. package/src/components/RightPanelRelationship/components/RelationshipsFilters/RelationshipsFiltersDialog/styles.ts +34 -0
  81. package/src/components/RightPanelRelationship/components/RelationshipsFilters/RelationshipsSearchTextField/RelationshipsSearchTextField.tsx +31 -0
  82. package/src/components/RightPanelRelationship/components/RelationshipsFilters/RelationshipsSearchTextField/__tests__/RelationshipsSearchTextField.test.tsx +43 -0
  83. package/src/components/RightPanelRelationship/components/RelationshipsFilters/RelationshipsSearchTextField/styles.ts +17 -0
  84. package/src/components/RightPanelRelationship/components/RelationshipsFilters/__tests__/RelationshipsFilters.test.tsx +76 -0
  85. package/src/components/RightPanelRelationship/components/RelationshipsFilters/styles.ts +19 -0
  86. package/src/components/RightPanelRelationship/styles.ts +20 -0
  87. package/src/components/SigmaCustomRenderers/SigmaCustomRenderersContainer.tsx +16 -0
  88. package/src/components/SigmaGraphContainer/SigmaGraphContainer.tsx +55 -0
  89. package/src/components/SigmaGraphContainer/__tests__/SigmaGraphContainer.test.tsx +25 -0
  90. package/src/components/SigmaGraphResizer/SigmaGraphResizer.tsx +13 -0
  91. package/src/components/SigmaGraphResizer/__tests__/SigmaGraphResizer.test.tsx +28 -0
  92. package/src/components/TreeLayout/TreeLayout.tsx +33 -0
  93. package/src/components/TreeLayout/__tests__/TreeLayout.test.tsx +42 -0
  94. package/src/components/TreeLayout/styles.ts +10 -0
  95. package/src/components/ZoomSlider/ZoomSlider.tsx +90 -0
  96. package/src/components/ZoomSlider/__tests__/ZoomSlider.test.tsx +84 -0
  97. package/src/components/ZoomSlider/styles.ts +57 -0
  98. package/src/constants/index.ts +1 -0
  99. package/src/contexts/GraphStateContext.tsx +19 -0
  100. package/src/contexts/SigmaCustomRenderersContext.ts +20 -0
  101. package/src/helpers/relationsHelpers.ts +9 -0
  102. package/src/hooks/__tests__/useGraphLayout.test.tsx +825 -0
  103. package/src/hooks/__tests__/useGraphLayoutSelector.test.tsx +19 -0
  104. package/src/hooks/__tests__/useSelfRelationLoopsRenderer.test.ts +198 -0
  105. package/src/hooks/__tests__/useSigmaCustomRenderers.test.ts +273 -0
  106. package/src/hooks/__tests__/useTooltipRenderer.test.ts +289 -0
  107. package/src/hooks/useGraphLayout.ts +308 -0
  108. package/src/hooks/useGraphLayoutSelector.ts +19 -0
  109. package/src/hooks/useGraphLoader.ts +279 -0
  110. package/src/hooks/useGraphRightSidePanelElements.tsx +36 -0
  111. package/src/hooks/useGraphState.ts +40 -0
  112. package/src/hooks/useGraphType.ts +32 -0
  113. package/src/hooks/useRelationshipTable.ts +212 -0
  114. package/src/hooks/useRelationshipTableFilters.ts +43 -0
  115. package/src/hooks/useSelectedEntity.ts +89 -0
  116. package/src/hooks/useSelfRelationLoopsRenderer.ts +52 -0
  117. package/src/hooks/useSigmaCustomRenderers.ts +112 -0
  118. package/src/hooks/useTooltipRenderer.ts +80 -0
  119. package/src/index.tsx +37 -0
  120. package/src/rendering/canvas/__tests__/hover.spec.ts +31 -0
  121. package/src/rendering/canvas/__tests__/label.spec.ts +64 -0
  122. package/src/rendering/canvas/__tests__/nodeBackground.spec.ts +99 -0
  123. package/src/rendering/canvas/__tests__/selfRelationLoop.spec.ts +88 -0
  124. package/src/rendering/canvas/__tests__/tooltip.spec.ts +33 -0
  125. package/src/rendering/canvas/hover.ts +13 -0
  126. package/src/rendering/canvas/label.ts +33 -0
  127. package/src/rendering/canvas/nodeBackground.ts +61 -0
  128. package/src/rendering/canvas/selfRelationLoop.ts +108 -0
  129. package/src/rendering/canvas/tooltip.ts +38 -0
  130. package/src/rendering/icons/collapseIcon.inline.svg.ts +6 -0
  131. package/src/rendering/icons/expandIcon.inline.svg.ts +5 -0
  132. package/src/rendering/icons/no_photo.inline.svg.ts +13 -0
  133. package/src/rendering/webgl/edge.arrowHead.ts +87 -0
  134. package/src/rendering/webgl/edge.clamped.ts +246 -0
  135. package/src/rendering/webgl/edge.reversedArrowHead.ts +14 -0
  136. package/src/rendering/webgl/helpers/__tests__/imageHelper.spec.ts +36 -0
  137. package/src/rendering/webgl/helpers/imageHelper.ts +13 -0
  138. package/src/rendering/webgl/image.ts +115 -0
  139. package/src/rendering/webgl/node.border.ts +78 -0
  140. package/src/rendering/webgl/node.buttons.ts +241 -0
  141. package/src/rendering/webgl/node.image.ts +169 -0
  142. package/src/rendering/webgl/shaders/edge.clamped.vert.glsl.ts +55 -0
  143. package/src/rendering/webgl/shaders/node.border.frag.glsl.ts +30 -0
  144. package/src/rendering/webgl/shaders/node.border.vert.glsl.ts +37 -0
  145. package/src/rendering/webgl/shaders/node.buttons.frag.glsl.ts +32 -0
  146. package/src/rendering/webgl/shaders/node.buttons.vert.glsl.ts +49 -0
  147. package/src/rendering/webgl/shaders/node.image.frag.glsl.ts +46 -0
  148. package/src/rendering/webgl/shaders/node.image.vert.glsl.ts +42 -0
  149. package/src/types/graphDataTypes.ts +143 -0
  150. package/src/types/sigmaCustomRenderersTypes.ts +13 -0
  151. package/src/utils/__tests__/graph.spec.ts +152 -0
  152. package/src/utils/__tests__/graphLayout.spec.ts +125 -0
  153. package/src/utils/__tests__/hopsData.spec.ts +456 -0
  154. package/src/utils/__tests__/processResponceToGraph.spec.ts +165 -0
  155. package/src/utils/graph.ts +83 -0
  156. package/src/utils/graphLayout.ts +70 -0
  157. package/src/utils/hopsData.ts +198 -0
  158. package/src/utils/processResponseToGraph.ts +32 -0
  159. package/tsconfig.json +4 -0
  160. package/webpack.config.js +10 -0
  161. package/bundle.js +0 -2
  162. package/bundle.js.LICENSE.txt +0 -54
  163. /package/{5271a9e7b6651c852e93.png → public/5271a9e7b6651c852e93.png} +0 -0
  164. /package/{main.css → public/main.css} +0 -0
@@ -0,0 +1,90 @@
1
+ import React, {useEffect, useMemo, useState} from 'react';
2
+ import classnames from 'classnames';
3
+ import {clamp, omit} from 'ramda';
4
+ import {useCamera, useRegisterEvents, useSigma, useSetSettings} from '@react-sigma/core';
5
+ import AddIcon from '@mui/icons-material/Add';
6
+ import RemoveIcon from '@mui/icons-material/Remove';
7
+ import Slider from '@mui/material/Slider';
8
+ import IconButton from '@mui/material/IconButton';
9
+
10
+ import {useStyles} from './styles';
11
+
12
+ const percentsToRatio = (percent: number): number => Math.pow(100 / percent, 2);
13
+ const ratioToPercents = (ratio: number): number => 100 / Math.sqrt(ratio);
14
+
15
+ const SliderThumb = (props) => {
16
+ const styles = useStyles();
17
+ const thumbProps = omit(['className'], props);
18
+
19
+ return (
20
+ <div className={styles.thumb} {...thumbProps}>
21
+ <RemoveIcon className={classnames(styles.icon, styles.thumbIcon)} />
22
+ </div>
23
+ );
24
+ };
25
+
26
+ type Props = {
27
+ className?: string;
28
+ max: number;
29
+ min: number;
30
+ };
31
+
32
+ const ZoomSlider = ({className, max, min}: Props) => {
33
+ const styles = useStyles();
34
+
35
+ const setSettings = useSetSettings();
36
+ const registerEvents = useRegisterEvents();
37
+ const camera = useSigma().getCamera();
38
+ const {zoomIn, zoomOut} = useCamera({factor: 1.2});
39
+ const [value, setValue] = useState(clamp(min, max, ratioToPercents(camera.getState().ratio)));
40
+
41
+ const maxCameraRatio = useMemo(() => (min > 0 ? percentsToRatio(min) : null), [min]);
42
+ const minCameraRatio = useMemo(() => (max > 0 ? percentsToRatio(max) : null), [max]);
43
+
44
+ useEffect(() => {
45
+ setSettings({
46
+ maxCameraRatio,
47
+ minCameraRatio
48
+ });
49
+
50
+ return () => {
51
+ setSettings({
52
+ maxCameraRatio: null,
53
+ minCameraRatio: null
54
+ });
55
+ };
56
+ }, [setSettings, minCameraRatio, maxCameraRatio]);
57
+
58
+ useEffect(() => {
59
+ registerEvents({
60
+ updated: (event) => setValue(ratioToPercents(event.ratio))
61
+ });
62
+ }, [registerEvents]);
63
+
64
+ const handleChange = (event, newValue) =>
65
+ camera.setState({ratio: camera.getBoundedRatio(percentsToRatio(newValue))});
66
+
67
+ return (
68
+ <div className={classnames(styles.container, className)}>
69
+ <IconButton className={styles.minButton} onClick={() => zoomOut()} size="large">
70
+ <RemoveIcon className={styles.icon} />
71
+ </IconButton>
72
+ <Slider
73
+ components={{
74
+ Thumb: SliderThumb
75
+ }}
76
+ classes={{root: styles.sliderRoot, rail: styles.rail}}
77
+ track={false}
78
+ value={value}
79
+ min={min}
80
+ max={max}
81
+ onChange={handleChange}
82
+ />
83
+ <IconButton className={styles.maxButton} onClick={() => zoomIn()} size="large">
84
+ <AddIcon className={styles.icon} />
85
+ </IconButton>
86
+ </div>
87
+ );
88
+ };
89
+
90
+ export default ZoomSlider;
@@ -0,0 +1,84 @@
1
+ import React from 'react';
2
+ import {shallow, mount} from 'enzyme';
3
+ import {act} from 'react-dom/test-utils';
4
+ import {useCamera, useSetSettings, useRegisterEvents} from '@react-sigma/core';
5
+ import ZoomSlider from '../ZoomSlider';
6
+ import IconButton from '@mui/material/IconButton';
7
+ import AddIcon from '@mui/icons-material/Add';
8
+ import RemoveIcon from '@mui/icons-material/Remove';
9
+ import Slider from '@mui/material/Slider';
10
+
11
+ jest.mock('@react-sigma/core', () => ({
12
+ ...jest.requireActual<Record<string, unknown>>('@react-sigma/core'),
13
+ useCamera: jest.fn().mockReturnValue({
14
+ zoomOut: jest.fn(),
15
+ zoomIn: jest.fn()
16
+ }),
17
+ useSigma: jest.fn().mockReturnValue({
18
+ getCamera: () => ({
19
+ setState: () => {},
20
+ getState: () => ({ratio: 1}),
21
+ getBoundedRatio: jest.fn()
22
+ })
23
+ }),
24
+ useSetSettings: jest.fn().mockReturnValue(jest.fn()),
25
+ useRegisterEvents: jest.fn().mockReturnValue(jest.fn())
26
+ }));
27
+
28
+ describe('ZoomSlider tests', () => {
29
+ it('should render main parts', () => {
30
+ const component = shallow(<ZoomSlider className="testClass" min={30} max={300} />);
31
+
32
+ expect(component.find(IconButton)).toHaveLength(2);
33
+ expect(component.find(AddIcon)).toHaveLength(1);
34
+ expect(component.find(RemoveIcon)).toHaveLength(1);
35
+
36
+ const slider = component.find(Slider);
37
+ expect(slider).toHaveLength(1);
38
+ expect(slider.props()).toEqual({
39
+ ThumbComponent: expect.any(Function),
40
+ classes: {root: 'sliderRoot', rail: 'rail'},
41
+ track: false,
42
+ value: 100,
43
+ min: 30,
44
+ max: 300,
45
+ onChange: expect.any(Function)
46
+ });
47
+ });
48
+
49
+ it('should call registerEvents and setSettings', () => {
50
+ const setSettings = useSetSettings();
51
+ const registerEvents = useRegisterEvents();
52
+
53
+ mount(<ZoomSlider className="testClass" min={50} max={200} />);
54
+ expect(setSettings).toHaveBeenCalledWith({
55
+ maxCameraRatio: 4,
56
+ minCameraRatio: 0.25
57
+ });
58
+ expect(registerEvents).toHaveBeenCalledWith({
59
+ updated: expect.any(Function)
60
+ });
61
+ });
62
+
63
+ it('should call zoomOut on min button click', () => {
64
+ const component = shallow(<ZoomSlider className="testClass" min={30} max={300} />);
65
+ const {zoomOut} = useCamera();
66
+
67
+ act(() => {
68
+ component.find(IconButton).at(0).simulate('click');
69
+ });
70
+
71
+ expect(zoomOut).toHaveBeenCalled();
72
+ });
73
+
74
+ it('should call zoomIn on max button click', () => {
75
+ const component = shallow(<ZoomSlider className="testClass" min={30} max={300} />);
76
+ const {zoomIn} = useCamera();
77
+
78
+ act(() => {
79
+ component.find(IconButton).at(1).simulate('click');
80
+ });
81
+
82
+ expect(zoomIn).toHaveBeenCalled();
83
+ });
84
+ });
@@ -0,0 +1,57 @@
1
+ import {makeStyles} from '@mui/styles';
2
+
3
+ const boxShadow = '0 1px 1px rgba(0,0,0,0.14), 0 2px 1px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,0,0.2)';
4
+
5
+ const buttonStyle = {
6
+ background: '#FFFFFF',
7
+ boxShadow,
8
+ width: '28px',
9
+ height: '28px'
10
+ };
11
+
12
+ export const useStyles = makeStyles({
13
+ container: {
14
+ display: 'flex',
15
+ alignItems: 'center'
16
+ },
17
+ maxButton: {
18
+ ...buttonStyle,
19
+ borderRadius: '2px 4px 4px 2px'
20
+ },
21
+ minButton: {
22
+ ...buttonStyle,
23
+ borderRadius: '4px 2px 2px 4px'
24
+ },
25
+ thumb: {
26
+ position: 'absolute',
27
+ boxShadow,
28
+ borderRadius: '2px',
29
+ width: '8px',
30
+ height: '28px',
31
+ marginTop: '-13px',
32
+ marginLeft: '1px',
33
+ color: 'rgba(0,0,0,0.54)',
34
+ backgroundColor: '#FFFFFF',
35
+ boxSizing: 'border-box',
36
+ outline: 0,
37
+ display: 'flex',
38
+ alignItems: 'center',
39
+ justifyContent: 'center'
40
+ },
41
+ thumbIcon: {
42
+ transform: 'rotate(90deg)'
43
+ },
44
+ icon: {
45
+ width: '18px',
46
+ height: '18px'
47
+ },
48
+ rail: {
49
+ opacity: 1,
50
+ height: '4px',
51
+ paddingRight: '10px'
52
+ },
53
+ sliderRoot: {
54
+ color: '#EDEDED',
55
+ marginRight: '10px'
56
+ }
57
+ });
@@ -0,0 +1 @@
1
+ export const ROWS_PER_PAGE_OPTIONS = [25, 50, 100];
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+
3
+ import {GraphState} from '../types/graphDataTypes';
4
+
5
+ export const GraphStateContext = React.createContext<GraphState>({
6
+ graphLoading: false,
7
+ data: null,
8
+ graphologyGraph: null,
9
+ selectedEntityLoading: false,
10
+ selectedEntity: null,
11
+ onEntitySelect: () => {},
12
+ relationshipTable: {},
13
+ onCollapseEntity: () => {},
14
+ onExpandEntity: () => {},
15
+ layout: null,
16
+ setLayout: () => {}
17
+ });
18
+
19
+ GraphStateContext.displayName = 'GraphStateContext';
@@ -0,0 +1,20 @@
1
+ import {createContext, useContext} from 'react';
2
+ import {noop} from '@reltio/components';
3
+ import {Renderers, Canvases} from '../types/sigmaCustomRenderersTypes';
4
+
5
+ type Props = {
6
+ addRenderers: (renderers: Renderers) => void;
7
+ canvases: Canvases;
8
+ };
9
+
10
+ export const SigmaCustomRenderersContext = createContext<Props>({
11
+ addRenderers: noop,
12
+ canvases: {}
13
+ });
14
+
15
+ export const useSigmaCustomRenderers = () => {
16
+ const sigmaCustomRenderers = useContext(SigmaCustomRenderersContext);
17
+ return sigmaCustomRenderers;
18
+ };
19
+
20
+ SigmaCustomRenderersContext.displayName = 'SigmaCustomRenderersContext';
@@ -0,0 +1,9 @@
1
+ import {generateNewRelationUri, EditingConnection} from '@reltio/mdm-sdk';
2
+
3
+ export const createNewConnection = (): EditingConnection => ({
4
+ relation: {
5
+ uri: generateNewRelationUri(),
6
+ type: null,
7
+ attributes: {}
8
+ }
9
+ });