@nutui/nutui-react-taro 3.0.0-beta.11 → 3.0.0-beta.13

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 (543) hide show
  1. package/dist/cjs/{utils → hooks}/use-click-away.js +2 -2
  2. package/dist/cjs/{utils → hooks}/use-custom-event.js +2 -2
  3. package/dist/cjs/{utils → hooks}/use-isomprphic-layout-effect.js +1 -1
  4. package/dist/cjs/{utils → hooks}/use-lock-scroll.js +2 -2
  5. package/dist/cjs/packages/actionsheet/style/style.css +13 -18
  6. package/dist/cjs/packages/address/address.d.ts +1 -1
  7. package/dist/cjs/packages/address/address.js +1 -1
  8. package/dist/cjs/packages/address/style/style.css +45 -57
  9. package/dist/cjs/packages/animate/animate.js +5 -6
  10. package/dist/cjs/packages/animate/style/animate.scss +63 -105
  11. package/dist/cjs/packages/animate/style/style.css +45 -44
  12. package/dist/cjs/packages/animate/style/style.harmony.css +45 -44
  13. package/dist/cjs/packages/animatingnumbers/style/style.css +3 -3
  14. package/dist/cjs/packages/audio/style/style.css +55 -55
  15. package/dist/cjs/packages/avatar/avatar.js +2 -2
  16. package/dist/cjs/packages/avatar/style/style.css +2 -2
  17. package/dist/cjs/packages/avatarcropper/avatarcropper.js +3 -2
  18. package/dist/cjs/packages/backtop/backtop.js +1 -3
  19. package/dist/cjs/packages/backtop/style/backtop.scss +0 -4
  20. package/dist/cjs/packages/backtop/style/style.css +8 -14
  21. package/dist/cjs/packages/backtop/style/style.harmony.css +0 -3
  22. package/dist/cjs/packages/badge/badge.js +10 -11
  23. package/dist/cjs/packages/badge/style/style.css +4 -4
  24. package/dist/cjs/packages/barrage/style/style.css +2 -2
  25. package/dist/cjs/packages/button/button.js +20 -13
  26. package/dist/cjs/packages/button/style/button.scss +3 -3
  27. package/dist/cjs/packages/button/style/style.css +43 -43
  28. package/dist/cjs/packages/button/style/style.harmony.css +3 -3
  29. package/dist/cjs/packages/calendar/style/calendar.scss +25 -31
  30. package/dist/cjs/packages/calendar/style/style.css +28 -39
  31. package/dist/cjs/packages/calendar/style/style.harmony.css +14 -20
  32. package/dist/cjs/packages/calendarcard/calendarcard.js +1 -1
  33. package/dist/cjs/packages/calendarcard/style/style.css +8 -8
  34. package/dist/cjs/packages/calendaritem/calendaritem.js +1 -2
  35. package/dist/cjs/packages/card/style/style.css +8 -8
  36. package/dist/cjs/packages/cascader/cascader.d.ts +2 -2
  37. package/dist/cjs/packages/cascader/cascader.js +5 -5
  38. package/dist/cjs/packages/cascader/style/style.css +35 -47
  39. package/dist/cjs/packages/cell/style/style.css +8 -8
  40. package/dist/cjs/packages/cellgroup/style/style.css +3 -3
  41. package/dist/cjs/packages/checkbox/checkbox.js +1 -1
  42. package/dist/cjs/packages/checkbox/style/style.css +29 -29
  43. package/dist/cjs/packages/checkboxgroup/checkboxgroup.js +1 -1
  44. package/dist/cjs/packages/checkboxgroup/style/style.css +7 -7
  45. package/dist/cjs/packages/circleprogress/circleprogress.js +1 -1
  46. package/dist/cjs/packages/circleprogress/style/style.css +3 -3
  47. package/dist/cjs/packages/col/style/col.scss +0 -1
  48. package/dist/cjs/packages/collapse/collapse.js +1 -1
  49. package/dist/cjs/packages/collapse/style/style.css +11 -11
  50. package/dist/cjs/packages/collapseitem/style/style.css +11 -11
  51. package/dist/cjs/packages/configprovider/configprovider.js +3 -3
  52. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  53. package/dist/cjs/packages/countdown/style/style.css +7 -7
  54. package/dist/cjs/packages/countup/style/style.css +3 -3
  55. package/dist/cjs/packages/datepicker/datepicker.js +1 -1
  56. package/dist/cjs/packages/datepicker/style/style.css +16 -21
  57. package/dist/cjs/packages/dialog/content.d.ts +3 -13
  58. package/dist/cjs/packages/dialog/content.js +27 -9
  59. package/dist/cjs/packages/dialog/dialog.d.ts +3 -5
  60. package/dist/cjs/packages/dialog/dialog.js +23 -23
  61. package/dist/cjs/packages/dialog/index.d.ts +1 -1
  62. package/dist/cjs/packages/dialog/style/dialog.scss +0 -4
  63. package/dist/cjs/packages/dialog/style/style.css +49 -57
  64. package/dist/cjs/packages/dialog/types.d.ts +57 -0
  65. package/dist/cjs/packages/dialog/types.js +4 -0
  66. package/dist/cjs/packages/dialog/types.taro.d.ts +10 -0
  67. package/dist/cjs/packages/divider/style/style.css +4 -4
  68. package/dist/cjs/packages/drag/drag.js +3 -2
  69. package/dist/cjs/packages/elevator/elevator.js +1 -1
  70. package/dist/cjs/packages/elevator/style/style.css +8 -8
  71. package/dist/cjs/packages/empty/empty.js +1 -3
  72. package/dist/cjs/packages/empty/style/style.css +3 -3
  73. package/dist/cjs/packages/fixednav/fixednav.d.ts +2 -15
  74. package/dist/cjs/packages/fixednav/fixednav.js +15 -34
  75. package/dist/cjs/packages/fixednav/index.d.ts +1 -2
  76. package/dist/cjs/packages/fixednav/style/style.css +3 -8
  77. package/dist/cjs/packages/fixednav/types.d.ts +12 -0
  78. package/dist/cjs/packages/fixednav/types.taro.d.ts +1 -0
  79. package/dist/cjs/packages/form/style/style.css +15 -15
  80. package/dist/cjs/packages/formitem/style/style.css +4 -4
  81. package/dist/cjs/packages/grid/style/style.css +6 -6
  82. package/dist/cjs/packages/griditem/style/style.css +5 -5
  83. package/dist/cjs/packages/hoverbutton/hoverbutton.js +1 -3
  84. package/dist/cjs/packages/hoverbutton/style/hoverbutton.scss +0 -4
  85. package/dist/cjs/packages/hoverbutton/style/style.css +4 -7
  86. package/dist/cjs/packages/hoverbutton/style/style.harmony.css +0 -3
  87. package/dist/cjs/packages/hoverbuttonitem/hoverbuttonitem.js +4 -5
  88. package/dist/cjs/packages/hoverbuttonitem/style/style.css +4 -4
  89. package/dist/cjs/packages/image/image.js +1 -1
  90. package/dist/cjs/packages/image/style/style.css +2 -2
  91. package/dist/cjs/packages/imagepreview/imagepreview.js +1 -1
  92. package/dist/cjs/packages/imagepreview/style/style.css +11 -27
  93. package/dist/cjs/packages/indicator/style/style.css +4 -4
  94. package/dist/cjs/packages/infiniteloading/style/style.css +4 -4
  95. package/dist/cjs/packages/input/input.js +1 -1
  96. package/dist/cjs/packages/input/style/input.scss +0 -6
  97. package/dist/cjs/packages/input/style/style.css +8 -14
  98. package/dist/cjs/packages/input/style/style.harmony.css +0 -6
  99. package/dist/cjs/packages/inputnumber/inputnumber.js +5 -15
  100. package/dist/cjs/packages/inputnumber/style/style.css +7 -7
  101. package/dist/cjs/packages/loading/style/style.css +2 -2
  102. package/dist/cjs/packages/lottie/mp.js +3 -2
  103. package/dist/cjs/packages/menu/style/style.css +8 -13
  104. package/dist/cjs/packages/menuitem/menuitem.js +5 -4
  105. package/dist/cjs/packages/menuitem/style/style.css +4 -9
  106. package/dist/cjs/packages/navbar/style/navbar.scss +1 -1
  107. package/dist/cjs/packages/navbar/style/style.css +3 -3
  108. package/dist/cjs/packages/navbar/style/style.harmony.css +1 -1
  109. package/dist/cjs/packages/notify/notify.js +3 -10
  110. package/dist/cjs/packages/notify/style/style.css +4 -4
  111. package/dist/cjs/packages/numberkeyboard/numberkeyboard.d.ts +1 -1
  112. package/dist/cjs/packages/numberkeyboard/style/style.css +13 -18
  113. package/dist/cjs/packages/nutui.react.build.d.ts +3 -1
  114. package/dist/cjs/packages/nutui.react.build.js +122 -118
  115. package/dist/cjs/packages/nutui.react.d.ts +4 -1
  116. package/dist/cjs/packages/nutui.react.js +123 -118
  117. package/dist/cjs/packages/nutui.react.scss.d.ts +1 -0
  118. package/dist/cjs/packages/nutui.react.scss.js +1 -0
  119. package/dist/cjs/packages/overlay/index.d.ts +1 -1
  120. package/dist/cjs/packages/overlay/overlay.d.ts +1 -12
  121. package/dist/cjs/packages/overlay/overlay.js +22 -35
  122. package/dist/cjs/packages/overlay/style/overlay.scss +0 -5
  123. package/dist/cjs/packages/overlay/style/style.css +1 -6
  124. package/dist/cjs/packages/overlay/style/style.harmony.css +0 -5
  125. package/dist/cjs/packages/overlay/types.d.ts +11 -0
  126. package/dist/cjs/packages/overlay/types.js +4 -0
  127. package/dist/cjs/packages/overlay/types.taro.d.ts +5 -0
  128. package/dist/cjs/packages/pagination/pagination.js +1 -1
  129. package/dist/cjs/packages/pagination/style/style.css +7 -7
  130. package/dist/cjs/packages/picker/picker.d.ts +1 -1
  131. package/dist/cjs/packages/picker/picker.js +6 -6
  132. package/dist/cjs/packages/picker/pickerpanel.js +1 -1
  133. package/dist/cjs/packages/picker/style/style.css +16 -21
  134. package/dist/cjs/packages/picker/style/style.harmony.css +2 -2
  135. package/dist/cjs/packages/pickerview/index.d.ts +3 -0
  136. package/dist/cjs/packages/pickerview/index.js +13 -0
  137. package/dist/cjs/packages/pickerview/pickerroller.d.ts +7 -0
  138. package/dist/cjs/packages/pickerview/pickerroller.js +186 -0
  139. package/dist/cjs/packages/pickerview/pickerview.d.ts +4 -0
  140. package/dist/cjs/packages/pickerview/pickerview.js +201 -0
  141. package/dist/cjs/packages/pickerview/style/css.js +1 -0
  142. package/dist/cjs/packages/pickerview/style/index.js +1 -0
  143. package/dist/cjs/packages/pickerview/style/pickerview.scss +79 -0
  144. package/dist/cjs/packages/pickerview/style/style.css +73 -0
  145. package/dist/cjs/packages/pickerview/style/style.harmony.css +83 -0
  146. package/dist/cjs/packages/pickerview/types.d.ts +32 -0
  147. package/dist/cjs/packages/pickerview/types.js +4 -0
  148. package/dist/cjs/packages/pickerview/utils.d.ts +14 -0
  149. package/dist/cjs/packages/pickerview/utils.js +46 -0
  150. package/dist/cjs/packages/popover/popover.d.ts +3 -3
  151. package/dist/cjs/packages/popover/popover.js +2 -2
  152. package/dist/cjs/packages/popover/style/style.css +12 -17
  153. package/dist/cjs/packages/popover/types.d.ts +3 -2
  154. package/dist/cjs/packages/popup/index.d.ts +1 -1
  155. package/dist/cjs/packages/popup/popup.d.ts +2 -25
  156. package/dist/cjs/packages/popup/popup.js +24 -40
  157. package/dist/cjs/packages/popup/style/style.css +5 -10
  158. package/dist/cjs/packages/popup/types.d.ts +25 -0
  159. package/dist/cjs/packages/popup/types.js +4 -0
  160. package/dist/cjs/packages/popup/types.taro.d.ts +8 -0
  161. package/dist/cjs/packages/price/style/style.css +1 -1
  162. package/dist/cjs/packages/progress/progress.js +4 -7
  163. package/dist/cjs/packages/progress/style/style.css +1 -1
  164. package/dist/cjs/packages/pulltorefresh/pulltorefresh.js +3 -8
  165. package/dist/cjs/packages/pulltorefresh/style/style.css +4 -4
  166. package/dist/cjs/packages/radio/radio.js +1 -1
  167. package/dist/cjs/packages/radio/style/style.css +19 -19
  168. package/dist/cjs/packages/radiogroup/radiogroup.js +1 -1
  169. package/dist/cjs/packages/radiogroup/style/style.css +6 -6
  170. package/dist/cjs/packages/range/range.js +8 -42
  171. package/dist/cjs/packages/range/style/style.css +9 -9
  172. package/dist/cjs/packages/rate/rate.js +2 -2
  173. package/dist/cjs/packages/resultpage/style/style.css +2 -2
  174. package/dist/cjs/packages/searchbar/style/style.css +5 -5
  175. package/dist/cjs/packages/segmented/segmented.js +1 -1
  176. package/dist/cjs/packages/segmented/style/style.css +2 -2
  177. package/dist/cjs/packages/shortpassword/shortpassword.d.ts +1 -1
  178. package/dist/cjs/packages/shortpassword/shortpassword.js +1 -1
  179. package/dist/cjs/packages/shortpassword/style/style.css +15 -20
  180. package/dist/cjs/packages/sidebar/sidebar.js +3 -3
  181. package/dist/cjs/packages/sidebar/style/style.css +5 -5
  182. package/dist/cjs/packages/sidebaritem/style/style.css +1 -1
  183. package/dist/cjs/packages/sidenavbar/style/style.css +9 -14
  184. package/dist/cjs/packages/sidenavbaritem/style/style.css +2 -2
  185. package/dist/cjs/packages/signature/style/style.css +2 -2
  186. package/dist/cjs/packages/skeleton/style/skeleton.scss +0 -18
  187. package/dist/cjs/packages/skeleton/style/style.css +5 -11
  188. package/dist/cjs/packages/skeleton/style/style.harmony.css +0 -6
  189. package/dist/cjs/packages/step/style/style.css +19 -19
  190. package/dist/cjs/packages/steps/style/style.css +19 -19
  191. package/dist/cjs/packages/sticky/sticky.js +3 -2
  192. package/dist/cjs/packages/subsidenavbar/style/style.css +2 -2
  193. package/dist/cjs/packages/swipe/swipe.js +3 -3
  194. package/dist/cjs/packages/swiper/style/style.css +4 -15
  195. package/dist/cjs/packages/swiper/style/style.harmony.css +0 -11
  196. package/dist/cjs/packages/swiper/style/swiper.scss +0 -11
  197. package/dist/cjs/packages/switch/style/style.css +6 -6
  198. package/dist/cjs/packages/switch/switch.js +1 -1
  199. package/dist/cjs/packages/tabbar/style/style.css +11 -18
  200. package/dist/cjs/packages/tabbar/tabbar.js +1 -1
  201. package/dist/cjs/packages/tabbaritem/style/style.css +10 -17
  202. package/dist/cjs/packages/tabbaritem/style/style.harmony.css +1 -1
  203. package/dist/cjs/packages/tabbaritem/style/tabbaritem.scss +2 -10
  204. package/dist/cjs/packages/tabbaritem/tabbaritem.js +9 -11
  205. package/dist/cjs/packages/table/style/style.css +11 -11
  206. package/dist/cjs/packages/table/table.js +1 -1
  207. package/dist/cjs/packages/tabpane/style/style.css +1 -1
  208. package/dist/cjs/packages/tabpane/tabpane.js +2 -2
  209. package/dist/cjs/packages/tabs/style/style.css +25 -32
  210. package/dist/cjs/packages/tabs/style/style.harmony.css +4 -11
  211. package/dist/cjs/packages/tabs/style/tabs.scss +4 -9
  212. package/dist/cjs/packages/tabs/tabs.js +33 -52
  213. package/dist/cjs/packages/tag/style/style.css +5 -5
  214. package/dist/cjs/packages/tag/style/tag.scss +0 -2
  215. package/dist/cjs/packages/textarea/style/style.css +13 -13
  216. package/dist/cjs/packages/textarea/textarea.d.ts +3 -3
  217. package/dist/cjs/packages/textarea/textarea.js +19 -22
  218. package/dist/cjs/packages/timedetail/style/style.css +4 -4
  219. package/dist/cjs/packages/timeselect/style/style.css +14 -19
  220. package/dist/cjs/packages/toast/index.d.ts +2 -1
  221. package/dist/cjs/packages/toast/style/style.css +2 -20
  222. package/dist/cjs/packages/toast/style/style.harmony.css +0 -11
  223. package/dist/cjs/packages/toast/style/toast.scss +0 -13
  224. package/dist/cjs/packages/toast/toast.d.ts +1 -22
  225. package/dist/cjs/packages/toast/toast.js +28 -26
  226. package/dist/cjs/packages/toast/types.d.ts +17 -0
  227. package/dist/cjs/packages/toast/types.js +4 -0
  228. package/dist/cjs/packages/tour/style/style.css +16 -21
  229. package/dist/cjs/packages/tour/tour.d.ts +1 -1
  230. package/dist/cjs/packages/tour/tour.js +1 -1
  231. package/dist/cjs/packages/trendarrow/style/style.css +1 -1
  232. package/dist/cjs/packages/uploader/style/style.css +12 -12
  233. package/dist/cjs/packages/uploader/types.d.ts +2 -1
  234. package/dist/cjs/packages/uploader/uploader.js +1 -1
  235. package/dist/cjs/packages/virtuallist/style/style.css +4 -4
  236. package/dist/cjs/packages/virtuallist/virtuallist.js +2 -2
  237. package/dist/cjs/utils/get-rect-by-taro.js +1 -15
  238. package/dist/cjs/utils/get-system-info.d.ts +19 -0
  239. package/dist/cjs/utils/get-system-info.js +32 -0
  240. package/dist/cjs/utils/platform-taro.d.ts +0 -2
  241. package/dist/cjs/utils/platform-taro.js +0 -21
  242. package/dist/cjs/utils/px-transform.js +0 -1
  243. package/dist/es/{utils → hooks}/use-click-away.js +3 -2
  244. package/dist/es/{utils → hooks}/use-custom-event.js +1 -1
  245. package/dist/es/{utils → hooks}/use-isomprphic-layout-effect.js +1 -1
  246. package/dist/es/{utils → hooks}/use-lock-scroll.js +2 -2
  247. package/dist/es/packages/actionsheet/style/style.css +13 -18
  248. package/dist/es/packages/address/address.d.ts +1 -1
  249. package/dist/es/packages/address/address.js +1 -1
  250. package/dist/es/packages/address/style/style.css +45 -57
  251. package/dist/es/packages/animate/animate.js +5 -6
  252. package/dist/es/packages/animate/style/animate.scss +63 -105
  253. package/dist/es/packages/animate/style/style.css +45 -44
  254. package/dist/es/packages/animate/style/style.harmony.css +45 -44
  255. package/dist/es/packages/animatingnumbers/style/style.css +3 -3
  256. package/dist/es/packages/audio/audio.d.ts +30 -10
  257. package/dist/es/packages/audio/style/style.css +55 -55
  258. package/dist/es/packages/avatar/avatar.js +3 -3
  259. package/dist/es/packages/avatar/style/style.css +2 -2
  260. package/dist/es/packages/avatarcropper/avatarcropper.js +3 -2
  261. package/dist/es/packages/backtop/backtop.js +1 -3
  262. package/dist/es/packages/backtop/style/backtop.scss +0 -4
  263. package/dist/es/packages/backtop/style/style.css +8 -14
  264. package/dist/es/packages/backtop/style/style.harmony.css +0 -3
  265. package/dist/es/packages/badge/badge.js +10 -11
  266. package/dist/es/packages/badge/style/style.css +4 -4
  267. package/dist/es/packages/barrage/style/style.css +2 -2
  268. package/dist/es/packages/button/button.js +22 -15
  269. package/dist/es/packages/button/style/button.scss +3 -3
  270. package/dist/es/packages/button/style/style.css +43 -43
  271. package/dist/es/packages/button/style/style.harmony.css +3 -3
  272. package/dist/es/packages/calendar/calendar.d.ts +27 -135
  273. package/dist/es/packages/calendar/style/calendar.scss +25 -31
  274. package/dist/es/packages/calendar/style/style.css +28 -39
  275. package/dist/es/packages/calendar/style/style.harmony.css +14 -20
  276. package/dist/es/packages/calendarcard/calendarcard.js +1 -1
  277. package/dist/es/packages/calendarcard/style/style.css +8 -8
  278. package/dist/es/packages/calendaritem/calendaritem.js +1 -2
  279. package/dist/es/packages/card/style/style.css +8 -8
  280. package/dist/es/packages/cascader/cascader.d.ts +2 -2
  281. package/dist/es/packages/cascader/cascader.js +2 -2
  282. package/dist/es/packages/cascader/style/style.css +35 -47
  283. package/dist/es/packages/cell/style/style.css +8 -8
  284. package/dist/es/packages/cellgroup/style/style.css +3 -3
  285. package/dist/es/packages/checkbox/checkbox.js +1 -1
  286. package/dist/es/packages/checkbox/style/style.css +29 -29
  287. package/dist/es/packages/checkboxgroup/checkboxgroup.js +1 -1
  288. package/dist/es/packages/checkboxgroup/style/style.css +7 -7
  289. package/dist/es/packages/circleprogress/circleprogress.d.ts +1 -1
  290. package/dist/es/packages/circleprogress/circleprogress.js +1 -1
  291. package/dist/es/packages/circleprogress/style/style.css +3 -3
  292. package/dist/es/packages/col/style/col.scss +0 -1
  293. package/dist/es/packages/collapse/collapse.js +1 -1
  294. package/dist/es/packages/collapse/style/style.css +11 -11
  295. package/dist/es/packages/collapseitem/style/style.css +11 -11
  296. package/dist/es/packages/configprovider/configprovider.js +3 -3
  297. package/dist/es/packages/configprovider/types.d.ts +1 -1
  298. package/dist/es/packages/countdown/style/style.css +7 -7
  299. package/dist/es/packages/countup/style/style.css +3 -3
  300. package/dist/es/packages/datepicker/datepicker.js +1 -1
  301. package/dist/es/packages/datepicker/style/style.css +16 -21
  302. package/dist/es/packages/dialog/content.d.ts +3 -13
  303. package/dist/es/packages/dialog/content.js +16 -6
  304. package/dist/es/packages/dialog/dialog.d.ts +3 -5
  305. package/dist/es/packages/dialog/dialog.js +24 -24
  306. package/dist/es/packages/dialog/index.d.ts +1 -1
  307. package/dist/es/packages/dialog/style/dialog.scss +0 -4
  308. package/dist/es/packages/dialog/style/style.css +49 -57
  309. package/dist/es/packages/dialog/types.d.ts +57 -0
  310. package/dist/es/packages/dialog/types.js +1 -0
  311. package/dist/es/packages/dialog/types.taro.d.ts +10 -0
  312. package/dist/es/packages/divider/style/style.css +4 -4
  313. package/dist/es/packages/drag/drag.js +4 -3
  314. package/dist/es/packages/elevator/elevator.js +1 -1
  315. package/dist/es/packages/elevator/style/style.css +8 -8
  316. package/dist/es/packages/empty/empty.js +1 -3
  317. package/dist/es/packages/empty/style/style.css +3 -3
  318. package/dist/es/packages/fixednav/fixednav.d.ts +2 -55
  319. package/dist/es/packages/fixednav/fixednav.js +15 -34
  320. package/dist/es/packages/fixednav/index.d.ts +1 -2
  321. package/dist/es/packages/fixednav/style/style.css +3 -8
  322. package/dist/es/packages/fixednav/types.d.ts +12 -0
  323. package/dist/es/packages/fixednav/types.taro.d.ts +1 -0
  324. package/dist/es/packages/form/form.d.ts +1 -1
  325. package/dist/es/packages/form/style/style.css +15 -15
  326. package/dist/es/packages/formitem/style/style.css +4 -4
  327. package/dist/es/packages/grid/style/style.css +6 -6
  328. package/dist/es/packages/griditem/style/style.css +5 -5
  329. package/dist/es/packages/hoverbutton/hoverbutton.js +1 -3
  330. package/dist/es/packages/hoverbutton/style/hoverbutton.scss +0 -4
  331. package/dist/es/packages/hoverbutton/style/style.css +4 -7
  332. package/dist/es/packages/hoverbutton/style/style.harmony.css +0 -3
  333. package/dist/es/packages/hoverbuttonitem/hoverbuttonitem.js +5 -6
  334. package/dist/es/packages/hoverbuttonitem/style/style.css +4 -4
  335. package/dist/es/packages/image/image.js +1 -1
  336. package/dist/es/packages/image/style/style.css +2 -2
  337. package/dist/es/packages/imagepreview/imagepreview.js +1 -1
  338. package/dist/es/packages/imagepreview/style/style.css +11 -27
  339. package/dist/es/packages/indicator/style/style.css +4 -4
  340. package/dist/es/packages/infiniteloading/style/style.css +4 -4
  341. package/dist/es/packages/input/input.js +1 -1
  342. package/dist/es/packages/input/style/input.scss +0 -6
  343. package/dist/es/packages/input/style/style.css +8 -14
  344. package/dist/es/packages/input/style/style.harmony.css +0 -6
  345. package/dist/es/packages/inputnumber/inputnumber.js +7 -17
  346. package/dist/es/packages/inputnumber/style/style.css +7 -7
  347. package/dist/es/packages/loading/style/style.css +2 -2
  348. package/dist/es/packages/lottie/mp.js +4 -3
  349. package/dist/es/packages/menu/style/style.css +8 -13
  350. package/dist/es/packages/menuitem/menuitem.js +6 -5
  351. package/dist/es/packages/menuitem/style/style.css +4 -9
  352. package/dist/es/packages/navbar/style/navbar.scss +1 -1
  353. package/dist/es/packages/navbar/style/style.css +3 -3
  354. package/dist/es/packages/navbar/style/style.harmony.css +1 -1
  355. package/dist/es/packages/noticebar/noticebar.d.ts +1 -1
  356. package/dist/es/packages/notify/notify.js +3 -10
  357. package/dist/es/packages/notify/style/style.css +4 -4
  358. package/dist/es/packages/numberkeyboard/numberkeyboard.d.ts +1 -1
  359. package/dist/es/packages/numberkeyboard/style/style.css +13 -18
  360. package/dist/es/packages/nutui.react.build.d.ts +3 -1
  361. package/dist/es/packages/nutui.react.build.js +3 -1
  362. package/dist/es/packages/overlay/index.d.ts +1 -1
  363. package/dist/es/packages/overlay/overlay.d.ts +1 -12
  364. package/dist/es/packages/overlay/overlay.js +23 -36
  365. package/dist/es/packages/overlay/style/overlay.scss +0 -5
  366. package/dist/es/packages/overlay/style/style.css +1 -6
  367. package/dist/es/packages/overlay/style/style.harmony.css +0 -5
  368. package/dist/es/packages/overlay/types.d.ts +11 -0
  369. package/dist/es/packages/overlay/types.js +1 -0
  370. package/dist/es/packages/overlay/types.taro.d.ts +5 -0
  371. package/dist/es/packages/pagination/pagination.js +1 -1
  372. package/dist/es/packages/pagination/style/style.css +7 -7
  373. package/dist/es/packages/picker/picker.d.ts +1 -1
  374. package/dist/es/packages/picker/picker.js +3 -3
  375. package/dist/es/packages/picker/pickerpanel.js +1 -1
  376. package/dist/es/packages/picker/style/style.css +16 -21
  377. package/dist/es/packages/picker/style/style.harmony.css +2 -2
  378. package/dist/es/packages/pickerview/index.d.ts +3 -0
  379. package/dist/es/packages/pickerview/index.js +2 -0
  380. package/dist/es/packages/pickerview/pickerroller.d.ts +7 -0
  381. package/dist/es/packages/pickerview/pickerroller.js +175 -0
  382. package/dist/es/packages/pickerview/pickerview.d.ts +4 -0
  383. package/dist/es/packages/pickerview/pickerview.js +189 -0
  384. package/dist/es/packages/pickerview/style/css.js +1 -0
  385. package/dist/es/packages/pickerview/style/index.js +1 -0
  386. package/dist/es/packages/pickerview/style/pickerview.scss +79 -0
  387. package/dist/es/packages/pickerview/style/style.css +73 -0
  388. package/dist/es/packages/pickerview/style/style.harmony.css +83 -0
  389. package/dist/es/packages/pickerview/types.d.ts +32 -0
  390. package/dist/es/packages/pickerview/types.js +1 -0
  391. package/dist/es/packages/pickerview/utils.d.ts +14 -0
  392. package/dist/es/packages/pickerview/utils.js +28 -0
  393. package/dist/es/packages/popover/popover.d.ts +3 -3
  394. package/dist/es/packages/popover/popover.js +2 -2
  395. package/dist/es/packages/popover/style/style.css +12 -17
  396. package/dist/es/packages/popover/types.d.ts +3 -2
  397. package/dist/es/packages/popup/index.d.ts +1 -1
  398. package/dist/es/packages/popup/popup.d.ts +2 -25
  399. package/dist/es/packages/popup/popup.js +24 -40
  400. package/dist/es/packages/popup/style/style.css +5 -10
  401. package/dist/es/packages/popup/types.d.ts +25 -0
  402. package/dist/es/packages/popup/types.js +1 -0
  403. package/dist/es/packages/popup/types.taro.d.ts +8 -0
  404. package/dist/es/packages/price/style/style.css +1 -1
  405. package/dist/es/packages/progress/progress.js +5 -8
  406. package/dist/es/packages/progress/style/style.css +1 -1
  407. package/dist/es/packages/pulltorefresh/pulltorefresh.js +3 -8
  408. package/dist/es/packages/pulltorefresh/style/style.css +4 -4
  409. package/dist/es/packages/radio/radio.js +1 -1
  410. package/dist/es/packages/radio/style/style.css +19 -19
  411. package/dist/es/packages/radiogroup/radiogroup.js +1 -1
  412. package/dist/es/packages/radiogroup/style/style.css +6 -6
  413. package/dist/es/packages/range/range.js +9 -43
  414. package/dist/es/packages/range/style/style.css +9 -9
  415. package/dist/es/packages/rate/rate.js +2 -2
  416. package/dist/es/packages/resultpage/style/style.css +2 -2
  417. package/dist/es/packages/searchbar/style/style.css +5 -5
  418. package/dist/es/packages/segmented/segmented.js +1 -1
  419. package/dist/es/packages/segmented/style/style.css +2 -2
  420. package/dist/es/packages/shortpassword/shortpassword.d.ts +1 -1
  421. package/dist/es/packages/shortpassword/shortpassword.js +1 -1
  422. package/dist/es/packages/shortpassword/style/style.css +15 -20
  423. package/dist/es/packages/sidebar/sidebar.js +3 -3
  424. package/dist/es/packages/sidebar/style/style.css +5 -5
  425. package/dist/es/packages/sidebaritem/style/style.css +1 -1
  426. package/dist/es/packages/sidenavbar/style/style.css +9 -14
  427. package/dist/es/packages/sidenavbaritem/style/style.css +2 -2
  428. package/dist/es/packages/signature/style/style.css +2 -2
  429. package/dist/es/packages/skeleton/style/skeleton.scss +0 -18
  430. package/dist/es/packages/skeleton/style/style.css +5 -11
  431. package/dist/es/packages/skeleton/style/style.harmony.css +0 -6
  432. package/dist/es/packages/step/style/style.css +19 -19
  433. package/dist/es/packages/steps/style/style.css +19 -19
  434. package/dist/es/packages/sticky/sticky.js +4 -3
  435. package/dist/es/packages/subsidenavbar/style/style.css +2 -2
  436. package/dist/es/packages/swipe/swipe.js +4 -4
  437. package/dist/es/packages/swiper/style/style.css +4 -15
  438. package/dist/es/packages/swiper/style/style.harmony.css +0 -11
  439. package/dist/es/packages/swiper/style/swiper.scss +0 -11
  440. package/dist/es/packages/switch/style/style.css +6 -6
  441. package/dist/es/packages/switch/switch.js +1 -1
  442. package/dist/es/packages/tabbar/style/style.css +11 -18
  443. package/dist/es/packages/tabbar/tabbar.js +1 -1
  444. package/dist/es/packages/tabbaritem/style/style.css +10 -17
  445. package/dist/es/packages/tabbaritem/style/style.harmony.css +1 -1
  446. package/dist/es/packages/tabbaritem/style/tabbaritem.scss +2 -10
  447. package/dist/es/packages/tabbaritem/tabbaritem.js +9 -11
  448. package/dist/es/packages/table/style/style.css +11 -11
  449. package/dist/es/packages/table/table.js +1 -1
  450. package/dist/es/packages/tabpane/style/style.css +1 -1
  451. package/dist/es/packages/tabpane/tabpane.js +2 -2
  452. package/dist/es/packages/tabs/style/style.css +25 -32
  453. package/dist/es/packages/tabs/style/style.harmony.css +4 -11
  454. package/dist/es/packages/tabs/style/tabs.scss +4 -9
  455. package/dist/es/packages/tabs/tabs.js +33 -52
  456. package/dist/es/packages/tag/style/style.css +5 -5
  457. package/dist/es/packages/tag/style/tag.scss +0 -2
  458. package/dist/es/packages/textarea/style/style.css +13 -13
  459. package/dist/es/packages/textarea/textarea.d.ts +3 -3
  460. package/dist/es/packages/textarea/textarea.js +20 -23
  461. package/dist/es/packages/timedetail/style/style.css +4 -4
  462. package/dist/es/packages/timeselect/style/style.css +14 -19
  463. package/dist/es/packages/toast/index.d.ts +2 -1
  464. package/dist/es/packages/toast/style/style.css +2 -20
  465. package/dist/es/packages/toast/style/style.harmony.css +0 -11
  466. package/dist/es/packages/toast/style/toast.scss +0 -13
  467. package/dist/es/packages/toast/toast.d.ts +1 -22
  468. package/dist/es/packages/toast/toast.js +28 -27
  469. package/dist/es/packages/toast/types.d.ts +17 -0
  470. package/dist/es/packages/toast/types.js +1 -0
  471. package/dist/es/packages/tour/style/style.css +16 -21
  472. package/dist/es/packages/tour/tour.d.ts +1 -1
  473. package/dist/es/packages/tour/tour.js +1 -1
  474. package/dist/es/packages/trendarrow/style/style.css +1 -1
  475. package/dist/es/packages/uploader/style/style.css +12 -12
  476. package/dist/es/packages/uploader/types.d.ts +2 -1
  477. package/dist/es/packages/uploader/uploader.js +1 -1
  478. package/dist/es/packages/virtuallist/style/style.css +4 -4
  479. package/dist/es/packages/virtuallist/virtuallist.d.ts +1 -1
  480. package/dist/es/packages/virtuallist/virtuallist.js +2 -2
  481. package/dist/es/utils/get-rect-by-taro.js +1 -15
  482. package/dist/es/utils/get-system-info.d.ts +19 -0
  483. package/dist/es/utils/get-system-info.js +19 -0
  484. package/dist/es/utils/platform-taro.d.ts +0 -2
  485. package/dist/es/utils/platform-taro.js +0 -15
  486. package/dist/es/utils/px-transform.js +1 -2
  487. package/dist/nutui.react.umd.js +946 -1287
  488. package/dist/style.css +1 -1
  489. package/dist/style.scss +45 -44
  490. package/dist/styles/variables.scss +71 -33
  491. package/package.json +1 -80
  492. /package/dist/cjs/{utils → hooks}/use-click-away.d.ts +0 -0
  493. /package/dist/cjs/{utils → hooks}/use-client-rect.d.ts +0 -0
  494. /package/dist/cjs/{utils → hooks}/use-client-rect.js +0 -0
  495. /package/dist/cjs/{utils → hooks}/use-custom-event.d.ts +0 -0
  496. /package/dist/cjs/{utils → hooks}/use-force-update.d.ts +0 -0
  497. /package/dist/cjs/{utils → hooks}/use-force-update.js +0 -0
  498. /package/dist/cjs/{utils → hooks}/use-isomprphic-layout-effect.d.ts +0 -0
  499. /package/dist/cjs/{utils → hooks}/use-lock-scoll-taro.d.ts +0 -0
  500. /package/dist/cjs/{utils → hooks}/use-lock-scoll-taro.js +0 -0
  501. /package/dist/cjs/{utils → hooks}/use-lock-scroll.d.ts +0 -0
  502. /package/dist/cjs/{utils → hooks}/use-memo.d.ts +0 -0
  503. /package/dist/cjs/{utils → hooks}/use-memo.js +0 -0
  504. /package/dist/cjs/{utils → hooks}/use-props-value.d.ts +0 -0
  505. /package/dist/cjs/{utils → hooks}/use-props-value.js +0 -0
  506. /package/dist/cjs/{utils → hooks}/use-ref-state.d.ts +0 -0
  507. /package/dist/cjs/{utils → hooks}/use-ref-state.js +0 -0
  508. /package/dist/cjs/{utils → hooks}/use-refs.d.ts +0 -0
  509. /package/dist/cjs/{utils → hooks}/use-refs.js +0 -0
  510. /package/dist/cjs/{utils → hooks}/use-taro-rect.d.ts +0 -0
  511. /package/dist/cjs/{utils → hooks}/use-taro-rect.js +0 -0
  512. /package/dist/cjs/{utils → hooks}/use-touch.d.ts +0 -0
  513. /package/dist/cjs/{utils → hooks}/use-touch.js +0 -0
  514. /package/dist/cjs/{utils → hooks}/use-uuid.d.ts +0 -0
  515. /package/dist/cjs/{utils → hooks}/use-uuid.js +0 -0
  516. /package/dist/cjs/{utils → hooks}/use-watch.d.ts +0 -0
  517. /package/dist/cjs/{utils → hooks}/use-watch.js +0 -0
  518. /package/dist/es/{utils → hooks}/use-click-away.d.ts +0 -0
  519. /package/dist/es/{utils → hooks}/use-client-rect.d.ts +0 -0
  520. /package/dist/es/{utils → hooks}/use-client-rect.js +0 -0
  521. /package/dist/es/{utils → hooks}/use-custom-event.d.ts +0 -0
  522. /package/dist/es/{utils → hooks}/use-force-update.d.ts +0 -0
  523. /package/dist/es/{utils → hooks}/use-force-update.js +0 -0
  524. /package/dist/es/{utils → hooks}/use-isomprphic-layout-effect.d.ts +0 -0
  525. /package/dist/es/{utils → hooks}/use-lock-scoll-taro.d.ts +0 -0
  526. /package/dist/es/{utils → hooks}/use-lock-scoll-taro.js +0 -0
  527. /package/dist/es/{utils → hooks}/use-lock-scroll.d.ts +0 -0
  528. /package/dist/es/{utils → hooks}/use-memo.d.ts +0 -0
  529. /package/dist/es/{utils → hooks}/use-memo.js +0 -0
  530. /package/dist/es/{utils → hooks}/use-props-value.d.ts +0 -0
  531. /package/dist/es/{utils → hooks}/use-props-value.js +0 -0
  532. /package/dist/es/{utils → hooks}/use-ref-state.d.ts +0 -0
  533. /package/dist/es/{utils → hooks}/use-ref-state.js +0 -0
  534. /package/dist/es/{utils → hooks}/use-refs.d.ts +0 -0
  535. /package/dist/es/{utils → hooks}/use-refs.js +0 -0
  536. /package/dist/es/{utils → hooks}/use-taro-rect.d.ts +0 -0
  537. /package/dist/es/{utils → hooks}/use-taro-rect.js +0 -0
  538. /package/dist/es/{utils → hooks}/use-touch.d.ts +0 -0
  539. /package/dist/es/{utils → hooks}/use-touch.js +0 -0
  540. /package/dist/es/{utils → hooks}/use-uuid.d.ts +0 -0
  541. /package/dist/es/{utils → hooks}/use-uuid.js +0 -0
  542. /package/dist/es/{utils → hooks}/use-watch.d.ts +0 -0
  543. /package/dist/es/{utils → hooks}/use-watch.js +0 -0
