@nutui/nutui-react-taro 3.0.18 → 3.0.19-beta.2

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 (269) hide show
  1. package/CHANGELOG.md +9 -10
  2. package/dist/cjs/hooks/taro/use-custom-event.js +5 -5
  3. package/dist/cjs/hooks/use-ref-state.js +3 -3
  4. package/dist/cjs/hooks/use-touch.js +1 -2
  5. package/dist/cjs/locales/ja-JP.d.ts +3 -0
  6. package/dist/cjs/locales/ja-JP.js +168 -0
  7. package/dist/cjs/packages/actionsheet/style/style.harmony.css +0 -3
  8. package/dist/cjs/packages/address/style/style.harmony.css +0 -3
  9. package/dist/cjs/packages/address/utils.js +3 -3
  10. package/dist/cjs/packages/animatingnumbers/countup.js +2 -0
  11. package/dist/cjs/packages/avatar/avatar.js +3 -1
  12. package/dist/cjs/packages/avatarcropper/avatarcropper.js +22 -30
  13. package/dist/cjs/packages/badge/badge.js +4 -7
  14. package/dist/cjs/packages/badge/style/badge.scss +1 -1
  15. package/dist/cjs/packages/badge/style/style.css +1 -1
  16. package/dist/cjs/packages/badge/style/style.harmony.css +1 -1
  17. package/dist/cjs/packages/badge/style-jmapp/badge.scss +1 -1
  18. package/dist/cjs/packages/badge/style-jmapp/style.css +1 -1
  19. package/dist/cjs/packages/badge/style-jrkf/badge.scss +1 -1
  20. package/dist/cjs/packages/badge/style-jrkf/style.css +1 -1
  21. package/dist/cjs/packages/barrage/barrage.js +14 -24
  22. package/dist/cjs/packages/calendar/style/style.harmony.css +0 -3
  23. package/dist/cjs/packages/calendar/utils.js +8 -8
  24. package/dist/cjs/packages/calendarcard/icon.js +5 -5
  25. package/dist/cjs/packages/calendarcard/utils.js +6 -6
  26. package/dist/cjs/packages/card/style/style.harmony.css +3 -3
  27. package/dist/cjs/packages/cascader/cascader.js +12 -21
  28. package/dist/cjs/packages/cascader/style/style.harmony.css +0 -3
  29. package/dist/cjs/packages/cascader/utils.js +3 -3
  30. package/dist/cjs/packages/col/col.js +16 -11
  31. package/dist/cjs/packages/collapseitem/collapseitem.js +4 -7
  32. package/dist/cjs/packages/configprovider/configprovider.js +7 -7
  33. package/dist/cjs/packages/configprovider/index.js +6 -6
  34. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  35. package/dist/cjs/packages/countdown/countdown.js +1 -2
  36. package/dist/cjs/packages/countdown/style/countdown.scss +1 -1
  37. package/dist/cjs/packages/countdown/style/style.css +1 -1
  38. package/dist/cjs/packages/countdown/style/style.harmony.css +1 -1
  39. package/dist/cjs/packages/countdown/style-jmapp/countdown.scss +1 -1
  40. package/dist/cjs/packages/countdown/style-jmapp/style.css +1 -1
  41. package/dist/cjs/packages/countdown/style-jrkf/countdown.scss +1 -1
  42. package/dist/cjs/packages/countdown/style-jrkf/style.css +1 -1
  43. package/dist/cjs/packages/datepicker/style/style.harmony.css +0 -3
  44. package/dist/cjs/packages/datepicker/utils.js +9 -9
  45. package/dist/cjs/packages/dialog/content.js +3 -3
  46. package/dist/cjs/packages/dialog/dialog.d.ts +2 -37
  47. package/dist/cjs/packages/dialog/dialog.js +8 -11
  48. package/dist/cjs/packages/dialog/style/dialog.scss +9 -1
  49. package/dist/cjs/packages/dialog/style/style.css +8 -1
  50. package/dist/cjs/packages/dialog/style/style.harmony.css +8 -1
  51. package/dist/cjs/packages/dialog/style-jmapp/dialog.scss +9 -1
  52. package/dist/cjs/packages/dialog/style-jmapp/style.css +8 -1
  53. package/dist/cjs/packages/dialog/style-jrkf/dialog.scss +9 -1
  54. package/dist/cjs/packages/dialog/style-jrkf/style.css +8 -1
  55. package/dist/cjs/packages/drag/drag.js +4 -7
  56. package/dist/cjs/packages/elevator/elevator.js +7 -10
  57. package/dist/cjs/packages/ellipsis/ellipsis.js +17 -30
  58. package/dist/cjs/packages/fixednav/style/style.harmony.css +1 -1
  59. package/dist/cjs/packages/form/index.js +0 -2
  60. package/dist/cjs/packages/form/useform.js +50 -57
  61. package/dist/cjs/packages/imagepreview/style/style.harmony.css +0 -3
  62. package/dist/cjs/packages/infiniteloading/infiniteloading.js +8 -14
  63. package/dist/cjs/packages/input/input.js +13 -4
  64. package/dist/cjs/packages/inputnumber/inputnumber.js +16 -28
  65. package/dist/cjs/packages/lottie/lottiemp.js +18 -10
  66. package/dist/cjs/packages/lottie/types.js +0 -2
  67. package/dist/cjs/packages/menuitem/menuitem.js +24 -22
  68. package/dist/cjs/packages/noticebar/noticebar.js +71 -67
  69. package/dist/cjs/packages/notify/notify.js +4 -4
  70. package/dist/cjs/packages/numberkeyboard/style/style.harmony.css +0 -3
  71. package/dist/cjs/packages/nutui.react.build.js +105 -105
  72. package/dist/cjs/packages/nutui.react.js +105 -105
  73. package/dist/cjs/packages/overlay/overlay.js +3 -3
  74. package/dist/cjs/packages/picker/style/style.harmony.css +0 -3
  75. package/dist/cjs/packages/pickerview/pickerroller.js +4 -7
  76. package/dist/cjs/packages/pickerview/pickerview.js +1 -2
  77. package/dist/cjs/packages/pickerview/utils.js +3 -3
  78. package/dist/cjs/packages/popover/popover.js +75 -77
  79. package/dist/cjs/packages/popover/style/style.harmony.css +0 -3
  80. package/dist/cjs/packages/popup/popup.d.ts +1 -1
  81. package/dist/cjs/packages/popup/popup.js +103 -10
  82. package/dist/cjs/packages/popup/style/popup.scss +0 -5
  83. package/dist/cjs/packages/popup/style/style.css +0 -3
  84. package/dist/cjs/packages/popup/style/style.harmony.css +0 -3
  85. package/dist/cjs/packages/popup/style-jmapp/popup.scss +0 -5
  86. package/dist/cjs/packages/popup/style-jmapp/style.css +0 -3
  87. package/dist/cjs/packages/popup/style-jrkf/popup.scss +0 -5
  88. package/dist/cjs/packages/popup/style-jrkf/style.css +0 -3
  89. package/dist/cjs/packages/price/style/price.scss +3 -3
  90. package/dist/cjs/packages/price/style/style.css +3 -3
  91. package/dist/cjs/packages/price/style/style.harmony.css +3 -3
  92. package/dist/cjs/packages/price/style-jmapp/price.scss +3 -3
  93. package/dist/cjs/packages/price/style-jmapp/style.css +3 -3
  94. package/dist/cjs/packages/price/style-jrkf/price.scss +3 -3
  95. package/dist/cjs/packages/price/style-jrkf/style.css +3 -3
  96. package/dist/cjs/packages/pulltorefresh/pulltorefresh.js +52 -56
  97. package/dist/cjs/packages/radio/index.js +0 -2
  98. package/dist/cjs/packages/range/range.js +18 -55
  99. package/dist/cjs/packages/rate/rate.js +8 -5
  100. package/dist/cjs/packages/rate/style/rate.scss +1 -1
  101. package/dist/cjs/packages/rate/style/style.css +1 -1
  102. package/dist/cjs/packages/rate/style/style.harmony.css +1 -1
  103. package/dist/cjs/packages/rate/style-jmapp/rate.scss +1 -1
  104. package/dist/cjs/packages/rate/style-jmapp/style.css +1 -1
  105. package/dist/cjs/packages/rate/style-jrkf/rate.scss +1 -1
  106. package/dist/cjs/packages/rate/style-jrkf/style.css +1 -1
  107. package/dist/cjs/packages/searchbar/searchbar.js +4 -4
  108. package/dist/cjs/packages/shortpassword/shortpassword.js +3 -3
  109. package/dist/cjs/packages/shortpassword/style/style.harmony.css +0 -3
  110. package/dist/cjs/packages/signature/signature.js +10 -2
  111. package/dist/cjs/packages/sticky/sticky.js +4 -7
  112. package/dist/cjs/packages/swipe/swipe.js +44 -46
  113. package/dist/cjs/packages/swiper/index.js +0 -1
  114. package/dist/cjs/packages/swiper/swiper.js +1 -2
  115. package/dist/cjs/packages/switch/switch.js +4 -7
  116. package/dist/cjs/packages/tabbar/style/style.harmony.css +1 -1
  117. package/dist/cjs/packages/tabbaritem/style/style.harmony.css +1 -1
  118. package/dist/cjs/packages/textarea/textarea.js +2 -1
  119. package/dist/cjs/packages/timeselect/style/style.harmony.css +0 -3
  120. package/dist/cjs/packages/toast/toast.js +4 -4
  121. package/dist/cjs/packages/tour/style/style.harmony.css +0 -3
  122. package/dist/cjs/packages/uploader/uploader.js +40 -52
  123. package/dist/cjs/packages/virtuallist/utils.js +6 -6
  124. package/dist/cjs/packages/watermark/watermark.js +4 -8
  125. package/dist/cjs/types/spec/address/base.js +0 -2
  126. package/dist/cjs/types/spec/avatar/taro.d.ts +7 -1
  127. package/dist/cjs/types/spec/popup/base.d.ts +5 -0
  128. package/dist/cjs/types/spec/searchbar/h5.d.ts +2 -1
  129. package/dist/cjs/types/spec/searchbar/taro.d.ts +1 -0
  130. package/dist/cjs/utils/date.js +5 -5
  131. package/dist/cjs/utils/event-mocker.js +10 -18
  132. package/dist/cjs/utils/get-rect.js +4 -4
  133. package/dist/cjs/utils/get-scroll-parent.js +3 -3
  134. package/dist/cjs/utils/merge-props.js +3 -3
  135. package/dist/cjs/utils/merge.js +6 -6
  136. package/dist/cjs/utils/raf.js +3 -3
  137. package/dist/cjs/utils/render.js +5 -9
  138. package/dist/cjs/utils/rubberband.js +3 -3
  139. package/dist/cjs/utils/taro/get-rect.js +14 -24
  140. package/dist/cjs/utils/taro/get-system-info.js +4 -4
  141. package/dist/cjs/utils/taro/platform.js +5 -5
  142. package/dist/es/hooks/use-touch.js +1 -1
  143. package/dist/es/locales/ja-JP.d.ts +3 -0
  144. package/dist/es/locales/ja-JP.js +158 -0
  145. package/dist/es/packages/actionsheet/style/style.harmony.css +0 -3
  146. package/dist/es/packages/address/style/style.harmony.css +0 -3
  147. package/dist/es/packages/animatingnumbers/countup.js +2 -0
  148. package/dist/es/packages/avatar/avatar.js +3 -1
  149. package/dist/es/packages/avatarcropper/avatarcropper.js +24 -32
  150. package/dist/es/packages/badge/badge.js +4 -7
  151. package/dist/es/packages/badge/style/badge.scss +1 -1
  152. package/dist/es/packages/badge/style/style.css +1 -1
  153. package/dist/es/packages/badge/style/style.harmony.css +1 -1
  154. package/dist/es/packages/badge/style-jmapp/badge.scss +1 -1
  155. package/dist/es/packages/badge/style-jmapp/style.css +1 -1
  156. package/dist/es/packages/badge/style-jrkf/badge.scss +1 -1
  157. package/dist/es/packages/badge/style-jrkf/style.css +1 -1
  158. package/dist/es/packages/barrage/barrage.js +14 -24
  159. package/dist/es/packages/calendar/style/style.harmony.css +0 -3
  160. package/dist/es/packages/card/style/style.harmony.css +3 -3
  161. package/dist/es/packages/cascader/cascader.js +12 -21
  162. package/dist/es/packages/cascader/style/style.harmony.css +0 -3
  163. package/dist/es/packages/col/col.js +17 -12
  164. package/dist/es/packages/collapseitem/collapseitem.js +4 -7
  165. package/dist/es/packages/configprovider/types.d.ts +1 -1
  166. package/dist/es/packages/countdown/countdown.js +1 -2
  167. package/dist/es/packages/countdown/style/countdown.scss +1 -1
  168. package/dist/es/packages/countdown/style/style.css +1 -1
  169. package/dist/es/packages/countdown/style/style.harmony.css +1 -1
  170. package/dist/es/packages/countdown/style-jmapp/countdown.scss +1 -1
  171. package/dist/es/packages/countdown/style-jmapp/style.css +1 -1
  172. package/dist/es/packages/countdown/style-jrkf/countdown.scss +1 -1
  173. package/dist/es/packages/countdown/style-jrkf/style.css +1 -1
  174. package/dist/es/packages/datepicker/style/style.harmony.css +0 -3
  175. package/dist/es/packages/dialog/dialog.d.ts +2 -37
  176. package/dist/es/packages/dialog/dialog.js +4 -7
  177. package/dist/es/packages/dialog/style/dialog.scss +9 -1
  178. package/dist/es/packages/dialog/style/style.css +8 -1
  179. package/dist/es/packages/dialog/style/style.harmony.css +8 -1
  180. package/dist/es/packages/dialog/style-jmapp/dialog.scss +9 -1
  181. package/dist/es/packages/dialog/style-jmapp/style.css +8 -1
  182. package/dist/es/packages/dialog/style-jrkf/dialog.scss +9 -1
  183. package/dist/es/packages/dialog/style-jrkf/style.css +8 -1
  184. package/dist/es/packages/drag/drag.js +4 -7
  185. package/dist/es/packages/elevator/elevator.js +4 -7
  186. package/dist/es/packages/ellipsis/ellipsis.js +17 -30
  187. package/dist/es/packages/fixednav/style/style.harmony.css +1 -1
  188. package/dist/es/packages/form/index.js +0 -1
  189. package/dist/es/packages/form/useform.js +46 -53
  190. package/dist/es/packages/imagepreview/style/style.harmony.css +0 -3
  191. package/dist/es/packages/infiniteloading/infiniteloading.js +8 -14
  192. package/dist/es/packages/input/input.js +13 -4
  193. package/dist/es/packages/inputnumber/inputnumber.js +16 -28
  194. package/dist/es/packages/lottie/lottiemp.js +20 -12
  195. package/dist/es/packages/lottie/types.js +1 -1
  196. package/dist/es/packages/menuitem/menuitem.js +24 -22
  197. package/dist/es/packages/noticebar/noticebar.js +71 -67
  198. package/dist/es/packages/numberkeyboard/style/style.harmony.css +0 -3
  199. package/dist/es/packages/picker/style/style.harmony.css +0 -3
  200. package/dist/es/packages/pickerview/pickerroller.js +4 -7
  201. package/dist/es/packages/pickerview/pickerview.js +1 -2
  202. package/dist/es/packages/popover/popover.js +75 -77
  203. package/dist/es/packages/popover/style/style.harmony.css +0 -3
  204. package/dist/es/packages/popup/popup.d.ts +1 -1
  205. package/dist/es/packages/popup/popup.js +104 -11
  206. package/dist/es/packages/popup/style/popup.scss +0 -5
  207. package/dist/es/packages/popup/style/style.css +0 -3
  208. package/dist/es/packages/popup/style/style.harmony.css +0 -3
  209. package/dist/es/packages/popup/style-jmapp/popup.scss +0 -5
  210. package/dist/es/packages/popup/style-jmapp/style.css +0 -3
  211. package/dist/es/packages/popup/style-jrkf/popup.scss +0 -5
  212. package/dist/es/packages/popup/style-jrkf/style.css +0 -3
  213. package/dist/es/packages/price/style/price.scss +3 -3
  214. package/dist/es/packages/price/style/style.css +3 -3
  215. package/dist/es/packages/price/style/style.harmony.css +3 -3
  216. package/dist/es/packages/price/style-jmapp/price.scss +3 -3
  217. package/dist/es/packages/price/style-jmapp/style.css +3 -3
  218. package/dist/es/packages/price/style-jrkf/price.scss +3 -3
  219. package/dist/es/packages/price/style-jrkf/style.css +3 -3
  220. package/dist/es/packages/pulltorefresh/pulltorefresh.js +52 -56
  221. package/dist/es/packages/radio/index.js +0 -1
  222. package/dist/es/packages/range/range.js +19 -56
  223. package/dist/es/packages/rate/rate.js +9 -6
  224. package/dist/es/packages/rate/style/rate.scss +1 -1
  225. package/dist/es/packages/rate/style/style.css +1 -1
  226. package/dist/es/packages/rate/style/style.harmony.css +1 -1
  227. package/dist/es/packages/rate/style-jmapp/rate.scss +1 -1
  228. package/dist/es/packages/rate/style-jmapp/style.css +1 -1
  229. package/dist/es/packages/rate/style-jrkf/rate.scss +1 -1
  230. package/dist/es/packages/rate/style-jrkf/style.css +1 -1
  231. package/dist/es/packages/searchbar/searchbar.js +4 -4
  232. package/dist/es/packages/shortpassword/style/style.harmony.css +0 -3
  233. package/dist/es/packages/signature/signature.js +10 -2
  234. package/dist/es/packages/sticky/sticky.js +4 -7
  235. package/dist/es/packages/swipe/swipe.js +45 -47
  236. package/dist/es/packages/swiper/index.js +0 -1
  237. package/dist/es/packages/swiper/swiper.js +1 -2
  238. package/dist/es/packages/switch/switch.js +4 -7
  239. package/dist/es/packages/tabbar/style/style.harmony.css +1 -1
  240. package/dist/es/packages/tabbaritem/style/style.harmony.css +1 -1
  241. package/dist/es/packages/textarea/textarea.js +2 -1
  242. package/dist/es/packages/timeselect/style/style.harmony.css +0 -3
  243. package/dist/es/packages/tour/style/style.harmony.css +0 -3
  244. package/dist/es/packages/uploader/uploader.js +40 -52
  245. package/dist/es/packages/watermark/watermark.js +4 -8
  246. package/dist/es/types/spec/address/base.js +1 -1
  247. package/dist/es/types/spec/avatar/taro.d.ts +7 -1
  248. package/dist/es/types/spec/popup/base.d.ts +20 -0
  249. package/dist/es/types/spec/searchbar/h5.d.ts +2 -1
  250. package/dist/es/types/spec/searchbar/taro.d.ts +1 -0
  251. package/dist/es/utils/event-mocker.js +4 -12
  252. package/dist/es/utils/render.js +2 -6
  253. package/dist/es/utils/taro/get-rect.js +10 -20
  254. package/dist/nutui.react.umd.js +850 -927
  255. package/dist/style-jmapp.css +1 -1
  256. package/dist/style-jmapp.scss +34 -34
  257. package/dist/style-jrkf.css +1 -1
  258. package/dist/style-jrkf.scss +30 -30
  259. package/dist/style.css +1 -1
  260. package/dist/style.scss +44 -44
  261. package/dist/styles/jd-font.scss +4 -4
  262. package/dist/styles/theme-dark.scss +90 -56
  263. package/dist/styles/theme-default.scss +94 -60
  264. package/dist/styles/themes/dark.css +1 -1
  265. package/dist/styles/themes/default.css +1 -1
  266. package/dist/styles/variables-jmapp.scss +4 -0
  267. package/dist/styles/variables-jrkf.scss +4 -0
  268. package/dist/styles/variables.scss +4 -0
  269. package/package.json +1 -1
