Documentation
¶
Index ¶
- Variables
- type Button
- type ChangeEvent
- type ChangeFunc
- type ChangeHandler
- type CheckBox
- type ClickEvent
- type ClickFunc
- type ClickHandler
- type Dropdown
- type Field
- type HTMLInputTyper
- type InputEvent
- type InputFunc
- type InputHandler
- type KeyDownEvent
- type KeyDownFunc
- type KeyDownHandler
- type KeyPressEvent
- type KeyPressFunc
- type KeyPressHandler
- type KeyUpEvent
- type KeyUpFunc
- type KeyUpHandler
- type ListBindGenericSlice
- type ListBindGenericValues
- type ListBinder
- type ListKeyValuePair
- type RadioButton
- type Tags
- type TextArea
- type ValueBindAny
- type ValueBinder
- type ValueGetter
- type ValueSetter
Constants ¶
This section is empty.
Variables ¶
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) Compute ¶
func (c *Button) Compute(ctx vugu.ComputeCtx)
func (*Button) HandleClick ¶
type ChangeEvent ¶
type ChangeFunc ¶
type ChangeFunc func(event ChangeEvent)
ChangeFunc implements ChangeHandler as a function.
func (ChangeFunc) ChangeHandle ¶
func (f ChangeFunc) ChangeHandle(event ChangeEvent)
ChangeHandle implements the ChangeHandler interface.
type ChangeHandler ¶
type ChangeHandler interface {
ChangeHandle(event ChangeEvent)
}
ChangeHandler is the interface for things that can handle ChangeEvent.
type CheckBox ¶
CheckBox is a boolean type input component. Similar to a button that can be toggled.
type ClickEvent ¶
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 ¶
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.
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.
Input InputHandler // External handler that is called upon an event.
KeyDown KeyDownHandler // External handler that is called upon an event.
KeyPress KeyPressHandler // External handler that is called upon an event.
KeyUp KeyUpHandler // External handler that is called upon an event.
// 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.
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 InputEvent ¶
type InputFunc ¶
type InputFunc func(event InputEvent)
InputFunc implements InputHandler as a function.
func (InputFunc) InputHandle ¶
func (f InputFunc) InputHandle(event InputEvent)
InputHandle implements the InputHandler interface.
type InputHandler ¶
type InputHandler interface {
InputHandle(event InputEvent)
}
InputHandler is the interface for things that can handle InputEvent.
type KeyDownEvent ¶
type KeyDownFunc ¶
type KeyDownFunc func(event KeyDownEvent)
KeyDownFunc implements KeyDownHandler as a function.
func (KeyDownFunc) KeyDownHandle ¶
func (f KeyDownFunc) KeyDownHandle(event KeyDownEvent)
KeyDownHandle implements the KeyDownHandler interface.
type KeyDownHandler ¶
type KeyDownHandler interface {
KeyDownHandle(event KeyDownEvent)
}
KeyDownHandler is the interface for things that can handle KeyDownEvent.
type KeyPressEvent ¶
type KeyPressFunc ¶
type KeyPressFunc func(event KeyPressEvent)
KeyPressFunc implements KeyPressHandler as a function.
func (KeyPressFunc) KeyPressHandle ¶
func (f KeyPressFunc) KeyPressHandle(event KeyPressEvent)
KeyPressHandle implements the KeyPressHandler interface.
type KeyPressHandler ¶
type KeyPressHandler interface {
KeyPressHandle(event KeyPressEvent)
}
KeyPressHandler is the interface for things that can handle KeyPressEvent.
type KeyUpEvent ¶
type KeyUpFunc ¶
type KeyUpFunc func(event KeyUpEvent)
KeyUpFunc implements KeyUpHandler as a function.
func (KeyUpFunc) KeyUpHandle ¶
func (f KeyUpFunc) KeyUpHandle(event KeyUpEvent)
KeyUpHandle implements the KeyUpHandler interface.
type KeyUpHandler ¶
type KeyUpHandler interface {
KeyUpHandle(event KeyUpEvent)
}
KeyUpHandler is the interface for things that can handle KeyUpEvent.
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.
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.
type TextArea ¶
type TextArea struct {
AttrMap vugu.AttrMap
Bind ValueBinder
Input InputHandler // External handler that is called upon an event.
KeyDown KeyDownHandler // External handler that is called upon an event.
KeyPress KeyPressHandler // External handler that is called upon an event.
KeyUp KeyUpHandler // External handler that is called upon an event.
}
TextArea is a text or number based input component. The HTML input type is determined by the bound data type.
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.