MackeyRMS / elm-ui-table / Table

Flexible helpers for constructing Tables

Construct a Table from a List of records with an id key


type Table record

init : List r -> Table r

sort : Column ctx record msg -> Table record -> Table record

desc : Table record -> Table record

preFilter : Column ctx r msg -> String -> Table r -> Table r

filtered : Maybe (record -> Basics.Bool) -> List (Column ctx record msg) -> Table record -> List record

Prepare the View for a Table giving it a Msg constructor that takes a Table


type View c ctx record msg

lined : { idPrefix : String } -> (Table record -> msg) -> Table record -> List (Column ctx record msg) -> View { can_add_body_row_attributes : (), can_add_header_row_attributes : (), can_add_table_attributes : () } ctx record msg

Make an elm-ui based table with sane defaults for a common use case

build : { idPrefix : String } -> (Table record -> msg) -> Table record -> List (Column ctx record msg) -> View WithAbilities ctx record msg

Make a raw elm-ui native table

Takes a Table returns Html

view : View c ctx record msg -> Element.WithContext.Element ctx msg

Phantom helpers


type alias WithAbilities =
{ can_add_table_attributes : ()
, can_add_header_row_attributes : ()
, can_add_body_row_attributes : ()
, can_add_row_borders : () 
}

attributes : List (Element.WithContext.Attribute ctx msg) -> View { c | can_add_table_attributes : () } ctx record msg -> View c ctx record msg

headRowAttributes : List (Element.WithContext.Attribute ctx msg) -> View { c | can_add_header_row_attributes : () } ctx record msg -> View c ctx record msg

bodyRowAttributes : (record -> List (Element.WithContext.Attribute ctx msg)) -> View { c | can_add_body_row_attributes : () } ctx record msg -> View c ctx record msg

withRowBorders : View { c | can_add_row_borders : () } ctx record msg -> View c ctx record msg

withStickyHeader : View c ctx record msg -> View c ctx record msg


type alias InfiniteListConf =
{ rowHeight : RowHeight
, containerHeight : Maybe WindowHeight
, howManyLengthsBelowTheFold : Basics.Int 
}


type alias RowHeight =
Length


type alias WindowHeight =
Length

infinite : InfiniteListConf -> View c ctx record msg -> View c ctx record msg

Filtering

keep : (r -> Basics.Bool) -> View c ctx r msg -> View c ctx r msg

Accessors

records : Table record -> List record