dashboard

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

forked from: https://github.com/charmbracelet/bubbles/blob/master/paginator/paginator.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenBrowser

func OpenBrowser(url string)

Types

type Bubble

type Bubble struct {
	// contains filtered or unexported fields
}

func InitialModel

func InitialModel() Bubble

func (Bubble) Init

func (b Bubble) Init() tea.Cmd

func (Bubble) Update

func (b Bubble) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Do computations for TUI app

func (Bubble) View

func (b Bubble) View() string

type Bubbles

type Bubbles struct {
	// contains filtered or unexported fields
}

type ErrorMsg

type ErrorMsg error
type Nav struct {
	// contains filtered or unexported fields
}

type Paginator

type Paginator struct {
	Type        Type
	Cursor      int
	Index       int
	Page        int
	PerPage     int
	TotalPages  int
	Width       int
	Height      int
	ActiveDot   string
	InactiveDot string
	Content     string
}

Paginator is the Bubble Tea model for this user interface.

func NewPaginator

func NewPaginator() Paginator

func (Paginator) GetContent

func (m Paginator) GetContent() string

func (*Paginator) GetCursorIndex

func (m *Paginator) GetCursorIndex() int

func (*Paginator) GetSliceBounds

func (m *Paginator) GetSliceBounds() (start int, end int)

func (*Paginator) GetSliceStart

func (m *Paginator) GetSliceStart() int

func (*Paginator) GoToStart

func (m *Paginator) GoToStart()

func (Paginator) ItemsOnPage

func (m Paginator) ItemsOnPage() int

ItemsOnPage is a helper function for returning the numer of items on the current page given the total numer of items passed as an argument.

func (*Paginator) LineDown

func (m *Paginator) LineDown()

func (*Paginator) LineUp

func (m *Paginator) LineUp()

func (*Paginator) NextPage

func (m *Paginator) NextPage()

NextPage is a helper function for navigating one page forward. It will not page beyond the last page (i.e. totalPages - 1).

func (Paginator) OnLastPage

func (m Paginator) OnLastPage() bool

OnLastPage returns whether or not we're on the last page.

func (*Paginator) PrevPage

func (m *Paginator) PrevPage()

PrevPage is a number function for navigating one page backward. It will not page beyond the first page (i.e. page 0).

func (*Paginator) SetContent

func (m *Paginator) SetContent(s string)

SetContent set the pager's text content.

func (*Paginator) SetHeight

func (m *Paginator) SetHeight(i int)

func (*Paginator) SetTotalPages

func (m *Paginator) SetTotalPages(items int) int

SetTotalPages is a helper function for calculating the total number of pages from a given number of items. It's use is optional since this pager can be used for other things beyond navigating sets. Note that it both returns the number of total pages and alters the model.

func (*Paginator) SetWidth

func (m *Paginator) SetWidth(i int)

func (Paginator) Update

func (m Paginator) Update(msg tea.Msg) (Paginator, tea.Cmd)

Update is the Tea update function which binds keystrokes to pagination.

func (Paginator) View

func (m Paginator) View() string

View renders the pagination to a string.

type Type

type Type int

Type specifies the way we render pagination.

const Dots Type = iota

Pagination rendering options.

Directories

Path Synopsis
viewport
forked from: https://github.com/charmbracelet/bubbles/blob/master/viewport/viewport.go
forked from: https://github.com/charmbracelet/bubbles/blob/master/viewport/viewport.go

Jump to

Keyboard shortcuts

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