Drag and Drop for sortable lists in Elm web apps with mouse support.
$ npm install -g elm elm-live
$ npm run watch
create : DnDList.Config a -> Msg -> DnDList.System a Msg
update: DnDList.Msg -> DnDList.Model -> List a -> ( DnDList.Model, List a )
dragEvents : DragIndex -> DragElementId -> List (Html.Attribute Msg)
dropEvents : DropIndex -> DropElementId -> List (Html.Attribute Msg)
ghostStyles : DnDList.Model -> List (Html.Attribute Msg)
info : DnDList.Model -> Maybe DnDList.Info
pseudocode type alias Config a =
{ beforeUpdate : DragIndex -> DropIndex -> List a -> List a
, movement : Free
| Horizontal
| Vertical
, listen : OnDrag
| OnDrop
, operation : InsertAfter
| InsertBefore
| Rotate
| Swap
| Unaltered
}
type alias Info =
{ dragIndex : Int
, dropIndex : Int
, dragElementId : String
, dropElementId : String
, dragElement : Browser.Dom.Element
, dropElement : Browser.Dom.Element
, startPosition : { x : Float, y : Float }
, currentPosition : { x : Float, y : Float }
}
- Risk Register by ProjectBalm is a risk management add-on for Atlassian Jira.
dnd-list is used in the risk model editor for re-ordering risk levels, and is even used to re-order the rows and columns of the risk matrix.
This package was inspired by the following shiny gems: