Documentation ¶
Overview ¶
Package selector is a terminal single-selection list library. selector library provides the functions of page up and down and key movement, and supports custom rendering methods.
Index ¶
- Constants
- func DefaultHeaderFuncWithAppend(append string) func(m Model, obj interface{}, gdIndex int) string
- func DefaultSelectedFuncWithIndex(indexFormat string) func(m Model, obj interface{}, gdIndex int) string
- func DefaultUnSelectedFuncWithIndex(indexFormat string) func(m Model, obj interface{}, gdIndex int) string
- type Model
Constants ¶
View Source
const ( DefaultHeader = "Use the arrow keys to navigate: ↓ ↑ → ←" DefaultCursor = "»" DefaultFinished = "Current selected: %s\n" ColorHeader = "15" ColorCursor = "2" ColorFinished = "2" ColorSelected = "14" ColorUnSelected = "8" )
Variables ¶
This section is empty.
Functions ¶
func DefaultHeaderFuncWithAppend ¶
DefaultHeaderFuncWithAppend return the default HeaderFunc and append the given string to the next line of the default header
Types ¶
type Model ¶
type Model struct { // HeaderFunc Header rendering function HeaderFunc func(m Model, obj interface{}, gdIndex int) string // Cursor cursor rendering style Cursor string // CursorColor cursor rendering color CursorColor string // SelectedFunc selected data rendering function SelectedFunc func(m Model, obj interface{}, gdIndex int) string // UnSelectedFunc unselected data rendering function UnSelectedFunc func(m Model, obj interface{}, gdIndex int) string FooterFunc func(m Model, obj interface{}, gdIndex int) string // FinishedFunc finished rendering function FinishedFunc func(selected interface{}) string // PerPage data count per page PerPage int // Data the data set to be rendered Data []interface{} // contains filtered or unexported fields }
Model is a data container used to store TUI status information, the ui rendering success style is as follows:
Use the arrow keys to navigate: ↓ ↑ → ← Select Commit Type: » [1] feat (Introducing new features) 2. fix (Bug fix) 3. docs (Writing docs) 4. style (Improving structure/format of the code) 5. refactor (Refactoring code) --------- Commit Type ---------- Type: feat Description: 新功能(Introducing new features)
func (Model) PageData ¶
func (m Model) PageData() []interface{}
PageData return the current page data area slice
func (Model) Selected ¶
func (m Model) Selected() interface{}
Selected return the currently selected data
Click to show internal directories.
Click to hide internal directories.