@wot-ui/ui 1.0.0 → 2.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (386) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +134 -0
  3. package/attributes.json +1 -0
  4. package/changelog.md +63 -0
  5. package/common/AbortablePromise.ts +28 -0
  6. package/common/canvasHelper.ts +49 -0
  7. package/common/clickoutside.ts +25 -0
  8. package/common/event.ts +8 -0
  9. package/common/formatDate.ts +68 -0
  10. package/common/interceptor.ts +43 -0
  11. package/common/props.ts +53 -0
  12. package/common/util.ts +836 -0
  13. package/components/wd-action-sheet/index.scss +232 -0
  14. package/components/wd-action-sheet/types.ts +155 -0
  15. package/components/wd-action-sheet/wd-action-sheet.vue +176 -0
  16. package/components/wd-avatar/index.scss +150 -0
  17. package/components/wd-avatar/types.ts +98 -0
  18. package/components/wd-avatar/wd-avatar.vue +184 -0
  19. package/components/wd-avatar-group/index.scss +11 -0
  20. package/components/wd-avatar-group/types.ts +61 -0
  21. package/components/wd-avatar-group/wd-avatar-group.vue +115 -0
  22. package/components/wd-backtop/index.scss +67 -0
  23. package/components/wd-backtop/types.ts +66 -0
  24. package/components/wd-backtop/wd-backtop.vue +57 -0
  25. package/components/wd-badge/index.scss +116 -0
  26. package/components/wd-badge/types.ts +94 -0
  27. package/components/wd-badge/wd-badge.vue +78 -0
  28. package/components/wd-button/index.scss +436 -0
  29. package/components/wd-button/types.ts +204 -0
  30. package/components/wd-button/wd-button.vue +210 -0
  31. package/components/wd-calendar/index.scss +97 -0
  32. package/components/wd-calendar/types.ts +221 -0
  33. package/components/wd-calendar/wd-calendar.vue +339 -0
  34. package/components/wd-calendar-view/index.scss +41 -0
  35. package/components/wd-calendar-view/month/index.scss +144 -0
  36. package/components/wd-calendar-view/month/month.vue +389 -0
  37. package/components/wd-calendar-view/month/types.ts +70 -0
  38. package/components/wd-calendar-view/monthPanel/index.scss +84 -0
  39. package/components/wd-calendar-view/monthPanel/month-panel.vue +541 -0
  40. package/components/wd-calendar-view/monthPanel/types.ts +151 -0
  41. package/components/wd-calendar-view/types.ts +166 -0
  42. package/components/wd-calendar-view/utils.ts +318 -0
  43. package/components/wd-calendar-view/wd-calendar-view.vue +117 -0
  44. package/components/wd-calendar-view/year/index.scss +148 -0
  45. package/components/wd-calendar-view/year/types.ts +74 -0
  46. package/components/wd-calendar-view/year/year.vue +206 -0
  47. package/components/wd-calendar-view/yearPanel/index.scss +42 -0
  48. package/components/wd-calendar-view/yearPanel/types.ts +96 -0
  49. package/components/wd-calendar-view/yearPanel/year-panel.vue +249 -0
  50. package/components/wd-card/index.scss +104 -0
  51. package/components/wd-card/types.ts +47 -0
  52. package/components/wd-card/wd-card.vue +38 -0
  53. package/components/wd-cascader/index.scss +154 -0
  54. package/components/wd-cascader/types.ts +191 -0
  55. package/components/wd-cascader/wd-cascader.vue +589 -0
  56. package/components/wd-cell/index.scss +244 -0
  57. package/components/wd-cell/types.ts +205 -0
  58. package/components/wd-cell/wd-cell.vue +172 -0
  59. package/components/wd-cell-group/index.scss +53 -0
  60. package/components/wd-cell-group/types.ts +97 -0
  61. package/components/wd-cell-group/wd-cell-group.vue +48 -0
  62. package/components/wd-checkbox/index.scss +166 -0
  63. package/components/wd-checkbox/types.ts +118 -0
  64. package/components/wd-checkbox/wd-checkbox.vue +216 -0
  65. package/components/wd-checkbox-group/index.scss +5 -0
  66. package/components/wd-checkbox-group/types.ts +93 -0
  67. package/components/wd-checkbox-group/wd-checkbox-group.vue +148 -0
  68. package/components/wd-circle/index.scss +28 -0
  69. package/components/wd-circle/types.ts +54 -0
  70. package/components/wd-circle/wd-circle.vue +306 -0
  71. package/components/wd-col/index.scss +5 -0
  72. package/components/wd-col/types.ts +16 -0
  73. package/components/wd-col/wd-col.vue +83 -0
  74. package/components/wd-collapse/index.scss +71 -0
  75. package/components/wd-collapse/types.ts +68 -0
  76. package/components/wd-collapse/wd-collapse.vue +165 -0
  77. package/components/wd-collapse-item/index.scss +86 -0
  78. package/components/wd-collapse-item/types.ts +62 -0
  79. package/components/wd-collapse-item/wd-collapse-item.vue +184 -0
  80. package/components/wd-config-provider/index.scss +10 -0
  81. package/components/wd-config-provider/types.ts +2061 -0
  82. package/components/wd-config-provider/wd-config-provider.vue +61 -0
  83. package/components/wd-count-down/index.scss +16 -0
  84. package/components/wd-count-down/types.ts +58 -0
  85. package/components/wd-count-down/utils.ts +52 -0
  86. package/components/wd-count-down/wd-count-down.vue +62 -0
  87. package/components/wd-count-to/index.scss +25 -0
  88. package/components/wd-count-to/types.ts +121 -0
  89. package/components/wd-count-to/wd-count-to.vue +126 -0
  90. package/components/wd-curtain/index.scss +96 -0
  91. package/components/wd-curtain/types.ts +82 -0
  92. package/components/wd-curtain/wd-curtain.vue +172 -0
  93. package/components/wd-datetime-picker/index.scss +133 -0
  94. package/components/wd-datetime-picker/types.ts +198 -0
  95. package/components/wd-datetime-picker/wd-datetime-picker.vue +526 -0
  96. package/components/wd-datetime-picker-view/types.ts +171 -0
  97. package/components/wd-datetime-picker-view/util.ts +30 -0
  98. package/components/wd-datetime-picker-view/wd-datetime-picker-view.vue +402 -0
  99. package/components/wd-dialog/index.scss +281 -0
  100. package/components/wd-dialog/index.ts +168 -0
  101. package/components/wd-dialog/types.ts +452 -0
  102. package/components/wd-dialog/wd-dialog.vue +586 -0
  103. package/components/wd-divider/index.scss +122 -0
  104. package/components/wd-divider/types.ts +50 -0
  105. package/components/wd-divider/wd-divider.vue +54 -0
  106. package/components/wd-drop-menu/index.scss +90 -0
  107. package/components/wd-drop-menu/types.ts +38 -0
  108. package/components/wd-drop-menu/wd-drop-menu.vue +168 -0
  109. package/components/wd-drop-menu-item/index.scss +96 -0
  110. package/components/wd-drop-menu-item/types.ts +93 -0
  111. package/components/wd-drop-menu-item/wd-drop-menu-item.vue +205 -0
  112. package/components/wd-empty/index.scss +46 -0
  113. package/components/wd-empty/types.ts +37 -0
  114. package/components/wd-empty/wd-empty.vue +47 -0
  115. package/components/wd-fab/index.scss +124 -0
  116. package/components/wd-fab/types.ts +119 -0
  117. package/components/wd-fab/wd-fab.vue +322 -0
  118. package/components/wd-floating-panel/index.scss +73 -0
  119. package/components/wd-floating-panel/type.ts +32 -0
  120. package/components/wd-floating-panel/wd-floating-panel.vue +142 -0
  121. package/components/wd-form/adapters/zod.ts +56 -0
  122. package/components/wd-form/index.ts +2 -0
  123. package/components/wd-form/types.ts +133 -0
  124. package/components/wd-form/wd-form.vue +121 -0
  125. package/components/wd-form-item/index.scss +26 -0
  126. package/components/wd-form-item/types.ts +134 -0
  127. package/components/wd-form-item/wd-form-item.vue +182 -0
  128. package/components/wd-gap/index.scss +9 -0
  129. package/components/wd-gap/types.ts +26 -0
  130. package/components/wd-gap/wd-gap.vue +38 -0
  131. package/components/wd-grid/index.scss +11 -0
  132. package/components/wd-grid/types.ts +97 -0
  133. package/components/wd-grid/wd-grid.vue +48 -0
  134. package/components/wd-grid-item/index.scss +187 -0
  135. package/components/wd-grid-item/types.ts +98 -0
  136. package/components/wd-grid-item/wd-grid-item.vue +295 -0
  137. package/components/wd-icon/index.scss +46 -0
  138. package/components/wd-icon/types.ts +44 -0
  139. package/components/wd-icon/wd-icon.vue +66 -0
  140. package/components/wd-image-preview/index.scss +94 -0
  141. package/components/wd-image-preview/index.ts +95 -0
  142. package/components/wd-image-preview/types.ts +165 -0
  143. package/components/wd-image-preview/wd-image-preview.vue +233 -0
  144. package/components/wd-img/index.scss +82 -0
  145. package/components/wd-img/types.ts +96 -0
  146. package/components/wd-img/wd-img.vue +91 -0
  147. package/components/wd-img-cropper/index.scss +259 -0
  148. package/components/wd-img-cropper/types.ts +101 -0
  149. package/components/wd-img-cropper/wd-img-cropper.vue +653 -0
  150. package/components/wd-index-anchor/index.scss +34 -0
  151. package/components/wd-index-anchor/type.ts +9 -0
  152. package/components/wd-index-anchor/wd-index-anchor.vue +55 -0
  153. package/components/wd-index-bar/index.scss +68 -0
  154. package/components/wd-index-bar/type.ts +23 -0
  155. package/components/wd-index-bar/wd-index-bar.vue +157 -0
  156. package/components/wd-input/index.scss +129 -0
  157. package/components/wd-input/types.ts +165 -0
  158. package/components/wd-input/wd-input.vue +237 -0
  159. package/components/wd-input-number/index.scss +233 -0
  160. package/components/wd-input-number/types.ts +131 -0
  161. package/components/wd-input-number/wd-input-number.vue +473 -0
  162. package/components/wd-keyboard/constants.ts +81 -0
  163. package/components/wd-keyboard/index.scss +104 -0
  164. package/components/wd-keyboard/key/index.scss +103 -0
  165. package/components/wd-keyboard/key/index.vue +84 -0
  166. package/components/wd-keyboard/key/types.ts +44 -0
  167. package/components/wd-keyboard/types.ts +138 -0
  168. package/components/wd-keyboard/wd-keyboard.vue +236 -0
  169. package/components/wd-loading/index.scss +205 -0
  170. package/components/wd-loading/types.ts +61 -0
  171. package/components/wd-loading/wd-loading.vue +70 -0
  172. package/components/wd-loadmore/index.scss +62 -0
  173. package/components/wd-loadmore/types.ts +42 -0
  174. package/components/wd-loadmore/wd-loadmore.vue +68 -0
  175. package/components/wd-navbar/index.scss +96 -0
  176. package/components/wd-navbar/types.ts +74 -0
  177. package/components/wd-navbar/wd-navbar.vue +136 -0
  178. package/components/wd-navbar-capsule/index.scss +70 -0
  179. package/components/wd-navbar-capsule/types.ts +11 -0
  180. package/components/wd-navbar-capsule/wd-navbar-capsule.vue +48 -0
  181. package/components/wd-notice-bar/index.scss +94 -0
  182. package/components/wd-notice-bar/types.ts +97 -0
  183. package/components/wd-notice-bar/wd-notice-bar.vue +270 -0
  184. package/components/wd-notify/index.scss +114 -0
  185. package/components/wd-notify/index.ts +63 -0
  186. package/components/wd-notify/types.ts +130 -0
  187. package/components/wd-notify/wd-notify.vue +162 -0
  188. package/components/wd-overlay/index.scss +14 -0
  189. package/components/wd-overlay/types.ts +42 -0
  190. package/components/wd-overlay/wd-overlay.vue +55 -0
  191. package/components/wd-pagination/index.scss +71 -0
  192. package/components/wd-pagination/types.ts +69 -0
  193. package/components/wd-pagination/wd-pagination.vue +118 -0
  194. package/components/wd-password-input/index.scss +134 -0
  195. package/components/wd-password-input/types.ts +42 -0
  196. package/components/wd-password-input/wd-password-input.vue +51 -0
  197. package/components/wd-picker/index.scss +72 -0
  198. package/components/wd-picker/types.ts +141 -0
  199. package/components/wd-picker/wd-picker.vue +220 -0
  200. package/components/wd-picker-view/index.scss +93 -0
  201. package/components/wd-picker-view/types.ts +145 -0
  202. package/components/wd-picker-view/useSelection.ts +385 -0
  203. package/components/wd-picker-view/wd-picker-view.vue +227 -0
  204. package/components/wd-popover/index.scss +117 -0
  205. package/components/wd-popover/types.ts +106 -0
  206. package/components/wd-popover/wd-popover.vue +212 -0
  207. package/components/wd-popup/index.scss +89 -0
  208. package/components/wd-popup/types.ts +110 -0
  209. package/components/wd-popup/wd-popup.vue +174 -0
  210. package/components/wd-progress/index.scss +155 -0
  211. package/components/wd-progress/types.ts +94 -0
  212. package/components/wd-progress/wd-progress.vue +249 -0
  213. package/components/wd-radio/index.scss +189 -0
  214. package/components/wd-radio/types.ts +64 -0
  215. package/components/wd-radio/wd-radio.vue +164 -0
  216. package/components/wd-radio-group/index.scss +5 -0
  217. package/components/wd-radio-group/types.ts +70 -0
  218. package/components/wd-radio-group/wd-radio-group.vue +53 -0
  219. package/components/wd-rate/index.scss +57 -0
  220. package/components/wd-rate/types.ts +86 -0
  221. package/components/wd-rate/wd-rate.vue +168 -0
  222. package/components/wd-resize/index.scss +31 -0
  223. package/components/wd-resize/types.ts +14 -0
  224. package/components/wd-resize/wd-resize.vue +157 -0
  225. package/components/wd-root-portal/wd-root-portal.vue +77 -0
  226. package/components/wd-row/index.scss +6 -0
  227. package/components/wd-row/types.ts +36 -0
  228. package/components/wd-row/wd-row.vue +88 -0
  229. package/components/wd-search/index.scss +171 -0
  230. package/components/wd-search/types.ts +107 -0
  231. package/components/wd-search/wd-search.vue +198 -0
  232. package/components/wd-segmented/index.scss +155 -0
  233. package/components/wd-segmented/types.ts +81 -0
  234. package/components/wd-segmented/wd-segmented.vue +169 -0
  235. package/components/wd-select-picker/index.scss +72 -0
  236. package/components/wd-select-picker/types.ts +72 -0
  237. package/components/wd-select-picker/wd-select-picker.vue +371 -0
  238. package/components/wd-sidebar/index.scss +25 -0
  239. package/components/wd-sidebar/types.ts +34 -0
  240. package/components/wd-sidebar/wd-sidebar.vue +57 -0
  241. package/components/wd-sidebar-item/index.scss +91 -0
  242. package/components/wd-sidebar-item/types.ts +28 -0
  243. package/components/wd-sidebar-item/wd-sidebar-item.vue +118 -0
  244. package/components/wd-signature/index.scss +42 -0
  245. package/components/wd-signature/types.ts +295 -0
  246. package/components/wd-signature/wd-signature.vue +664 -0
  247. package/components/wd-skeleton/index.scss +112 -0
  248. package/components/wd-skeleton/types.ts +124 -0
  249. package/components/wd-skeleton/wd-skeleton.vue +110 -0
  250. package/components/wd-slide-verify/index.scss +112 -0
  251. package/components/wd-slide-verify/types.ts +98 -0
  252. package/components/wd-slide-verify/wd-slide-verify.vue +222 -0
  253. package/components/wd-slider/index.scss +485 -0
  254. package/components/wd-slider/types.ts +166 -0
  255. package/components/wd-slider/wd-slider.vue +529 -0
  256. package/components/wd-sort-button/index.scss +126 -0
  257. package/components/wd-sort-button/types.ts +68 -0
  258. package/components/wd-sort-button/wd-sort-button.vue +67 -0
  259. package/components/wd-step/index.scss +366 -0
  260. package/components/wd-step/types.ts +43 -0
  261. package/components/wd-step/wd-step.vue +181 -0
  262. package/components/wd-steps/index.scss +7 -0
  263. package/components/wd-steps/types.ts +50 -0
  264. package/components/wd-steps/wd-steps.vue +39 -0
  265. package/components/wd-sticky/index.scss +9 -0
  266. package/components/wd-sticky/types.ts +13 -0
  267. package/components/wd-sticky/wd-sticky.vue +192 -0
  268. package/components/wd-sticky-box/index.scss +6 -0
  269. package/components/wd-sticky-box/types.ts +20 -0
  270. package/components/wd-sticky-box/wd-sticky-box.vue +157 -0
  271. package/components/wd-swipe-action/index.scss +22 -0
  272. package/components/wd-swipe-action/types.ts +87 -0
  273. package/components/wd-swipe-action/wd-swipe-action.vue +320 -0
  274. package/components/wd-swiper/index.scss +69 -0
  275. package/components/wd-swiper/types.ts +275 -0
  276. package/components/wd-swiper/wd-swiper.vue +332 -0
  277. package/components/wd-swiper-nav/index.scss +179 -0
  278. package/components/wd-swiper-nav/types.ts +42 -0
  279. package/components/wd-swiper-nav/wd-swiper-nav.vue +42 -0
  280. package/components/wd-switch/index.scss +177 -0
  281. package/components/wd-switch/types.ts +93 -0
  282. package/components/wd-switch/wd-switch.vue +107 -0
  283. package/components/wd-tab/index.scss +16 -0
  284. package/components/wd-tab/types.ts +45 -0
  285. package/components/wd-tab/wd-tab.vue +99 -0
  286. package/components/wd-tabbar/index.scss +71 -0
  287. package/components/wd-tabbar/types.ts +79 -0
  288. package/components/wd-tabbar/wd-tabbar.vue +109 -0
  289. package/components/wd-tabbar-item/index.scss +50 -0
  290. package/components/wd-tabbar-item/types.ts +45 -0
  291. package/components/wd-tabbar-item/wd-tabbar-item.vue +101 -0
  292. package/components/wd-table/index.scss +128 -0
  293. package/components/wd-table/types.ts +160 -0
  294. package/components/wd-table/wd-table.vue +331 -0
  295. package/components/wd-table-column/index.scss +15 -0
  296. package/components/wd-table-column/types.ts +81 -0
  297. package/components/wd-table-column/wd-table-column.vue +198 -0
  298. package/components/wd-tabs/index.scss +332 -0
  299. package/components/wd-tabs/types.ts +155 -0
  300. package/components/wd-tabs/wd-tabs.vue +508 -0
  301. package/components/wd-tag/index.scss +325 -0
  302. package/components/wd-tag/types.ts +90 -0
  303. package/components/wd-tag/wd-tag.vue +158 -0
  304. package/components/wd-text/index.scss +52 -0
  305. package/components/wd-text/types.ts +107 -0
  306. package/components/wd-text/wd-text.vue +141 -0
  307. package/components/wd-textarea/index.scss +112 -0
  308. package/components/wd-textarea/types.ts +151 -0
  309. package/components/wd-textarea/wd-textarea.vue +212 -0
  310. package/components/wd-toast/index.scss +92 -0
  311. package/components/wd-toast/index.ts +97 -0
  312. package/components/wd-toast/types.ts +190 -0
  313. package/components/wd-toast/wd-toast.vue +158 -0
  314. package/components/wd-tooltip/index.scss +77 -0
  315. package/components/wd-tooltip/types.ts +105 -0
  316. package/components/wd-tooltip/wd-tooltip.vue +169 -0
  317. package/components/wd-tour/index.scss +106 -0
  318. package/components/wd-tour/types.ts +268 -0
  319. package/components/wd-tour/wd-tour.vue +518 -0
  320. package/components/wd-transition/index.scss +67 -0
  321. package/components/wd-transition/types.ts +106 -0
  322. package/components/wd-transition/wd-transition.vue +238 -0
  323. package/components/wd-upload/index.scss +204 -0
  324. package/components/wd-upload/types.ts +390 -0
  325. package/components/wd-upload/wd-upload.vue +565 -0
  326. package/components/wd-video-preview/index.scss +54 -0
  327. package/components/wd-video-preview/index.ts +64 -0
  328. package/components/wd-video-preview/types.ts +66 -0
  329. package/components/wd-video-preview/wd-video-preview.vue +141 -0
  330. package/components/wd-watermark/index.scss +21 -0
  331. package/components/wd-watermark/types.ts +130 -0
  332. package/components/wd-watermark/wd-watermark.vue +718 -0
  333. package/components/wot-ui/wot-ui.vue +5 -0
  334. package/composables/index.ts +16 -0
  335. package/composables/useCell.ts +34 -0
  336. package/composables/useChildren.ts +120 -0
  337. package/composables/useConfigProvider.ts +45 -0
  338. package/composables/useCountDown.ts +138 -0
  339. package/composables/useDeviceInfo.ts +136 -0
  340. package/composables/useLockScroll.ts +37 -0
  341. package/composables/useParent.ts +51 -0
  342. package/composables/usePopover.ts +212 -0
  343. package/composables/useQueue.ts +52 -0
  344. package/composables/useRaf.ts +37 -0
  345. package/composables/useTouch.ts +43 -0
  346. package/composables/useTranslate.ts +12 -0
  347. package/composables/useUpload.ts +366 -0
  348. package/global.d.ts +106 -0
  349. package/index.ts +6 -0
  350. package/locale/index.ts +32 -0
  351. package/locale/lang/ar-SA.ts +150 -0
  352. package/locale/lang/de-DE.ts +150 -0
  353. package/locale/lang/en-US.ts +150 -0
  354. package/locale/lang/es-ES.ts +150 -0
  355. package/locale/lang/fr-FR.ts +150 -0
  356. package/locale/lang/ja-JP.ts +150 -0
  357. package/locale/lang/ko-KR.ts +150 -0
  358. package/locale/lang/pt-PT.ts +150 -0
  359. package/locale/lang/ru-RU.ts +150 -0
  360. package/locale/lang/th-TH.ts +150 -0
  361. package/locale/lang/tr-TR.ts +155 -0
  362. package/locale/lang/ug-CN.ts +154 -0
  363. package/locale/lang/vi-VN.ts +89 -0
  364. package/locale/lang/zh-CN.ts +154 -0
  365. package/locale/lang/zh-HK.ts +78 -0
  366. package/locale/lang/zh-TW.ts +78 -0
  367. package/package.json +1 -11
  368. package/styles/iconfont/iconfont.scss +1243 -0
  369. package/styles/mixin/_config.scss +7 -0
  370. package/styles/mixin/_function.scss +44 -0
  371. package/styles/mixin/_mixin.scss +473 -0
  372. package/styles/theme/base/color.scss +210 -0
  373. package/styles/theme/base/font.scss +13 -0
  374. package/styles/theme/base/index.scss +8 -0
  375. package/styles/theme/base/insets.scss +32 -0
  376. package/styles/theme/base/number.scss +36 -0
  377. package/styles/theme/base/opacity.scss +9 -0
  378. package/styles/theme/base/radius.scss +13 -0
  379. package/styles/theme/base/stroke.scss +9 -0
  380. package/styles/theme/base/typography.scss +44 -0
  381. package/styles/theme/dark.scss +101 -0
  382. package/styles/theme/index.scss +16 -0
  383. package/styles/theme/light.scss +101 -0
  384. package/styles/variable.scss +472 -0
  385. package/tags.json +1 -0
  386. package/web-types.json +1 -0
