Skip to content

Commit

Permalink
feat: add some graph options
Browse files Browse the repository at this point in the history
  • Loading branch information
Ariel-Lau committed Jun 17, 2024
1 parent 7dc2470 commit faefa2b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/core/src/components/Graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ const XFlowGraph = (props: GraphOptions) => {
restrict,
restrictOptions,
connectionOptions,
onPortRendered,
onEdgeLabelRendered,
createCellView,
selectOptions,
keyboardOptions,
scroller,
Expand Down Expand Up @@ -67,6 +70,9 @@ const XFlowGraph = (props: GraphOptions) => {
magnetAvailable: magnetAvailableHighlightOptions,
magnetAdsorbed: magnetAdsorbedHighlightOptions,
},
onPortRendered,
onEdgeLabelRendered,
createCellView,
});

g.use(new Selection({ enabled: true, ...selectOptions }));
Expand Down
8 changes: 8 additions & 0 deletions packages/core/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ export interface GraphOptions {

// node & edge
connectionEdgeOptions?: Partial<EdgeOptions>;
onPortRendered?: (args: Options.OnPortRenderedArgs) => void;
onEdgeLabelRendered?: (args: Options.OnEdgeLabelRenderedArgs) => void;

// cell
createCellView?: (
this: Graph,
cell: Cell,
) => typeof CellView | (new (...args: any[]) => CellView) | null | undefined;

// interactive
embedable?: boolean;
Expand Down

0 comments on commit faefa2b

Please sign in to comment.