table

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Title string
	// MaxWidth is unused for now
	MaxWidth *int
	// contains filtered or unexported fields
}

type Model

type Model struct {
	pane.Pane

	Columns []Column
	// contains filtered or unexported fields
}

func New

func New(ctx *context.ProgramContext, spec TableSpec) *Model

func (*Model) AppendRows

func (m *Model) AppendRows(rows []Row)

func (*Model) ClearRows

func (m *Model) ClearRows()

func (*Model) GetCurrentItem

func (m *Model) GetCurrentItem() int

func (*Model) GetCurrentRow

func (m *Model) GetCurrentRow() Row

func (*Model) GetCurrentRowMarshalled added in v0.0.3

func (m *Model) GetCurrentRowMarshalled() map[string]string

func (*Model) GetRowAt

func (m *Model) GetRowAt(index int) Row

func (*Model) Hide

func (m *Model) Hide()

func (*Model) Init

func (m *Model) Init() tea.Cmd

func (*Model) MarhsalRow added in v0.0.3

func (m *Model) MarhsalRow(row Row) map[string]string

func (*Model) OnLineDown

func (m *Model) OnLineDown()

func (*Model) OnLineUp

func (m *Model) OnLineUp()

func (*Model) ResetCurrentItem

func (m *Model) ResetCurrentItem()

func (*Model) SetRows

func (m *Model) SetRows(rows []Row)

func (*Model) SetSize

func (m *Model) SetSize(width int, height int)

func (*Model) UnmarshalRow added in v0.0.3

func (m *Model) UnmarshalRow(row map[string]string) Row

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (pane.Pane, tea.Cmd, bool)

func (*Model) UpdateRow added in v0.0.3

func (m *Model) UpdateRow(primaryKeyIndex int, newRow Row)

Updates a row using a given column as the primary key

func (*Model) View

func (m *Model) View() string

type Row

type Row []string

type TableSpec

type TableSpec struct {
	pane.BaseSpec

	Columns []Column
}

func (TableSpec) NewFromSpec

func (s TableSpec) NewFromSpec(ctx *context.ProgramContext, spec pane.PaneSpec) pane.Pane

Jump to

Keyboard shortcuts

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