2023-06-26 22:23:07 +00:00
|
|
|
package input
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/vugu/vugu"
|
|
|
|
)
|
|
|
|
|
|
|
|
// TextArea is a text or number based input component.
|
|
|
|
// The HTML input type is determined by the bound data type.
|
|
|
|
type TextArea struct {
|
|
|
|
AttrMap vugu.AttrMap
|
|
|
|
|
2024-12-30 12:54:41 +00:00
|
|
|
Bind ValueBinder
|
2023-06-26 22:23:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *TextArea) content() string {
|
|
|
|
if c.Bind != nil {
|
2024-12-30 12:54:41 +00:00
|
|
|
return c.Bind.StringValue()
|
2023-06-26 22:23:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *TextArea) handleChange(event vugu.DOMEvent) {
|
|
|
|
val := event.PropString("target", "value")
|
|
|
|
|
|
|
|
if c.Bind != nil {
|
2024-12-30 12:54:41 +00:00
|
|
|
c.Bind.SetStringValue(val) // TODO: Error is omitted, we should show it
|
2023-06-26 22:23:07 +00:00
|
|
|
}
|
|
|
|
}
|