@@ -65,7 +65,7 @@
65
65
  .nut-picker-list {
66
66
  flex: 1;
67
67
  position: relative;
68
- height: 252px;
68
+ height: calc(36px * 7);
69
69
  overflow: hidden;
70
70
  text-align: center;
71
71
  }
@@ -86,7 +86,7 @@
86
86
  z-index: 3;
87
87
  }
88
88
  .nut-picker-view-panel {
89
- height: 252px;
89
+ height: calc(36px * 7);
90
90
  flex-grow: 1;
91
91
  }
92
92
  .nut-picker-content {
@@ -0,0 +1,3 @@
1
+ import PickerView from "./pickerview";
2
+ export type { PickerViewProps, PickerOptionItem, PickerRollerProps, PickerValue, PickerOptions, PickerOnChangeCallbackParameter, } from './types';
3
+ export default PickerView;
@@ -0,0 +1,2 @@
1
+ import PickerView from "./pickerview";
2
+ export default PickerView;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { PickerRollerProps } from './types';
3
+ declare const PickerRoller: React.ForwardRefExoticComponent<Partial<PickerRollerProps> & React.RefAttributes<{
4
+ stopMomentum: () => void;
5
+ moving: boolean;
6
+ }>>;
7
+ export default PickerRoller;
@@ -0,0 +1,175 @@
1
+ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
2
+ import React, { useState, useEffect, useRef, useImperativeHandle } from "react";
3
+ import { View } from "@tarojs/components";
4
+ import { useTouch } from "../../hooks/use-touch";
5
+ import { passiveSupported } from "../../utils/supports-passive";
6
+ import { web } from "../../utils/platform-taro";
7
+ import { preventDefault } from "../../utils";
8
+ import { momentum, useStyles } from "./utils";
9
+ var InternalPickerRoller = function(props, ref) {
10
+ var _props_keyIndex = props.keyIndex, keyIndex = _props_keyIndex === void 0 ? 0 : _props_keyIndex, _props_options = props.options, options = _props_options === void 0 ? [] : _props_options, _props_threeDimensional = props.threeDimensional, threeDimensional = _props_threeDimensional === void 0 ? true : _props_threeDimensional, _props_duration = props.duration, duration = _props_duration === void 0 ? 1000 : _props_duration, onSelect = props.onSelect, _props_renderLabel = props.renderLabel, renderLabel = _props_renderLabel === void 0 ? function(item) {
11
+ return item.label;
12
+ } : _props_renderLabel;
13
+ var DEFAULT_DURATION = 200;
14
+ var INERTIA_TIME = 300;
15
+ var INERTIA_DISTANCE = 15;
16
+ var ROTATION = 20;
17
+ var touch = useTouch();
18
+ var _useState = _sliced_to_array(useState(1), 2), currentIndex = _useState[0], setCurrentIndex = _useState[1];
19
+ var lineSpacing = useRef(36);
20
+ var _useState1 = _sliced_to_array(useState(0), 2), touchTime = _useState1[0], setTouchTime = _useState1[1];
21
+ var _useState2 = _sliced_to_array(useState('0deg'), 2), touchDeg = _useState2[0], setTouchDeg = _useState2[1];
22
+ var isMoving = useRef(false);
23
+ var rollerRef = useRef(null);
24
+ var pickerRollerRef = useRef(null);
25
+ var _useState3 = _sliced_to_array(useState(0), 2), startTime = _useState3[0], setStartTime = _useState3[1];
26
+ var _useState4 = _sliced_to_array(useState(0), 2), startY = _useState4[0], setStartY = _useState4[1];
27
+ var transformY = useRef(0);
28
+ var _useState5 = _sliced_to_array(useState(0), 2), scrollDistance = _useState5[0], setScrollDistance = _useState5[1];
29
+ var _useStyles = useStyles(touchTime, touchDeg, scrollDistance, lineSpacing, ROTATION), touchRollerStyle = _useStyles.touchRollerStyle, touchTiledStyle = _useStyles.touchTiledStyle, rollerStyle = _useStyles.rollerStyle;
30
+ var isItemHidden = function(index) {
31
+ return index >= currentIndex + 8 || index <= currentIndex - 8;
32
+ };
33
+ var applyTransform = function(type, deg) {
34
+ var time = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : DEFAULT_DURATION, translateY = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
35
+ setTouchTime(type !== 'end' ? 0 : time);
36
+ setTouchDeg(deg);
37
+ setScrollDistance(translateY);
38
+ };
39
+ var handleMove = function(move, type, time) {
40
+ var updatedMove = move + transformY.current;
41
+ if (type === 'end') {
42
+ updatedMove = Math.max(Math.min(updatedMove, 0), -(options.length - 1) * lineSpacing.current);
43
+ // 滚动距离为lineSpacing.current的倍数值
44
+ var endMove = Math.round(updatedMove / lineSpacing.current) * lineSpacing.current;
45
+ var deg = "".concat((Math.abs(Math.round(endMove / lineSpacing.current)) + 1) * ROTATION, "deg");
46
+ applyTransform(type, deg, time, endMove);
47
+ setCurrentIndex(Math.abs(Math.round(endMove / lineSpacing.current)) + 1);
48
+ } else {
49
+ var currentDeg = (-updatedMove / lineSpacing.current + 1) * ROTATION;
50
+ var deg1 = Math.min(Math.max(currentDeg, 0), (options.length + 1) * ROTATION);
51
+ if (deg1 >= 0 && deg1 < (options.length + 1) * ROTATION) {
52
+ applyTransform('', "".concat(deg1, "deg"), undefined, updatedMove);
53
+ setCurrentIndex(Math.abs(Math.round(updatedMove / lineSpacing.current)) + 1);
54
+ }
55
+ }
56
+ };
57
+ var selectValue = function(move) {
58
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(options === null || options === void 0 ? void 0 : options[Math.round(-move / lineSpacing.current)], keyIndex);
59
+ };
60
+ var handleTouchStart = function(event) {
61
+ touch.start(event);
62
+ setStartY(touch.deltaY.current);
63
+ setStartTime(Date.now());
64
+ transformY.current = scrollDistance;
65
+ };
66
+ var handleTouchMove = function(event) {
67
+ touch.move(event);
68
+ if (touch.isVertical) {
69
+ isMoving.current = true;
70
+ preventDefault(event, true);
71
+ }
72
+ var move = touch.deltaY.current - startY;
73
+ handleMove(move);
74
+ };
75
+ var handleTouchEnd = function() {
76
+ if (!isMoving.current) return;
77
+ var move = touch.deltaY.current - startY;
78
+ var moveTime = Date.now() - startTime;
79
+ if (moveTime <= INERTIA_TIME && Math.abs(move) > INERTIA_DISTANCE) {
80
+ var distance = momentum(move, moveTime);
81
+ handleMove(distance, 'end', +duration);
82
+ } else {
83
+ handleMove(move, 'end');
84
+ }
85
+ setTimeout(function() {
86
+ touch.reset();
87
+ }, 0);
88
+ };
89
+ var updateStatus = function(shouldSelect, value) {
90
+ var selectedValue = value || props.value;
91
+ var index = options.findIndex(function(item) {
92
+ return item.value === selectedValue;
93
+ });
94
+ setCurrentIndex(index === -1 ? 1 : index + 1);
95
+ var move = index * lineSpacing.current;
96
+ shouldSelect && selectValue(-move);
97
+ handleMove(-move);
98
+ };
99
+ var stopMomentumScroll = function() {
100
+ isMoving.current = false;
101
+ setTouchTime(0);
102
+ selectValue(scrollDistance);
103
+ };
104
+ // lineSpacing.current CSS variable
105
+ useEffect(function() {
106
+ var element = pickerRollerRef.current;
107
+ if (element && web()) {
108
+ var computedStyle = getComputedStyle(element);
109
+ var currentLineSpacing = computedStyle.getPropertyValue('--nutui-picker-item-height');
110
+ !!currentLineSpacing && (lineSpacing.current = parseFloat(currentLineSpacing));
111
+ }
112
+ }, [
113
+ pickerRollerRef.current
114
+ ]);
115
+ useEffect(function() {
116
+ isMoving.current = false;
117
+ setScrollDistance(0);
118
+ transformY.current = 0;
119
+ updateStatus(false);
120
+ }, [
121
+ options,
122
+ props.value
123
+ ]);
124
+ useImperativeHandle(ref, function() {
125
+ return {
126
+ stopMomentum: stopMomentumScroll,
127
+ moving: isMoving.current
128
+ };
129
+ });
130
+ useEffect(function() {
131
+ var _pickerRollerRef_current, _pickerRollerRef_current1, _pickerRollerRef_current2;
132
+ var eventOptions = passiveSupported ? {
133
+ passive: false,
134
+ once: true
135
+ } : false;
136
+ (_pickerRollerRef_current = pickerRollerRef.current) === null || _pickerRollerRef_current === void 0 ? void 0 : _pickerRollerRef_current.addEventListener('touchstart', handleTouchStart, eventOptions);
137
+ (_pickerRollerRef_current1 = pickerRollerRef.current) === null || _pickerRollerRef_current1 === void 0 ? void 0 : _pickerRollerRef_current1.addEventListener('touchmove', handleTouchMove, eventOptions);
138
+ (_pickerRollerRef_current2 = pickerRollerRef.current) === null || _pickerRollerRef_current2 === void 0 ? void 0 : _pickerRollerRef_current2.addEventListener('touchend', handleTouchEnd, eventOptions);
139
+ return function() {
140
+ var _pickerRollerRef_current, _pickerRollerRef_current1, _pickerRollerRef_current2;
141
+ (_pickerRollerRef_current = pickerRollerRef.current) === null || _pickerRollerRef_current === void 0 ? void 0 : _pickerRollerRef_current.removeEventListener('touchstart', handleTouchStart, eventOptions);
142
+ (_pickerRollerRef_current1 = pickerRollerRef.current) === null || _pickerRollerRef_current1 === void 0 ? void 0 : _pickerRollerRef_current1.removeEventListener('touchmove', handleTouchMove, eventOptions);
143
+ (_pickerRollerRef_current2 = pickerRollerRef.current) === null || _pickerRollerRef_current2 === void 0 ? void 0 : _pickerRollerRef_current2.removeEventListener('touchend', handleTouchEnd, eventOptions);
144
+ };
145
+ }, [
146
+ pickerRollerRef.current,
147
+ handleTouchStart,
148
+ handleTouchMove,
149
+ handleTouchEnd
150
+ ]);
151
+ return /*#__PURE__*/ React.createElement(View, {
152
+ className: "nut-pickerview-list",
153
+ ref: pickerRollerRef
154
+ }, /*#__PURE__*/ React.createElement(View, {
155
+ className: "nut-pickerview-roller",
156
+ ref: rollerRef,
157
+ style: threeDimensional ? touchRollerStyle() : touchTiledStyle(),
158
+ onTransitionEnd: stopMomentumScroll
159
+ }, threeDimensional && options.map(function(item, index) {
160
+ var _item_value;
161
+ return /*#__PURE__*/ React.createElement(View, {
162
+ className: "nut-pickerview-roller-item ".concat(isItemHidden(index + 1) && 'nut-pickerview-roller-item-hidden'),
163
+ style: rollerStyle(index),
164
+ key: (_item_value = item.value) !== null && _item_value !== void 0 ? _item_value : index
165
+ }, renderLabel(item));
166
+ }), !threeDimensional && options.map(function(item, index) {
167
+ var _item_value;
168
+ return /*#__PURE__*/ React.createElement(View, {
169
+ className: "nut-pickerview-roller-item-tiled",
170
+ key: (_item_value = item.value) !== null && _item_value !== void 0 ? _item_value : index
171
+ }, renderLabel(item));
172
+ })));
173
+ };
174
+ var PickerRoller = /*#__PURE__*/ React.forwardRef(InternalPickerRoller);
175
+ export default PickerRoller;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { PickerViewProps } from './types';
3
+ declare const PickerView: React.ForwardRefExoticComponent<Partial<PickerViewProps> & React.RefAttributes<unknown>>;
4
+ export default PickerView;
@@ -0,0 +1,189 @@
1
+ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
+ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
+ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
4
+ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
5
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
6
+ import classNames from "classnames";
7
+ import { View } from "@tarojs/components";
8
+ import isEqual from "react-fast-compare";
9
+ import { ComponentDefaults } from "../../utils/typings";
10
+ import { usePropsValue } from "../../hooks/use-props-value";
11
+ import PickerRoller from "./pickerroller";
12
+ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
13
+ options: [],
14
+ defaultValue: [],
15
+ value: undefined,
16
+ renderLabel: function(item) {
17
+ return item.label;
18
+ }
19
+ });
20
+ var InternalPickerView = function(props, ref) {
21
+ var _$_object_spread = _object_spread({}, defaultProps, props), options = _$_object_spread.options, _object_spread_defaultValue = _$_object_spread.defaultValue, defaultValue = _object_spread_defaultValue === void 0 ? [] : _object_spread_defaultValue, value = _$_object_spread.value, duration = _$_object_spread.duration, threeDimensional = _$_object_spread.threeDimensional, renderLabel = _$_object_spread.renderLabel, className = _$_object_spread.className, style = _$_object_spread.style, onChange = _$_object_spread.onChange;
22
+ var classPrefix = 'nut-pickerview';
23
+ var cls = classNames(classPrefix, className);
24
+ var _usePropsValue = _sliced_to_array(usePropsValue({
25
+ value: value,
26
+ defaultValue: _to_consumable_array(defaultValue),
27
+ finalValue: _to_consumable_array(defaultValue)
28
+ }), 1), selectedValue = _usePropsValue[0];
29
+ var _useState = _sliced_to_array(useState(selectedValue), 2), innerValue = _useState[0], setInnerValue = _useState[1];
30
+ var _useState1 = _sliced_to_array(useState([]), 2), innerOptions = _useState1[0], setInnerOptions = _useState1[1];
31
+ var changeIndex = useRef(0);
32
+ /**
33
+ * 数据类型:级联、多列
34
+ */ var columnsType = useMemo(function() {
35
+ var firstColumn = props.options[0] || [];
36
+ if (Array.isArray(firstColumn) && firstColumn.length > 0 && 'children' in firstColumn[0]) {
37
+ return 'cascade';
38
+ }
39
+ return 'multiple';
40
+ }, [
41
+ props.options
42
+ ]);
43
+ var formatCascadeOptions = function(options, value) {
44
+ var _loop = function() {
45
+ var currentOptions = columnOptions.children;
46
+ formatted.push(currentOptions);
47
+ var currentValue = value === null || value === void 0 ? void 0 : value[columnIndex];
48
+ if (currentValue === 0) {
49
+ // 如果 currentValue 为 0,返回第一个 children
50
+ columnOptions = currentOptions[0];
51
+ } else if (currentValue) {
52
+ // 如果 currentValue 存在,查找匹配的项
53
+ var index = currentOptions.findIndex(function(columnItem) {
54
+ return columnItem.value === currentValue;
55
+ });
56
+ columnOptions = currentOptions[index === -1 ? 0 : index] // 如果未找到,默认取第一个
57
+ ;
58
+ } else {
59
+ return "break" // 如果 currentValue 不存在,终止循环
60
+ ;
61
+ }
62
+ columnIndex++;
63
+ };
64
+ if (!options.length) return [] // 如果 options 为空,直接返回空数组
65
+ ;
66
+ var formatted = [];
67
+ var columnOptions = {
68
+ label: '',
69
+ value: '',
70
+ children: options
71
+ };
72
+ var columnIndex = 0;
73
+ while(columnOptions && columnOptions.children){
74
+ var _ret = _loop();
75
+ if (_ret === "break") break;
76
+ }
77
+ return formatted;
78
+ };
79
+ var formatOptions = useMemo(function() {
80
+ if (columnsType === 'cascade') {
81
+ var _props_options;
82
+ return formatCascadeOptions(props === null || props === void 0 ? void 0 : (_props_options = props.options) === null || _props_options === void 0 ? void 0 : _props_options[0], innerValue);
83
+ }
84
+ return props.options;
85
+ }, [
86
+ innerValue,
87
+ options,
88
+ columnsType
89
+ ]);
90
+ useEffect(function() {
91
+ var options = props.options;
92
+ if (Array.isArray(options) && options.length && options !== innerOptions) {
93
+ setInnerOptions(formatOptions);
94
+ }
95
+ }, [
96
+ props.options,
97
+ innerValue
98
+ ]);
99
+ useEffect(function() {
100
+ if (selectedValue !== innerValue) {
101
+ setInnerValue(selectedValue);
102
+ }
103
+ }, [
104
+ selectedValue
105
+ ]);
106
+ var handleSelect = useCallback(function(option, index) {
107
+ var newValue = option === null || option === void 0 ? void 0 : option.value;
108
+ if (!newValue || innerValue[index] === newValue) return;
109
+ changeIndex.current = index;
110
+ if (columnsType === 'multiple') {
111
+ setInnerValue(function(prev) {
112
+ var next = _to_consumable_array(prev);
113
+ next[index] = newValue;
114
+ return next;
115
+ });
116
+ } else {
117
+ var _option_children, _option_children1, _props_options;
118
+ var startIndex = index;
119
+ var values = [];
120
+ values[index] = option.value;
121
+ while(option === null || option === void 0 ? void 0 : (_option_children = option.children) === null || _option_children === void 0 ? void 0 : _option_children[0]){
122
+ values[index + 1] = option.children[0].value;
123
+ index++;
124
+ option = option.children[0];
125
+ }
126
+ // 当前改变列的下一列 children 值为空
127
+ if (option === null || option === void 0 ? void 0 : (_option_children1 = option.children) === null || _option_children1 === void 0 ? void 0 : _option_children1.length) {
128
+ values[index + 1] = '';
129
+ }
130
+ var combineResult = _to_consumable_array(innerValue.slice(0, startIndex)).concat(_to_consumable_array(values.splice(startIndex)));
131
+ setInnerValue(_to_consumable_array(combineResult));
132
+ var optionFirst = props === null || props === void 0 ? void 0 : (_props_options = props.options) === null || _props_options === void 0 ? void 0 : _props_options[0];
133
+ if (!isEqual(formatCascadeOptions(optionFirst, combineResult), innerOptions)) {
134
+ setInnerOptions(formatCascadeOptions(optionFirst, combineResult));
135
+ }
136
+ }
137
+ }, [
138
+ innerValue,
139
+ props.options,
140
+ columnsType,
141
+ innerOptions
142
+ ]);
143
+ var selectedOptions = useMemo(function() {
144
+ return innerOptions.map(function(columnOptions, index) {
145
+ var selectedOption = columnOptions.find(function(item) {
146
+ return item.value === innerValue[index];
147
+ });
148
+ return selectedOption;
149
+ // return selectedOption || columnOptions[0]
150
+ }).filter(Boolean);
151
+ }, [
152
+ innerOptions,
153
+ innerValue
154
+ ]);
155
+ useEffect(function() {
156
+ onChange === null || onChange === void 0 ? void 0 : onChange({
157
+ value: innerValue,
158
+ index: changeIndex.current,
159
+ selectedOptions: selectedOptions
160
+ });
161
+ }, [
162
+ innerValue,
163
+ selectedOptions,
164
+ onChange
165
+ ]);
166
+ return /*#__PURE__*/ React.createElement(View, {
167
+ className: cls,
168
+ style: style
169
+ }, innerOptions.map(function(item, index) {
170
+ var _props_setRefs;
171
+ return /*#__PURE__*/ React.createElement(PickerRoller, {
172
+ ref: props === null || props === void 0 ? void 0 : (_props_setRefs = props.setRefs) === null || _props_setRefs === void 0 ? void 0 : _props_setRefs.call(props, index),
173
+ key: index,
174
+ keyIndex: index,
175
+ value: innerValue[index],
176
+ options: item,
177
+ renderLabel: renderLabel,
178
+ onSelect: handleSelect,
179
+ duration: duration,
180
+ threeDimensional: threeDimensional
181
+ });
182
+ }), (innerOptions === null || innerOptions === void 0 ? void 0 : innerOptions.length) ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(View, {
183
+ className: "nut-pickerview-mask"
184
+ }), /*#__PURE__*/ React.createElement(View, {
185
+ className: "nut-pickerview-indicator"
186
+ })) : null);
187
+ };
188
+ var PickerView = /*#__PURE__*/ React.forwardRef(InternalPickerView);
189
+ export default PickerView;
@@ -0,0 +1 @@
1
+ import './style.css'
@@ -0,0 +1 @@
1
+ import './pickerview.scss';
@@ -0,0 +1,79 @@
1
+ .nut-pickerview {
2
+ --nutui-picker-item-height: 36px;
3
+ position: relative;
4
+ display: flex;
5
+ width: 100%;
6
+ height: $picker-list-height;
7
+ $pickerview-top: calc(($picker-list-height - $picker-item-height) / 2);
8
+ overflow: hidden;
9
+
10
+ &-mask,
11
+ &-indicator {
12
+ position: absolute;
13
+ left: 0;
14
+ right: 0;
15
+ z-index: 3;
16
+ pointer-events: none;
17
+ }
18
+
19
+ &-mask {
20
+ top: 0;
21
+ bottom: 0;
22
+ background-image: $picker-mask-background;
23
+ background-position: top, bottom;
24
+ background-size: 100% $pickerview-top;
25
+ background-repeat: no-repeat;
26
+ transform: translateZ(0);
27
+ }
28
+
29
+ &-indicator {
30
+ top: $pickerview-top;
31
+ height: $picker-item-height;
32
+ border: $picker-item-active-line-border;
33
+ border-left: 0;
34
+ border-right: 0;
35
+ box-sizing: border-box;
36
+ }
37
+
38
+ &-list {
39
+ position: relative;
40
+ flex: 1;
41
+ height: $picker-list-height;
42
+ overflow: hidden;
43
+ touch-action: none;
44
+ }
45
+
46
+ &-roller {
47
+ position: absolute;
48
+ top: $pickerview-top;
49
+ width: 100%;
50
+ height: $picker-item-height;
51
+ z-index: 1;
52
+ transform-style: preserve-3d;
53
+ }
54
+
55
+ &-roller-item {
56
+ position: absolute;
57
+ top: 0;
58
+ backface-visibility: hidden;
59
+ -moz-backface-visibility: hidden;
60
+ -webkit-backface-visibility: hidden;
61
+ &-hidden {
62
+ visibility: hidden;
63
+ opacity: 0;
64
+ }
65
+ }
66
+
67
+ &-roller-item,
68
+ &-roller-item-tiled {
69
+ width: 100%;
70
+ height: $picker-item-height;
71
+ line-height: $picker-item-height;
72
+ color: $picker-item-text-color;
73
+ font-size: $picker-item-text-font-size;
74
+ text-align: center;
75
+ overflow: hidden;
76
+ text-overflow: ellipsis;
77
+ white-space: nowrap;
78
+ }
79
+ }
@@ -0,0 +1,73 @@
1
+ /* #ifdef harmony */
2
+ /* #endif */
3
+ /* #ifndef harmony */
4
+ /* #endif */
5
+ .nut-pickerview {
6
+ --nutui-picker-item-height: 36px;
7
+ position: relative;
8
+ display: flex;
9
+ width: 100%;
10
+ height: calc(var(--nutui-picker-item-height, 36px) * 7);
11
+ overflow: hidden;
12
+ }
13
+ .nut-pickerview-mask, .nut-pickerview-indicator {
14
+ position: absolute;
15
+ left: 0;
16
+ right: 0;
17
+ z-index: 3;
18
+ pointer-events: none;
19
+ }
20
+ .nut-pickerview-mask {
21
+ top: 0;
22
+ bottom: 0;
23
+ background-image: var(--picker-mask-background, linear-gradient(180deg, var(--nutui-white-12), var(--nutui-white-7)), linear-gradient(0deg, var(--nutui-white-12), var(--nutui-white-7)));
24
+ background-position: top, bottom;
25
+ background-size: 100% calc((var(--nutui-picker-item-height, 36px) * 7 - var(--nutui-picker-item-height, 36px)) / 2);
26
+ background-repeat: no-repeat;
27
+ transform: translateZ(0);
28
+ }
29
+ .nut-pickerview-indicator {
30
+ top: calc((var(--nutui-picker-item-height, 36px) * 7 - var(--nutui-picker-item-height, 36px)) / 2);
31
+ height: var(--nutui-picker-item-height, 36px);
32
+ border: var(--nutui-picker-item-active-line-border, 1px solid var(--nutui-color-border, rgba(0, 0, 0, 0.06)));
33
+ border-left: 0;
34
+ border-right: 0;
35
+ box-sizing: border-box;
36
+ }
37
+ .nut-pickerview-list {
38
+ position: relative;
39
+ flex: 1;
40
+ height: calc(var(--nutui-picker-item-height, 36px) * 7);
41
+ overflow: hidden;
42
+ touch-action: none;
43
+ }
44
+ .nut-pickerview-roller {
45
+ position: absolute;
46
+ top: calc((var(--nutui-picker-item-height, 36px) * 7 - var(--nutui-picker-item-height, 36px)) / 2);
47
+ width: 100%;
48
+ height: var(--nutui-picker-item-height, 36px);
49
+ z-index: 1;
50
+ transform-style: preserve-3d;
51
+ }
52
+ .nut-pickerview-roller-item {
53
+ position: absolute;
54
+ top: 0;
55
+ backface-visibility: hidden;
56
+ -moz-backface-visibility: hidden;
57
+ -webkit-backface-visibility: hidden;
58
+ }
59
+ .nut-pickerview-roller-item-hidden {
60
+ visibility: hidden;
61
+ opacity: 0;
62
+ }
63
+ .nut-pickerview-roller-item, .nut-pickerview-roller-item-tiled {
64
+ width: 100%;
65
+ height: var(--nutui-picker-item-height, 36px);
66
+ line-height: var(--nutui-picker-item-height, 36px);
67
+ color: var(--nutui-picker-item-text-color, var(--nutui-color-title, #1a1a1a));
68
+ font-size: var(--nutui-picker-item-text-font-size, var(--nutui-font-size-base, 14px));
69
+ text-align: center;
70
+ overflow: hidden;
71
+ text-overflow: ellipsis;
72
+ white-space: nowrap;
73
+ }
@@ -0,0 +1,83 @@
1
+ /* #ifdef harmony */
2
+ /* #endif */
3
+ /* #ifndef harmony */
4
+ /* #endif */
5
+ .nut-pickerview {
6
+ position: relative;
7
+ display: flex;
8
+ width: 100%;
9
+ height: calc(36px * 7);
10
+ overflow: hidden;
11
+ }
12
+ .nut-pickerview-mask, .nut-pickerview-indicator {
13
+ position: absolute;
14
+ left: 0;
15
+ right: 0;
16
+ z-index: 3;
17
+ pointer-events: none;
18
+ }
19
+ .nut-pickerview-mask {
20
+ top: 0;
21
+ bottom: 0;
22
+ background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.4)), linear-gradient(0deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.4));
23
+ background-position: top, bottom;
24
+ background-size: 100% calc((36px * 7 - 36px) / 2);
25
+ background-repeat: no-repeat;
26
+ transform: translateZ(0);
27
+ }
28
+ .nut-pickerview-indicator {
29
+ top: calc((36px * 7 - 36px) / 2);
30
+ height: 36px;
31
+ border: 1px solid rgba(0, 0, 0, 0.06);
32
+ border-left: 0;
33
+ border-right: 0;
34
+ box-sizing: border-box;
35
+ }
36
+ .nut-pickerview-list {
37
+ position: relative;
38
+ flex: 1;
39
+ height: calc(36px * 7);
40
+ overflow: hidden;
41
+ touch-action: none;
42
+ }
43
+ .nut-pickerview-roller {
44
+ position: absolute;
45
+ top: calc((36px * 7 - 36px) / 2);
46
+ width: 100%;
47
+ height: 36px;
48
+ z-index: 1;
49
+ transform-style: preserve-3d;
50
+ }
51
+ .nut-pickerview-roller-item {
52
+ position: absolute;
53
+ top: 0;
54
+ backface-visibility: hidden;
55
+ -moz-backface-visibility: hidden;
56
+ -webkit-backface-visibility: hidden;
57
+ }
58
+ .nut-pickerview-roller-item-hidden {
59
+ visibility: hidden;
60
+ opacity: 0;
61
+ }
62
+ .nut-pickerview-roller-item {
63
+ width: 100%;
64
+ height: 36px;
65
+ line-height: 36px;
66
+ color: #1a1a1a;
67
+ font-size: 14px;
68
+ text-align: center;
69
+ overflow: hidden;
70
+ text-overflow: ellipsis;
71
+ white-space: nowrap;
72
+ }
73
+ .nut-pickerview-roller-item-tiled {
74
+ width: 100%;
75
+ height: 36px;
76
+ line-height: 36px;
77
+ color: #1a1a1a;
78
+ font-size: 14px;
79
+ text-align: center;
80
+ overflow: hidden;
81
+ text-overflow: ellipsis;
82
+ white-space: nowrap;
83
+ }
@@ -0,0 +1,32 @@
1
+ import { BasicComponent } from "../../utils/typings";
2
+ export type PickerValue = string | number | null;
3
+ export interface PickerOptionItem {
4
+ label: string | number;
5
+ value: string | number;
6
+ children?: PickerOptionItem[];
7
+ }
8
+ export type PickerOptions = PickerOptionItem[];
9
+ export interface PickerRollerProps {
10
+ options: PickerOptionItem[];
11
+ keyIndex: number;
12
+ value: PickerValue;
13
+ threeDimensional?: boolean;
14
+ duration?: number | string;
15
+ onSelect: (option: PickerOptionItem, index: number) => void;
16
+ renderLabel: (item: PickerOptionItem) => React.ReactNode;
17
+ }
18
+ export interface PickerOnChangeCallbackParameter {
19
+ value: PickerValue[];
20
+ index: number;
21
+ selectedOptions: PickerOptionItem[];
22
+ }
23
+ export interface PickerViewProps extends BasicComponent {
24
+ setRefs?: (ref: any) => any;
25
+ options: PickerOptions[];
26
+ value?: PickerValue[];
27
+ defaultValue?: PickerValue[];
28
+ threeDimensional?: boolean;
29
+ duration?: number | string;
30
+ renderLabel: (item: PickerOptionItem) => React.ReactNode;
31
+ onChange?: (arg0: PickerOnChangeCallbackParameter) => void;
32
+ }
@@ -0,0 +1 @@
1
+ export { };