PaletteComponentProps
Props for the PaletteComponent
Properties
allowClickToAdd?
optionalallowClickToAdd:boolean
When in draw mode, allow addition of new vertices simply by clicking, instead of requiring a shape be drawn. (When this is true, the drawing method also still works)
allowDropOnCanvas?
optionalallowDropOnCanvas:boolean
Whether or not to allow drop on whitespace in the canvas. Defaults to true.
allowDropOnEdge?
optionalallowDropOnEdge:boolean
Whether or not to allow drop on edge. Defaults to false.
allowDropOnGroup?
optionalallowDropOnGroup:boolean
Whether or not to allow drop on existing vertices. Defaults to true.
allowDropOnNode?
optionalallowDropOnNode:boolean
Defaults to false. Allows items to be dropped onto nodes in the canvas. If this is true and an element is dropped onto a node, the result is the same as if the element has been dropped onto whitespace. Note that when this is false and the user has dragged something over a node, the drag item is still not considered to be over the canvas, and releasing the mouse button at that time will not cause a new node to be added. Use ignoreDropOnNode if that's the behaviour you want.
allowRotation?
optionalallowRotation:boolean
Whether or not to allow rotation of elements being dragged. Defaults to true.
autoEdgeConnect?
optionalautoEdgeConnect:boolean|AutoEdgeConnectOptions
If true, the palette will automatically connect a new vertex being dragged onto the canvas to existing vertices, if the shape definitions for the new vertex and/or the existing vertices have source/target elements.
canvasDropFilter?
optionalcanvasDropFilter:CanvasDropFilter
Optional filter to test if objects may be dropped on the canvas.
className?
optionalclassName:string
Optional extra css classes to set on the element
clickToAddOnly?
optionalclickToAddOnly:boolean
This flag relates to "draw" mode, and defaults to false. When true, the palette only supports click to draw new vertices, not drag. This flag is forced to true if the associated UI does not have useModelForSizes set, since there is no point in allowing a user to drag a vertex to some size if its not going to be honoured. When you set this flag and associated UI does have useModelForSizes set, the palette will use default sizes for new nodes/groups.
dataGenerator?
optionaldataGenerator:DataGeneratorFunction
Function to use to get a dataset for an item that is being dragged/has been tapped. If omitted, Visually JS will use a default data generator that extracts data values from any data-vjs-*** attribute on the element being dragged.
dragSize?
optionaldragSize:Size
Optional size to use for elements dragged from the palette; used in drag mode only.
groupIdentifier?
optionalgroupIdentifier:GroupIdentifierFunction
Function to use to determine whether an item that is being dragged/has been tapped represents a group.
ignoreDropOnNode?
optionalignoreDropOnNode:boolean
Defaults to false. When true, the palette treats nodes as if they are part of the canvas - a user can drag new items on top of existing nodes and the new item will be added to the canvas. If you want to force your users to drop on canvas whitespace, don't set this. Note that this flag will force allowDropOnNode to false.
mode?
optionalmode:PaletteMode
Mode to operate in - 'drag', 'tap' or 'draw'. Defaults to 'drag'.
onVertexAdded?
optionalonVertexAdded:OnVertexAddedCallback
Optional callback that will be invoked after a new vertex has been dropped and added to the dataset.
Param
rotationSpeed?
optionalrotationSpeed:number
The number of milliseconds required to complete a full rotation of an element when the trigger key is held down. Defaults to 2000.
selectAfterAdd?
optionalselectAfterAdd:boolean
Defaults to false. When true, a newly added vertex is set as the model's current selection.
selector?
optionalselector:string
CSS 3 selector identifying what child elements of container are draggable/can be tapped. Optional. If omitted, a default of [data-vjs-type] will be used.
showGroups?
optionalshowGroups:boolean
Whether or not to show groups in the palette. Defaults to true.
surface?
optionalsurface:Surface
The surface to attach to. Optional: this component can derive a surface from a SurfaceProvider or SurfaceComponent. You'll only need this in certain advanced scenarios.
typeGenerator?
optionaltypeGenerator:TypeGeneratorFunction
Function to use to get the type of an item that is being dragged/has been tapped.