flex.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VFlexBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VFlex(children ...h.HTMLComponent) (r *VFlexBuilder) {
  11. r = &VFlexBuilder{
  12. tag: h.Tag("v-flex").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VFlexBuilder) AlignSelfBaseline(v bool) (r *VFlexBuilder) {
  17. b.tag.Attr(":align-self-baseline", fmt.Sprint(v))
  18. return b
  19. }
  20. func (b *VFlexBuilder) AlignSelfCenter(v bool) (r *VFlexBuilder) {
  21. b.tag.Attr(":align-self-center", fmt.Sprint(v))
  22. return b
  23. }
  24. func (b *VFlexBuilder) AlignSelfEnd(v bool) (r *VFlexBuilder) {
  25. b.tag.Attr(":align-self-end", fmt.Sprint(v))
  26. return b
  27. }
  28. func (b *VFlexBuilder) AlignSelfStart(v bool) (r *VFlexBuilder) {
  29. b.tag.Attr(":align-self-start", fmt.Sprint(v))
  30. return b
  31. }
  32. func (b *VFlexBuilder) Grow(v bool) (r *VFlexBuilder) {
  33. b.tag.Attr(":grow", fmt.Sprint(v))
  34. return b
  35. }
  36. func (b *VFlexBuilder) Id(v string) (r *VFlexBuilder) {
  37. b.tag.Attr("id", v)
  38. return b
  39. }
  40. func (b *VFlexBuilder) Shrink(v bool) (r *VFlexBuilder) {
  41. b.tag.Attr(":shrink", fmt.Sprint(v))
  42. return b
  43. }
  44. func (b *VFlexBuilder) Tag(v string) (r *VFlexBuilder) {
  45. b.tag.Attr("tag", v)
  46. return b
  47. }
  48. func (b *VFlexBuilder) SetAttr(k string, v interface{}) {
  49. b.tag.SetAttr(k, v)
  50. }
  51. func (b *VFlexBuilder) Attr(vs ...interface{}) (r *VFlexBuilder) {
  52. b.tag.Attr(vs...)
  53. return b
  54. }
  55. func (b *VFlexBuilder) Children(children ...h.HTMLComponent) (r *VFlexBuilder) {
  56. b.tag.Children(children...)
  57. return b
  58. }
  59. func (b *VFlexBuilder) AppendChildren(children ...h.HTMLComponent) (r *VFlexBuilder) {
  60. b.tag.AppendChildren(children...)
  61. return b
  62. }
  63. func (b *VFlexBuilder) PrependChildren(children ...h.HTMLComponent) (r *VFlexBuilder) {
  64. b.tag.PrependChildren(children...)
  65. return b
  66. }
  67. func (b *VFlexBuilder) Class(names ...string) (r *VFlexBuilder) {
  68. b.tag.Class(names...)
  69. return b
  70. }
  71. func (b *VFlexBuilder) ClassIf(name string, add bool) (r *VFlexBuilder) {
  72. b.tag.ClassIf(name, add)
  73. return b
  74. }
  75. func (b *VFlexBuilder) On(name string, value string) (r *VFlexBuilder) {
  76. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  77. return b
  78. }
  79. func (b *VFlexBuilder) Bind(name string, value string) (r *VFlexBuilder) {
  80. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  81. return b
  82. }
  83. func (b *VFlexBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  84. return b.tag.MarshalHTML(ctx)
  85. }