list

package
v0.0.61 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcceptChoices added in v0.0.6

func AcceptChoices(accept bool) tea.Cmd

AcceptChoices returns a confirmation dialogue.

func DefaultKeyMap added in v0.0.6

func DefaultKeyMap() keys.KeyMap

func VimKeyMap added in v0.0.6

func VimKeyMap() keys.KeyMap

Types

type Component added in v0.0.6

type Component struct {
	reactea.BasicComponent
	reactea.BasicPropfulComponent[Props]

	Cursor int
	KeyMap keys.KeyMap

	Viewport viewport.Model
	// contains filtered or unexported fields
}

func New added in v0.0.6

func New() *Component

func (*Component) AfterUpdate added in v0.0.6

func (m *Component) AfterUpdate() tea.Cmd

func (Component) CurrentItem added in v0.0.6

func (m Component) CurrentItem() int

CurrentItem returns the selected row. You can cast it to your own implementation.

func (*Component) DefaultKeyMap added in v0.0.6

func (m *Component) DefaultKeyMap() *Component

func (Component) GetCursor added in v0.0.6

func (m Component) GetCursor() int

Cursor returns the index of the selected item.

func (*Component) GotoBottom added in v0.0.6

func (m *Component) GotoBottom()

GotoBottom moves the selection to the last row.

func (*Component) GotoTop added in v0.0.6

func (m *Component) GotoTop()

GotoTop moves the selection to the first row.

func (Component) Height added in v0.0.6

func (m Component) Height() int

Height returns the viewport height of the list.

func (*Component) Init added in v0.0.6

func (m *Component) Init(props Props) tea.Cmd

func (*Component) MoveDown added in v0.0.6

func (m *Component) MoveDown(n int)

MoveDown moves the selection down by any number of rows. It can not go below the last row.

func (*Component) MoveUp added in v0.0.6

func (m *Component) MoveUp(n int)

MoveUp moves the selection up by any number of rows. It can not go above the first row.

func (*Component) Render added in v0.0.6

func (m *Component) Render(w, h int) string

func (*Component) SetCursor added in v0.0.6

func (m *Component) SetCursor(n int)

SetCursor sets the cursor position in the list.

func (*Component) SetHeight added in v0.0.6

func (m *Component) SetHeight(h int)

SetHeight sets the height of the viewport of the list.

func (*Component) SetKeyMap added in v0.0.6

func (m *Component) SetKeyMap(km keys.KeyMap)

SetKeyMap sets the keymap for the list.

func (*Component) SetWidth added in v0.0.6

func (m *Component) SetWidth(w int)

SetWidth sets the width of the viewport of the list.

func (*Component) Update added in v0.0.6

func (m *Component) Update(msg tea.Msg) tea.Cmd

func (*Component) UpdateItems added in v0.0.6

func (m *Component) UpdateItems()

UpdateItems updates the list content based on the previously defined columns and rows.

func (*Component) VimKeyMap added in v0.0.6

func (m *Component) VimKeyMap() *Component

func (Component) Width added in v0.0.6

func (m Component) Width() int

Width returns the viewport width of the list.

type Option added in v0.0.6

type Option func(*Component)

type Props added in v0.0.6

type Props struct {
	Editable    bool
	Filterable  bool
	Matches     []item.Item
	Selected    map[int]struct{}
	ToggleItems func(...int)
	ShowHelp    func([]map[string]string)
}

Jump to

Keyboard shortcuts

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