Add input field buttons example

- Change d3c-button-transparent to d3c-button-borderless
This commit is contained in:
David Vogel 2023-05-25 17:44:44 +02:00
parent 6e74124634
commit 25a5cd3a2e
13 changed files with 222 additions and 60 deletions

View File

@ -29,9 +29,8 @@
flex-direction: column; flex-direction: column;
} }
.d3c-button-transparent .d3c-1633424238, .d3c-button-transparent.d3c-1633424238 { .d3c-button-borderless .d3c-1633424238, .d3c-button-borderless.d3c-1633424238 {
border: none; border: none;
background-color: transparent;
} }
.d3c-1633424238-highlighter { .d3c-1633424238-highlighter {

View File

@ -58,7 +58,7 @@ func (c *Button) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
} }
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Data: "style", Attr: []vugu.VGAttribute(nil)} vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Data: "style", Attr: []vugu.VGAttribute(nil)}
{ {
vgn.AppendChild(&vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t.d3c-1633424238 {\n\t\tposition: relative;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\tgap: 0.5em;\n\t\ttext-decoration: none;\n\t\tpadding: 0.3em 0.5em;\n\t\tmargin: 0.5em 0;\n\t\tborder-radius: 4px;\n\t\tborder: 1px solid var(--d3c-color-border);\n\t\tbackground-color: var(--d3c-color-background);\n\t\tcolor: var(--d3c-color-text);\n\t\twhite-space: nowrap;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t\tfont-size: 1em;\n\t\tfont-family: \"Segoe UI\", sans-serif;\n\t\tmin-height: 2em;\n\t\tuser-select: none;\n\t}\n\n\t.d3c-button-vertical .d3c-1633424238, .d3c-button-vertical.d3c-1633424238 {\n\t\tflex-direction: column;\n\t}\n\n\t.d3c-button-transparent .d3c-1633424238, .d3c-button-transparent.d3c-1633424238 {\n\t\tborder: none;\n\t\tbackground-color: transparent;\n\t}\n\n\t.d3c-1633424238-highlighter {\n\t\tposition: absolute;\n\t\tborder-radius: 2px;\n\t\theight: 4px;\n\t\tleft: 0.5em;\n\t\tright: 0.5em;\n\t\tbottom: 0;\n\t}\n\n\t.d3c-button-highlight .d3c-1633424238-highlighter, .d3c-button-highlight.d3c-1633424238-highlighter {\n\t\tbackground-color: var(--d3c-color-accent) !important;\n\t}\n\n\t.d3c-button-only-icon .d3c-1633424238 > *:nth-child(n+3), .d3c-button-only-icon.d3c-1633424238 > *:nth-child(n+3) {\n\t\tdisplay: none;\n\t}\n\n\t.d3c-1633424238:hover {\n\t\tbackground-color: var(--d3c-color-hovered);\n\t}\n\n\t.d3c-1633424238:active {\n\t\tbackground-color: var(--d3c-color-activated);\n\t}\n\n\t.d3c-1633424238:focus-visible {\n\t\toutline: 2px solid var(--d3c-color-accent);\n\t}\n", Attr: []vugu.VGAttribute(nil)}) vgn.AppendChild(&vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t.d3c-1633424238 {\n\t\tposition: relative;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\tgap: 0.5em;\n\t\ttext-decoration: none;\n\t\tpadding: 0.3em 0.5em;\n\t\tmargin: 0.5em 0;\n\t\tborder-radius: 4px;\n\t\tborder: 1px solid var(--d3c-color-border);\n\t\tbackground-color: var(--d3c-color-background);\n\t\tcolor: var(--d3c-color-text);\n\t\twhite-space: nowrap;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t\tfont-size: 1em;\n\t\tfont-family: \"Segoe UI\", sans-serif;\n\t\tmin-height: 2em;\n\t\tuser-select: none;\n\t}\n\n\t.d3c-button-vertical .d3c-1633424238, .d3c-button-vertical.d3c-1633424238 {\n\t\tflex-direction: column;\n\t}\n\n\t.d3c-button-borderless .d3c-1633424238, .d3c-button-borderless.d3c-1633424238 {\n\t\tborder: none;\n\t}\n\n\t.d3c-1633424238-highlighter {\n\t\tposition: absolute;\n\t\tborder-radius: 2px;\n\t\theight: 4px;\n\t\tleft: 0.5em;\n\t\tright: 0.5em;\n\t\tbottom: 0;\n\t}\n\n\t.d3c-button-highlight .d3c-1633424238-highlighter, .d3c-button-highlight.d3c-1633424238-highlighter {\n\t\tbackground-color: var(--d3c-color-accent) !important;\n\t}\n\n\t.d3c-button-only-icon .d3c-1633424238 > *:nth-child(n+3), .d3c-button-only-icon.d3c-1633424238 > *:nth-child(n+3) {\n\t\tdisplay: none;\n\t}\n\n\t.d3c-1633424238:hover {\n\t\tbackground-color: var(--d3c-color-hovered);\n\t}\n\n\t.d3c-1633424238:active {\n\t\tbackground-color: var(--d3c-color-activated);\n\t}\n\n\t.d3c-1633424238:focus-visible {\n\t\toutline: 2px solid var(--d3c-color-accent);\n\t}\n", Attr: []vugu.VGAttribute(nil)})
} }
vgout.AppendCSS(vgn) vgout.AppendCSS(vgn)
return vgout return vgout

