sheet.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VSheetBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VSheet(children ...h.HTMLComponent) (r *VSheetBuilder) {
  11. r = &VSheetBuilder{
  12. tag: h.Tag("v-sheet").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VSheetBuilder) Color(v string) (r *VSheetBuilder) {
  17. b.tag.Attr("color", v)
  18. return b
  19. }
  20. func (b *VSheetBuilder) Dark(v bool) (r *VSheetBuilder) {
  21. b.tag.Attr(":dark", fmt.Sprint(v))
  22. return b
  23. }
  24. func (b *VSheetBuilder) Elevation(v int) (r *VSheetBuilder) {
  25. b.tag.Attr(":elevation", fmt.Sprint(v))
  26. return b
  27. }
  28. func (b *VSheetBuilder) Height(v int) (r *VSheetBuilder) {
  29. b.tag.Attr(":height", fmt.Sprint(v))
  30. return b
  31. }
  32. func (b *VSheetBuilder) Light(v bool) (r *VSheetBuilder) {
  33. b.tag.Attr(":light", fmt.Sprint(v))
  34. return b
  35. }
  36. func (b *VSheetBuilder) MaxHeight(v int) (r *VSheetBuilder) {
  37. b.tag.Attr(":max-height", fmt.Sprint(v))
  38. return b
  39. }
  40. func (b *VSheetBuilder) MaxWidth(v int) (r *VSheetBuilder) {
  41. b.tag.Attr(":max-width", fmt.Sprint(v))
  42. return b
  43. }
  44. func (b *VSheetBuilder) MinHeight(v int) (r *VSheetBuilder) {
  45. b.tag.Attr(":min-height", fmt.Sprint(v))
  46. return b
  47. }
  48. func (b *VSheetBuilder) MinWidth(v int) (r *VSheetBuilder) {
  49. b.tag.Attr(":min-width", fmt.Sprint(v))
  50. return b
  51. }
  52. func (b *VSheetBuilder) Outlined(v bool) (r *VSheetBuilder) {
  53. b.tag.Attr(":outlined", fmt.Sprint(v))
  54. return b
  55. }
  56. func (b *VSheetBuilder) Rounded(v bool) (r *VSheetBuilder) {
  57. b.tag.Attr(":rounded", fmt.Sprint(v))
  58. return b
  59. }
  60. func (b *VSheetBuilder) Shaped(v bool) (r *VSheetBuilder) {
  61. b.tag.Attr(":shaped", fmt.Sprint(v))
  62. return b
  63. }
  64. func (b *VSheetBuilder) Tag(v string) (r *VSheetBuilder) {
  65. b.tag.Attr("tag", v)
  66. return b
  67. }
  68. func (b *VSheetBuilder) Tile(v bool) (r *VSheetBuilder) {
  69. b.tag.Attr(":tile", fmt.Sprint(v))
  70. return b
  71. }
  72. func (b *VSheetBuilder) Width(v int) (r *VSheetBuilder) {
  73. b.tag.Attr(":width", fmt.Sprint(v))
  74. return b
  75. }
  76. func (b *VSheetBuilder) SetAttr(k string, v interface{}) {
  77. b.tag.SetAttr(k, v)
  78. }
  79. func (b *VSheetBuilder) Attr(vs ...interface{}) (r *VSheetBuilder) {
  80. b.tag.Attr(vs...)
  81. return b
  82. }
  83. func (b *VSheetBuilder) Children(children ...h.HTMLComponent) (r *VSheetBuilder) {
  84. b.tag.Children(children...)
  85. return b
  86. }
  87. func (b *VSheetBuilder) AppendChildren(children ...h.HTMLComponent) (r *VSheetBuilder) {
  88. b.tag.AppendChildren(children...)
  89. return b
  90. }
  91. func (b *VSheetBuilder) PrependChildren(children ...h.HTMLComponent) (r *VSheetBuilder) {
  92. b.tag.PrependChildren(children...)
  93. return b
  94. }
  95. func (b *VSheetBuilder) Class(names ...string) (r *VSheetBuilder) {
  96. b.tag.Class(names...)
  97. return b
  98. }
  99. func (b *VSheetBuilder) ClassIf(name string, add bool) (r *VSheetBuilder) {
  100. b.tag.ClassIf(name, add)
  101. return b
  102. }
  103. func (b *VSheetBuilder) On(name string, value string) (r *VSheetBuilder) {
  104. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  105. return b
  106. }
  107. func (b *VSheetBuilder) Bind(name string, value string) (r *VSheetBuilder) {
  108. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  109. return b
  110. }
  111. func (b *VSheetBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  112. return b.tag.MarshalHTML(ctx)
  113. }