class

Term2::Components::Table

Inherits Term2::Model < Reference < Object

Constants

HEADER_ROW = -1

HeaderRow constant used in StyleFunc to identify the header row

Constructors

build(*options : Option) : Table
Source
new(columns : Array(Column | Tuple(String, Int32)) = [] of Column, rows : Array(Row) = [] of Row, width : Int32 = 0, height : Int32 = 0, id : String = "")
Source
new(width : Int32 = 0, height : Int32 = 0, & : Table -> Nil)
Source

Class methods

default_filter(term : String, targets : Array(Row)) : Array(FilteredRow)
Source
default_styles
Source
with_columns(cols : Array(Column)) : Option
Source
with_height(h : Int32) : Option
Source
with_rows(rows : Array(Row)) : Option
Source
with_styles(s : Styles) : Option
Source
with_width(w : Int32) : Option
Source

Instance methods

blur

Blur (unfocus) this model's zone.

Source
border

Border configuration

Source
border=(border : Border)

Border configuration

Source
border_bottom
Source
border_bottom=(border_bottom : Bool)
Source
border_column
Source
border_column=(border_column : Bool)
Source
border_header
Source
border_header=(border_header : Bool)
Source
border_left
Source
border_left=(border_left : Bool)
Source
border_right
Source
border_right=(border_right : Bool)
Source
border_row
Source
border_row=(border_row : Bool)
Source
border_style
Source
border_style=(border_style : Style)
Source
border_top
Source
border_top=(border_top : Bool)
Source
cell_style
Source
cell_style=(s : Style)
Source
column(title : String, width : Int32)
Source
columns
Source
columns=(columns : Array(Column))
Source
cursor
Source
cursor=(cursor : Int32)
Source
filter_func
Source
filter_func=(filter_func : FilterFunc)
Source
filter_text
Source
filter_text=(text : String)
Source
focus

Focus this model's zone.

Source
focused?

Whether this model is currently focused.

Source
goto_bottom
Source
goto_top
Source
handle_key(msg : KeyMsg)
Source
header_style

Legacy style properties mapped to styles object

Source
header_style=(s : Style)
Source
height

Total height including header + viewport. If 0, uses Bubble Tea defaults.

Source
height=(h : Int32)

Total height including header + viewport. If 0, uses Bubble Tea defaults.

Source
id=(id : String)
Source
key_map
Source
key_map=(key_map : KeyMap)
Source
move_cursor(delta : Int32)
Source
move_down(n : Int32)
Source
move_up(n : Int32)
Source
render_header
Source
render_row(row : Row, row_idx : Int32, selected : Bool) : String

Public for testing

Source
row(values : Array(String))
Source
row(*values : String)
Source
rows
Source
rows=(rows : Array(Row))
Source
selected_row
Source
selected_style
Source
selected_style=(s : Style)
Source
style_func
Source
style_func=(style_func : StyleFunc | Nil)
Source
styles

Styles

Source
styles=(styles : Styles)

Styles

Source
update(msg : Msg) : Tuple(Table, Cmd)

Update is called when a message is received. Use it to inspect the message and, in response, update the model and/or send a command.

Source
update_viewport
Source
view

View renders the program's UI, which is just a string. The view is rendered after every Update.

Source
viewport

Components

Source
viewport=(viewport : Viewport)

Components

Source
visible_rows
Source
width
Source
width=(width : Int32)
Source

Nested types