View File

@ -1,4 +1,4 @@
<div class="d3c-1684925699 d3c-button-transparent"> <div class="d3c-1684925699 d3c-button-borderless">
<input vg-attr='c.AttrMap' :type="c.inputType()" :value="c.content()" @input="c.handleChange(event)"> <input vg-attr='c.AttrMap' :type="c.inputType()" :value="c.content()" @input="c.handleChange(event)">
<vg-comp expr="c.DefaultSlot"></vg-comp> <vg-comp expr="c.DefaultSlot"></vg-comp>
<div class="d3c-1684925699-error d3c-color-critical" vg-if="c.err != nil"></div> <div class="d3c-1684925699-error d3c-color-critical" vg-if="c.err != nil"></div>

View File

@ -18,7 +18,7 @@ func (c *Field) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
var vgiterkey interface{} var vgiterkey interface{}
_ = vgiterkey _ = vgiterkey
var vgn *vugu.VGNode var vgn *vugu.VGNode
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "div", Attr: []vugu.VGAttribute{vugu.VGAttribute{Namespace: "", Key: "class", Val: "d3c-1684925699 d3c-button-transparent"}}} vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "div", Attr: []vugu.VGAttribute{vugu.VGAttribute{Namespace: "", Key: "class", Val: "d3c-1684925699 d3c-button-borderless"}}}
vgout.Out = append(vgout.Out, vgn) // root for output vgout.Out = append(vgout.Out, vgn) // root for output
{ {
vgparent := vgn vgparent := vgn

View File

@ -28,9 +28,8 @@
flex-direction: column; flex-direction: column;
} }
.d3c-button-transparent .d3c-1683622560, .d3c-button-transparent.d3c-1683622560 { .d3c-button-borderless .d3c-1683622560, .d3c-button-borderless.d3c-1683622560 {
border: none; border: none;
background-color: transparent;
} }
.d3c-1683622560-highlighter { .d3c-1683622560-highlighter {

View File

@ -58,7 +58,7 @@ func (c *SidebarEntry) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
} }
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Data: "style", Attr: []vugu.VGAttribute(nil)} vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Data: "style", Attr: []vugu.VGAttribute(nil)}
{ {
vgn.AppendChild(&vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t.d3c-1683622560 {\n\t\tposition: relative;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tgap: 0.5em;\n\t\ttext-decoration: none;\n\t\tpadding: 0.3em 0.5em;\n\t\tmargin: 0.5em 0;\n\t\tborder-radius: 4px;\n\t\tborder: 1px solid var(--d3c-color-border);\n\t\tbackground-color: var(--d3c-color-background);\n\t\tcolor: var(--d3c-color-text);\n\t\twhite-space: nowrap;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t\tfont-size: 1em;\n\t\tfont-family: \"Segoe UI\", sans-serif;\n\t\tmin-height: 2em;\n\t\tuser-select: none;\n\t}\n\n\t.d3c-button-vertical .d3c-1683622560, .d3c-button-vertical.d3c-1683622560 {\n\t\tflex-direction: column;\n\t}\n\n\t.d3c-button-transparent .d3c-1683622560, .d3c-button-transparent.d3c-1683622560 {\n\t\tborder: none;\n\t\tbackground-color: transparent;\n\t}\n\n\t.d3c-1683622560-highlighter {\n\t\tposition: absolute;\n\t\tborder-radius: 2px;\n\t\twidth: 4px;\n\t\ttop: 0.5em;\n\t\tbottom: 0.5em;\n\t\tleft: 0;\n\t}\n\n\t.d3c-button-highlight .d3c-1683622560-highlighter, .d3c-button-highlight.d3c-1683622560-highlighter {\n\t\tbackground-color: var(--d3c-color-accent) !important;\n\t}\n\n\t.d3c-button-only-icon .d3c-1683622560 > *:nth-child(n+3), .d3c-button-only-icon.d3c-1683622560 > *:nth-child(n+3) {\n\t\tdisplay: none;\n\t}\n\n\t.d3c-1683622560:hover {\n\t\tbackground-color: var(--d3c-color-hovered);\n\t}\n\n\t.d3c-1683622560:active {\n\t\tbackground-color: var(--d3c-color-activated);\n\t}\n\n\t.d3c-1683622560:focus-visible {\n\t\toutline: 2px solid var(--d3c-color-accent);\n\t}\n", Attr: []vugu.VGAttribute(nil)}) vgn.AppendChild(&vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t.d3c-1683622560 {\n\t\tposition: relative;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tgap: 0.5em;\n\t\ttext-decoration: none;\n\t\tpadding: 0.3em 0.5em;\n\t\tmargin: 0.5em 0;\n\t\tborder-radius: 4px;\n\t\tborder: 1px solid var(--d3c-color-border);\n\t\tbackground-color: var(--d3c-color-background);\n\t\tcolor: var(--d3c-color-text);\n\t\twhite-space: nowrap;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t\tfont-size: 1em;\n\t\tfont-family: \"Segoe UI\", sans-serif;\n\t\tmin-height: 2em;\n\t\tuser-select: none;\n\t}\n\n\t.d3c-button-vertical .d3c-1683622560, .d3c-button-vertical.d3c-1683622560 {\n\t\tflex-direction: column;\n\t}\n\n\t.d3c-button-borderless .d3c-1683622560, .d3c-button-borderless.d3c-1683622560 {\n\t\tborder: none;\n\t}\n\n\t.d3c-1683622560-highlighter {\n\t\tposition: absolute;\n\t\tborder-radius: 2px;\n\t\twidth: 4px;\n\t\ttop: 0.5em;\n\t\tbottom: 0.5em;\n\t\tleft: 0;\n\t}\n\n\t.d3c-button-highlight .d3c-1683622560-highlighter, .d3c-button-highlight.d3c-1683622560-highlighter {\n\t\tbackground-color: var(--d3c-color-accent) !important;\n\t}\n\n\t.d3c-button-only-icon .d3c-1683622560 > *:nth-child(n+3), .d3c-button-only-icon.d3c-1683622560 > *:nth-child(n+3) {\n\t\tdisplay: none;\n\t}\n\n\t.d3c-1683622560:hover {\n\t\tbackground-color: var(--d3c-color-hovered);\n\t}\n\n\t.d3c-1683622560:active {\n\t\tbackground-color: var(--d3c-color-activated);\n\t}\n\n\t.d3c-1683622560:focus-visible {\n\t\toutline: 2px solid var(--d3c-color-accent);\n\t}\n", Attr: []vugu.VGAttribute(nil)})
} }
vgout.AppendCSS(vgn) vgout.AppendCSS(vgn)
return vgout return vgout

