@nutui/nutui-react-taro 1.5.2 → 1.5.3-beta.1

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 (232) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/dist/esm/ActionSheet.js +14 -90
  3. package/dist/esm/Address.js +21 -620
  4. package/dist/esm/Animate.js +7 -53
  5. package/dist/esm/AnimatingNumbers.js +7 -125
  6. package/dist/esm/Audio.js +19 -264
  7. package/dist/esm/Avatar.js +11 -130
  8. package/dist/esm/{AvatarContext-15733596.js → AvatarContext-c96afdcc.js} +3 -1
  9. package/dist/esm/AvatarGroup.js +11 -41
  10. package/dist/esm/BackTop.js +10 -138
  11. package/dist/esm/Badge.js +9 -71
  12. package/dist/esm/Barrage.js +8 -97
  13. package/dist/esm/Button.js +9 -108
  14. package/dist/esm/Calendar.js +20 -128
  15. package/dist/esm/CalendarItem.js +12 -674
  16. package/dist/esm/Card.js +11 -61
  17. package/dist/esm/Cascader.js +16 -671
  18. package/dist/esm/Cell.js +9 -101
  19. package/dist/esm/CellGroup.js +5 -2
  20. package/dist/esm/Checkbox.js +7 -5
  21. package/dist/esm/CheckboxGroup.js +8 -111
  22. package/dist/esm/CircleProgress.js +8 -114
  23. package/dist/esm/Col.js +7 -57
  24. package/dist/esm/Collapse.js +7 -97
  25. package/dist/esm/CollapseItem.js +8 -146
  26. package/dist/esm/ConfigProvider.js +8 -187
  27. package/dist/esm/CountDown.js +9 -247
  28. package/dist/esm/DatePicker.js +25 -309
  29. package/dist/esm/Dialog.js +17 -296
  30. package/dist/esm/Divider.js +7 -34
  31. package/dist/esm/Drag.js +7 -118
  32. package/dist/esm/Elevator.js +8 -234
  33. package/dist/esm/Ellipsis.js +10 -176
  34. package/dist/esm/Empty.js +8 -79
  35. package/dist/esm/FixedNav.js +14 -103
  36. package/dist/esm/Form.js +10 -215
  37. package/dist/esm/FormItem.js +10 -3
  38. package/dist/esm/Grid.js +11 -81
  39. package/dist/esm/GridItem.js +13 -123
  40. package/dist/esm/Icon.js +5 -2
  41. package/dist/esm/Image.js +11 -169
  42. package/dist/esm/ImagePreview.js +19 -225
  43. package/dist/esm/Indicator.js +7 -50
  44. package/dist/esm/Infiniteloading.js +14 -215
  45. package/dist/esm/Input.js +12 -362
  46. package/dist/esm/InputNumber.js +9 -275
  47. package/dist/esm/Layout.js +5 -13
  48. package/dist/esm/Menu.js +10 -153
  49. package/dist/esm/MenuItem.js +15 -175
  50. package/dist/esm/NavBar.js +9 -114
  51. package/dist/esm/NoticeBar.js +10 -568
  52. package/dist/esm/Notify.js +8 -234
  53. package/dist/esm/NumberKeyboard.js +17 -247
  54. package/dist/esm/Overlay.js +6 -2
  55. package/dist/esm/Pagination.js +9 -168
  56. package/dist/esm/Picker.js +22 -494
  57. package/dist/esm/Popover.js +12 -223
  58. package/dist/esm/Popup.js +13 -193
  59. package/dist/esm/Price.js +6 -84
  60. package/dist/esm/Progress.js +9 -122
  61. package/dist/esm/PullToRefresh.js +13 -276
  62. package/dist/esm/Radio.js +8 -4
  63. package/dist/esm/RadioGroup.js +7 -120
  64. package/dist/esm/Range.js +15 -406
  65. package/dist/esm/Rate.js +9 -121
  66. package/dist/esm/Row.js +7 -49
  67. package/dist/esm/SearchBar.js +12 -235
  68. package/dist/esm/ShortPassword.js +17 -191
  69. package/dist/esm/SideNavBar.js +19 -57
  70. package/dist/esm/SideNavBarItem.js +5 -24
  71. package/dist/esm/Signature.js +13 -153
  72. package/dist/esm/Skeleton.js +12 -98
  73. package/dist/esm/Step.js +10 -87
  74. package/dist/esm/Steps.js +8 -38
  75. package/dist/esm/Sticky.js +11 -190
  76. package/dist/esm/SubSideNavBar.js +6 -78
  77. package/dist/esm/Swipe.js +10 -230
  78. package/dist/esm/Swiper.js +9 -490
  79. package/dist/esm/SwiperItem.js +8 -36
  80. package/dist/esm/Switch.js +6 -71
  81. package/dist/esm/TabPane.js +5 -2
  82. package/dist/esm/Tabbar.js +6 -68
  83. package/dist/esm/TabbarItem.js +9 -78
  84. package/dist/esm/Table.js +12 -140
  85. package/dist/esm/Tabs.js +8 -5
  86. package/dist/esm/Tag.js +10 -110
  87. package/dist/esm/TextArea.js +9 -148
  88. package/dist/esm/TimeDetail.js +9 -67
  89. package/dist/esm/TimePannel.js +9 -29
  90. package/dist/esm/TimeSelect.js +19 -171
  91. package/dist/esm/Toast.js +7 -268
  92. package/dist/esm/TrendArrow.js +7 -99
  93. package/dist/esm/Uploader.js +17 -566
  94. package/dist/esm/{UserContext-101ad4a4.js → UserContext-0aac9a82.js} +3 -1
  95. package/dist/esm/{UserContext-2629d479.js → UserContext-e402e1a6.js} +3 -1
  96. package/dist/esm/{UserContext-b33bcf21.js → UserContext-e8176108.js} +3 -1
  97. package/dist/esm/Video.js +7 -90
  98. package/dist/esm/VirtualList.js +9 -313
  99. package/dist/esm/WaterMark.js +11 -111
  100. package/dist/esm/actionsheet.taro-e6a51446.js +53 -0
  101. package/dist/esm/address.taro-3a9b6396.js +461 -0
  102. package/dist/esm/animate.taro-fb7986d6.js +40 -0
  103. package/dist/esm/animatingnumbers.taro-03e5d61d.js +104 -0
  104. package/dist/esm/audio.taro-87ec8bf2.js +161 -0
  105. package/dist/esm/avatar.taro-3676f38f.js +103 -0
  106. package/dist/esm/avatargroup-f3574510.js +34 -0
  107. package/dist/esm/backtop.taro-66394a36.js +48 -0
  108. package/dist/esm/badge.taro-a4e59c11.js +52 -0
  109. package/dist/esm/barrage.taro-0495a1b2.js +94 -0
  110. package/dist/esm/{bem-3b438e61.js → bem-350c1702.js} +3 -6
  111. package/dist/esm/button.taro-9244d065.js +100 -0
  112. package/dist/esm/calendar.taro-670842ea.js +65 -0
  113. package/dist/esm/calendaritem.taro-2a603571.js +787 -0
  114. package/dist/esm/can-use-dom-3eeb5af4.js +6 -0
  115. package/dist/esm/card.taro-e4c76dad.js +33 -0
  116. package/dist/esm/cascader.taro-a5553aa5.js +437 -0
  117. package/dist/esm/cell.taro-a10a74d3.js +64 -0
  118. package/dist/esm/cellgroup.taro-abe501bc.js +25 -0
  119. package/dist/esm/checkbox.taro-6120e3e3.js +171 -0
  120. package/dist/esm/circleprogress.taro-79854448.js +109 -0
  121. package/dist/esm/col.taro-53eed3cc.js +41 -0
  122. package/dist/esm/collapse.taro-1a9e4ba2.js +83 -0
  123. package/dist/esm/collapseitem-4d0bc55d.js +83 -0
  124. package/dist/esm/configprovider-67d19d3a.js +19 -0
  125. package/dist/esm/configprovider.taro-8d71eb49.js +42 -0
  126. package/dist/esm/countdown.taro-5b17c607.js +226 -0
  127. package/dist/esm/datepicker.taro-477ad357.js +275 -0
  128. package/dist/esm/dialog.taro-a3267d29.js +118 -0
  129. package/dist/esm/divider.taro-26d1d8b4.js +35 -0
  130. package/dist/esm/drag.taro-79bb8744.js +110 -0
  131. package/dist/esm/elevator.taro-6019669e.js +178 -0
  132. package/dist/esm/ellipsis.taro-f15f26da.js +241 -0
  133. package/dist/esm/empty.taro-04ae4389.js +62 -0
  134. package/dist/esm/fixednav.taro-1f05acaf.js +53 -0
  135. package/dist/esm/form.taro-0b399b30.js +178 -0
  136. package/dist/esm/formitem.taro-190a3326.js +89 -0
  137. package/dist/esm/get-scroll-parent-b4a07e65.js +25 -0
  138. package/dist/esm/grid.taro-3503b82c.js +61 -0
  139. package/dist/esm/{grid.context-2ee27d95.js → grid.taro.context-c2bbfb4f.js} +4 -2
  140. package/dist/esm/griditem.taro-cdb3f119.js +98 -0
  141. package/dist/esm/icon-296a1bec.js +63 -0
  142. package/dist/esm/icon.taro-296a1bec.js +63 -0
  143. package/dist/esm/image.taro-142cf512.js +64 -0
  144. package/dist/esm/imagepreview.taro-c50bb0a3.js +167 -0
  145. package/dist/esm/index-5bcb0ff8.js +7 -0
  146. package/dist/esm/indicator.taro-cba8b010.js +37 -0
  147. package/dist/esm/infiniteloading.taro-183bccbf.js +144 -0
  148. package/dist/esm/input.taro-97af6c96.js +240 -0
  149. package/dist/esm/inputnumber.taro-91f65d17.js +130 -0
  150. package/dist/esm/layout.taro-9046d093.js +11 -0
  151. package/dist/esm/menu.taro-7e4038a1.js +99 -0
  152. package/dist/esm/menuitem.taro-96cc4f15.js +130 -0
  153. package/dist/esm/navbar.taro-777c4705.js +79 -0
  154. package/dist/esm/noticebar.taro-4a23cdee.js +448 -0
  155. package/dist/esm/notify.taro-e17c6f82.js +75 -0
  156. package/dist/esm/numberkeyboard.taro-1bc24744.js +159 -0
  157. package/dist/esm/nutui-react.es.js +119 -94
  158. package/dist/esm/offsetContext-c2a746fa.js +5 -0
  159. package/dist/esm/overlay.taro-21e87fb1.js +69 -0
  160. package/dist/esm/pagination.taro-715a173b.js +124 -0
  161. package/dist/esm/picker.taro-0073eeaa.js +472 -0
  162. package/dist/esm/popover.taro-ad5e76ea.js +156 -0
  163. package/dist/esm/popup.taro-01676bff.js +137 -0
  164. package/dist/esm/price.taro-776ed16e.js +83 -0
  165. package/dist/esm/progress.taro-f0ce38e9.js +90 -0
  166. package/dist/esm/pulltorefresh.taro-a294f656.js +181 -0
  167. package/dist/esm/radio.taro-a6eff96c.js +168 -0
  168. package/dist/esm/range.taro-d8fc7656.js +332 -0
  169. package/dist/esm/rate.taro-6cdf03bd.js +75 -0
  170. package/dist/esm/row.taro-f64d4a13.js +46 -0
  171. package/dist/esm/searchbar.taro-0c25927b.js +152 -0
  172. package/dist/esm/shortpassword.taro-9ee034f7.js +111 -0
  173. package/dist/esm/sidenavbar.taro-c307b35e.js +35 -0
  174. package/dist/esm/sidenavbaritem.taro-5a7965d0.js +12 -0
  175. package/dist/esm/signature.taro-ec4e713b.js +143 -0
  176. package/dist/esm/skeleton.taro-76faf63f.js +62 -0
  177. package/dist/esm/step.taro-b7903e8c.js +59 -0
  178. package/dist/esm/steps.taro-c82d2252.js +30 -0
  179. package/dist/esm/sticky.taro-218bda37.js +138 -0
  180. package/dist/esm/subsidenavbar.taro-69cb9752.js +63 -0
  181. package/dist/esm/supports-passive-c85ef996.js +18 -0
  182. package/dist/esm/swipe.taro-ea35f07f.js +177 -0
  183. package/dist/esm/swiper.taro-7a94e211.js +451 -0
  184. package/dist/esm/swiperitem-c9e3d0d5.js +29 -0
  185. package/dist/esm/switch.taro-34ca8228.js +50 -0
  186. package/dist/esm/tabbar.taro-9acfc2fa.js +59 -0
  187. package/dist/esm/tabbaritem.taro-bf517487.js +58 -0
  188. package/dist/esm/table.taro-91fc0c01.js +93 -0
  189. package/dist/esm/tabpane.taro-4ca340ef.js +23 -0
  190. package/dist/esm/tabs.taro-6a7524a4.js +140 -0
  191. package/dist/esm/tag.taro-23ba0834.js +92 -0
  192. package/dist/esm/textarea.taro-442e7350.js +94 -0
  193. package/dist/esm/timedetail.taro-5b2f2269.js +44 -0
  194. package/dist/esm/timepannel.taro-d6e40180.js +22 -0
  195. package/dist/esm/timeselect.taro-a07036f4.js +133 -0
  196. package/dist/esm/toast.taro-d6c14811.js +109 -0
  197. package/dist/esm/trendarrow.taro-b8c5ccd9.js +73 -0
  198. package/dist/esm/typings-b9828dba.js +9 -0
  199. package/dist/esm/uploader.taro-587e6bf3.js +492 -0
  200. package/dist/esm/useClientRect-1f8ed1fe.js +18 -0
  201. package/dist/esm/useTouch-db24bb5c.js +69 -0
  202. package/dist/esm/video-f1be8a91.js +67 -0
  203. package/dist/esm/virtuallist.taro-f0b0270d.js +214 -0
  204. package/dist/esm/watermark.taro-9ce2ae37.js +114 -0
  205. package/dist/esm/zh-CN-c779e6c1.js +131 -0
  206. package/dist/locales/base.js +1 -1
  207. package/dist/locales/en-US.js +1 -1
  208. package/dist/locales/id-ID.js +1 -1
  209. package/dist/locales/zh-CN.js +1 -1
  210. package/dist/locales/zh-TW.js +1 -1
  211. package/dist/locales/zh-UG.js +1 -1
  212. package/dist/nutui.react.mjs +13028 -14863
  213. package/dist/nutui.react.umd.js +13027 -14864
  214. package/dist/style.mjs +1 -1
  215. package/dist/types/index.d.ts +176 -183
  216. package/package.json +1 -1
  217. package/dist/esm/cellgroup-fcc72767.js +0 -34
  218. package/dist/esm/checkbox-44e13cd0.js +0 -137
  219. package/dist/esm/date-c7aad4c0.js +0 -97
  220. package/dist/esm/formitem-8a73a5fb.js +0 -157
  221. package/dist/esm/get-scroll-parent-5f85dee8.js +0 -24
  222. package/dist/esm/icon-4ef1581c.js +0 -70
  223. package/dist/esm/index-030b7245.js +0 -11
  224. package/dist/esm/offsetContext-3ab00d40.js +0 -16
  225. package/dist/esm/overlay-de6c79d5.js +0 -83
  226. package/dist/esm/radio-9f141e6b.js +0 -118
  227. package/dist/esm/render-bbebb760.js +0 -79
  228. package/dist/esm/tabpane-01075e6c.js +0 -29
  229. package/dist/esm/tabs-e1b4e4b1.js +0 -181
  230. package/dist/esm/typings-f27b58f4.js +0 -8
  231. package/dist/esm/useClientRect-56bb675b.js +0 -39
  232. package/dist/esm/useTouch-cf73a407.js +0 -99
