File

src/drop-target-specification.ts

Description

The spec passed to SkyhookDndService.

Note the two type parameters. Both must represent plain JS objects. See the extended discussion of these type parameters at DragSourceSpec.

Index

Methods

Methods

Optional canDrop
canDrop(monitor: DropTargetMonitor)

Queries your component to determine whether an item can be dropped on this target.

NOTE: runs outside Angular change detection. This is for performance reasons. You shouldn't be making changes to your component here anyway. If you do change your component inside this callback, it may not appear immediately, and if you use NgZone.run() then you may experience performance degradation.

Default, when not specified, is true.

Parameters :
Name Type Optional
monitor DropTargetMonitor<Item | DropResult> No
Returns : boolean
Optional drop
drop(monitor: DropTargetMonitor)

Called when a compatible item is dropped on the target. You may either return nothing, or a plain object.

If you return an object, it is going to become the drop result and will be available to the drag source in its DragSourceSpec method as DropTargetMonitor. This is useful in case you want the source to perform different actions depending on which target received the drop. Otherwise, it is simpler to handle the dropped item here.

If you have nested drop targets, you can test whether a nested target has already handled drop by checking DropTargetMonitor. Both this method and the source's endDrag() method are good places to fire @ngrx/store actions.

This method will not be called if canDrop() is defined and returns false.

Parameters :
Name Type Optional
monitor DropTargetMonitor<Item | DropResult> No
Returns : DropResult | void
Optional hover
hover(monitor: DropTargetMonitor)

Called frequently while the mouse hovers over the owner drop target while dragging a relevant item.

Parameters :
Name Type Optional
monitor DropTargetMonitor<Item | DropResult> No
Returns : void

result-matching ""

    No results matching ""