MadonnaMat/elm-select-two/4.0.0

NOTE: the latest version is 6.0.1

Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: no fork with tag 4.0.0 found (6 same-name repos checked); https://github.com/MadonnaMat/elm-select-two has tag 4.0.0, but not a package Elm could build from it; https://github.com/MadonnaMat/elm-select-two commit dcad29ab1afb630222dcf6f210ed489ba22ef7ad (the tag's commit when Software Heritage visited) has tag 4.0.0, but not a package Elm could build from it; no cached copy. Use another version.

Details

SelectTwo.Types

SelectTwo Types

Types

type alias SelectTwoConfig msg =
{ defaults : List (SelectTwoOption msg)
, id_ : String
, list : List (GroupSelectTwoOption msg)
, clearMsg : Maybe (Maybe msg -> msg)
, showSearch : Bool
, width : String
, placeholder : String
, disabled : Bool
, multiSelect : Bool
, noResultsMessage : Maybe String
, ajax : Bool
, delay : Float
, closeOnClear : Bool
}

Config for SelectTwo used when initializing your select2 box

type SelectTwoMsg msg
= SelectTwoTrigger (SelectTwoDropdown msg)
| SelectTwoOpen (SelectTwoDropdown msg) (Result Error Element)
| SelectTwoHovered (Maybe msg)
| SelectTwoSelected (Maybe msg)
| SetSelectTwoSearch String
| DelayedSelectTwoAjax String
| STRes (Result Error ())
| STMsg msg
| STNull
| SentAjax String AjaxParams Bool
| ResultScroll ScrollInfo

Command Messages for SelectTwo

type alias Model model msg =
{ model | selectTwo : Maybe (SelectTwo msg) }

Model structure needed for selectTwo, all records using selectTwo should have this structure

type alias SelectTwo msg =
{ dropdown : SelectTwoDropdown msg
, hovered : Maybe msg
, search : Maybe String
, list : List (GroupSelectTwoOption msg)
, ajax : Bool
, id_ : String
, ajaxParams : Maybe AjaxParams
}

Structure created in users model when select2 is activated

type alias SelectTwoDropdown msg =
{ id_ : String
, defaults : List (SelectTwoOption msg)
, list : List (GroupSelectTwoOption msg)
, showSearch : Bool
, x : Float
, y : Float
, width : Float
, ajax : Bool
, delay : Float
, noResultsMessage : Maybe String
}

Data to generate the dropdown

type alias GroupSelectTwoOption msg =
( String, List (SelectTwoOption msg) )

Grouped SelectTwoOption, first option in the tuple is the name of the group

type alias SelectTwoOption msg =
( Maybe msg, String, Bool )

Rows in a select table, first option is the command message to be sent, second is the html to be displayed and the string to search on, and the third is if it is disabled or not

type alias AjaxParams =
{ page : Int
, term : String
, more : Bool
, loading : Bool
}

Parameters used in ajax calls

type alias ScrollInfo =
{ scrollHeight : Int
, scrollTop : Int
}