Skip to content

Commit

Permalink
✨ feat(pro-flow-editor): 导出 api (#14)
Browse files Browse the repository at this point in the history
* fix: support disable

* fix: 导出更多的 api 支持
  • Loading branch information
chenshuai2144 committed Oct 7, 2023
1 parent 04ea771 commit d00cc7a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
7 changes: 6 additions & 1 deletion src/FlowEditor/container/index.tsx
Expand Up @@ -10,15 +10,20 @@ export interface FlowEditorProps extends StoreUpdaterProps, FlowEditorAppProps {
}

const FlowEditor = forwardRef<any, FlowEditorProps>(
({ devtools, onNodesInit, defaultViewport, nodeTypes, ...res }, ref) => {
(
{ devtools, onNodesInit, defaultViewport, contextMenuEnabled, flowProps, nodeTypes, ...res },
ref,
) => {
return (
<HotkeysProvider initiallyActiveScopes={['flow-editor']}>
<FlowEditorProvider showDevtools={devtools}>
<App
ref={ref}
nodeTypes={nodeTypes}
onNodesInit={onNodesInit}
contextMenuEnabled={contextMenuEnabled}
defaultViewport={defaultViewport}
flowProps={flowProps}
/>
<StoreUpdater {...res} />
</FlowEditorProvider>
Expand Down
3 changes: 2 additions & 1 deletion src/FlowEditor/hooks/useFlowEditor.ts
@@ -1,6 +1,6 @@
import { useMemoizedFn } from 'ahooks';
import { useMemo } from 'react';

import { ReactFlowInstance } from 'reactflow';
import { useStoreApi } from '../store';
import { PublicStoreAction } from '../store/slices';
import { FlattenEdges, FlattenNodes } from '../types';
Expand All @@ -9,6 +9,7 @@ export interface FlowEditorInstance extends PublicStoreAction {
getFlattenNodes: () => FlattenNodes;
getFlattenEdges: () => FlattenEdges;
getSelectedKeys: () => string[];
reactflow?: ReactFlowInstance;
}

export const useFlowEditor = (): FlowEditorInstance => {
Expand Down
1 change: 0 additions & 1 deletion src/FlowEditor/store/slices/index.ts
@@ -1,7 +1,6 @@
import { EdgesSlice, PublicEdgesAction } from './edgesSlice';
import { GeneralActionSlice, PublicGeneralAction } from './generalActionSlice';
import { NodesSlice, PublicNodesAction } from './nodesSlice';

export { edgesSlice } from './edgesSlice';
export { generalActionSlice } from './generalActionSlice';
export { nodesSlice } from './nodesSlice';
Expand Down
30 changes: 23 additions & 7 deletions tsconfig.json
@@ -1,5 +1,10 @@
{
"include": ["src", "tests", ".dumi/**/*", ".dumirc.ts", "*.ts"],
"include": [
"src",
"tests",
".dumirc.ts",
"*.ts"
],
"compilerOptions": {
"strict": true,
"declaration": true,
Expand All @@ -8,12 +13,23 @@
"resolveJsonModule": true,
"jsx": "react-jsx",
"baseUrl": ".",
"types": ["vitest/globals"],
"types": [
"vitest/globals"
],
"paths": {
"@@/*": [".dumi/tmp/*"],
"@/*": ["./src/*"],
"@ant-design/pro-flow": ["src"],
"@ant-design/pro-flow/*": ["src/*", "*"]
"@@/*": [
".dumi/tmp/*"
],
"@/*": [
"./src/*"
],
"@ant-design/pro-flow": [
"src"
],
"@ant-design/pro-flow/*": [
"src/*",
"*"
]
}
}
}
}

0 comments on commit d00cc7a

Please sign in to comment.