@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,492 +1,11 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- import _typeof from "@babel/runtime/helpers/typeof";
5
- var _excluded = ["children", "direction", "className", "pageContent", "onChange", "initPage", "paginationColor", "paginationVisible", "touchable", "isPreventDefault", "isStopPropagation", "autoPlay", "isCenter", "paginationBgColor"];
6
- 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; }
7
- 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; }
8
- import React__default, { useRef, useState, useMemo, useEffect } from 'react';
9
- import classNames from 'classnames';
10
- import { D as DataContext } from './UserContext-2629d479.js';
11
- import { c as cn } from './bem-3b438e61.js';
12
- import { g as getRect } from './useClientRect-56bb675b.js';
1
+ import { S as Swiper } from './swiper.taro-7a94e211.js';
2
+ import 'react';
3
+ import 'classnames';
4
+ import '@tarojs/taro';
5
+ import './UserContext-e8176108.js';
6
+ import './bem-350c1702.js';
13
7
  import '@bem-react/classname';
14
- var defaultProps = {
15
- width: (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' ? window.innerWidth : 375,
16
- height: 0,
17
- duration: 500,
18
- initPage: 0,
19
- autoPlay: 0,
20
- direction: 'horizontal',
21
- paginationColor: '#fff',
22
- paginationBgColor: '#ddd',
23
- paginationVisible: false,
24
- loop: true,
25
- touchable: true,
26
- isPreventDefault: true,
27
- isStopPropagation: true,
28
- isCenter: false,
29
- className: ''
30
- };
31
- var DISTANCE = 5;
32
- var Swiper = React__default.forwardRef(function (props, ref) {
33
- var _classNames, _classNames2;
34
- var propSwiper = _objectSpread(_objectSpread({}, defaultProps), props);
35
- var children = propSwiper.children,
36
- direction = propSwiper.direction,
37
- className = propSwiper.className,
38
- pageContent = propSwiper.pageContent,
39
- onChange = propSwiper.onChange,
40
- initPage = propSwiper.initPage,
41
- paginationColor = propSwiper.paginationColor,
42
- paginationVisible = propSwiper.paginationVisible,
43
- touchable = propSwiper.touchable,
44
- isPreventDefault = propSwiper.isPreventDefault,
45
- isStopPropagation = propSwiper.isStopPropagation,
46
- autoPlay = propSwiper.autoPlay,
47
- isCenter = propSwiper.isCenter,
48
- paginationBgColor = propSwiper.paginationBgColor,
49
- rest = _objectWithoutProperties(propSwiper, _excluded);
50
- var container = useRef(null);
51
- var innerRef = useRef(null);
52
- var _swiper = useRef({
53
- moving: false,
54
- autoplayTimer: null,
55
- width: 0,
56
- height: 0,
57
- offset: 0,
58
- size: 0
59
- });
60
- var isVertical = direction === 'vertical';
61
- var _useState = useState(null),
62
- _useState2 = _slicedToArray(_useState, 2),
63
- rect = _useState2[0],
64
- setRect = _useState2[1];
65
- // eslint-disable-next-line prefer-const
66
- var _useState3 = useState(0),
67
- _useState4 = _slicedToArray(_useState3, 2),
68
- active = _useState4[0],
69
- setActive = _useState4[1];
70
- var _useState5 = useState(0),
71
- _useState6 = _slicedToArray(_useState5, 2),
72
- width = _useState6[0],
73
- setWidth = _useState6[1];
74
- var _useState7 = useState(0),
75
- _useState8 = _slicedToArray(_useState7, 2),
76
- height = _useState8[0],
77
- setHeight = _useState8[1];
78
- var _useState9 = useState(0),
79
- _useState10 = _slicedToArray(_useState9, 2),
80
- offset = _useState10[0],
81
- setOffset = _useState10[1];
82
- var _useState11 = useState([]),
83
- _useState12 = _slicedToArray(_useState11, 2),
84
- childOffset = _useState12[0],
85
- setChildOffset = _useState12[1];
86
- var _useState13 = useState(false),
87
- _useState14 = _slicedToArray(_useState13, 2),
88
- ready = _useState14[0],
89
- setReady = _useState14[1];
90
- var size = isVertical ? height : width;
91
- var _useState15 = useState({
92
- startX: 0,
93
- startY: 0,
94
- deltaX: 0,
95
- deltaY: 0,
96
- offsetX: 0,
97
- offsetY: 0,
98
- stateDirection: '',
99
- delta: 0,
100
- touchTime: 0
101
- }),
102
- _useState16 = _slicedToArray(_useState15, 2),
103
- touch = _useState16[0],
104
- setTouch = _useState16[1];
105
- var _useMemo = useMemo(function () {
106
- var childCount = 0;
107
- var childs = React__default.Children.map(props.children, function (child) {
108
- if (!React__default.isValidElement(child)) return null;
109
- childCount++;
110
- return child;
111
- });
112
- return {
113
- childs: childs,
114
- childCount: childCount
115
- };
116
- }, [props.children]),
117
- childs = _useMemo.childs,
118
- childCount = _useMemo.childCount;
119
- var trackSize = childCount * Number(size);
120
- // 父组件参数传入子组件item
121
- var parent = {
122
- propSwiper: propSwiper,
123
- size: size
124
- };
125
- var minOffset = function () {
126
- if (rect) {
127
- var base = isVertical ? rect.height : rect.width;
128
- return base - Number(size) * childCount;
129
- }
130
- return 0;
131
- }();
132
- // 清除定时器
133
- var stopAutoPlay = function stopAutoPlay() {
134
- clearTimeout(_swiper.current.autoplayTimer);
135
- _swiper.current.autoplayTimer = null;
136
- };
137
- // 定时轮播
138
- var autoplay = function autoplay() {
139
- if (propSwiper.autoPlay <= 0 || childCount <= 1) return;
140
- stopAutoPlay();
141
- _swiper.current.autoplayTimer = setTimeout(function () {
142
- next();
143
- autoplay();
144
- }, Number(propSwiper.autoPlay));
145
- };
146
- // 重置首尾位置信息
147
- var resettPosition = function resettPosition() {
148
- _swiper.current.moving = true;
149
- if (active <= -1) {
150
- move({
151
- pace: childCount
152
- });
153
- }
154
- if (active >= childCount) {
155
- move({
156
- pace: -childCount
157
- });
158
- }
159
- };
160
- // 上一页
161
- var prev = function prev() {
162
- resettPosition();
163
- touchReset();
164
- requestFrame(function () {
165
- requestFrame(function () {
166
- _swiper.current.moving = false;
167
- move({
168
- pace: -1,
169
- isEmit: true
170
- });
171
- });
172
- });
173
- };
174
- // 下一页
175
- var next = function next() {
176
- resettPosition();
177
- touchReset();
178
- requestFrame(function () {
179
- requestFrame(function () {
180
- _swiper.current.moving = false;
181
- move({
182
- pace: 1,
183
- isEmit: true
184
- });
185
- });
186
- });
187
- };
188
- // 前往指定页
189
- var to = function to(index) {
190
- resettPosition();
191
- touchReset();
192
- requestFrame(function () {
193
- requestFrame(function () {
194
- _swiper.current.moving = false;
195
- var targetIndex;
196
- if (props.loop && childCount === index) {
197
- targetIndex = active === 0 ? 0 : index;
198
- } else {
199
- targetIndex = index % childCount;
200
- }
201
- move({
202
- pace: targetIndex - active,
203
- isEmit: true
204
- });
205
- });
206
- });
207
- };
208
- var resize = function resize() {
209
- init(active);
210
- };
211
- // 切换方法
212
- var move = function move(_ref) {
213
- var _ref$pace = _ref.pace,
214
- pace = _ref$pace === void 0 ? 0 : _ref$pace,
215
- _ref$offset = _ref.offset,
216
- offset = _ref$offset === void 0 ? 0 : _ref$offset,
217
- _ref$isEmit = _ref.isEmit,
218
- isEmit = _ref$isEmit === void 0 ? false : _ref$isEmit,
219
- _ref$movingStatus = _ref.movingStatus,
220
- movingStatus = _ref$movingStatus === void 0 ? false : _ref$movingStatus;
221
- if (childCount <= 1) return;
222
- var targetActive = getActive(pace);
223
- // 父级容器偏移量
224
- var targetOffset = getOffset(targetActive, offset);
225
- // 如果循环,调整开头结尾图片位置
226
- if (props.loop) {
227
- if (Array.isArray(children) && children[0] && targetOffset !== minOffset) {
228
- var rightBound = targetOffset < minOffset;
229
- childOffset[0] = rightBound ? trackSize : 0;
230
- }
231
- if (Array.isArray(children) && children[childCount - 1] && targetOffset !== 0) {
232
- var leftBound = targetOffset > 0;
233
- childOffset[childCount - 1] = leftBound ? -trackSize : 0;
234
- }
235
- setChildOffset(childOffset);
236
- }
237
- if (isEmit && active !== targetActive) {
238
- props.onChange && props.onChange((targetActive + childCount) % childCount);
239
- }
240
- active = targetActive;
241
- setActive(targetActive);
242
- setOffset(targetOffset);
243
- getStyle(targetOffset);
244
- };
245
- // 确定当前active 元素
246
- var getActive = function getActive(pace) {
247
- if (pace) {
248
- var _active = active + pace;
249
- if (props.loop) {
250
- return range(_active, -1, childCount);
251
- }
252
- return range(_active, 0, childCount - 1);
253
- }
254
- return active;
255
- };
256
- // 计算位移
257
- var getOffset = function getOffset(active) {
258
- var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
259
- var currentPosition = active * Number(size);
260
- if (!props.loop) {
261
- currentPosition = Math.min(currentPosition, -minOffset);
262
- }
263
- var targetOffset = offset - currentPosition;
264
- if (!props.loop) {
265
- targetOffset = range(targetOffset, minOffset, 0);
266
- }
267
- return targetOffset;
268
- };
269
- // 浏览器 帧 事件
270
- var requestFrame = function requestFrame(fn) {
271
- window.requestAnimationFrame.call(window, fn);
272
- };
273
- // 取值 方法
274
- var range = function range(num, min, max) {
275
- return Math.min(Math.max(num, min), max);
276
- };
277
- var getDirection = function getDirection(x, y) {
278
- if (x > y && x > DISTANCE) return 'horizontal';
279
- if (y > x && y > DISTANCE) return 'vertical';
280
- return '';
281
- };
282
- // 重置 全部位移信息
283
- var touchReset = function touchReset() {
284
- touch.startX = 0;
285
- touch.startY = 0;
286
- touch.deltaX = 0;
287
- touch.deltaY = 0;
288
- touch.offsetX = 0;
289
- touch.offsetY = 0;
290
- touch.delta = 0;
291
- touch.stateDirection = '';
292
- touch.touchTime = 0;
293
- };
294
- // 触摸事件开始
295
- var touchStart = function touchStart(e) {
296
- touchReset();
297
- touch.startX = e.touches[0].clientX;
298
- touch.startY = e.touches[0].clientY;
299
- };
300
- // 触摸事件移动
301
- var touchMove = function touchMove(e) {
302
- touch.deltaX = e.touches[0].clientX - touch.startX;
303
- touch.deltaY = e.touches[0].clientY - touch.startY;
304
- touch.offsetX = Math.abs(touch.deltaX);
305
- touch.offsetY = Math.abs(touch.deltaY);
306
- touch.delta = isVertical ? touch.deltaY : touch.deltaX;
307
- if (!touch.stateDirection) {
308
- touch.stateDirection = getDirection(touch.offsetX, touch.offsetY);
309
- }
310
- };
311
- var b = cn('swiper');
312
- var classes = classNames(b(''));
313
- var contentClass = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(b('inner')), true), _defineProperty(_classNames, "".concat(b('vertical')), isVertical), _classNames));
314
- var getStyle = function getStyle() {
315
- var moveOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : offset;
316
- var target = innerRef.current;
317
- var _offset = 0;
318
- if (!isCenter) {
319
- _offset = moveOffset;
320
- } else {
321
- var _size = isVertical ? height : width;
322
- var val = isVertical ? rect.height - _size : rect.width - _size;
323
- _offset = moveOffset + (active === childCount - 1 && !props.loop ? -val / 2 : val / 2);
324
- }
325
- target.style.transitionDuration = "".concat(_swiper.current.moving ? 0 : props.duration, "ms");
326
- target.style[isVertical ? 'height' : 'width'] = "".concat(Number(size) * childCount, "px");
327
- target.style[isVertical ? 'width' : 'height'] = "".concat(isVertical ? width : height, "px");
328
- target.style.transform = "translate3D".concat(!isVertical ? "(".concat(_offset, "px,0,0)") : "(0,".concat(_offset, "px,0)"));
329
- };
330
- var onTouchStart = function onTouchStart(e) {
331
- if (props.isPreventDefault) e.preventDefault();
332
- if (props.isStopPropagation) e.stopPropagation();
333
- if (!props.touchable) return;
334
- touchStart(e);
335
- touch.touchTime = Date.now();
336
- stopAutoPlay();
337
- resettPosition();
338
- };
339
- var onTouchMove = function onTouchMove(e) {
340
- if (props.touchable && _swiper.current.moving) {
341
- touchMove(e);
342
- if (touch.stateDirection === props.direction) {
343
- move({
344
- offset: touch.delta
345
- });
346
- }
347
- }
348
- };
349
- var onTouchEnd = function onTouchEnd(e) {
350
- if (!props.touchable || !_swiper.current.moving) return;
351
- var speed = touch.delta / (Date.now() - touch.touchTime);
352
- var isShouldMove = Math.abs(speed) > 0.3 || Math.abs(touch.delta) > +(size / 2).toFixed(2);
353
- var pace = 0;
354
- _swiper.current.moving = false;
355
- if (isShouldMove && touch.stateDirection === props.direction) {
356
- var _offset2 = isVertical ? touch.offsetY : touch.offsetX;
357
- if (props.loop) {
358
- if (_offset2 > 0) {
359
- pace = touch.delta > 0 ? -1 : 1;
360
- } else {
361
- pace = 0;
362
- }
363
- } else {
364
- pace = -Math[touch.delta > 0 ? 'ceil' : 'floor'](touch.delta / size);
365
- }
366
- move({
367
- pace: pace,
368
- isEmit: true
369
- });
370
- } else if (touch.delta) {
371
- move({
372
- pace: 0
373
- });
374
- } else {
375
- getStyle();
376
- }
377
- autoplay();
378
- };
379
- useEffect(function () {
380
- _swiper.current.activePagination = (active + childCount) % childCount;
381
- }, [active]);
382
- var init = function init() {
383
- var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : +propSwiper.initPage;
384
- var rect = getRect(container === null || container === void 0 ? void 0 : container.current);
385
- var _active = Math.max(Math.min(childCount - 1, active), 0);
386
- var _width = propSwiper.width ? +propSwiper.width : rect.width;
387
- var _height = propSwiper.height ? +propSwiper.height : rect.height;
388
- size = isVertical ? _height : _width;
389
- trackSize = childCount * Number(size);
390
- var targetOffset = getOffset(_active);
391
- _swiper.current.moving = true;
392
- if (ready) {
393
- _swiper.current.moving = false;
394
- }
395
- setRect(rect);
396
- setActive(_active);
397
- setWidth(_width);
398
- setHeight(_height);
399
- setOffset(targetOffset);
400
- setReady(true);
401
- };
402
- useEffect(function () {
403
- if (ready) {
404
- getStyle();
405
- }
406
- }, [isVertical, width, height, offset, ready]);
407
- useEffect(function () {
408
- if (ready) {
409
- stopAutoPlay();
410
- autoplay();
411
- }
412
- return function () {
413
- setReady(false);
414
- };
415
- }, [ready]);
416
- useEffect(function () {
417
- stopAutoPlay();
418
- autoplay();
419
- }, [children]);
420
- useEffect(function () {
421
- init();
422
- }, [propSwiper.initPage]);
423
- useEffect(function () {
424
- var target = container.current;
425
- target.addEventListener('touchstart', onTouchStart, false);
426
- target.addEventListener('touchmove', onTouchMove, false);
427
- target.addEventListener('touchend', onTouchEnd, false);
428
- return function () {
429
- target.removeEventListener('touchstart', onTouchStart, false);
430
- target.removeEventListener('touchmove', onTouchMove, false);
431
- target.removeEventListener('touchend', onTouchEnd, false);
432
- };
433
- });
434
- useEffect(function () {
435
- return function () {
436
- stopAutoPlay();
437
- };
438
- }, []);
439
- var itemStyle = function itemStyle(index) {
440
- var style = {};
441
- var _direction = propSwiper.direction || direction;
442
- var _size = size;
443
- if (_size) {
444
- style[_direction === 'horizontal' ? 'width' : 'height'] = "".concat(_size, "px");
445
- }
446
- var offset = childOffset[index];
447
- if (offset) {
448
- style.transform = "translate3D".concat(_direction === 'horizontal' ? "(".concat(offset, "px,0,0)") : "(0,".concat(offset, "px,0)"));
449
- }
450
- return style;
451
- };
452
- React__default.useImperativeHandle(ref, function () {
453
- return {
454
- to: to,
455
- next: next,
456
- prev: prev,
457
- resize: resize
458
- };
459
- });
460
- return React__default.createElement(DataContext.Provider, {
461
- value: parent
462
- }, React__default.createElement("div", _objectSpread({
463
- className: "".concat(classes, " ").concat(className),
464
- ref: container
465
- }, rest), React__default.createElement("div", {
466
- className: contentClass,
467
- ref: innerRef
468
- }, React__default.Children.map(childs, function (child, index) {
469
- return React__default.createElement("div", {
470
- className: b('item-wrapper'),
471
- style: itemStyle(index),
472
- key: index
473
- }, child);
474
- })), propSwiper.paginationVisible && !('pageContent' in propSwiper) ? React__default.createElement("div", {
475
- className: classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(b('pagination')), true), _defineProperty(_classNames2, "".concat(b('pagination-vertical')), isVertical), _classNames2))
476
- }, React__default.Children.map(childs, function (item, index) {
477
- return React__default.createElement("i", {
478
- style: (active + childCount) % childCount === index ? {
479
- backgroundColor: propSwiper.paginationColor
480
- } : {
481
- backgroundColor: propSwiper.paginationBgColor
482
- },
483
- className: classNames({
484
- active: (active + childCount) % childCount === index
485
- }),
486
- key: index
487
- });
488
- })) : React__default.createElement("div", null, pageContent)));
489
- });
490
- Swiper.defaultProps = defaultProps;
491
- Swiper.displayName = 'NutSwiper';
8
+
9
+
10
+
492
11
  export { Swiper as default };
