@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
@@ -115,7 +115,11 @@ var InternalSignature = function(props, ref) {
115
115
  var initCanvas = function() {
116
116
  nextTick(function() {
117
117
  setTimeout(function() {
118
- if (getEnv() === 'WEAPP' || getEnv() === 'JD') {
118
+ if ([
119
+ 'WEAPP',
120
+ 'JD',
121
+ 'ASCF'
122
+ ].includes(getEnv())) {
119
123
  createSelectorQuery().select("#".concat(canvasId)).fields({
120
124
  node: true,
121
125
  size: true
@@ -142,7 +146,11 @@ var InternalSignature = function(props, ref) {
142
146
  }, rest), /*#__PURE__*/ React.createElement(View, {
143
147
  className: "".concat(classPrefix, "-inner spcanvas_WEAPP"),
144
148
  ref: wrapRef
145
- }, getEnv() === 'WEAPP' || getEnv() === 'JD' ? /*#__PURE__*/ React.createElement("canvas", {
149
+ }, [
150
+ 'WEAPP',
151
+ 'JD',
152
+ 'ASCF'
153
+ ].includes(getEnv()) ? /*#__PURE__*/ React.createElement("canvas", {
146
154
  id: canvasId,
147
155
  ref: canvasRef,
148
156
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -81,8 +81,8 @@ export var Sticky = function(props) {
81
81
  threshold,
82
82
  zIndex
83
83
  ]);
84
- var handleScroll = /*#__PURE__*/ function() {
85
- var _ref = _async_to_generator(function(scrollTop) {
84
+ var handleScroll = function(scrollTop) {
85
+ return _async_to_generator(function() {
86
86
  var curRootRect, stickyRect, containerRect, difference, curTransform, curFixed, windowHeight;
87
87
  return _ts_generator(this, function(_state) {
88
88
  switch(_state.label){
@@ -150,11 +150,8 @@ export var Sticky = function(props) {
150
150
  ];
151
151
  }
152
152
  });
153
- });
154
- return function handleScroll(scrollTop) {
155
- return _ref.apply(this, arguments);
156
- };
157
- }();
153
+ })();
154
+ };
158
155
  var getElement = useCallback(function() {
159
156
  return getScrollParent(rootRef.current);
160
157
  }, []);
@@ -3,10 +3,9 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
3
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
4
  import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
5
5
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
6
- import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
6
+ import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
7
7
  import classNames from "classnames";
8
8
  import { View } from "@tarojs/components";
9
- import { nextTick, useReady } from "@tarojs/taro";
10
9
  import { useTouch } from "../../hooks/use-touch";
11
10
  import { getRectInMultiPlatform } from "../../utils/taro/get-rect";
12
11
  import { ComponentDefaults } from "../../utils/typings";
@@ -30,10 +29,39 @@ export var Swipe = /*#__PURE__*/ forwardRef(function(props, instanceRef) {
30
29
  var uid = useUuid();
31
30
  var leftId = "swipe-left-".concat(uid);
32
31
  var rightId = "swipe-right-".concat(uid);
32
+ var _$_object_spread = _object_spread({}, defaultProps, props), children = _$_object_spread.children, className = _$_object_spread.className, style = _$_object_spread.style;
33
+ var root = useRef();
34
+ var opened = useRef(false);
35
+ var lockClick = useRef(false);
36
+ var startOffset = useRef(0);
37
+ var _useState = _sliced_to_array(useState({
38
+ offset: 0,
39
+ dragging: false
40
+ }), 2), state = _useState[0], setState = _useState[1];
41
+ var _useRefState = _sliced_to_array(useRefState({
42
+ left: 0,
43
+ right: 0
44
+ }), 2), actionWidth = _useRefState[0], updateState = _useRefState[1];
45
+ var setActionWidth = useCallback(function(fn) {
46
+ var res = fn();
47
+ if (res.left !== undefined) {
48
+ updateState(_object_spread_props(_object_spread({}, actionWidth.current), {
49
+ left: res.left
50
+ }));
51
+ }
52
+ if (res.right !== undefined) {
53
+ updateState(_object_spread_props(_object_spread({}, actionWidth.current), {
54
+ right: res.right
55
+ }));
56
+ }
57
+ }, [
58
+ actionWidth,
59
+ updateState
60
+ ]);
33
61
  // 获取元素的时候要在页面 onReady 后,需要参考小程序的事件周期
34
- useReady(function() {
35
- var getWidth = /*#__PURE__*/ function() {
36
- var _ref = _async_to_generator(function() {
62
+ useLayoutEffect(function() {
63
+ var getWidth = function() {
64
+ return _async_to_generator(function() {
37
65
  var leftRect, rightRect;
38
66
  return _ts_generator(this, function(_state) {
39
67
  switch(_state.label){
@@ -77,47 +105,20 @@ export var Swipe = /*#__PURE__*/ forwardRef(function(props, instanceRef) {
77
105
  ];
78
106
  }
79
107
  });
80
- });
81
- return function getWidth() {
82
- return _ref.apply(this, arguments);
83
- };
84
- }();
85
- nextTick(function() {
86
- return getWidth();
87
- });
88
- });
89
- var _$_object_spread = _object_spread({}, defaultProps, props), children = _$_object_spread.children, className = _$_object_spread.className, style = _$_object_spread.style;
90
- var root = useRef();
91
- var opened = useRef(false);
92
- var lockClick = useRef(false);
93
- var startOffset = useRef(0);
94
- var _useState = _sliced_to_array(useState({
95
- offset: 0,
96
- dragging: false
97
- }), 2), state = _useState[0], setState = _useState[1];
98
- var _useRefState = _sliced_to_array(useRefState({
99
- left: 0,
100
- right: 0
101
- }), 2), actionWidth = _useRefState[0], updateState = _useRefState[1];
102
- var setActionWidth = function(fn) {
103
- var res = fn();
104
- if (res.left !== undefined) {
105
- updateState(_object_spread_props(_object_spread({}, actionWidth.current), {
106
- left: res.left
107
- }));
108
- }
109
- if (res.right !== undefined) {
110
- updateState(_object_spread_props(_object_spread({}, actionWidth.current), {
111
- right: res.right
112
- }));
113
- }
114
- };
108
+ })();
109
+ };
110
+ getWidth();
111
+ }, [
112
+ leftId,
113
+ rightId,
114
+ setActionWidth
115
+ ]);
115
116
  var wrapperStyle = {
116
117
  transform: "translate(".concat(state.offset).concat(!harmony() ? 'px' : '', ", 0)"),
117
118
  transitionDuration: state.dragging ? '0s' : '.6s'
118
119
  };
119
- var onTouchStart = /*#__PURE__*/ function() {
120
- var _ref = _async_to_generator(function(event) {
120
+ var onTouchStart = function(event) {
121
+ return _async_to_generator(function() {
121
122
  var leftRect, rightRect, _props_onTouchStart;
122
123
  return _ts_generator(this, function(_state) {
123
124
  switch(_state.label){
@@ -167,11 +168,8 @@ export var Swipe = /*#__PURE__*/ forwardRef(function(props, instanceRef) {
167
168
  ];
168
169
  }
169
170
  });
170
- });
171
- return function onTouchStart(event) {
172
- return _ref.apply(this, arguments);
173
- };
174
- }();
171
+ })();
172
+ };
175
173
  var onTouchMove = function(event) {
176
174
  var _props_onTouchMove;
177
175
  if (props.disabled) {
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { Swiper } from "./swiper";
3
2
  import SwiperItem from "../swiperitem/index";
4
3
  var InnerSwiper = Swiper;
@@ -19,7 +19,7 @@ var defaultProps = {
19
19
  };
20
20
  var classPrefix = 'nut-swiper';
21
21
  export var Swiper = /*#__PURE__*/ React.forwardRef(function(props, ref) {
22
- var _ref = _object_spread({}, defaultProps, props), width = _ref.width, height = _ref.height, className = _ref.className, children = _ref.children, indicator = _ref.indicator, indicatorDots = _ref.indicatorDots, loop = _ref.loop, circular = _ref.circular, autoPlay = _ref.autoPlay, autoplay = _ref.autoplay, duration = _ref.duration, vertical = _ref.vertical, direction = _ref.direction, defaultValue = _ref.defaultValue, current = _ref.current, onChange = _ref.onChange, style = _ref.style, rest = _object_without_properties(_ref, [
22
+ var _ref = _object_spread({}, defaultProps, props), width = _ref.width, height = _ref.height, className = _ref.className, children = _ref.children, indicator = _ref.indicator, indicatorDots = _ref.indicatorDots, loop = _ref.loop, circular = _ref.circular, autoPlay = _ref.autoPlay, autoplay = _ref.autoplay, vertical = _ref.vertical, direction = _ref.direction, defaultValue = _ref.defaultValue, current = _ref.current, onChange = _ref.onChange, style = _ref.style, rest = _object_without_properties(_ref, [
23
23
  "width",
24
24
  "height",
25
25
  "className",
@@ -30,7 +30,6 @@ export var Swiper = /*#__PURE__*/ React.forwardRef(function(props, ref) {
30
30
  "circular",
31
31
  "autoPlay",
32
32
  "autoplay",
33
- "duration",
34
33
  "vertical",
35
34
  "direction",
36
35
  "defaultValue",
@@ -62,8 +62,8 @@ export var Switch = function(props) {
62
62
  (_obj = {}, _define_property(_obj, "".concat(classPrefix, "-close"), !value), _define_property(_obj, "".concat(classPrefix, "-disabled"), disabled), _define_property(_obj, "".concat(classPrefix, "-disabled-close"), disabled && !value), _obj)
63
63
  ]);
64
64
  };
65
- var onClick = /*#__PURE__*/ function() {
66
- var _ref = _async_to_generator(function() {
65
+ var onClick = function() {
66
+ return _async_to_generator(function() {
67
67
  var e;
68
68
  return _ts_generator(this, function(_state) {
69
69
  switch(_state.label){
@@ -108,11 +108,8 @@ export var Switch = function(props) {
108
108
  ];
109
109
  }
110
110
  });
111
- });
112
- return function onClick() {
113
- return _ref.apply(this, arguments);
114
- };
115
- }();
111
+ })();
112
+ };
116
113
  var _obj, _obj1;
117
114
  return /*#__PURE__*/ React.createElement(View, _object_spread({
118
115
  className: classes(),
@@ -56,7 +56,7 @@
56
56
  background: var(--nutui-badge-background-disabled-color, var(--nutui-color-text-disabled, #c2c4cc));
57
57
  }
58
58
  .nut-badge-number {
59
- font-family: "JD";
59
+ font-family: "JDZH-Regular";
60
60
  }
61
61
  .nut-badge-one {
62
62
  height: var(--nutui-badge-height, 14px);
@@ -56,7 +56,7 @@
56
56
  background: var(--nutui-badge-background-disabled-color, var(--nutui-color-text-disabled, #c2c4cc));
57
57
  }
58
58
  .nut-badge-number {
59
- font-family: "JD";
59
+ font-family: "JDZH-Regular";
60
60
  }
61
61
  .nut-badge-one {
62
62
  height: var(--nutui-badge-height, 14px);
@@ -121,7 +121,8 @@ export var TextArea = /*#__PURE__*/ forwardRef(function(props, ref) {
121
121
  onFocus: handleFocus,
122
122
  autoHeight: autoSize,
123
123
  maxlength: maxLength,
124
- placeholder: placeholder !== undefined ? placeholder : locale.placeholder
124
+ placeholder: placeholder !== undefined ? placeholder : locale.placeholder,
125
+ showCount: showCount
125
126
  })), showCount && /*#__PURE__*/ React.createElement(View, {
126
127
  className: classNames("".concat(classPrefix, "-limit"), _define_property({}, "".concat(classPrefix, "-limit-disabled"), disabled))
127
128
  }, innerValue.length, "/", maxLength < 0 ? 0 : maxLength)));
@@ -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;
@@ -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;
@@ -106,22 +106,24 @@ var InternalUploader = function(props, ref) {
106
106
  var classes = classNames(className, 'nut-uploader');
107
107
  useImperativeHandle(ref, function() {
108
108
  return {
109
- submit: /*#__PURE__*/ _async_to_generator(function() {
110
- return _ts_generator(this, function(_state) {
111
- switch(_state.label){
112
- case 0:
113
- return [
114
- 4,
115
- uploadAction(uploadQueue)
116
- ];
117
- case 1:
118
- _state.sent();
119
- return [
120
- 2
121
- ];
122
- }
123
- });
124
- }),
109
+ submit: function() {
110
+ return _async_to_generator(function() {
111
+ return _ts_generator(this, function(_state) {
112
+ switch(_state.label){
113
+ case 0:
114
+ return [
115
+ 4,
116
+ uploadAction(uploadQueue)
117
+ ];
118
+ case 1:
119
+ _state.sent();
120
+ return [
121
+ 2
122
+ ];
123
+ }
124
+ });
125
+ })();
126
+ },
125
127
  clear: function() {
126
128
  clearUploadQueue();
127
129
  }
@@ -168,7 +170,8 @@ var InternalUploader = function(props, ref) {
168
170
  if ([
169
171
  'WEAPP',
170
172
  'JD',
171
- 'WEB'
173
+ 'WEB',
174
+ 'ASCF'
172
175
  ].includes(env) && chooseMedia) {
173
176
  chooseMedia({
174
177
  count: multiple ? maxCount * 1 - fileList.length : 1,
@@ -189,8 +192,8 @@ var InternalUploader = function(props, ref) {
189
192
  });
190
193
  }
191
194
  };
192
- var uploadAction = /*#__PURE__*/ function() {
193
- var _ref = _async_to_generator(function(tasks) {
195
+ var uploadAction = function(tasks) {
196
+ return _async_to_generator(function() {
194
197
  var taskIds, list;
195
198
  return _ts_generator(this, function(_state) {
196
199
  switch(_state.label){
@@ -210,8 +213,8 @@ var InternalUploader = function(props, ref) {
210
213
  setFileList(list);
211
214
  return [
212
215
  4,
213
- Promise.all(tasks.map(/*#__PURE__*/ function() {
214
- var _ref = _async_to_generator(function(currentTask, index) {
216
+ Promise.all(tasks.map(function(currentTask, index) {
217
+ return _async_to_generator(function() {
215
218
  var result, list, e, list1;
216
219
  return _ts_generator(this, function(_state) {
217
220
  switch(_state.label){
@@ -258,11 +261,8 @@ var InternalUploader = function(props, ref) {
258
261
  ];
259
262
  }
260
263
  });
261
- });
262
- return function(currentTask, index) {
263
- return _ref.apply(this, arguments);
264
- };
265
- }())).catch(function(errs) {
264
+ })();
265
+ })).catch(function(errs) {
266
266
  return console.error(errs);
267
267
  })
268
268
  ];
@@ -273,14 +273,11 @@ var InternalUploader = function(props, ref) {
273
273
  ];
274
274
  }
275
275
  });
276
- });
277
- return function uploadAction(tasks) {
278
- return _ref.apply(this, arguments);
279
- };
280
- }();
276
+ })();
277
+ };
281
278
  var idCountRef = useRef(0);
282
- var readFile = /*#__PURE__*/ function() {
283
- var _ref = _async_to_generator(function(files) {
279
+ var readFile = function(files) {
280
+ return _async_to_generator(function() {
284
281
  var tasks;
285
282
  return _ts_generator(this, function(_state) {
286
283
  switch(_state.label){
@@ -338,11 +335,8 @@ var InternalUploader = function(props, ref) {
338
335
  ];
339
336
  }
340
337
  });
341
- });
342
- return function readFile(files) {
343
- return _ref.apply(this, arguments);
344
- };
345
- }();
338
+ })();
339
+ };
346
340
  var filterFiles = function(files) {
347
341
  var maximum = maxCount * 1;
348
342
  var maximize = maxFileSize * 1;
@@ -381,8 +375,8 @@ var InternalUploader = function(props, ref) {
381
375
  }
382
376
  });
383
377
  };
384
- var onChangeMedia = /*#__PURE__*/ function() {
385
- var _ref = _async_to_generator(function(res) {
378
+ var onChangeMedia = function(res) {
379
+ return _async_to_generator(function() {
386
380
  var tempFiles, _files;
387
381
  return _ts_generator(this, function(_state) {
388
382
  // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
@@ -401,13 +395,10 @@ var InternalUploader = function(props, ref) {
401
395
  2
402
396
  ];
403
397
  });
404
- });
405
- return function onChangeMedia(res) {
406
- return _ref.apply(this, arguments);
407
- };
408
- }();
409
- var onChangeImage = /*#__PURE__*/ function() {
410
- var _ref = _async_to_generator(function(res) {
398
+ })();
399
+ };
400
+ var onChangeImage = function(res) {
401
+ return _async_to_generator(function() {
411
402
  var tempFiles, _files;
412
403
  return _ts_generator(this, function(_state) {
413
404
  tempFiles = res.tempFiles;
@@ -425,11 +416,8 @@ var InternalUploader = function(props, ref) {
425
416
  2
426
417
  ];
427
418
  });
428
- });
429
- return function onChangeImage(res) {
430
- return _ref.apply(this, arguments);
431
- };
432
- }();
419
+ })();
420
+ };
433
421
  var handleItemClick = function(file, index) {
434
422
  onFileItemClick === null || onFileItemClick === void 0 ? void 0 : onFileItemClick(file, index);
435
423
  };
@@ -79,20 +79,16 @@ export var WaterMark = function(props) {
79
79
  setBase64Url(canvas.toDataURL());
80
80
  };
81
81
  } else if (content) {
82
- ctx.textBaseline = 'middle' // 设置或返回在绘制文本时使用的当前文本基线。(正中)
83
- ;
84
- ctx.textAlign = 'center' // 设置或返回文本内容的当前对齐方式。
85
- ;
82
+ ctx.textBaseline = 'middle'; // 设置或返回在绘制文本时使用的当前文本基线。(正中)
83
+ ctx.textAlign = 'center'; // 设置或返回文本内容的当前对齐方式。
86
84
  // 文字绕中间旋转
87
85
  ctx.translate(markWidth / 2, markHeight / 2);
88
86
  ctx.rotate(Math.PI / 180 * Number(rotate));
89
87
  var markSize = Number(fontSize) * ratio;
90
88
  ctx.font = "".concat(fontStyle, " normal ").concat(fontWeight, " ").concat(markSize, "px/").concat(markHeight, "px ").concat(fontFamily);
91
89
  ctx.fillStyle = color;
92
- ctx.fillText(content, startX, startY) // 在画布上绘制"被填充的"文本。
93
- ;
94
- ctx.restore() // 返回之前保存过的路径状态和属性。
95
- ;
90
+ ctx.fillText(content, startX, startY); // 在画布上绘制"被填充的"文本。
91
+ ctx.restore(); // 返回之前保存过的路径状态和属性。
96
92
  setBase64Url(canvas.toDataURL());
97
93
  }
98
94
  } else {
@@ -1 +1 @@
1
- import React from "react";
1
+ export { };
@@ -1,7 +1,13 @@
1
- import { ITouchEvent } from '@tarojs/components';
1
+ import { ITouchEvent, ImageProps } from '@tarojs/components';
2
2
  import { BaseAvatar, BaseAvatarGroup } from './base';
3
3
  export interface TaroAvatarProps extends Omit<BaseAvatar, 'onClick'> {
4
4
  avatarIndex: number;
5
+ /** 图片裁剪、缩放的模式,同 Taro Image 的 mode 属性 */
6
+ mode: keyof ImageProps.Mode;
7
+ /**
8
+ * @deprecated 请使用 mode 属性代替
9
+ */
10
+ fit: BaseAvatar['fit'];
5
11
  onClick: (e: ITouchEvent) => void;
6
12
  }
7
13
  export interface TaroAvatarGroupProps extends BaseAvatarGroup {
@@ -50,6 +50,14 @@ export interface BasePopup extends BaseProps, BaseOverlay {
50
50
  */
51
51
  round: boolean
52
52
  /**
53
+ * 上下滑动调整高度,当前只支持从底部弹出
54
+ */
55
+ resizable: boolean
56
+ /**
57
+ * 设置最小高度
58
+ */
59
+ minHeight: string
60
+ /**
53
61
  * 打开弹框时触发
54
62
  */
55
63
  onOpen: () => void
@@ -65,4 +73,16 @@ export interface BasePopup extends BaseProps, BaseOverlay {
65
73
  * 点击关闭图标时触发
66
74
  */
67
75
  onCloseIconClick: (e: any) => boolean | void
76
+ /**
77
+ * 滑动时触发
78
+ */
79
+ onTouchMove: (height: number, e: any, direction: 'up' | 'down') => void
80
+ /**
81
+ * 开始触碰时触发
82
+ */
83
+ onTouchStart: (height: number, e: any) => void
84
+ /**
85
+ * 结束触碰时触发
86
+ */
87
+ onTouchEnd: (height: number, e: any) => void
68
88
  }
@@ -1,4 +1,4 @@
1
- import type { ChangeEvent, FocusEvent, MouseEvent } from 'react';
1
+ import type { ChangeEvent, FocusEvent, MouseEvent, InputHTMLAttributes } from 'react';
2
2
  import { BaseSearchBar } from './base';
3
3
  export interface WebSearchBarProps extends Omit<BaseSearchBar, 'onChange' | 'onFocus' | 'onBlur' | 'onClear' | 'onInputClick'> {
4
4
  onChange?: (value: string, event?: ChangeEvent<HTMLInputElement>) => void;
@@ -6,4 +6,5 @@ export interface WebSearchBarProps extends Omit<BaseSearchBar, 'onChange' | 'onF
6
6
  onBlur?: (value: string, event: FocusEvent<HTMLInputElement>) => void;
7
7
  onClear?: (event: MouseEvent<HTMLDivElement>) => void;
8
8
  onInputClick?: (event: MouseEvent<HTMLInputElement>) => void;
9
+ inputProps?: Partial<InputHTMLAttributes<HTMLInputElement>>;
9
10
  }
@@ -9,5 +9,6 @@ export interface TaroSearchBarProps extends Omit<BaseSearchBar, 'onChange' | 'on
9
9
  onBlur?: (value: string, event: BaseEventOrig<inputValueEventDetail>) => void;
10
10
  onClear?: (event: ITouchEvent) => void;
11
11
  onInputClick?: (event: ITouchEvent) => void;
12
+ inputProps?: Partial<InputProps>;
12
13
  }
13
14
  export {};
@@ -72,10 +72,7 @@ export function triggerDrag(el) {
72
72
  * @param {number} endY 结束触摸点的 Y 坐标
73
73
  * @param {number} duration 移动持续时间(毫秒)
74
74
  */ export function simulateTouchMove(element, startX, startY, endX, endY, duration) {
75
- return _simulateTouchMove.apply(this, arguments);
76
- }
77
- function _simulateTouchMove() {
78
- _simulateTouchMove = _async_to_generator(function(element, startX, startY, endX, endY, duration) {
75
+ return _async_to_generator(function() {
79
76
  var touch, touchList, distanceX, distanceY, startTime, elapsed, progress, currentX, currentY, currentTouch, currentTouchList;
80
77
  return _ts_generator(this, function(_state) {
81
78
  switch(_state.label){
@@ -128,8 +125,7 @@ function _simulateTouchMove() {
128
125
  ];
129
126
  }
130
127
  });
131
- });
132
- return _simulateTouchMove.apply(this, arguments);
128
+ })();
133
129
  }
134
130
  /**
135
131
  * 模拟触摸缩放方法
@@ -138,10 +134,7 @@ function _simulateTouchMove() {
138
134
  * @param {number} endDistance 结束触摸点的距离
139
135
  * @param {number} duration 缩放持续时间(毫秒)
140
136
  */ export function simulateTouchZoom(element, startDistance, endDistance, duration) {
141
- return _simulateTouchZoom.apply(this, arguments);
142
- }
143
- function _simulateTouchZoom() {
144
- _simulateTouchZoom = _async_to_generator(function(element, startDistance, endDistance, duration) {
137
+ return _async_to_generator(function() {
145
138
  var centerX, centerY, startScale, endScale, startTouches, endTouches, progress, currentScale, currentDistance, currentTouches;
146
139
  return _ts_generator(this, function(_state) {
147
140
  switch(_state.label){
@@ -201,6 +194,5 @@ function _simulateTouchZoom() {
201
194
  ];
202
195
  }
203
196
  });
204
- });
205
- return _simulateTouchZoom.apply(this, arguments);
197
+ })();
206
198
  }
@@ -45,10 +45,7 @@ function legacyUnmount(container) {
45
45
  return unmountComponentAtNode(container);
46
46
  }
47
47
  function concurrentUnmount(container) {
48
- return _concurrentUnmount.apply(this, arguments);
49
- }
50
- function _concurrentUnmount() {
51
- _concurrentUnmount = _async_to_generator(function(container) {
48
+ return _async_to_generator(function() {
52
49
  return _ts_generator(this, function(_state) {
53
50
  // Delay to unmount to avoid React 18 sync warning
54
51
  return [
@@ -60,8 +57,7 @@ function _concurrentUnmount() {
60
57
  })
61
58
  ];
62
59
  });
63
- });
64
- return _concurrentUnmount.apply(this, arguments);
60
+ })();
65
61
  }
66
62
  export function unmount(container) {
67
63
  if (createRoot) {
@@ -15,12 +15,10 @@ export function makeRect(width, height) {
15
15
  height: height
16
16
  };
17
17
  }
18
- export var getRectInMultiPlatform = /*#__PURE__*/ function() {
19
- var _ref = _async_to_generator(function(element) {
20
- var harmonyId;
21
- var _arguments = arguments;
18
+ export var getRectInMultiPlatform = function(element) {
19
+ var harmonyId = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
20
+ return _async_to_generator(function() {
22
21
  return _ts_generator(this, function(_state) {
23
- harmonyId = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : '';
24
22
  if (element) {
25
23
  if (inBrowser) {
26
24
  return [
@@ -51,18 +49,13 @@ export var getRectInMultiPlatform = /*#__PURE__*/ function() {
51
49
  Promise.resolve(makeRect(0, 0))
52
50
  ];
53
51
  });
54
- });
55
- return function getRectInMultiPlatform(element) {
56
- return _ref.apply(this, arguments);
57
- };
58
- }();
52
+ })();
53
+ };
59
54
  // 获取元素位置,不走缓存
60
- export var getRectInMultiPlatformWithoutCache = /*#__PURE__*/ function() {
61
- var _ref = _async_to_generator(function(element) {
62
- var harmonyId;
63
- var _arguments = arguments;
55
+ export var getRectInMultiPlatformWithoutCache = function(element) {
56
+ var harmonyId = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
57
+ return _async_to_generator(function() {
64
58
  return _ts_generator(this, function(_state) {
65
- harmonyId = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : '';
66
59
  if (element) {
67
60
  if (inBrowser) {
68
61
  return [
@@ -85,8 +78,5 @@ export var getRectInMultiPlatformWithoutCache = /*#__PURE__*/ function() {
85
78
  Promise.resolve(makeRect(0, 0))
86
79
  ];
87
80
  });
88
- });
89
- return function getRectInMultiPlatformWithoutCache(element) {
90
- return _ref.apply(this, arguments);
91
- };
92
- }();
81
+ })();
82
+ };