mercurymedia/elm-smart-select/8.0.0

MultiSelectRemote

A select component for multi selection with remote data.

Architecture

type SmartSelect msg a

The opaque type representing a particular smart select instance.

type Msg a

Opaque type representing cases to be passed to MultiSelectRemote.update

{ selectionMsg : ( List a, Msg a ) -> msg
, internalMsg : Msg a -> msg
, idPrefix : String
}
-> SmartSelect msg a

Instantiates and returns a smart select.

  • selectionMsg takes a function that expects a tuple representing the list of selections and a MultiSelectRemote.Msg and returns an externally defined msg for handling selection.
  • internalMsg takes a function that expects a MultiSelectRemote.Msg and returns an externally defined msg.
  • idPrefix takes a string with a unique prefix
{ selected : List a
, optionLabelFn : a -> String
, viewSelectedOptionFn : a -> Html msg
, remoteSettings : RemoteSettings msg
}
-> SmartSelect msg a
-> Html msg

The smart select view for selecting multiple options at a time with remote data.

  • selected takes a list of the currently selected entities.
  • optionLabelFn takes a function that expects an instance of the data being selected from and returns a string naming/labeling the instance, i.e. if it is a "Product" being selected, the label may be "Garden Hose".
  • viewSelectedOptionFn takes a function that expects and instance of the data being selected from and returns html to render a selected option.
  • remoteSettings takes the remoteSettings record (see the RemoteSettings type)
viewCustom : Config msg a -> SmartSelect msg a -> Html msg

The smart select custom view for selecting multiple options at a time with remote data. You have to pass a custom configuration here.

subscriptions : RemoteSettings msg -> SmartSelect msg a -> Sub msg

Events external to the smart select to which it is subscribed.

Msg a
-> RemoteSettings msg
-> RemoteQueryAttrs a
-> SmartSelect msg a
-> ( SmartSelect msg a, Cmd msg )

Update the provided smart select and receive the updated select instance and a cmd to run.

updatePosition : SmartSelect msg a -> ( SmartSelect msg a, Cmd msg )

Triggers an update of the provided smart select's alignment