xtui

package
v0.0.0-...-fb2e7cc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EmptyCell represents an empty cell in the table.
	EmptyCell = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Table

type Table struct {
	*widgets.Table

	//Rows are the rows of the table.
	Rows TableRows

	// colors which will be used to paint the table rows.
	Colors struct {
		// default color of each row
		Text termui.Color
		// text color of the selected row
		SelectedRowFg termui.Color
		// row color of the selected row
		SelectedRowBg termui.Color
	}
	// contains filtered or unexported fields
}

Table is extending the Table in the termui/v3/widgets/ package to support scrolling/filtering.

func NewTable

func NewTable(lightTheme bool) *Table

NewTable returns a default instance of xtui.Table.

func (*Table) AppendToFilter

func (t *Table) AppendToFilter(filter string)

AppendToFilter updates the filter of the table.

func (*Table) ColumnWidths

func (t *Table) ColumnWidths() ([]int, error)

ColumnWidths returns the column widths of the table.

func (*Table) Draw

func (t *Table) Draw(buf *termui.Buffer)

Draw extends the method Draw from tui.Table to also include filtering.

func (*Table) Filter

func (t *Table) Filter() string

Filter returns the filter of the table.

func (*Table) InitFilter

func (t *Table) InitFilter(column, rowsPerEntry int)

InitFilter initializes the table to support filtering for rows

func (*Table) PageDown

func (t *Table) PageDown()

PageDown skips to the next page

func (*Table) PageUp

func (t *Table) PageUp()

PageUp skips to the previous page

func (*Table) ReduceFilter

func (t *Table) ReduceFilter(n int)

ReduceFilter removes the last n bytes written.

func (*Table) ScrollDown

func (t *Table) ScrollDown()

ScrollDown scrolls the table one row down

func (*Table) ScrollUp

func (t *Table) ScrollUp()

ScrollUp scrolls the table one row up

func (*Table) SetRect

func (t *Table) SetRect(x, y, x1, y2 int)

SetRect resize the table, and correctly sets the height of the table. x,y : top left corner x1,y2 : bottom right corner

type TableRows

type TableRows [][]string

TableRows represent the rows of the table.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL