data-table-header.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VDataTableHeaderBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VDataTableHeader(children ...h.HTMLComponent) (r *VDataTableHeaderBuilder) {
  11. r = &VDataTableHeaderBuilder{
  12. tag: h.Tag("v-data-table-header").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VDataTableHeaderBuilder) CheckboxColor(v string) (r *VDataTableHeaderBuilder) {
  17. b.tag.Attr("checkbox-color", v)
  18. return b
  19. }
  20. func (b *VDataTableHeaderBuilder) DisableSort(v bool) (r *VDataTableHeaderBuilder) {
  21. b.tag.Attr(":disable-sort", fmt.Sprint(v))
  22. return b
  23. }
  24. func (b *VDataTableHeaderBuilder) EveryItem(v bool) (r *VDataTableHeaderBuilder) {
  25. b.tag.Attr(":every-item", fmt.Sprint(v))
  26. return b
  27. }
  28. func (b *VDataTableHeaderBuilder) Headers(v interface{}) (r *VDataTableHeaderBuilder) {
  29. b.tag.Attr(":headers", h.JSONString(v))
  30. return b
  31. }
  32. func (b *VDataTableHeaderBuilder) Mobile(v bool) (r *VDataTableHeaderBuilder) {
  33. b.tag.Attr(":mobile", fmt.Sprint(v))
  34. return b
  35. }
  36. func (b *VDataTableHeaderBuilder) Options(v interface{}) (r *VDataTableHeaderBuilder) {
  37. b.tag.Attr(":options", h.JSONString(v))
  38. return b
  39. }
  40. func (b *VDataTableHeaderBuilder) ShowGroupBy(v bool) (r *VDataTableHeaderBuilder) {
  41. b.tag.Attr(":show-group-by", fmt.Sprint(v))
  42. return b
  43. }
  44. func (b *VDataTableHeaderBuilder) SingleSelect(v bool) (r *VDataTableHeaderBuilder) {
  45. b.tag.Attr(":single-select", fmt.Sprint(v))
  46. return b
  47. }
  48. func (b *VDataTableHeaderBuilder) SomeItems(v bool) (r *VDataTableHeaderBuilder) {
  49. b.tag.Attr(":some-items", fmt.Sprint(v))
  50. return b
  51. }
  52. func (b *VDataTableHeaderBuilder) SortByText(v string) (r *VDataTableHeaderBuilder) {
  53. b.tag.Attr("sort-by-text", v)
  54. return b
  55. }
  56. func (b *VDataTableHeaderBuilder) SortIcon(v string) (r *VDataTableHeaderBuilder) {
  57. b.tag.Attr("sort-icon", v)
  58. return b
  59. }
  60. func (b *VDataTableHeaderBuilder) SetAttr(k string, v interface{}) {
  61. b.tag.SetAttr(k, v)
  62. }
  63. func (b *VDataTableHeaderBuilder) Attr(vs ...interface{}) (r *VDataTableHeaderBuilder) {
  64. b.tag.Attr(vs...)
  65. return b
  66. }
  67. func (b *VDataTableHeaderBuilder) Children(children ...h.HTMLComponent) (r *VDataTableHeaderBuilder) {
  68. b.tag.Children(children...)
  69. return b
  70. }
  71. func (b *VDataTableHeaderBuilder) AppendChildren(children ...h.HTMLComponent) (r *VDataTableHeaderBuilder) {
  72. b.tag.AppendChildren(children...)
  73. return b
  74. }
  75. func (b *VDataTableHeaderBuilder) PrependChildren(children ...h.HTMLComponent) (r *VDataTableHeaderBuilder) {
  76. b.tag.PrependChildren(children...)
  77. return b
  78. }
  79. func (b *VDataTableHeaderBuilder) Class(names ...string) (r *VDataTableHeaderBuilder) {
  80. b.tag.Class(names...)
  81. return b
  82. }
  83. func (b *VDataTableHeaderBuilder) ClassIf(name string, add bool) (r *VDataTableHeaderBuilder) {
  84. b.tag.ClassIf(name, add)
  85. return b
  86. }
  87. func (b *VDataTableHeaderBuilder) On(name string, value string) (r *VDataTableHeaderBuilder) {
  88. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  89. return b
  90. }
  91. func (b *VDataTableHeaderBuilder) Bind(name string, value string) (r *VDataTableHeaderBuilder) {
  92. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  93. return b
  94. }
  95. func (b *VDataTableHeaderBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  96. return b.tag.MarshalHTML(ctx)
  97. }