@neo4j-nvl/react 0.2.47 → 0.2.49

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.
@@ -39,7 +39,7 @@ const options = {
39
39
  */
40
40
  export const InteractiveNvlWrapper = memo(forwardRef(({ nodes, rels, layout, layoutOptions, mouseEventCallbacks = {}, nvlCallbacks = {}, nvlOptions = {}, interactionOptions = options }, nvlRef) => {
41
41
  const myNvlRef = nvlRef !== null ? nvlRef : useRef(null);
42
- const { onHover, onNodeClick, onNodeDoubleClick, onNodeRightClick, onRelationshipClick, onRelationshipDoubleClick, onRelationshipRightClick, onCanvasClick, onCanvasRightClick, onPan, onZoom, onDrag, onDragStart, onDragEnd, onDrawEnd, onBoxStarted, onBoxSelect, onLassoStarted, onLassoSelect } = mouseEventCallbacks;
42
+ const { onHover, onNodeClick, onNodeDoubleClick, onNodeRightClick, onRelationshipClick, onRelationshipDoubleClick, onRelationshipRightClick, onCanvasClick, onCanvasRightClick, onPan, onZoom, onDrag, onDragStart, onDragEnd, onDrawEnd, onHoverNodeMargin, onBoxStarted, onBoxSelect, onLassoStarted, onLassoSelect } = mouseEventCallbacks;
43
43
  const hoverInteraction = useRef();
44
44
  const clickInteraction = useRef();
45
45
  const panInteraction = useRef();
@@ -62,6 +62,7 @@ export const InteractiveNvlWrapper = memo(forwardRef(({ nodes, rels, layout, lay
62
62
  useInteraction(DragNodeInteraction, dragNodeInteraction, onDrag, 'onDrag', myNvlRef, interactionOptions);
63
63
  useInteraction(DragNodeInteraction, dragNodeInteraction, onDragStart, 'onDragStart', myNvlRef, interactionOptions);
64
64
  useInteraction(DragNodeInteraction, dragNodeInteraction, onDragEnd, 'onDragEnd', myNvlRef, interactionOptions);
65
+ useInteraction(DrawInteraction, drawInteraction, onHoverNodeMargin, 'onHoverNodeMargin', myNvlRef, interactionOptions);
65
66
  useInteraction(DrawInteraction, drawInteraction, onDrawEnd, 'onDrawEnd', myNvlRef, interactionOptions);
66
67
  useInteraction(BoxSelectInteraction, multiSelectInteraction, onBoxStarted, 'onBoxStarted', myNvlRef, interactionOptions);
67
68
  useInteraction(BoxSelectInteraction, multiSelectInteraction, onBoxSelect, 'onBoxSelect', myNvlRef, interactionOptions);
@@ -2,4 +2,4 @@ import type NVL from '@neo4j-nvl/core';
2
2
  import type { MutableRefObject } from 'react';
3
3
  import type { InteractionOptions, MouseEvent, MouseInteraction, MouseInteractionModule } from './types';
4
4
  export declare const destroyInteraction: (interactionRef: MutableRefObject<MouseInteraction>) => void;
5
- export declare const useInteraction: (interaction: MouseInteractionModule, interactionRef: MutableRefObject<MouseInteraction>, callback: boolean | ((...args: unknown[]) => void), eventName: MouseEvent, nvlRef: MutableRefObject<NVL>, interactionOptions: InteractionOptions) => void;
5
+ export declare const useInteraction: (Interaction: MouseInteractionModule, interactionRef: MutableRefObject<MouseInteraction>, callback: boolean | ((...args: unknown[]) => void), eventName: MouseEvent, nvlRef: MutableRefObject<NVL>, interactionOptions: InteractionOptions) => void;
@@ -5,14 +5,12 @@ export const destroyInteraction = (interactionRef) => {
5
5
  (_a = interactionRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
6
6
  interactionRef.current = null;
7
7
  };
8
- export const useInteraction = (interaction, interactionRef, callback, eventName, nvlRef, interactionOptions) => {
8
+ export const useInteraction = (Interaction, interactionRef, callback, eventName, nvlRef, interactionOptions) => {
9
9
  useEffect(() => {
10
10
  setTimeout(() => {
11
11
  if ((callback === true || typeof callback === 'function') && !isNil(nvlRef.current)) {
12
12
  if (isNil(interactionRef.current)) {
13
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
14
- // @ts-ignore
15
- interactionRef.current = new interaction(nvlRef.current, interactionOptions);
13
+ interactionRef.current = new Interaction(nvlRef.current, interactionOptions);
16
14
  }
17
15
  if (typeof callback === 'function') {
18
16
  interactionRef.current.updateCallback(eventName, callback);
@@ -8,7 +8,7 @@ export type InteractionOptions = ClickInteractionOptions & BoxSelectInteractionO
8
8
  * The events that can be passed to the {@link MouseEventCallbacks} object
9
9
  * to turn on/off certain events for the {@link InteractiveNvlWrapper} component.
10
10
  */
11
- export type MouseEvent = 'onHover' | 'onNodeClick' | 'onNodeRightClick' | 'onNodeDoubleClick' | 'onRelationshipClick' | 'onRelationshipDoubleClick' | 'onRelationshipRightClick' | 'onCanvasClick' | 'onCanvasDoubleClick' | 'onCanvasRightClick' | 'onDrag' | 'onDragStart' | 'onDragEnd' | 'onDrawEnd' | 'onPan' | 'onZoom' | 'onBoxStarted' | 'onBoxSelect' | 'onLassoStarted' | 'onLassoSelect';
11
+ export type MouseEvent = keyof MouseEventCallbacks;
12
12
  /**
13
13
  * The properties that can be passed to the {@link InteractiveNvlWrapper} component.
14
14
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-nvl/react",
3
- "version": "0.2.47",
3
+ "version": "0.2.49",
4
4
  "main": "lib/index.js",
5
5
  "license": "SEE LICENSE IN 'Neo4j Early Access Agreement - Visualization Library.pdf'",
6
6
  "scripts": {