tooltip.go 5.3 KB

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