@10yun/cv-mobile-ui 0.5.29 → 0.5.31

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 (350) hide show
  1. package/package.json +5 -1
  2. package/plugins/luch-request/adapters/index.js +131 -0
  3. package/plugins/luch-request/core/InterceptorManager.js +50 -0
  4. package/plugins/luch-request/core/Request.js +199 -0
  5. package/plugins/luch-request/core/buildFullPath.js +20 -0
  6. package/plugins/luch-request/core/defaults.js +32 -0
  7. package/plugins/luch-request/core/dispatchRequest.js +5 -0
  8. package/plugins/luch-request/core/mergeConfig.js +125 -0
  9. package/plugins/luch-request/core/settle.js +16 -0
  10. package/plugins/luch-request/helpers/buildURL.js +71 -0
  11. package/plugins/luch-request/helpers/combineURLs.js +12 -0
  12. package/plugins/luch-request/helpers/isAbsoluteURL.js +14 -0
  13. package/plugins/luch-request/index.d.ts +197 -0
  14. package/plugins/luch-request/index.js +2 -0
  15. package/plugins/luch-request/readme.md +3 -0
  16. package/plugins/luch-request/utils/clone.js +264 -0
  17. package/plugins/luch-request/utils.js +131 -0
  18. package/plugins/request.js +2 -2
  19. package/ui-cv/components/cv-btn-base/cv-btn-base.vue +1 -1
  20. package/ui-cv/components/cv-form-item/cv-form-item.vue +1 -1
  21. package/ui-fireui/fui-actionsheet/fui-actionsheet.vue +202 -0
  22. package/ui-fireui/fui-alert/fui-alert.vue +141 -0
  23. package/ui-fireui/fui-badge/fui-badge.vue +158 -0
  24. package/ui-fireui/fui-bottom-navigation/fui-bottom-navigation.vue +390 -0
  25. package/ui-fireui/fui-bottom-popup/fui-bottom-popup.vue +100 -0
  26. package/ui-fireui/fui-bubble-popup/fui-bubble-popup.vue +236 -0
  27. package/ui-fireui/fui-button/fui-button.vue +424 -0
  28. package/ui-fireui/fui-calendar/fui-calendar.js +915 -0
  29. package/ui-fireui/fui-calendar/fui-calendar.vue +868 -0
  30. package/ui-fireui/fui-card/fui-card.vue +231 -0
  31. package/ui-fireui/fui-cascade-selection/fui-cascade-selection.vue +538 -0
  32. package/ui-fireui/fui-circular-progress/fui-circular-progress.vue +261 -0
  33. package/ui-fireui/fui-collapse/fui-collapse.vue +179 -0
  34. package/ui-fireui/fui-countdown/fui-countdown.vue +301 -0
  35. package/ui-fireui/fui-datetime/fui-datetime.vue +570 -0
  36. package/ui-fireui/fui-divider/fui-divider.vue +118 -0
  37. package/ui-fireui/fui-drawer/fui-drawer.vue +103 -0
  38. package/ui-fireui/fui-dropdown-list/fui-dropdown-list.vue +70 -0
  39. package/ui-fireui/fui-fab/fui-fab.vue +284 -0
  40. package/ui-fireui/fui-footer/fui-footer.vue +131 -0
  41. package/ui-fireui/fui-grid/fui-grid.vue +42 -0
  42. package/ui-fireui/fui-grid-item/fui-grid-item.vue +142 -0
  43. package/ui-fireui/fui-icon/fui-icon.vue +820 -0
  44. package/ui-fireui/fui-image-cropper/fui-image-cropper.vue +1058 -0
  45. package/ui-fireui/fui-image-group/fui-image-group.vue +149 -0
  46. package/ui-fireui/fui-keyboard/fui-keyboard.vue +254 -0
  47. package/ui-fireui/fui-keyboard-input/fui-keyboard-input.vue +78 -0
  48. package/ui-fireui/fui-list-cell/fui-list-cell.vue +178 -0
  49. package/ui-fireui/fui-list-view/fui-list-view.vue +87 -0
  50. package/ui-fireui/fui-loading/fui-loading.vue +78 -0
  51. package/ui-fireui/fui-loadmore/fui-loadmore.vue +163 -0
  52. package/ui-fireui/fui-modal/fui-modal.vue +392 -0
  53. package/ui-fireui/fui-navigation-bar/fui-navigation-bar.vue +180 -0
  54. package/ui-fireui/fui-no-data/fui-no-data.vue +116 -0
  55. package/ui-fireui/fui-nomore/fui-nomore.vue +116 -0
  56. package/ui-fireui/fui-numberbox/fui-numberbox.vue +234 -0
  57. package/ui-fireui/fui-numberbox-border/fui-numberbox-border.vue +232 -0
  58. package/ui-fireui/fui-picture-cropper/fui-picture-cropper.vue +682 -0
  59. package/ui-fireui/fui-picture-cropper/fui-picture-cropper.wxs +560 -0
  60. package/ui-fireui/fui-rate/fui-rate.vue +167 -0
  61. package/ui-fireui/fui-round-progress/fui-round-progress.vue +306 -0
  62. package/ui-fireui/fui-scroll-top/fui-scroll-top.vue +189 -0
  63. package/ui-fireui/fui-sharemodel/fui-sharemodel.vue +181 -0
  64. package/ui-fireui/fui-skeleton/fui-skeleton.vue +248 -0
  65. package/ui-fireui/fui-steps/fui-steps.vue +214 -0
  66. package/ui-fireui/fui-sticky/fui-sticky.vue +155 -0
  67. package/ui-fireui/fui-sticky-wxs/fui-sticky-wxs.vue +133 -0
  68. package/ui-fireui/fui-sticky-wxs/fui-sticky.wxs +44 -0
  69. package/ui-fireui/fui-swipe-action/fui-swipe-action.vue +301 -0
  70. package/ui-fireui/fui-tabbar/fui-tabbar.vue +283 -0
  71. package/ui-fireui/fui-tabs/fui-tabs.vue +284 -0
  72. package/ui-fireui/fui-tabs2/fui-tabs2.vue +284 -0
  73. package/ui-fireui/fui-tag/fui-tag.vue +374 -0
  74. package/ui-fireui/fui-time-axis/fui-time-axis.vue +36 -0
  75. package/ui-fireui/fui-timeaxis-item/fui-timeaxis-item.vue +48 -0
  76. package/ui-fireui/fui-tips/fui-tips.vue +161 -0
  77. package/ui-fireui/fui-toast/fui-toast.vue +117 -0
  78. package/ui-fireui/fui-top-dropdown/fui-top-dropdown.vue +129 -0
  79. package/ui-fireui/fui-upload/fui-upload.vue +446 -0
  80. package/ui-fireui/fui-uploadsamll/fui-uploadsamll.vue +472 -0
  81. package/uview-plus/README.md +2 -2
  82. package/uview-plus/changelog-wu-tool.md +21 -0
  83. package/uview-plus/changelog-wu.md +91 -0
  84. package/uview-plus/components/u-action-sheet/_doc/changelog.md +12 -0
  85. package/uview-plus/components/u-action-sheet/_doc/package.json +92 -0
  86. package/uview-plus/components/u-action-sheet/_doc/readme.md +16 -0
  87. package/uview-plus/components/u-action-sheet/u-action-sheet.vue +8 -8
  88. package/uview-plus/components/u-album/u-album.vue +1 -1
  89. package/uview-plus/components/u-alert/u-alert.vue +5 -5
  90. package/uview-plus/components/u-app-update/_doc/changelog.md +26 -0
  91. package/uview-plus/components/u-app-update/_doc/package.json +89 -0
  92. package/uview-plus/components/u-app-update/_doc/readme.md +16 -0
  93. package/uview-plus/components/u-app-update/config.js +120 -0
  94. package/uview-plus/components/u-app-update/img/act.png +0 -0
  95. package/uview-plus/components/u-app-update/img/appUploadAlertBoxBg.png +0 -0
  96. package/uview-plus/components/u-app-update/img/close.png +0 -0
  97. package/uview-plus/components/u-app-update/js-sdk/checkVersion.js +81 -0
  98. package/uview-plus/components/u-app-update/js-sdk/silentlyAppUpdate.js +41 -0
  99. package/uview-plus/components/u-app-update/pages/index.vue +8 -0
  100. package/uview-plus/components/u-app-update/u-app-update.vue +583 -0
  101. package/uview-plus/components/u-avatar/u-avatar.vue +2 -2
  102. package/uview-plus/components/u-avatar-group/u-avatar-group.vue +79 -3
  103. package/uview-plus/components/u-back-top/u-back-top.vue +4 -4
  104. package/uview-plus/components/u-badge/u-badge.vue +1 -1
  105. package/uview-plus/components/u-button/u-button.vue +8 -8
  106. package/uview-plus/components/u-button-wu/_doc/changelog.md +6 -0
  107. package/uview-plus/components/u-button-wu/_doc/package.json +89 -0
  108. package/uview-plus/components/u-button-wu/_doc/readme.md +16 -0
  109. package/uview-plus/components/u-button-wu/u-button-wu.vue +522 -0
  110. package/uview-plus/components/u-button-wu/vue.scss +81 -0
  111. package/uview-plus/components/u-calendar/u-calendar.vue +5 -6
  112. package/uview-plus/components/u-calendar-wu/_doc/changelog.md +145 -0
  113. package/uview-plus/components/u-calendar-wu/_doc/package.json +90 -0
  114. package/uview-plus/components/u-calendar-wu/_doc/readme.md +16 -0
  115. package/uview-plus/components/u-calendar-wu/calendar.js +664 -0
  116. package/uview-plus/components/u-calendar-wu/i18n/en.json +14 -0
  117. package/uview-plus/components/u-calendar-wu/i18n/index.js +8 -0
  118. package/uview-plus/components/u-calendar-wu/i18n/zh-Hans.json +14 -0
  119. package/uview-plus/components/u-calendar-wu/i18n/zh-Hant.json +14 -0
  120. package/uview-plus/components/u-calendar-wu/props.js +166 -0
  121. package/uview-plus/components/u-calendar-wu/style.css +196 -0
  122. package/uview-plus/components/u-calendar-wu/u-calendar-wu.vue +921 -0
  123. package/uview-plus/components/u-calendar-wu/util.js +552 -0
  124. package/uview-plus/components/u-calendar-wu/wu-calendar-block/props.js +73 -0
  125. package/uview-plus/components/u-calendar-wu/wu-calendar-block/wu-calendar-block.vue +122 -0
  126. package/uview-plus/components/u-calendar-wu/wu-calendar-item/props.js +55 -0
  127. package/uview-plus/components/u-calendar-wu/wu-calendar-item/wu-calendar-item.vue +293 -0
  128. package/uview-plus/components/u-car-keyboard/u-car-keyboard.vue +2 -2
  129. package/uview-plus/components/u-card/u-card.vue +139 -3
  130. package/uview-plus/components/u-cell/_doc/changelog.md +6 -0
  131. package/uview-plus/components/u-cell/_doc/package.json +89 -0
  132. package/uview-plus/components/u-cell/_doc/readme.md +25 -0
  133. package/uview-plus/components/u-cell/u-cell.vue +4 -4
  134. package/uview-plus/components/u-cell-group/u-cell-group.vue +2 -2
  135. package/uview-plus/components/u-checkbox/_doc/changelog.md +8 -0
  136. package/uview-plus/components/u-checkbox/_doc/package.json +88 -0
  137. package/uview-plus/components/u-checkbox/_doc/readme.md +25 -0
  138. package/uview-plus/components/u-checkbox/u-checkbox.vue +4 -4
  139. package/uview-plus/components/u-checkbox-group/u-checkbox-group.vue +1 -1
  140. package/uview-plus/components/u-code/_doc/changelog.md +6 -0
  141. package/uview-plus/components/u-code/_doc/package.json +86 -0
  142. package/uview-plus/components/u-code/_doc/readme.md +16 -0
  143. package/uview-plus/components/u-code/u-code.vue +1 -1
  144. package/uview-plus/components/u-code-input/u-code-input.vue +1 -1
  145. package/uview-plus/components/u-col/u-col.vue +1 -1
  146. package/uview-plus/components/u-collapse/u-collapse.vue +2 -2
  147. package/uview-plus/components/u-collapse-item/u-collapse-item.vue +218 -3
  148. package/uview-plus/components/u-column-notice/u-column-notice.vue +3 -3
  149. package/uview-plus/components/u-count-down/u-count-down.vue +1 -1
  150. package/uview-plus/components/u-count-to/u-count-to.vue +1 -1
  151. package/uview-plus/components/u-datetime-picker/u-datetime-picker.vue +3 -3
  152. package/uview-plus/components/u-divider/u-divider.vue +3 -3
  153. package/uview-plus/components/u-drag-sort/_doc/changelog.md +0 -0
  154. package/uview-plus/components/u-drag-sort/_doc/package.json +85 -0
  155. package/uview-plus/components/u-drag-sort/_doc/readme.md +16 -0
  156. package/uview-plus/components/u-drag-sort/u-drag-sort.vue +3 -0
  157. package/uview-plus/components/u-dropdown/u-dropdown.vue +3 -3
  158. package/uview-plus/components/u-dropdown-item/u-dropdown-item.vue +1 -1
  159. package/uview-plus/components/u-empty/u-empty.vue +30 -4
  160. package/uview-plus/components/u-form-item/u-form-item.vue +4 -4
  161. package/uview-plus/components/u-gap/_doc/changelog.md +4 -0
  162. package/uview-plus/components/u-gap/_doc/package.json +86 -0
  163. package/uview-plus/components/u-gap/_doc/readme.md +22 -0
  164. package/uview-plus/components/u-gap/u-gap.vue +1 -1
  165. package/uview-plus/components/u-grid/u-grid.vue +1 -1
  166. package/uview-plus/components/u-grid-item/u-grid-item.vue +1 -1
  167. package/uview-plus/components/u-icon/_doc/changelog.md +10 -0
  168. package/uview-plus/components/u-icon/_doc/package.json +85 -0
  169. package/uview-plus/components/u-icon/_doc/readme.md +10 -0
  170. package/uview-plus/components/u-icon/icon.js +23 -25
  171. package/uview-plus/components/u-icon/icons.js +213 -213
  172. package/uview-plus/components/u-icon/style.css +3 -3
  173. package/uview-plus/components/u-icon/u-icon.vue +1 -1
  174. package/uview-plus/components/u-icon/u-icon2.vue +149 -0
  175. package/uview-plus/components/u-image/u-image.vue +5 -5
  176. package/uview-plus/components/u-image-wu/_doc/changelog.md +21 -0
  177. package/uview-plus/components/u-image-wu/_doc/package.json +88 -0
  178. package/uview-plus/components/u-image-wu/_doc/readme.md +11 -0
  179. package/uview-plus/components/u-image-wu/props.js +94 -0
  180. package/uview-plus/components/u-image-wu/u-image-wu.vue +243 -0
  181. package/uview-plus/components/u-index-anchor/u-index-anchor.vue +1 -1
  182. package/uview-plus/components/u-index-list/u-index-list.vue +2 -2
  183. package/uview-plus/components/u-input/_doc/changelog.md +6 -0
  184. package/uview-plus/components/u-input/_doc/package.json +88 -0
  185. package/uview-plus/components/u-input/_doc/readme.md +16 -0
  186. package/uview-plus/components/u-input/u-input.vue +4 -4
  187. package/uview-plus/components/u-keyboard/u-keyboard.vue +6 -6
  188. package/uview-plus/components/u-lazy-load/u-lazy-load.vue +257 -3
  189. package/uview-plus/components/u-line/_doc/changelog.md +8 -0
  190. package/uview-plus/components/u-line/_doc/package.json +86 -0
  191. package/uview-plus/components/u-line/_doc/readme.md +16 -0
  192. package/uview-plus/components/u-line/u-line.vue +1 -1
  193. package/uview-plus/components/u-line-progress/u-line-progress.vue +1 -1
  194. package/uview-plus/components/u-link/_doc/changelog.md +8 -0
  195. package/uview-plus/components/u-link/_doc/package.json +86 -0
  196. package/uview-plus/components/u-link/_doc/readme.md +20 -0
  197. package/uview-plus/components/u-link/u-link.vue +1 -1
  198. package/uview-plus/components/u-list/u-list.vue +1 -1
  199. package/uview-plus/components/u-list-item/u-list-item.vue +1 -1
  200. package/uview-plus/components/u-loading-icon/_doc/changelog.md +12 -0
  201. package/uview-plus/components/u-loading-icon/_doc/package.json +86 -0
  202. package/uview-plus/components/u-loading-icon/_doc/readme.md +16 -0
  203. package/uview-plus/components/u-loading-icon/props.js +1 -1
  204. package/uview-plus/components/u-loading-icon/u-loading-icon.vue +191 -3
  205. package/uview-plus/components/u-loading-page/u-loading-page.vue +4 -4
  206. package/uview-plus/components/u-loadmore/u-loadmore.vue +4 -4
  207. package/uview-plus/components/u-mask/u-mask.vue +120 -113
  208. package/uview-plus/components/u-message-input/u-message-input.vue +1 -1
  209. package/uview-plus/components/u-modal/u-modal.vue +6 -6
  210. package/uview-plus/components/u-navbar/_doc/changelog.md +6 -0
  211. package/uview-plus/components/u-navbar/_doc/package.json +89 -0
  212. package/uview-plus/components/u-navbar/_doc/readme.md +16 -0
  213. package/uview-plus/components/u-navbar/u-navbar.vue +4 -4
  214. package/uview-plus/components/u-navbar-mini/u-navbar-mini.vue +2 -2
  215. package/uview-plus/components/u-navbar-wu/props.js +102 -0
  216. package/uview-plus/components/u-navbar-wu/u-navbar-wu.vue +196 -0
  217. package/uview-plus/components/u-no-network/u-no-network.vue +5 -5
  218. package/uview-plus/components/u-notice-bar/u-notice-bar.vue +5 -5
  219. package/uview-plus/components/u-notify/u-notify.vue +6 -6
  220. package/uview-plus/components/u-number-box/_doc/changelog.md +19 -0
  221. package/uview-plus/components/u-number-box/_doc/package.json +88 -0
  222. package/uview-plus/components/u-number-box/_doc/readme.md +16 -0
  223. package/uview-plus/components/u-number-box/u-number-box.vue +9 -3
  224. package/uview-plus/components/u-number-keyboard/u-number-keyboard.vue +1 -1
  225. package/uview-plus/components/u-overlay/_doc/changelog.md +4 -0
  226. package/uview-plus/components/u-overlay/_doc/package.json +88 -0
  227. package/uview-plus/components/u-overlay/_doc/readme.md +16 -0
  228. package/uview-plus/components/u-overlay/u-overlay.vue +3 -3
  229. package/uview-plus/components/u-picker/u-picker.vue +5 -5
  230. package/uview-plus/components/u-popup/_doc/changelog.md +4 -0
  231. package/uview-plus/components/u-popup/_doc/package.json +92 -0
  232. package/uview-plus/components/u-popup/_doc/readme.md +16 -0
  233. package/uview-plus/components/u-popup/u-popup.vue +8 -8
  234. package/uview-plus/components/u-popup-wu/keypress.js +45 -0
  235. package/uview-plus/components/u-popup-wu/u-popup-wu.vue +519 -0
  236. package/uview-plus/components/u-radio/_doc/changelog.md +6 -0
  237. package/uview-plus/components/u-radio/_doc/package.json +88 -0
  238. package/uview-plus/components/u-radio/_doc/readme.md +25 -0
  239. package/uview-plus/components/u-radio/u-radio.vue +4 -4
  240. package/uview-plus/components/u-radio-group/u-radio-group.vue +1 -1
  241. package/uview-plus/components/u-rate/u-rate.vue +5 -5
  242. package/uview-plus/components/u-read-more/u-read-more.vue +126 -3
  243. package/uview-plus/components/u-row/_doc/changelog.md +8 -0
  244. package/uview-plus/components/u-row/_doc/package.json +86 -0
  245. package/uview-plus/components/u-row/_doc/readme.md +16 -0
  246. package/uview-plus/components/u-row/u-row.vue +1 -1
  247. package/uview-plus/components/u-row-notice/u-row-notice.vue +3 -3
  248. package/uview-plus/components/u-safe-bottom/_doc/changelog.md +6 -0
  249. package/uview-plus/components/u-safe-bottom/_doc/package.json +86 -0
  250. package/uview-plus/components/u-safe-bottom/_doc/readme.md +16 -0
  251. package/uview-plus/components/u-safe-bottom/u-safe-bottom.vue +48 -3
  252. package/uview-plus/components/u-search/u-search.vue +4 -4
  253. package/uview-plus/components/u-select/u-select.vue +175 -3
  254. package/uview-plus/components/u-skeleton/u-skeleton.vue +3 -3
  255. package/uview-plus/components/u-sku-wu/_doc/changelog.md +27 -0
  256. package/uview-plus/components/u-sku-wu/_doc/package.json +93 -0
  257. package/uview-plus/components/u-sku-wu/_doc/readme.md +16 -0
  258. package/uview-plus/components/u-sku-wu/props.js +86 -0
  259. package/uview-plus/components/u-sku-wu/style.css +271 -0
  260. package/uview-plus/components/u-sku-wu/u-sku-wu.vue +864 -0
  261. package/uview-plus/components/u-status-bar/_doc/changelog.md +4 -0
  262. package/uview-plus/components/u-status-bar/_doc/package.json +86 -0
  263. package/uview-plus/components/u-status-bar/_doc/readme.md +16 -0
  264. package/uview-plus/components/u-status-bar/u-status-bar.vue +1 -1
  265. package/uview-plus/components/u-steps/u-steps.vue +1 -1
  266. package/uview-plus/components/u-steps-item/u-steps-item.vue +7 -7
  267. package/uview-plus/components/u-sticky/u-sticky.vue +1 -1
  268. package/uview-plus/components/u-subsection/u-subsection.vue +1 -1
  269. package/uview-plus/components/u-swipe-action/u-swipe-action.vue +1 -1
  270. package/uview-plus/components/u-swipe-action-item/u-swipe-action-item.vue +3 -3
  271. package/uview-plus/components/u-swiper/u-swiper.vue +1 -1
  272. package/uview-plus/components/u-swiper-indicator/u-swiper-indicator.vue +1 -1
  273. package/uview-plus/components/u-switch/u-switch.vue +2 -2
  274. package/uview-plus/components/u-tabbar/u-tabbar.vue +2 -2
  275. package/uview-plus/components/u-tabbar-item/u-tabbar-item.vue +9 -4
  276. package/uview-plus/components/u-table/u-table.vue +1 -1
  277. package/uview-plus/components/u-tabs/u-tabs.vue +3 -3
  278. package/uview-plus/components/u-tag/u-tag.vue +5 -5
  279. package/uview-plus/components/u-text/_doc/changelog.md +10 -0
  280. package/uview-plus/components/u-text/_doc/package.json +89 -0
  281. package/uview-plus/components/u-text/_doc/readme.md +20 -0
  282. package/uview-plus/components/u-text/u-text.vue +159 -3
  283. package/uview-plus/components/u-textarea/_doc/changelog.md +6 -0
  284. package/uview-plus/components/u-textarea/_doc/package.json +86 -0
  285. package/uview-plus/components/u-textarea/_doc/readme.md +25 -0
  286. package/uview-plus/components/u-toast/u-toast.vue +8 -8
  287. package/uview-plus/components/u-tooltip/u-tooltip.vue +6 -6
  288. package/uview-plus/components/u-transition/_doc/changelog.md +14 -0
  289. package/uview-plus/components/u-transition/_doc/package.json +86 -0
  290. package/uview-plus/components/u-transition/_doc/readme.md +16 -0
  291. package/uview-plus/components/u-transition-wu/createAnimation.js +148 -0
  292. package/uview-plus/components/u-transition-wu/props.js +32 -0
  293. package/uview-plus/components/u-transition-wu/u-transition.vue +300 -0
  294. package/uview-plus/components/u-upload/u-upload.vue +10 -10
  295. package/uview-plus/components/u-verification-code/u-verification-code.vue +161 -0
  296. package/uview-plus/components/u-waterfall/u-waterfall.vue +221 -3
  297. package/uview-plus/index.js +109 -94
  298. package/uview-plus/libs/config/config.js +46 -48
  299. package/uview-plus/libs/css/color.scss +32 -311
  300. package/uview-plus/libs/css/components-wu.scss +30 -0
  301. package/uview-plus/libs/css/vue.scss +10 -10
  302. package/uview-plus/libs/ctocode/index.js +120 -0
  303. package/uview-plus/libs/function/calc.js +61 -55
  304. package/uview-plus/libs/function/color/color-convert/CHANGELOG.md +54 -0
  305. package/uview-plus/libs/function/color/color-convert/LICENSE +21 -0
  306. package/uview-plus/libs/function/color/color-convert/README.md +68 -0
  307. package/uview-plus/libs/function/color/color-convert/conversions.js +839 -0
  308. package/uview-plus/libs/function/color/color-convert/index.js +81 -0
  309. package/uview-plus/libs/function/color/color-convert/package.json +48 -0
  310. package/uview-plus/libs/function/color/color-convert/route.js +97 -0
  311. package/uview-plus/libs/function/color/color-name/LICENSE +8 -0
  312. package/uview-plus/libs/function/color/color-name/README.md +11 -0
  313. package/uview-plus/libs/function/color/color-name/index.js +152 -0
  314. package/uview-plus/libs/function/color/color-name/package.json +28 -0
  315. package/uview-plus/libs/function/color/color-string/LICENSE +21 -0
  316. package/uview-plus/libs/function/color/color-string/README.md +62 -0
  317. package/uview-plus/libs/function/color/color-string/index.js +244 -0
  318. package/uview-plus/libs/function/color/color-string/package.json +39 -0
  319. package/uview-plus/libs/function/color/color.js +496 -0
  320. package/uview-plus/libs/function/color/index.js +158 -0
  321. package/uview-plus/libs/function/color/is-arrayish/LICENSE +21 -0
  322. package/uview-plus/libs/function/color/is-arrayish/README.md +16 -0
  323. package/uview-plus/libs/function/color/is-arrayish/index.js +9 -0
  324. package/uview-plus/libs/function/color/is-arrayish/package.json +45 -0
  325. package/uview-plus/libs/function/color/is-arrayish/yarn-error.log +1443 -0
  326. package/uview-plus/libs/function/color/simple-swizzle/LICENSE +21 -0
  327. package/uview-plus/libs/function/color/simple-swizzle/README.md +39 -0
  328. package/uview-plus/libs/function/color/simple-swizzle/index.js +29 -0
  329. package/uview-plus/libs/function/color/simple-swizzle/package.json +36 -0
  330. package/uview-plus/libs/function/colorGradient.js +108 -106
  331. package/uview-plus/libs/function/debounce.js +17 -17
  332. package/uview-plus/libs/function/digit.js +1 -3
  333. package/uview-plus/libs/function/http.js +3 -3
  334. package/uview-plus/libs/function/index-wu.js +198 -0
  335. package/uview-plus/libs/function/index.js +579 -566
  336. package/uview-plus/libs/function/platform.js +18 -18
  337. package/uview-plus/libs/function/test.js +135 -137
  338. package/uview-plus/libs/function/throttle.js +17 -17
  339. package/uview-plus/libs/luch-request/core/Request.js +199 -199
  340. package/uview-plus/libs/mixin/mpMixin.js +1 -0
  341. package/uview-plus/libs/mixin/openType.js +33 -0
  342. package/uview-plus/libs/util/async-validator.js +1343 -1343
  343. package/uview-plus/libs/util/dayjs.js +404 -0
  344. package/uview-plus/libs/util/route.js +101 -105
  345. package/uview-plus/package-wu-tool.json +84 -0
  346. package/uview-plus/package-wu.json +112 -0
  347. package/uview-plus/package.json +106 -95
  348. package/uview-plus/readme-wu.md +148 -0
  349. package/uview-ui/index.js +51 -52
  350. package/plugins/uni-upgrade.js +0 -294
