Documentation
¶
Index ¶
- type FilterState
- type FilteredItem
- type FilteredItems
- type ItemConstructor
- type ListFilter
- type ListItem
- type SimpleListItem
- type Widget
- func (w *Widget[T]) AppendItem(data T)
- func (w *Widget[T]) BlurCurrent()
- func (w *Widget[T]) FilterState() FilterState
- func (w *Widget[T]) FocusFirst()
- func (w *Widget[T]) GetGlobalIndex() int
- func (w *Widget[T]) GetItem(index int) T
- func (w *Widget[T]) GetItems() []T
- func (w *Widget[T]) GetSelectedItem() T
- func (w *Widget[T]) Init() tea.Cmd
- func (w *Widget[T]) InsertItem(index int, data T)
- func (w *Widget[T]) IsInputting() bool
- func (w *Widget[T]) Length() int
- func (w *Widget[T]) MoveItem(startIndex, destIndex int)
- func (w *Widget[T]) NextItem()
- func (w *Widget[T]) OnBlur()
- func (w *Widget[T]) OnFocus()
- func (w *Widget[T]) PreviousItem()
- func (w *Widget[T]) RemoveItem(index int)
- func (w *Widget[T]) Render() string
- func (w *Widget[T]) Resize(size orvyn.Size)
- func (w *Widget[T]) SetCursorMovementKeybinds(cursorUp, cursorDown key.Binding)
- func (w *Widget[T]) SetFilterPlaceholder(s string)
- func (w *Widget[T]) SetFilterable(filterable bool)
- func (w *Widget[T]) SetItem(index int, data T)
- func (w *Widget[T]) SetItems(items []T)
- func (w *Widget[T]) Update(msg tea.Msg) tea.Cmd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FilterState ¶
type FilterState int
FilterState Taken from github.com/charmbracelet/bubbles/list/list.go FilterState describes the current filtering state on the model.
const ( Unfiltered FilterState = iota // no filter set Filtering // user is actively setting a filter FilterApplied // a filter is applied and user is not editing filter )
Possible filter states.
func (FilterState) String ¶
func (f FilterState) String() string
String returns a human-readable string of the current filter state.
type FilteredItem ¶
type FilteredItem struct {
Index int // corresponding global index
}
type FilteredItems ¶
type FilteredItems []FilteredItem
func BasicFilter ¶
func BasicFilter[T any](items *[]ListItem[T], s string) FilteredItems
func FuzzyFilter ¶
func FuzzyFilter[T any](items *[]ListItem[T], s string) FilteredItems
type ItemConstructor ¶
ItemConstructor defines the signature of the item constructor. T type represents the type of the item data.
type ListFilter ¶
type ListFilter[T any] func(items *[]ListItem[T], s string) FilteredItems
type ListItem ¶
type ListItem[T any] interface { orvyn.Focusable orvyn.Renderable FilterValue() string UpdateData(data T) GetData() T }
type SimpleListItem ¶
type SimpleListItem struct {
orvyn.BaseWidget
orvyn.BaseFocusable
// contains filtered or unexported fields
}
func (*SimpleListItem) FilterValue ¶
func (s *SimpleListItem) FilterValue() string
func (*SimpleListItem) GetData ¶
func (s *SimpleListItem) GetData() string
func (*SimpleListItem) Render ¶
func (s *SimpleListItem) Render() string
func (*SimpleListItem) Resize ¶
func (s *SimpleListItem) Resize(size orvyn.Size)
func (*SimpleListItem) UpdateData ¶
func (s *SimpleListItem) UpdateData(value string)
type Widget ¶
type Widget[T any] struct { orvyn.BaseWidget orvyn.BaseFocusable InfiniteScroll bool AutoFocusNewItem bool CursorMovingCallback func(int) CursorMovedCallback func(int) Filter ListFilter[T] // contains filtered or unexported fields }
Widget defines a widgetlist widget. T type represents the type of the item data.
func New ¶
func New[T any](itemConstructor ItemConstructor[T]) *Widget[T]
New creates a new *Widget widgetlist and takes an itemConstructor as parameter. T type represents the type of the item data.
func (*Widget[T]) AppendItem ¶
func (w *Widget[T]) AppendItem(data T)
func (*Widget[T]) BlurCurrent ¶
func (w *Widget[T]) BlurCurrent()
func (*Widget[T]) FilterState ¶
func (w *Widget[T]) FilterState() FilterState
func (*Widget[T]) FocusFirst ¶
func (w *Widget[T]) FocusFirst()
func (*Widget[T]) GetGlobalIndex ¶
func (*Widget[T]) GetSelectedItem ¶
func (w *Widget[T]) GetSelectedItem() T
func (*Widget[T]) InsertItem ¶
func (*Widget[T]) IsInputting ¶
func (*Widget[T]) NextItem ¶
func (w *Widget[T]) NextItem()
NextItem manages the focus of the next item.
func (*Widget[T]) PreviousItem ¶
func (w *Widget[T]) PreviousItem()
PreviousItem manages the focus of the previous item.