@neo4j-nvl/react 1.2.0-bf56a927 → 1.2.0-c4f11168

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.
@@ -27,8 +27,8 @@ describe('BasicNvlWrapper', () => {
27
27
  });
28
28
  test('initialises NVL expectedly with a graph object and properties', () => {
29
29
  const mockLayoutDoneFunction = jest.fn();
30
- render(_jsx("div", { children: _jsx(BasicNvlWrapper, { nodes: [{ id: '1' }, { id: '2' }], rels: [{ id: '12', from: '1', to: '2' }], layout: HierarchicalLayoutType, layoutOptions: { enableCytoscape: true }, nvlOptions: { renderer: 'canvas' }, nvlCallbacks: { onLayoutDone: mockLayoutDoneFunction } }) }));
31
- expect(NVL).toHaveBeenCalledWith(expect.any(HTMLDivElement), [{ id: '1' }, { id: '2' }], [{ id: '12', from: '1', to: '2' }], { renderer: 'canvas', layout: HierarchicalLayoutType, layoutOptions: { enableCytoscape: true } }, {
30
+ render(_jsx("div", { children: _jsx(BasicNvlWrapper, { nodes: [{ id: '1' }, { id: '2' }], rels: [{ id: '12', from: '1', to: '2' }], layout: HierarchicalLayoutType, layoutOptions: { direction: 'down' }, nvlOptions: { renderer: 'canvas' }, nvlCallbacks: { onLayoutDone: mockLayoutDoneFunction } }) }));
31
+ expect(NVL).toHaveBeenCalledWith(expect.any(HTMLDivElement), [{ id: '1' }, { id: '2' }], [{ id: '12', from: '1', to: '2' }], { renderer: 'canvas', layout: HierarchicalLayoutType, layoutOptions: { direction: 'down' } }, {
32
32
  onLayoutDone: mockLayoutDoneFunction
33
33
  });
34
34
  });
@@ -85,11 +85,11 @@ describe('InteractiveNvlWrapper', () => {
85
85
  });
86
86
  test('initialises NVL expectedly with a graph object and properties', () => {
87
87
  const mockLayoutDoneFunction = jest.fn();
88
- render(_jsx(InteractiveNvlWrapper, { nodes: [{ id: '1' }, { id: '2' }], rels: [{ id: '12', from: '1', to: '2' }], layout: HierarchicalLayoutType, layoutOptions: { enableCytoscape: true }, nvlOptions: { renderer: 'canvas' }, nvlCallbacks: { onLayoutDone: mockLayoutDoneFunction } }));
88
+ render(_jsx(InteractiveNvlWrapper, { nodes: [{ id: '1' }, { id: '2' }], rels: [{ id: '12', from: '1', to: '2' }], layout: HierarchicalLayoutType, layoutOptions: { direction: 'down' }, nvlOptions: { renderer: 'canvas' }, nvlCallbacks: { onLayoutDone: mockLayoutDoneFunction } }));
89
89
  act(() => {
90
90
  mockOnInitialization?.();
91
91
  });
92
- expect(NVL).toHaveBeenCalledWith(expect.any(HTMLDivElement), [{ id: '1' }, { id: '2' }], [{ id: '12', from: '1', to: '2' }], { renderer: 'canvas', layout: HierarchicalLayoutType, layoutOptions: { enableCytoscape: true } }, {
92
+ expect(NVL).toHaveBeenCalledWith(expect.any(HTMLDivElement), [{ id: '1' }, { id: '2' }], [{ id: '12', from: '1', to: '2' }], { renderer: 'canvas', layout: HierarchicalLayoutType, layoutOptions: { direction: 'down' } }, {
93
93
  onLayoutDone: mockLayoutDoneFunction,
94
94
  onInitialization: mockOnInitialization
95
95
  });
@@ -24,8 +24,8 @@ export const StaticPictureWrapper = ({ nodes, rels, nvlOptions = {}, width = 500
24
24
  const [imgSrc, setImgSrc] = useState();
25
25
  useEffect(() => {
26
26
  const div = document.createElement('div');
27
- div.style.width = `${width / window.devicePixelRatio}px`;
28
- div.style.height = `${height / window.devicePixelRatio}px`;
27
+ div.style.width = `${width}px`;
28
+ div.style.height = `${height}px`;
29
29
  const myNvl = new NVL(div, nodes, rels, nvlOptions, {
30
30
  onLayoutDone: () => {
31
31
  myNvl.fit(myNvl.getNodes().map((n) => n.id));
@@ -53,5 +53,5 @@ export const StaticPictureWrapper = ({ nodes, rels, nvlOptions = {}, width = 500
53
53
  };
54
54
  // eslint-disable-next-line react-hooks/exhaustive-deps
55
55
  }, [nodes, rels, width, height, format]);
56
- return imgSrc !== undefined ? _jsx("img", { src: imgSrc, width: width, height: height, alt: "Graph" }) : null;
56
+ return imgSrc !== undefined ? (_jsx("img", { src: imgSrc, width: width, height: height, style: { display: 'block', width, height, objectFit: 'contain' }, alt: "Graph" })) : null;
57
57
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-nvl/react",
3
- "version": "1.2.0-bf56a927",
3
+ "version": "1.2.0-c4f11168",
4
4
  "main": "lib/index.js",
5
5
  "homepage": "https://neo4j.com/docs/nvl/current/",
6
6
  "license": "SEE LICENSE IN 'LICENSE.txt'",
@@ -36,8 +36,8 @@
36
36
  "react-dom": "19.2.1"
37
37
  },
38
38
  "dependencies": {
39
- "@neo4j-nvl/base": "1.2.0-bf56a927",
40
- "@neo4j-nvl/interaction-handlers": "1.2.0-bf56a927",
39
+ "@neo4j-nvl/base": "1.2.0-c4f11168",
40
+ "@neo4j-nvl/interaction-handlers": "1.2.0-c4f11168",
41
41
  "lodash": "4.18.1"
42
42
  },
43
43
  "peerDependencies": {