components

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisplayErrorNotification added in v1.1.2

func DisplayErrorNotification(message string)

func DisplayInfoNotification added in v1.1.2

func DisplayInfoNotification(message string)

func DisplayNotification added in v1.1.2

func DisplayNotification(message, messageType string)

func DisplayWarningNotification added in v1.1.2

func DisplayWarningNotification(message string)

func GetTableScreen

func GetTableScreen(tbHandler TableDataHandler, customStyles map[string]lipgloss.Color) string

GetTableScreen returns the string representation of the table with custom styles.

func GetTableScreenCustom added in v1.2.0

func GetTableScreenCustom(tbHandler TableDataHandler, customStyles map[string]lipgloss.Color, styleFunc StyleFunc) string

GetTableScreenCustom returns the string representation of the table with custom styles and an optional style function.

func NavigateAndExecuteForm(config FormConfig) (map[string]string, error)
func NavigateAndExecuteTable(tbHandler TableDataHandler, customStyles map[string]lipgloss.Color) error

NavigateAndExecuteTable navigates and executes the table screen with custom styles.

func NavigateAndExecuteTableCustom(tbHandler TableDataHandler, customStyles map[string]lipgloss.Color, styleFunc StyleFunc) error

NavigateAndExecuteTableCustom navigates and executes the table screen with custom styles and an optional style function.

func ShowForm

func ShowForm(config FormConfig) (map[string]string, error)

func ShowFormWithNotification added in v1.1.2

func ShowFormWithNotification(config FormConfig) (map[string]string, error)

func ShowNotification added in v1.1.2

func ShowNotification(notification Notification)

func StartTableScreen

func StartTableScreen(tbHandler TableDataHandler, customStyles map[string]lipgloss.Color) error

StartTableScreen starts the table screen with custom styles.

func StartTableScreenCustom added in v1.2.0

func StartTableScreenCustom(tbHandler TableDataHandler, customStyles map[string]lipgloss.Color, styleFunc StyleFunc) error

StartTableScreenCustom starts the table screen with custom styles and an optional style function.

func StartTableScreenFromRenderer added in v1.1.2

func StartTableScreenFromRenderer(k *TableRenderer) error

StartTableScreenFromRenderer starts the table screen from a given TableRenderer.

Types

type FormModel

type FormModel struct {
	Title        string
	FocusIndex   int
	Inputs       []textinput.Model
	CursorMode   cursor.Mode
	Fields       []FormInputObject[any]
	ErrorMessage string
}

func (*FormModel) Init

func (m *FormModel) Init() tea.Cmd

func (*FormModel) Update

func (m *FormModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*FormModel) View

func (m *FormModel) View() string

type Notification added in v1.1.2

type Notification struct {
	Message string
	Type    NotificationType
}

type NotificationType added in v1.1.2

type NotificationType string
const (
	Info    NotificationType = "info"
	Warning NotificationType = "warning"
	Error   NotificationType = "error"
)

type StyleFunc added in v1.2.0

type StyleFunc func(row, col int, cellValue string) lipgloss.Style

StyleFunc defines a function that returns a lipgloss.Style based on row, column, and cell value.

type TableRenderer

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

TableRenderer is responsible for rendering tables in the terminal with customizable styles and dynamic behavior.

func NewTableRenderer

func NewTableRenderer(tbHandler TableDataHandler, customStyles map[string]lipgloss.Color, styleFunc StyleFunc) *TableRenderer

NewTableRenderer creates a new TableRenderer with custom styles and an optional style function.

func (*TableRenderer) ApplyFilter

func (k *TableRenderer) ApplyFilter()

ApplyFilter applies a filter to the table rows.

func (*TableRenderer) ExportToCSV

func (k *TableRenderer) ExportToCSV(filename string)

ExportToCSV exports the table data to a CSV file.

func (*TableRenderer) ExportToExcel

func (k *TableRenderer) ExportToExcel(filename string)

ExportToExcel is a placeholder for exporting the table data to an Excel file.

func (*TableRenderer) ExportToJSON

func (k *TableRenderer) ExportToJSON(filename string)

ExportToJSON exports the table data to a JSON file.

func (*TableRenderer) ExportToMarkdown

func (k *TableRenderer) ExportToMarkdown(filename string)

ExportToMarkdown exports the table data to a Markdown file.

func (*TableRenderer) ExportToPDF

func (k *TableRenderer) ExportToPDF(filename string)

ExportToPDF exports the table data to a PDF file.

func (*TableRenderer) ExportToXML

func (k *TableRenderer) ExportToXML(filename string)

ExportToXML exports the table data to an XML file.

func (*TableRenderer) ExportToYAML

func (k *TableRenderer) ExportToYAML(filename string)

ExportToYAML exports the table data to a YAML file.

func (*TableRenderer) GetArrayMap added in v1.1.2

func (k *TableRenderer) GetArrayMap() map[string][]string

GetArrayMap returns the table data as a map of arrays.

func (*TableRenderer) GetByteMap added in v1.1.2

func (k *TableRenderer) GetByteMap() map[string][]byte

GetByteMap returns the table data as a map of byte slices.

func (*TableRenderer) GetCurrentPageRows

func (k *TableRenderer) GetCurrentPageRows() [][]string

GetCurrentPageRows returns the rows for the current page.

func (*TableRenderer) GetHashMap added in v1.1.2

func (k *TableRenderer) GetHashMap() map[string]string

GetHashMap returns the table data as a hash map.

func (*TableRenderer) GetHeaders added in v1.1.2

func (k *TableRenderer) GetHeaders() []string

GetHeaders returns the table headers.

func (*TableRenderer) GetObjectMap added in v1.1.2

func (k *TableRenderer) GetObjectMap() []map[string]string

GetObjectMap returns the table data as a slice of maps.

func (*TableRenderer) GetRows added in v1.1.2

func (k *TableRenderer) GetRows() [][]string

GetRows returns the table rows.

func (*TableRenderer) Init

func (k *TableRenderer) Init() tea.Cmd

Init initializes the table renderer.

func (*TableRenderer) RowsNavigate

func (k *TableRenderer) RowsNavigate(direction string) error

RowsNavigate navigates through the table rows.

func (*TableRenderer) SortRows

func (k *TableRenderer) SortRows()

SortRows sorts the table rows.

func (*TableRenderer) ToggleColumnVisibility added in v1.1.2

func (k *TableRenderer) ToggleColumnVisibility()

ToggleColumnVisibility toggles the visibility of the columns in the table.

func (*TableRenderer) Update

func (k *TableRenderer) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update updates the table renderer based on user input.

func (*TableRenderer) View

func (k *TableRenderer) View() string

View returns the string representation of the table for rendering.

Jump to

Keyboard shortcuts

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