refactor(inrernals): use one prop for all internals

This commit is contained in:
moklick
2022-05-26 20:20:35 +02:00
parent 732d92d10b
commit ee7084b5dc
9 changed files with 35 additions and 30 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ import {
Transform,
XYPosition,
} from '../../types';
import { handleBoundsSymbol, rectToBox } from '../../utils';
import { internalsSymbol, rectToBox } from '../../utils';
export type CreateEdgeTypes = (edgeTypes: EdgeTypes) => EdgeTypesWrapped;
@@ -168,7 +168,7 @@ export function isEdgeVisible({
export function getNodeData(nodeInternals: NodeInternals, nodeId: string): [Rect, NodeHandleBounds | null, boolean] {
const node = nodeInternals.get(nodeId);
const handleBounds = node?.[handleBoundsSymbol] || null;
const handleBounds = node?.[internalsSymbol].handleBounds || null;
const isInvalid =
!node ||
+3 -3
View File
@@ -11,7 +11,7 @@ import {
ReactFlowState,
WrapNodeProps,
} from '../../types';
import { isParentSymbol, zSymbol } from '../../utils';
import { internalsSymbol } from '../../utils';
interface NodeRendererProps {
nodeTypes: NodeTypesWrapped;
@@ -118,8 +118,8 @@ const NodeRenderer = (props: NodeRendererProps) => {
isConnectable={isConnectable}
resizeObserver={resizeObserver}
dragHandle={node.dragHandle}
zIndex={node[zSymbol] ?? 0}
isParent={!!node[isParentSymbol]}
zIndex={node[internalsSymbol].z ?? 0}
isParent={!!node[internalsSymbol].isParent}
noDragClassName={props.noDragClassName}
noPanClassName={props.noPanClassName}
/>