alert.go 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VAlertBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VAlert(children ...h.HTMLComponent) (r *VAlertBuilder) {
  11. r = &VAlertBuilder{
  12. tag: h.Tag("v-alert").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VAlertBuilder) Border(v string) (r *VAlertBuilder) {
  17. b.tag.Attr("border", v)
  18. return b
  19. }
  20. func (b *VAlertBuilder) CloseIcon(v string) (r *VAlertBuilder) {
  21. b.tag.Attr("close-icon", v)
  22. return b
  23. }
  24. func (b *VAlertBuilder) CloseLabel(v string) (r *VAlertBuilder) {
  25. b.tag.Attr("close-label", v)
  26. return b
  27. }
  28. func (b *VAlertBuilder) Color(v string) (r *VAlertBuilder) {
  29. b.tag.Attr("color", v)
  30. return b
  31. }
  32. func (b *VAlertBuilder) ColoredBorder(v bool) (r *VAlertBuilder) {
  33. b.tag.Attr(":colored-border", fmt.Sprint(v))
  34. return b
  35. }
  36. func (b *VAlertBuilder) Dark(v bool) (r *VAlertBuilder) {
  37. b.tag.Attr(":dark", fmt.Sprint(v))
  38. return b
  39. }
  40. func (b *VAlertBuilder) Dense(v bool) (r *VAlertBuilder) {
  41. b.tag.Attr(":dense", fmt.Sprint(v))
  42. return b
  43. }
  44. func (b *VAlertBuilder) Dismissible(v bool) (r *VAlertBuilder) {
  45. b.tag.Attr(":dismissible", fmt.Sprint(v))
  46. return b
  47. }
  48. func (b *VAlertBuilder) Elevation(v int) (r *VAlertBuilder) {
  49. b.tag.Attr(":elevation", fmt.Sprint(v))
  50. return b
  51. }
  52. func (b *VAlertBuilder) Height(v int) (r *VAlertBuilder) {
  53. b.tag.Attr(":height", fmt.Sprint(v))
  54. return b
  55. }
  56. func (b *VAlertBuilder) Icon(v bool) (r *VAlertBuilder) {
  57. b.tag.Attr(":icon", fmt.Sprint(v))
  58. return b
  59. }
  60. func (b *VAlertBuilder) Light(v bool) (r *VAlertBuilder) {
  61. b.tag.Attr(":light", fmt.Sprint(v))
  62. return b
  63. }
  64. func (b *VAlertBuilder) MaxHeight(v int) (r *VAlertBuilder) {
  65. b.tag.Attr(":max-height", fmt.Sprint(v))
  66. return b
  67. }
  68. func (b *VAlertBuilder) MaxWidth(v int) (r *VAlertBuilder) {
  69. b.tag.Attr(":max-width", fmt.Sprint(v))
  70. return b
  71. }
  72. func (b *VAlertBuilder) MinHeight(v int) (r *VAlertBuilder) {
  73. b.tag.Attr(":min-height", fmt.Sprint(v))
  74. return b
  75. }
  76. func (b *VAlertBuilder) MinWidth(v int) (r *VAlertBuilder) {
  77. b.tag.Attr(":min-width", fmt.Sprint(v))
  78. return b
  79. }
  80. func (b *VAlertBuilder) Mode(v string) (r *VAlertBuilder) {
  81. b.tag.Attr("mode", v)
  82. return b
  83. }
  84. func (b *VAlertBuilder) Origin(v string) (r *VAlertBuilder) {
  85. b.tag.Attr("origin", v)
  86. return b
  87. }
  88. func (b *VAlertBuilder) Outlined(v bool) (r *VAlertBuilder) {
  89. b.tag.Attr(":outlined", fmt.Sprint(v))
  90. return b
  91. }
  92. func (b *VAlertBuilder) Prominent(v bool) (r *VAlertBuilder) {
  93. b.tag.Attr(":prominent", fmt.Sprint(v))
  94. return b
  95. }
  96. func (b *VAlertBuilder) Rounded(v bool) (r *VAlertBuilder) {
  97. b.tag.Attr(":rounded", fmt.Sprint(v))
  98. return b
  99. }
  100. func (b *VAlertBuilder) Shaped(v bool) (r *VAlertBuilder) {
  101. b.tag.Attr(":shaped", fmt.Sprint(v))
  102. return b
  103. }
  104. func (b *VAlertBuilder) Tag(v string) (r *VAlertBuilder) {
  105. b.tag.Attr("tag", v)
  106. return b
  107. }
  108. func (b *VAlertBuilder) Text(v bool) (r *VAlertBuilder) {
  109. b.tag.Attr(":text", fmt.Sprint(v))
  110. return b
  111. }
  112. func (b *VAlertBuilder) Tile(v bool) (r *VAlertBuilder) {
  113. b.tag.Attr(":tile", fmt.Sprint(v))
  114. return b
  115. }
  116. func (b *VAlertBuilder) Transition(v string) (r *VAlertBuilder) {
  117. b.tag.Attr("transition", v)
  118. return b
  119. }
  120. func (b *VAlertBuilder) Type(v string) (r *VAlertBuilder) {
  121. b.tag.Attr("type", v)
  122. return b
  123. }
  124. func (b *VAlertBuilder) Value(v bool) (r *VAlertBuilder) {
  125. b.tag.Attr(":value", fmt.Sprint(v))
  126. return b
  127. }
  128. func (b *VAlertBuilder) Width(v int) (r *VAlertBuilder) {
  129. b.tag.Attr(":width", fmt.Sprint(v))
  130. return b
  131. }
  132. func (b *VAlertBuilder) SetAttr(k string, v interface{}) {
  133. b.tag.SetAttr(k, v)
  134. }
  135. func (b *VAlertBuilder) Attr(vs ...interface{}) (r *VAlertBuilder) {
  136. b.tag.Attr(vs...)
  137. return b
  138. }
  139. func (b *VAlertBuilder) Children(children ...h.HTMLComponent) (r *VAlertBuilder) {
  140. b.tag.Children(children...)
  141. return b
  142. }
  143. func (b *VAlertBuilder) AppendChildren(children ...h.HTMLComponent) (r *VAlertBuilder) {
  144. b.tag.AppendChildren(children...)
  145. return b
  146. }
  147. func (b *VAlertBuilder) PrependChildren(children ...h.HTMLComponent) (r *VAlertBuilder) {
  148. b.tag.PrependChildren(children...)
  149. return b
  150. }
  151. func (b *VAlertBuilder) Class(names ...string) (r *VAlertBuilder) {
  152. b.tag.Class(names...)
  153. return b
  154. }
  155. func (b *VAlertBuilder) ClassIf(name string, add bool) (r *VAlertBuilder) {
  156. b.tag.ClassIf(name, add)
  157. return b
  158. }
  159. func (b *VAlertBuilder) On(name string, value string) (r *VAlertBuilder) {
  160. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  161. return b
  162. }
  163. func (b *VAlertBuilder) Bind(name string, value string) (r *VAlertBuilder) {
  164. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  165. return b
  166. }
  167. func (b *VAlertBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  168. return b.tag.MarshalHTML(ctx)
  169. }