@@ -1,3 +1,5 @@
1
1
  import { createContext } from 'react';
2
- var DataContext = createContext({});
2
+
3
+ const DataContext = createContext({});
4
+
3
5
  export { DataContext as D };
@@ -1,3 +1,5 @@
1
1
  import { createContext } from 'react';
2
- var DataContext = createContext({});
2
+
3
+ const DataContext = createContext({});
4
+
3
5
  export { DataContext as D };
@@ -1,3 +1,5 @@
1
1
  import { createContext } from 'react';
2
- var DataContext = createContext({});
2
+
3
+ const DataContext = createContext({});
4
+
3
5
  export { DataContext as D };
package/dist/esm/Video.js CHANGED
@@ -1,92 +1,9 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["children", "source", "options", "className", "play", "pause", "playend", "onPlayFuc", "onPauseFuc", "onPlayend"];
4
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
- import React__default, { useRef, useEffect } from 'react';
7
- import classNames from 'classnames';
8
- import { c as cn } from './bem-3b438e61.js';
1
+ import { V as Video } from './video-f1be8a91.js';
2
+ import 'react';
3
+ import 'classnames';
4
+ import './bem-350c1702.js';
9
5
  import '@bem-react/classname';
10
- var defaultProps = {
11
- source: {
12
- type: {},
13
- src: ''
14
- },
15
- options: {
16
- controls: true,
17
- muted: false,
18
- autoplay: false,
19
- poster: '',
20
- playsinline: false,
21
- loop: false
22
- }
23
- };
24
- var Video = function Video(props) {
25
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
26
- children = _defaultProps$props.children,
27
- source = _defaultProps$props.source,
28
- options = _defaultProps$props.options,
29
- className = _defaultProps$props.className,
30
- play = _defaultProps$props.play,
31
- pause = _defaultProps$props.pause,
32
- playend = _defaultProps$props.playend,
33
- onPlayFuc = _defaultProps$props.onPlayFuc,
34
- onPauseFuc = _defaultProps$props.onPauseFuc,
35
- onPlayend = _defaultProps$props.onPlayend,
36
- restProps = _objectWithoutProperties(_defaultProps$props, _excluded);
37
- var rootRef = useRef(null);
38
- var b = cn('video');
39
- var classes = classNames(className, b(''));
40
- useEffect(function () {
41
- init();
42
- }, []);
43
- var init = function init() {
44
- if (rootRef.current) {
45
- var videoRef = rootRef.current;
46
- if (options.autoplay) {
47
- setTimeout(function () {
48
- videoRef.play();
49
- }, 200);
50
- }
51
- if (options.playsinline) {
52
- videoRef.setAttribute('playsinline', String(options.playsinline));
53
- videoRef.setAttribute('webkit-playsinline', String(options.playsinline));
54
- videoRef.setAttribute('x5-video-player-type', 'h5-page');
55
- videoRef.setAttribute('x5-video-player-fullscreen', 'false');
56
- }
57
- videoRef.addEventListener('play', function () {
58
- onPlayFuc && onPlayFuc(videoRef);
59
- play && play(videoRef);
60
- });
61
- videoRef.addEventListener('pause', function () {
62
- onPauseFuc && onPauseFuc(videoRef);
63
- pause && pause(videoRef);
64
- });
65
- videoRef.addEventListener('ended', function () {
66
- videoRef.currentTime = 0;
67
- onPlayend && onPlayend(videoRef);
68
- playend && playend(videoRef);
69
- });
70
- }
71
- };
72
- return React__default.createElement("div", _objectSpread({
73
- className: classes
74
- }, restProps), React__default.createElement("video", {
75
- className: "nut-video-player",
76
- muted: options.muted,
77
- autoPlay: options.autoplay,
78
- loop: options.loop,
79
- poster: options.poster,
80
- controls: options.controls,
81
- ref: rootRef,
82
- src: source.src
83
- }, React__default.createElement("source", {
84
- src: source.src,
85
- type: source.type
86
- }), React__default.createElement("track", {
87
- kind: "captions"
88
- })));
89
- };
90
- Video.defaultProps = defaultProps;
91
- Video.displayName = 'NutVideo';
6
+
7
+
8
+
92
9
  export { Video as default };
