MadonnaMat / elm-select-two / 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 : Basics.Bool
, width : String
, placeholder : String
, disabled : Basics.Bool
, multiSelect : Basics.Bool
, noResultsMessage : Maybe String
, ajax : Basics.Bool
, delay : Basics.Float
, closeOnClear : Basics.Bool 
}

Config for SelectTwo used when initializing your select2 box


type SelectTwoMsg msg
    = SelectTwoTrigger (SelectTwoDropdown msg)
    | SelectTwoOpen (SelectTwoDropdown msg) (Result Browser.Dom.Error Browser.Dom.Element)
    | SelectTwoHovered (Maybe msg)
    | SelectTwoSelected (Maybe msg)
    | SetSelectTwoSearch String
    | DelayedSelectTwoAjax String
    | STRes (Result Browser.Dom.Error ())
    | STMsg msg
    | STNull
    | SentAjax String AjaxParams Basics.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 : Basics.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 : Basics.Bool
, x : Basics.Float
, y : Basics.Float
, width : Basics.Float
, ajax : Basics.Bool
, delay : Basics.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
, Basics.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 : Basics.Int
, term : String
, more : Basics.Bool
, loading : Basics.Bool 
}

Parameters used in ajax calls


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