added types for handles
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user