Documentation ΒΆ
Index ΒΆ
- Constants
- type FlexBox
- func (r *FlexBox) AddRows(rows []*FlexBoxRow) *FlexBox
- func (r *FlexBox) ForceRecalculate()
- func (r *FlexBox) GetHeight() int
- func (r *FlexBox) GetRow(index int) (row FlexBoxRow, exists bool)
- func (r *FlexBox) GetWidth() int
- func (r *FlexBox) LockRowHeight(value int) *FlexBox
- func (r *FlexBox) MustGetRow(index int) FlexBoxRow
- func (r *FlexBox) NewRow() *FlexBoxRow
- func (r *FlexBox) Render() string
- func (r *FlexBox) Row(index int) *FlexBoxRow
- func (r *FlexBox) RowsLen() int
- func (r *FlexBox) SetHeight(value int) *FlexBox
- func (r *FlexBox) SetRows(rows []*FlexBoxRow) *FlexBox
- func (r *FlexBox) SetStyle(style lipgloss.Style) *FlexBox
- func (r *FlexBox) SetWidth(value int) *FlexBox
- func (r *FlexBox) StylePassing(value bool) *FlexBox
- func (r *FlexBox) UpdateRow(index int, row *FlexBoxRow) *FlexBox
- type FlexBoxCell
- func (r *FlexBoxCell) GetContent() string
- func (r *FlexBoxCell) GetHeight() int
- func (r *FlexBoxCell) GetStyle() lipgloss.Style
- func (r *FlexBoxCell) GetWidth() int
- func (r *FlexBoxCell) SetContent(content string) *FlexBoxCell
- func (r *FlexBoxCell) SetID(id string) *FlexBoxCell
- func (r *FlexBoxCell) SetMinWidth(value int) *FlexBoxCell
- func (r *FlexBoxCell) SetStyle(style lipgloss.Style) *FlexBoxCell
- type FlexBoxRow
- func (r *FlexBoxRow) AddCells(cells []*FlexBoxCell) *FlexBoxRow
- func (r *FlexBoxRow) Cell(index int) *FlexBoxCell
- func (r *FlexBoxRow) CellsLen() int
- func (r *FlexBoxRow) GetCellWithID(id string) (cell FlexBoxCell, exists bool)
- func (r *FlexBoxRow) GetCellWithIndex(index int) (cell FlexBoxCell, exists bool)
- func (r *FlexBoxRow) MustGetCellWithIndex(index int) FlexBoxCell
- func (r *FlexBoxRow) SetStyle(style lipgloss.Style) *FlexBoxRow
- func (r *FlexBoxRow) StylePassing(value bool) *FlexBoxRow
- func (r *FlexBoxRow) UpdateCellWithIndex(index int, cell *FlexBoxCell)
- type Ordered
- type Table
- func (r *Table) AddRows(rows [][]any) (*Table, error)
- func (r *Table) CursorDown() *Table
- func (r *Table) CursorLeft() *Table
- func (r *Table) CursorRight() *Table
- func (r *Table) CursorUp() *Table
- func (r *Table) GetCursorLocation() (int, int)
- func (r *Table) GetCursorValue() string
- func (r *Table) GetFilter() (columnIndex int, s string)
- func (r *Table) MustAddRows(rows [][]any) *Table
- func (r *Table) OrderByColumn(index int) *Table
- func (r *Table) Render() string
- func (r *Table) SetFilter(columnIndex int, s string) *Table
- func (r *Table) SetHeight(value int) *Table
- func (r *Table) SetMinWidth(values []int) *Table
- func (r *Table) SetRatio(values []int) *Table
- func (r *Table) SetStyles(styles map[TableStyleKey]lipgloss.Style) *Table
- func (r *Table) SetTypes(columnTypes ...any) (*Table, error)
- func (r *Table) SetWidth(value int) *Table
- func (r *Table) UnsetFilter() *Table
- type TableBadCellTypeError
- type TableBadTypeError
- type TableRowLenError
- type TableSingleType
- type TableSortingOrderKey
- type TableStyleKey
Constants ΒΆ
const ( TableSortingAscending = 0 TableSortingDescending = 1 )
Variables ΒΆ
This section is empty.
Functions ΒΆ
This section is empty.
Types ΒΆ
type FlexBox ΒΆ
type FlexBox struct {
// contains filtered or unexported fields
}
FlexBox responsive box grid insipred by CSS flexbox
func NewFlexBox ΒΆ
NewFlexBox initialize FlexBox object with defaults
func (*FlexBox) AddRows ΒΆ
func (r *FlexBox) AddRows(rows []*FlexBoxRow) *FlexBox
AddRows appends additional rows to the FlexBox
func (*FlexBox) ForceRecalculate ΒΆ
func (r *FlexBox) ForceRecalculate()
ForceRecalculate forces the recalculation for the box and all the rows
func (*FlexBox) GetRow ΒΆ
func (r *FlexBox) GetRow(index int) (row FlexBoxRow, exists bool)
GetRow returns the FlexBoxRow on the given index if it exists note: it does not return a pointer
func (*FlexBox) LockRowHeight ΒΆ
LockRowHeight sets the fixed height value for all the rows this will disable vertical scaling
func (*FlexBox) MustGetRow ΒΆ
func (r *FlexBox) MustGetRow(index int) FlexBoxRow
MustGetRow same as GetRow only panics if row does not exist
func (*FlexBox) NewRow ΒΆ
func (r *FlexBox) NewRow() *FlexBoxRow
NewRow initialize a new FlexBoxRow with width inherited from the FlexBox
func (*FlexBox) Render ΒΆ
Render initiates the recalculation of the rows dimensions(height) if the recalculate flag is on, and then it renders all the rows and combines them on the vertical axis
func (*FlexBox) Row ΒΆ
func (r *FlexBox) Row(index int) *FlexBoxRow
Row returns the FlexBoxRow on the given index if it exists note: forces the recalculation if found
func (*FlexBox) SetRows ΒΆ
func (r *FlexBox) SetRows(rows []*FlexBoxRow) *FlexBox
SetRows replace rows on the FlexBox
func (*FlexBox) StylePassing ΒΆ
StylePassing set whether the style should be passed to the rows
type FlexBoxCell ΒΆ
type FlexBoxCell struct {
// contains filtered or unexported fields
}
FlexBoxCell is a building block object of the FlexBox, it represents a single cell within a box cells are stacked horizontally
func NewFlexBoxCell ΒΆ
func NewFlexBoxCell(ratioX, ratioY int) *FlexBoxCell
NewFlexBoxCell initialize FlexBoxCell object with defaults
func (*FlexBoxCell) GetContent ΒΆ
func (r *FlexBoxCell) GetContent() string
GetContent returns the cells raw content
func (*FlexBoxCell) GetHeight ΒΆ
func (r *FlexBoxCell) GetHeight() int
GetHeight returns real height of the cell
func (*FlexBoxCell) GetStyle ΒΆ
func (r *FlexBoxCell) GetStyle() lipgloss.Style
GetStyle returns the copy of the cells current style
func (*FlexBoxCell) GetWidth ΒΆ
func (r *FlexBoxCell) GetWidth() int
GetWidth returns real width of the cell
func (*FlexBoxCell) SetContent ΒΆ
func (r *FlexBoxCell) SetContent(content string) *FlexBoxCell
SetContent sets the cells content
func (*FlexBoxCell) SetID ΒΆ
func (r *FlexBoxCell) SetID(id string) *FlexBoxCell
SetID sets the cells ID
func (*FlexBoxCell) SetMinWidth ΒΆ
func (r *FlexBoxCell) SetMinWidth(value int) *FlexBoxCell
SetMinWidth sets the cells minimum width, this will not disable responsivness
func (*FlexBoxCell) SetStyle ΒΆ
func (r *FlexBoxCell) SetStyle(style lipgloss.Style) *FlexBoxCell
SetStyle replaces the style, it unsets width/height related keys
type FlexBoxRow ΒΆ
type FlexBoxRow struct {
// contains filtered or unexported fields
}
FlexBoxRow is the container for the cells, this object has the least to do with the ratio of the construction as it takes all of the needed ratio information from the cell slice rows are stacked vertically
func (*FlexBoxRow) AddCells ΒΆ
func (r *FlexBoxRow) AddCells(cells []*FlexBoxCell) *FlexBoxRow
AddCells appends the cells to the row if the cell ID is not set it will default to the index of the cell
func (*FlexBoxRow) Cell ΒΆ
func (r *FlexBoxRow) Cell(index int) *FlexBoxCell
Cell returns the FlexBoxCell on the given index if it exists note: forces the recalculation if found
func (*FlexBoxRow) CellsLen ΒΆ
func (r *FlexBoxRow) CellsLen() int
CellsLen returns the len of the cells slice
func (*FlexBoxRow) GetCellWithID ΒΆ
func (r *FlexBoxRow) GetCellWithID(id string) (cell FlexBoxCell, exists bool)
GetCellWithID returns the cell with the given ID if existing
func (*FlexBoxRow) GetCellWithIndex ΒΆ
func (r *FlexBoxRow) GetCellWithIndex(index int) (cell FlexBoxCell, exists bool)
GetCellWithIndex returns the cell with the given index if existing note: it does not return a pointer
func (*FlexBoxRow) MustGetCellWithIndex ΒΆ
func (r *FlexBoxRow) MustGetCellWithIndex(index int) FlexBoxCell
MustGetCellWithIndex returns the cell with the given index if existing, panic if not note: it does not return a pointer
func (*FlexBoxRow) SetStyle ΒΆ
func (r *FlexBoxRow) SetStyle(style lipgloss.Style) *FlexBoxRow
SetStyle replaces the style, it unsets width/height related keys
func (*FlexBoxRow) StylePassing ΒΆ
func (r *FlexBoxRow) StylePassing(value bool) *FlexBoxRow
StylePassing set whether the style should be passed to the cells
func (*FlexBoxRow) UpdateCellWithIndex ΒΆ
func (r *FlexBoxRow) UpdateCellWithIndex(index int, cell *FlexBoxCell)
UpdateCellWithIndex replaces the cell on the given index if it exists if its not existing no changes will apply
type Table ΒΆ
type Table struct {
// contains filtered or unexported fields
}
Table responsive, x/y scrollable table that uses magic of FlexBox
func (*Table) AddRows ΒΆ
AddRows add multiple rows, will return error on the first instance of a row that does not match the type set on table will update rows only when there are no errors
func (*Table) CursorRight ΒΆ
CursorRight move table cursor right
func (*Table) GetCursorLocation ΒΆ
GetCursorLocation returns the current x,y position of the cursor
func (*Table) GetCursorValue ΒΆ
GetCursorValue returns the string of the cell under the cursor
func (*Table) GetFilter ΒΆ
GetFilter returns string used for filtering and the column index TODO: enable multi column filtering
func (*Table) MustAddRows ΒΆ
MustAddRows executes AddRows and panics if there is an error
func (*Table) OrderByColumn ΒΆ
OrderByColumn orders rows by a column with the index n, simple bubble sort, nothing too fancy does not apply when there is less than 2 row in a table TODO: this messes up numbering that one might use, implement automatic indexing of rows TODO: allow user to disable ordering
func (*Table) SetMinWidth ΒΆ
SetMinWidth replaces the minimum width slice, it has to be exactly the len of the headers/rows slices if it's not matching len it will trigger fatal error
func (*Table) SetRatio ΒΆ
SetRatio replaces the ratio slice, it has to be exactly the len of the headers/rows slices also each value have to be greater than 0, if either fails we panic
func (*Table) SetStyles ΒΆ
func (r *Table) SetStyles(styles map[TableStyleKey]lipgloss.Style) *Table
SetStyles allows overrides of styling elements of the table When only a partial set of overrides are provided, the default styling will be used
func (*Table) SetTypes ΒΆ
SetTypes sets the column type, setting this will remove all the rows so make sure you do it when instantiating Table object or add new rows after this, types have to be one of Ordered interface types
type TableBadCellTypeError ΒΆ
type TableBadCellTypeError struct {
// contains filtered or unexported fields
}
TableBadCellTypeError type of cell does not match type of column
func (TableBadCellTypeError) Error ΒΆ
func (e TableBadCellTypeError) Error() string
type TableBadTypeError ΒΆ
type TableBadTypeError struct {
// contains filtered or unexported fields
}
TableBadTypeError type does not match Ordered interface types
func (TableBadTypeError) Error ΒΆ
func (e TableBadTypeError) Error() string
type TableRowLenError ΒΆ
type TableRowLenError struct {
// contains filtered or unexported fields
}
TableRowLenError row length is not matching headers len
func (TableRowLenError) Error ΒΆ
func (e TableRowLenError) Error() string
type TableSingleType ΒΆ
TableSingleType is Table that is using only 1 type for rows allowing for easier AddRows with fewer errors
func NewTableSingleType ΒΆ
func NewTableSingleType[T Ordered](width, height int, columnHeaders []string) *TableSingleType[T]
NewTableSingleType initialize TableSingleType object with defaults
func (*TableSingleType[T]) AddRows ΒΆ
func (r *TableSingleType[T]) AddRows(rows [][]T) *TableSingleType[T]
func (*TableSingleType[T]) MustAddRows ΒΆ
func (r *TableSingleType[T]) MustAddRows(rows [][]T) *TableSingleType[T]
func (*TableSingleType[T]) SetTypes ΒΆ
func (r *TableSingleType[T]) SetTypes()
SetTypes overridden for TableSimple
type TableSortingOrderKey ΒΆ
type TableSortingOrderKey int
type TableStyleKey ΒΆ
type TableStyleKey int
const ( TableHeaderStyleKey TableStyleKey = iota TableRowsStyleKey TableRowsSubsequentStyleKey TableRowsCursorStyleKey TableCellCursorStyleKey )