dialog

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ModeAlert   = 0 // alert 模式
	ModeConfirm = 1 // confirm 模式
	ModePrompt  = 2 // prompt 模式
)

Functions

func PlaceOverlay

func PlaceOverlay(x, y int, fg, bg string) string

PlaceOverlay places fg on top of bg.

Types

type DialogModel

type DialogModel struct {
	*model.BoxModel
	Payload  *DialogPayload
	TabIndex int // 0-textarea 1-btnCancel 2-btnOK

	// components
	TextInput textinput.Model
	Select    list.Model
}

func New

func New() DialogModel

func (*DialogModel) Blur added in v1.1.0

func (m *DialogModel) Blur()

func (*DialogModel) Close

func (m *DialogModel) Close()

func (*DialogModel) FnOK added in v1.1.0

func (m *DialogModel) FnOK()

func (*DialogModel) Focus added in v1.1.0

func (m *DialogModel) Focus()

func (DialogModel) Init

func (m DialogModel) Init() tea.Cmd

func (*DialogModel) Show

func (m *DialogModel) Show(payload *DialogPayload)

func (DialogModel) Update

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

func (DialogModel) View

func (m DialogModel) View() string

type DialogPayload

type DialogPayload struct {
	Mode        int // 0 - alert模式,1 - confirm模式,2 - prompt模式
	Title       string
	Message     string
	PromptValue string
	SelectList  []string
	FnOK        func(args ...string) bool
	Width       int // 宽度,默认 42
}

Jump to

Keyboard shortcuts

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