editable

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	// contains filtered or unexported fields
}

type Column

type Column struct {
	Title      string
	Width      int
	Validators []func([]string, [][]string, string) error
}

type KeyMap

type KeyMap struct {
	CellUp     key.Binding
	CellDown   key.Binding
	CellLeft   key.Binding
	CellRight  key.Binding
	NextCell   key.Binding
	NewRow     key.Binding
	PageUp     key.Binding
	PageDown   key.Binding
	GotoTop    key.Binding
	GotoBottom key.Binding
}

func DefaultKeyMap

func DefaultKeyMap() KeyMap

type Model

type Model struct {
	KeyMap KeyMap
	// contains filtered or unexported fields
}

func NewModel

func NewModel(opts ...Option) Model

func (*Model) AddRow

func (m *Model) AddRow()

func (Model) At

func (m Model) At(row, cell int) string

func (*Model) Blur

func (m *Model) Blur()

func (Model) Columns

func (m Model) Columns() int

func (Model) Cursor

func (m Model) Cursor() (int, int)

func (Model) Errors

func (m Model) Errors() []error

func (*Model) Focus

func (m *Model) Focus()

func (*Model) GotoBottom

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

func (*Model) GotoTop

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

func (Model) Init

func (m Model) Init() tea.Cmd

func (*Model) Move

func (m *Model) Move(y, x int) tea.Cmd

func (*Model) MoveDown

func (m *Model) MoveDown(n int) tea.Cmd

func (*Model) MoveLeft

func (m *Model) MoveLeft(n int) tea.Cmd

func (*Model) MoveRight

func (m *Model) MoveRight(n int) tea.Cmd

func (*Model) MoveToNextCell

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

func (*Model) MoveUp

func (m *Model) MoveUp(n int) tea.Cmd

func (*Model) RemoveRow

func (m *Model) RemoveRow(n int)

func (Model) Rows

func (m Model) Rows() int

func (*Model) SetColumns

func (m *Model) SetColumns(c []Column)

func (*Model) SetStyles

func (m *Model) SetStyles(s Styles)

func (Model) Titles added in v1.9.0

func (m Model) Titles() []string

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Model) Validate

func (m *Model) Validate()

func (Model) Values

func (m Model) Values() [][]string

func (Model) View

func (m Model) View() string

type Option

type Option func(*Model)

Option is used to set options in New. For example:

table := New(WithColumns([]Column{{Title: "ID", Width: 10}}))

func IsOptional added in v1.2.1

func IsOptional(optional bool) Option

func WithColumns

func WithColumns(columns []Column) Option

func WithKeyMap

func WithKeyMap(km KeyMap) Option

func WithRows

func WithRows(rows []Row) Option

func WithStyles

func WithStyles(s Styles) Option

type Row

type Row []Cell

type Styles

type Styles struct {
	Header   lipgloss.Style
	Cell     lipgloss.Style
	Selected lipgloss.Style
	Error    lipgloss.Style
}

func DefaultStyles

func DefaultStyles() Styles

Jump to

Keyboard shortcuts

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