list-item.go 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VListItemBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VListItem(children ...h.HTMLComponent) (r *VListItemBuilder) {
  11. r = &VListItemBuilder{
  12. tag: h.Tag("v-list-item").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VListItemBuilder) ActiveClass(v string) (r *VListItemBuilder) {
  17. b.tag.Attr("active-class", v)
  18. return b
  19. }
  20. func (b *VListItemBuilder) Append(v bool) (r *VListItemBuilder) {
  21. b.tag.Attr(":append", fmt.Sprint(v))
  22. return b
  23. }
  24. func (b *VListItemBuilder) Color(v string) (r *VListItemBuilder) {
  25. b.tag.Attr("color", v)
  26. return b
  27. }
  28. func (b *VListItemBuilder) Dark(v bool) (r *VListItemBuilder) {
  29. b.tag.Attr(":dark", fmt.Sprint(v))
  30. return b
  31. }
  32. func (b *VListItemBuilder) Dense(v bool) (r *VListItemBuilder) {
  33. b.tag.Attr(":dense", fmt.Sprint(v))
  34. return b
  35. }
  36. func (b *VListItemBuilder) Disabled(v bool) (r *VListItemBuilder) {
  37. b.tag.Attr(":disabled", fmt.Sprint(v))
  38. return b
  39. }
  40. func (b *VListItemBuilder) Exact(v bool) (r *VListItemBuilder) {
  41. b.tag.Attr(":exact", fmt.Sprint(v))
  42. return b
  43. }
  44. func (b *VListItemBuilder) ExactActiveClass(v string) (r *VListItemBuilder) {
  45. b.tag.Attr("exact-active-class", v)
  46. return b
  47. }
  48. func (b *VListItemBuilder) ExactPath(v bool) (r *VListItemBuilder) {
  49. b.tag.Attr(":exact-path", fmt.Sprint(v))
  50. return b
  51. }
  52. func (b *VListItemBuilder) Href(v interface{}) (r *VListItemBuilder) {
  53. b.tag.Attr(":href", h.JSONString(v))
  54. return b
  55. }
  56. func (b *VListItemBuilder) Inactive(v bool) (r *VListItemBuilder) {
  57. b.tag.Attr(":inactive", fmt.Sprint(v))
  58. return b
  59. }
  60. func (b *VListItemBuilder) InputValue(v interface{}) (r *VListItemBuilder) {
  61. b.tag.Attr(":input-value", h.JSONString(v))
  62. return b
  63. }
  64. func (b *VListItemBuilder) Light(v bool) (r *VListItemBuilder) {
  65. b.tag.Attr(":light", fmt.Sprint(v))
  66. return b
  67. }
  68. func (b *VListItemBuilder) Link(v bool) (r *VListItemBuilder) {
  69. b.tag.Attr(":link", fmt.Sprint(v))
  70. return b
  71. }
  72. func (b *VListItemBuilder) Nuxt(v bool) (r *VListItemBuilder) {
  73. b.tag.Attr(":nuxt", fmt.Sprint(v))
  74. return b
  75. }
  76. func (b *VListItemBuilder) Replace(v bool) (r *VListItemBuilder) {
  77. b.tag.Attr(":replace", fmt.Sprint(v))
  78. return b
  79. }
  80. func (b *VListItemBuilder) Ripple(v interface{}) (r *VListItemBuilder) {
  81. b.tag.Attr(":ripple", h.JSONString(v))
  82. return b
  83. }
  84. func (b *VListItemBuilder) Selectable(v bool) (r *VListItemBuilder) {
  85. b.tag.Attr(":selectable", fmt.Sprint(v))
  86. return b
  87. }
  88. func (b *VListItemBuilder) Tag(v string) (r *VListItemBuilder) {
  89. b.tag.Attr("tag", v)
  90. return b
  91. }
  92. func (b *VListItemBuilder) Target(v string) (r *VListItemBuilder) {
  93. b.tag.Attr("target", v)
  94. return b
  95. }
  96. func (b *VListItemBuilder) ThreeLine(v bool) (r *VListItemBuilder) {
  97. b.tag.Attr(":three-line", fmt.Sprint(v))
  98. return b
  99. }
  100. func (b *VListItemBuilder) To(v interface{}) (r *VListItemBuilder) {
  101. b.tag.Attr(":to", h.JSONString(v))
  102. return b
  103. }
  104. func (b *VListItemBuilder) TwoLine(v bool) (r *VListItemBuilder) {
  105. b.tag.Attr(":two-line", fmt.Sprint(v))
  106. return b
  107. }
  108. func (b *VListItemBuilder) Value(v interface{}) (r *VListItemBuilder) {
  109. b.tag.Attr(":value", h.JSONString(v))
  110. return b
  111. }
  112. func (b *VListItemBuilder) SetAttr(k string, v interface{}) {
  113. b.tag.SetAttr(k, v)
  114. }
  115. func (b *VListItemBuilder) Attr(vs ...interface{}) (r *VListItemBuilder) {
  116. b.tag.Attr(vs...)
  117. return b
  118. }
  119. func (b *VListItemBuilder) Children(children ...h.HTMLComponent) (r *VListItemBuilder) {
  120. b.tag.Children(children...)
  121. return b
  122. }
  123. func (b *VListItemBuilder) AppendChildren(children ...h.HTMLComponent) (r *VListItemBuilder) {
  124. b.tag.AppendChildren(children...)
  125. return b
  126. }
  127. func (b *VListItemBuilder) PrependChildren(children ...h.HTMLComponent) (r *VListItemBuilder) {
  128. b.tag.PrependChildren(children...)
  129. return b
  130. }
  131. func (b *VListItemBuilder) Class(names ...string) (r *VListItemBuilder) {
  132. b.tag.Class(names...)
  133. return b
  134. }
  135. func (b *VListItemBuilder) ClassIf(name string, add bool) (r *VListItemBuilder) {
  136. b.tag.ClassIf(name, add)
  137. return b
  138. }
  139. func (b *VListItemBuilder) On(name string, value string) (r *VListItemBuilder) {
  140. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  141. return b
  142. }
  143. func (b *VListItemBuilder) Bind(name string, value string) (r *VListItemBuilder) {
  144. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  145. return b
  146. }
  147. func (b *VListItemBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  148. return b.tag.MarshalHTML(ctx)
  149. }