@@ -0,0 +1,541 @@
1
+ <template>
2
+ <view class="wd-month-panel">
3
+ <!-- 切换模式导航控制栏 -->
4
+ <view class="wd-month-panel__controls" v-if="switchMode !== 'none'">
5
+ <view class="wd-month-panel__control">
6
+ <wd-icon
7
+ v-if="switchMode === 'year-month'"
8
+ name="double-left"
9
+ :custom-class="`wd-month-panel__control-icon ${isPrevYearDisabled ? 'is-disabled' : ''}`"
10
+ @click="!isPrevYearDisabled && changeYear(-1)"
11
+ />
12
+ <wd-icon
13
+ name="left"
14
+ :custom-class="`wd-month-panel__control-icon ${isPrevMonthDisabled ? 'is-disabled' : ''}`"
15
+ @click="!isPrevMonthDisabled && changeMonth(-1)"
16
+ />
17
+ </view>
18
+ <text class="wd-month-panel__controls-title">{{ controlsTitle }}</text>
19
+ <view class="wd-month-panel__control">
20
+ <wd-icon
21
+ name="right"
22
+ :custom-class="`wd-month-panel__control-icon ${isNextMonthDisabled ? 'is-disabled' : ''}`"
23
+ @click="!isNextMonthDisabled && changeMonth(1)"
24
+ />
25
+ <wd-icon
26
+ v-if="switchMode === 'year-month'"
27
+ name="double-right"
28
+ :custom-class="`wd-month-panel__control-icon ${isNextYearDisabled ? 'is-disabled' : ''}`"
29
+ @click="!isNextYearDisabled && changeYear(1)"
30
+ />
31
+ </view>
32
+ </view>
33
+
34
+ <view class="wd-month-panel__weeks">
35
+ <view v-for="item in 7" :key="item" class="wd-month-panel__week">{{ weekLabel(item + firstDayOfWeek) }}</view>
36
+ </view>
37
+
38
+ <!-- 面板标题(仅滚动模式显示) -->
39
+ <view v-if="showPanelTitle && switchMode === 'none'" class="wd-month-panel__title">
40
+ {{ title }}
41
+ </view>
42
+
43
+ <scroll-view
44
+ :class="`wd-month-panel__container ${!!timeType ? 'wd-month-panel__container--time' : ''}`"
45
+ :style="containerStyle"
46
+ :scroll-y="true"
47
+ :scroll-top="scrollTop"
48
+ @scroll="switchMode === 'none' ? monthScroll($event) : undefined"
49
+ >
50
+ <view v-for="(item, index) in displayMonths" :key="index" :id="`month${index}`">
51
+ <month
52
+ :type="type"
53
+ :date="item.date"
54
+ :value="value"
55
+ :min-date="minDate"
56
+ :max-date="maxDate"
57
+ :first-day-of-week="firstDayOfWeek"
58
+ :formatter="formatter"
59
+ :max-range="maxRange"
60
+ :range-prompt="rangePrompt"
61
+ :allow-same-day="allowSameDay"
62
+ :default-time="defaultTime"
63
+ :showTitle="switchMode === 'none' && index !== 0"
64
+ @change="handleDateChange"
65
+ />
66
+ </view>
67
+ </scroll-view>
68
+
69
+ <view v-if="timeType" class="wd-month-panel__time">
70
+ <view v-if="type === 'datetimerange'" class="wd-month-panel__time-label">
71
+ <view class="wd-month-panel__time-text">{{ timeType === 'start' ? translate('startTime') : translate('endTime') }}</view>
72
+ </view>
73
+ <view class="wd-month-panel__time-picker">
74
+ <wd-datetime-picker-view
75
+ v-model="timeValue"
76
+ type="time"
77
+ :item-height="itemHeight"
78
+ :visible-item-count="visibleItemCount"
79
+ :immediate-change="immediateChange"
80
+ :filter="timeFilter"
81
+ :formatter="internalTimeFormatter"
82
+ :use-second="!hideSecond"
83
+ @change="handleTimeChange"
84
+ @pickstart="handlePickStart"
85
+ @pickend="handlePickEnd"
86
+ />
87
+ </view>
88
+ </view>
89
+ </view>
90
+ </template>
91
+
92
+ <script lang="ts">
93
+ export default {
94
+ options: {
95
+ addGlobalClass: true,
96
+ // #ifndef MP-TOUTIAO
97
+ virtualHost: true,
98
+ // #endif
99
+ styleIsolation: 'shared'
100
+ }
101
+ }
102
+ </script>
103
+
104
+ <script lang="ts" setup>
105
+ import wdDatetimePickerView from '../../wd-datetime-picker-view/wd-datetime-picker-view.vue'
106
+ import { computed, ref, watch, onMounted, type CSSProperties } from 'vue'
107
+ import { debounce, isArray, isEqual, isNumber, pause, padZero, addUnit, objToStyle } from '../../../common/util'
108
+ import { compareMonth, formatMonthTitle, getMonthEndDay, getMonths, getWeekLabel } from '../utils'
109
+ import Month from '../month/month.vue'
110
+ import { monthPanelProps, type MonthInfo, type MonthPanelTimeType, type MonthPanelExpose } from './types'
111
+ import { useTranslate } from '../../../composables/useTranslate'
112
+ import { type CalendarTimeFormatter } from '../types'
113
+ const props = defineProps(monthPanelProps)
114
+ const emit = defineEmits(['change', 'pickstart', 'pickend'])
115
+
116
+ const { translate } = useTranslate('calendar-view')
117
+
118
+ const scrollTop = ref<number>(0) // 滚动位置
119
+ const scrollIndex = ref<number>(0) // 当前显示的月份索引
120
+ const timeValue = ref<string>('') // 当前选中的时分秒 HH:mm:ss
121
+
122
+ /**
123
+ * 当前显示的月份(仅在 switchMode !== 'none' 时使用)
124
+ * 存储格式:{ year: number, month: number }
125
+ */
126
+ const currentDisplayMonth = ref<{ year: number; month: number }>({
127
+ year: new Date().getFullYear(),
128
+ month: new Date().getMonth()
129
+ })
130
+
131
+ const timeType = ref<MonthPanelTimeType>('') // 当前时间类型,是开始还是结束
132
+ const innerValue = ref<string | number | (number | null)[]>('') // 内部保存一个值,用于判断新老值,避免监听器触发
133
+
134
+ const handleChange = debounce((value) => {
135
+ emit('change', {
136
+ value
137
+ })
138
+ }, 50)
139
+
140
+ /**
141
+ * 当前显示月份的时间戳(仅在 switchMode !== 'none' 时使用)
142
+ */
143
+ const currentMonthDate = computed(() => {
144
+ return new Date(currentDisplayMonth.value.year, currentDisplayMonth.value.month, 1).getTime()
145
+ })
146
+
147
+ /**
148
+ * 控制栏标题(切换模式下显示的年月)
149
+ */
150
+ const controlsTitle = computed(() => {
151
+ return formatMonthTitle(currentMonthDate.value)
152
+ })
153
+
154
+ // 标题(滚动模式下显示的年月)
155
+ const title = computed(() => {
156
+ return formatMonthTitle(months.value[scrollIndex.value].date)
157
+ })
158
+
159
+ /**
160
+ * 获取月份的起始时间戳(当月1日 00:00:00)
161
+ */
162
+ function getMonthStart(year: number, month: number): number {
163
+ return new Date(year, month, 1).getTime()
164
+ }
165
+
166
+ /**
167
+ * 是否禁用上个月按钮
168
+ */
169
+ const isPrevMonthDisabled = computed(() => {
170
+ const { year, month } = currentDisplayMonth.value
171
+ const prevMonthStart = getMonthStart(year, month - 1)
172
+ const minMonthStart = getMonthStart(new Date(props.minDate).getFullYear(), new Date(props.minDate).getMonth())
173
+ return prevMonthStart < minMonthStart
174
+ })
175
+
176
+ /**
177
+ * 是否禁用下个月按钮
178
+ */
179
+ const isNextMonthDisabled = computed(() => {
180
+ const { year, month } = currentDisplayMonth.value
181
+ const nextMonthStart = getMonthStart(year, month + 1)
182
+ const maxMonthStart = getMonthStart(new Date(props.maxDate).getFullYear(), new Date(props.maxDate).getMonth())
183
+ return nextMonthStart > maxMonthStart
184
+ })
185
+
186
+ /**
187
+ * 是否禁用上一年按钮
188
+ */
189
+ const isPrevYearDisabled = computed(() => {
190
+ const { year, month } = currentDisplayMonth.value
191
+ const prevYear = year - 1
192
+ const minYear = new Date(props.minDate).getFullYear()
193
+ const minMonth = new Date(props.minDate).getMonth()
194
+
195
+ // 如果上一年小于最小年份,禁用
196
+ if (prevYear < minYear) {
197
+ return true
198
+ }
199
+
200
+ // 如果上一年等于最小年份,且当前月份小于最小月份,禁用
201
+ if (prevYear === minYear && month < minMonth) {
202
+ return true
203
+ }
204
+
205
+ return false
206
+ })
207
+
208
+ /**
209
+ * 是否禁用下一年按钮
210
+ */
211
+ const isNextYearDisabled = computed(() => {
212
+ const { year, month } = currentDisplayMonth.value
213
+ const nextYear = year + 1
214
+ const maxYear = new Date(props.maxDate).getFullYear()
215
+ const maxMonth = new Date(props.maxDate).getMonth()
216
+
217
+ // 如果下一年大于最大年份,禁用
218
+ if (nextYear > maxYear) {
219
+ return true
220
+ }
221
+
222
+ // 如果下一年等于最大年份,且当前月份大于最大月份,禁用
223
+ if (nextYear === maxYear && month > maxMonth) {
224
+ return true
225
+ }
226
+
227
+ return false
228
+ })
229
+
230
+ /**
231
+ * 切换月份
232
+ * @param delta 偏移量,-1 表示上个月,1 表示下个月
233
+ */
234
+ function changeMonth(delta: number) {
235
+ const { year, month } = currentDisplayMonth.value
236
+ const newDate = new Date(year, month + delta, 1)
237
+ currentDisplayMonth.value = {
238
+ year: newDate.getFullYear(),
239
+ month: newDate.getMonth()
240
+ }
241
+ }
242
+
243
+ /**
244
+ * 切换年份
245
+ * @param delta 偏移量,-1 表示上一年,1 表示下一年
246
+ */
247
+ function changeYear(delta: number) {
248
+ const { year, month } = currentDisplayMonth.value
249
+ const newDate = new Date(year + delta, month, 1)
250
+ currentDisplayMonth.value = {
251
+ year: newDate.getFullYear(),
252
+ month: newDate.getMonth()
253
+ }
254
+ }
255
+
256
+ // 周标题
257
+ const weekLabel = computed(() => {
258
+ return (index: number) => {
259
+ return getWeekLabel(index - 1)
260
+ }
261
+ })
262
+
263
+ // 滚动区域的高度
264
+ const containerStyle = computed(() => {
265
+ const style: CSSProperties = {
266
+ height: timeType.value ? addUnit(props.panelHeight - 120) : addUnit(props.panelHeight)
267
+ }
268
+ return objToStyle(style)
269
+ })
270
+
271
+ // 月份日期和月份高度
272
+ const months = computed<MonthInfo[]>(() => {
273
+ return getMonths(props.minDate, props.maxDate).map((month, index) => {
274
+ const offset = (7 + new Date(month).getDay() - props.firstDayOfWeek) % 7
275
+ const totalDay = getMonthEndDay(new Date(month).getFullYear(), new Date(month).getMonth() + 1)
276
+ const rows = Math.ceil((offset + totalDay) / 7)
277
+ return {
278
+ height: rows * 60 + (rows - 1) * 4 + (index === 0 ? 0 : 40), // 每行60px高度,除最后一行外每行加4px margin,加上标题40px
279
+ date: month
280
+ }
281
+ })
282
+ })
283
+
284
+ /**
285
+ * 用于渲染的月份列表
286
+ * - switchMode = 'none':返回所有月份(滚动模式)
287
+ * - switchMode = 'month' | 'year-month':返回当前显示月份(固定模式)
288
+ */
289
+ const displayMonths = computed<MonthInfo[]>(() => {
290
+ if (props.switchMode === 'none') {
291
+ return months.value
292
+ }
293
+ // 固定模式:只返回当前显示的月份
294
+ const offset = (7 + new Date(currentMonthDate.value).getDay() - props.firstDayOfWeek) % 7
295
+ const totalDay = getMonthEndDay(currentDisplayMonth.value.year, currentDisplayMonth.value.month + 1)
296
+ const rows = Math.ceil((offset + totalDay) / 7)
297
+ return [
298
+ {
299
+ height: rows * 60 + (rows - 1) * 4,
300
+ date: currentMonthDate.value
301
+ }
302
+ ]
303
+ })
304
+
305
+ watch(
306
+ () => props.type,
307
+ (val) => {
308
+ if (
309
+ (val === 'datetime' && props.value) ||
310
+ (val === 'datetimerange' && isArray(props.value) && props.value && props.value.length > 0 && props.value[0])
311
+ ) {
312
+ setTime(props.value, 'start')
313
+ }
314
+ },
315
+ {
316
+ deep: true,
317
+ immediate: true
318
+ }
319
+ )
320
+
321
+ watch(
322
+ () => props.value,
323
+ (val) => {
324
+ if (isEqual(val, innerValue.value)) return
325
+
326
+ if ((props.type === 'datetime' && val) || (props.type === 'datetimerange' && val && isArray(val) && val.length > 0 && val[0])) {
327
+ setTime(val, 'start')
328
+ }
329
+ },
330
+ {
331
+ deep: true,
332
+ immediate: true
333
+ }
334
+ )
335
+
336
+ onMounted(() => {
337
+ // 初始化当前显示月份(switchMode !== 'none' 时使用)
338
+ if (props.switchMode !== 'none') {
339
+ initCurrentDisplayMonth()
340
+ }
341
+ scrollIntoView()
342
+ })
343
+
344
+ /**
345
+ * 初始化当前显示月份
346
+ * 根据选中值或当前日期设置初始月份
347
+ */
348
+ function initCurrentDisplayMonth() {
349
+ let activeDate: number | null = null
350
+
351
+ if (isArray(props.value)) {
352
+ const sortedValue = [...props.value].sort((a, b) => (a || 0) - (b || 0))
353
+ activeDate = sortedValue[0]
354
+ } else if (isNumber(props.value)) {
355
+ activeDate = props.value
356
+ }
357
+
358
+ if (!activeDate) {
359
+ activeDate = Date.now()
360
+ }
361
+
362
+ // 确保日期在 minDate 和 maxDate 范围内
363
+ if (activeDate < props.minDate) {
364
+ activeDate = props.minDate
365
+ } else if (activeDate > props.maxDate) {
366
+ activeDate = props.maxDate
367
+ }
368
+
369
+ const date = new Date(activeDate)
370
+ currentDisplayMonth.value = {
371
+ year: date.getFullYear(),
372
+ month: date.getMonth()
373
+ }
374
+ }
375
+
376
+ /**
377
+ * 使当前日期或者选中日期滚动到可视区域
378
+ */
379
+ async function scrollIntoView() {
380
+ // 等待渲染完毕
381
+ await pause()
382
+ let activeDate: number | null = 0
383
+ if (isArray(props.value)) {
384
+ // 对数组按时间排序,取第一个值
385
+ const sortedValue = [...props.value].sort((a, b) => (a || 0) - (b || 0))
386
+ activeDate = sortedValue[0]
387
+ } else if (isNumber(props.value)) {
388
+ activeDate = props.value
389
+ }
390
+
391
+ if (!activeDate) {
392
+ activeDate = Date.now()
393
+ }
394
+
395
+ let top: number = 0
396
+ let activeMonthIndex = -1
397
+ for (let index = 0; index < months.value.length; index++) {
398
+ if (compareMonth(months.value[index].date, activeDate) === 0) {
399
+ activeMonthIndex = index
400
+ // 找到选中月份后,计算选中日期在月份中的位置
401
+ const date = new Date(activeDate)
402
+ const day = date.getDate()
403
+ const firstDay = new Date(date.getFullYear(), date.getMonth(), 1)
404
+ const offset = (7 + firstDay.getDay() - props.firstDayOfWeek) % 7
405
+ const row = Math.floor((offset + day - 1) / 7)
406
+ // 每行高度60px,每行加4px margin
407
+ top += row * 60 + row * 4
408
+ break
409
+ }
410
+ top += months.value[index] ? Number(months.value[index].height) : 0
411
+ }
412
+ scrollTop.value = 0
413
+ if (top > 0) {
414
+ await pause()
415
+ // 如果不是第一个月才加45
416
+ scrollTop.value = top + (activeMonthIndex > 0 ? 40 : 0)
417
+ }
418
+ }
419
+
420
+ const internalTimeFormatter: CalendarTimeFormatter = (type, value) => {
421
+ if (props.timeFormatter) {
422
+ return props.timeFormatter(type, value)
423
+ }
424
+ return translate(type, value)
425
+ }
426
+
427
+ /**
428
+ * 获取 date 的时分秒字符串 HH:mm:ss
429
+ * @param {timestamp} date 时间
430
+ * @param {string} type 类型,是开始还是结束
431
+ */
432
+ function getTimeValue(date: number | (number | null)[], type: MonthPanelTimeType) {
433
+ let dateValue: Date = new Date()
434
+ if (props.type === 'datetime') {
435
+ dateValue = new Date(date as number)
436
+ } else if (isArray(date)) {
437
+ if (type === 'start') {
438
+ dateValue = new Date(date[0] || '')
439
+ } else {
440
+ dateValue = new Date(date[1] || '')
441
+ }
442
+ }
443
+
444
+ const hour = padZero(dateValue.getHours())
445
+ const minute = padZero(dateValue.getMinutes())
446
+ const second = padZero(dateValue.getSeconds())
447
+ return props.hideSecond ? `${hour}:${minute}` : `${hour}:${minute}:${second}`
448
+ }
449
+
450
+ function setTime(value: number | (number | null)[], type?: MonthPanelTimeType) {
451
+ if (isArray(value) && value[0] && value[1] && type === 'start' && timeType.value === 'start') {
452
+ type = 'end'
453
+ }
454
+ timeType.value = type || ''
455
+ timeValue.value = getTimeValue(value, type || '')
456
+ }
457
+ function handleDateChange({ value, type }: { value: number | (number | null)[]; type?: MonthPanelTimeType }) {
458
+ if (!isEqual(value, props.value)) {
459
+ // 内部保存一个值,用于判断新老值,避免监听器触发
460
+ innerValue.value = value
461
+ handleChange(value)
462
+ }
463
+ // datetime 和 datetimerange 类型,需要展示时间
464
+ if (props.type.indexOf('time') > -1) {
465
+ setTime(value, type)
466
+ }
467
+ }
468
+
469
+ function handleTimeChange({ value }: { value: string }) {
470
+ if (!props.value) {
471
+ return
472
+ }
473
+ const [hour, minute, second] = value.split(':').map(Number)
474
+
475
+ if (props.type === 'datetime' && isNumber(props.value)) {
476
+ const date = new Date(props.value)
477
+ date.setHours(hour)
478
+ date.setMinutes(minute)
479
+ date.setSeconds(props.hideSecond ? 0 : second || 0)
480
+ const dateTime = date.getTime()
481
+ handleChange(dateTime)
482
+ } else if (isArray(props.value) && props.type === 'datetimerange') {
483
+ const [start, end] = props.value!
484
+ const dataValue = timeType.value === 'start' ? start : end
485
+ const date = new Date(dataValue || '')
486
+ date.setHours(hour)
487
+ date.setMinutes(minute)
488
+ date.setSeconds(props.hideSecond ? 0 : second || 0)
489
+ const dateTime = date.getTime()
490
+
491
+ if (dateTime === dataValue) return
492
+
493
+ const finalValue = [start, end]
494
+ if (timeType.value === 'start') {
495
+ finalValue[0] = dateTime
496
+ } else {
497
+ finalValue[1] = dateTime
498
+ }
499
+ innerValue.value = finalValue // 内部保存一个值,用于判断新老值,避免监听器触发
500
+ handleChange(finalValue)
501
+ }
502
+ }
503
+
504
+ function handlePickStart() {
505
+ emit('pickstart')
506
+ }
507
+ function handlePickEnd() {
508
+ emit('pickend')
509
+ }
510
+
511
+ const monthScroll = (event: { detail: { scrollTop: number } }) => {
512
+ if (months.value.length <= 1) {
513
+ return
514
+ }
515
+ const scrollTop = Math.max(0, event.detail.scrollTop)
516
+ doSetSubtitle(scrollTop)
517
+ }
518
+
519
+ /**
520
+ * 设置小标题
521
+ * scrollTop 滚动条位置
522
+ */
523
+ function doSetSubtitle(scrollTop: number) {
524
+ let height: number = 0 // 月份高度和
525
+ for (let index = 0; index < months.value.length; index++) {
526
+ height = height + months.value[index].height
527
+ if (scrollTop < height) {
528
+ scrollIndex.value = index
529
+ return
530
+ }
531
+ }
532
+ }
533
+
534
+ defineExpose<MonthPanelExpose>({
535
+ scrollIntoView
536
+ })
537
+ </script>
538
+
539
+ <style lang="scss">
540
+ @use './index.scss';
541
+ </style>
@@ -0,0 +1,151 @@
1
+ import type { ComponentPublicInstance, ExtractPropTypes, PropType } from 'vue'
2
+ import { makeBooleanProp, makeNumberProp, makeStringProp } from '../../../common/props'
3
+ import type { CalendarFormatter, CalendarTimeFilter, CalendarTimeFormatter, CalendarType } from '../types'
4
+
5
+ const now = new Date()
6
+ const defaultMinDate = new Date(now.getFullYear(), now.getMonth() - 6, now.getDate()).getTime()
7
+ const defaultMaxDate = new Date(now.getFullYear(), now.getMonth() + 6, now.getDate(), 23, 59, 59).getTime()
8
+
9
+ /**
10
+ * 月份信息
11
+ */
12
+ /**
13
+ * 月份信息
14
+ */
15
+ export interface MonthInfo {
16
+ /** 日期时间戳 */
17
+ date: number
18
+ /** 高度 */
19
+ height: number
20
+ }
21
+
22
+ export const monthPanelProps = {
23
+ /**
24
+ * 日期类型
25
+ * 类型: CalendarType
26
+ * 可选值: 'date' | 'dates' | 'datetime' | 'week' | 'month' | 'daterange' | 'datetimerange' | 'weekrange' | 'monthrange'
27
+ * 默认值: 'date'
28
+ */
29
+ type: makeStringProp<CalendarType>('date'),
30
+ /**
31
+ * 选中值,为 13 位时间戳或时间戳数组
32
+ * 类型: number | (number | null)[] | null
33
+ * 默认值: null
34
+ */
35
+ value: {
36
+ type: [Number, Array, null] as PropType<number | (number | null)[] | null>,
37
+ default: null
38
+ },
39
+ /**
40
+ * 最小日期,为 13 位时间戳
41
+ * 类型: number
42
+ * 默认值: 当前日期 - 6个月
43
+ */
44
+ minDate: makeNumberProp(defaultMinDate),
45
+ /**
46
+ * 最大日期,为 13 位时间戳
47
+ * 类型: number
48
+ * 默认值: 当前日期 + 6个月
49
+ */
50
+ maxDate: makeNumberProp(defaultMaxDate),
51
+ /**
52
+ * 周起始天
53
+ * 类型: number
54
+ * 默认值: 0
55
+ */
56
+ firstDayOfWeek: makeNumberProp(0),
57
+ /**
58
+ * 日期格式化函数
59
+ * 类型: CalendarFormatter
60
+ */
61
+ formatter: Function as PropType<CalendarFormatter>,
62
+ /**
63
+ * type 为范围选择时有效,最大日期范围
64
+ * 类型: number
65
+ */
66
+ maxRange: Number,
67
+ /**
68
+ * type 为范围选择时有效,选择超出最大日期范围时的错误提示文案
69
+ * 类型: string
70
+ */
71
+ rangePrompt: String,
72
+ /**
73
+ * type 为范围选择时有效,是否允许选择同一天
74
+ * 类型: boolean
75
+ * 默认值: false
76
+ */
77
+ allowSameDay: makeBooleanProp(false),
78
+ /**
79
+ * 是否展示面板标题,自动计算当前滚动的日期月份
80
+ * 类型: boolean
81
+ * 默认值: false
82
+ */
83
+ showPanelTitle: makeBooleanProp(false),
84
+ /**
85
+ * 选中日期所使用的当日内具体时刻
86
+ * 类型: number[][]
87
+ */
88
+ defaultTime: {
89
+ type: [Array] as PropType<Array<number[]>>
90
+ },
91
+ /**
92
+ * 可滚动面板的高度
93
+ * 类型: number
94
+ * 默认值: 378
95
+ */
96
+ panelHeight: makeNumberProp(378),
97
+ /**
98
+ * 选项高度
99
+ * 类型: number
100
+ * 默认值: 44
101
+ */
102
+ itemHeight: makeNumberProp(44),
103
+ /**
104
+ * 可见选项数量
105
+ * 类型: number
106
+ * 默认值: 6
107
+ */
108
+ visibleItemCount: makeNumberProp(6),
109
+ /**
110
+ * type 为 'datetime' 或 'datetimerange' 时有效,用于过滤时间选择器的数据
111
+ * 类型: CalendarTimeFilter
112
+ */
113
+ timeFilter: Function as PropType<CalendarTimeFilter>,
114
+ /**
115
+ * type 为 'datetime' 或 'datetimerange' 时有效,用于格式化时间选择器的数据
116
+ * 类型: CalendarTimeFormatter
117
+ */
118
+ timeFormatter: Function as PropType<CalendarTimeFormatter>,
119
+ /**
120
+ * type 为 'datetime' 或 'datetimerange' 时有效,是否不展示秒修改
121
+ * 类型: boolean
122
+ * 默认值: false
123
+ */
124
+ hideSecond: makeBooleanProp(false),
125
+ /**
126
+ * 是否在手指松开时立即触发picker-view的 change 事件。若不开启则会在滚动动画结束后触发 change 事件,1.2.25版本起提供,仅微信小程序和支付宝小程序支持。
127
+ * 类型: boolean
128
+ * 默认值: false
129
+ */
130
+ immediateChange: makeBooleanProp(false),
131
+ /**
132
+ * 切换模式
133
+ * 类型: 'none' | 'month' | 'year-month'
134
+ * 可选值: none 平铺展示所有月份/年份,不展示切换按钮 | month 支持按月切换,展示上个月/下个月按钮 | year-month 支持按年切换,也支持按月切换,展示上一年/下一年,上个月/下个月按钮
135
+ * 默认值: 'none'
136
+ */
137
+ switchMode: makeStringProp<'none' | 'month' | 'year-month'>('none')
138
+ }
139
+
140
+ export type MonthPanelProps = ExtractPropTypes<typeof monthPanelProps>
141
+
142
+ export type MonthPanelTimeType = 'start' | 'end' | ''
143
+
144
+ export type MonthPanelExpose = {
145
+ /**
146
+ * 使当前日期或者选中日期滚动到可视区域
147
+ */
148
+ scrollIntoView: () => void
149
+ }
150
+
151
+ export type MonthPanelInstance = ComponentPublicInstance<MonthPanelProps, MonthPanelExpose>