View File

@ -1,5 +1,5 @@
<div vg-attr='utils.AttributesAppend{AttrMap: c.AttrMap, Classes: "d3c-1633357633"}'> <div vg-attr='utils.AttributesAppend{AttrMap: c.AttrMap, Classes: "d3c-1633357633"}'>
<div :class='"d3c-1633357633-sidebar d3c-button-transparent d3c-color-layer-1 " + c.sidebarClasses'> <div :class='"d3c-1633357633-sidebar d3c-button-borderless d3c-color-layer-1 " + c.sidebarClasses'>
<div class="d3c-1633357633-sidebar-menu"> <div class="d3c-1633357633-sidebar-menu">
<input:Button @Click="c.handleMenuButton(event)"> <input:Button @Click="c.handleMenuButton(event)">
<vg-slot name="IconSlot"><icons:LGlobalNav></icons:LGlobalNav></vg-slot> <vg-slot name="IconSlot"><icons:LGlobalNav></icons:LGlobalNav></vg-slot>
@ -18,7 +18,7 @@
<div class="d3c-1633357633-body"> <div class="d3c-1633357633-body">
<div vg-if="c.showBodyOverlay" class="d3c-1633357633-body-overlay" @click="c.handleOverlayClick(event)"> <div vg-if="c.showBodyOverlay" class="d3c-1633357633-body-overlay" @click="c.handleOverlayClick(event)">
</div> </div>
<div class="d3c-1633357633-menu d3c-button-transparent d3c-color-layer-1"> <div class="d3c-1633357633-menu d3c-button-borderless d3c-color-layer-1">
<input:Button @Click="c.handleMenuButton(event)"> <input:Button @Click="c.handleMenuButton(event)">
<vg-slot name="IconSlot"><icons:LGlobalNav></icons:LGlobalNav></vg-slot> <vg-slot name="IconSlot"><icons:LGlobalNav></icons:LGlobalNav></vg-slot>
</input:Button> </input:Button>

