page

package
v1.1.11 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 23 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear()

func ClearLine

func ClearLine(row int)

func Flush

func Flush()

func MoveCursor

func MoveCursor(column, row int)

func Print

func Print(content string)

func PrintAt

func PrintAt(content string, column, row int)

func Println

func Println(content string)

Types

type Page

type Page struct {
	ActivePageIndex int // The index of the active page.
	// contains filtered or unexported fields
}

Page represents a page in a document or a user interface.

func NewPage

func NewPage(t *term.ViewPort, pageTitle *lang.Text) *Page

The NewPage function creates a new page with a truncated title and initializes other properties.

func (*Page) Add

func (p *Page) Add(rowContent string, altID string, dateTime string)

The `Add` function is used to add a new row of data to a page. It takes four parameters: `pageRowNumber`, `rowContent`, `altID`, and `dateTime`.

func (*Page) AddAction

func (p *Page) AddAction(validAction *actn.Action)

AddAction takes a validAction string as a parameter. The function adds the validAction to the list of available actions on the page.

func (*Page) AddBlankRow

func (p *Page) AddBlankRow()

AddBlankRow adds a blank row to the page

func (*Page) AddBreakRow

func (p *Page) AddBreakRow()

func (*Page) AddColumns

func (p *Page) AddColumns(columns ...string)

func (*Page) AddColumnsTitle

func (p *Page) AddColumnsTitle(columns ...string)

AddColumnsTitle adds a ruler to the page, separating the columns

func (*Page) AddFieldValuePair

func (p *Page) AddFieldValuePair(key any, value string)

AddFieldValuePair adds a field value pair to the page

AddFieldValuePair takes two strings as arguments, where the first string represents the field name and the second string represents the field value. The function adds a row to the page with the field name on the left and the field value on the right, separated by a colon.

Example:

page.AddFieldValuePair("Field Name", "Field Value")

func (*Page) AddIntAction

func (p *Page) AddIntAction(num int)

AddIntAction adds an action to the page with the given integer value

func (*Page) AddMenuOption

func (p *Page) AddMenuOption(id int, rowContent string, altID string, dateTime string)

The `Add` function is used to add a new row of data to a page. It takes four parameters: `pageRowNumber`, `rowContent`, `altID`, and `dateTime`.

func (*Page) AddParagraph

func (p *Page) AddParagraph(msg []string)

func (*Page) AddParagraphString

func (p *Page) AddParagraphString(msg string)

func (*Page) Back

func (p *Page) Back()

Back moves to the previous page. If the current page is the first page, it returns an error.

func (*Page) BlockAction

func (p *Page) BlockAction(action string)

func (*Page) BlockIntAction

func (p *Page) BlockIntAction(action int)

func (*Page) Body

func (p *Page) Body()

func (*Page) Break

func (p *Page) Break(row int)

func (*Page) Clear

func (p *Page) Clear()

func (*Page) ClearContent

func (p *Page) ClearContent(row int)

func (*Page) Clearline

func (p *Page) Clearline(row int)

func (*Page) Display_Actions

func (p *Page) Display_Actions() (nextAction *actn.Action)

func (*Page) Display_Confirmation

func (p *Page) Display_Confirmation(msg *lang.Text) (bool, error)

func (*Page) Display_Input

func (p *Page) Display_Input(minLen, maxLen int) (nextAction string, selected pageRow)

func (*Page) Dump

func (p *Page) Dump(in ...string)

func (*Page) Error

func (p *Page) Error(err error, msg ...string)

func (*Page) Footer

func (p *Page) Footer()

func (*Page) FormatRowOutput

func (p *Page) FormatRowOutput(msg string) string

func (*Page) Forward

func (p *Page) Forward()

Forward moves to the next page. If the current page is the last page, it returns an error.

func (*Page) GetActions

func (p *Page) GetActions() []*actn.Action

func (*Page) GetBlockedActions

func (p *Page) GetBlockedActions() []string

func (*Page) GetDebugRow

func (p *Page) GetDebugRow(rowNo int) pageRow

GetDebugRow returns the pageRow at the specified index.

This function is used for debugging purposes.

func (*Page) GetHelp

func (p *Page) GetHelp() []string

func (*Page) GetOptions

func (p *Page) GetOptions(includeDefaults bool) string

func (*Page) GetRows

func (p *Page) GetRows() int

GetRows returns the number of rows in the page.

func (*Page) Header

func (p *Page) Header(msg string)

The `Header` function is a method of the `Crt` struct. It is responsible for printing a banner message to the console.

func (*Page) Help

func (p *Page) Help()

func (*Page) Hint

func (p *Page) Hint(info *lang.Text, msg ...string)

func (*Page) Info

func (p *Page) Info(info *lang.Text, msg ...string)

func (*Page) Input

func (p *Page) Input(msg *lang.Text, options string) string

The `Input` function is a method of the `Crt` struct. It is used to display a prompt for the user for input on the terminal.

func (*Page) InputHintInfo

func (p *Page) InputHintInfo(msg *lang.Text)

func (*Page) IsBlockedAction

func (p *Page) IsBlockedAction(action string) bool

func (*Page) PagingInfo

func (p *Page) PagingInfo(page, ofPages int)

func (*Page) ResetPrompt

func (p *Page) ResetPrompt()

ResetPrompt resets the prompt to the default value

func (*Page) ResetSetHelp

func (p *Page) ResetSetHelp()

func (*Page) SetHelp

func (p *Page) SetHelp(msg []string)

func (*Page) SetPrompt

func (p *Page) SetPrompt(prompt *lang.Text)

SetPrompt sets the prompt for the page

func (*Page) SetTitle

func (p *Page) SetTitle(title *lang.Text)

func (*Page) ShowOptions

func (p *Page) ShowOptions()

func (*Page) Success

func (p *Page) Success(message *lang.Text, msg ...string)

func (*Page) UnblockAction

func (p *Page) UnblockAction(action string)

func (*Page) ViewPort

func (p *Page) ViewPort() term.ViewPort

func (*Page) Warning

func (p *Page) Warning(warning lang.Text, msg ...string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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