This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
An EditableWebData represents an Editable value, along with WebData.
version 2.0.0
license BSD3
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 2.0.0
Committed At 2018-07-30 17:26:32 UTC
stoeffel/editable 1.2.0 <= v < 2.0.0 1.2.0
krisajenkins/remotedata 4.3.0 <= v < 5.0.0 4.5.0
elm-lang/html 2.0.0 <= v < 3.0.0 2.0.0
elm-lang/core 5.1.1 <= v < 6.0.0 5.1.1

README

Build Status

EditableWebData

An EditableWebData represents an Editable value, along with WebData.

Similar to the example in Gizra/elm-storage-key lets imagine a Todo list that can be edited. And lets assume that while a todo item is being edited, or while it's being saved, we'd like to keep showing the original value.

Here's a pattern we may use to solve this:

import EveryDictList
import StorageKey

type alias TodoItem =
    String


{-| Wrap our `TodoItem` with `EditableWebData`, thus making it have the ability
of having an "original" vs "new" values, and also maintain the `WebData` state.
-}
type alias EditableWebDataTodoItem =
    EditableWebData TodoItem


{-| The TodoItem ID is type safety.
-}
type TodoItemId
    = TodoItemId Int


{-| We wrap the `ArticleId` with the `StorageKey`.
-}
type alias StorageKeyTodoItem =
    StorageKey TodoItem


{-| We use `EveryDictList` as we want to maintain the order of the items.
-}
type alias EveryDictListTodoItems =
    EveryDictList StorageKeyArticle EditableWebDataTodoItem


type alias Todo =
    { label : String
    , items : EveryDictListTodoItems
    }

Installation

elm-package install Gizra/elm-editable-webdata

Tests

Install packages: npm install -g elm-test elm-verify-examples

Execute tests: ./execute-tests