View File

@ -31,7 +31,7 @@ func (c *Sidebar) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "div", Attr: []vugu.VGAttribute(nil)} vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "div", Attr: []vugu.VGAttribute(nil)}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
vgn.AddAttrInterface("class", "d3c-1633357633-sidebar d3c-button-transparent d3c-color-layer-1 "+c.sidebarClasses) vgn.AddAttrInterface("class", "d3c-1633357633-sidebar d3c-button-borderless d3c-color-layer-1 "+c.sidebarClasses)
{ {
vgparent := vgn vgparent := vgn
_ = vgparent _ = vgparent
@ -172,7 +172,7 @@ func (c *Sidebar) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
} }
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "div", Attr: []vugu.VGAttribute{vugu.VGAttribute{Namespace: "", Key: "class", Val: "d3c-1633357633-menu d3c-button-transparent d3c-color-layer-1"}}} vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "div", Attr: []vugu.VGAttribute{vugu.VGAttribute{Namespace: "", Key: "class", Val: "d3c-1633357633-menu d3c-button-borderless d3c-color-layer-1"}}}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgparent := vgn vgparent := vgn

View File

@ -3,7 +3,7 @@
<div :class='c.modalContainerClasses'> <div :class='c.modalContainerClasses'>
<div :class='"d3c-1684423938-modal-menu " + c.modalSignalClasses'> <div :class='"d3c-1684423938-modal-menu " + c.modalSignalClasses'>
<h3 class="d3c-1684423938-modal-title" style="flex-grow:1" vg-content="c.modalTitle"></h3> <h3 class="d3c-1684423938-modal-title" style="flex-grow:1" vg-content="c.modalTitle"></h3>
<input:Button @Click="c.handleModalClose(event)" class="d3c-button-transparent"><vg-slot name="IconSlot"><icons:LCancel></icons:LCancel></vg-slot></input:Button> <input:Button @Click="c.handleModalClose(event)" class="d3c-button-borderless"><vg-slot name="IconSlot"><icons:LCancel></icons:LCancel></vg-slot></input:Button>
</div> </div>
<vg-comp expr="c.modal"></vg-comp> <vg-comp expr="c.modal"></vg-comp>
</div> </div>
@ -13,7 +13,7 @@
<div :class='"d3c-1684423938-toast-signal " + toast.signalClasses '></div> <div :class='"d3c-1684423938-toast-signal " + toast.signalClasses '></div>
<div class="d3c-1684423938-toast-body"><vg-comp expr="toast.body"></vg-comp></div> <div class="d3c-1684423938-toast-body"><vg-comp expr="toast.body"></vg-comp></div>
<div class="d3c-1684423938-toast-menu"> <div class="d3c-1684423938-toast-menu">
<input:Button @Click="c.handleToastClose(event, toast.body)" class="d3c-button-transparent"><vg-slot name="IconSlot"><icons:LCancel></icons:LCancel></vg-slot></input:Button> <input:Button @Click="c.handleToastClose(event, toast.body)" class="d3c-button-borderless"><vg-slot name="IconSlot"><icons:LCancel></icons:LCancel></vg-slot></input:Button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -67,7 +67,7 @@ func (c *Container) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
} }
vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around
vgcomp.AttrMap = make(map[string]interface{}, 8) vgcomp.AttrMap = make(map[string]interface{}, 8)
vgcomp.AttrMap["class"] = "d3c-button-transparent" vgcomp.AttrMap["class"] = "d3c-button-borderless"
vgcomp.Click = input.ClickFunc(func(event input.ClickEvent) { c.handleModalClose(event) }) vgcomp.Click = input.ClickFunc(func(event input.ClickEvent) { c.handleModalClose(event) })
vgcomp.IconSlot = vugu.NewBuilderFunc(func(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgcomp.IconSlot = vugu.NewBuilderFunc(func(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn := &vugu.VGNode{Type: vugu.VGNodeType(3)} vgn := &vugu.VGNode{Type: vugu.VGNodeType(3)}
@ -179,7 +179,7 @@ func (c *Container) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
} }
vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around
vgcomp.AttrMap = make(map[string]interface{}, 8) vgcomp.AttrMap = make(map[string]interface{}, 8)
vgcomp.AttrMap["class"] = "d3c-button-transparent" vgcomp.AttrMap["class"] = "d3c-button-borderless"
vgcomp.Click = input.ClickFunc(func(event input.ClickEvent) { c.handleToastClose(event, toast.body) }) vgcomp.Click = input.ClickFunc(func(event input.ClickEvent) { c.handleToastClose(event, toast.body) })
vgcomp.IconSlot = vugu.NewBuilderFunc(func(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) { vgcomp.IconSlot = vugu.NewBuilderFunc(func(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn := &vugu.VGNode{Type: vugu.VGNodeType(3)} vgn := &vugu.VGNode{Type: vugu.VGNodeType(3)}

View File

@ -4,8 +4,10 @@ type PageInput struct {
button1Counter int `vugu:"data"` button1Counter int `vugu:"data"`
button4Bool bool `vugu:"data"` button4Bool bool `vugu:"data"`
input1String string `vugu:"data"` inputField1String string `vugu:"data"`
input2Int int `vugu:"data"` inputField2Int int `vugu:"data"`
input3Float float64 `vugu:"data"` inputField3Float float64 `vugu:"data"`
input4String string `vugu:"data"` inputField4String string `vugu:"data"`
inputField5String string `vugu:"data"`
inputField5Bool bool `vugu:"data"`
} }

View File

@ -48,23 +48,34 @@
<p>Input fields can be bound to data. They will automatically change their type based on the bound data type.</p> <p>Input fields can be bound to data. They will automatically change their type based on the bound data type.</p>
<view:Code> <view:Code>
<pre vg-content='"<label for=\"page-input-1\">Some input field</label>\n" + <pre vg-content='"<label for=\"page-input-1\">Some input field</label>\n" +
"<input:Field id=\"page-input-1\" :Bind=\"input.FieldBindAny{&c.input1String}\"></input:Field>"' style="margin: 0;"></pre> "<input:Field id=\"page-input-1\" :Bind=\"input.FieldBindAny{&c.inputField1String}\"></input:Field>"' style="margin: 0;"></pre>
</view:Code> </view:Code>
<label for="page-input-1">Some input field bound to string value</label> <label for="page-input-1">Some input field bound to string value</label>
<input:Field id="page-input-1" :Bind="input.FieldBindAny{&c.input1String}"></input:Field> <input:Field id="page-input-1" :Bind="input.FieldBindAny{&c.inputField1String}"></input:Field>
<span vg-content='fmt.Sprintf("Current value is %q.", c.input1String)'></span> <span vg-content='fmt.Sprintf("Current value is %q.", c.inputField1String)'></span>
<br> <br>
<label for="page-input-2">Some input field bound to integer value</label> <label for="page-input-2">Some input field bound to integer value</label>
<input:Field id="page-input-2" :Bind="input.FieldBindAny{&c.input2Int}"></input:Field> <input:Field id="page-input-2" :Bind="input.FieldBindAny{&c.inputField2Int}"></input:Field>
<span vg-content='fmt.Sprintf("Current value is %v.", c.input2Int)'></span> <span vg-content='fmt.Sprintf("Current value is %v.", c.inputField2Int)'></span>
<br> <br>
<label for="page-input-3">Some input field bound to float value</label> <label for="page-input-3">Some input field bound to float value</label>
<input:Field id="page-input-3" :Bind="input.FieldBindAny{&c.input3Float}"></input:Field> <input:Field id="page-input-3" :Bind="input.FieldBindAny{&c.inputField3Float}"></input:Field>
<span vg-content='fmt.Sprintf("Current value is %v.", c.input3Float)'></span> <span vg-content='fmt.Sprintf("Current value is %v.", c.inputField3Float)'></span>
<p>For passwords you have to use the <view:CodeInline>input.FieldBindPassword</view:CodeInline> binder:</p> <p>For passwords you have to use the <view:CodeInline>input.FieldBindPassword</view:CodeInline> binder:</p>
<label for="page-input-4">Some input field bound to password string</label> <label for="page-input-4">Some input field bound to password string</label>
<input:Field id="page-input-4" :Bind="input.FieldBindPassword{&c.input4String}"></input:Field> <input:Field id="page-input-4" :Bind="input.FieldBindPassword{&c.inputField4String}"></input:Field>
<span vg-content='fmt.Sprintf("Secret password is %q.", c.input4String)'></span> <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>
<input:Field id="page-input-5" :Bind="input.FieldBindAny{&c.inputField5String}">
<input:Button :Bind="&c.inputField5Bool">
<icons:LLockOpened vg-if="!c.inputField5Bool" class="d3c-button-borderless"></icons:LLockOpened>
<icons:LLockClosed vg-if="c.inputField5Bool" class="d3c-button-borderless"></icons:LLockClosed>
</input:Button>
<input:Button>
<icons:LGlobe></icons:LGlobe>
</input:Button>
</input:Field>
</layout:Container> </layout:Container>
</div> </div>

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"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0xC22DDE5B6BFE0832^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0xCEEA144C25FF2E6B^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*layout.Container) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*layout.Container)
if vgcomp == nil { 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 "} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "Clickable components support the "}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0x59F69B4F6C5BDA6A^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0x293C7847767D0443^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline)
if vgcomp == nil { 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 "} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: " event that handlers can be registered to with "}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0x14219A8F237A8A44^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0x2E397688ACD190A2^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline)
if vgcomp == nil { 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"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0x9794E8F35738F27^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0xD5BA3CC9CD0D12FE^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code)
if vgcomp == nil { 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"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0x4F033E58EC649380^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0xA425E79111F90BDD^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code)
if vgcomp == nil { 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"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0x10CD21DEF4514889^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0x4BD198012B78C1B4^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button)
if vgcomp == nil { 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"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0xF7BB886DF1216355^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0x77450DC118F5A209^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code)
if vgcomp == nil { 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"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0xF8A2420E39F2415C^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0xF4282C931C72C8BE^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button)
if vgcomp == nil { if vgcomp == nil {
@ -284,7 +284,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
_ = vgparent _ = vgparent
{ {
vgcompKey := vugu.MakeCompKey(0xF0C7F02200B137BC^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0xAF781B607847C544^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LDocument) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LDocument)
if vgcomp == nil { 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 "} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "Use the "}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0xEB81B350C2CF1159^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0x354C94E7EBA72AAC^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline)
if vgcomp == nil { 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"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0x2DC9BCD93B9858D1^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0x9ED5C23518440634^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code)
if vgcomp == nil { 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"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0xEA75A143AA77A70F^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0x4A176307736BB1F7^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button)
if vgcomp == nil { if vgcomp == nil {
@ -414,7 +414,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
_ = vgparent _ = vgparent
{ {
vgcompKey := vugu.MakeCompKey(0x5C6C5649D58283EC^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0x1553CB8390B8D1DF^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LGlobe) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LGlobe)
if vgcomp == nil { 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"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0xC55F497851F56570^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0xEB960134DB660ED7^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code)
if vgcomp == nil { 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"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0xF1AD429EB840E2F^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0x62538CCFB0C3AF11^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button)
if vgcomp == nil { if vgcomp == nil {
@ -529,7 +529,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0xDD9A2869F1839484^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0xEC245637543BA0FC^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.Code)
if vgcomp == nil { if vgcomp == nil {
@ -550,7 +550,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "pre", Attr: []vugu.VGAttribute{vugu.VGAttribute{Namespace: "", Key: "style", Val: "margin: 0;"}}} vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "pre", Attr: []vugu.VGAttribute{vugu.VGAttribute{Namespace: "", Key: "style", Val: "margin: 0;"}}}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
vgn.SetInnerHTML("<label for=\"page-input-1\">Some input field</label>\n" + vgn.SetInnerHTML("<label for=\"page-input-1\">Some input field</label>\n" +
"<input:Field id=\"page-input-1\" :Bind=\"input.FieldBindAny{&c.input1String}\"></input:Field>") "<input:Field id=\"page-input-1\" :Bind=\"input.FieldBindAny{&c.inputField1String}\"></input:Field>")
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
return return
@ -567,7 +567,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0x7D4F43932DEDE021^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0x6526634FF3B54319^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Field) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Field)
if vgcomp == nil { if vgcomp == nil {
@ -576,7 +576,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgin.BuildEnv.WireComponent(vgcomp) vgin.BuildEnv.WireComponent(vgcomp)
} }
vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around
vgcomp.Bind = input.FieldBindAny{&c.input1String} vgcomp.Bind = input.FieldBindAny{&c.inputField1String}
vgcomp.AttrMap = make(map[string]interface{}, 8) vgcomp.AttrMap = make(map[string]interface{}, 8)
vgcomp.AttrMap["id"] = "page-input-1" vgcomp.AttrMap["id"] = "page-input-1"
vgout.Components = append(vgout.Components, vgcomp) vgout.Components = append(vgout.Components, vgcomp)
@ -587,7 +587,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "span", Attr: []vugu.VGAttribute(nil)} vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "span", Attr: []vugu.VGAttribute(nil)}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
vgn.SetInnerHTML(fmt.Sprintf("Current value is %q.", c.input1String)) vgn.SetInnerHTML(fmt.Sprintf("Current value is %q.", c.inputField1String))
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "br", Attr: []vugu.VGAttribute(nil)} vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "br", Attr: []vugu.VGAttribute(nil)}
@ -601,7 +601,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0xB0EA81F9A317ADA1^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0x5BC320CBDC58240^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Field) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Field)
if vgcomp == nil { if vgcomp == nil {
@ -610,7 +610,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgin.BuildEnv.WireComponent(vgcomp) vgin.BuildEnv.WireComponent(vgcomp)
} }
vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around
vgcomp.Bind = input.FieldBindAny{&c.input2Int} vgcomp.Bind = input.FieldBindAny{&c.inputField2Int}
vgcomp.AttrMap = make(map[string]interface{}, 8) vgcomp.AttrMap = make(map[string]interface{}, 8)
vgcomp.AttrMap["id"] = "page-input-2" vgcomp.AttrMap["id"] = "page-input-2"
vgout.Components = append(vgout.Components, vgcomp) vgout.Components = append(vgout.Components, vgcomp)
@ -621,7 +621,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "span", Attr: []vugu.VGAttribute(nil)} vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "span", Attr: []vugu.VGAttribute(nil)}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
vgn.SetInnerHTML(fmt.Sprintf("Current value is %v.", c.input2Int)) vgn.SetInnerHTML(fmt.Sprintf("Current value is %v.", c.inputField2Int))
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "br", Attr: []vugu.VGAttribute(nil)} vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "br", Attr: []vugu.VGAttribute(nil)}
@ -635,7 +635,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0x819FBFBA88D2E9E7^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0xF46C5FDA4EC7E69^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Field) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Field)
if vgcomp == nil { if vgcomp == nil {
@ -644,7 +644,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgin.BuildEnv.WireComponent(vgcomp) vgin.BuildEnv.WireComponent(vgcomp)
} }
vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around
vgcomp.Bind = input.FieldBindAny{&c.input3Float} vgcomp.Bind = input.FieldBindAny{&c.inputField3Float}
vgcomp.AttrMap = make(map[string]interface{}, 8) vgcomp.AttrMap = make(map[string]interface{}, 8)
vgcomp.AttrMap["id"] = "page-input-3" vgcomp.AttrMap["id"] = "page-input-3"
vgout.Components = append(vgout.Components, vgcomp) vgout.Components = append(vgout.Components, vgcomp)
@ -655,7 +655,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "span", Attr: []vugu.VGAttribute(nil)} vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "span", Attr: []vugu.VGAttribute(nil)}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
vgn.SetInnerHTML(fmt.Sprintf("Current value is %v.", c.input3Float)) vgn.SetInnerHTML(fmt.Sprintf("Current value is %v.", c.inputField3Float))
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "p", Attr: []vugu.VGAttribute(nil)} vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "p", Attr: []vugu.VGAttribute(nil)}
@ -666,7 +666,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
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 use the "}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0x620ADFDAD9D1E612^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0xEA1DA1E311E89B9D^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*view.CodeInline)
if vgcomp == nil { if vgcomp == nil {
@ -701,7 +701,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"} vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
{ {
vgcompKey := vugu.MakeCompKey(0x947AC7AB0BD9A1A1^vgin.CurrentPositionHash(), vgiterkey) vgcompKey := vugu.MakeCompKey(0x7F57299092001AA3^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component // ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Field) vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Field)
if vgcomp == nil { if vgcomp == nil {
@ -710,7 +710,7 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgin.BuildEnv.WireComponent(vgcomp) vgin.BuildEnv.WireComponent(vgcomp)
} }
vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around
vgcomp.Bind = input.FieldBindPassword{&c.input4String} vgcomp.Bind = input.FieldBindPassword{&c.inputField4String}
vgcomp.AttrMap = make(map[string]interface{}, 8) vgcomp.AttrMap = make(map[string]interface{}, 8)
vgcomp.AttrMap["id"] = "page-input-4" vgcomp.AttrMap["id"] = "page-input-4"
vgout.Components = append(vgout.Components, vgcomp) vgout.Components = append(vgout.Components, vgcomp)
@ -721,8 +721,159 @@ func (c *PageInput) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "span", Attr: []vugu.VGAttribute(nil)} vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "span", Attr: []vugu.VGAttribute(nil)}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
vgn.SetInnerHTML(fmt.Sprintf("Secret password is %q.", c.input4String)) vgn.SetInnerHTML(fmt.Sprintf("Secret password is %q.", c.inputField4String))
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\n\t"} 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("You can add additional buttons to the input field:"))
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-5"}}}
vgparent.AppendChild(vgn)
vgn.SetInnerHTML(vugu.HTML("Some input field with some extra button"))
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0xF0289D7E34872CA4^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.inputField5String}
vgcomp.AttrMap = make(map[string]interface{}, 8)
vgcomp.AttrMap["id"] = "page-input-5"
vgcomp.DefaultSlot = vugu.NewBuilderFunc(func(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn := &vugu.VGNode{Type: vugu.VGNodeType(3)}
vgout = &vugu.BuildOut{}
vgout.Out = append(vgout.Out, vgn)
vgparent := vgn
_ = vgparent
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0xD2C6B2B25A02A991^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button)
if vgcomp == nil {
// create new one if needed
vgcomp = new(input.Button)
vgin.BuildEnv.WireComponent(vgcomp)
}
vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around
vgcomp.Bind = &c.inputField5Bool
vgcomp.DefaultSlot = vugu.NewBuilderFunc(func(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn := &vugu.VGNode{Type: vugu.VGNodeType(3)}
vgout = &vugu.BuildOut{}
vgout.Out = append(vgout.Out, vgn)
vgparent := vgn
_ = vgparent
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t\t"}
vgparent.AppendChild(vgn)
if !c.inputField5Bool {
{
vgcompKey := vugu.MakeCompKey(0xA5DA8A9DBDB90700^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LLockOpened)
if vgcomp == nil {
// create new one if needed
vgcomp = new(icons.LLockOpened)
vgin.BuildEnv.WireComponent(vgcomp)
}
vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around
vgcomp.AttrMap = make(map[string]interface{}, 8)
vgcomp.AttrMap["class"] = "d3c-button-borderless"
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\t\t"}
vgparent.AppendChild(vgn)
if c.inputField5Bool {
{
vgcompKey := vugu.MakeCompKey(0xDD2A63E717759625^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LLockClosed)
if vgcomp == nil {
// create new one if needed
vgcomp = new(icons.LLockClosed)
vgin.BuildEnv.WireComponent(vgcomp)
}
vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around
vgcomp.AttrMap = make(map[string]interface{}, 8)
vgcomp.AttrMap["class"] = "d3c-button-borderless"
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\t"}
vgparent.AppendChild(vgn)
return
})
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\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0xA8B460D83294629^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*input.Button)
if vgcomp == nil {
// create new one if needed
vgcomp = new(input.Button)
vgin.BuildEnv.WireComponent(vgcomp)
}
vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around
vgcomp.DefaultSlot = vugu.NewBuilderFunc(func(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
vgn := &vugu.VGNode{Type: vugu.VGNodeType(3)}
vgout = &vugu.BuildOut{}
vgout.Out = append(vgout.Out, vgn)
vgparent := vgn
_ = vgparent
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t\t\t"}
vgparent.AppendChild(vgn)
{
vgcompKey := vugu.MakeCompKey(0xC486202221CDA1F7^vgin.CurrentPositionHash(), vgiterkey)
// ask BuildEnv for prior instance of this specific component
vgcomp, _ := vgin.BuildEnv.CachedComponent(vgcompKey).(*icons.LGlobe)
if vgcomp == nil {
// create new one if needed
vgcomp = new(icons.LGlobe)
vgin.BuildEnv.WireComponent(vgcomp)
}
vgin.BuildEnv.UseComponent(vgcompKey, vgcomp) // ensure we can use this in the cache next time around
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\t"}
vgparent.AppendChild(vgn)
return
})
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)
return
})
vgout.Components = append(vgout.Components, vgcomp)
vgn = &vugu.VGNode{Component: vgcomp}
vgparent.AppendChild(vgn)
}
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\n\t"}
vgparent.AppendChild(vgn) vgparent.AppendChild(vgn)
return return
}) })