layout.go 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VLayoutBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VLayout(children ...h.HTMLComponent) (r *VLayoutBuilder) {
  11. r = &VLayoutBuilder{
  12. tag: h.Tag("v-layout").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VLayoutBuilder) AlignBaseline(v bool) (r *VLayoutBuilder) {
  17. b.tag.Attr(":align-baseline", fmt.Sprint(v))
  18. return b
  19. }
  20. func (b *VLayoutBuilder) AlignCenter(v bool) (r *VLayoutBuilder) {
  21. b.tag.Attr(":align-center", fmt.Sprint(v))
  22. return b
  23. }
  24. func (b *VLayoutBuilder) AlignContentCenter(v bool) (r *VLayoutBuilder) {
  25. b.tag.Attr(":align-content-center", fmt.Sprint(v))
  26. return b
  27. }
  28. func (b *VLayoutBuilder) AlignContentEnd(v bool) (r *VLayoutBuilder) {
  29. b.tag.Attr(":align-content-end", fmt.Sprint(v))
  30. return b
  31. }
  32. func (b *VLayoutBuilder) AlignContentSpaceAround(v bool) (r *VLayoutBuilder) {
  33. b.tag.Attr(":align-content-space-around", fmt.Sprint(v))
  34. return b
  35. }
  36. func (b *VLayoutBuilder) AlignContentSpaceBetween(v bool) (r *VLayoutBuilder) {
  37. b.tag.Attr(":align-content-space-between", fmt.Sprint(v))
  38. return b
  39. }
  40. func (b *VLayoutBuilder) AlignContentStart(v bool) (r *VLayoutBuilder) {
  41. b.tag.Attr(":align-content-start", fmt.Sprint(v))
  42. return b
  43. }
  44. func (b *VLayoutBuilder) AlignEnd(v bool) (r *VLayoutBuilder) {
  45. b.tag.Attr(":align-end", fmt.Sprint(v))
  46. return b
  47. }
  48. func (b *VLayoutBuilder) AlignStart(v bool) (r *VLayoutBuilder) {
  49. b.tag.Attr(":align-start", fmt.Sprint(v))
  50. return b
  51. }
  52. func (b *VLayoutBuilder) Column(v bool) (r *VLayoutBuilder) {
  53. b.tag.Attr(":column", fmt.Sprint(v))
  54. return b
  55. }
  56. func (b *VLayoutBuilder) Dtype(v bool) (r *VLayoutBuilder) {
  57. b.tag.Attr(":d-{type}", fmt.Sprint(v))
  58. return b
  59. }
  60. func (b *VLayoutBuilder) FillHeight(v bool) (r *VLayoutBuilder) {
  61. b.tag.Attr(":fill-height", fmt.Sprint(v))
  62. return b
  63. }
  64. func (b *VLayoutBuilder) Id(v string) (r *VLayoutBuilder) {
  65. b.tag.Attr("id", v)
  66. return b
  67. }
  68. func (b *VLayoutBuilder) JustifyCenter(v bool) (r *VLayoutBuilder) {
  69. b.tag.Attr(":justify-center", fmt.Sprint(v))
  70. return b
  71. }
  72. func (b *VLayoutBuilder) JustifyEnd(v bool) (r *VLayoutBuilder) {
  73. b.tag.Attr(":justify-end", fmt.Sprint(v))
  74. return b
  75. }
  76. func (b *VLayoutBuilder) JustifySpaceAround(v bool) (r *VLayoutBuilder) {
  77. b.tag.Attr(":justify-space-around", fmt.Sprint(v))
  78. return b
  79. }
  80. func (b *VLayoutBuilder) JustifySpaceBetween(v bool) (r *VLayoutBuilder) {
  81. b.tag.Attr(":justify-space-between", fmt.Sprint(v))
  82. return b
  83. }
  84. func (b *VLayoutBuilder) JustifyStart(v bool) (r *VLayoutBuilder) {
  85. b.tag.Attr(":justify-start", fmt.Sprint(v))
  86. return b
  87. }
  88. func (b *VLayoutBuilder) Reverse(v bool) (r *VLayoutBuilder) {
  89. b.tag.Attr(":reverse", fmt.Sprint(v))
  90. return b
  91. }
  92. func (b *VLayoutBuilder) Row(v bool) (r *VLayoutBuilder) {
  93. b.tag.Attr(":row", fmt.Sprint(v))
  94. return b
  95. }
  96. func (b *VLayoutBuilder) Tag(v string) (r *VLayoutBuilder) {
  97. b.tag.Attr("tag", v)
  98. return b
  99. }
  100. func (b *VLayoutBuilder) Wrap(v bool) (r *VLayoutBuilder) {
  101. b.tag.Attr(":wrap", fmt.Sprint(v))
  102. return b
  103. }
  104. func (b *VLayoutBuilder) SetAttr(k string, v interface{}) {
  105. b.tag.SetAttr(k, v)
  106. }
  107. func (b *VLayoutBuilder) Attr(vs ...interface{}) (r *VLayoutBuilder) {
  108. b.tag.Attr(vs...)
  109. return b
  110. }
  111. func (b *VLayoutBuilder) Children(children ...h.HTMLComponent) (r *VLayoutBuilder) {
  112. b.tag.Children(children...)
  113. return b
  114. }
  115. func (b *VLayoutBuilder) AppendChildren(children ...h.HTMLComponent) (r *VLayoutBuilder) {
  116. b.tag.AppendChildren(children...)
  117. return b
  118. }
  119. func (b *VLayoutBuilder) PrependChildren(children ...h.HTMLComponent) (r *VLayoutBuilder) {
  120. b.tag.PrependChildren(children...)
  121. return b
  122. }
  123. func (b *VLayoutBuilder) Class(names ...string) (r *VLayoutBuilder) {
  124. b.tag.Class(names...)
  125. return b
  126. }
  127. func (b *VLayoutBuilder) ClassIf(name string, add bool) (r *VLayoutBuilder) {
  128. b.tag.ClassIf(name, add)
  129. return b
  130. }
  131. func (b *VLayoutBuilder) On(name string, value string) (r *VLayoutBuilder) {
  132. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  133. return b
  134. }
  135. func (b *VLayoutBuilder) Bind(name string, value string) (r *VLayoutBuilder) {
  136. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  137. return b
  138. }
  139. func (b *VLayoutBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  140. return b.tag.MarshalHTML(ctx)
  141. }