@@ -1,38 +1,10 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- 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; }
3
- 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; }
4
- import React__default, { useContext } from 'react';
5
- import classNames from 'classnames';
6
- import { D as DataContext } from './UserContext-2629d479.js';
7
- import { c as cn } from './bem-3b438e61.js';
1
+ import { S as SwiperItem } from './swiperitem-c9e3d0d5.js';
2
+ import 'react';
3
+ import 'classnames';
4
+ import './UserContext-e8176108.js';
5
+ import './bem-350c1702.js';
8
6
  import '@bem-react/classname';
9
- var defaultProps = {
10
- direction: 'horizontal'
11
- };
12
- var SwiperItem = React__default.forwardRef(function (props, ref) {
13
- var _props = _objectSpread(_objectSpread({}, defaultProps), props);
14
- var className = _props.className,
15
- style = _props.style,
16
- children = _props.children,
17
- direction = _props.direction,
18
- size = _props.size;
19
- var parent = useContext(DataContext);
20
- var b = cn('swiper-item');
21
- var classes = classNames(b(''), className);
22
- var getStyle = function getStyle() {
23
- var style = {};
24
- var _direction = (parent === null || parent === void 0 ? void 0 : parent.propSwiper.direction) || direction;
25
- var _size = (parent === null || parent === void 0 ? void 0 : parent.size) || size;
26
- if (_size) {
27
- style[_direction === 'horizontal' ? 'width' : 'height'] = "".concat(_size, "px");
28
- }
29
- return style;
30
- };
31
- return React__default.createElement("div", {
32
- className: classes,
33
- style: _objectSpread(_objectSpread({}, style), getStyle())
34
- }, children);
35
- });
36
- SwiperItem.defaultProps = defaultProps;
37
- SwiperItem.displayName = 'NutSwiperItem';
7
+
8
+
9
+
38
10
  export { SwiperItem as default };
