refactor(lib): use react 18

This commit is contained in:
moklick
2022-04-11 16:11:14 +02:00
parent 97c8316f8d
commit 607e8061c9
21 changed files with 129 additions and 513 deletions
+2 -2
View File
@@ -1,9 +1,9 @@
import React, { memo, useRef, useState, useEffect, FC } from 'react';
import React, { memo, useRef, useState, useEffect, FC, PropsWithChildren } from 'react';
import cc from 'classcat';
import { EdgeTextProps, Rect } from '../../types';
const EdgeText: FC<EdgeTextProps> = ({
const EdgeText: FC<PropsWithChildren<EdgeTextProps>> = ({
x,
y,
label,
+1 -1
View File
@@ -140,7 +140,7 @@ export default (EdgeComponent: ComponentType<EdgeProps>) => {
const handleEdgeUpdater = useCallback(
(event: React.MouseEvent<SVGGElement, MouseEvent>, isSourceHandle: boolean) => {
const nodeId = isSourceHandle ? target : source;
const handleId = isSourceHandle ? targetHandleId : sourceHandleId;
const handleId = (isSourceHandle ? targetHandleId : sourceHandleId) || null;
const handleType = isSourceHandle ? 'target' : 'source';
const isValidConnection = () => true;
const isTarget = isSourceHandle;
+1
View File
@@ -232,6 +232,7 @@ export default (NodeComponent: ComponentType<NodeProps>) => {
]);
return (
// @ts-ignore
<DraggableCore
onStart={onDragStart}
onDrag={onDrag}
+1
View File
@@ -113,6 +113,7 @@ function NodesSelection({
return (
<div className={cc(['react-flow__nodesselection', 'react-flow__container', noPanClassName])} style={style}>
{/* @ts-ignore */}
<DraggableCore
scale={tScale}
grid={grid}