color-picker.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VColorPickerBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VColorPicker(children ...h.HTMLComponent) (r *VColorPickerBuilder) {
  11. r = &VColorPickerBuilder{
  12. tag: h.Tag("v-color-picker").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VColorPickerBuilder) CanvasHeight(v string) (r *VColorPickerBuilder) {
  17. b.tag.Attr("canvas-height", v)
  18. return b
  19. }
  20. func (b *VColorPickerBuilder) Dark(v bool) (r *VColorPickerBuilder) {
  21. b.tag.Attr(":dark", fmt.Sprint(v))
  22. return b
  23. }
  24. func (b *VColorPickerBuilder) Disabled(v bool) (r *VColorPickerBuilder) {
  25. b.tag.Attr(":disabled", fmt.Sprint(v))
  26. return b
  27. }
  28. func (b *VColorPickerBuilder) DotSize(v int) (r *VColorPickerBuilder) {
  29. b.tag.Attr(":dot-size", fmt.Sprint(v))
  30. return b
  31. }
  32. func (b *VColorPickerBuilder) Elevation(v int) (r *VColorPickerBuilder) {
  33. b.tag.Attr(":elevation", fmt.Sprint(v))
  34. return b
  35. }
  36. func (b *VColorPickerBuilder) Flat(v bool) (r *VColorPickerBuilder) {
  37. b.tag.Attr(":flat", fmt.Sprint(v))
  38. return b
  39. }
  40. func (b *VColorPickerBuilder) HideCanvas(v bool) (r *VColorPickerBuilder) {
  41. b.tag.Attr(":hide-canvas", fmt.Sprint(v))
  42. return b
  43. }
  44. func (b *VColorPickerBuilder) HideInputs(v bool) (r *VColorPickerBuilder) {
  45. b.tag.Attr(":hide-inputs", fmt.Sprint(v))
  46. return b
  47. }
  48. func (b *VColorPickerBuilder) HideModeSwitch(v bool) (r *VColorPickerBuilder) {
  49. b.tag.Attr(":hide-mode-switch", fmt.Sprint(v))
  50. return b
  51. }
  52. func (b *VColorPickerBuilder) HideSliders(v bool) (r *VColorPickerBuilder) {
  53. b.tag.Attr(":hide-sliders", fmt.Sprint(v))
  54. return b
  55. }
  56. func (b *VColorPickerBuilder) Light(v bool) (r *VColorPickerBuilder) {
  57. b.tag.Attr(":light", fmt.Sprint(v))
  58. return b
  59. }
  60. func (b *VColorPickerBuilder) Mode(v string) (r *VColorPickerBuilder) {
  61. b.tag.Attr("mode", v)
  62. return b
  63. }
  64. func (b *VColorPickerBuilder) ShowSwatches(v bool) (r *VColorPickerBuilder) {
  65. b.tag.Attr(":show-swatches", fmt.Sprint(v))
  66. return b
  67. }
  68. func (b *VColorPickerBuilder) Swatches(v interface{}) (r *VColorPickerBuilder) {
  69. b.tag.Attr(":swatches", h.JSONString(v))
  70. return b
  71. }
  72. func (b *VColorPickerBuilder) SwatchesMaxHeight(v int) (r *VColorPickerBuilder) {
  73. b.tag.Attr(":swatches-max-height", fmt.Sprint(v))
  74. return b
  75. }
  76. func (b *VColorPickerBuilder) Value(v interface{}) (r *VColorPickerBuilder) {
  77. b.tag.Attr(":value", h.JSONString(v))
  78. return b
  79. }
  80. func (b *VColorPickerBuilder) Width(v int) (r *VColorPickerBuilder) {
  81. b.tag.Attr(":width", fmt.Sprint(v))
  82. return b
  83. }
  84. func (b *VColorPickerBuilder) SetAttr(k string, v interface{}) {
  85. b.tag.SetAttr(k, v)
  86. }
  87. func (b *VColorPickerBuilder) Attr(vs ...interface{}) (r *VColorPickerBuilder) {
  88. b.tag.Attr(vs...)
  89. return b
  90. }
  91. func (b *VColorPickerBuilder) Children(children ...h.HTMLComponent) (r *VColorPickerBuilder) {
  92. b.tag.Children(children...)
  93. return b
  94. }
  95. func (b *VColorPickerBuilder) AppendChildren(children ...h.HTMLComponent) (r *VColorPickerBuilder) {
  96. b.tag.AppendChildren(children...)
  97. return b
  98. }
  99. func (b *VColorPickerBuilder) PrependChildren(children ...h.HTMLComponent) (r *VColorPickerBuilder) {
  100. b.tag.PrependChildren(children...)
  101. return b
  102. }
  103. func (b *VColorPickerBuilder) Class(names ...string) (r *VColorPickerBuilder) {
  104. b.tag.Class(names...)
  105. return b
  106. }
  107. func (b *VColorPickerBuilder) ClassIf(name string, add bool) (r *VColorPickerBuilder) {
  108. b.tag.ClassIf(name, add)
  109. return b
  110. }
  111. func (b *VColorPickerBuilder) On(name string, value string) (r *VColorPickerBuilder) {
  112. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  113. return b
  114. }
  115. func (b *VColorPickerBuilder) Bind(name string, value string) (r *VColorPickerBuilder) {
  116. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  117. return b
  118. }
  119. func (b *VColorPickerBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  120. return b.tag.MarshalHTML(ctx)
  121. }