File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " @xrenders/xflow" ,
3- "version" : " 1.0.4-beta.2 " ,
3+ "version" : " 1.0.4-beta.4 " ,
44 "description" : " 一款功能强大、易用灵活的流程编辑器框架,帮助你轻松构建复杂的工作流和流程产品" ,
55 "keywords" : [
66 " xflow"
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export const useFlow = () => {
2424 fitView,
2525 setCenter,
2626 fitBounds,
27- toObject,
27+ toObject : _toObject ,
2828 getNodes : _getNodes ,
2929 getEdges,
3030 screenToFlowPosition,
@@ -33,19 +33,28 @@ export const useFlow = () => {
3333
3434 const { record } = useTemporalStore ( ) ;
3535
36- const getNodes = useMemoizedFn ( ( ) => {
37- const nodes = _getNodes ( ) ;
38- const result = nodes . map ( item => {
36+ const getNodes = useMemoizedFn ( ( _nodes : any ) => {
37+ const nodes = _nodes || _getNodes ( ) ;
38+ const result = nodes . map ( ( item : any ) => {
3939 const { data, ...rest } = item ;
4040 const { _nodeType, ...restData } = data ;
4141 return {
4242 ...rest ,
43- data : restData
43+ data : restData ,
44+ type : _nodeType
4445 }
4546 } ) ;
4647 return result ;
4748 } ) ;
4849
50+ const toObject = ( ) => {
51+ const { nodes, ...rest } = _toObject ( ) ;
52+ return {
53+ ...rest ,
54+ nodes : getNodes ( nodes )
55+ } ;
56+ } ;
57+
4958 const setNodes = useMemoizedFn ( ( nodes : FlowNode [ ] , isTransform = false ) => {
5059 storeApi . getState ( ) . setNodes ( nodes , isTransform ) ;
5160 } ) ;
You can’t perform that action at this time.
0 commit comments