treeview.go 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VTreeviewBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VTreeview(children ...h.HTMLComponent) (r *VTreeviewBuilder) {
  11. r = &VTreeviewBuilder{
  12. tag: h.Tag("v-treeview").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VTreeviewBuilder) Activatable(v bool) (r *VTreeviewBuilder) {
  17. b.tag.Attr(":activatable", fmt.Sprint(v))
  18. return b
  19. }
  20. func (b *VTreeviewBuilder) Active(v interface{}) (r *VTreeviewBuilder) {
  21. b.tag.Attr(":active", h.JSONString(v))
  22. return b
  23. }
  24. func (b *VTreeviewBuilder) ActiveClass(v string) (r *VTreeviewBuilder) {
  25. b.tag.Attr("active-class", v)
  26. return b
  27. }
  28. func (b *VTreeviewBuilder) Color(v string) (r *VTreeviewBuilder) {
  29. b.tag.Attr("color", v)
  30. return b
  31. }
  32. func (b *VTreeviewBuilder) Dark(v bool) (r *VTreeviewBuilder) {
  33. b.tag.Attr(":dark", fmt.Sprint(v))
  34. return b
  35. }
  36. func (b *VTreeviewBuilder) Dense(v bool) (r *VTreeviewBuilder) {
  37. b.tag.Attr(":dense", fmt.Sprint(v))
  38. return b
  39. }
  40. func (b *VTreeviewBuilder) ExpandIcon(v string) (r *VTreeviewBuilder) {
  41. b.tag.Attr("expand-icon", v)
  42. return b
  43. }
  44. func (b *VTreeviewBuilder) Filter(v interface{}) (r *VTreeviewBuilder) {
  45. b.tag.Attr(":filter", h.JSONString(v))
  46. return b
  47. }
  48. func (b *VTreeviewBuilder) Hoverable(v bool) (r *VTreeviewBuilder) {
  49. b.tag.Attr(":hoverable", fmt.Sprint(v))
  50. return b
  51. }
  52. func (b *VTreeviewBuilder) IndeterminateIcon(v string) (r *VTreeviewBuilder) {
  53. b.tag.Attr("indeterminate-icon", v)
  54. return b
  55. }
  56. func (b *VTreeviewBuilder) ItemChildren(v string) (r *VTreeviewBuilder) {
  57. b.tag.Attr("item-children", v)
  58. return b
  59. }
  60. func (b *VTreeviewBuilder) ItemDisabled(v string) (r *VTreeviewBuilder) {
  61. b.tag.Attr("item-disabled", v)
  62. return b
  63. }
  64. func (b *VTreeviewBuilder) ItemKey(v string) (r *VTreeviewBuilder) {
  65. b.tag.Attr("item-key", v)
  66. return b
  67. }
  68. func (b *VTreeviewBuilder) ItemText(v string) (r *VTreeviewBuilder) {
  69. b.tag.Attr("item-text", v)
  70. return b
  71. }
  72. func (b *VTreeviewBuilder) Items(v interface{}) (r *VTreeviewBuilder) {
  73. b.tag.Attr(":items", h.JSONString(v))
  74. return b
  75. }
  76. func (b *VTreeviewBuilder) Light(v bool) (r *VTreeviewBuilder) {
  77. b.tag.Attr(":light", fmt.Sprint(v))
  78. return b
  79. }
  80. func (b *VTreeviewBuilder) LoadChildren(v interface{}) (r *VTreeviewBuilder) {
  81. b.tag.Attr(":load-children", h.JSONString(v))
  82. return b
  83. }
  84. func (b *VTreeviewBuilder) LoadingIcon(v string) (r *VTreeviewBuilder) {
  85. b.tag.Attr("loading-icon", v)
  86. return b
  87. }
  88. func (b *VTreeviewBuilder) MultipleActive(v bool) (r *VTreeviewBuilder) {
  89. b.tag.Attr(":multiple-active", fmt.Sprint(v))
  90. return b
  91. }
  92. func (b *VTreeviewBuilder) OffIcon(v string) (r *VTreeviewBuilder) {
  93. b.tag.Attr("off-icon", v)
  94. return b
  95. }
  96. func (b *VTreeviewBuilder) OnIcon(v string) (r *VTreeviewBuilder) {
  97. b.tag.Attr("on-icon", v)
  98. return b
  99. }
  100. func (b *VTreeviewBuilder) Open(v interface{}) (r *VTreeviewBuilder) {
  101. b.tag.Attr(":open", h.JSONString(v))
  102. return b
  103. }
  104. func (b *VTreeviewBuilder) OpenAll(v bool) (r *VTreeviewBuilder) {
  105. b.tag.Attr(":open-all", fmt.Sprint(v))
  106. return b
  107. }
  108. func (b *VTreeviewBuilder) OpenOnClick(v bool) (r *VTreeviewBuilder) {
  109. b.tag.Attr(":open-on-click", fmt.Sprint(v))
  110. return b
  111. }
  112. func (b *VTreeviewBuilder) ReturnObject(v bool) (r *VTreeviewBuilder) {
  113. b.tag.Attr(":return-object", fmt.Sprint(v))
  114. return b
  115. }
  116. func (b *VTreeviewBuilder) Rounded(v bool) (r *VTreeviewBuilder) {
  117. b.tag.Attr(":rounded", fmt.Sprint(v))
  118. return b
  119. }
  120. func (b *VTreeviewBuilder) Search(v string) (r *VTreeviewBuilder) {
  121. b.tag.Attr("search", v)
  122. return b
  123. }
  124. func (b *VTreeviewBuilder) Selectable(v bool) (r *VTreeviewBuilder) {
  125. b.tag.Attr(":selectable", fmt.Sprint(v))
  126. return b
  127. }
  128. func (b *VTreeviewBuilder) SelectedColor(v string) (r *VTreeviewBuilder) {
  129. b.tag.Attr("selected-color", v)
  130. return b
  131. }
  132. func (b *VTreeviewBuilder) SelectionType(v string) (r *VTreeviewBuilder) {
  133. b.tag.Attr("selection-type", v)
  134. return b
  135. }
  136. func (b *VTreeviewBuilder) Shaped(v bool) (r *VTreeviewBuilder) {
  137. b.tag.Attr(":shaped", fmt.Sprint(v))
  138. return b
  139. }
  140. func (b *VTreeviewBuilder) Transition(v bool) (r *VTreeviewBuilder) {
  141. b.tag.Attr(":transition", fmt.Sprint(v))
  142. return b
  143. }
  144. func (b *VTreeviewBuilder) Value(v interface{}) (r *VTreeviewBuilder) {
  145. b.tag.Attr(":value", h.JSONString(v))
  146. return b
  147. }
  148. func (b *VTreeviewBuilder) SetAttr(k string, v interface{}) {
  149. b.tag.SetAttr(k, v)
  150. }
  151. func (b *VTreeviewBuilder) Attr(vs ...interface{}) (r *VTreeviewBuilder) {
  152. b.tag.Attr(vs...)
  153. return b
  154. }
  155. func (b *VTreeviewBuilder) Children(children ...h.HTMLComponent) (r *VTreeviewBuilder) {
  156. b.tag.Children(children...)
  157. return b
  158. }
  159. func (b *VTreeviewBuilder) AppendChildren(children ...h.HTMLComponent) (r *VTreeviewBuilder) {
  160. b.tag.AppendChildren(children...)
  161. return b
  162. }
  163. func (b *VTreeviewBuilder) PrependChildren(children ...h.HTMLComponent) (r *VTreeviewBuilder) {
  164. b.tag.PrependChildren(children...)
  165. return b
  166. }
  167. func (b *VTreeviewBuilder) Class(names ...string) (r *VTreeviewBuilder) {
  168. b.tag.Class(names...)
  169. return b
  170. }
  171. func (b *VTreeviewBuilder) ClassIf(name string, add bool) (r *VTreeviewBuilder) {
  172. b.tag.ClassIf(name, add)
  173. return b
  174. }
  175. func (b *VTreeviewBuilder) On(name string, value string) (r *VTreeviewBuilder) {
  176. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  177. return b
  178. }
  179. func (b *VTreeviewBuilder) Bind(name string, value string) (r *VTreeviewBuilder) {
  180. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  181. return b
  182. }
  183. func (b *VTreeviewBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  184. return b.tag.MarshalHTML(ctx)
  185. }