MackeyRMS/elm-ui-table/1.0.1

NOTE: the latest version is 1.1.4

Table

Flexible helpers for constructing Tables

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

init : List r -> Table r
sort : Column ctx record msg -> Table record -> Table record
preFilter : Column ctx r msg -> String -> Table r -> Table r
Maybe (record -> Bool)
-> List (Column ctx record msg)
-> Table record
-> List record
type Table record

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

type View c ctx record msg
{ 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

{ 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 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 : ()
}
List (Attribute ctx msg)
-> View { c | can_add_table_attributes : () } ctx record msg
-> View c ctx record msg
List (Attribute ctx msg)
-> View { c | can_add_header_row_attributes : () } ctx record msg
-> View c ctx record msg
(record -> List (Attribute ctx msg))
-> View { c | can_add_body_row_attributes : () } ctx record msg
-> View c ctx record msg
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 : Int
}
type alias RowHeight =
Length
type alias WindowHeight =
Length
infinite : InfiniteListConf -> View c ctx record msg -> View c ctx record msg

Filtering

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

Accessors

records : Table record -> List record