input

package
v0.0.0-...-66b229c Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Dummy struct{}

Dummy can be referenced in vugu files to prevent go from causing errors due to not used imports.

Use it like this:

_ = input.Dummy

Functions

This section is empty.

Types

type Button

type Button struct {
	AttrMap vugu.AttrMap

	IconSlot    vugu.Builder `vugu:"data"` // Slot for the symbol.
	DefaultSlot vugu.Builder `vugu:"data"`

	Bind *bool `vugu:"data"` // A data binding with some bool variable. If this contains a reference, the button can be toggled.

	Click ClickHandler // External handler that is called upon an event.
	// contains filtered or unexported fields
}

func (*Button) Build

func (c *Button) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut)

func (*Button) Compute

func (c *Button) Compute(ctx vugu.ComputeCtx)

func (*Button) HandleClick

func (c *Button) HandleClick(event vugu.DOMEvent)

type CheckBox

type CheckBox struct {
	AttrMap vugu.AttrMap

	Bind *bool
}

CheckBox is a boolean type input component. Similar to a button that can be toggled.

func (*CheckBox) Build

func (c *CheckBox) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut)

type ClickEvent

type ClickEvent struct {
	vugu.DOMEvent
}

type ClickFunc

type ClickFunc func(event ClickEvent)

ClickFunc implements ClickHandler as a function.

func (ClickFunc) ClickHandle

func (f ClickFunc) ClickHandle(event ClickEvent)

ClickHandle implements the ClickHandler interface.

type ClickHandler

type ClickHandler interface {
	ClickHandle(event ClickEvent)
}

ClickHandler is the interface for things that can handle ClickEvent.

type Dropdown struct {
	AttrMap vugu.AttrMap

	Bind     ValueBinder // Binds the current selected key to some variable.
	BindList ListBinder  // Binds the list content to some list provider.
}

Dropdown provides several options that the user can choose.

func (c *Dropdown) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut)

type Field

type Field struct {
	AttrMap vugu.AttrMap
	ID      string // The ID of the internal input component.

	Bind interface {
		ValueBinder
		HTMLInputTyper
	}

	DefaultSlot vugu.Builder

	Type string // Overrides the type of the input component.
	// contains filtered or unexported fields
}

Field is a text or number based input component. The HTML input type is determined by the bound data type.

func (*Field) Build

func (c *Field) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut)

type HTMLInputTyper

type HTMLInputTyper interface {
	HTMLInputType() string // HTMLInputType returns the to be used type parameter for the HTML input element.
}

HTMLInputTyper can be implemented by types that need to be bound to UI components.

type ListBindGenericSlice

type ListBindGenericSlice[T any] struct {
	Slice *[]T
}

ListBindGenericSlice implements ListBinder for slices that are of some arbitrary type.

List keys will be bound to slice indices, and list values will be bound to a string representation of the slice elements.

func (ListBindGenericSlice[T]) ListAddKeyValuePair

func (l ListBindGenericSlice[T]) ListAddKeyValuePair(key, value string) error

func (ListBindGenericSlice[T]) ListDeleteKey

func (l ListBindGenericSlice[T]) ListDeleteKey(key string) bool

func (ListBindGenericSlice[T]) ListKeyValuePairs

func (l ListBindGenericSlice[T]) ListKeyValuePairs() []ListKeyValuePair

func (ListBindGenericSlice[T]) ListLen

func (l ListBindGenericSlice[T]) ListLen() int

type ListBindGenericValues

type ListBindGenericValues[T any] []T

ListBindGenericValues implements ListBinder for slices that are of some arbitrary type.

List keys and values will be bound to the string representation of the slice elements.

This is useful for dropdown components, as the key of the selected element will be set to the bound value.

This can not modify the bound list.

func (ListBindGenericValues[T]) ListAddKeyValuePair

func (l ListBindGenericValues[T]) ListAddKeyValuePair(key, value string) error

func (ListBindGenericValues[T]) ListDeleteKey

func (l ListBindGenericValues[T]) ListDeleteKey(key string) bool

func (ListBindGenericValues[T]) ListKeyValuePairs

func (l ListBindGenericValues[T]) ListKeyValuePairs() []ListKeyValuePair

func (ListBindGenericValues[T]) ListLen

func (l ListBindGenericValues[T]) ListLen() int

type ListBinder

type ListBinder interface {
	ListKeyValuePairs() []ListKeyValuePair
	ListDeleteKey(key string) bool               // Removes the entry with the given key, and returns true if it got deleted successfully.
	ListAddKeyValuePair(key, value string) error // Adds the key value pair to the list.
	ListLen() int                                // Returns the length of the list.
}

ListBinder describes an interface that simple lists can implement to be compatible with list based UI components.

type ListKeyValuePair

type ListKeyValuePair struct {
	Key, Value string
}

type RadioButton

type RadioButton struct {
	AttrMap vugu.AttrMap

	Bind ValueBinder // Binds the current selected key to some variable.
	Key  string      // The key that this RadioButton represents as a string.
}

RadioButton provides an option that the user can select. A group of RadioButtons is defined when they share a data binding.

func (*RadioButton) Build

func (c *RadioButton) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut)

type Tags

type Tags struct {
	AttrMap vugu.AttrMap

	Bind ListBinder // Binds the shown tags to some slice.
	// contains filtered or unexported fields
}

Tags provides a way for the user to add/remove entries from a slice.

func (*Tags) Build

func (c *Tags) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut)

type TextArea

type TextArea struct {
	AttrMap vugu.AttrMap

	Bind *string
}

TextArea is a text or number based input component. The HTML input type is determined by the bound data type.

func (*TextArea) Build

func (c *TextArea) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut)

type ValueBindAny

type ValueBindAny struct{ Value any }

ValueBindAny implements the ValueBinder interface for all basic types and the encoding.TextMarshaler, encoding.TextUnmarshaler interfaces.

func (ValueBindAny) HTMLInputType

func (f ValueBindAny) HTMLInputType() string

func (ValueBindAny) SetStringValue

func (f ValueBindAny) SetStringValue(value string) error

func (ValueBindAny) StringValue

func (f ValueBindAny) StringValue() string

type ValueBinder

type ValueBinder interface {
	ValueGetter
	ValueSetter
}

ValueBinder can be implemented by types that need to be bound to UI components.

type ValueGetter

type ValueGetter interface {
	StringValue() string // StringValue returns the value as a string formatted in the users/current locale.
}

ValueGetter can be implemented by types that need to be bound to UI components.

type ValueSetter

type ValueSetter interface {
	SetStringValue(string) error // SetStringValue parses the string value in the users/current locale.
}

ValueSetter can be implemented by types that need to be bound to UI components.

Jump to

Keyboard shortcuts

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