date-picker.go 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VDatePickerBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VDatePicker(children ...h.HTMLComponent) (r *VDatePickerBuilder) {
  11. r = &VDatePickerBuilder{
  12. tag: h.Tag("v-date-picker").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VDatePickerBuilder) ActivePicker(v string) (r *VDatePickerBuilder) {
  17. b.tag.Attr("active-picker", v)
  18. return b
  19. }
  20. func (b *VDatePickerBuilder) AllowedDates(v interface{}) (r *VDatePickerBuilder) {
  21. b.tag.Attr(":allowed-dates", h.JSONString(v))
  22. return b
  23. }
  24. func (b *VDatePickerBuilder) Color(v string) (r *VDatePickerBuilder) {
  25. b.tag.Attr("color", v)
  26. return b
  27. }
  28. func (b *VDatePickerBuilder) Dark(v bool) (r *VDatePickerBuilder) {
  29. b.tag.Attr(":dark", fmt.Sprint(v))
  30. return b
  31. }
  32. func (b *VDatePickerBuilder) DayFormat(v interface{}) (r *VDatePickerBuilder) {
  33. b.tag.Attr(":day-format", h.JSONString(v))
  34. return b
  35. }
  36. func (b *VDatePickerBuilder) Disabled(v bool) (r *VDatePickerBuilder) {
  37. b.tag.Attr(":disabled", fmt.Sprint(v))
  38. return b
  39. }
  40. func (b *VDatePickerBuilder) Elevation(v int) (r *VDatePickerBuilder) {
  41. b.tag.Attr(":elevation", fmt.Sprint(v))
  42. return b
  43. }
  44. func (b *VDatePickerBuilder) EventColor(v interface{}) (r *VDatePickerBuilder) {
  45. b.tag.Attr(":event-color", h.JSONString(v))
  46. return b
  47. }
  48. func (b *VDatePickerBuilder) Events(v interface{}) (r *VDatePickerBuilder) {
  49. b.tag.Attr(":events", h.JSONString(v))
  50. return b
  51. }
  52. func (b *VDatePickerBuilder) FirstDayOfWeek(v string) (r *VDatePickerBuilder) {
  53. b.tag.Attr("first-day-of-week", v)
  54. return b
  55. }
  56. func (b *VDatePickerBuilder) Flat(v bool) (r *VDatePickerBuilder) {
  57. b.tag.Attr(":flat", fmt.Sprint(v))
  58. return b
  59. }
  60. func (b *VDatePickerBuilder) FullWidth(v bool) (r *VDatePickerBuilder) {
  61. b.tag.Attr(":full-width", fmt.Sprint(v))
  62. return b
  63. }
  64. func (b *VDatePickerBuilder) HeaderColor(v string) (r *VDatePickerBuilder) {
  65. b.tag.Attr("header-color", v)
  66. return b
  67. }
  68. func (b *VDatePickerBuilder) HeaderDateFormat(v interface{}) (r *VDatePickerBuilder) {
  69. b.tag.Attr(":header-date-format", h.JSONString(v))
  70. return b
  71. }
  72. func (b *VDatePickerBuilder) Landscape(v bool) (r *VDatePickerBuilder) {
  73. b.tag.Attr(":landscape", fmt.Sprint(v))
  74. return b
  75. }
  76. func (b *VDatePickerBuilder) Light(v bool) (r *VDatePickerBuilder) {
  77. b.tag.Attr(":light", fmt.Sprint(v))
  78. return b
  79. }
  80. func (b *VDatePickerBuilder) Locale(v string) (r *VDatePickerBuilder) {
  81. b.tag.Attr("locale", v)
  82. return b
  83. }
  84. func (b *VDatePickerBuilder) LocaleFirstDayOfYear(v string) (r *VDatePickerBuilder) {
  85. b.tag.Attr("locale-first-day-of-year", v)
  86. return b
  87. }
  88. func (b *VDatePickerBuilder) Max(v string) (r *VDatePickerBuilder) {
  89. b.tag.Attr("max", v)
  90. return b
  91. }
  92. func (b *VDatePickerBuilder) Min(v string) (r *VDatePickerBuilder) {
  93. b.tag.Attr("min", v)
  94. return b
  95. }
  96. func (b *VDatePickerBuilder) MonthFormat(v interface{}) (r *VDatePickerBuilder) {
  97. b.tag.Attr(":month-format", h.JSONString(v))
  98. return b
  99. }
  100. func (b *VDatePickerBuilder) Multiple(v bool) (r *VDatePickerBuilder) {
  101. b.tag.Attr(":multiple", fmt.Sprint(v))
  102. return b
  103. }
  104. func (b *VDatePickerBuilder) NextIcon(v string) (r *VDatePickerBuilder) {
  105. b.tag.Attr("next-icon", v)
  106. return b
  107. }
  108. func (b *VDatePickerBuilder) NextMonthAriaLabel(v string) (r *VDatePickerBuilder) {
  109. b.tag.Attr("next-month-aria-label", v)
  110. return b
  111. }
  112. func (b *VDatePickerBuilder) NextYearAriaLabel(v string) (r *VDatePickerBuilder) {
  113. b.tag.Attr("next-year-aria-label", v)
  114. return b
  115. }
  116. func (b *VDatePickerBuilder) NoTitle(v bool) (r *VDatePickerBuilder) {
  117. b.tag.Attr(":no-title", fmt.Sprint(v))
  118. return b
  119. }
  120. func (b *VDatePickerBuilder) PickerDate(v string) (r *VDatePickerBuilder) {
  121. b.tag.Attr("picker-date", v)
  122. return b
  123. }
  124. func (b *VDatePickerBuilder) PrevIcon(v string) (r *VDatePickerBuilder) {
  125. b.tag.Attr("prev-icon", v)
  126. return b
  127. }
  128. func (b *VDatePickerBuilder) PrevMonthAriaLabel(v string) (r *VDatePickerBuilder) {
  129. b.tag.Attr("prev-month-aria-label", v)
  130. return b
  131. }
  132. func (b *VDatePickerBuilder) PrevYearAriaLabel(v string) (r *VDatePickerBuilder) {
  133. b.tag.Attr("prev-year-aria-label", v)
  134. return b
  135. }
  136. func (b *VDatePickerBuilder) Range(v bool) (r *VDatePickerBuilder) {
  137. b.tag.Attr(":range", fmt.Sprint(v))
  138. return b
  139. }
  140. func (b *VDatePickerBuilder) Reactive(v bool) (r *VDatePickerBuilder) {
  141. b.tag.Attr(":reactive", fmt.Sprint(v))
  142. return b
  143. }
  144. func (b *VDatePickerBuilder) Readonly(v bool) (r *VDatePickerBuilder) {
  145. b.tag.Attr(":readonly", fmt.Sprint(v))
  146. return b
  147. }
  148. func (b *VDatePickerBuilder) Scrollable(v bool) (r *VDatePickerBuilder) {
  149. b.tag.Attr(":scrollable", fmt.Sprint(v))
  150. return b
  151. }
  152. func (b *VDatePickerBuilder) SelectedItemsText(v string) (r *VDatePickerBuilder) {
  153. b.tag.Attr("selected-items-text", v)
  154. return b
  155. }
  156. func (b *VDatePickerBuilder) ShowAdjacentMonths(v bool) (r *VDatePickerBuilder) {
  157. b.tag.Attr(":show-adjacent-months", fmt.Sprint(v))
  158. return b
  159. }
  160. func (b *VDatePickerBuilder) ShowCurrent(v bool) (r *VDatePickerBuilder) {
  161. b.tag.Attr(":show-current", fmt.Sprint(v))
  162. return b
  163. }
  164. func (b *VDatePickerBuilder) ShowWeek(v bool) (r *VDatePickerBuilder) {
  165. b.tag.Attr(":show-week", fmt.Sprint(v))
  166. return b
  167. }
  168. func (b *VDatePickerBuilder) TitleDateFormat(v interface{}) (r *VDatePickerBuilder) {
  169. b.tag.Attr(":title-date-format", h.JSONString(v))
  170. return b
  171. }
  172. func (b *VDatePickerBuilder) Type(v string) (r *VDatePickerBuilder) {
  173. b.tag.Attr("type", v)
  174. return b
  175. }
  176. func (b *VDatePickerBuilder) Value(v string) (r *VDatePickerBuilder) {
  177. b.tag.Attr("value", v)
  178. return b
  179. }
  180. func (b *VDatePickerBuilder) WeekdayFormat(v interface{}) (r *VDatePickerBuilder) {
  181. b.tag.Attr(":weekday-format", h.JSONString(v))
  182. return b
  183. }
  184. func (b *VDatePickerBuilder) Width(v int) (r *VDatePickerBuilder) {
  185. b.tag.Attr(":width", fmt.Sprint(v))
  186. return b
  187. }
  188. func (b *VDatePickerBuilder) YearFormat(v interface{}) (r *VDatePickerBuilder) {
  189. b.tag.Attr(":year-format", h.JSONString(v))
  190. return b
  191. }
  192. func (b *VDatePickerBuilder) YearIcon(v string) (r *VDatePickerBuilder) {
  193. b.tag.Attr("year-icon", v)
  194. return b
  195. }
  196. func (b *VDatePickerBuilder) SetAttr(k string, v interface{}) {
  197. b.tag.SetAttr(k, v)
  198. }
  199. func (b *VDatePickerBuilder) Attr(vs ...interface{}) (r *VDatePickerBuilder) {
  200. b.tag.Attr(vs...)
  201. return b
  202. }
  203. func (b *VDatePickerBuilder) Children(children ...h.HTMLComponent) (r *VDatePickerBuilder) {
  204. b.tag.Children(children...)
  205. return b
  206. }
  207. func (b *VDatePickerBuilder) AppendChildren(children ...h.HTMLComponent) (r *VDatePickerBuilder) {
  208. b.tag.AppendChildren(children...)
  209. return b
  210. }
  211. func (b *VDatePickerBuilder) PrependChildren(children ...h.HTMLComponent) (r *VDatePickerBuilder) {
  212. b.tag.PrependChildren(children...)
  213. return b
  214. }
  215. func (b *VDatePickerBuilder) Class(names ...string) (r *VDatePickerBuilder) {
  216. b.tag.Class(names...)
  217. return b
  218. }
  219. func (b *VDatePickerBuilder) ClassIf(name string, add bool) (r *VDatePickerBuilder) {
  220. b.tag.ClassIf(name, add)
  221. return b
  222. }
  223. func (b *VDatePickerBuilder) On(name string, value string) (r *VDatePickerBuilder) {
  224. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  225. return b
  226. }
  227. func (b *VDatePickerBuilder) Bind(name string, value string) (r *VDatePickerBuilder) {
  228. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  229. return b
  230. }
  231. func (b *VDatePickerBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  232. return b.tag.MarshalHTML(ctx)
  233. }