EngageSoftware/elm-engage-common/5.3.0

NOTE: the latest version is 8.2.10

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

(a -> comparable)
-> Decoder (List a)
-> 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 -> Bool

Check if the ListData is editing

isEmpty : ListData state a comparable -> Bool

Check if the list is empty

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

Map an edit to a ListData

state
-> a
-> ListData state a comparable
-> ListData state a comparable

Get a new list data from new data

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

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

View helper for a ListData