Skip to content

Commit

Permalink
feat:表单关闭事件
Browse files Browse the repository at this point in the history
  • Loading branch information
jile1997 committed Jan 2, 2025
1 parent ef5ad22 commit 8e85ef2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/x-flow/src/XFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const XFlow: FC<FlowProps> = memo(props => {
const { settingMap, globalConfig,readOnly } = useContext(ConfigContext);
const [openPanel, setOpenPanel] = useState<boolean>(true);
const [openLogPanel, setOpenLogPanel] = useState<boolean>(true);
const { onNodeClick } = props;
const { onNodeClick,panel } = props;

useEffect(() => {
zoomTo(0.8);
Expand Down Expand Up @@ -341,6 +341,7 @@ const XFlow: FC<FlowProps> = memo(props => {
if (!activeNode?._status || !openLogPanel) {
setActiveNode(null);
}
panel.onClose && panel.onClose(activeNode?.id)
}}
node={activeNode}
data={activeNode?.values}
Expand Down
8 changes: 6 additions & 2 deletions packages/x-flow/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ export interface TControl{
// isConnectableEnd?:boolean
// }

export interface TPanel{
onClose:(activeNodeId:string)=>void
}

export interface FlowProps {
initialValues?: {
nodes: any[];
Expand All @@ -111,10 +115,10 @@ export interface FlowProps {
//handle?:THandle
};
logPanel?: TLogPanel; // 日志面板配置
readOnly?:boolean//只读模式
panel?:TPanel //表单配置面板
onNodeClick?: NodeMouseHandler;
onMenuItemClick: (itemInfo: ItemInfo,defaultAction:()=>void) => void;
readOnly?:boolean

}
interface ItemInfo {
key: 'copy' | 'paste' | 'delete' | string;
Expand Down

0 comments on commit 8e85ef2

Please sign in to comment.