@neo4j-nvl/react 0.3.1-c678d7aa → 0.3.1-d62fa5e9
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/README.md
CHANGED
|
@@ -14,15 +14,10 @@ npm install @neo4j-nvl/react
|
|
|
14
14
|
|
|
15
15
|
### Using the library
|
|
16
16
|
|
|
17
|
-
This is an example on how to use the BasicReactWrapper component:
|
|
17
|
+
This is an example on how to use the BasicReactWrapper component:
|
|
18
18
|
|
|
19
19
|
```tsx
|
|
20
|
-
<BasicNvlWrapper
|
|
21
|
-
nodes={nodes}
|
|
22
|
-
rels={relationships}
|
|
23
|
-
nvlOptions={options}
|
|
24
|
-
nvlCallbacks={callbacks}
|
|
25
|
-
/>
|
|
20
|
+
<BasicNvlWrapper nodes={nodes} rels={relationships} nvlOptions={options} nvlCallbacks={callbacks} />
|
|
26
21
|
```
|
|
27
22
|
|
|
28
23
|
When nodes and/or relationships are updated in the React wrapper, the NVL instance will be updated accordingly:
|
|
@@ -81,5 +76,9 @@ const [multiSelect, setMultiSelect] = useState(false)
|
|
|
81
76
|
</>
|
|
82
77
|
```
|
|
83
78
|
|
|
79
|
+
You can also find more instructions and examples on how to use the NVL React wrappers in the [docs](https://neo4j.com/docs/nvl/current/react-wrappers/).
|
|
84
80
|
|
|
85
|
-
|
|
81
|
+
### Product analytics
|
|
82
|
+
|
|
83
|
+
In order to improve the library we are collecting some information about the usage of NVL. If you prefer to disable this behavior set the parameter `disableTelemetry=true` as a parameter in `nvlOptions`.
|
|
84
|
+
For example: `<BasicNvlWrapper nvlOptions={{ disableTelemetry: true }} nodes=[0,1] rels=[0,1]/>` or `<InteractiveNvlWrapper nvlOptions={{ disableTelemetry: true }} nodes=[0,1] rels=[0,1]/>`
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import NVL from '@neo4j-nvl/base';
|
|
3
3
|
import { forwardRef, memo, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
4
|
+
import { BASIC_WRAPPER_ID } from '../utils/constants';
|
|
4
5
|
import { getMapDifferences, getNodeAttributeDifferences } from '../utils/graph-comparison';
|
|
5
6
|
import { useDeepCompareEffect } from '../utils/hooks';
|
|
6
7
|
/**
|
|
@@ -192,5 +193,5 @@ export const BasicNvlWrapper = memo(forwardRef(({ nodes, rels, layout, layoutOpt
|
|
|
192
193
|
}
|
|
193
194
|
nvlRef.current.setDisableWebGL(nvlOptions.disableWebGL);
|
|
194
195
|
}, [nvlOptions.disableWebGL]);
|
|
195
|
-
return _jsx("div", { ref: containerRef, style: { height: '100%', outline: '0' }, ...nvlEvents });
|
|
196
|
+
return _jsx("div", { id: BASIC_WRAPPER_ID, ref: containerRef, style: { height: '100%', outline: '0' }, ...nvlEvents });
|
|
196
197
|
}));
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { BoxSelectInteraction, ClickInteraction, DragNodeInteraction, DrawInteraction, HoverInteraction, LassoInteraction, PanInteraction, ZoomInteraction } from '@neo4j-nvl/interaction-handlers';
|
|
3
3
|
import { forwardRef, memo, useEffect, useRef } from 'react';
|
|
4
4
|
import { BasicNvlWrapper } from '../basic-wrapper/BasicNvlWrapper';
|
|
5
|
+
import { INTERACTIVE_WRAPPER_ID } from '../utils/constants';
|
|
5
6
|
import { destroyInteraction, useInteraction } from './hooks';
|
|
6
7
|
const options = {
|
|
7
8
|
selectOnClick: false,
|
|
@@ -82,5 +83,5 @@ export const InteractiveNvlWrapper = memo(forwardRef(({ nodes, rels, layout, lay
|
|
|
82
83
|
destroyInteraction(multiSelectInteraction);
|
|
83
84
|
destroyInteraction(lassoInteraction);
|
|
84
85
|
}, []);
|
|
85
|
-
return (_jsx(BasicNvlWrapper, { ref: myNvlRef, nodes: nodes, rels: rels, nvlOptions: nvlOptions, nvlCallbacks: nvlCallbacks, layout: layout, layoutOptions: layoutOptions, onInitializationError: onInitializationError, ...nvlEvents }));
|
|
86
|
+
return (_jsx(BasicNvlWrapper, { ref: myNvlRef, nodes: nodes, id: INTERACTIVE_WRAPPER_ID, rels: rels, nvlOptions: nvlOptions, nvlCallbacks: nvlCallbacks, layout: layout, layoutOptions: layoutOptions, onInitializationError: onInitializationError, ...nvlEvents }));
|
|
86
87
|
}));
|
package/lib/utils/hooks.js
CHANGED
|
@@ -11,5 +11,6 @@ function useDeepCompareMemoize(value) {
|
|
|
11
11
|
return ref.current;
|
|
12
12
|
}
|
|
13
13
|
export const useDeepCompareEffect = (callback, dependencies) => {
|
|
14
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
15
|
useEffect(callback, dependencies.map(useDeepCompareMemoize));
|
|
15
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-nvl/react",
|
|
3
|
-
"version": "0.3.1-
|
|
3
|
+
"version": "0.3.1-d62fa5e9",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"homepage": "https://neo4j.com/docs/nvl/current/",
|
|
6
6
|
"license": "SEE LICENSE IN 'LICENSE.txt'",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"typescript": "^5.4.5"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@neo4j-nvl/base": "^0.3.1-
|
|
45
|
-
"@neo4j-nvl/interaction-handlers": "^0.3.1-
|
|
44
|
+
"@neo4j-nvl/base": "^0.3.1-d62fa5e9",
|
|
45
|
+
"@neo4j-nvl/interaction-handlers": "^0.3.1-d62fa5e9",
|
|
46
46
|
"lodash": "4.17.21",
|
|
47
47
|
"react": "^18.2.0",
|
|
48
48
|
"react-dom": "^18.2.0"
|