@neo4j-nvl/react 0.2.52 → 0.2.54
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.
|
@@ -109,5 +109,5 @@ export interface BasicReactWrapperProps {
|
|
|
109
109
|
* For more about interactivity, check out the {@link NVL}.hittest method,
|
|
110
110
|
* the Interaction Handlers module module and the {@link InteractiveNvlWrapper}.
|
|
111
111
|
*/
|
|
112
|
-
export declare const BasicNvlWrapper: React.MemoExoticComponent<React.ForwardRefExoticComponent<
|
|
112
|
+
export declare const BasicNvlWrapper: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<BasicReactWrapperProps & React.HTMLProps<HTMLDivElement>, "ref"> & React.RefAttributes<IncludeMethods<NVL>>>>;
|
|
113
113
|
export {};
|
|
@@ -126,8 +126,9 @@ export const BasicNvlWrapper = memo(forwardRef(({ nodes, rels, layout, layoutOpt
|
|
|
126
126
|
}
|
|
127
127
|
return () => {
|
|
128
128
|
newNvl?.destroy();
|
|
129
|
+
nvlRef.current = null;
|
|
129
130
|
};
|
|
130
|
-
}, []);
|
|
131
|
+
}, [containerRef.current]);
|
|
131
132
|
useEffect(() => {
|
|
132
133
|
if (nvlRef.current === null) {
|
|
133
134
|
return;
|
|
@@ -6,21 +6,19 @@ export const destroyInteraction = (interactionRef) => {
|
|
|
6
6
|
};
|
|
7
7
|
export const useInteraction = (Interaction, interactionRef, callback, eventName, nvlRef, interactionOptions) => {
|
|
8
8
|
useEffect(() => {
|
|
9
|
-
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
interactionRef.current = new Interaction(nvlRef.current, interactionOptions);
|
|
13
|
-
}
|
|
14
|
-
if (typeof callback === 'function') {
|
|
15
|
-
interactionRef.current.updateCallback(eventName, callback);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
interactionRef.current.removeCallback(eventName);
|
|
19
|
-
}
|
|
9
|
+
if ((callback === true || typeof callback === 'function') && !isNil(nvlRef.current)) {
|
|
10
|
+
if (isNil(interactionRef.current)) {
|
|
11
|
+
interactionRef.current = new Interaction(nvlRef.current, interactionOptions);
|
|
20
12
|
}
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
if (typeof callback === 'function') {
|
|
14
|
+
interactionRef.current.updateCallback(eventName, callback);
|
|
23
15
|
}
|
|
24
|
-
|
|
16
|
+
else if (!isNil(interactionRef.current.callbackMap[eventName])) {
|
|
17
|
+
interactionRef.current.removeCallback(eventName);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else if (callback === false) {
|
|
21
|
+
destroyInteraction(interactionRef);
|
|
22
|
+
}
|
|
25
23
|
}, [callback]);
|
|
26
24
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-nvl/react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.54",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"license": "SEE LICENSE IN 'Neo4j Early Access Agreement - Visualization Library.pdf'",
|
|
6
6
|
"scripts": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@testing-library/jest-dom": "^5.16.5",
|
|
28
28
|
"@testing-library/react": "^13.4.0",
|
|
29
29
|
"@types/lodash": "4.14.202",
|
|
30
|
-
"@types/react": "
|
|
30
|
+
"@types/react": "18.2.58",
|
|
31
31
|
"babel-eslint": "^10.1.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|