@neo4j-nvl/react
Advanced tools
Comparing version 0.2.10 to 0.2.11
@@ -0,4 +1,4 @@ | ||
import type { ExternalCallbacks, Layout, LayoutOptions, Node, NvlOptions, Relationship } from '@neo4j-nvl/core'; | ||
import NVL from '@neo4j-nvl/core'; | ||
import React from 'react'; | ||
import type { NvlOptions, Node, Relationship, LayoutOptions, Layout, ExternalCallbacks } from '@neo4j-nvl/core'; | ||
import NVL from '@neo4j-nvl/core'; | ||
type IncludeMethods<T> = Pick<T, { | ||
@@ -5,0 +5,0 @@ [K in keyof T]: T[K] extends (_: unknown) => unknown ? K : never; |
@@ -12,4 +12,4 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
}; | ||
import React, { useEffect, useState, useRef, forwardRef, useImperativeHandle, memo } from 'react'; | ||
import NVL from '@neo4j-nvl/core'; | ||
import React, { forwardRef, memo, useEffect, useImperativeHandle, useRef, useState } from 'react'; | ||
import { getMapDifferences, getNodeAttributeDifferences } from '../utils/graphComparison'; | ||
@@ -151,4 +151,6 @@ import { useDeepCompareEffect } from '../utils/hooks'; | ||
setCurrentNodes(nodes); | ||
nvlRef.current && nvlRef.current.addAndUpdateElementsInGraph([...nodeChanges.added, ...nodeDiff], [...relChanges.added, ...relChanges.updated]); | ||
nvlRef.current && nvlRef.current.removeRelationshipsWithIds(relChanges.removed.map((r) => r.id)); | ||
nvlRef.current && | ||
nvlRef.current.addAndUpdateElementsInGraph([...nodeChanges.added, ...nodeDiff], [...relChanges.added, ...relChanges.updated]); | ||
nvlRef.current && | ||
nvlRef.current.removeRelationshipsWithIds(relChanges.removed.map((r) => r.id)); | ||
nvlRef.current && nvlRef.current.removeNodesWithIds(nodeChanges.removed.map((n) => n.id)); | ||
@@ -155,0 +157,0 @@ }, [nodes, rels]); |
import { BasicNvlWrapper } from './basic-wrapper/BasicNvlWrapper'; | ||
import type { BasicReactWrapperProps } from './basic-wrapper/BasicNvlWrapper'; | ||
import { InteractiveNvlWrapper } from './interactive-nvl-wrapper/InteractiveNvlWrapper'; | ||
import type { MouseEventCallbacks, InteractiveNvlWrapperProps, MouseEvent, InteractionOptions } from './interactive-nvl-wrapper/InteractiveNvlWrapper'; | ||
import type { InteractionOptions, InteractiveNvlWrapperProps, MouseEvent, MouseEventCallbacks } from './interactive-nvl-wrapper/InteractiveNvlWrapper'; | ||
export { BasicNvlWrapper, InteractiveNvlWrapper }; | ||
export type { MouseEventCallbacks, MouseEvent, BasicReactWrapperProps, InteractionOptions, InteractiveNvlWrapperProps }; |
import type NVL from '@neo4j-nvl/core'; | ||
import type { ClickInteractionOptions, ClickInteractionCallbacks, HoverInteractionOptions, MultiSelectInteractionOptions, MultiSelectInteractionCallbacks, DragNodeInteractionCallbacks, HoverInteractionCallbacks, PanInteractionCallbacks, ZoomInteractionCallbacks, DrawInteractionCallbacks } from '@neo4j-nvl/interaction-handlers'; | ||
import type { ClickInteractionCallbacks, ClickInteractionOptions, DragNodeInteractionCallbacks, DrawInteractionCallbacks, HoverInteractionCallbacks, HoverInteractionOptions, MultiSelectInteractionCallbacks, MultiSelectInteractionOptions, PanInteractionCallbacks, ZoomInteractionCallbacks } from '@neo4j-nvl/interaction-handlers'; | ||
import React from 'react'; | ||
@@ -4,0 +4,0 @@ import type { BasicReactWrapperProps } from '../basic-wrapper/BasicNvlWrapper'; |
@@ -8,2 +8,2 @@ import { Node, Relationship } from '@neo4j-nvl/core'; | ||
declare const getNodeAttributeDifferences: (prevNodes: Node[], newNodes: Node[]) => Node[]; | ||
export { getNodeAttributeDifferences, getMapDifferences, }; | ||
export { getNodeAttributeDifferences, getMapDifferences }; |
@@ -1,2 +0,2 @@ | ||
import { isEqual, keyBy, transform, sortBy, keys } from 'lodash'; | ||
import { isEqual, keyBy, keys, sortBy, transform } from 'lodash'; | ||
const getMapDifferences = (prevGraphElements, newGraphElements) => { | ||
@@ -38,5 +38,5 @@ const prevMap = keyBy(prevGraphElements, 'id'); | ||
return { | ||
added: added.map(id => currentMap[id]), | ||
removed: removed.map(id => prevMap[id]), | ||
updated: updated.map(id => currentMap[id]) | ||
added: added.map((id) => currentMap[id]), | ||
removed: removed.map((id) => prevMap[id]), | ||
updated: updated.map((id) => currentMap[id]) | ||
}; | ||
@@ -47,3 +47,3 @@ }; | ||
return newNodes | ||
.map(nodeToUpdate => { | ||
.map((nodeToUpdate) => { | ||
const previousNode = prevNodeMap[nodeToUpdate.id]; | ||
@@ -59,4 +59,4 @@ if (!previousNode) { | ||
}) | ||
.filter(n => n && Object.keys(n).length > 1); | ||
.filter((n) => n && Object.keys(n).length > 1); | ||
}; | ||
export { getNodeAttributeDifferences, getMapDifferences, }; | ||
export { getNodeAttributeDifferences, getMapDifferences }; |
{ | ||
"name": "@neo4j-nvl/react", | ||
"version": "0.2.10", | ||
"version": "0.2.11", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN 'Neo4j Early Access Agreement - Visualization Library.pdf'", |
218765
532