@@ -86,93 +86,91 @@ var Popover = function Popover(props) {
86
86
  ]);
87
87
  var uid = (0, _useuuid.useUuid)();
88
88
  var popoverId = "popover-".concat(uid);
89
- var getWrapperPosition = /*#__PURE__*/ function() {
90
- var _ref = (0, _async_to_generator._)(function() {
89
+ var getWrapperPosition = function getWrapperPosition() {
90
+ return (0, _async_to_generator._)(function() {
91
91
  return (0, _ts_generator._)(this, function(_state) {
92
- (0, _taro.nextTick)(/*#__PURE__*/ (0, _async_to_generator._)(function() {
93
- var rect, _tmp, width, height, right, left, top;
94
- return (0, _ts_generator._)(this, function(_state) {
95
- switch(_state.label){
96
- case 0:
97
- if (!targetId) return [
98
- 3,
99
- 2
100
- ];
101
- return [
102
- 4,
103
- (0, _getrect.getRectInMultiPlatform)(document.querySelector("#".concat(targetId)), targetId)
104
- ];
105
- case 1:
106
- _tmp = _state.sent();
107
- return [
108
- 3,
109
- 4
110
- ];
111
- case 2:
112
- return [
113
- 4,
114
- (0, _getrect.getRectInMultiPlatform)(popoverRef.current, popoverId)
115
- ];
116
- case 3:
117
- _tmp = _state.sent();
118
- _state.label = 4;
119
- case 4:
120
- rect = _tmp;
121
- width = rect.width, height = rect.height, right = rect.right, left = rect.left, top = rect.top;
122
- setWrapperPosition({
123
- width: width,
124
- height: height,
125
- left: rtl ? right : left,
126
- top: top,
127
- right: rtl ? left : right
128
- });
129
- getPopoverContentW();
130
- return [
131
- 2
132
- ];
133
- }
134
- });
135
- }));
92
+ (0, _taro.nextTick)(function() {
93
+ return (0, _async_to_generator._)(function() {
94
+ var rect, _tmp, width, height, right, left, top;
95
+ return (0, _ts_generator._)(this, function(_state) {
96
+ switch(_state.label){
97
+ case 0:
98
+ if (!targetId) return [
99
+ 3,
100
+ 2
101
+ ];
102
+ return [
103
+ 4,
104
+ (0, _getrect.getRectInMultiPlatform)(document.querySelector("#".concat(targetId)), targetId)
105
+ ];
106
+ case 1:
107
+ _tmp = _state.sent();
108
+ return [
109
+ 3,
110
+ 4
111
+ ];
112
+ case 2:
113
+ return [
114
+ 4,
115
+ (0, _getrect.getRectInMultiPlatform)(popoverRef.current, popoverId)
116
+ ];
117
+ case 3:
118
+ _tmp = _state.sent();
119
+ _state.label = 4;
120
+ case 4:
121
+ rect = _tmp;
122
+ width = rect.width, height = rect.height, right = rect.right, left = rect.left, top = rect.top;
123
+ setWrapperPosition({
124
+ width: width,
125
+ height: height,
126
+ left: rtl ? right : left,
127
+ top: top,
128
+ right: rtl ? left : right
129
+ });
130
+ getPopoverContentW();
131
+ return [
132
+ 2
133
+ ];
134
+ }
135
+ });
136
+ })();
137
+ });
136
138
  return [
137
139
  2
138
140
  ];
139
141
  });
140
- });
141
- return function getWrapperPosition() {
142
- return _ref.apply(this, arguments);
143
- };
144
- }();
145
- var getPopoverContentW = /*#__PURE__*/ function() {
146
- var _ref = (0, _async_to_generator._)(function() {
142
+ })();
143
+ };
144
+ var getPopoverContentW = function getPopoverContentW() {
145
+ return (0, _async_to_generator._)(function() {
147
146
  return (0, _ts_generator._)(this, function(_state) {
148
- (0, _taro.nextTick)(/*#__PURE__*/ (0, _async_to_generator._)(function() {
149
- var rectContent;
150
- return (0, _ts_generator._)(this, function(_state) {
151
- switch(_state.label){
152
- case 0:
153
- return [
154
- 4,
155
- (0, _getrect.getRectInMultiPlatform)(popoverContentRef.current)
156
- ];
157
- case 1:
158
- rectContent = _state.sent();
159
- setPopWidth(rectContent.width);
160
- setPopHeight(rectContent.height);
161
- return [
162
- 2
163
- ];
164
- }
165
- });
166
- }));
147
+ (0, _taro.nextTick)(function() {
148
+ return (0, _async_to_generator._)(function() {
149
+ var rectContent;
150
+ return (0, _ts_generator._)(this, function(_state) {
151
+ switch(_state.label){
152
+ case 0:
153
+ return [
154
+ 4,
155
+ (0, _getrect.getRectInMultiPlatform)(popoverContentRef.current)
156
+ ];
157
+ case 1:
158
+ rectContent = _state.sent();
159
+ setPopWidth(rectContent.width);
160
+ setPopHeight(rectContent.height);
161
+ return [
162
+ 2
163
+ ];
164
+ }
165
+ });
166
+ })();
167
+ });
167
168
  return [
168
169
  2
169
170
  ];
170
171
  });
171
- });
172
- return function getPopoverContentW() {
173
- return _ref.apply(this, arguments);
174
- };
175
- }();
172
+ })();
173
+ };
176
174
  var clickAway = function clickAway() {
177
175
  if (closeOnOutsideClick) {
178
176
  onClick === null || onClick === void 0 ? void 0 : onClick();
@@ -134,9 +134,6 @@
134
134
  .nut-popup-center.nut-popup-round {
135
135
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
136
136
  }
137
- .nut-popup-bottom, .nut-popup-top {
138
- max-height: 87%;
139
- }
140
137
  .nut-popup-bottom {
141
138
  bottom: 0;
142
139
  left: 0;
@@ -1,3 +1,3 @@
1
1
  import React, { FunctionComponent } from 'react';
2
2
  import { TaroPopupProps } from "../../types";
3
- export declare const Popup: FunctionComponent<Partial<TaroPopupProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick' | 'title'>>;
3
+ export declare const Popup: FunctionComponent<Partial<TaroPopupProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick' | 'title' | 'onTouchStart' | 'onTouchMove' | 'onTouchEnd'>>;
@@ -10,20 +10,24 @@ Object.defineProperty(exports, "Popup", {
10
10
  });
11
11
  var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
12
  var _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
13
+ var _async_to_generator = require("@swc/helpers/_/_async_to_generator");
13
14
  var _define_property = require("@swc/helpers/_/_define_property");
14
15
  var _object_spread = require("@swc/helpers/_/_object_spread");
15
16
  var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
16
17
  var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
18
+ var _ts_generator = require("@swc/helpers/_/_ts_generator");
17
19
  var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
18
20
  var _reactdom = require("react-dom");
19
21
  var _reacttransitiongroup = require("react-transition-group");
20
22
  var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
21
23
  var _iconsreacttaro = require("@nutui/icons-react-taro");
22
24
  var _components = require("@tarojs/components");
25
+ var _getrect = require("../../utils/taro/get-rect");
23
26
  var _overlay = require("../overlay/overlay");
24
27
  var _index = /*#__PURE__*/ _interop_require_default._(require("../overlay/index"));
25
28
  var _uselockscoll = require("../../hooks/taro/use-lock-scoll");
26
29
  var _platform = require("../../utils/taro/platform");
30
+ var _pxtransform = require("../../utils/taro/px-transform");
27
31
  var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _overlay.defaultOverlayProps), {
28
32
  position: 'center',
29
33
  transition: '',
@@ -36,6 +40,8 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _overla
36
40
  portal: null,
37
41
  overlay: true,
38
42
  round: false,
43
+ resizable: false,
44
+ minHeight: '',
39
45
  onOpen: function onOpen() {},
40
46
  onClose: function onClose() {},
41
47
  onOverlayClick: function onOverlayClick() {
@@ -43,29 +49,51 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _overla
43
49
  },
44
50
  onCloseIconClick: function onCloseIconClick() {
45
51
  return true;
46
- }
52
+ },
53
+ onTouchStart: function onTouchStart() {},
54
+ onTouchMove: function onTouchMove() {},
55
+ onTouchEnd: function onTouchEnd() {}
47
56
  });
