Documentation
¶
Overview ¶
Package list provides a generic list implementation to be used inside BubbleTea-based dialog components.
Index ¶
- type ComparableStringer
- type Entries
- type Entry
- type List
- func (self *List[S]) Aborted() bool
- func (self *List[S]) EntryNumberStr(number int) string
- func (self *List[S]) HandleKey(key tea.KeyMsg) (bool, tea.Cmd)
- func (self *List[S]) MoveCursorDown()
- func (self *List[S]) MoveCursorUp()
- func (self *List[S]) MovePageDown()
- func (self *List[S]) MovePageUp()
- func (self List[S]) SelectedData() S
- func (self List[S]) SelectedEntry() Entry[S]
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComparableStringer ¶
type ComparableStringer interface {
comparable
fmt.Stringer
}
narrower type needed to use the NewEntries convenience function
type Entries ¶
type Entries[S comparable] []Entry[S]
Entries provides methods for a collection of Entry instances.
func NewEntries ¶
func NewEntries[S ComparableStringer](records ...S) Entries[S]
creates an Entries instance containing the given records
func (Entries[S]) AllDisabled ¶
indicates whether all entries in this list are disabled
func (Entries[S]) IndexOfFunc ¶
provides the position of the given needle in this list
type Entry ¶
type Entry[S comparable] struct { Data S Disabled bool `exhaustruct:"optional"` Text string }
Entry is an entry in a List instance.
type List ¶
type List[S comparable] struct { Colors colors.DialogColors // colors to use for help text Cursor int // index of the currently selected row Entries Entries[S] // the entries to select from EntryNumber string // the manually entered entry number MaxDigits int // how many digits make up an entry number NumberFormat string // template for formatting the entry number Status Status }
List contains elements and operations common to all BubbleTea-based list implementations.
func (*List[S]) EntryNumberStr ¶
EntryNumberStr provides a colorized string to print the given entry number.
func (*List[S]) MoveCursorDown ¶
func (self *List[S]) MoveCursorDown()
func (*List[S]) MoveCursorUp ¶
func (self *List[S]) MoveCursorUp()
func (*List[S]) MovePageDown ¶
func (self *List[S]) MovePageDown()
func (*List[S]) MovePageUp ¶
func (self *List[S]) MovePageUp()
func (List[S]) SelectedData ¶
func (self List[S]) SelectedData() S
func (List[S]) SelectedEntry ¶
Click to show internal directories.
Click to hide internal directories.