added types for handles

This commit is contained in:
peterkogo
2024-01-15 17:48:29 +01:00
parent 8c32b426f4
commit 0f8e13e0cf
2 changed files with 30 additions and 0 deletions
+13
View File
@@ -23,13 +23,26 @@ export type ConnectionData = {
};
export type HandleComponentProps = {
/** type of the handle
* @example HandleType.Source, HandleType.Target
*/
type: HandleType;
/** position of the handle
* @example Position.TopLeft, Position.TopRight,
* Position.BottomLeft, Position.BottomRight
*/
position?: Position;
/** id of the handle
* @remarks optional if there is only one handle of this type
*/
id?: string;
class?: string;
style?: string;
/** should you be able to connect from/to this handle */
isConnectable?: boolean;
/** shoould you be able to connect from this handle */
isConnectableStart?: boolean;
/** should you be able to connect to this handle */
isConnectableEnd?: boolean;
onconnect?: (connections: Connection[]) => void;
ondisconnect?: (connections: Connection[]) => void;
+17
View File
@@ -27,12 +27,29 @@ export type ConnectionHandle = {
};
export type HandleProps = {
/** type of the handle
* @example HandleType.Source, HandleType.Target
*/
type: HandleType;
/** position of the handle
* @example Position.TopLeft, Position.TopRight,
* Position.BottomLeft, Position.BottomRight
*/
position: Position;
/** should you be able to connect to/from this handle */
isConnectable?: boolean;
/** shoud you be able to connect from this handle */
isConnectableStart?: boolean;
/** should you be able to connect to this handle */
isConnectableEnd?: boolean;
/** callback called when connection is made */
onConnect?: OnConnect;
/** callback if connection is valid
* @remarks connection becomes an edge if isValidConnection returns true
*/
isValidConnection?: IsValidConnection;
/** id of the handle
* @remarks optional if there is only one handle of this type
*/
id?: string;
};