48
57
  // 默认1000,参看variables
49
58
  var _zIndex = 1100;
50
59
  var Popup = function Popup(props) {
51
- var _$_object_spread = (0, _object_spread._)({}, defaultProps, props), children = _$_object_spread.children, visible = _$_object_spread.visible, overlay = _$_object_spread.overlay, closeOnOverlayClick = _$_object_spread.closeOnOverlayClick, overlayStyle = _$_object_spread.overlayStyle, overlayClassName = _$_object_spread.overlayClassName, zIndex = _$_object_spread.zIndex, lockScroll = _$_object_spread.lockScroll, duration = _$_object_spread.duration, closeable = _$_object_spread.closeable, closeIconPosition = _$_object_spread.closeIconPosition, closeIcon = _$_object_spread.closeIcon, left = _$_object_spread.left, title = _$_object_spread.title, description = _$_object_spread.description, style = _$_object_spread.style, transition = _$_object_spread.transition, round = _$_object_spread.round, position = _$_object_spread.position, className = _$_object_spread.className, destroyOnClose = _$_object_spread.destroyOnClose, portal = _$_object_spread.portal, onOpen = _$_object_spread.onOpen, onClose = _$_object_spread.onClose, onOverlayClick = _$_object_spread.onOverlayClick, onCloseIconClick = _$_object_spread.onCloseIconClick, afterShow = _$_object_spread.afterShow, afterClose = _$_object_spread.afterClose, onClick = _$_object_spread.onClick;
60
+ var _$_object_spread = (0, _object_spread._)({}, defaultProps, props), children = _$_object_spread.children, visible = _$_object_spread.visible, overlay = _$_object_spread.overlay, closeOnOverlayClick = _$_object_spread.closeOnOverlayClick, overlayStyle = _$_object_spread.overlayStyle, overlayClassName = _$_object_spread.overlayClassName, zIndex = _$_object_spread.zIndex, lockScroll = _$_object_spread.lockScroll, duration = _$_object_spread.duration, closeable = _$_object_spread.closeable, closeIconPosition = _$_object_spread.closeIconPosition, closeIcon = _$_object_spread.closeIcon, left = _$_object_spread.left, title = _$_object_spread.title, description = _$_object_spread.description, style = _$_object_spread.style, transition = _$_object_spread.transition, round = _$_object_spread.round, position = _$_object_spread.position, className = _$_object_spread.className, destroyOnClose = _$_object_spread.destroyOnClose, portal = _$_object_spread.portal, resizable = _$_object_spread.resizable, minHeight = _$_object_spread.minHeight, onOpen = _$_object_spread.onOpen, onClose = _$_object_spread.onClose, onOverlayClick = _$_object_spread.onOverlayClick, onCloseIconClick = _$_object_spread.onCloseIconClick, afterShow = _$_object_spread.afterShow, afterClose = _$_object_spread.afterClose, onClick = _$_object_spread.onClick, onTouchStart = _$_object_spread.onTouchStart, onTouchMove = _$_object_spread.onTouchMove, onTouchEnd = _$_object_spread.onTouchEnd;
52
61
  var innerIndex = zIndex || _zIndex;
53
62
  var _useState = (0, _sliced_to_array._)((0, _react.useState)(innerIndex), 2), index = _useState[0], setIndex = _useState[1];
54
63
  var _useState1 = (0, _sliced_to_array._)((0, _react.useState)(visible), 2), innerVisible = _useState1[0], setInnerVisible = _useState1[1];
55
64
  var _useState2 = (0, _sliced_to_array._)((0, _react.useState)(true), 2), showChildren = _useState2[0], setShowChildren = _useState2[1];
56
65
  var _useState3 = (0, _sliced_to_array._)((0, _react.useState)(''), 2), transitionName = _useState3[0], setTransitionName = _useState3[1];
57
- var refObject = (0, _uselockscoll.useLockScrollTaro)(innerVisible && lockScroll);
66
+ var nodeRef = (0, _uselockscoll.useLockScrollTaro)(innerVisible && lockScroll);
67
+ var rootRect = (0, _react.useRef)(null);
68
+ var touchStartRef = (0, _react.useRef)(0);
69
+ var touchMoveDistanceRef = (0, _react.useRef)(0);
70
+ var heightRef = (0, _react.useRef)(0);
71
+ var defaultHeightRef = (0, _react.useRef)(0);
72
+ var isTouching = (0, _react.useRef)(false);
58
73
  var classPrefix = 'nut-popup';
59
74
  var overlayStyles = (0, _object_spread._)({}, overlayStyle);
60
75
  var contentZIndex = (0, _platform.harmony)() ? index + 1 : index // 解决harmony层级问题
61
76
  ;
62
77
  var popStyles = (0, _object_spread._)({
63
- zIndex: contentZIndex
78
+ zIndex: contentZIndex,
79
+ minHeight: minHeight
64
80
  }, style);
65
81
  var _obj;
66
82
  var popClassName = (0, _classnames.default)(classPrefix, (_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix, "-round"), round || position === 'bottom'), (0, _define_property._)(_obj, "".concat(classPrefix, "-").concat(position), true), _obj), className);
