-
Notifications
You must be signed in to change notification settings - Fork 3
/
node_actionformmodal.go
105 lines (87 loc) · 2.83 KB
/
node_actionformmodal.go
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package node
import (
"github.com/BeanWei/li/li-engine/ac"
"github.com/BeanWei/li/li-engine/controller"
"github.com/BeanWei/li/li-engine/view"
"github.com/BeanWei/li/li-engine/view/ui"
)
func ActionFormModal(name string) *actionformmodalBuilder {
return &actionformmodalBuilder{&NodeBuilder{
schema: &ui.Schema{
Name: name,
Type: ui.SchemaTypeVoid,
XComponent: ui.ComponentActionFormModal,
XComponentProps: map[string]interface{}{
"modalProps": make(map[string]interface{}),
"layoutProps": make(map[string]interface{}),
},
HandlerNames: make([]string, 0),
},
}}
}
type actionformmodalBuilder struct {
*NodeBuilder
}
func (b *actionformmodalBuilder) AC(f ac.AC) *actionformmodalBuilder {
b.schema.AC = f
return b
}
func (b *actionformmodalBuilder) Title(title string) *actionformmodalBuilder {
b.SetTitle(title)
return b
}
func (b *actionformmodalBuilder) Description(description string) *actionformmodalBuilder {
b.SetDescription(description)
return b
}
// TODO: 支持通过回调函数获取
func (b *actionformmodalBuilder) InitialValues(initialValues map[string]interface{}) *actionformmodalBuilder {
b.schema.XComponentProps["initialValues"] = initialValues
return b
}
func (b *actionformmodalBuilder) ForInit(operation string, handler interface{}) *actionformmodalBuilder {
b.schema.XComponentProps["forInit"] = operation
b.schema.HandlerNames = append(b.schema.HandlerNames, operation)
controller.Bind(operation, handler)
return b
}
func (b *actionformmodalBuilder) ButtonStyle(style map[string]interface{}) *actionformmodalBuilder {
b.schema.XComponentProps["style"] = style
return b
}
func (b *actionformmodalBuilder) ButtonType(typ string) *actionformmodalBuilder {
b.schema.XComponentProps["type"] = typ
return b
}
func (b *actionformmodalBuilder) ButtonStatus(status string) *actionformmodalBuilder {
b.schema.XComponentProps["status"] = status
return b
}
func (b *actionformmodalBuilder) ButtonSize(size string) *actionformmodalBuilder {
b.schema.XComponentProps["size"] = size
return b
}
func (b *actionformmodalBuilder) ButtonShape(shape string) *actionformmodalBuilder {
b.schema.XComponentProps["shape"] = shape
return b
}
func (b *actionformmodalBuilder) ButtonIcon(icon string) *actionformmodalBuilder {
b.schema.XComponentProps["icon"] = icon
return b
}
func (b *actionformmodalBuilder) ButtonIconOnly(iconOnly bool) *actionformmodalBuilder {
b.schema.XComponentProps["iconOnly"] = iconOnly
return b
}
func (b *actionformmodalBuilder) ButtonLong(long bool) *actionformmodalBuilder {
b.schema.XComponentProps["long"] = long
return b
}
func (b *actionformmodalBuilder) Body(elements ...view.Node) *actionformmodalBuilder {
b.Items(elements...)
return b
}
func (b *actionformmodalBuilder) Footer(elements ...view.Node) *actionformmodalBuilder {
b.Children(elements...)
return b
}