@@ -1,73 +1,8 @@
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 { c as cn } from './bem-3b438e61.js';
7
- import { C as ComponentDefaults } from './typings-f27b58f4.js';
1
+ import { S as Switch } from './switch.taro-34ca8228.js';
2
+ import 'react';
3
+ import './bem-350c1702.js';
8
4
  import '@bem-react/classname';
9
- var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
10
- isAsync: false,
11
- checked: false,
12
- disable: false,
13
- activeColor: '',
14
- inactiveColor: '',
15
- activeText: '',
16
- inactiveText: '',
17
- className: ''
18
- });
19
- var Switch = function Switch(props) {
20
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
21
- isAsync = _defaultProps$props.isAsync,
22
- checked = _defaultProps$props.checked,
23
- disable = _defaultProps$props.disable,
24
- activeColor = _defaultProps$props.activeColor,
25
- inactiveColor = _defaultProps$props.inactiveColor,
26
- activeText = _defaultProps$props.activeText,
27
- inactiveText = _defaultProps$props.inactiveText,
28
- onChange = _defaultProps$props.onChange,
29
- className = _defaultProps$props.className,
30
- style = _defaultProps$props.style;
31
- var _useState = useState(false),
32
- _useState2 = _slicedToArray(_useState, 2),
33
- value = _useState2[0],
34
- setValue = _useState2[1];
35
- var b = cn('switch');
36
- useEffect(function () {
37
- setValue(checked);
38
- }, [checked]);
39
- var classes = function classes() {
40
- return "".concat(b(), " ").concat(value ? 'switch-open' : 'switch-close', " ").concat(disable ? "".concat(b(), "-disable") : '', " ", "".concat(b(), "-base"), " ").concat(className);
41
- };
42
- var styles = function styles() {
43
- var myStyle = _objectSpread({
44
- backgroundColor: value ? activeColor : inactiveColor
45
- }, style || {});
46
- return myStyle;
47
- };
48
- var _onClick = function onClick(event) {
49
- if (disable) return;
50
- if (!isAsync) {
51
- setValue(!value);
52
- }
53
- onChange && onChange(!value, event);
54
- };
55
- return React__default.createElement("div", {
56
- className: classes(),
57
- onClick: function onClick(e) {
58
- return _onClick(e);
59
- },
60
- style: styles()
61
- }, React__default.createElement("div", {
62
- className: "switch-button"
63
- }, !value && React__default.createElement("div", {
64
- className: "close-line"
65
- }), activeText && React__default.createElement(React__default.Fragment, null, value ? React__default.createElement("div", {
66
- className: "".concat(b('label'), " open")
67
- }, activeText) : React__default.createElement("div", {
68
- className: "".concat(b('label'), " close")
69
- }, inactiveText))));
70
- };
71
- Switch.defaultProps = defaultProps;
72
- Switch.displayName = 'NutSwitch';
5
+
6
+
7
+
73
8
  export { Switch as default };
@@ -1,6 +1,9 @@
1
- import { T as TabPane } from './tabpane-01075e6c.js';
1
+ import { T as TabPane } from './tabpane.taro-4ca340ef.js';
2
2
  import 'react';
3
3
  import 'classnames';
4
- import './bem-3b438e61.js';
4
+ import './bem-350c1702.js';
5
5
  import '@bem-react/classname';
6
+
7
+
8
+
6
9
  export { TabPane as default };