Documentation ¶
Index ¶
- type InlineList
- func (m InlineList) Choice() string
- func (m InlineList) Init() tea.Cmd
- func (m InlineList) IsPaginationVisible() bool
- func (m *InlineList) SetChoice(choice string)
- func (m *InlineList) SetMaxDisplayedItems(maxDisplayedItems int)
- func (m *InlineList) SetMinimized(minimized bool)
- func (m InlineList) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m InlineList) UpdateInlineList(msg tea.Msg) (InlineList, tea.Cmd)
- func (m InlineList) View() string
- type InlineListArgs
- type ListItem
- type SliceView
- func (m SliceView[T]) All() []T
- func (m SliceView[T]) Choice() T
- func (m SliceView[T]) Cursor() int
- func (m *SliceView[T]) CursorBack()
- func (m *SliceView[T]) CursorNext()
- func (m SliceView[T]) IsChoice(i int) bool
- func (m SliceView[T]) IsChoiceRelative(relativeI int) bool
- func (m *SliceView[T]) IsInView(i int) bool
- func (m SliceView[T]) MaxDisplayedItems() int
- func (m SliceView[T]) NumDisplayed() int
- func (m *SliceView[T]) SetCursor(cursor int)
- func (m *SliceView[T]) SetMaxDisplayedItems(max int)
- func (m *SliceView[T]) UpdateItems(items []T)
- func (m SliceView[T]) View() []T
- func (m SliceView[T]) ViewBounds() (int, int)
- func (m SliceView[T]) ViewOffset() int
- type StringItem
- type UpdateListItemsMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InlineList ¶
type InlineList struct { Items SliceView[ListItem] Paginator paginator.Model // contains filtered or unexported fields }
func NewInlineList ¶
func NewInlineList(args InlineListArgs) InlineList
func (InlineList) Choice ¶
func (m InlineList) Choice() string
func (InlineList) Init ¶
func (m InlineList) Init() tea.Cmd
func (InlineList) IsPaginationVisible ¶ added in v1.54.7
func (m InlineList) IsPaginationVisible() bool
func (*InlineList) SetChoice ¶
func (m *InlineList) SetChoice(choice string)
func (*InlineList) SetMaxDisplayedItems ¶ added in v1.54.7
func (m *InlineList) SetMaxDisplayedItems(maxDisplayedItems int)
func (*InlineList) SetMinimized ¶ added in v1.54.7
func (m *InlineList) SetMinimized(minimized bool)
func (InlineList) UpdateInlineList ¶
func (m InlineList) UpdateInlineList(msg tea.Msg) (InlineList, tea.Cmd)
UpdateInlineList does the same thing as Update, without erasing the component's type.
useful when composing this model into another model
func (InlineList) View ¶
func (m InlineList) View() string
type InlineListArgs ¶
type ListItem ¶
func StringsToListItems ¶
type SliceView ¶ added in v1.54.7
type SliceView[T any] struct { // contains filtered or unexported fields }
SliceView sliding window view of a list of items e.g. a list of items that can be displayed in a terminal window, but not all at once It keeps track of the cursor position and the view window, ensuring the cursor is always visible in the sub-slice of items
func NewSliceView ¶ added in v1.54.7
func (SliceView[T]) Choice ¶ added in v1.54.7
func (m SliceView[T]) Choice() T
Choice returns the currently selected item
func (SliceView[T]) Cursor ¶ added in v1.54.7
Cursor returns the index of the currently selected item
func (*SliceView[T]) CursorBack ¶ added in v1.54.7
func (m *SliceView[T]) CursorBack()
CursorUp moves the cursor up, wrapping around if it reaches the top it also updates the view to ensure the cursor is always visible
func (*SliceView[T]) CursorNext ¶ added in v1.54.7
func (m *SliceView[T]) CursorNext()
CursorDown moves the cursor down, wrapping around if it reaches the bottom it also updates the view to ensure the cursor is always visible
func (SliceView[T]) IsChoice ¶ added in v1.54.7
IsChoice returns true if the index is the currently selected item
func (SliceView[T]) IsChoiceRelative ¶ added in v1.54.7
IsChoiceRelative returns true if the index is the currently selected item where the index is relative to the view sub-slice
func (SliceView[T]) MaxDisplayedItems ¶ added in v1.54.7
MaxDisplayedItems returns the maximum number of items to display Use NumDisplayed to get the actual number of items that will be displayed
func (SliceView[T]) NumDisplayed ¶ added in v1.54.7
NumDisplayed is the number of items that will be displayed based on max and total number of items
func (*SliceView[T]) SetCursor ¶ added in v1.54.7
SetCursor sets the cursor to the specified index, updating the view as needed if the cursor is out of bounds, it will wrap around
func (*SliceView[T]) SetMaxDisplayedItems ¶ added in v1.54.7
SetMaxDisplayedItems sets the maximum number of items to display if max is 0 or less, it will display all items
func (*SliceView[T]) UpdateItems ¶ added in v1.54.7
func (m *SliceView[T]) UpdateItems(items []T)
func (SliceView[T]) View ¶ added in v1.54.7
func (m SliceView[T]) View() []T
View returns the items that should be displayed
func (SliceView[T]) ViewBounds ¶ added in v1.54.7
ViewBounds returns the start and end index of the view
func (SliceView[T]) ViewOffset ¶ added in v1.54.7
ViewOffset returns the index of the first item displayed in the view
type StringItem ¶
type StringItem struct {
Value string
}
func (StringItem) GetItemDescription ¶
func (s StringItem) GetItemDescription() string
func (StringItem) GetItemValue ¶
func (s StringItem) GetItemValue() string
type UpdateListItemsMsg ¶
type UpdateListItemsMsg []ListItem