refactor(reactflow): add node resizer package
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
import { memo, FC } from 'react';
|
import { memo, FC } from 'react';
|
||||||
import { Handle, Position, NodeProps } from 'reactflow';
|
import { Handle, Position, NodeProps, NodeResizeControl } from 'reactflow';
|
||||||
|
|
||||||
import { NodeResizeControl } from '@reactflow/node-resizer';
|
|
||||||
import '@reactflow/node-resizer/dist/style.css';
|
|
||||||
import ResizeIcon from './ResizeIcon';
|
import ResizeIcon from './ResizeIcon';
|
||||||
|
|
||||||
const controlStyle = {
|
const controlStyle = {
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
import { memo, FC } from 'react';
|
import { memo, FC } from 'react';
|
||||||
import { Handle, Position, NodeProps } from 'reactflow';
|
import { Handle, Position, NodeProps, NodeResizer } from 'reactflow';
|
||||||
import { NodeResizer } from '@reactflow/node-resizer';
|
|
||||||
|
|
||||||
import '@reactflow/node-resizer/dist/style.css';
|
|
||||||
|
|
||||||
const DefaultResizerNode: FC<NodeProps> = ({ data, selected }) => {
|
const DefaultResizerNode: FC<NodeProps> = ({ data, selected }) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
import { memo, FC } from 'react';
|
import { memo, FC } from 'react';
|
||||||
import { Handle, Position, NodeProps } from 'reactflow';
|
import { Handle, Position, NodeProps, NodeResizeControl } from 'reactflow';
|
||||||
import { NodeResizeControl } from '@reactflow/node-resizer';
|
|
||||||
|
|
||||||
import '@reactflow/node-resizer/dist/style.css';
|
|
||||||
|
|
||||||
const HorizontalResizerNode: FC<NodeProps> = ({ data }) => {
|
const HorizontalResizerNode: FC<NodeProps> = ({ data }) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
import { memo, FC } from 'react';
|
import { memo, FC } from 'react';
|
||||||
import { Handle, Position, NodeProps } from 'reactflow';
|
import { Handle, Position, NodeProps, NodeResizeControl } from 'reactflow';
|
||||||
|
|
||||||
import { NodeResizeControl } from '@reactflow/node-resizer';
|
|
||||||
import '@reactflow/node-resizer/dist/style.css';
|
|
||||||
|
|
||||||
const CustomNode: FC<NodeProps> = ({ id, data }) => {
|
const CustomNode: FC<NodeProps> = ({ id, data }) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import CustomResizer from './CustomResizer';
|
|||||||
import VerticalResizer from './VerticalResizer';
|
import VerticalResizer from './VerticalResizer';
|
||||||
import HorizontalResizer from './HorizontalResizer';
|
import HorizontalResizer from './HorizontalResizer';
|
||||||
|
|
||||||
|
import 'reactflow/dist/style.css';
|
||||||
|
|
||||||
const nodeTypes = {
|
const nodeTypes = {
|
||||||
defaultResizer: DefaultResizer,
|
defaultResizer: DefaultResizer,
|
||||||
customResizer: CustomResizer,
|
customResizer: CustomResizer,
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
"@reactflow/controls": "workspace:*",
|
"@reactflow/controls": "workspace:*",
|
||||||
"@reactflow/core": "workspace:*",
|
"@reactflow/core": "workspace:*",
|
||||||
"@reactflow/minimap": "workspace:*",
|
"@reactflow/minimap": "workspace:*",
|
||||||
|
"@reactflow/node-resizer": "workspace:*",
|
||||||
"@reactflow/node-toolbar": "workspace:*"
|
"@reactflow/node-toolbar": "workspace:*"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
@import '@reactflow/core/dist/base.css';
|
@import '@reactflow/core/dist/base.css';
|
||||||
@import '@reactflow/controls/dist/style.css';
|
@import '@reactflow/controls/dist/style.css';
|
||||||
@import '@reactflow/minimap/dist/style.css';
|
@import '@reactflow/minimap/dist/style.css';
|
||||||
|
@import '@reactflow/node-resizer/dist/style.css';
|
||||||
|
|||||||
@@ -3,5 +3,6 @@ export * from '@reactflow/minimap';
|
|||||||
export * from '@reactflow/controls';
|
export * from '@reactflow/controls';
|
||||||
export * from '@reactflow/background';
|
export * from '@reactflow/background';
|
||||||
export * from '@reactflow/node-toolbar';
|
export * from '@reactflow/node-toolbar';
|
||||||
|
export * from '@reactflow/node-resizer';
|
||||||
|
|
||||||
export { ReactFlow as default } from '@reactflow/core';
|
export { ReactFlow as default } from '@reactflow/core';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
@import '@reactflow/core/dist/style.css';
|
@import '@reactflow/core/dist/style.css';
|
||||||
@import '@reactflow/controls/dist/style.css';
|
@import '@reactflow/controls/dist/style.css';
|
||||||
@import '@reactflow/minimap/dist/style.css';
|
@import '@reactflow/minimap/dist/style.css';
|
||||||
|
@import '@reactflow/node-resizer/dist/style.css';
|
||||||
|
|||||||
Generated
+2
@@ -284,6 +284,7 @@ importers:
|
|||||||
'@reactflow/core': workspace:*
|
'@reactflow/core': workspace:*
|
||||||
'@reactflow/eslint-config': workspace:*
|
'@reactflow/eslint-config': workspace:*
|
||||||
'@reactflow/minimap': workspace:*
|
'@reactflow/minimap': workspace:*
|
||||||
|
'@reactflow/node-resizer': workspace:^2.1.0
|
||||||
'@reactflow/node-toolbar': workspace:*
|
'@reactflow/node-toolbar': workspace:*
|
||||||
'@reactflow/rollup-config': workspace:*
|
'@reactflow/rollup-config': workspace:*
|
||||||
'@reactflow/tsconfig': workspace:*
|
'@reactflow/tsconfig': workspace:*
|
||||||
@@ -296,6 +297,7 @@ importers:
|
|||||||
'@reactflow/controls': link:../controls
|
'@reactflow/controls': link:../controls
|
||||||
'@reactflow/core': link:../core
|
'@reactflow/core': link:../core
|
||||||
'@reactflow/minimap': link:../minimap
|
'@reactflow/minimap': link:../minimap
|
||||||
|
'@reactflow/node-resizer': link:../node-resizer
|
||||||
'@reactflow/node-toolbar': link:../node-toolbar
|
'@reactflow/node-toolbar': link:../node-toolbar
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@reactflow/eslint-config': link:../../tooling/eslint-config
|
'@reactflow/eslint-config': link:../../tooling/eslint-config
|
||||||
|
|||||||
Reference in New Issue
Block a user