@@ -0,0 +1,921 @@
1
+ <template>
2
+ <view class="wu-calendar" @click.stop>
3
+ <view
4
+ v-if="!insert && show"
5
+ class="wu-calendar__mask"
6
+ :class="{ 'wu-calendar--mask-show': aniMaskShow }"
7
+ @click="clean"
8
+ ></view>
9
+ <view
10
+ v-if="insert || show"
11
+ class="wu-calendar__content"
12
+ :class="{ 'wu-calendar--fixed': !insert, 'wu-calendar--ani-show': aniMaskShow }"
13
+ >
14
+ <!-- 弹窗日历取消与确认按钮位置 -->
15
+ <slot name="operation" v-if="operationPosition == 'top'">
16
+ <view v-if="!insert" class="wu-calendar__header wu-calendar--fixed-top">
17
+ <view class="wu-calendar__header-btn-box" @click="cancel">
18
+ <text class="wu-calendar__header-text wu-calendar--fixed-width" :style="[{ color: cancelColor }]">
19
+ {{ cancelText }}
20
+ </text>
21
+ </view>
22
+ <view class="wu-calendar__header-btn-box" @click="confirm">
23
+ <text class="wu-calendar__header-text wu-calendar--fixed-width" :style="[{ color: confirmColor }]">{{ okText }}</text>
24
+ </view>
25
+ </view>
26
+ </slot>
27
+ <!-- 日历头部 -->
28
+ <slot name="header" :nowDate="nowDate">
29
+ <view class="wu-calendar__header">
30
+ <!-- 纵向滑动切换展示内容 -->
31
+ <template v-if="slideSwitchMode == 'vertical'">
32
+ <view class="wu-calendar__header-btn-box vertical">
33
+ <view class="wu-calendar__header-btn wu-calendar--top" @click.stop="pre"></view>
34
+ <picker mode="date" :value="nowDate.fullDate" fields="month" @change="bindDateChange">
35
+ <text class="wu-calendar__header-text">
36
+ {{ (nowDate.year || '') + YearText + (nowDate.month || '') + MonthText }}
37
+ </text>
38
+ </picker>
39
+ <view class="wu-calendar__header-btn wu-calendar--bottom" @click.stop="next"></view>
40
+ </view>
41
+ <text class="wu-calendar__backtoday vertical" @click="backToday">{{ todayText }}</text>
42
+ </template>
43
+ <!-- 横向滑动与无滑动展示内容 -->
44
+ <template v-else>
45
+ <view class="wu-calendar__header-btn-box horizontal" @click.stop="pre">
46
+ <view class="wu-calendar__header-btn wu-calendar--left"></view>
47
+ </view>
48
+ <picker mode="date" :value="nowDate.fullDate" fields="month" @change="bindDateChange">
49
+ <text class="wu-calendar__header-text">
50
+ {{ (nowDate.year || '') + YearText + (nowDate.month || '') + MonthText }}
51
+ </text>
52
+ </picker>
53
+ <view class="wu-calendar__header-btn-box horizontal" @click.stop="next">
54
+ <view class="wu-calendar__header-btn wu-calendar--right"></view>
55
+ </view>
56
+ <text class="wu-calendar__backtoday" @click="backToday">{{ todayText }}</text>
57
+ </template>
58
+ </view>
59
+ </slot>
60
+ <view class="wu-calendar__box">
61
+ <view class="wu-calendar__weeks">
62
+ <view class="wu-calendar__weeks-day" v-if="startWeek === 'sun'">
63
+ <text class="wu-calendar__weeks-day-text">{{ SUNText }}</text>
64
+ </view>
65
+ <view class="wu-calendar__weeks-day">
66
+ <text class="wu-calendar__weeks-day-text">{{ monText }}</text>
67
+ </view>
68
+ <view class="wu-calendar__weeks-day">
69
+ <text class="wu-calendar__weeks-day-text">{{ TUEText }}</text>
70
+ </view>
71
+ <view class="wu-calendar__weeks-day">
72
+ <text class="wu-calendar__weeks-day-text">{{ WEDText }}</text>
73
+ </view>
74
+ <view class="wu-calendar__weeks-day">
75
+ <text class="wu-calendar__weeks-day-text">{{ THUText }}</text>
76
+ </view>
77
+ <view class="wu-calendar__weeks-day">
78
+ <text class="wu-calendar__weeks-day-text">{{ FRIText }}</text>
79
+ </view>
80
+ <view class="wu-calendar__weeks-day">
81
+ <text class="wu-calendar__weeks-day-text">{{ SATText }}</text>
82
+ </view>
83
+ <view class="wu-calendar__weeks-day" v-if="startWeek === 'mon'">
84
+ <text class="wu-calendar__weeks-day-text">{{ SUNText }}</text>
85
+ </view>
86
+ </view>
87
+ <!-- 滑动切换 -->
88
+ <swiper
89
+ v-if="slideSwitchMode !== 'none'"
90
+ :class="{ 'wu-calendar__weeks_container': initStatus }"
91
+ :style="[calendarContentStyle]"
92
+ :duration="500"
93
+ :vertical="slideSwitchMode == 'vertical'"
94
+ circular
95
+ :current="swiperCurrent"
96
+ @change="swiperChange"
97
+ skip-hidden-item-layout
98
+ >
99
+ <!-- 月或周日历 -->
100
+ <template v-if="type === 'month' || type === 'week'">
101
+ <swiper-item>
102
+ <wu-calendar-block
103
+ :weeks="preWeeks"
104
+ :calendar="calendar"
105
+ :selected="selected"
106
+ :lunar="lunar"
107
+ @change="choiceDate"
108
+ :color="color"
109
+ :actBadgeColor="actBadgeColor"
110
+ :startText="startText"
111
+ :endText="endText"
112
+ :month="preWeeksMonth"
113
+ :FoldStatus="FoldStatus"
114
+ :monthShowCurrentMonth="monthShowCurrentMonth"
115
+ :showMonth="showMonth"
116
+ :itemHeight="itemHeight"
117
+ :defaultMargin="defaultMargin"
118
+ :todayDefaultStyle="todayDefaultStyle"
119
+ ></wu-calendar-block>
120
+ </swiper-item>
121
+ <swiper-item>
122
+ <wu-calendar-block
123
+ :weeks="weeks"
124
+ :calendar="calendar"
125
+ :selected="selected"
126
+ :lunar="lunar"
127
+ @change="choiceDate"
128
+ :color="color"
129
+ :actBadgeColor="actBadgeColor"
130
+ :startText="startText"
131
+ :endText="endText"
132
+ :monthShowCurrentMonth="monthShowCurrentMonth"
133
+ :month="weeksMonth"
134
+ :FoldStatus="FoldStatus"
135
+ :showMonth="showMonth"
136
+ :itemHeight="itemHeight"
137
+ :defaultMargin="defaultMargin"
138
+ :todayDefaultStyle="todayDefaultStyle"
139
+ ></wu-calendar-block>
140
+ </swiper-item>
141
+ <swiper-item>
142
+ <wu-calendar-block
143
+ :weeks="nextWeeks"
144
+ :calendar="calendar"
145
+ :selected="selected"
146
+ :lunar="lunar"
147
+ @change="choiceDate"
148
+ :color="color"
149
+ :actBadgeColor="actBadgeColor"
150
+ :startText="startText"
151
+ :endText="endText"
152
+ :month="nextWeeksMonth"
153
+ :FoldStatus="FoldStatus"
154
+ :monthShowCurrentMonth="monthShowCurrentMonth"
155
+ :showMonth="showMonth"
156
+ :itemHeight="itemHeight"
157
+ :defaultMargin="defaultMargin"
158
+ :todayDefaultStyle="todayDefaultStyle"
159
+ ></wu-calendar-block>
160
+ </swiper-item>
161
+ </template>
162
+ </swiper>
163
+ <!-- 无滑动切换 -->
164
+ <template v-else>
165
+ <!-- 月或周日历 -->
166
+ <wu-calendar-block
167
+ class="wu-calendar__weeks_container"
168
+ :style="[calendarContentStyle]"
169
+ :weeks="weeks"
170
+ :calendar="calendar"
171
+ :selected="selected"
172
+ :lunar="lunar"
173
+ @change="choiceDate"
174
+ :color="color"
175
+ :actBadgeColor="actBadgeColor"
176
+ :startText="startText"
177
+ :endText="endText"
178
+ :month="nowDate.month"
179
+ :FoldStatus="FoldStatus"
180
+ :monthShowCurrentMonth="monthShowCurrentMonth"
181
+ :showMonth="showMonth"
182
+ :itemHeight="itemHeight"
183
+ :defaultMargin="defaultMargin"
184
+ :todayDefaultStyle="todayDefaultStyle"
185
+ ></wu-calendar-block>
186
+ </template>
187
+ </view>
188
+ <view class="wu-calendar__fold" v-if="type !== 'year' && Fold" @click="FoldClick">
189
+ <up-icon v-if="FoldStatus == 'open'" name="arrow-up" bold size="18"></up-icon>
190
+ <up-icon v-else-if="FoldStatus == 'close'" name="arrow-down" bold size="18"></up-icon>
191
+ </view>
192
+ <!-- 弹窗日历取消与确认按钮位置 -->
193
+ <slot name="operation" v-if="operationPosition == 'bottom'">
194
+ <view v-if="!insert" class="wu-calendar__header wu-calendar--fixed-top">
195
+ <view class="wu-calendar__header-btn-box" @click="cancel">
196
+ <text class="wu-calendar__header-text wu-calendar--fixed-width" :style="[{ color: cancelColor }]">
197
+ {{ cancelText }}
198
+ </text>
199
+ </view>
200
+ <view class="wu-calendar__header-btn-box" @click="confirm">
201
+ <text class="wu-calendar__header-text wu-calendar--fixed-width" :style="[{ color: confirmColor }]">{{ okText }}</text>
202
+ </view>
203
+ </view>
204
+ </slot>
205
+ <up-safe-bottom v-if="!insert && show"></up-safe-bottom>
206
+ </view>
207
+ </view>
208
+ </template>
209
+
210
+ <script>
211
+ import Calendar from './util.js';
212
+ import { mpMixin } from '../../libs/mixin/mpMixin.js';
213
+ import { mixin } from '../../libs/mixin/mixin.js';
214
+ import props from './props.js';
215
+
216
+ import { initVueI18n } from '@dcloudio/uni-i18n';
217
+ import i18nMessages from './i18n/index.js';
218
+ const { t } = initVueI18n(i18nMessages);
219
+ import wuCalendarBlock from './wu-calendar-block/wu-calendar-block.vue';
220
+ /**
221
+ * Calendar 日历
222
+ * @description 日历组件,多模式选择(单日期、多日期、范围日期选择),多日历类型(周、月日历),动态计算滑动。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
223
+ * @tutorial https://wuui.cn/zh-CN/components/calendar.html
224
+ * @property {String} date 自定义当前时间,默认为今天
225
+ * @property {String} type 日历类型(默认为month)
226
+ * @value month 月日历
227
+ * @value week 周日历
228
+ * @property {Boolean} fold 是否支持折叠(默认值 month: true, week: false)
229
+ * @property {Boolean} useToday 是否使用默认日期(今天,默认为true)
230
+ * @property {Boolean} todayDefaultStyle 是否显示今日默认样式(默认为true)
231
+ * @property {String} color 主题色(默认#3c9cff)
232
+ * @property {String} mode = [single|multiple|range] 日期选择类型(默认single(单日期选择))
233
+ * @value single 单日期选择
234
+ * @value multiple 多日期选择
235
+ * @value range 范围选择
236
+ * @property {String} color 主题色(默认#3c9cff)
237
+ * @property {Number} itemHeight 日历中每一项日期的高度(默认60),单位px
238
+ * @property {String} cancelColor 取消文字的颜色(默认#333333)
239
+ * @property {String} confirmColor 确认文字的颜色(默认#333333)
240
+ * @property {String} startText mode=range时,第一个日期底部的提示文字
241
+ * @property {String} endText mode=range时,最后一个日期底部的提示文字
242
+ * @property {String} startWeek 日历以周几开始,默认为周日(sun),`type: month | week`时生效
243
+ * @value sun 周日
244
+ * @value mon 周一
245
+ * @property {Boolean} lunar 显示农历
246
+ * @property {String} startDate 日期选择范围-开始日期
247
+ * @property {String} endDate 日期选择范围-结束日期
248
+ * @property {Boolean} rangeEndRepick 允许范围内重选结束日期(默认false)
249
+ * @property {Boolean} rangeSameDay 允许日期选择范围起始日期为同一天(默认false)
250
+ * @property {Boolean} rangeHaveDisableTruncation 允许日期选择范围内遇到打点禁用日期进行截断
251
+ * @property {Boolean} monthShowCurrentMonth 当月是否仅展示当月数据
252
+ * @property {Boolean} insert = [true|false] 插入模式,默认为true
253
+ * @value true 插入模式
254
+ * @value false 弹窗模式
255
+ * @property {String} slideSwitchMode 滑动切换模式,默认为horizontal(横向滑动切换)
256
+ * @value horizontal 横向滑动切换
257
+ * @value vertical 纵向滑动切换
258
+ * @value none 不使用滑动切换
259
+ * @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
260
+ * @property {Array[Object]} selected 自定义打点,期待格式 [{date: '2023-11-18', info: '¥888', infoColor: '#6ac695', topInfo: '机票打折', topInfoColor: '#6ac695', badge: true, badgePosition: 'top-right', disable: false}, ...]
261
+ * @property {Boolean} showMonth 是否选择月份为背景(默认true)
262
+ * @property {Boolean} maskClick 是否点击遮罩层关闭(默认false)
263
+ * @property {Boolean} disabledChoice 是否禁止点击日历(默认false)
264
+ * @property {String} actBadgeColor 当通过 `selected` 属性设置某个日期 `badgeColor`后,如果该日期被选择且主题色与 `badgeColor` 一致时,徽标会显示本颜色
265
+ * @property {String} operationPosition 弹窗日历取消和确认按钮的显示位置
266
+ * @property {Boolean} confirmFullDate 弹窗日历点击确认时是否需要选择完整日期
267
+ * @event {Function} close 日历弹窗点击遮罩层关闭,`insert :false` 时生效
268
+ * @event {Function} change 日期改变,`insert :ture` 时生效
269
+ * @event {Function} confirm 确认选择,`insert :false` 时生效
270
+ * @event {Function} cancel 点击取消按钮,`insert :false` 时生效
271
+ * @event {Function} monthSwitch 切换月份时触发
272
+ * @event {Function} foldSwitch 切换折叠状态时触发,`type: month | week` & `fold: true` 时生效
273
+ * @example <wu-calendar :insert="true":lunar="true" start-date="2022-5-20" end-date="2023-5-20"@change="change" />
274
+ */
275
+ export default {
276
+ components: { wuCalendarBlock },
277
+ mixins: [mpMixin, mixin, props],
278
+ emits: ['close', 'cancel', 'confirm', 'change', 'monthSwitch', 'foldSwitch'],
279
+ data() {
280
+ return {
281
+ show: false,
282
+ weeks: [],
283
+ preWeeks: [],
284
+ nextWeeks: [],
285
+ weeksMonth: null,
286
+ preWeeksMonth: null,
287
+ nextWeeksMonth: null,
288
+ calendar: {},
289
+ nowDate: '',
290
+ aniMaskShow: false,
291
+ swiperCurrent: 1,
292
+ swiperChangeDirection: '',
293
+ pickerDate: '',
294
+ Fold: null,
295
+ FoldStatus: null,
296
+ weekContentStyle: {},
297
+ initStatus: false,
298
+ defaultMargin: 8
299
+ };
300
+ },
301
+ computed: {
302
+ /**
303
+ * for i18n
304
+ */
305
+ okText() {
306
+ return t('wu-calender.ok');
307
+ },
308
+ cancelText() {
309
+ return t('wu-calender.cancel');
310
+ },
311
+ YearText() {
312
+ return t('wu-calender.year');
313
+ },
314
+ MonthText() {
315
+ return t('wu-calender.month');
316
+ },
317
+ todayText() {
318
+ return t('wu-calender.today');
319
+ },
320
+ monText() {
321
+ return t('wu-calender.MON');
322
+ },
323
+ TUEText() {
324
+ return t('wu-calender.TUE');
325
+ },
326
+ WEDText() {
327
+ return t('wu-calender.WED');
328
+ },
329
+ THUText() {
330
+ return t('wu-calender.THU');
331
+ },
332
+ FRIText() {
333
+ return t('wu-calender.FRI');
334
+ },
335
+ SATText() {
336
+ return t('wu-calender.SAT');
337
+ },
338
+ SUNText() {
339
+ return t('wu-calender.SUN');
340
+ },
341
+ calendarContentStyle() {
342
+ return {
343
+ height: (this.FoldStatus === 'open' ? this.itemHeight * 6 : this.itemHeight) + 'px'
344
+ };
345
+ },
346
+ getDateType() {
347
+ if (this.type === 'year') return this.type;
348
+ return this.FoldStatus === 'open' ? 'month' : 'week';
349
+ }
350
+ },
351
+ watch: {
352
+ date(newVal) {
353
+ this.cale.cleanRange();
354
+ this.init(newVal);
355
+ },
356
+ mode(newVal) {
357
+ this.cale.cleanRange();
358
+ this.cale.resetMode(newVal);
359
+ this.init(this.date);
360
+ },
361
+ startDate(val) {
362
+ this.cale.resetSatrtDate(val);
363
+ this.cale.setDate(this.nowDate.fullDate);
364
+ this.assignmentWeeks();
365
+ },
366
+ endDate(val) {
367
+ this.cale.resetEndDate(val);
368
+ this.cale.setDate(this.nowDate.fullDate);
369
+ this.assignmentWeeks();
370
+ },
371
+ monthShowCurrentMonth(val) {
372
+ this.cale.resetMonthShowCurrentMonth(val);
373
+ this.setDate(this.nowDate.fullDate);
374
+ },
375
+ rangeEndRepick(val) {
376
+ this.cale.resetRangeEndRepick(val);
377
+ },
378
+ rangeSameDay(val) {
379
+ this.cale.resetRangeSameDay(val);
380
+ },
381
+ rangeHaveDisableTruncation(val) {
382
+ this.cale.resetRangeHaveDisableTruncation(val);
383
+ this.cale.cleanRange();
384
+ this.init(this.date);
385
+ },
386
+ selected: {
387
+ handler(newVal) {
388
+ this.cale.setSelectInfo(this.nowDate.fullDate, newVal);
389
+ this.assignmentWeeks();
390
+ // 找出目前的信息weeks 并 将 this.calendar重新赋值
391
+ let nowDateInfo = this.cale.canlender.filter(
392
+ (item) => item.fullDate && this.cale.dateEqual(item.fullDate, this.calendar.fullDate)
393
+ );
394
+ if (nowDateInfo.length) this.calendar = nowDateInfo[0];
395
+ },
396
+ deep: true
397
+ },
398
+ fold(newVal) {
399
+ this.Fold = newVal;
400
+ },
401
+ type(newVal) {
402
+ this.initFold();
403
+ this.cale.resetFoldStatus(this.FoldStatus);
404
+ this.init(this.date);
405
+ },
406
+ startWeek(newVal) {
407
+ this.cale.cleanRange();
408
+ this.cale.resetStartWeek(newVal);
409
+ this.init(this.date);
410
+ }
411
+ },
412
+ created() {
413
+ this.initFold();
414
+ this.cale = new Calendar({
415
+ selected: this.selected,
416
+ startDate: this.startDate,
417
+ endDate: this.endDate,
418
+ mode: this.mode,
419
+ type: this.type,
420
+ startWeek: this.startWeek,
421
+ foldStatus: this.FoldStatus,
422
+ monthShowCurrentMonth: this.monthShowCurrentMonth,
423
+ rangeEndRepick: this.rangeEndRepick,
424
+ rangeSameDay: this.rangeSameDay,
425
+ rangeHaveDisableTruncation: this.rangeHaveDisableTruncation
426
+ });
427
+ this.init(this.date);
428
+ },
429
+ methods: {
430
+ // 取消穿透
431
+ clean() {
432
+ if (this.maskClick) {
433
+ this.$emit('close');
434
+ this.close();
435
+ }
436
+ },
437
+ bindDateChange(e) {
438
+ const value = e.detail.value + '-1';
439
+ this.setDate(value);
440
+ this.swiperCurrentChangeWeeks();
441
+
442
+ const { year, month } = this.cale.getDate(value);
443
+ this.$emit('monthSwitch', {
444
+ year,
445
+ month: Number(month),
446
+ fullDate: `${year}-${`${month}`.padStart(2, '0')}`
447
+ });
448
+ },
449
+ /**
450
+ * 初始化日期显示
451
+ * @param {Object} date
452
+ */
453
+ init(date) {
454
+ this.$nextTick(() => {
455
+ // 初始化
456
+ this.initStatus = false;
457
+ let firstDate = this.mode == 'single' ? date : date[0];
458
+ // 如果填写默认值
459
+ if (date) {
460
+ // 当前数据类型
461
+ let dateType = Object.prototype.toString.call(date);
462
+ // 验证类型
463
+ if (this.mode == 'single' && dateType != '[object String]') {
464
+ return console.error(`类型错误,mode=${this.mode}时,date=String`);
465
+ } else if (this.mode != 'single' && dateType != '[object Array]') {
466
+ return console.error(`类型错误,mode=${this.mode}时,date=Array`);
467
+ }
468
+ // 根据类型默认选中不同的值
469
+ if (this.mode == 'multiple') {
470
+ this.cale.multiple = date.map((item) => item);
471
+ this.cale._getWeek(this.cale.multiple[this.cale.multiple.length - 1]);
472
+ } else if (this.mode == 'range') {
473
+ date[0] ? this.cale.setRange(date[0]) : '';
474
+ date[1] ? this.cale.setRange(date[1]) : '';
475
+ }
476
+ }
477
+ // 如果不填写默认值 且 使用今日作为默认值 并且 还没有在打点中禁用今天的日期
478
+ else if (
479
+ this.useToday &&
480
+ !this.selected.filter((item) => item.disable && this.cale.dateEqual(item.date, this.cale.date.fullDate)).length
481
+ ) {
482
+ if (this.mode == 'multiple') {
483
+ this.cale.multiple = [this.cale.date.fullDate];
484
+ this.cale._getWeek(this.cale.multiple[this.cale.multiple.length - 1]);
485
+ } else if (this.mode == 'range') {
486
+ this.cale.setRange(this.cale.date.fullDate);
487
+ }
488
+ }
489
+
490
+ // 设置日期
491
+ this.cale.setDate(firstDate);
492
+ // 现在的日期
493
+ this.nowDate = this.cale.getInfo(firstDate);
494
+ // 设置当前月份
495
+ this.weeksMonth = this.nowDate.month;
496
+ // 如果不填写默认值 且 使用今日作为默认值
497
+ if ((this.useToday && !this.date) || this.date) {
498
+ this.calendar = this.nowDate;
499
+ }
500
+
501
+ // 渲染
502
+ this.updateWeeks(false, true);
503
+ // 初始化成功
504
+ this.initStatus = true;
505
+ });
506
+ },
507
+ /**
508
+ * 打开日历弹窗
509
+ */
510
+ open() {
511
+ // #ifdef APP-NVUE
512
+ // 为弹窗模式且需要清理数据
513
+ if (this.clearDate && !this.insert) {
514
+ this.reset(this.date);
515
+ }
516
+ // #endif
517
+ this.show = true;
518
+ // #ifdef H5
519
+ if (!this.insert) document.body.style = 'overflow: hidden';
520
+ // #endif
521
+ this.$nextTick(() => {
522
+ setTimeout(() => {
523
+ this.aniMaskShow = true;
524
+ }, 50);
525
+ });
526
+ },
527
+ /**
528
+ * 关闭日历弹窗
529
+ */
530
+ close() {
531
+ this.aniMaskShow = false;
532
+ this.$nextTick(() => {
533
+ setTimeout(() => {
534
+ this.show = false;
535
+ // #ifdef H5
536
+ if (!this.insert) document.body.style = 'overflow: visible';
537
+ // #endif
538
+ // #ifndef APP-NVUE
539
+ // 为弹窗模式且需要清理数据
540
+ if (this.clearDate && !this.insert) {
541
+ this.reset();
542
+ }
543
+ // #endif
544
+ }, 300);
545
+ });
546
+ },
547
+ /**
548
+ * 重置
549
+ */
550
+ reset() {
551
+ this.cale.cleanRange();
552
+ this.cale.cleanMultiple();
553
+ this.swiperCurrent = 1;
554
+ this.init(this.date);
555
+ },
556
+ /**
557
+ * 清空选中
558
+ */
559
+ clearSelect() {
560
+ this.cale.cleanRange();
561
+ this.cale.cleanMultiple();
562
+ this.calendar = {};
563
+ this.updateWeeks(false, true);
564
+ },
565
+ /**
566
+ * 确认按钮
567
+ */
568
+ confirm() {
569
+ if (this.confirmFullDate) {
570
+ if (this.mode == 'single' && !this.calendar.fullDate) {
571
+ return uni.showToast({
572
+ icon: 'none',
573
+ title: '请选择日期',
574
+ duration: 600
575
+ });
576
+ } else if (this.mode == 'multiple' && !this.cale.multiple.length) {
577
+ return uni.showToast({
578
+ icon: 'none',
579
+ title: '请至少选择一个日期',
580
+ duration: 600
581
+ });
582
+ } else if (this.mode == 'range') {
583
+ if (!this.cale.rangeStatus.before) {
584
+ return uni.showToast({
585
+ icon: 'none',
586
+ title: '请选择开始日期',
587
+ duration: 600
588
+ });
589
+ } else if (!this.cale.rangeStatus.after) {
590
+ return uni.showToast({
591
+ icon: 'none',
592
+ title: '请选择结束日期',
593
+ duration: 600
594
+ });
595
+ }
596
+ }
597
+ }
598
+ this.setEmit('confirm');
599
+ this.close();
600
+ },
601
+ /**
602
+ * 取消按钮
603
+ */
604
+ cancel() {
605
+ this.$emit('cancel');
606
+ this.close();
607
+ },
608
+ /**
609
+ * 变化触发
610
+ */
611
+ change() {
612
+ if (!this.insert) return;
613
+ this.setEmit('change');
614
+ },
615
+ /**
616
+ * 选择月份触发
617
+ */
618
+ monthSwitch() {
619
+ let { year, month } = this.nowDate;
620
+ this.$emit('monthSwitch', {
621
+ year,
622
+ month: Number(month),
623
+ fullDate: `${year}-${`${month}`.padStart(2, '0')}`
624
+ });
625
+ },
626
+ /**
627
+ * 派发事件
628
+ * @param {Object} name
629
+ */
630
+ setEmit(name) {
631
+ let { year, month, date, fullDate, lunar, extraInfo, type, mode } = this.calendar;
632
+
633
+ let params = {
634
+ range: this.cale.rangeStatus,
635
+ multiple: this.cale.multiple,
636
+ mode,
637
+ type,
638
+ year,
639
+ month: Number(month),
640
+ date,
641
+ fulldate: fullDate,
642
+ lunar,
643
+ extraInfo: extraInfo || {}
644
+ };
645
+
646
+ if (this.type === 'month' || this.type === 'week') {
647
+ params.foldStatus = this.FoldStatus;
648
+ }
649
+
650
+ this.$emit(name, params);
651
+ },
652
+ /**
653
+ * 选择天触发
654
+ * @param {Object} weeks
655
+ */
656
+ choiceDate(weeks) {
657
+ // 如果为禁用 或者 空数据 或者 禁止点击日期
658
+ if (weeks.disable || weeks.empty || this.disabledChoice) return;
659
+
660
+ this.calendar = weeks;
661
+ // 保存操作的日历信息
662
+ this.nowDate = this.calendar;
663
+ // 设置选择范围
664
+ this.cale.setRange(this.calendar.fullDate);
665
+ // 设置多选
666
+ this.cale.setMultiple(this.calendar.fullDate);
667
+
668
+ // 如果启用滑动切换 且当前模式为范围选择时则重新计算上月与下月
669
+ if (this.slideSwitchMode !== 'none') {
670
+ let weekName = '';
671
+ switch (this.swiperCurrent) {
672
+ case 0:
673
+ weekName = 'preWeeks';
674
+ if (this.mode == 'range') {
675
+ this.weeks = this.cale._getWeek(this.weeks[0].find((item) => item.fullDate).fullDate, false);
676
+ this.nextWeeks = this.cale._getWeek(this.nextWeeks[0].find((item) => item.fullDate).fullDate, false);
677
+ }
678
+ break;
679
+ case 1:
680
+ weekName = 'weeks';
681
+ if (this.mode == 'range') {
682
+ this.preWeeks = this.cale._getWeek(this.preWeeks[0].find((item) => item.fullDate).fullDate, false);
683
+ this.nextWeeks = this.cale._getWeek(this.nextWeeks[0].find((item) => item.fullDate).fullDate, false);
684
+ }
685
+ break;
686
+ case 2:
687
+ weekName = 'nextWeeks';
688
+ if (this.mode == 'range') {
689
+ this.weeks = this.cale._getWeek(this.weeks[0].find((item) => item.fullDate).fullDate, false);
690
+ this.preWeeks = this.cale._getWeek(this.preWeeks[0].find((item) => item.fullDate).fullDate, false);
691
+ }
692
+ break;
693
+ }
694
+ this[weekName] = this.cale.weeks;
695
+ } else {
696
+ this.weeks = this.cale.weeks;
697
+ }
698
+
699
+ this.change();
700
+ },
701
+ /**
702
+ * 回到今天
703
+ */
704
+ backToday() {
705
+ // 获取目前的年月
706
+ const nowYearMonth = `${this.nowDate.year}-${this.nowDate.month}`;
707
+
708
+ if (this.cale.rangeStatus.before && !this.cale.rangeStatus.after) {
709
+ this.cale.rangeStatus.before = '';
710
+ }
711
+
712
+ // 设置日期
713
+ this.setDate(this.cale.date.fullDate);
714
+ let date = this.nowDate;
715
+ this.calendar = date;
716
+ // 设置选中的日期
717
+ this.cale.setRange(date.fullDate);
718
+ // 今天的日期
719
+ const todayYearMonth = `${date.year}-${date.month}`;
720
+
721
+ // 如果当前日期 与 今天的日期不符
722
+ if (nowYearMonth !== todayYearMonth) {
723
+ // 触发月份切换事件
724
+ this.monthSwitch();
725
+ }
726
+
727
+ // 设置日期
728
+ this.setDate(this.cale.date.fullDate);
729
+ // swiperCurrent改变需要改动的weeks
730
+ this.swiperCurrentChangeWeeks();
731
+ // 改变事件
732
+ this.change();
733
+ },
734
+ /**
735
+ * 上个月
736
+ */
737
+ pre() {
738
+ this.swiperChangeDirection = 'pre';
739
+ this.updateWeeks();
740
+ },
741
+ /**
742
+ * 下个月
743
+ */
744
+ next() {
745
+ this.swiperChangeDirection = 'next';
746
+ this.updateWeeks();
747
+ },
748
+ /**
749
+ * 设置日期
750
+ * @param {Object} date
751
+ */
752
+ setDate(date) {
753
+ this.cale.setDate(date);
754
+ this.nowDate = this.cale.getInfo(date);
755
+ this.assignmentWeeks();
756
+ },
757
+ /**
758
+ * 用来将cale.weeks 赋值到 weeks
759
+ */
760
+ assignmentWeeks() {
761
+ let weekName = '';
762
+ let weekMonthName = '';
763
+ switch (this.swiperCurrent) {
764
+ case 0:
765
+ weekName = 'preWeeks';
766
+ weekMonthName = 'preWeeksMonth';
767
+ break;
768
+ case 1:
769
+ weekName = 'weeks';
770
+ weekMonthName = 'weeksMonth';
771
+ break;
772
+ case 2:
773
+ weekName = 'nextWeeks';
774
+ weekMonthName = 'nextWeeksMonth';
775
+ break;
776
+ }
777
+ this[weekName] = this.cale.weeks;
778
+ this[weekMonthName] = this.cale.selectDate.month;
779
+ },
780
+ /**
781
+ * 滑动切换日期
782
+ */
783
+ swiperChange(e) {
784
+ // 非用户滑动不执行
785
+ if (e.detail.source !== 'touch' && e.detail.source !== 'autoplay') return;
786
+ let curr = e.detail.current;
787
+ if (curr - this.swiperCurrent == 1 || curr - this.swiperCurrent == -2) {
788
+ this.swiperChangeDirection = 'next';
789
+ } else {
790
+ this.swiperChangeDirection = 'pre';
791
+ }
792
+ this.swiperCurrent = curr;
793
+ this.updateWeeks();
794
+ },
795
+ /**
796
+ * 更新weeks
797
+ * @param {Boolean} isChange 是否使当前的weeks发生变化
798
+ */
799
+ updateWeeks(isChange = true, isInt = false) {
800
+ let newFullDate = '';
801
+ // 是否变动日期信息
802
+ if (isChange) {
803
+ // 如果目前处于打开状态也就是月日历时,将记录月份改为一号(这样可以在用户切换到任意月份时并折叠自动选中1号)
804
+ let fullDate = this.FoldStatus === 'close' ? this.nowDate.fullDate : `${this.nowDate.year}-${this.nowDate.month}-${1}`;
805
+ newFullDate = this.cale.getDate(fullDate, this.swiperChangeDirection === 'next' ? +1 : -1, this.getDateType).fullDate;
806
+ } else {
807
+ newFullDate = this.cale.getDate(this.nowDate.fullDate, 0, this.getDateType).fullDate;
808
+ }
809
+ this.setDate(newFullDate);
810
+ this.swiperCurrentChangeWeeks();
811
+ if (!isInt) {
812
+ this.monthSwitch();
813
+ }
814
+ },
815
+ /**
816
+ * swiperCurrent改变需要改动的weeks
817
+ */
818
+ swiperCurrentChangeWeeks() {
819
+ if (this.slideSwitchMode === 'none') return;
820
+ // 防止一次渲染过多数据,造成对nvue的卡顿
821
+ this.$nextTick(() => {
822
+ let nextDate = this.cale.getDate(this.nowDate.fullDate, +1, this.getDateType);
823
+ let nextWeeks = this.cale._getWeek(nextDate.fullDate, false);
824
+ let nextWeeksMonth = nextDate.month;
825
+ let preDate = this.cale.getDate(this.nowDate.fullDate, -1, this.getDateType);
826
+ let preWeeks = this.cale._getWeek(preDate.fullDate, false);
827
+ let preWeeksMonth = preDate.month;
828
+
829
+ if (this.swiperCurrent == 0) {
830
+ this.weeks = nextWeeks;
831
+ this.weeksMonth = nextWeeksMonth;
832
+ this.nextWeeks = preWeeks;
833
+ this.nextWeeksMonth = preWeeksMonth;
834
+ } else if (this.swiperCurrent == 1) {
835
+ this.nextWeeks = nextWeeks;
836
+ this.nextWeeksMonth = nextWeeksMonth;
837
+ this.preWeeks = preWeeks;
838
+ this.preWeeksMonth = preWeeksMonth;
839
+ } else {
840
+ this.preWeeks = nextWeeks;
841
+ this.preWeeksMonth = nextWeeksMonth;
842
+ this.weeks = preWeeks;
843
+ this.weeksMonth = preWeeksMonth;
844
+ }
845
+ });
846
+ },
847
+
848
+ // 点击折叠
849
+ FoldClick() {
850
+ this.FoldStatus = this.FoldStatus === 'open' ? 'close' : 'open';
851
+ this.cale.resetFoldStatus(this.FoldStatus);
852
+ // 重置当前weeks
853
+ this.setDate(this.nowDate.fullDate);
854
+ this.$nextTick(() => {
855
+ // 重置左右切换的上下weeks
856
+ if (this.slideSwitchMode !== 'none') {
857
+ let nextDate = this.cale.getDate(this.nowDate.fullDate, +1, this.getDateType);
858
+ let nextWeeks = this.cale._getWeek(nextDate.fullDate, false);
859
+ let nextWeeksMonth = nextDate.month;
860
+
861
+ let preDate = this.cale.getDate(this.nowDate.fullDate, -1, this.getDateType);
862
+ let preWeeks = this.cale._getWeek(preDate.fullDate, false);
863
+ let preWeeksMonth = preDate.month;
864
+
865
+ if (this.swiperChangeDirection == 'next') {
866
+ if (this.swiperCurrent == 0) {
867
+ this.weeks = nextWeeks;
868
+ this.weeksMonth = nextWeeksMonth;
869
+ this.nextWeeks = preWeeks;
870
+ this.nextWeeksMonth = preWeeksMonth;
871
+ } else if (this.swiperCurrent == 1) {
872
+ this.nextWeeks = nextWeeks;
873
+ this.nextWeeksMonth = nextWeeksMonth;
874
+ this.preWeeks = preWeeks;
875
+ this.preWeeksMonth = preWeeksMonth;
876
+ } else {
877
+ this.preWeeks = nextWeeks;
878
+ this.preWeeksMonth = nextWeeksMonth;
879
+ this.weeks = preWeeks;
880
+ this.weeksMonth = preWeeksMonth;
881
+ }
882
+ } else {
883
+ if (this.swiperCurrent == 0) {
884
+ this.nextWeeks = preWeeks;
885
+ this.nextWeeksMonth = preWeeksMonth;
886
+ this.weeks = nextWeeks;
887
+ this.weeksMonth = nextWeeksMonth;
888
+ } else if (this.swiperCurrent == 1) {
889
+ this.preWeeks = preWeeks;
890
+ this.preWeeksMonth = preWeeksMonth;
891
+ this.nextWeeks = nextWeeks;
892
+ this.nextWeeksMonth = nextWeeksMonth;
893
+ } else {
894
+ this.weeks = preWeeks;
895
+ this.weeksMonth = preWeeksMonth;
896
+ this.preWeeks = nextWeeks;
897
+ this.preWeeksMonth = nextWeeksMonth;
898
+ }
899
+ }
900
+ }
901
+ });
902
+ // fold切换事件
903
+ this.$emit('foldSwitch', {
904
+ type: this.type,
905
+ status: this.FoldStatus
906
+ });
907
+ },
908
+ // 初始化折叠
909
+ initFold() {
910
+ if (this.type === 'month' || this.type === 'week') {
911
+ this.Fold = this.fold === null ? this.type !== 'month' : this.fold;
912
+ this.FoldStatus = this.type !== 'month' ? 'close' : 'open';
913
+ }
914
+ }
915
+ }
916
+ };
917
+ </script>
918
+
919
+ <style scoped>
920
+ @import './style.css';
921
+ </style>