83
+ var _useState4 = (0, _sliced_to_array._)((0, _react.useState)(''), 2), popupHeight = _useState4[0], setPopupHeight = _useState4[1];
84
+ var resizeStyles = function resizeStyles() {
85
+ if (popupHeight !== '') {
86
+ return {
87
+ height: popupHeight
88
+ };
89
+ }
90
+ };
67
91
  var open = function open() {
68
92
  if (!innerVisible) {
93
+ // 当高度改变后,再次打开时,将高度置为初始高度
94
+ if (position === 'bottom' && resizable && nodeRef.current && heightRef.current) {
95
+ setPopupHeight((0, _pxtransform.pxTransform)(defaultHeightRef.current));
96
+ }
69
97
  setInnerVisible(true);
70
98
  setIndex(++innerIndex);
71
99
  }
@@ -119,18 +147,83 @@ var Popup = function Popup(props) {
119
147
  return renderCloseIcon();
120
148
  }
121
149
  };
150
+ var handleTouchStart = function handleTouchStart(event) {
151
+ return (0, _async_to_generator._)(function() {
152
+ var _nodeRef_current, _rootRect_current, e, rect;
153
+ return (0, _ts_generator._)(this, function(_state) {
154
+ switch(_state.label){
155
+ case 0:
156
+ if (position !== 'bottom' || !resizable || !nodeRef.current) return [
157
+ 2
158
+ ];
159
+ e = event;
160
+ // 开始touch,记录下touch的pageY,用以判断是向上滑动还是向下滑动
161
+ touchStartRef.current = e.touches[0].pageY;
162
+ // 标记开始滑动
163
+ isTouching.current = true;
164
+ return [
165
+ 4,
166
+ (0, _getrect.getRectInMultiPlatformWithoutCache)(nodeRef.current)
167
+ ];
168
+ case 1:
169
+ rect = _state.sent();
170
+ rootRect.current = rect;
171
+ heightRef.current = ((_nodeRef_current = nodeRef.current) === null || _nodeRef_current === void 0 ? void 0 : _nodeRef_current.offsetHeight) || ((_rootRect_current = rootRect.current) === null || _rootRect_current === void 0 ? void 0 : _rootRect_current.height) || 0;
172
+ if (!defaultHeightRef.current) defaultHeightRef.current = heightRef.current;
173
+ onTouchStart === null || onTouchStart === void 0 ? void 0 : onTouchStart(heightRef.current, e);
174
+ return [
175
+ 2
176
+ ];
177
+ }
178
+ });
179
+ })();
180
+ };
181
+ var handleTouchMove = function handleTouchMove(event) {
182
+ if (position !== 'bottom' || !resizable || !nodeRef.current || !rootRect.current) return;
183
+ var e = event;
184
+ e.stopPropagation();
185
+ // 计算位移:move过程中,当前的pageY 与 start值比较
186
+ touchMoveDistanceRef.current = e.touches[0].pageY - touchStartRef.current;
187
+ var handleMove = function handleMove() {
188
+ var min = typeof minHeight === 'number' ? minHeight : parseInt(String(minHeight || 0), 10) || 0;
189
+ var currentHeight = Math.max(min, heightRef.current - touchMoveDistanceRef.current);
190
+ setPopupHeight((0, _pxtransform.pxTransform)(currentHeight));
191
+ if (touchMoveDistanceRef.current > 0 && isTouching.current) {
192
+ // 向下滑动
193
+ onTouchMove === null || onTouchMove === void 0 ? void 0 : onTouchMove(currentHeight, e, 'down');
194
+ } else {
195
+ // 向上滑动
196
+ onTouchMove === null || onTouchMove === void 0 ? void 0 : onTouchMove(currentHeight, e, 'up');
197
+ }
198
+ };
199
+ requestAnimationFrame(handleMove);
200
+ };
201
+ var handleTouchEnd = function handleTouchEnd(event) {
202
+ if (position !== 'bottom' || !resizable || !nodeRef.current || !rootRect.current) return;
203
+ var e = event;
204
+ isTouching.current = false;
205
+ var min = typeof minHeight === 'number' ? minHeight : parseInt(String(minHeight || 0), 10) || 0;
206
+ var currentHeight = Math.max(min, heightRef.current - touchMoveDistanceRef.current);
207
+ onTouchEnd === null || onTouchEnd === void 0 ? void 0 : onTouchEnd(currentHeight, e);
208
+ };
122
209
  var renderContent = function renderContent() {
123
- return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement(_components.View, {
124
- ref: refObject,
125
- style: popStyles,
210
+ return /*#__PURE__*/ _react.default.createElement(_components.View, {
211
+ ref: nodeRef,
212
+ style: (0, _object_spread._)((0, _object_spread_props._)((0, _object_spread._)({}, popStyles), {
213
+ display: innerVisible ? 'block' : 'none'
214
+ }), resizeStyles()),
126
215
  className: popClassName,
127
216
  onClick: onClick,
128
- catchMove: lockScroll
129
- }, renderTitle(), showChildren ? children : null));
217
+ catchMove: lockScroll,
218
+ onTouchStart: handleTouchStart,
219
+ onTouchMove: handleTouchMove,
220
+ onTouchEnd: handleTouchEnd,
221
+ onTouchCancel: handleTouchEnd
222
+ }, renderTitle(), showChildren ? children : null);
130
223
  };
