EngageSoftware / elm-engage-common / Engage.ListData

ListData


type ListData state a comparable
    = ListData (Dict comparable a) (Edit state a)

A ListData type


type Edit state a
    = NoEdit
    | Edit state a

An Edit type

cancelEdit : ListData state a comparable -> ListData state a comparable

Cancel an edit

decoder : (a -> comparable) -> Json.Decode.Decoder (List a) -> Json.Decode.Decoder (ListData state a comparable)

ListData decoder

getDict : ListData state a comparable -> Dict comparable a

Get the dict from the list data

editView : (state -> a -> Html msg) -> ListData state a comparable -> Html msg

Edit view helper

empty : ListData state a comparable

Get an empty ListData

fromList : (a -> comparable) -> List a -> ListData state a comparable

Get a ListData from a List

getEdit : ListData state a comparable -> Maybe ( state, a )

Get the edit of the ListData

isEditing : ListData state a comparable -> Basics.Bool

Check if the ListData is editing

isEmpty : ListData state a comparable -> Basics.Bool

Check if the list is empty

mapEdit : (state -> a -> ( state, a )) -> ListData state a comparable -> ListData state a comparable

Map an edit to a ListData

newData : state -> a -> ListData state a comparable -> ListData state a comparable

Get a new list data from new data

setEdit : state -> comparable -> ListData state a comparable -> ListData state a comparable

Set the edit of the ListData

setState : state -> ListData state a comparable -> ListData state a comparable

Set the editing state

view : (a -> comparable) -> (a -> comparable) -> (a -> Html msg) -> ListData state a comparable -> List (Html msg)

View helper for a ListData