@@ -1,315 +1,11 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["sourceData", "ItemRender", "itemEqualSize", "itemSize", "horizontal", "overscan", "key", "handleScroll", "onScroll", "className", "containerSize"];
5
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
- import React__default, { useRef, useState, useEffect, useCallback } from 'react';
8
- import { useConfig } from './ConfigProvider.js';
1
+ import { V as VirtualList } from './virtuallist.taro-f0b0270d.js';
2
+ import 'react';
3
+ import '@tarojs/components';
4
+ import '@tarojs/taro';
5
+ import './configprovider.taro-8d71eb49.js';
6
+ import 'lodash.kebabcase';
7
+ import './zh-CN-c779e6c1.js';
8
+
9
+
9
10
 
10
- // 缓存列表初始化信息
11
- var initPositinoCache = function initPositinoCache(reaItemSize) {
12
- var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
13
- var index = 0;
14
- var positions = Array(length);
15
- while (index < length) {
16
- positions[index] = {
17
- index: index,
18
- height: reaItemSize,
19
- width: reaItemSize,
20
- top: index * reaItemSize,
21
- bottom: (index + 1) * reaItemSize,
22
- left: index * reaItemSize,
23
- right: (index + 1) * reaItemSize
24
- };
25
- index++;
26
- }
27
- return positions;
28
- };
29
- // 获取列表总高度
30
- var getListTotalSize = function getListTotalSize(positions, horizontal) {
31
- var index = positions.length - 1;
32
- var size = 0;
33
- if (index < 0) {
34
- size = 0;
35
- } else {
36
- size = horizontal ? positions[index].right : positions[index].bottom;
37
- }
38
- return size;
39
- };
40
- // 通过二分法找到 scrollOffset 对应的值
41
- var binarySearch = function binarySearch(positionsList) {
42
- var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
43
- var horizontal = arguments.length > 2 ? arguments[2] : undefined;
44
- var start = 0;
45
- var end = positionsList.length - 1;
46
- var tempIndex = null;
47
- var key = horizontal ? 'right' : 'bottom';
48
- while (start <= end) {
49
- var midIndex = Math.floor((start + end) / 2);
50
- var midValue = positionsList[midIndex][key];
51
- // 相等则直接返回(因为是bottom, 因此startIndex应该是下一个节点)
52
- if (midValue === value) {
53
- return midIndex + 1;
54
- }
55
- // 中间值 < 传入值,则说明 value对应的节点 大于 start, start往后移动一位
56
- if (midValue < value) {
57
- start = midIndex + 1;
58
- }
59
- // 中间值 > 传入值,则说明 value 在 中间值之前,end 节点移动到 mid - 1
60
- else if (midValue > value) {
61
- // tempIndex存放最靠近值为value的所有
62
- if (tempIndex === null || tempIndex > midIndex) {
63
- tempIndex = midIndex;
64
- }
65
- end = midIndex - 1;
66
- }
67
- }
68
- tempIndex = tempIndex || 0;
69
- return tempIndex;
70
- };
71
- var getEndIndex = function getEndIndex(_ref) {
72
- var sourceData = _ref.sourceData,
73
- startIndex = _ref.startIndex,
74
- visibleCount = _ref.visibleCount,
75
- _ref$itemEqualSize = _ref.itemEqualSize,
76
- itemEqualSize = _ref$itemEqualSize === void 0 ? true : _ref$itemEqualSize,
77
- positions = _ref.positions,
78
- offSetSize = _ref.offSetSize,
79
- overscan = _ref.overscan,
80
- _ref$sizeKey = _ref.sizeKey,
81
- sizeKey = _ref$sizeKey === void 0 ? 'width' : _ref$sizeKey;
82
- var dataLength = sourceData.length;
83
- var tempIndex = null;
84
- if (itemEqualSize) {
85
- var endIndex = startIndex + visibleCount;
86
- tempIndex = dataLength > 0 ? Math.min(dataLength, endIndex) : endIndex;
87
- } else {
88
- var sizeNum = 0;
89
- for (var i = startIndex; i < dataLength; i++) {
90
- sizeNum += positions[i][sizeKey] || 0;
91
- if (sizeNum > offSetSize) {
92
- var _endIndex = i + overscan;
93
- tempIndex = dataLength > 0 ? Math.min(dataLength, _endIndex) : _endIndex;
94
- break;
95
- }
96
- }
97
- if (sizeNum < offSetSize) {
98
- tempIndex = dataLength;
99
- }
100
- }
101
- tempIndex = tempIndex || 0;
102
- return tempIndex;
103
- };
104
- // 更新Item大小
105
- var updateItemSize = function updateItemSize(positions, items, sizeKey) {
106
- var newPos = positions.concat();
107
- Array.from(items).forEach(function (item) {
108
- var index = Number(item.getAttribute('data-index'));
109
- var styleVal = item.getAttribute('style');
110
- if (styleVal && styleVal.includes('none')) return;
111
- var nowSize = item.getBoundingClientRect()[sizeKey];
112
- var oldSize = positions[index][sizeKey];
113
- // 存在差值, 更新该节点以后所有的节点
114
- var dValue = oldSize - nowSize;
115
- if (dValue) {
116
- if (sizeKey === 'width') {
117
- newPos[index].right -= dValue;
118
- newPos[index][sizeKey] = nowSize;
119
- for (var k = index + 1; k < positions.length; k++) {
120
- newPos[k].left = positions[k - 1].right;
121
- newPos[k].right -= dValue;
122
- }
123
- } else if (sizeKey === 'height') {
124
- newPos[index].bottom -= dValue;
125
- newPos[index][sizeKey] = nowSize;
126
- for (var _k = index + 1; _k < positions.length; _k++) {
127
- newPos[_k].top = positions[_k - 1].bottom;
128
- newPos[_k].bottom -= dValue;
129
- }
130
- }
131
- }
132
- });
133
- };
134
- var defaultProps = {};
135
- var VirtualList = function VirtualList(props) {
136
- var _props$sourceData = props.sourceData,
137
- sourceData = _props$sourceData === void 0 ? [] : _props$sourceData,
138
- ItemRender = props.ItemRender,
139
- _props$itemEqualSize = props.itemEqualSize,
140
- itemEqualSize = _props$itemEqualSize === void 0 ? true : _props$itemEqualSize,
141
- _props$itemSize = props.itemSize,
142
- itemSize = _props$itemSize === void 0 ? 200 : _props$itemSize,
143
- _props$horizontal = props.horizontal,
144
- horizontal = _props$horizontal === void 0 ? false : _props$horizontal,
145
- _props$overscan = props.overscan,
146
- overscan = _props$overscan === void 0 ? 2 : _props$overscan,
147
- key = props.key,
148
- handleScroll = props.handleScroll,
149
- onScroll = props.onScroll,
150
- className = props.className,
151
- containerSize = props.containerSize,
152
- rest = _objectWithoutProperties(props, _excluded);
153
- var sizeKey = horizontal ? 'width' : 'height';
154
- var scrollKey = horizontal ? 'scrollLeft' : 'scrollTop';
155
- var offsetKey = horizontal ? 'left' : 'top';
156
- useConfig();
157
- // 虚拟列表容器ref
158
- var scrollRef = useRef(null);
159
- // 虚拟列表显示区域ref
160
- var itemsRef = useRef(null);
161
- var firstItemRef = useRef(null);
162
- // 列表位置信息
163
- var _useState = useState([{
164
- index: 0,
165
- left: 0,
166
- top: 0,
167
- bottom: 0,
168
- width: 0,
169
- height: 0,
170
- right: 0
171
- }]),
172
- _useState2 = _slicedToArray(_useState, 2),
173
- positions = _useState2[0],
174
- setPositions = _useState2[1];
175
- // 列表总大小
176
- var _useState3 = useState(99999999),
177
- _useState4 = _slicedToArray(_useState3, 2),
178
- listTotalSize = _useState4[0],
179
- setListTotalSize = _useState4[1];
180
- // 可视区域条数
181
- var _useState5 = useState(0),
182
- _useState6 = _slicedToArray(_useState5, 2),
183
- visibleCount = _useState6[0],
184
- setVisibleCount = _useState6[1];
185
- var _useState7 = useState(containerSize || 0),
186
- _useState8 = _slicedToArray(_useState7, 2),
187
- offSetSize = _useState8[0],
188
- setOffSetSize = _useState8[1];
189
- var _useState9 = useState({
190
- startOffset: 0,
191
- startIndex: 0,
192
- overStart: 0,
193
- endIndex: 10 // 可视区域结束索引
194
- }),
195
- _useState10 = _slicedToArray(_useState9, 2),
196
- options = _useState10[0],
197
- setOptions = _useState10[1];
198
- // 列表位置信息
199
- useEffect(function () {
200
- var pos = initPositinoCache(itemSize, sourceData.length);
201
- setPositions(pos);
202
- var totalSize = getListTotalSize(pos, horizontal);
203
- setListTotalSize(totalSize);
204
- }, [sourceData, itemSize, horizontal]);
205
- var getElement = useCallback(function () {
206
- var _scrollRef$current;
207
- return ((_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.parentElement) || document.body;
208
- }, []);
209
- useEffect(function () {
210
- if (containerSize) return;
211
- var size = horizontal ? getElement().offsetWidth : getElement().offsetHeight;
212
- setOffSetSize(size);
213
- }, [getElement, horizontal, containerSize]);
214
- useEffect(function () {
215
- // 初始-计算visibleCount
216
- if (offSetSize === 0) return;
217
- var count = Math.ceil(offSetSize / itemSize) + overscan;
218
- setVisibleCount(count);
219
- setOptions(function (options) {
220
- return _objectSpread(_objectSpread({}, options), {}, {
221
- endIndex: count
222
- });
223
- });
224
- }, [getElement, horizontal, itemSize, overscan, offSetSize]);
225
- var updateTotalSize = useCallback(function () {
226
- if (!itemsRef.current) return;
227
- var items = itemsRef.current.children;
228
- if (!items.length) return;
229
- // 更新缓存
230
- updateItemSize(positions, items, sizeKey);
231
- var totalSize = getListTotalSize(positions, horizontal);
232
- setListTotalSize(totalSize);
233
- }, [positions, sizeKey, horizontal]);
234
- var scroll = useCallback(function () {
235
- requestAnimationFrame(function (e) {
236
- var scrollSize = getElement()[scrollKey];
237
- var startIndex = binarySearch(positions, scrollSize, horizontal);
238
- var overStart = startIndex - overscan > -1 ? startIndex - overscan : 0;
239
- // const offSetSize = horizontal ? getElement().offsetWidth : getElement().offsetHeight
240
- if (!itemEqualSize) {
241
- updateTotalSize();
242
- }
243
- var endIndex = getEndIndex({
244
- sourceData: sourceData,
245
- startIndex: startIndex,
246
- visibleCount: visibleCount,
247
- itemEqualSize: itemEqualSize,
248
- positions: positions,
249
- offSetSize: offSetSize,
250
- sizeKey: sizeKey,
251
- overscan: overscan
252
- });
253
- var startOffset = positions[startIndex][offsetKey];
254
- setOptions({
255
- startOffset: startOffset,
256
- startIndex: startIndex,
257
- overStart: overStart,
258
- endIndex: endIndex
259
- });
260
- // 无限下滑
261
- if (endIndex > sourceData.length - 1) {
262
- if (onScroll) {
263
- onScroll();
264
- } else if (handleScroll) {
265
- handleScroll();
266
- }
267
- }
268
- });
269
- }, [positions, getElement, sourceData, visibleCount, itemEqualSize, updateTotalSize, offsetKey, sizeKey, scrollKey, horizontal, overscan, handleScroll, offSetSize]);
270
- useEffect(function () {
271
- var element = getElement();
272
- element.addEventListener('scroll', scroll, false);
273
- return function () {
274
- element.removeEventListener('scroll', scroll, false);
275
- };
276
- }, [getElement, scroll]);
277
- return React__default.createElement("div", _objectSpread(_objectSpread({
278
- className: className ? "".concat(className, " nut-virtualList-box") : 'nut-virtualList-box'
279
- }, rest), {}, {
280
- style: _defineProperty({}, sizeKey, containerSize ? "".concat(offSetSize, "px") : '')
281
- }), React__default.createElement("div", {
282
- ref: scrollRef,
283
- className: horizontal ? 'nut-horizontal-box' : 'nut-vertical-box',
284
- style: _defineProperty({
285
- position: 'relative'
286
- }, sizeKey, "".concat(listTotalSize, "px"))
287
- }, React__default.createElement("ul", {
288
- className: horizontal ? 'nut-virtuallist-items nut-horizontal-items' : 'nut-virtuallist-items nut-vertical-items',
289
- ref: itemsRef,
290
- style: {
291
- transform: horizontal ? "translate3d(".concat(options.startOffset, "px,0,0)") : "translate3d(0,".concat(options.startOffset, "px,0)")
292
- }
293
- }, sourceData.slice(options.overStart, options.endIndex).map(function (data, index) {
294
- var startIndex = options.startIndex,
295
- overStart = options.overStart;
296
- var dataIndex = overStart + index;
297
- var styleVal = dataIndex < startIndex ? 'none' : 'block';
298
- var keyVal = key && data[key] ? data[key] : dataIndex;
299
- return React__default.createElement("li", {
300
- ref: dataIndex === 0 ? firstItemRef : null,
301
- "data-index": "".concat(dataIndex),
302
- className: dataIndex % 2 === 0 ? 'nut-virtuallist-item even' : 'nut-virtuallist-item odd',
303
- key: "".concat(keyVal),
304
- style: {
305
- display: styleVal
306
- }
307
- }, ItemRender ? React__default.createElement(ItemRender, {
308
- data: data,
309
- index: "".concat(dataIndex)
310
- }) : data);
311
- }))));
312
- };
313
- VirtualList.defaultProps = defaultProps;
314
- VirtualList.displayName = 'NutVirtualList';
315
11
  export { VirtualList as default };
@@ -1,113 +1,13 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
- import React__default, { useState, useEffect } from 'react';
6
- import classNames from 'classnames';
7
- import { useConfig } from './ConfigProvider.js';
8
- import { c as cn } from './bem-3b438e61.js';
1
+ import { W as WaterMark } from './watermark.taro-9ce2ae37.js';
2
+ import 'react';
3
+ import '@tarojs/taro';
4
+ import 'classnames';
5
+ import './configprovider-67d19d3a.js';
6
+ import 'lodash.kebabcase';
7
+ import './zh-CN-c779e6c1.js';
8
+ import './bem-350c1702.js';
9
9
  import '@bem-react/classname';
10
- var defaultProps = {
11
- content: '',
12
- fullPage: true,
13
- zIndex: 2000,
14
- gapX: 24,
15
- gapY: 48,
16
- width: 120,
17
- height: 64,
18
- image: '',
19
- imageWidth: 120,
20
- imageHeight: 64,
21
- rotate: -22,
22
- fontColor: 'rgba(0,0,0,.15)',
23
- fontStyle: 'normal',
24
- fontFamily: 'PingFang SC',
25
- fontWeight: 'normal',
26
- fontSize: 14
27
- };
28
- var WaterMark = function WaterMark(props) {
29
- var _classNames;
30
- var _useConfig = useConfig(),
31
- locale = _useConfig.locale;
32
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
33
- content = _defaultProps$props.content,
34
- fullPage = _defaultProps$props.fullPage,
35
- zIndex = _defaultProps$props.zIndex,
36
- className = _defaultProps$props.className,
37
- gapX = _defaultProps$props.gapX,
38
- gapY = _defaultProps$props.gapY,
39
- width = _defaultProps$props.width,
40
- height = _defaultProps$props.height,
41
- image = _defaultProps$props.image,
42
- imageWidth = _defaultProps$props.imageWidth,
43
- imageHeight = _defaultProps$props.imageHeight,
44
- rotate = _defaultProps$props.rotate,
45
- fontColor = _defaultProps$props.fontColor,
46
- fontStyle = _defaultProps$props.fontStyle,
47
- fontFamily = _defaultProps$props.fontFamily,
48
- fontWeight = _defaultProps$props.fontWeight,
49
- fontSize = _defaultProps$props.fontSize,
50
- style = _defaultProps$props.style,
51
- children = _defaultProps$props.children;
52
- var _useState = useState(''),
53
- _useState2 = _slicedToArray(_useState, 2),
54
- base64Url = _useState2[0],
55
- setBase64Url = _useState2[1];
56
- var b = cn('watermark');
57
- var classes = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(b('')), true), _defineProperty(_classNames, "".concat(b(''), "-full-page"), fullPage), _classNames));
58
- var cls = classNames(classes, className);
59
- useEffect(function () {
60
- init();
61
- }, []);
62
- var init = function init() {
63
- var canvas = document.createElement('canvas');
64
- var ratio = window.devicePixelRatio;
65
- var ctx = canvas.getContext('2d');
66
- var canvasWidth = "".concat((gapX + width) * ratio, "px");
67
- var canvasHeight = "".concat((gapY + height) * ratio, "px");
68
- var markWidth = width * ratio;
69
- var markHeight = height * ratio;
70
- canvas.setAttribute('width', canvasWidth);
71
- canvas.setAttribute('height', canvasHeight);
72
- if (ctx) {
73
- if (image) {
74
- ctx.translate(markWidth / 2, markHeight / 2);
75
- ctx.rotate(Math.PI / 180 * Number(rotate));
76
- var img = new Image();
77
- img.crossOrigin = 'anonymous';
78
- img.referrerPolicy = 'no-referrer';
79
- img.src = image;
80
- img.onload = function () {
81
- ctx.drawImage(img, -imageWidth * ratio / 2, -imageHeight * ratio / 2, imageWidth * ratio, imageHeight * ratio);
82
- ctx.restore();
83
- setBase64Url(canvas.toDataURL());
84
- };
85
- } else if (content) {
86
- ctx.textBaseline = 'middle'; // 设置或返回在绘制文本时使用的当前文本基线。(正中)
87
- ctx.textAlign = 'center'; // 设置或返回文本内容的当前对齐方式。
88
- // 文字绕中间旋转
89
- ctx.translate(markWidth / 2, markHeight / 2);
90
- ctx.rotate(Math.PI / 180 * Number(rotate));
91
- var markSize = Number(fontSize) * ratio;
92
- ctx.font = "".concat(fontStyle, " normal ").concat(fontWeight, " ").concat(markSize, "px/").concat(markHeight, "px ").concat(fontFamily);
93
- ctx.fillStyle = fontColor;
94
- ctx.fillText(content, 0, 0); // 在画布上绘制"被填充的"文本。
95
- ctx.restore(); // 返回之前保存过的路径状态和属性。
96
- setBase64Url(canvas.toDataURL());
97
- }
98
- } else {
99
- throw new Error(locale.watermark.errorCanvasTips);
100
- }
101
- };
102
- return React__default.createElement("div", {
103
- className: cls,
104
- style: _objectSpread({
105
- zIndex: zIndex,
106
- backgroundSize: "".concat(gapX + width, "px"),
107
- backgroundImage: "url('".concat(base64Url, "')")
108
- }, style)
109
- });
110
- };
111
- WaterMark.defaultProps = defaultProps;
112
- WaterMark.displayName = 'NutWaterMark';
10
+
11
+
12
+
113
13
  export { WaterMark as default };