131
224
  var renderPop = function renderPop() {
132
225
  return /*#__PURE__*/ _react.default.createElement(_reacttransitiongroup.CSSTransition, {
133
- nodeRef: refObject,
226
+ nodeRef: nodeRef,
134
227
  classNames: transitionName,
135
228
  mountOnEnter: true,
136
229
  unmountOnExit: destroyOnClose,
@@ -88,11 +88,6 @@
88
88
  }
89
89
  }
90
90
 
91
- &-bottom,
92
- &-top {
93
- max-height: 87%;
94
- }
95
-
96
91
  &-bottom {
97
92
  bottom: 0;
98
93
  left: 0;
@@ -80,9 +80,6 @@
80
80
  .nut-popup-center.nut-popup-round {
81
81
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
82
82
  }
83
- .nut-popup-bottom, .nut-popup-top {
84
- max-height: 87%;
85
- }
86
83
  .nut-popup-bottom {
87
84
  bottom: 0;
88
85
  left: 0;
@@ -134,9 +134,6 @@
134
134
  .nut-popup-center.nut-popup-round {
135
135
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
136
136
  }
137
- .nut-popup-bottom, .nut-popup-top {
138
- max-height: 87%;
139
- }
140
137
  .nut-popup-bottom {
141
138
  bottom: 0;
142
139
  left: 0;
@@ -88,11 +88,6 @@
88
88
  }
89
89
  }
90
90
 
91
- &-bottom,
92
- &-top {
93
- max-height: 87%;
94
- }
95
-
96
91
  &-bottom {
97
92
  bottom: 0;
98
93
  left: 0;
@@ -80,9 +80,6 @@
80
80
  .nut-popup-center.nut-popup-round {
81
81
  border-radius: var(--nutui-popup-border-radius, 12px);
82
82
  }
83
- .nut-popup-bottom, .nut-popup-top {
84
- max-height: 87%;
85
- }
86
83
  .nut-popup-bottom {
87
84
  bottom: 0;
88
85
  left: 0;
@@ -88,11 +88,6 @@
88
88
  }
89
89
  }
90
90
 
91
- &-bottom,
92
- &-top {
93
- max-height: 87%;
94
- }
95
-
96
91
  &-bottom {
97
92
  bottom: 0;
98
93
  left: 0;
@@ -80,9 +80,6 @@
80
80
  .nut-popup-center.nut-popup-round {
81
81
  border-radius: var(--nutui-popup-border-radius, 12px);
82
82
  }
83
- .nut-popup-bottom, .nut-popup-top {
84
- max-height: 87%;
85
- }
86
83
  .nut-popup-bottom {
87
84
  bottom: 0;
88
85
  left: 0;
@@ -9,7 +9,7 @@
9
9
  &-integer,
10
10
  &-decimal {
11
11
  color: $price-color;
12
- font-family: 'JD';
12
+ font-family: 'JDZH-Bold';
13
13
  line-height: 1;
14
14
  }
15
15
 
@@ -18,7 +18,7 @@
18
18
  &-symbol,
19
19
  &-integer,
20
20
  &-decimal {
21
- font-family: 'JD-Bold';
21
+ font-family: 'JDZH-Bold';
22
22
  color: $price-darkgray-color;
23
23
  }
24
24
  }
@@ -29,7 +29,7 @@
29
29
  &-symbol,
30
30
  &-integer,
31
31
  &-decimal {
32
- font-family: 'JD-Bold';
32
+ font-family: 'JDZH-Bold';
33
33
  color: $price-primary-color;
34
34
  }
35
35
  }
@@ -11,15 +11,15 @@
11
11
  }
12
12
  .nut-price-symbol, .nut-price-integer, .nut-price-decimal {
13
13
  color: var(--nutui-price-color, var(--nutui-color-text-help));
14
- font-family: "JD";
14
+ font-family: "JDZH-Bold";
15
15
  line-height: 1;
16
16
  }
17
17
  .nut-price-darkgray .nut-price-symbol, .nut-price-darkgray .nut-price-integer, .nut-price-darkgray .nut-price-decimal {
18
- font-family: "JD-Bold";
18
+ font-family: "JDZH-Bold";
19
19
  color: var(--nutui-price-darkgray-color, var(--nutui-gray-7));
20
20
  }
21
21
  .nut-price-primary .nut-price-symbol, .nut-price-primary .nut-price-integer, .nut-price-primary .nut-price-decimal {
22
- font-family: "JD-Bold";
22
+ font-family: "JDZH-Bold";
23
23
  color: var(--nutui-price-color, var(--nutui-color-primary, #ff0f23));
24
24
  }
25
25
  .nut-price-symbol {
@@ -11,15 +11,15 @@
11
11
  }
12
12
  .nut-price-symbol, .nut-price-integer, .nut-price-decimal {
13
13
  color: var(--nutui-price-color, var(--nutui-color-text-help));
14
- font-family: "JD";
14
+ font-family: "JDZH-Bold";
15
15
  line-height: 1;
16
16
  }
17
17
  .nut-price-darkgray .nut-price-symbol, .nut-price-darkgray .nut-price-integer, .nut-price-darkgray .nut-price-decimal {
18
- font-family: "JD-Bold";
18
+ font-family: "JDZH-Bold";
19
19
  color: var(--nutui-price-darkgray-color, var(--nutui-gray-7));
20
20
  }
21
21
  .nut-price-primary .nut-price-symbol, .nut-price-primary .nut-price-integer, .nut-price-primary .nut-price-decimal {
22
- font-family: "JD-Bold";
22
+ font-family: "JDZH-Bold";
23
23
  color: var(--nutui-price-color, var(--nutui-color-primary, #ff0f23));
24
24
  }
25
25
  .nut-price-symbol {
@@ -9,7 +9,7 @@
9
9
  &-integer,
10
10
  &-decimal {
11
11
  color: $price-color;
12
- font-family: 'JD';
12
+ font-family: 'JDZH-Bold';
13
13
  line-height: 1;
14
14
  }
15
15
 
@@ -18,7 +18,7 @@
18
18
  &-symbol,
19
19
  &-integer,
20
20
  &-decimal {
21
- font-family: 'JD-Bold';
21
+ font-family: 'JDZH-Bold';
22
22
  color: $price-darkgray-color;
23
23
  }
24
24
  }
@@ -29,7 +29,7 @@
29
29
  &-symbol,
30
30
  &-integer,
31
31
  &-decimal {
32
- font-family: 'JD-Bold';
32
+ font-family: 'JDZH-Bold';
33
33
  color: $price-primary-color;
34
34
  }
35
35
  }
@@ -11,15 +11,15 @@
11
11
  }
12
12
  .nut-price-symbol, .nut-price-integer, .nut-price-decimal {
13
13
  color: var(--nutui-price-color, var(--nutui-color-text-help));
14
- font-family: "JD";
14
+ font-family: "JDZH-Bold";
15
15
  line-height: 1;
16
16
  }
17
17
  .nut-price-darkgray .nut-price-symbol, .nut-price-darkgray .nut-price-integer, .nut-price-darkgray .nut-price-decimal {
18
- font-family: "JD-Bold";
18
+ font-family: "JDZH-Bold";
19
19
  color: var(--nutui-price-darkgray-color, var(--nutui-gray-7));
20
20
  }
21
21
  .nut-price-primary .nut-price-symbol, .nut-price-primary .nut-price-integer, .nut-price-primary .nut-price-decimal {
22
- font-family: "JD-Bold";
22
+ font-family: "JDZH-Bold";
23
23
  color: var(--nutui-price-color, var(--nutui-color-primary));
24
24
  }
25
25
  .nut-price-symbol {
@@ -9,7 +9,7 @@
9
9
  &-integer,
10
10
  &-decimal {
11
11
  color: $price-color;
12
- font-family: 'JD';
12
+ font-family: 'JDZH-Bold';
13
13
  line-height: 1;
14
14
  }
15
15
 
@@ -18,7 +18,7 @@
18
18
  &-symbol,
19
19
  &-integer,
20
20
  &-decimal {
21
- font-family: 'JD-Bold';
21
+ font-family: 'JDZH-Bold';
22
22
  color: $price-darkgray-color;
23
23
  }
24
24
  }
@@ -29,7 +29,7 @@
29
29
  &-symbol,
30
30
  &-integer,
31
31
  &-decimal {
32
- font-family: 'JD-Bold';
32
+ font-family: 'JDZH-Bold';
33
33
  color: $price-primary-color;
34
34
  }
35
35
  }
@@ -11,15 +11,15 @@
11
11
  }
12
12
  .nut-price-symbol, .nut-price-integer, .nut-price-decimal {
13
13
  color: var(--nutui-price-color, var(--nutui-color-text-help));
14
- font-family: "JD";
14
+ font-family: "JDZH-Bold";
15
15
  line-height: 1;
16
16
  }
17
17
  .nut-price-darkgray .nut-price-symbol, .nut-price-darkgray .nut-price-integer, .nut-price-darkgray .nut-price-decimal {
18
- font-family: "JD-Bold";
18
+ font-family: "JDZH-Bold";
19
19
  color: var(--nutui-price-darkgray-color, var(--nutui-gray-7));
20
20
  }
21
21
  .nut-price-primary .nut-price-symbol, .nut-price-primary .nut-price-integer, .nut-price-primary .nut-price-decimal {
22
- font-family: "JD-Bold";
22
+ font-family: "JDZH-Bold";
23
23
  color: var(--nutui-price-color, var(--nutui-color-primary, #ff6666));
24
24
  }
25
25
  .nut-price-symbol {