selector

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveMsg

type ActiveMsg struct{ IdentifiableItem }

ActiveMsg is a message that is sent when an item is active but not selected.

type IdentifiableItem

type IdentifiableItem interface {
	list.DefaultItem
	ID() string
}

IdentifiableItem is an item that can be identified by a string. Implements list.DefaultItem.

type ItemDelegate

type ItemDelegate interface {
	list.ItemDelegate
}

ItemDelegate is a wrapper around list.ItemDelegate.

type SelectMsg

type SelectMsg struct{ IdentifiableItem }

SelectMsg is a message that is sent when an item is selected.

type Selector

type Selector struct {
	*list.Model
	// contains filtered or unexported fields
}

Selector is a list of items that can be selected.

func New

func New(common common.Common, items []IdentifiableItem, delegate ItemDelegate) *Selector

New creates a new selector.

func (*Selector) CursorDown

func (s *Selector) CursorDown()

CursorDown moves the cursor down.

func (*Selector) CursorUp

func (s *Selector) CursorUp()

CursorUp moves the cursor up.

func (*Selector) DisableQuitKeybindings

func (s *Selector) DisableQuitKeybindings()

DisableQuitKeybindings disables the quit keybindings.

func (*Selector) FilterState

func (s *Selector) FilterState() list.FilterState

FilterState returns the filter state.

func (*Selector) Index

func (s *Selector) Index() int

Index returns the index of the selected item.

func (*Selector) Init

func (s *Selector) Init() tea.Cmd

Init implements tea.Model.

func (*Selector) Items

func (s *Selector) Items() []list.Item

Items returns the items in the selector.

func (*Selector) Page

func (s *Selector) Page() int

Page returns the current page.

func (*Selector) PerPage

func (s *Selector) PerPage() int

PerPage returns the number of items per page.

func (*Selector) Select

func (s *Selector) Select(index int)

Select selects the item at the given index.

func (*Selector) SelectItemCmd

func (s *Selector) SelectItemCmd() tea.Msg

SelectItemCmd is a command that selects the currently active item.

func (*Selector) SelectedItem

func (s *Selector) SelectedItem() IdentifiableItem

SelectedItem returns the currently selected item.

func (*Selector) SetFilteringEnabled

func (s *Selector) SetFilteringEnabled(enabled bool)

SetFilteringEnabled sets the filtering enabled flag.

func (*Selector) SetItems

func (s *Selector) SetItems(items []IdentifiableItem) tea.Cmd

SetItems sets the items in the selector.

func (*Selector) SetPage

func (s *Selector) SetPage(page int)

SetPage sets the current page.

func (*Selector) SetShowFilter

func (s *Selector) SetShowFilter(show bool)

SetShowFilter sets the show filter flag.

func (*Selector) SetShowHelp

func (s *Selector) SetShowHelp(show bool)

SetShowHelp sets the show help flag.

func (*Selector) SetShowPagination

func (s *Selector) SetShowPagination(show bool)

SetShowPagination sets the show pagination flag.

func (*Selector) SetShowStatusBar

func (s *Selector) SetShowStatusBar(show bool)

SetShowStatusBar sets the show status bar flag.

func (*Selector) SetShowTitle

func (s *Selector) SetShowTitle(show bool)

SetShowTitle sets the show title flag.

func (*Selector) SetSize

func (s *Selector) SetSize(width, height int)

SetSize implements common.Component.

func (*Selector) SetTotalPages

func (s *Selector) SetTotalPages(items int) int

SetTotalPages sets the total number of pages given the number of items.

func (*Selector) TotalPages

func (s *Selector) TotalPages() int

TotalPages returns the total number of pages.

func (*Selector) Update

func (s *Selector) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (*Selector) View

func (s *Selector) View() string

View implements tea.Model.

func (*Selector) VisibleItems

func (s *Selector) VisibleItems() []list.Item

VisibleItems returns all the visible items in the selector.

Jump to

Keyboard shortcuts

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