@neo4j-nvl/react 1.1.0-7e7582c7 → 1.1.0-816a2979
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/lib/__tests__/BasicNvlWrapper.test.js +2 -2
- package/lib/__tests__/InteractiveNvlWrapper.test.js +64 -3
- package/lib/index.d.ts +2 -2
- package/lib/interactive-nvl-wrapper/InteractionHandlers.d.ts +2 -1
- package/lib/interactive-nvl-wrapper/InteractionHandlers.js +13 -2
- package/lib/interactive-nvl-wrapper/InteractiveNvlWrapper.d.ts +1 -2
- package/lib/interactive-nvl-wrapper/InteractiveNvlWrapper.js +2 -2
- package/lib/interactive-nvl-wrapper/hooks.d.ts +3 -3
- package/lib/interactive-nvl-wrapper/types.d.ts +12 -4
- package/lib/utils/constants.d.ts +2 -2
- package/package.json +4 -4
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import NVL, { HierarchicalLayoutType } from '@neo4j-nvl/base';
|
|
3
3
|
import '@testing-library/jest-dom';
|
|
4
4
|
import { render } from '@testing-library/react';
|
|
5
|
-
import
|
|
5
|
+
import { StrictMode } from 'react';
|
|
6
6
|
import { BasicNvlWrapper } from '../basic-wrapper/BasicNvlWrapper';
|
|
7
7
|
jest.mock('@neo4j-nvl/base');
|
|
8
8
|
jest.mock('@neo4j-nvl/layout-workers');
|
|
@@ -43,7 +43,7 @@ describe('BasicNvlWrapper', () => {
|
|
|
43
43
|
test('successfully re-initialises NVL when using React StrictMode', () => {
|
|
44
44
|
const destroy = jest.fn();
|
|
45
45
|
jest.spyOn(NVL.prototype, 'destroy').mockImplementation(destroy);
|
|
46
|
-
render(_jsx(
|
|
46
|
+
render(_jsx(StrictMode, { children: _jsx("div", { children: _jsx(BasicNvlWrapper, { nodes: [], rels: [] }) }) }));
|
|
47
47
|
expect(NVL).toHaveBeenCalledTimes(2);
|
|
48
48
|
expect(destroy).toHaveBeenCalledTimes(1);
|
|
49
49
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import NVL, { HierarchicalLayoutType } from '@neo4j-nvl/base';
|
|
3
|
-
import { BoxSelectInteraction, ClickInteraction, DragNodeInteraction, DrawInteraction, HoverInteraction, LassoInteraction, PanInteraction, ZoomInteraction } from '@neo4j-nvl/interaction-handlers';
|
|
3
|
+
import { BoxSelectInteraction, ClickInteraction, DragNodeInteraction, DrawInteraction, HoverInteraction, KeyboardInteraction, LassoInteraction, PanInteraction, ZoomInteraction } from '@neo4j-nvl/interaction-handlers';
|
|
4
4
|
import '@testing-library/jest-dom';
|
|
5
5
|
import { render } from '@testing-library/react';
|
|
6
|
-
import
|
|
6
|
+
import { StrictMode, act, createRef } from 'react';
|
|
7
7
|
import { InteractiveNvlWrapper } from '../interactive-nvl-wrapper/InteractiveNvlWrapper';
|
|
8
8
|
jest.mock('@neo4j-nvl/base');
|
|
9
9
|
jest.mock('@neo4j-nvl/layout-workers');
|
|
@@ -42,6 +42,10 @@ LassoInteraction.prototype.callbackMap = new Map();
|
|
|
42
42
|
LassoInteraction.prototype.updateCallback = jest.fn();
|
|
43
43
|
LassoInteraction.prototype.removeCallback = jest.fn();
|
|
44
44
|
LassoInteraction.prototype.destroy = jest.fn();
|
|
45
|
+
KeyboardInteraction.prototype.callbackMap = new Map();
|
|
46
|
+
KeyboardInteraction.prototype.updateCallback = jest.fn();
|
|
47
|
+
KeyboardInteraction.prototype.removeCallback = jest.fn();
|
|
48
|
+
KeyboardInteraction.prototype.destroy = jest.fn();
|
|
45
49
|
let mockDestroy;
|
|
46
50
|
let destroyHoverInteraction;
|
|
47
51
|
let destroyPanInteraction;
|
|
@@ -70,6 +74,7 @@ describe('InteractiveNvlWrapper', () => {
|
|
|
70
74
|
jest.spyOn(DrawInteraction.prototype, 'destroy').mockImplementation(jest.fn());
|
|
71
75
|
jest.spyOn(BoxSelectInteraction.prototype, 'destroy').mockImplementation(jest.fn());
|
|
72
76
|
jest.spyOn(LassoInteraction.prototype, 'destroy').mockImplementation(jest.fn());
|
|
77
|
+
jest.spyOn(KeyboardInteraction.prototype, 'destroy').mockImplementation(jest.fn());
|
|
73
78
|
});
|
|
74
79
|
afterEach(() => {
|
|
75
80
|
jest.clearAllMocks();
|
|
@@ -110,6 +115,7 @@ describe('InteractiveNvlWrapper', () => {
|
|
|
110
115
|
expect(ZoomInteraction).not.toHaveBeenCalled();
|
|
111
116
|
expect(BoxSelectInteraction).not.toHaveBeenCalled();
|
|
112
117
|
expect(LassoInteraction).not.toHaveBeenCalled();
|
|
118
|
+
expect(KeyboardInteraction).not.toHaveBeenCalled();
|
|
113
119
|
});
|
|
114
120
|
test.each([
|
|
115
121
|
{
|
|
@@ -253,6 +259,48 @@ describe('InteractiveNvlWrapper', () => {
|
|
|
253
259
|
expect(InteractionClass).toHaveBeenCalledWith(myNvlRef.current, options);
|
|
254
260
|
expect(InteractionClass).toHaveBeenCalledTimes(1);
|
|
255
261
|
});
|
|
262
|
+
test.each([
|
|
263
|
+
{
|
|
264
|
+
name: 'KeyboardInteraction with onKeyDown',
|
|
265
|
+
callback: { onKeyDown: jest.fn() }
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: 'KeyboardInteraction with onKeyUp',
|
|
269
|
+
callback: { onKeyUp: jest.fn() }
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: 'KeyboardInteraction with onNodeFocus',
|
|
273
|
+
callback: { onNodeFocus: jest.fn() }
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
name: 'KeyboardInteraction with onNodeBlur',
|
|
277
|
+
callback: { onNodeBlur: jest.fn() }
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: 'KeyboardInteraction with onRelationshipFocus',
|
|
281
|
+
callback: { onRelationshipFocus: jest.fn() }
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
name: 'KeyboardInteraction with onRelationshipBlur',
|
|
285
|
+
callback: { onRelationshipBlur: jest.fn() }
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
name: 'KeyboardInteraction with onCanvasFocus',
|
|
289
|
+
callback: { onCanvasFocus: jest.fn() }
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
name: 'KeyboardInteraction with onCanvasBlur',
|
|
293
|
+
callback: { onCanvasBlur: jest.fn() }
|
|
294
|
+
}
|
|
295
|
+
])('initialises $name when its callback is provided', ({ callback }) => {
|
|
296
|
+
const myNvlRef = createRef();
|
|
297
|
+
render(_jsx(InteractiveNvlWrapper, { nodes: [], rels: [], ref: myNvlRef, keyboardEventCallbacks: callback }));
|
|
298
|
+
act(() => {
|
|
299
|
+
mockOnInitialization?.();
|
|
300
|
+
});
|
|
301
|
+
expect(KeyboardInteraction).toHaveBeenCalledWith(myNvlRef.current, expect.objectContaining({}));
|
|
302
|
+
expect(KeyboardInteraction).toHaveBeenCalledTimes(1);
|
|
303
|
+
});
|
|
256
304
|
test('does not attempt to initialize interaction handlers if NVL container is not available', () => {
|
|
257
305
|
const myNvlRef = createRef();
|
|
258
306
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -280,7 +328,7 @@ describe('InteractiveNvlWrapper', () => {
|
|
|
280
328
|
});
|
|
281
329
|
test('successfully re-initialises NVL and active interaction handlers when using React StrictMode', () => {
|
|
282
330
|
const myNvlRef = createRef();
|
|
283
|
-
render(_jsx(
|
|
331
|
+
render(_jsx(StrictMode, { children: _jsx(InteractiveNvlWrapper, { nodes: [], rels: [], ref: myNvlRef, mouseEventCallbacks: {
|
|
284
332
|
onHover: true
|
|
285
333
|
}, interactionOptions: {
|
|
286
334
|
drawShadowOnHover: true
|
|
@@ -299,6 +347,19 @@ describe('InteractiveNvlWrapper', () => {
|
|
|
299
347
|
expect(ZoomInteraction).not.toHaveBeenCalled();
|
|
300
348
|
expect(BoxSelectInteraction).not.toHaveBeenCalled();
|
|
301
349
|
expect(LassoInteraction).not.toHaveBeenCalled();
|
|
350
|
+
expect(KeyboardInteraction).not.toHaveBeenCalled();
|
|
351
|
+
});
|
|
352
|
+
test('destroys keyboard interaction on unmount', () => {
|
|
353
|
+
const destroyKeyboardInteraction = jest.fn();
|
|
354
|
+
jest.spyOn(KeyboardInteraction.prototype, 'destroy').mockImplementation(destroyKeyboardInteraction);
|
|
355
|
+
const { unmount } = render(_jsx(InteractiveNvlWrapper, { nodes: [], rels: [], keyboardEventCallbacks: {
|
|
356
|
+
onKeyDown: true
|
|
357
|
+
} }));
|
|
358
|
+
act(() => {
|
|
359
|
+
mockOnInitialization?.();
|
|
360
|
+
});
|
|
361
|
+
unmount();
|
|
362
|
+
expect(destroyKeyboardInteraction).toHaveBeenCalledTimes(1);
|
|
302
363
|
});
|
|
303
364
|
test('also calls custom callbacks on initialization', () => {
|
|
304
365
|
const customOnInitializationCallback = jest.fn();
|
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BasicNvlWrapper } from './basic-wrapper/BasicNvlWrapper';
|
|
2
2
|
import type { BasicReactWrapperProps } from './basic-wrapper/BasicNvlWrapper';
|
|
3
3
|
import { InteractiveNvlWrapper } from './interactive-nvl-wrapper/InteractiveNvlWrapper';
|
|
4
|
-
import type { InteractionOptions, InteractiveNvlWrapperProps, MouseEvent, MouseEventCallbacks } from './interactive-nvl-wrapper/types';
|
|
4
|
+
import type { InteractionOptions, InteractiveNvlWrapperProps, KeyboardEvent, KeyboardEventCallbacks, MouseEvent, MouseEventCallbacks } from './interactive-nvl-wrapper/types';
|
|
5
5
|
import type { StaticPictureWrapperProps } from './static-picture-wrapper/StaticPictureWrapper';
|
|
6
6
|
import { StaticPictureWrapper } from './static-picture-wrapper/StaticPictureWrapper';
|
|
7
7
|
export { BasicNvlWrapper, InteractiveNvlWrapper, StaticPictureWrapper };
|
|
8
|
-
export type { MouseEventCallbacks, MouseEvent, BasicReactWrapperProps, InteractionOptions, InteractiveNvlWrapperProps, StaticPictureWrapperProps };
|
|
8
|
+
export type { MouseEventCallbacks, KeyboardEventCallbacks, MouseEvent, KeyboardEvent, BasicReactWrapperProps, InteractionOptions, InteractiveNvlWrapperProps, StaticPictureWrapperProps };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type NVL from '@neo4j-nvl/base';
|
|
2
2
|
import type { MutableRefObject } from 'react';
|
|
3
|
-
import type { InteractionOptions, MouseEventCallbacks } from './types';
|
|
3
|
+
import type { InteractionOptions, KeyboardEventCallbacks, MouseEventCallbacks } from './types';
|
|
4
4
|
interface InteractionHandlersProps {
|
|
5
5
|
nvlRef: MutableRefObject<NVL | null>;
|
|
6
6
|
mouseEventCallbacks: MouseEventCallbacks;
|
|
7
|
+
keyboardEventCallbacks: KeyboardEventCallbacks;
|
|
7
8
|
interactionOptions: InteractionOptions;
|
|
8
9
|
}
|
|
9
10
|
export declare const InteractionHandlers: React.FC<InteractionHandlersProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BoxSelectInteraction, ClickInteraction, DragNodeInteraction, DrawInteraction, HoverInteraction, LassoInteraction, PanInteraction, ZoomInteraction } from '@neo4j-nvl/interaction-handlers';
|
|
1
|
+
import { BoxSelectInteraction, ClickInteraction, DragNodeInteraction, DrawInteraction, HoverInteraction, KeyboardInteraction, LassoInteraction, PanInteraction, ZoomInteraction } from '@neo4j-nvl/interaction-handlers';
|
|
2
2
|
import { useEffect, useRef } from 'react';
|
|
3
3
|
import { destroyInteraction, useInteraction } from './hooks';
|
|
4
|
-
export const InteractionHandlers = ({ nvlRef, mouseEventCallbacks, interactionOptions }) => {
|
|
4
|
+
export const InteractionHandlers = ({ nvlRef, mouseEventCallbacks, keyboardEventCallbacks, interactionOptions }) => {
|
|
5
5
|
const hoverInteraction = useRef(null);
|
|
6
6
|
const clickInteraction = useRef(null);
|
|
7
7
|
const panInteraction = useRef(null);
|
|
@@ -10,6 +10,7 @@ export const InteractionHandlers = ({ nvlRef, mouseEventCallbacks, interactionOp
|
|
|
10
10
|
const drawInteraction = useRef(null);
|
|
11
11
|
const multiSelectInteraction = useRef(null);
|
|
12
12
|
const lassoInteraction = useRef(null);
|
|
13
|
+
const keyboardInteraction = useRef(null);
|
|
13
14
|
useInteraction(HoverInteraction, hoverInteraction, mouseEventCallbacks.onHover, 'onHover', nvlRef, interactionOptions);
|
|
14
15
|
useInteraction(ClickInteraction, clickInteraction, mouseEventCallbacks.onNodeClick, 'onNodeClick', nvlRef, interactionOptions);
|
|
15
16
|
useInteraction(ClickInteraction, clickInteraction, mouseEventCallbacks.onNodeDoubleClick, 'onNodeDoubleClick', nvlRef, interactionOptions);
|
|
@@ -33,6 +34,15 @@ export const InteractionHandlers = ({ nvlRef, mouseEventCallbacks, interactionOp
|
|
|
33
34
|
useInteraction(BoxSelectInteraction, multiSelectInteraction, mouseEventCallbacks.onBoxSelect, 'onBoxSelect', nvlRef, interactionOptions);
|
|
34
35
|
useInteraction(LassoInteraction, lassoInteraction, mouseEventCallbacks.onLassoStarted, 'onLassoStarted', nvlRef, interactionOptions);
|
|
35
36
|
useInteraction(LassoInteraction, lassoInteraction, mouseEventCallbacks.onLassoSelect, 'onLassoSelect', nvlRef, interactionOptions);
|
|
37
|
+
useInteraction(KeyboardInteraction, keyboardInteraction, keyboardEventCallbacks.onKeyDown, 'onKeyDown', nvlRef, interactionOptions);
|
|
38
|
+
useInteraction(KeyboardInteraction, keyboardInteraction, keyboardEventCallbacks.onKeyUp, 'onKeyUp', nvlRef, interactionOptions);
|
|
39
|
+
useInteraction(KeyboardInteraction, keyboardInteraction, keyboardEventCallbacks.onNodeFocus, 'onNodeFocus', nvlRef, interactionOptions);
|
|
40
|
+
useInteraction(KeyboardInteraction, keyboardInteraction, keyboardEventCallbacks.onNodeBlur, 'onNodeBlur', nvlRef, interactionOptions);
|
|
41
|
+
useInteraction(KeyboardInteraction, keyboardInteraction, keyboardEventCallbacks.onRelationshipFocus, 'onRelationshipFocus', nvlRef, interactionOptions);
|
|
42
|
+
useInteraction(KeyboardInteraction, keyboardInteraction, keyboardEventCallbacks.onRelationshipBlur, 'onRelationshipBlur', nvlRef, interactionOptions);
|
|
43
|
+
useInteraction(KeyboardInteraction, keyboardInteraction, keyboardEventCallbacks.onCanvasFocus, 'onCanvasFocus', nvlRef, interactionOptions);
|
|
44
|
+
useInteraction(KeyboardInteraction, keyboardInteraction, keyboardEventCallbacks.onCanvasBlur, 'onCanvasBlur', nvlRef, interactionOptions);
|
|
45
|
+
useInteraction(KeyboardInteraction, keyboardInteraction, keyboardEventCallbacks.onContextMenu, 'onContextMenu', nvlRef, interactionOptions);
|
|
36
46
|
useEffect(() => () => {
|
|
37
47
|
destroyInteraction(hoverInteraction);
|
|
38
48
|
destroyInteraction(clickInteraction);
|
|
@@ -42,6 +52,7 @@ export const InteractionHandlers = ({ nvlRef, mouseEventCallbacks, interactionOp
|
|
|
42
52
|
destroyInteraction(drawInteraction);
|
|
43
53
|
destroyInteraction(multiSelectInteraction);
|
|
44
54
|
destroyInteraction(lassoInteraction);
|
|
55
|
+
destroyInteraction(keyboardInteraction);
|
|
45
56
|
}, []);
|
|
46
57
|
return null;
|
|
47
58
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type NVL from '@neo4j-nvl/base';
|
|
2
2
|
import type { HTMLProps } from 'react';
|
|
3
|
-
import React from 'react';
|
|
4
3
|
import type { InteractiveNvlWrapperProps } from './types';
|
|
5
4
|
/**
|
|
6
5
|
* The interactive React wrapper component contains a collection of interaction handlers by default
|
|
@@ -13,4 +12,4 @@ import type { InteractiveNvlWrapperProps } from './types';
|
|
|
13
12
|
*
|
|
14
13
|
* For examples, head to the {@link https://neo4j.com/docs/nvl/current/react-wrappers/#_interactive_reactive_wrapperr Interactive React wrapper documentation page}.
|
|
15
14
|
*/
|
|
16
|
-
export declare const InteractiveNvlWrapper:
|
|
15
|
+
export declare const InteractiveNvlWrapper: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<InteractiveNvlWrapperProps & HTMLProps<HTMLDivElement>, "ref"> & import("react").RefAttributes<NVL>>>;
|
|
@@ -20,7 +20,7 @@ const options = {
|
|
|
20
20
|
*
|
|
21
21
|
* For examples, head to the {@link https://neo4j.com/docs/nvl/current/react-wrappers/#_interactive_reactive_wrapperr Interactive React wrapper documentation page}.
|
|
22
22
|
*/
|
|
23
|
-
export const InteractiveNvlWrapper = memo(forwardRef(({ nodes, rels, layout, layoutOptions, onInitializationError, mouseEventCallbacks = {}, nvlCallbacks = {}, nvlOptions = {}, interactionOptions = options, ...nvlEvents }, nvlRef) => {
|
|
23
|
+
export const InteractiveNvlWrapper = memo(forwardRef(({ nodes, rels, layout, layoutOptions, onInitializationError, mouseEventCallbacks = {}, keyboardEventCallbacks = {}, nvlCallbacks = {}, nvlOptions = {}, interactionOptions = options, ...nvlEvents }, nvlRef) => {
|
|
24
24
|
const newNvlRef = useRef(null);
|
|
25
25
|
const myNvlRef = nvlRef ?? newNvlRef;
|
|
26
26
|
const [isNvlInitialized, setIsNvlInitialized] = useState(false);
|
|
@@ -42,5 +42,5 @@ export const InteractiveNvlWrapper = memo(forwardRef(({ nodes, rels, layout, lay
|
|
|
42
42
|
}
|
|
43
43
|
handleInitialization();
|
|
44
44
|
}
|
|
45
|
-
}, layout: layout, layoutOptions: layoutOptions, onInitializationError: handleInitializationError, ...nvlEvents }), setupInteractions && (_jsx(InteractionHandlers, { nvlRef: myNvlRef, mouseEventCallbacks: mouseEventCallbacks, interactionOptions: interactionOptions }))] }));
|
|
45
|
+
}, layout: layout, layoutOptions: layoutOptions, onInitializationError: handleInitializationError, ...nvlEvents }), setupInteractions && (_jsx(InteractionHandlers, { nvlRef: myNvlRef, mouseEventCallbacks: mouseEventCallbacks, keyboardEventCallbacks: keyboardEventCallbacks, interactionOptions: interactionOptions }))] }));
|
|
46
46
|
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type NVL from '@neo4j-nvl/base';
|
|
2
2
|
import type { MutableRefObject } from 'react';
|
|
3
|
-
import type {
|
|
4
|
-
export declare const destroyInteraction: (interactionRef: MutableRefObject<
|
|
5
|
-
export declare const useInteraction: (Interaction:
|
|
3
|
+
import type { Interaction, InteractionModule, InteractionOptions, KeyboardEvent, MouseEvent } from './types';
|
|
4
|
+
export declare const destroyInteraction: (interactionRef: MutableRefObject<Interaction | null>) => void;
|
|
5
|
+
export declare const useInteraction: (Interaction: InteractionModule, interactionRef: MutableRefObject<Interaction | null>, callback: ((...args: unknown[]) => void) | boolean | undefined, eventName: MouseEvent | KeyboardEvent, nvlRef: MutableRefObject<NVL | null>, interactionOptions: InteractionOptions) => void;
|
|
@@ -1,28 +1,36 @@
|
|
|
1
|
-
import type { BoxSelectInteraction, BoxSelectInteractionCallbacks, BoxSelectInteractionOptions, ClickInteraction, ClickInteractionCallbacks, ClickInteractionOptions, DragNodeInteraction, DragNodeInteractionCallbacks, DrawInteraction, DrawInteractionCallbacks, DrawInteractionOptions, HoverInteraction, HoverInteractionCallbacks, HoverInteractionOptions, LassoInteraction, LassoInteractionCallbacks, LassoInteractionOptions, PanInteraction, PanInteractionCallbacks, PanInteractionOptions, ZoomInteraction, ZoomInteractionCallbacks, ZoomInteractionOptions } from '@neo4j-nvl/interaction-handlers';
|
|
1
|
+
import type { BoxSelectInteraction, BoxSelectInteractionCallbacks, BoxSelectInteractionOptions, ClickInteraction, ClickInteractionCallbacks, ClickInteractionOptions, DragNodeInteraction, DragNodeInteractionCallbacks, DrawInteraction, DrawInteractionCallbacks, DrawInteractionOptions, HoverInteraction, HoverInteractionCallbacks, HoverInteractionOptions, KeyboardInteraction, KeyboardInteractionCallbacks, KeyboardInteractionOptions, LassoInteraction, LassoInteractionCallbacks, LassoInteractionOptions, PanInteraction, PanInteractionCallbacks, PanInteractionOptions, ZoomInteraction, ZoomInteractionCallbacks, ZoomInteractionOptions } from '@neo4j-nvl/interaction-handlers';
|
|
2
2
|
import type { BasicReactWrapperProps } from '../basic-wrapper/BasicNvlWrapper';
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
3
|
+
export type InteractionModule = typeof HoverInteraction | typeof ClickInteraction | typeof PanInteraction | typeof ZoomInteraction | typeof DragNodeInteraction | typeof DrawInteraction | typeof BoxSelectInteraction | typeof LassoInteraction | typeof KeyboardInteraction;
|
|
4
|
+
export type Interaction = HoverInteraction | ClickInteraction | PanInteraction | ZoomInteraction | DragNodeInteraction | DrawInteraction | BoxSelectInteraction | LassoInteraction | KeyboardInteraction;
|
|
5
5
|
/**
|
|
6
6
|
* Collection of mouse event callbacks that can be used with
|
|
7
7
|
* the {@link InteractiveNvlWrapper} component.
|
|
8
8
|
*/
|
|
9
9
|
export type MouseEventCallbacks = ClickInteractionCallbacks & DragNodeInteractionCallbacks & HoverInteractionCallbacks & PanInteractionCallbacks & ZoomInteractionCallbacks & BoxSelectInteractionCallbacks & DrawInteractionCallbacks & LassoInteractionCallbacks;
|
|
10
|
+
/**
|
|
11
|
+
* Collection of keyboard event callbacks that can be used with
|
|
12
|
+
* the {@link InteractiveNvlWrapper} component.
|
|
13
|
+
*/
|
|
14
|
+
export type KeyboardEventCallbacks = KeyboardInteractionCallbacks;
|
|
10
15
|
/**
|
|
11
16
|
* Collection of interaction options that can be used with
|
|
12
17
|
* the {@link InteractiveNvlWrapper} component.
|
|
13
18
|
*/
|
|
14
|
-
export type InteractionOptions = ClickInteractionOptions & BoxSelectInteractionOptions & HoverInteractionOptions & PanInteractionOptions & ZoomInteractionOptions & LassoInteractionOptions & DrawInteractionOptions;
|
|
19
|
+
export type InteractionOptions = ClickInteractionOptions & BoxSelectInteractionOptions & HoverInteractionOptions & PanInteractionOptions & ZoomInteractionOptions & LassoInteractionOptions & DrawInteractionOptions & KeyboardInteractionOptions;
|
|
15
20
|
/**
|
|
16
21
|
* The events that can be passed to the {@link MouseEventCallbacks} object
|
|
17
22
|
* to turn on/off certain events for the {@link InteractiveNvlWrapper} component.
|
|
18
23
|
*/
|
|
19
24
|
export type MouseEvent = keyof MouseEventCallbacks;
|
|
25
|
+
export type KeyboardEvent = keyof KeyboardEventCallbacks;
|
|
20
26
|
/**
|
|
21
27
|
* The properties that can be passed to the {@link InteractiveNvlWrapper} component.
|
|
22
28
|
*/
|
|
23
29
|
export interface InteractiveNvlWrapperProps extends BasicReactWrapperProps {
|
|
24
30
|
/** {@link MouseEventCallbacks} containing functions for callbacks on certain actions */
|
|
25
31
|
mouseEventCallbacks?: MouseEventCallbacks;
|
|
32
|
+
/** {@link KeyboardEventCallbacks} containing functions for callbacks on keyboard actions */
|
|
33
|
+
keyboardEventCallbacks?: KeyboardEventCallbacks;
|
|
26
34
|
/** {@link InteractionOptions} for the underlying interaction handlers */
|
|
27
35
|
interactionOptions?: InteractionOptions;
|
|
28
36
|
}
|
package/lib/utils/constants.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const BASIC_WRAPPER_ID
|
|
2
|
-
export const INTERACTIVE_WRAPPER_ID
|
|
1
|
+
export declare const BASIC_WRAPPER_ID = "NVL_basic-wrapper";
|
|
2
|
+
export declare const INTERACTIVE_WRAPPER_ID = "NVL_interactive-wrapper";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-nvl/react",
|
|
3
|
-
"version": "1.1.0-
|
|
3
|
+
"version": "1.1.0-816a2979",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"homepage": "https://neo4j.com/docs/nvl/current/",
|
|
6
6
|
"license": "SEE LICENSE IN 'LICENSE.txt'",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"react-dom": "19.2.1"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@neo4j-nvl/base": "1.1.0-
|
|
40
|
-
"@neo4j-nvl/interaction-handlers": "1.1.0-
|
|
41
|
-
"lodash": "4.
|
|
39
|
+
"@neo4j-nvl/base": "1.1.0-816a2979",
|
|
40
|
+
"@neo4j-nvl/interaction-handlers": "1.1.0-816a2979",
|
|
41
|
+
"lodash": "4.18.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "18.0.0 || ^19.0.0",
|