@@ -0,0 +1,53 @@
1
+ import React__default from 'react';
2
+ import { P as Popup } from './popup.taro-01676bff.js';
3
+ import { c as cn } from './bem-350c1702.js';
4
+
5
+ const defaultProps = {
6
+ cancelTxt: '',
7
+ optionTag: 'name',
8
+ optionSubTag: 'subname',
9
+ chooseTagValue: '',
10
+ title: '',
11
+ color: '#ee0a24',
12
+ description: '',
13
+ menuItems: [],
14
+ onCancel: () => { },
15
+ onChoose: () => { },
16
+ visible: false,
17
+ className: '',
18
+ style: {},
19
+ };
20
+ const ActionSheet = (props) => {
21
+ const { children, cancelTxt, optionTag, optionSubTag, chooseTagValue, title, color, description, menuItems, onCancel, onChoose, visible, className, style, ...rest } = { ...defaultProps, ...props };
22
+ const b = cn('actionsheet');
23
+ const isHighlight = (item) => {
24
+ return props.chooseTagValue &&
25
+ props.chooseTagValue === item[props.optionTag || 'name']
26
+ ? props.color
27
+ : '#1a1a1a';
28
+ };
29
+ const cancelActionSheet = () => {
30
+ onCancel && onCancel();
31
+ };
32
+ const chooseItem = (item, index) => {
33
+ if (!item.disable) {
34
+ onChoose && onChoose(item, index);
35
+ }
36
+ };
37
+ return (React__default.createElement(Popup, { round: true, visible: visible, position: "bottom", onClose: () => {
38
+ onCancel && onCancel();
39
+ } },
40
+ React__default.createElement("div", { className: `${b()} ${className}`, style: style, ...rest },
41
+ title && React__default.createElement("div", { className: b('title') }, title),
42
+ description && (React__default.createElement("div", { className: `${b('item')} desc` }, description)),
43
+ menuItems.length ? (React__default.createElement("div", { className: b('menu') }, menuItems.map((item, index) => {
44
+ return (React__default.createElement("div", { className: `${b('item')} ${item.disable ? b('item-disabled') : ''}`, style: { color: isHighlight(item) }, key: index, onClick: () => chooseItem(item, index) },
45
+ item[optionTag],
46
+ React__default.createElement("div", { className: "subdesc" }, item[optionSubTag])));
47
+ }))) : (children),
48
+ cancelTxt && (React__default.createElement("div", { className: b('cancel'), onClick: () => cancelActionSheet() }, cancelTxt)))));
49
+ };
50
+ ActionSheet.defaultProps = defaultProps;
51
+ ActionSheet.displayName = 'NutActionSheet';
52
+
53
+ export { ActionSheet as A };