From 3e00802e2c82fbc986d3d0b88b9e33e8dac24afc Mon Sep 17 00:00:00 2001
From: KMimura <40707315+KMimura@users.noreply.github.com>
Date: Mon, 25 Feb 2019 13:21:35 +0900
Subject: [PATCH 1/3] added File input box
---
gwu/textbox_pwbox.go | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/gwu/textbox_pwbox.go b/gwu/textbox_pwbox.go
index b517e1d..3f053a7 100644
--- a/gwu/textbox_pwbox.go
+++ b/gwu/textbox_pwbox.go
@@ -101,6 +101,7 @@ type textBoxImpl struct {
hasEnabledImpl // Has enabled implementation
isPassw bool // Tells if the text box is a password box
+ isFile bool // Tells if the text box accepts a file path
rows, cols int // Number of displayed rows and columns.
}
@@ -110,21 +111,28 @@ var (
// NewTextBox creates a new TextBox.
func NewTextBox(text string) TextBox {
- c := newTextBoxImpl(strEncURIThisV, text, false)
+ c := newTextBoxImpl(strEncURIThisV, text, false, false)
+ c.Style().AddClass("gwu-TextBox")
+ return &c
+}
+
+// NewFileTextBox creates a new TextBox that accept a file path.
+func NewFileTextBox(text string) TextBox {
+ c := newTextBoxImpl(strEncURIThisV, text, false, true)
c.Style().AddClass("gwu-TextBox")
return &c
}
// NewPasswBox creates a new PasswBox.
func NewPasswBox(text string) TextBox {
- c := newTextBoxImpl(strEncURIThisV, text, true)
+ c := newTextBoxImpl(strEncURIThisV, text, true, false)
c.Style().AddClass("gwu-PasswBox")
return &c
}
// newTextBoxImpl creates a new textBoxImpl.
-func newTextBoxImpl(valueProviderJs []byte, text string, isPassw bool) textBoxImpl {
- c := textBoxImpl{newCompImpl(valueProviderJs), newHasTextImpl(text), newHasEnabledImpl(), isPassw, 1, 20}
+func newTextBoxImpl(valueProviderJs []byte, text string, isPassw, isFile bool) textBoxImpl {
+ c := textBoxImpl{newCompImpl(valueProviderJs), newHasTextImpl(text), newHasEnabledImpl(), isPassw, isFile, 1, 20}
c.AddSyncOnETypes(ETypeChange)
return c
}
@@ -202,6 +210,7 @@ var (
strInputOp = []byte(``) // `"/>`
@@ -212,6 +221,8 @@ func (c *textBoxImpl) renderInput(w Writer) {
w.Write(strInputOp)
if c.isPassw {
w.Write(strPassword)
+ } else if c.isFile{
+ w.Write(strFile)
} else {
w.Write(strText)
}
From f259630f2cddea17bc568b0e78cf8a6ea295d276 Mon Sep 17 00:00:00 2001
From: KMimura <40707315+KMimura@users.noreply.github.com>
Date: Mon, 25 Feb 2019 13:39:57 +0900
Subject: [PATCH 2/3] created 'FileInputBox'
---
gwu/textbox_pwbox.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gwu/textbox_pwbox.go b/gwu/textbox_pwbox.go
index 3f053a7..727d1e9 100644
--- a/gwu/textbox_pwbox.go
+++ b/gwu/textbox_pwbox.go
@@ -116,8 +116,8 @@ func NewTextBox(text string) TextBox {
return &c
}
-// NewFileTextBox creates a new TextBox that accept a file path.
-func NewFileTextBox(text string) TextBox {
+// NewFileInputBox creates a new TextBox that accept a file path.
+func NewFileInputBox(text string) TextBox {
c := newTextBoxImpl(strEncURIThisV, text, false, true)
c.Style().AddClass("gwu-TextBox")
return &c
From 95f06cf73101073dc9ca07f1b90b4b0fa7c5e36a Mon Sep 17 00:00:00 2001
From: KMimura <40707315+KMimura@users.noreply.github.com>
Date: Mon, 25 Feb 2019 13:41:45 +0900
Subject: [PATCH 3/3] created 'FileInputBox'
---
gwu/textbox_pwbox.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gwu/textbox_pwbox.go b/gwu/textbox_pwbox.go
index 727d1e9..a9b5d6b 100644
--- a/gwu/textbox_pwbox.go
+++ b/gwu/textbox_pwbox.go
@@ -210,7 +210,7 @@ var (
strInputOp = []byte(``) // `"/>`