Remove FieldBindPassword & Add support for time.Time

- Add Type field to input.Field that can override the input type
- Add support for time.Time to input.Field
- Update example PageInput
This commit is contained in:
David Vogel 2023-06-23 21:10:35 +02:00
parent 2f8a3b5016
commit 11199f5e0d
6 changed files with 114 additions and 76 deletions

View File

@ -1,6 +1,7 @@
{
"cSpell.words": [
"Dadido",
"datetime",
"domrender",
"Fullscreen",
"ldflags",

View File

@ -4,6 +4,7 @@ import (
"encoding"
"fmt"
"strconv"
"time"
)
// FieldBinder is an interface that everything that every type that wants to bind to an input field must implement.
@ -46,6 +47,8 @@ func (f FieldBindAny) String() string {
return strconv.FormatFloat(float64(*v), 'f', -1, 32) // TODO: Format number in current user's locale
case *float64:
return strconv.FormatFloat(float64(*v), 'f', -1, 64)
case *time.Time:
return v.Local().Format("2006-01-02T15:04")
case encoding.TextMarshaler:
data, _ := v.MarshalText() // Ignore any errors, as we can't handle them here.
return string(data)
@ -136,6 +139,12 @@ func (f FieldBindAny) SetString(value string) error {
return err
}
*v = float64(val)
case *time.Time:
val, err := time.ParseInLocation("2006-01-02T15:04", value, time.Local)
if err != nil {
return err
}
*v = val
case encoding.TextUnmarshaler:
return v.UnmarshalText([]byte(value))
default:
@ -155,33 +164,11 @@ func (f FieldBindAny) HTMLInputType() string {
return "number"
case *float32, *float64:
return "number"
case *time.Time:
return "datetime-local"
case encoding.TextMarshaler, encoding.TextUnmarshaler:
return "text"
}
return "text"
}
// FieldBindPassword implements the FieldBinder interface for strings.
type FieldBindPassword struct{ Value *string }
func (f FieldBindPassword) String() string {
if f.Value != nil {
return *f.Value
}
return ""
}
func (f FieldBindPassword) SetString(value string) error {
if f.Value != nil {
*f.Value = value
return nil
}
return fmt.Errorf("no value is bound to this component")
}
func (f FieldBindPassword) HTMLInputType() string {
return "password"
}

View File

@ -14,6 +14,8 @@ type Field struct {
DefaultSlot vugu.Builder
Type string // Overrides the type of the input component.
err error // Current error caused by any invalid input.
}
@ -26,6 +28,10 @@ func (c *Field) content() string {
}
func (c *Field) inputType() string {
if c.Type != "" {
return c.Type
}
if c.Bind != nil {
return c.Bind.HTMLInputType()
}

View File

@ -1,6 +1,10 @@
package main
import "github.com/vugu/vugu"
import (
"time"
"github.com/vugu/vugu"
)
type PageInput struct {
button1Counter int `vugu:"data"`
@ -18,6 +22,7 @@ type PageInput struct {
inputField5String string `vugu:"data"`
inputField5Bool bool `vugu:"data"`
inputField6Bool bool `vugu:"data"`
inputField7Time time.Time `vugu:"data"`
dropdown1Slice []string `vugu:"data"`
dropdown1Index int `vugu:"data"`
@ -28,6 +33,7 @@ type PageInput struct {
func (c *PageInput) Init(ctx vugu.InitCtx) {
c.radioButton1 = "B"
c.checkBox2 = true
c.inputField7Time = time.Now()
c.dropdown1Slice = []string{"This", "is", "a", "list", "of", "things!"}
c.tags1Slice = []string{"some", "tags"}
}

View File

@ -92,9 +92,9 @@
<label for="page-input-6">Some input field bound to bool value</label>
<input:Field ID="page-input-6" :Bind="input.FieldBindAny{&c.inputField6Bool}"></input:Field>
<span vg-content='fmt.Sprintf("Current state is %v.", c.inputField6Bool)'></span>
<p>For passwords you have to use the <view:CodeInline>input.FieldBindPassword</view:CodeInline> binder:</p>
<p>For passwords you have to set the <view:CodeInline>Type="password"</view:CodeInline> field of the component:</p>
<label for="page-input-4">Some input field bound to password string</label>
<input:Field ID="page-input-4" :Bind="input.FieldBindPassword{&c.inputField4String}"></input:Field>
<input:Field ID="page-input-4" :Bind="input.FieldBindAny{&c.inputField4String}" Type="password"></input:Field>
<span vg-content='fmt.Sprintf("Secret password is %q.", c.inputField4String)'></span>
<p>You can add additional buttons to the input field:</p>
<label for="page-input-5">Some input field with some extra button</label>
@ -107,6 +107,10 @@
<icons:LGlobe></icons:LGlobe>
</input:Button>
</input:Field>
<p>time.Time is also supported:</p>
<label for="page-input-7">Some input field bound to a time.Time value</label>
<input:Field ID="page-input-7" :Bind="input.FieldBindAny{&c.inputField7Time}"></input:Field>
<span vg-content='fmt.Sprintf("Selected date and time is %v.", c.inputField7Time)'></span>
<h2>Drop-down</h2>
<label for="page-dropdown-1">Select a slice entry</label>

View File

@ -31,7 +31,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0xD91683A9B73577EE^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0xA7BF38F7A4F15FB1^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*layout.Container)
if vgcomp == nil {
@ -62,7 +62,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "Clickable components support the "}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x5B30FCAD26739F63^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x1BBFCEE5ECF27786^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline)
if vgcomp == nil {
@ -89,7 +89,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: " event that handlers can be registered to with "}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x6B9DB7F6B53653AE^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x76DA5A4D7ABA2079^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline)
if vgcomp == nil {
@ -117,7 +117,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0xF288C6CA8AD20954^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x2E1D3AB39AD10144^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code)
if vgcomp == nil {
@ -166,7 +166,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x3B4A927BBE7A1799^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x9726746926D8210F^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code)
if vgcomp == nil {
@ -198,7 +198,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x90DA35C1900DEDC8^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0xCBD014406ABD8E7F^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button)
if vgcomp == nil {
@ -232,7 +232,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x4D711FE64E9739F8^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x138295FF6DF1D969^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code)
if vgcomp == nil {
@ -267,7 +267,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x765CC91E21B26780^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0xAE9BFD565BC46B08^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button)
if vgcomp == nil {
@ -284,7 +284,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
_ = vgparent
{
vgcompKey := vugu.MakeCompKey(0x406B98FE10679DEC^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x52BE6DBBEDC24298^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LDocument)
if vgcomp == nil {
@ -330,7 +330,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "Use the "}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x61B658093D9F2480^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0xA5E3450E097417E6^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline)
if vgcomp == nil {
@ -360,7 +360,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x223C6A258C851839^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x16924E989032F15B^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code)
if vgcomp == nil {
@ -395,7 +395,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x262D746787D635F5^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0xD97E450127BB784C^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button)
if vgcomp == nil {
@ -414,7 +414,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
_ = vgparent
{
vgcompKey := vugu.MakeCompKey(0x1D5E2D2D1DC8E22B^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x33BAEA5D3DC63B9E^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LGlobe)
if vgcomp == nil {
@ -454,7 +454,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x166575EBA57E5395^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x31C77D55E912FB04^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code)
if vgcomp == nil {
@ -486,7 +486,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0xE099A60747E10D04^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x9E08C767F104F536^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button)
if vgcomp == nil {
@ -524,7 +524,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0xD69BB61B7D6C0736^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0xF3FCB1DBB43CD672^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code)
if vgcomp == nil {
@ -557,7 +557,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x2B23448F4992967D^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0xF602BFD925DBEE69^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.RadioButton)
if vgcomp == nil {
@ -587,7 +587,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x242A69A41C22FD77^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x862E0DFB092D8EFC^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.RadioButton)
if vgcomp == nil {
@ -617,7 +617,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0xB3591D43765CE4A6^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x8ED0FBD0D48EC151^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.RadioButton)
if vgcomp == nil {
@ -652,7 +652,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x356F69A257F5FFAC^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x25B165A3AE4838B5^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code)
if vgcomp == nil {
@ -685,7 +685,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0xB4DC6B64ABA54579^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x12B9256A2CAB3523^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.CheckBox)
if vgcomp == nil {
@ -714,7 +714,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x8E823C6B52892653^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x2898350697073FE9^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.CheckBox)
if vgcomp == nil {
@ -755,7 +755,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "To make labels work correctly, you have to use the "}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x8A395E3190C3BB17^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0xC90AD44CF5169056^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline)
if vgcomp == nil {
@ -785,7 +785,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0xDCC83ED7EF6D2B07^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x309EA081BB038019^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code)
if vgcomp == nil {
@ -823,7 +823,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x3C5D37BC91592864^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0xD2B67FE044D91FCE^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Field)
if vgcomp == nil {
@ -856,7 +856,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0xAD10FB81C6E8DBC6^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x255F990C3224E008^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Field)
if vgcomp == nil {
@ -889,7 +889,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x2227DAD00DA77ED^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0xEF716BA24AC432D4^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Field)
if vgcomp == nil {
@ -922,7 +922,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x9C29CAB437462211^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0xDBF4B9CBAE332106^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Field)
if vgcomp == nil {
@ -949,10 +949,10 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
{
vgparent := vgn
_ = vgparent
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "For passwords you have to use the "}
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "For passwords you have to set the "}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0xE03E10C30B31DCAE^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x9380782AB9F0496F^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline)
if vgcomp == nil {
@ -968,7 +968,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgparent := vgn
_ = vgparent
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "input.FieldBindPassword"}
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "Type=\"password\""}
vgparent.AppendChild(vgn)
return
})
@ -976,7 +976,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Component: vgcomp}
vgparent.AppendChild(vgn)
}
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: " binder:"}
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: " field of the component:"}
vgparent.AppendChild(vgn)
}
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
@ -987,7 +987,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0xF80E7959999F9A6E^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0xAE94EFCAA96C7B2B^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Field)
if vgcomp == nil {
@ -996,8 +996,9 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgin.BuildEnv.WireComponent(vgcomp)
}
vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around
vgcomp.Bind = input.FieldBindPassword{&c.inputField4String}
vgcomp.Bind = input.FieldBindAny{&c.inputField4String}
vgcomp.ID = "page-input-4"
vgcomp.Type = "password"
vgout.Components = append(vgout.Components, vgcomp)
vgn = &vugu.VGNode{Component: vgcomp}
vgparent.AppendChild(vgn)
@ -1020,7 +1021,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x24D83BEE34C19455^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0xCEB9FF384528CCBB^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Field)
if vgcomp == nil {
@ -1041,7 +1042,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x4C793F71A9D72212^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x151D017F3E93F8EA^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button)
if vgcomp == nil {
@ -1062,7 +1063,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgparent.AppendChild(vgn)
if !c.inputField5Bool {
{
vgcompKey := vugu.MakeCompKey(0xDBC6A1964C3AAB4E^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x564011B2B94AAA09^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LLockOpened)
if vgcomp == nil {
@ -1082,7 +1083,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgparent.AppendChild(vgn)
if c.inputField5Bool {
{
vgcompKey := vugu.MakeCompKey(0xADC3EACF8D017D8^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x208118A20A66CA35^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LLockClosed)
if vgcomp == nil {
@ -1109,7 +1110,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0xAAE16992DDE3F2B4^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0x2D48A2E1FE429FE5^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button)
if vgcomp == nil {
@ -1128,7 +1129,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0xF4E25069180419AB^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0xF2109FFEEC226E2F^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LGlobe)
if vgcomp == nil {
@ -1157,6 +1158,39 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Component: vgcomp}
vgparent.AppendChild(vgn)
}
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "p", Attr: []vugu.VGAttribute(nil)}
vgparent.AppendChild(vgn)
vgn.SetInnerHTML(vugu.HTML("time.Time is also supported:"))
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "label", Attr: []vugu.VGAttribute{vugu.VGAttribute{Namespace: "", Key: "for", Val: "page-input-7"}}}
vgparent.AppendChild(vgn)
vgn.SetInnerHTML(vugu.HTML("Some input field bound to a time.Time value"))
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x53FBACB92BF2833B^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Field)
if vgcomp == nil {
// create new one if needed
vgcomp = new(input.Field)
vgin.BuildEnv.WireComponent(vgcomp)
}
vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around
vgcomp.Bind = input.FieldBindAny{&c.inputField7Time}
vgcomp.ID = "page-input-7"
vgout.Components = append(vgout.Components, vgcomp)
vgn = &vugu.VGNode{Component: vgcomp}
vgparent.AppendChild(vgn)
}
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "span", Attr: []vugu.VGAttribute(nil)}
vgparent.AppendChild(vgn)
vgn.SetInnerHTML(fmt.Sprintf("Selected date and time is %v.", c.inputField7Time))
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\n\t\t"}
vgparent.AppendChild(vgn)
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "h2", Attr: []vugu.VGAttribute(nil)}
@ -1170,7 +1204,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0xA8B644EE4371B847^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0xDE6670421206A893^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Dropdown)
if vgcomp == nil {
@ -1205,7 +1239,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0x13F92885BE084412^vgin.CurrentPositionHash(), vgiterkey)
vgcompKey := vugu.MakeCompKey(0xA5223E429AA7432^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Tags)
if vgcomp == nil {