menu.go 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VMenuBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VMenu(children ...h.HTMLComponent) (r *VMenuBuilder) {
  11. r = &VMenuBuilder{
  12. tag: h.Tag("v-menu").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VMenuBuilder) Absolute(v bool) (r *VMenuBuilder) {
  17. b.tag.Attr(":absolute", fmt.Sprint(v))
  18. return b
  19. }
  20. func (b *VMenuBuilder) Activator(v interface{}) (r *VMenuBuilder) {
  21. b.tag.Attr(":activator", h.JSONString(v))
  22. return b
  23. }
  24. func (b *VMenuBuilder) AllowOverflow(v bool) (r *VMenuBuilder) {
  25. b.tag.Attr(":allow-overflow", fmt.Sprint(v))
  26. return b
  27. }
  28. func (b *VMenuBuilder) Attach(v interface{}) (r *VMenuBuilder) {
  29. b.tag.Attr(":attach", h.JSONString(v))
  30. return b
  31. }
  32. func (b *VMenuBuilder) Auto(v bool) (r *VMenuBuilder) {
  33. b.tag.Attr(":auto", fmt.Sprint(v))
  34. return b
  35. }
  36. func (b *VMenuBuilder) Bottom(v bool) (r *VMenuBuilder) {
  37. b.tag.Attr(":bottom", fmt.Sprint(v))
  38. return b
  39. }
  40. func (b *VMenuBuilder) CloseDelay(v int) (r *VMenuBuilder) {
  41. b.tag.Attr(":close-delay", fmt.Sprint(v))
  42. return b
  43. }
  44. func (b *VMenuBuilder) CloseOnClick(v bool) (r *VMenuBuilder) {
  45. b.tag.Attr(":close-on-click", fmt.Sprint(v))
  46. return b
  47. }
  48. func (b *VMenuBuilder) CloseOnContentClick(v bool) (r *VMenuBuilder) {
  49. b.tag.Attr(":close-on-content-click", fmt.Sprint(v))
  50. return b
  51. }
  52. func (b *VMenuBuilder) ContentClass(v string) (r *VMenuBuilder) {
  53. b.tag.Attr("content-class", v)
  54. return b
  55. }
  56. func (b *VMenuBuilder) Dark(v bool) (r *VMenuBuilder) {
  57. b.tag.Attr(":dark", fmt.Sprint(v))
  58. return b
  59. }
  60. func (b *VMenuBuilder) DisableKeys(v bool) (r *VMenuBuilder) {
  61. b.tag.Attr(":disable-keys", fmt.Sprint(v))
  62. return b
  63. }
  64. func (b *VMenuBuilder) Disabled(v bool) (r *VMenuBuilder) {
  65. b.tag.Attr(":disabled", fmt.Sprint(v))
  66. return b
  67. }
  68. func (b *VMenuBuilder) Eager(v bool) (r *VMenuBuilder) {
  69. b.tag.Attr(":eager", fmt.Sprint(v))
  70. return b
  71. }
  72. func (b *VMenuBuilder) Fixed(v bool) (r *VMenuBuilder) {
  73. b.tag.Attr(":fixed", fmt.Sprint(v))
  74. return b
  75. }
  76. func (b *VMenuBuilder) InternalActivator(v bool) (r *VMenuBuilder) {
  77. b.tag.Attr(":internal-activator", fmt.Sprint(v))
  78. return b
  79. }
  80. func (b *VMenuBuilder) Left(v bool) (r *VMenuBuilder) {
  81. b.tag.Attr(":left", fmt.Sprint(v))
  82. return b
  83. }
  84. func (b *VMenuBuilder) Light(v bool) (r *VMenuBuilder) {
  85. b.tag.Attr(":light", fmt.Sprint(v))
  86. return b
  87. }
  88. func (b *VMenuBuilder) MaxHeight(v int) (r *VMenuBuilder) {
  89. b.tag.Attr(":max-height", fmt.Sprint(v))
  90. return b
  91. }
  92. func (b *VMenuBuilder) MaxWidth(v int) (r *VMenuBuilder) {
  93. b.tag.Attr(":max-width", fmt.Sprint(v))
  94. return b
  95. }
  96. func (b *VMenuBuilder) MinWidth(v int) (r *VMenuBuilder) {
  97. b.tag.Attr(":min-width", fmt.Sprint(v))
  98. return b
  99. }
  100. func (b *VMenuBuilder) NudgeBottom(v int) (r *VMenuBuilder) {
  101. b.tag.Attr(":nudge-bottom", fmt.Sprint(v))
  102. return b
  103. }
  104. func (b *VMenuBuilder) NudgeLeft(v int) (r *VMenuBuilder) {
  105. b.tag.Attr(":nudge-left", fmt.Sprint(v))
  106. return b
  107. }
  108. func (b *VMenuBuilder) NudgeRight(v int) (r *VMenuBuilder) {
  109. b.tag.Attr(":nudge-right", fmt.Sprint(v))
  110. return b
  111. }
  112. func (b *VMenuBuilder) NudgeTop(v int) (r *VMenuBuilder) {
  113. b.tag.Attr(":nudge-top", fmt.Sprint(v))
  114. return b
  115. }
  116. func (b *VMenuBuilder) NudgeWidth(v int) (r *VMenuBuilder) {
  117. b.tag.Attr(":nudge-width", fmt.Sprint(v))
  118. return b
  119. }
  120. func (b *VMenuBuilder) OffsetOverflow(v bool) (r *VMenuBuilder) {
  121. b.tag.Attr(":offset-overflow", fmt.Sprint(v))
  122. return b
  123. }
  124. func (b *VMenuBuilder) OffsetX(v bool) (r *VMenuBuilder) {
  125. b.tag.Attr(":offset-x", fmt.Sprint(v))
  126. return b
  127. }
  128. func (b *VMenuBuilder) OffsetY(v bool) (r *VMenuBuilder) {
  129. b.tag.Attr(":offset-y", fmt.Sprint(v))
  130. return b
  131. }
  132. func (b *VMenuBuilder) OpenDelay(v int) (r *VMenuBuilder) {
  133. b.tag.Attr(":open-delay", fmt.Sprint(v))
  134. return b
  135. }
  136. func (b *VMenuBuilder) OpenOnClick(v bool) (r *VMenuBuilder) {
  137. b.tag.Attr(":open-on-click", fmt.Sprint(v))
  138. return b
  139. }
  140. func (b *VMenuBuilder) OpenOnFocus(v bool) (r *VMenuBuilder) {
  141. b.tag.Attr(":open-on-focus", fmt.Sprint(v))
  142. return b
  143. }
  144. func (b *VMenuBuilder) OpenOnHover(v bool) (r *VMenuBuilder) {
  145. b.tag.Attr(":open-on-hover", fmt.Sprint(v))
  146. return b
  147. }
  148. func (b *VMenuBuilder) Origin(v string) (r *VMenuBuilder) {
  149. b.tag.Attr("origin", v)
  150. return b
  151. }
  152. func (b *VMenuBuilder) PositionX(v int) (r *VMenuBuilder) {
  153. b.tag.Attr(":position-x", fmt.Sprint(v))
  154. return b
  155. }
  156. func (b *VMenuBuilder) PositionY(v int) (r *VMenuBuilder) {
  157. b.tag.Attr(":position-y", fmt.Sprint(v))
  158. return b
  159. }
  160. func (b *VMenuBuilder) ReturnValue(v interface{}) (r *VMenuBuilder) {
  161. b.tag.Attr(":return-value", h.JSONString(v))
  162. return b
  163. }
  164. func (b *VMenuBuilder) Right(v bool) (r *VMenuBuilder) {
  165. b.tag.Attr(":right", fmt.Sprint(v))
  166. return b
  167. }
  168. func (b *VMenuBuilder) Rounded(v bool) (r *VMenuBuilder) {
  169. b.tag.Attr(":rounded", fmt.Sprint(v))
  170. return b
  171. }
  172. func (b *VMenuBuilder) Tile(v bool) (r *VMenuBuilder) {
  173. b.tag.Attr(":tile", fmt.Sprint(v))
  174. return b
  175. }
  176. func (b *VMenuBuilder) Top(v bool) (r *VMenuBuilder) {
  177. b.tag.Attr(":top", fmt.Sprint(v))
  178. return b
  179. }
  180. func (b *VMenuBuilder) Transition(v bool) (r *VMenuBuilder) {
  181. b.tag.Attr(":transition", fmt.Sprint(v))
  182. return b
  183. }
  184. func (b *VMenuBuilder) Value(v interface{}) (r *VMenuBuilder) {
  185. b.tag.Attr(":value", h.JSONString(v))
  186. return b
  187. }
  188. func (b *VMenuBuilder) ZIndex(v int) (r *VMenuBuilder) {
  189. b.tag.Attr(":z-index", fmt.Sprint(v))
  190. return b
  191. }
  192. func (b *VMenuBuilder) SetAttr(k string, v interface{}) {
  193. b.tag.SetAttr(k, v)
  194. }
  195. func (b *VMenuBuilder) Attr(vs ...interface{}) (r *VMenuBuilder) {
  196. b.tag.Attr(vs...)
  197. return b
  198. }
  199. func (b *VMenuBuilder) Children(children ...h.HTMLComponent) (r *VMenuBuilder) {
  200. b.tag.Children(children...)
  201. return b
  202. }
  203. func (b *VMenuBuilder) AppendChildren(children ...h.HTMLComponent) (r *VMenuBuilder) {
  204. b.tag.AppendChildren(children...)
  205. return b
  206. }
  207. func (b *VMenuBuilder) PrependChildren(children ...h.HTMLComponent) (r *VMenuBuilder) {
  208. b.tag.PrependChildren(children...)
  209. return b
  210. }
  211. func (b *VMenuBuilder) Class(names ...string) (r *VMenuBuilder) {
  212. b.tag.Class(names...)
  213. return b
  214. }
  215. func (b *VMenuBuilder) ClassIf(name string, add bool) (r *VMenuBuilder) {
  216. b.tag.ClassIf(name, add)
  217. return b
  218. }
  219. func (b *VMenuBuilder) On(name string, value string) (r *VMenuBuilder) {
  220. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  221. return b
  222. }
  223. func (b *VMenuBuilder) Bind(name string, value string) (r *VMenuBuilder) {
  224. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  225. return b
  226. }
  227. func (b *VMenuBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  228. return b.tag.MarshalHTML(ctx)
  229. }