toolbar.go 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VToolbarBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VToolbar(children ...h.HTMLComponent) (r *VToolbarBuilder) {
  11. r = &VToolbarBuilder{
  12. tag: h.Tag("v-toolbar").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VToolbarBuilder) Absolute(v bool) (r *VToolbarBuilder) {
  17. b.tag.Attr(":absolute", fmt.Sprint(v))
  18. return b
  19. }
  20. func (b *VToolbarBuilder) Bottom(v bool) (r *VToolbarBuilder) {
  21. b.tag.Attr(":bottom", fmt.Sprint(v))
  22. return b
  23. }
  24. func (b *VToolbarBuilder) Collapse(v bool) (r *VToolbarBuilder) {
  25. b.tag.Attr(":collapse", fmt.Sprint(v))
  26. return b
  27. }
  28. func (b *VToolbarBuilder) Color(v string) (r *VToolbarBuilder) {
  29. b.tag.Attr("color", v)
  30. return b
  31. }
  32. func (b *VToolbarBuilder) Dark(v bool) (r *VToolbarBuilder) {
  33. b.tag.Attr(":dark", fmt.Sprint(v))
  34. return b
  35. }
  36. func (b *VToolbarBuilder) Dense(v bool) (r *VToolbarBuilder) {
  37. b.tag.Attr(":dense", fmt.Sprint(v))
  38. return b
  39. }
  40. func (b *VToolbarBuilder) Elevation(v int) (r *VToolbarBuilder) {
  41. b.tag.Attr(":elevation", fmt.Sprint(v))
  42. return b
  43. }
  44. func (b *VToolbarBuilder) Extended(v bool) (r *VToolbarBuilder) {
  45. b.tag.Attr(":extended", fmt.Sprint(v))
  46. return b
  47. }
  48. func (b *VToolbarBuilder) ExtensionHeight(v int) (r *VToolbarBuilder) {
  49. b.tag.Attr(":extension-height", fmt.Sprint(v))
  50. return b
  51. }
  52. func (b *VToolbarBuilder) Flat(v bool) (r *VToolbarBuilder) {
  53. b.tag.Attr(":flat", fmt.Sprint(v))
  54. return b
  55. }
  56. func (b *VToolbarBuilder) Floating(v bool) (r *VToolbarBuilder) {
  57. b.tag.Attr(":floating", fmt.Sprint(v))
  58. return b
  59. }
  60. func (b *VToolbarBuilder) Height(v int) (r *VToolbarBuilder) {
  61. b.tag.Attr(":height", fmt.Sprint(v))
  62. return b
  63. }
  64. func (b *VToolbarBuilder) Light(v bool) (r *VToolbarBuilder) {
  65. b.tag.Attr(":light", fmt.Sprint(v))
  66. return b
  67. }
  68. func (b *VToolbarBuilder) MaxHeight(v int) (r *VToolbarBuilder) {
  69. b.tag.Attr(":max-height", fmt.Sprint(v))
  70. return b
  71. }
  72. func (b *VToolbarBuilder) MaxWidth(v int) (r *VToolbarBuilder) {
  73. b.tag.Attr(":max-width", fmt.Sprint(v))
  74. return b
  75. }
  76. func (b *VToolbarBuilder) MinHeight(v int) (r *VToolbarBuilder) {
  77. b.tag.Attr(":min-height", fmt.Sprint(v))
  78. return b
  79. }
  80. func (b *VToolbarBuilder) MinWidth(v int) (r *VToolbarBuilder) {
  81. b.tag.Attr(":min-width", fmt.Sprint(v))
  82. return b
  83. }
  84. func (b *VToolbarBuilder) Outlined(v bool) (r *VToolbarBuilder) {
  85. b.tag.Attr(":outlined", fmt.Sprint(v))
  86. return b
  87. }
  88. func (b *VToolbarBuilder) Prominent(v bool) (r *VToolbarBuilder) {
  89. b.tag.Attr(":prominent", fmt.Sprint(v))
  90. return b
  91. }
  92. func (b *VToolbarBuilder) Rounded(v bool) (r *VToolbarBuilder) {
  93. b.tag.Attr(":rounded", fmt.Sprint(v))
  94. return b
  95. }
  96. func (b *VToolbarBuilder) Shaped(v bool) (r *VToolbarBuilder) {
  97. b.tag.Attr(":shaped", fmt.Sprint(v))
  98. return b
  99. }
  100. func (b *VToolbarBuilder) Short(v bool) (r *VToolbarBuilder) {
  101. b.tag.Attr(":short", fmt.Sprint(v))
  102. return b
  103. }
  104. func (b *VToolbarBuilder) Src(v interface{}) (r *VToolbarBuilder) {
  105. b.tag.Attr(":src", h.JSONString(v))
  106. return b
  107. }
  108. func (b *VToolbarBuilder) Tag(v string) (r *VToolbarBuilder) {
  109. b.tag.Attr("tag", v)
  110. return b
  111. }
  112. func (b *VToolbarBuilder) Tile(v bool) (r *VToolbarBuilder) {
  113. b.tag.Attr(":tile", fmt.Sprint(v))
  114. return b
  115. }
  116. func (b *VToolbarBuilder) Width(v int) (r *VToolbarBuilder) {
  117. b.tag.Attr(":width", fmt.Sprint(v))
  118. return b
  119. }
  120. func (b *VToolbarBuilder) SetAttr(k string, v interface{}) {
  121. b.tag.SetAttr(k, v)
  122. }
  123. func (b *VToolbarBuilder) Attr(vs ...interface{}) (r *VToolbarBuilder) {
  124. b.tag.Attr(vs...)
  125. return b
  126. }
  127. func (b *VToolbarBuilder) Children(children ...h.HTMLComponent) (r *VToolbarBuilder) {
  128. b.tag.Children(children...)
  129. return b
  130. }
  131. func (b *VToolbarBuilder) AppendChildren(children ...h.HTMLComponent) (r *VToolbarBuilder) {
  132. b.tag.AppendChildren(children...)
  133. return b
  134. }
  135. func (b *VToolbarBuilder) PrependChildren(children ...h.HTMLComponent) (r *VToolbarBuilder) {
  136. b.tag.PrependChildren(children...)
  137. return b
  138. }
  139. func (b *VToolbarBuilder) Class(names ...string) (r *VToolbarBuilder) {
  140. b.tag.Class(names...)
  141. return b
  142. }
  143. func (b *VToolbarBuilder) ClassIf(name string, add bool) (r *VToolbarBuilder) {
  144. b.tag.ClassIf(name, add)
  145. return b
  146. }
  147. func (b *VToolbarBuilder) On(name string, value string) (r *VToolbarBuilder) {
  148. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  149. return b
  150. }
  151. func (b *VToolbarBuilder) Bind(name string, value string) (r *VToolbarBuilder) {
  152. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  153. return b
  154. }
  155. func (b *VToolbarBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  156. return b.tag.MarshalHTML(ctx)
  157. }