data-iterator.go 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VDataIteratorBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VDataIterator(children ...h.HTMLComponent) (r *VDataIteratorBuilder) {
  11. r = &VDataIteratorBuilder{
  12. tag: h.Tag("v-data-iterator").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VDataIteratorBuilder) CheckboxColor(v string) (r *VDataIteratorBuilder) {
  17. b.tag.Attr("checkbox-color", v)
  18. return b
  19. }
  20. func (b *VDataIteratorBuilder) CustomFilter(v interface{}) (r *VDataIteratorBuilder) {
  21. b.tag.Attr(":custom-filter", h.JSONString(v))
  22. return b
  23. }
  24. func (b *VDataIteratorBuilder) CustomGroup(v interface{}) (r *VDataIteratorBuilder) {
  25. b.tag.Attr(":custom-group", h.JSONString(v))
  26. return b
  27. }
  28. func (b *VDataIteratorBuilder) CustomSort(v interface{}) (r *VDataIteratorBuilder) {
  29. b.tag.Attr(":custom-sort", h.JSONString(v))
  30. return b
  31. }
  32. func (b *VDataIteratorBuilder) Dark(v bool) (r *VDataIteratorBuilder) {
  33. b.tag.Attr(":dark", fmt.Sprint(v))
  34. return b
  35. }
  36. func (b *VDataIteratorBuilder) DisableFiltering(v bool) (r *VDataIteratorBuilder) {
  37. b.tag.Attr(":disable-filtering", fmt.Sprint(v))
  38. return b
  39. }
  40. func (b *VDataIteratorBuilder) DisablePagination(v bool) (r *VDataIteratorBuilder) {
  41. b.tag.Attr(":disable-pagination", fmt.Sprint(v))
  42. return b
  43. }
  44. func (b *VDataIteratorBuilder) DisableSort(v bool) (r *VDataIteratorBuilder) {
  45. b.tag.Attr(":disable-sort", fmt.Sprint(v))
  46. return b
  47. }
  48. func (b *VDataIteratorBuilder) Expanded(v interface{}) (r *VDataIteratorBuilder) {
  49. b.tag.Attr(":expanded", h.JSONString(v))
  50. return b
  51. }
  52. func (b *VDataIteratorBuilder) FooterProps(v interface{}) (r *VDataIteratorBuilder) {
  53. b.tag.Attr(":footer-props", h.JSONString(v))
  54. return b
  55. }
  56. func (b *VDataIteratorBuilder) GroupBy(v string) (r *VDataIteratorBuilder) {
  57. b.tag.Attr("group-by", v)
  58. return b
  59. }
  60. func (b *VDataIteratorBuilder) GroupDesc(v bool) (r *VDataIteratorBuilder) {
  61. b.tag.Attr(":group-desc", fmt.Sprint(v))
  62. return b
  63. }
  64. func (b *VDataIteratorBuilder) HideDefaultFooter(v bool) (r *VDataIteratorBuilder) {
  65. b.tag.Attr(":hide-default-footer", fmt.Sprint(v))
  66. return b
  67. }
  68. func (b *VDataIteratorBuilder) ItemKey(v string) (r *VDataIteratorBuilder) {
  69. b.tag.Attr("item-key", v)
  70. return b
  71. }
  72. func (b *VDataIteratorBuilder) Items(v interface{}) (r *VDataIteratorBuilder) {
  73. b.tag.Attr(":items", h.JSONString(v))
  74. return b
  75. }
  76. func (b *VDataIteratorBuilder) ItemsPerPage(v int) (r *VDataIteratorBuilder) {
  77. b.tag.Attr(":items-per-page", fmt.Sprint(v))
  78. return b
  79. }
  80. func (b *VDataIteratorBuilder) Light(v bool) (r *VDataIteratorBuilder) {
  81. b.tag.Attr(":light", fmt.Sprint(v))
  82. return b
  83. }
  84. func (b *VDataIteratorBuilder) Loading(v bool) (r *VDataIteratorBuilder) {
  85. b.tag.Attr(":loading", fmt.Sprint(v))
  86. return b
  87. }
  88. func (b *VDataIteratorBuilder) LoadingText(v string) (r *VDataIteratorBuilder) {
  89. b.tag.Attr("loading-text", v)
  90. return b
  91. }
  92. func (b *VDataIteratorBuilder) Locale(v string) (r *VDataIteratorBuilder) {
  93. b.tag.Attr("locale", v)
  94. return b
  95. }
  96. func (b *VDataIteratorBuilder) MobileBreakpoint(v int) (r *VDataIteratorBuilder) {
  97. b.tag.Attr(":mobile-breakpoint", fmt.Sprint(v))
  98. return b
  99. }
  100. func (b *VDataIteratorBuilder) MultiSort(v bool) (r *VDataIteratorBuilder) {
  101. b.tag.Attr(":multi-sort", fmt.Sprint(v))
  102. return b
  103. }
  104. func (b *VDataIteratorBuilder) MustSort(v bool) (r *VDataIteratorBuilder) {
  105. b.tag.Attr(":must-sort", fmt.Sprint(v))
  106. return b
  107. }
  108. func (b *VDataIteratorBuilder) NoDataText(v string) (r *VDataIteratorBuilder) {
  109. b.tag.Attr("no-data-text", v)
  110. return b
  111. }
  112. func (b *VDataIteratorBuilder) NoResultsText(v string) (r *VDataIteratorBuilder) {
  113. b.tag.Attr("no-results-text", v)
  114. return b
  115. }
  116. func (b *VDataIteratorBuilder) Options(v interface{}) (r *VDataIteratorBuilder) {
  117. b.tag.Attr(":options", h.JSONString(v))
  118. return b
  119. }
  120. func (b *VDataIteratorBuilder) Page(v int) (r *VDataIteratorBuilder) {
  121. b.tag.Attr(":page", fmt.Sprint(v))
  122. return b
  123. }
  124. func (b *VDataIteratorBuilder) Search(v string) (r *VDataIteratorBuilder) {
  125. b.tag.Attr("search", v)
  126. return b
  127. }
  128. func (b *VDataIteratorBuilder) SelectableKey(v string) (r *VDataIteratorBuilder) {
  129. b.tag.Attr("selectable-key", v)
  130. return b
  131. }
  132. func (b *VDataIteratorBuilder) ServerItemsLength(v int) (r *VDataIteratorBuilder) {
  133. b.tag.Attr(":server-items-length", fmt.Sprint(v))
  134. return b
  135. }
  136. func (b *VDataIteratorBuilder) SingleExpand(v bool) (r *VDataIteratorBuilder) {
  137. b.tag.Attr(":single-expand", fmt.Sprint(v))
  138. return b
  139. }
  140. func (b *VDataIteratorBuilder) SingleSelect(v bool) (r *VDataIteratorBuilder) {
  141. b.tag.Attr(":single-select", fmt.Sprint(v))
  142. return b
  143. }
  144. func (b *VDataIteratorBuilder) SortBy(v string) (r *VDataIteratorBuilder) {
  145. b.tag.Attr("sort-by", v)
  146. return b
  147. }
  148. func (b *VDataIteratorBuilder) SortDesc(v bool) (r *VDataIteratorBuilder) {
  149. b.tag.Attr(":sort-desc", fmt.Sprint(v))
  150. return b
  151. }
  152. func (b *VDataIteratorBuilder) Value(v interface{}) (r *VDataIteratorBuilder) {
  153. b.tag.Attr(":value", h.JSONString(v))
  154. return b
  155. }
  156. func (b *VDataIteratorBuilder) SetAttr(k string, v interface{}) {
  157. b.tag.SetAttr(k, v)
  158. }
  159. func (b *VDataIteratorBuilder) Attr(vs ...interface{}) (r *VDataIteratorBuilder) {
  160. b.tag.Attr(vs...)
  161. return b
  162. }
  163. func (b *VDataIteratorBuilder) Children(children ...h.HTMLComponent) (r *VDataIteratorBuilder) {
  164. b.tag.Children(children...)
  165. return b
  166. }
  167. func (b *VDataIteratorBuilder) AppendChildren(children ...h.HTMLComponent) (r *VDataIteratorBuilder) {
  168. b.tag.AppendChildren(children...)
  169. return b
  170. }
  171. func (b *VDataIteratorBuilder) PrependChildren(children ...h.HTMLComponent) (r *VDataIteratorBuilder) {
  172. b.tag.PrependChildren(children...)
  173. return b
  174. }
  175. func (b *VDataIteratorBuilder) Class(names ...string) (r *VDataIteratorBuilder) {
  176. b.tag.Class(names...)
  177. return b
  178. }
  179. func (b *VDataIteratorBuilder) ClassIf(name string, add bool) (r *VDataIteratorBuilder) {
  180. b.tag.ClassIf(name, add)
  181. return b
  182. }
  183. func (b *VDataIteratorBuilder) On(name string, value string) (r *VDataIteratorBuilder) {
  184. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  185. return b
  186. }
  187. func (b *VDataIteratorBuilder) Bind(name string, value string) (r *VDataIteratorBuilder) {
  188. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  189. return b
  190. }
  191. func (b *VDataIteratorBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  192. return b.tag.MarshalHTML(ctx)
  193. }