window.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VWindowBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VWindow(children ...h.HTMLComponent) (r *VWindowBuilder) {
  11. r = &VWindowBuilder{
  12. tag: h.Tag("v-window").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VWindowBuilder) ActiveClass(v string) (r *VWindowBuilder) {
  17. b.tag.Attr("active-class", v)
  18. return b
  19. }
  20. func (b *VWindowBuilder) Continuous(v bool) (r *VWindowBuilder) {
  21. b.tag.Attr(":continuous", fmt.Sprint(v))
  22. return b
  23. }
  24. func (b *VWindowBuilder) Dark(v bool) (r *VWindowBuilder) {
  25. b.tag.Attr(":dark", fmt.Sprint(v))
  26. return b
  27. }
  28. func (b *VWindowBuilder) Light(v bool) (r *VWindowBuilder) {
  29. b.tag.Attr(":light", fmt.Sprint(v))
  30. return b
  31. }
  32. func (b *VWindowBuilder) NextIcon(v bool) (r *VWindowBuilder) {
  33. b.tag.Attr(":next-icon", fmt.Sprint(v))
  34. return b
  35. }
  36. func (b *VWindowBuilder) PrevIcon(v bool) (r *VWindowBuilder) {
  37. b.tag.Attr(":prev-icon", fmt.Sprint(v))
  38. return b
  39. }
  40. func (b *VWindowBuilder) Reverse(v bool) (r *VWindowBuilder) {
  41. b.tag.Attr(":reverse", fmt.Sprint(v))
  42. return b
  43. }
  44. func (b *VWindowBuilder) ShowArrows(v bool) (r *VWindowBuilder) {
  45. b.tag.Attr(":show-arrows", fmt.Sprint(v))
  46. return b
  47. }
  48. func (b *VWindowBuilder) ShowArrowsOnHover(v bool) (r *VWindowBuilder) {
  49. b.tag.Attr(":show-arrows-on-hover", fmt.Sprint(v))
  50. return b
  51. }
  52. func (b *VWindowBuilder) Tag(v string) (r *VWindowBuilder) {
  53. b.tag.Attr("tag", v)
  54. return b
  55. }
  56. func (b *VWindowBuilder) Touch(v interface{}) (r *VWindowBuilder) {
  57. b.tag.Attr(":touch", h.JSONString(v))
  58. return b
  59. }
  60. func (b *VWindowBuilder) Touchless(v bool) (r *VWindowBuilder) {
  61. b.tag.Attr(":touchless", fmt.Sprint(v))
  62. return b
  63. }
  64. func (b *VWindowBuilder) Value(v interface{}) (r *VWindowBuilder) {
  65. b.tag.Attr(":value", h.JSONString(v))
  66. return b
  67. }
  68. func (b *VWindowBuilder) Vertical(v bool) (r *VWindowBuilder) {
  69. b.tag.Attr(":vertical", fmt.Sprint(v))
  70. return b
  71. }
  72. func (b *VWindowBuilder) SetAttr(k string, v interface{}) {
  73. b.tag.SetAttr(k, v)
  74. }
  75. func (b *VWindowBuilder) Attr(vs ...interface{}) (r *VWindowBuilder) {
  76. b.tag.Attr(vs...)
  77. return b
  78. }
  79. func (b *VWindowBuilder) Children(children ...h.HTMLComponent) (r *VWindowBuilder) {
  80. b.tag.Children(children...)
  81. return b
  82. }
  83. func (b *VWindowBuilder) AppendChildren(children ...h.HTMLComponent) (r *VWindowBuilder) {
  84. b.tag.AppendChildren(children...)
  85. return b
  86. }
  87. func (b *VWindowBuilder) PrependChildren(children ...h.HTMLComponent) (r *VWindowBuilder) {
  88. b.tag.PrependChildren(children...)
  89. return b
  90. }
  91. func (b *VWindowBuilder) Class(names ...string) (r *VWindowBuilder) {
  92. b.tag.Class(names...)
  93. return b
  94. }
  95. func (b *VWindowBuilder) ClassIf(name string, add bool) (r *VWindowBuilder) {
  96. b.tag.ClassIf(name, add)
  97. return b
  98. }
  99. func (b *VWindowBuilder) On(name string, value string) (r *VWindowBuilder) {
  100. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  101. return b
  102. }
  103. func (b *VWindowBuilder) Bind(name string, value string) (r *VWindowBuilder) {
  104. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  105. return b
  106. }
  107. func (b *VWindowBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  108. return b.tag.MarshalHTML(ctx)
  109. }