1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
package testdata
import (
tui "github.com/grindlemire/go-tui"
)
type myInput struct {
app *tui.App
}
func MyInput() *myInput {
return &myInput{}
}
func (c *myInput) handleSubmit(text string) {}
func (c *myInput) Render(app *tui.App) *tui.Element {
__tui_0 := tui.New(
tui.WithDisplay(tui.DisplayFlex), tui.WithDirection(tui.Column),
tui.WithGap(1),
)
__tui_1 := app.MountPersistent(c, 0, func() tui.Component {
return tui.NewInput(
tui.WithInputPlaceholder("Type here..."),
tui.WithInputValue(tui.NewState("hello")),
tui.WithInputWidth(30),
tui.WithInputBorder(tui.BorderRounded),
tui.WithInputOnSubmit(c.handleSubmit),
)
})
__tui_0.AddChild(__tui_1)
return __tui_0
}
func (c *myInput) updatePropsFields(fresh tui.Component) {
f, ok := fresh.(*myInput)
if !ok {
return
}
c.app = f.app
}
func (c *myInput) UpdateProps(fresh tui.Component) {
c.updatePropsFields(fresh)
}
var _ tui.PropsUpdater = (*myInput)(nil)
func (c *myInput) bindAppFields(app *tui.App) {
c.app = app
}
func (c *myInput) BindApp(app *tui.App) {
c.bindAppFields(app)
}
var _ tui.AppBinder = (*myInput)(nil)
|