@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.
- package/CHANGELOG.md +7 -1
- package/dist/esm/ActionSheet.js +14 -90
- package/dist/esm/Address.js +21 -620
- package/dist/esm/Animate.js +7 -53
- package/dist/esm/AnimatingNumbers.js +7 -125
- package/dist/esm/Audio.js +19 -264
- package/dist/esm/Avatar.js +11 -130
- package/dist/esm/{AvatarContext-15733596.js → AvatarContext-c96afdcc.js} +3 -1
- package/dist/esm/AvatarGroup.js +11 -41
- package/dist/esm/BackTop.js +10 -138
- package/dist/esm/Badge.js +9 -71
- package/dist/esm/Barrage.js +8 -97
- package/dist/esm/Button.js +9 -108
- package/dist/esm/Calendar.js +20 -128
- package/dist/esm/CalendarItem.js +12 -674
- package/dist/esm/Card.js +11 -61
- package/dist/esm/Cascader.js +16 -671
- package/dist/esm/Cell.js +9 -101
- package/dist/esm/CellGroup.js +5 -2
- package/dist/esm/Checkbox.js +7 -5
- package/dist/esm/CheckboxGroup.js +8 -111
- package/dist/esm/CircleProgress.js +8 -114
- package/dist/esm/Col.js +7 -57
- package/dist/esm/Collapse.js +7 -97
- package/dist/esm/CollapseItem.js +8 -146
- package/dist/esm/ConfigProvider.js +8 -187
- package/dist/esm/CountDown.js +9 -247
- package/dist/esm/DatePicker.js +25 -309
- package/dist/esm/Dialog.js +17 -296
- package/dist/esm/Divider.js +7 -34
- package/dist/esm/Drag.js +7 -118
- package/dist/esm/Elevator.js +8 -234
- package/dist/esm/Ellipsis.js +10 -176
- package/dist/esm/Empty.js +8 -79
- package/dist/esm/FixedNav.js +14 -103
- package/dist/esm/Form.js +10 -215
- package/dist/esm/FormItem.js +10 -3
- package/dist/esm/Grid.js +11 -81
- package/dist/esm/GridItem.js +13 -123
- package/dist/esm/Icon.js +5 -2
- package/dist/esm/Image.js +11 -169
- package/dist/esm/ImagePreview.js +19 -225
- package/dist/esm/Indicator.js +7 -50
- package/dist/esm/Infiniteloading.js +14 -215
- package/dist/esm/Input.js +12 -362
- package/dist/esm/InputNumber.js +9 -275
- package/dist/esm/Layout.js +5 -13
- package/dist/esm/Menu.js +10 -153
- package/dist/esm/MenuItem.js +15 -175
- package/dist/esm/NavBar.js +9 -114
- package/dist/esm/NoticeBar.js +10 -568
- package/dist/esm/Notify.js +8 -234
- package/dist/esm/NumberKeyboard.js +17 -247
- package/dist/esm/Overlay.js +6 -2
- package/dist/esm/Pagination.js +9 -168
- package/dist/esm/Picker.js +22 -494
- package/dist/esm/Popover.js +12 -223
- package/dist/esm/Popup.js +13 -193
- package/dist/esm/Price.js +6 -84
- package/dist/esm/Progress.js +9 -122
- package/dist/esm/PullToRefresh.js +13 -276
- package/dist/esm/Radio.js +8 -4
- package/dist/esm/RadioGroup.js +7 -120
- package/dist/esm/Range.js +15 -406
- package/dist/esm/Rate.js +9 -121
- package/dist/esm/Row.js +7 -49
- package/dist/esm/SearchBar.js +12 -235
- package/dist/esm/ShortPassword.js +17 -191
- package/dist/esm/SideNavBar.js +19 -57
- package/dist/esm/SideNavBarItem.js +5 -24
- package/dist/esm/Signature.js +13 -153
- package/dist/esm/Skeleton.js +12 -98
- package/dist/esm/Step.js +10 -87
- package/dist/esm/Steps.js +8 -38
- package/dist/esm/Sticky.js +11 -190
- package/dist/esm/SubSideNavBar.js +6 -78
- package/dist/esm/Swipe.js +10 -230
- package/dist/esm/Swiper.js +9 -490
- package/dist/esm/SwiperItem.js +8 -36
- package/dist/esm/Switch.js +6 -71
- package/dist/esm/TabPane.js +5 -2
- package/dist/esm/Tabbar.js +6 -68
- package/dist/esm/TabbarItem.js +9 -78
- package/dist/esm/Table.js +12 -140
- package/dist/esm/Tabs.js +8 -5
- package/dist/esm/Tag.js +10 -110
- package/dist/esm/TextArea.js +9 -148
- package/dist/esm/TimeDetail.js +9 -67
- package/dist/esm/TimePannel.js +9 -29
- package/dist/esm/TimeSelect.js +19 -171
- package/dist/esm/Toast.js +7 -268
- package/dist/esm/TrendArrow.js +7 -99
- package/dist/esm/Uploader.js +17 -566
- package/dist/esm/{UserContext-101ad4a4.js → UserContext-0aac9a82.js} +3 -1
- package/dist/esm/{UserContext-2629d479.js → UserContext-e402e1a6.js} +3 -1
- package/dist/esm/{UserContext-b33bcf21.js → UserContext-e8176108.js} +3 -1
- package/dist/esm/Video.js +7 -90
- package/dist/esm/VirtualList.js +9 -313
- package/dist/esm/WaterMark.js +11 -111
- package/dist/esm/actionsheet.taro-e6a51446.js +53 -0
- package/dist/esm/address.taro-3a9b6396.js +461 -0
- package/dist/esm/animate.taro-fb7986d6.js +40 -0
- package/dist/esm/animatingnumbers.taro-03e5d61d.js +104 -0
- package/dist/esm/audio.taro-87ec8bf2.js +161 -0
- package/dist/esm/avatar.taro-3676f38f.js +103 -0
- package/dist/esm/avatargroup-f3574510.js +34 -0
- package/dist/esm/backtop.taro-66394a36.js +48 -0
- package/dist/esm/badge.taro-a4e59c11.js +52 -0
- package/dist/esm/barrage.taro-0495a1b2.js +94 -0
- package/dist/esm/{bem-3b438e61.js → bem-350c1702.js} +3 -6
- package/dist/esm/button.taro-9244d065.js +100 -0
- package/dist/esm/calendar.taro-670842ea.js +65 -0
- package/dist/esm/calendaritem.taro-2a603571.js +787 -0
- package/dist/esm/can-use-dom-3eeb5af4.js +6 -0
- package/dist/esm/card.taro-e4c76dad.js +33 -0
- package/dist/esm/cascader.taro-a5553aa5.js +437 -0
- package/dist/esm/cell.taro-a10a74d3.js +64 -0
- package/dist/esm/cellgroup.taro-abe501bc.js +25 -0
- package/dist/esm/checkbox.taro-6120e3e3.js +171 -0
- package/dist/esm/circleprogress.taro-79854448.js +109 -0
- package/dist/esm/col.taro-53eed3cc.js +41 -0
- package/dist/esm/collapse.taro-1a9e4ba2.js +83 -0
- package/dist/esm/collapseitem-4d0bc55d.js +83 -0
- package/dist/esm/configprovider-67d19d3a.js +19 -0
- package/dist/esm/configprovider.taro-8d71eb49.js +42 -0
- package/dist/esm/countdown.taro-5b17c607.js +226 -0
- package/dist/esm/datepicker.taro-477ad357.js +275 -0
- package/dist/esm/dialog.taro-a3267d29.js +118 -0
- package/dist/esm/divider.taro-26d1d8b4.js +35 -0
- package/dist/esm/drag.taro-79bb8744.js +110 -0
- package/dist/esm/elevator.taro-6019669e.js +178 -0
- package/dist/esm/ellipsis.taro-f15f26da.js +241 -0
- package/dist/esm/empty.taro-04ae4389.js +62 -0
- package/dist/esm/fixednav.taro-1f05acaf.js +53 -0
- package/dist/esm/form.taro-0b399b30.js +178 -0
- package/dist/esm/formitem.taro-190a3326.js +89 -0
- package/dist/esm/get-scroll-parent-b4a07e65.js +25 -0
- package/dist/esm/grid.taro-3503b82c.js +61 -0
- package/dist/esm/{grid.context-2ee27d95.js → grid.taro.context-c2bbfb4f.js} +4 -2
- package/dist/esm/griditem.taro-cdb3f119.js +98 -0
- package/dist/esm/icon-296a1bec.js +63 -0
- package/dist/esm/icon.taro-296a1bec.js +63 -0
- package/dist/esm/image.taro-142cf512.js +64 -0
- package/dist/esm/imagepreview.taro-c50bb0a3.js +167 -0
- package/dist/esm/index-5bcb0ff8.js +7 -0
- package/dist/esm/indicator.taro-cba8b010.js +37 -0
- package/dist/esm/infiniteloading.taro-183bccbf.js +144 -0
- package/dist/esm/input.taro-97af6c96.js +240 -0
- package/dist/esm/inputnumber.taro-91f65d17.js +130 -0
- package/dist/esm/layout.taro-9046d093.js +11 -0
- package/dist/esm/menu.taro-7e4038a1.js +99 -0
- package/dist/esm/menuitem.taro-96cc4f15.js +130 -0
- package/dist/esm/navbar.taro-777c4705.js +79 -0
- package/dist/esm/noticebar.taro-4a23cdee.js +448 -0
- package/dist/esm/notify.taro-e17c6f82.js +75 -0
- package/dist/esm/numberkeyboard.taro-1bc24744.js +159 -0
- package/dist/esm/nutui-react.es.js +119 -94
- package/dist/esm/offsetContext-c2a746fa.js +5 -0
- package/dist/esm/overlay.taro-21e87fb1.js +69 -0
- package/dist/esm/pagination.taro-715a173b.js +124 -0
- package/dist/esm/picker.taro-0073eeaa.js +472 -0
- package/dist/esm/popover.taro-ad5e76ea.js +156 -0
- package/dist/esm/popup.taro-01676bff.js +137 -0
- package/dist/esm/price.taro-776ed16e.js +83 -0
- package/dist/esm/progress.taro-f0ce38e9.js +90 -0
- package/dist/esm/pulltorefresh.taro-a294f656.js +181 -0
- package/dist/esm/radio.taro-a6eff96c.js +168 -0
- package/dist/esm/range.taro-d8fc7656.js +332 -0
- package/dist/esm/rate.taro-6cdf03bd.js +75 -0
- package/dist/esm/row.taro-f64d4a13.js +46 -0
- package/dist/esm/searchbar.taro-0c25927b.js +152 -0
- package/dist/esm/shortpassword.taro-9ee034f7.js +111 -0
- package/dist/esm/sidenavbar.taro-c307b35e.js +35 -0
- package/dist/esm/sidenavbaritem.taro-5a7965d0.js +12 -0
- package/dist/esm/signature.taro-ec4e713b.js +143 -0
- package/dist/esm/skeleton.taro-76faf63f.js +62 -0
- package/dist/esm/step.taro-b7903e8c.js +59 -0
- package/dist/esm/steps.taro-c82d2252.js +30 -0
- package/dist/esm/sticky.taro-218bda37.js +138 -0
- package/dist/esm/subsidenavbar.taro-69cb9752.js +63 -0
- package/dist/esm/supports-passive-c85ef996.js +18 -0
- package/dist/esm/swipe.taro-ea35f07f.js +177 -0
- package/dist/esm/swiper.taro-7a94e211.js +451 -0
- package/dist/esm/swiperitem-c9e3d0d5.js +29 -0
- package/dist/esm/switch.taro-34ca8228.js +50 -0
- package/dist/esm/tabbar.taro-9acfc2fa.js +59 -0
- package/dist/esm/tabbaritem.taro-bf517487.js +58 -0
- package/dist/esm/table.taro-91fc0c01.js +93 -0
- package/dist/esm/tabpane.taro-4ca340ef.js +23 -0
- package/dist/esm/tabs.taro-6a7524a4.js +140 -0
- package/dist/esm/tag.taro-23ba0834.js +92 -0
- package/dist/esm/textarea.taro-442e7350.js +94 -0
- package/dist/esm/timedetail.taro-5b2f2269.js +44 -0
- package/dist/esm/timepannel.taro-d6e40180.js +22 -0
- package/dist/esm/timeselect.taro-a07036f4.js +133 -0
- package/dist/esm/toast.taro-d6c14811.js +109 -0
- package/dist/esm/trendarrow.taro-b8c5ccd9.js +73 -0
- package/dist/esm/typings-b9828dba.js +9 -0
- package/dist/esm/uploader.taro-587e6bf3.js +492 -0
- package/dist/esm/useClientRect-1f8ed1fe.js +18 -0
- package/dist/esm/useTouch-db24bb5c.js +69 -0
- package/dist/esm/video-f1be8a91.js +67 -0
- package/dist/esm/virtuallist.taro-f0b0270d.js +214 -0
- package/dist/esm/watermark.taro-9ce2ae37.js +114 -0
- package/dist/esm/zh-CN-c779e6c1.js +131 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.mjs +13028 -14863
- package/dist/nutui.react.umd.js +13027 -14864
- package/dist/style.mjs +1 -1
- package/dist/types/index.d.ts +176 -183
- package/package.json +1 -1
- package/dist/esm/cellgroup-fcc72767.js +0 -34
- package/dist/esm/checkbox-44e13cd0.js +0 -137
- package/dist/esm/date-c7aad4c0.js +0 -97
- package/dist/esm/formitem-8a73a5fb.js +0 -157
- package/dist/esm/get-scroll-parent-5f85dee8.js +0 -24
- package/dist/esm/icon-4ef1581c.js +0 -70
- package/dist/esm/index-030b7245.js +0 -11
- package/dist/esm/offsetContext-3ab00d40.js +0 -16
- package/dist/esm/overlay-de6c79d5.js +0 -83
- package/dist/esm/radio-9f141e6b.js +0 -118
- package/dist/esm/render-bbebb760.js +0 -79
- package/dist/esm/tabpane-01075e6c.js +0 -29
- package/dist/esm/tabs-e1b4e4b1.js +0 -181
- package/dist/esm/typings-f27b58f4.js +0 -8
- package/dist/esm/useClientRect-56bb675b.js +0 -39
- package/dist/esm/useTouch-cf73a407.js +0 -99
|
@@ -1,277 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (min !== undefined) {
|
|
15
|
-
ret = Math.max(position, min);
|
|
16
|
-
}
|
|
17
|
-
if (max !== undefined) {
|
|
18
|
-
ret = Math.min(ret, max);
|
|
19
|
-
}
|
|
20
|
-
return ret;
|
|
21
|
-
}
|
|
22
|
-
function rubberband(distance, dimension, constant) {
|
|
23
|
-
return distance * dimension * constant / (dimension + constant * distance);
|
|
24
|
-
}
|
|
25
|
-
function rubberbandIfOutOfBounds(position, min, max, dimension) {
|
|
26
|
-
var constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0.15;
|
|
27
|
-
if (constant === 0) return bound(position, min, max);
|
|
28
|
-
if (position < min) return -rubberband(min - position, dimension, constant) + min;
|
|
29
|
-
if (position > max) return +rubberband(position - max, dimension, constant) + max;
|
|
30
|
-
return position;
|
|
31
|
-
}
|
|
32
|
-
var sleep = function sleep(time) {
|
|
33
|
-
return new Promise(function (resolve) {
|
|
34
|
-
return setTimeout(resolve, time);
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
var passiveSupported = false;
|
|
38
|
-
if (canUseDom) {
|
|
39
|
-
try {
|
|
40
|
-
var opts = Object.defineProperty({}, 'passive', {
|
|
41
|
-
get: function get() {
|
|
42
|
-
passiveSupported = true;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
window.addEventListener('test-passive-supported', null, opts);
|
|
46
|
-
} catch (e) {
|
|
47
|
-
console.log(e);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
var defaultProps = {
|
|
51
|
-
className: '',
|
|
52
|
-
style: {},
|
|
53
|
-
pullingText: '',
|
|
54
|
-
canReleaseText: '',
|
|
55
|
-
refreshingText: '',
|
|
56
|
-
completeText: '',
|
|
57
|
-
completeDelay: 500,
|
|
58
|
-
disabled: false,
|
|
59
|
-
headHeight: 40,
|
|
60
|
-
threshold: 60,
|
|
61
|
-
onRefresh: function onRefresh() {}
|
|
62
|
-
};
|
|
63
|
-
var PullToRefresh = function PullToRefresh(p) {
|
|
64
|
-
var _useConfig = useConfig(),
|
|
65
|
-
locale = _useConfig.locale;
|
|
66
|
-
var props = _objectSpread(_objectSpread(_objectSpread({}, defaultProps), p), {
|
|
67
|
-
pullingText: p.pullingText || locale.pullToRefresh.pullingText,
|
|
68
|
-
canReleaseText: p.canReleaseText || locale.pullToRefresh.canReleaseText,
|
|
69
|
-
refreshingText: p.refreshingText || locale.pullToRefresh.refreshingText,
|
|
70
|
-
completeText: p.completeText || locale.pullToRefresh.completeText
|
|
71
|
-
});
|
|
72
|
-
var headHeight = props.headHeight;
|
|
73
|
-
var threshold = props.threshold;
|
|
74
|
-
var _useState = useState('pulling'),
|
|
75
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
76
|
-
status = _useState2[0],
|
|
77
|
-
setStatus = _useState2[1];
|
|
78
|
-
var _useSpring = useSpring(function () {
|
|
79
|
-
return {
|
|
80
|
-
from: {
|
|
81
|
-
height: 0
|
|
82
|
-
},
|
|
83
|
-
config: {
|
|
84
|
-
tension: 300,
|
|
85
|
-
friction: 30,
|
|
86
|
-
clamp: true
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}),
|
|
90
|
-
_useSpring2 = _slicedToArray(_useSpring, 2),
|
|
91
|
-
springStyles = _useSpring2[0],
|
|
92
|
-
api = _useSpring2[1];
|
|
93
|
-
var elementRef = useRef(null);
|
|
94
|
-
var pullingRef = useRef(false);
|
|
95
|
-
useEffect(function () {
|
|
96
|
-
var _elementRef$current;
|
|
97
|
-
(_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 ? void 0 : _elementRef$current.addEventListener('touchmove', function () {});
|
|
98
|
-
}, []);
|
|
99
|
-
function doRefresh() {
|
|
100
|
-
return _doRefresh.apply(this, arguments);
|
|
101
|
-
}
|
|
102
|
-
function _doRefresh() {
|
|
103
|
-
_doRefresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
104
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
105
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
106
|
-
case 0:
|
|
107
|
-
api.start({
|
|
108
|
-
height: headHeight
|
|
109
|
-
});
|
|
110
|
-
setStatus('refreshing');
|
|
111
|
-
_context3.prev = 2;
|
|
112
|
-
_context3.next = 5;
|
|
113
|
-
return props.onRefresh();
|
|
114
|
-
case 5:
|
|
115
|
-
setStatus('complete');
|
|
116
|
-
_context3.next = 12;
|
|
117
|
-
break;
|
|
118
|
-
case 8:
|
|
119
|
-
_context3.prev = 8;
|
|
120
|
-
_context3.t0 = _context3["catch"](2);
|
|
121
|
-
api.start({
|
|
122
|
-
to: function () {
|
|
123
|
-
var _to = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(next) {
|
|
124
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
125
|
-
while (1) switch (_context.prev = _context.next) {
|
|
126
|
-
case 0:
|
|
127
|
-
_context.next = 2;
|
|
128
|
-
return next({
|
|
129
|
-
height: 0
|
|
130
|
-
});
|
|
131
|
-
case 2:
|
|
132
|
-
setStatus('pulling');
|
|
133
|
-
case 3:
|
|
134
|
-
case "end":
|
|
135
|
-
return _context.stop();
|
|
136
|
-
}
|
|
137
|
-
}, _callee);
|
|
138
|
-
}));
|
|
139
|
-
function to(_x) {
|
|
140
|
-
return _to.apply(this, arguments);
|
|
141
|
-
}
|
|
142
|
-
return to;
|
|
143
|
-
}()
|
|
144
|
-
});
|
|
145
|
-
throw _context3.t0;
|
|
146
|
-
case 12:
|
|
147
|
-
if (!(props.completeDelay > 0)) {
|
|
148
|
-
_context3.next = 15;
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
_context3.next = 15;
|
|
152
|
-
return sleep(props.completeDelay);
|
|
153
|
-
case 15:
|
|
154
|
-
api.start({
|
|
155
|
-
to: function () {
|
|
156
|
-
var _to2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(next) {
|
|
157
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
158
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
159
|
-
case 0:
|
|
160
|
-
_context2.next = 2;
|
|
161
|
-
return next({
|
|
162
|
-
height: 0
|
|
163
|
-
});
|
|
164
|
-
case 2:
|
|
165
|
-
setStatus('pulling');
|
|
166
|
-
case 3:
|
|
167
|
-
case "end":
|
|
168
|
-
return _context2.stop();
|
|
169
|
-
}
|
|
170
|
-
}, _callee2);
|
|
171
|
-
}));
|
|
172
|
-
function to(_x2) {
|
|
173
|
-
return _to2.apply(this, arguments);
|
|
174
|
-
}
|
|
175
|
-
return to;
|
|
176
|
-
}()
|
|
177
|
-
});
|
|
178
|
-
case 16:
|
|
179
|
-
case "end":
|
|
180
|
-
return _context3.stop();
|
|
181
|
-
}
|
|
182
|
-
}, _callee3, null, [[2, 8]]);
|
|
183
|
-
}));
|
|
184
|
-
return _doRefresh.apply(this, arguments);
|
|
185
|
-
}
|
|
186
|
-
useDrag(function (state) {
|
|
187
|
-
if (status === 'refreshing' || status === 'complete') return;
|
|
188
|
-
var event = state.event;
|
|
189
|
-
// 最后一个事件,检查是否可以刷新或是否是开始状态(第一个状态也是最后一个状态)
|
|
190
|
-
if (state.last) {
|
|
191
|
-
pullingRef.current = false;
|
|
192
|
-
if (status === 'canRelease') {
|
|
193
|
-
doRefresh();
|
|
194
|
-
} else {
|
|
195
|
-
api.start({
|
|
196
|
-
height: 0
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
function getScrollTop(element) {
|
|
202
|
-
return 'scrollTop' in element ? element.scrollTop : element.scrollY;
|
|
203
|
-
}
|
|
204
|
-
// 手指位置
|
|
205
|
-
var _state$movement = _slicedToArray(state.movement, 2),
|
|
206
|
-
y = _state$movement[1];
|
|
207
|
-
// 第一个事件,并且手指位置大于0
|
|
208
|
-
if (state.first && y > 0) {
|
|
209
|
-
var target = state.event.target;
|
|
210
|
-
if (!target || !(target instanceof Element)) return;
|
|
211
|
-
var scrollParent = getScrollParent(target);
|
|
212
|
-
while (true) {
|
|
213
|
-
if (!scrollParent) return;
|
|
214
|
-
var scrollTop = getScrollTop(scrollParent);
|
|
215
|
-
if (scrollTop > 0) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
// 查找到 window 说明到顶了
|
|
219
|
-
if (scrollParent instanceof Window) {
|
|
220
|
-
break;
|
|
221
|
-
}
|
|
222
|
-
// 递归查找
|
|
223
|
-
scrollParent = getScrollParent(scrollParent.parentNode);
|
|
224
|
-
}
|
|
225
|
-
pullingRef.current = true;
|
|
226
|
-
}
|
|
227
|
-
if (!pullingRef.current) return;
|
|
228
|
-
if (event.cancelable) {
|
|
229
|
-
event.preventDefault();
|
|
230
|
-
}
|
|
231
|
-
event.stopPropagation();
|
|
232
|
-
var height = Math.max(rubberbandIfOutOfBounds(y, 0, 0, headHeight * 5, 0.5), 0);
|
|
233
|
-
api.start({
|
|
234
|
-
height: height
|
|
235
|
-
});
|
|
236
|
-
setStatus(height > threshold ? 'canRelease' : 'pulling');
|
|
237
|
-
}, {
|
|
238
|
-
pointer: {
|
|
239
|
-
touch: true
|
|
240
|
-
},
|
|
241
|
-
axis: 'y',
|
|
242
|
-
target: elementRef,
|
|
243
|
-
enabled: !props.disabled,
|
|
244
|
-
eventOptions: passiveSupported ? {
|
|
245
|
-
passive: false
|
|
246
|
-
} : false
|
|
247
|
-
});
|
|
248
|
-
var renderStatusText = function renderStatusText() {
|
|
249
|
-
if (props.renderText) {
|
|
250
|
-
var _props$renderText;
|
|
251
|
-
return (_props$renderText = props.renderText) === null || _props$renderText === void 0 ? void 0 : _props$renderText.call(props, status);
|
|
252
|
-
}
|
|
253
|
-
if (status === 'pulling') return props.pullingText;
|
|
254
|
-
if (status === 'canRelease') return props.canReleaseText;
|
|
255
|
-
if (status === 'refreshing') return props.refreshingText;
|
|
256
|
-
if (status === 'complete') return props.completeText;
|
|
257
|
-
return '';
|
|
258
|
-
};
|
|
259
|
-
return React__default.createElement(animated.div, {
|
|
260
|
-
ref: elementRef,
|
|
261
|
-
className: "nut-pulltorefresh ".concat(props.className),
|
|
262
|
-
style: props.style
|
|
263
|
-
}, React__default.createElement(animated.div, {
|
|
264
|
-
style: springStyles,
|
|
265
|
-
className: "nut-pulltorefresh-head"
|
|
266
|
-
}, React__default.createElement("div", {
|
|
267
|
-
className: "nut-pulltorefresh-head-content",
|
|
268
|
-
style: {
|
|
269
|
-
height: headHeight
|
|
270
|
-
}
|
|
271
|
-
}, renderStatusText())), React__default.createElement("div", {
|
|
272
|
-
className: "nut-pulltorefresh-content"
|
|
273
|
-
}, props.children));
|
|
274
|
-
};
|
|
275
|
-
PullToRefresh.defaultProps = defaultProps;
|
|
276
|
-
PullToRefresh.displayName = 'NutPullToRefresh';
|
|
1
|
+
import { P as PullToRefresh } from './pulltorefresh.taro-a294f656.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '@use-gesture/react';
|
|
4
|
+
import '@react-spring/web';
|
|
5
|
+
import './configprovider.taro-8d71eb49.js';
|
|
6
|
+
import 'lodash.kebabcase';
|
|
7
|
+
import './zh-CN-c779e6c1.js';
|
|
8
|
+
import './get-scroll-parent-b4a07e65.js';
|
|
9
|
+
import './can-use-dom-3eeb5af4.js';
|
|
10
|
+
import './supports-passive-c85ef996.js';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
277
14
|
export { PullToRefresh as default };
|
package/dist/esm/Radio.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { R as Radio } from './radio-
|
|
1
|
+
import { R as Radio } from './radio.taro-a6eff96c.js';
|
|
2
2
|
import 'react';
|
|
3
|
-
import './
|
|
4
|
-
import './
|
|
5
|
-
import '
|
|
3
|
+
import './icon.taro-296a1bec.js';
|
|
4
|
+
import './bem-350c1702.js';
|
|
5
|
+
import '@bem-react/classname';
|
|
6
|
+
import './typings-b9828dba.js';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
6
10
|
export { Radio as default };
|
package/dist/esm/RadioGroup.js
CHANGED
|
@@ -1,123 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
_excluded2 = ["label", "value", "disabled", "onChange"];
|
|
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, { useState, useEffect, useCallback } from 'react';
|
|
9
|
-
import { R as Radio, a as RadioContext } from './radio-9f141e6b.js';
|
|
10
|
-
import { c as cn } from './bem-3b438e61.js';
|
|
11
|
-
import './Icon.js';
|
|
12
|
-
import './RadioGroup.js';
|
|
13
|
-
import './typings-f27b58f4.js';
|
|
1
|
+
import { a as RadioGroup } from './radio.taro-a6eff96c.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import './icon.taro-296a1bec.js';
|
|
4
|
+
import './bem-350c1702.js';
|
|
14
5
|
import '@bem-react/classname';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
onChange: function onChange(value) {},
|
|
19
|
-
direction: 'vertical',
|
|
20
|
-
options: []
|
|
21
|
-
};
|
|
22
|
-
var RadioGroup = React__default.forwardRef(function (props, ref) {
|
|
23
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
24
|
-
children = _defaultProps$props.children;
|
|
25
|
-
cn('RadioGroup');
|
|
26
|
-
var className = props.className,
|
|
27
|
-
value = props.value,
|
|
28
|
-
_onChange = props.onChange,
|
|
29
|
-
textPosition = props.textPosition,
|
|
30
|
-
direction = props.direction,
|
|
31
|
-
options = props.options,
|
|
32
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
33
|
-
var _useState = useState(value),
|
|
34
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
-
val2State = _useState2[0],
|
|
36
|
-
setVal2State = _useState2[1];
|
|
37
|
-
// useImperativeHandle(ref, () => ({
|
|
38
|
-
// toggleAll(state: boolean) {
|
|
39
|
-
// console.log(state)
|
|
40
|
-
// if (state === false) {
|
|
41
|
-
// setInnerValue([])
|
|
42
|
-
// } else {
|
|
43
|
-
// const childrenLabel: string[] = []
|
|
44
|
-
// React.Children.map(children, (child) => {
|
|
45
|
-
// const childProps = (child as any).props
|
|
46
|
-
// childrenLabel.push(childProps.label || (child as any).children)
|
|
47
|
-
// })
|
|
48
|
-
// setInnerValue(childrenLabel)
|
|
49
|
-
// }
|
|
50
|
-
// },
|
|
51
|
-
// }))
|
|
52
|
-
useEffect(function () {
|
|
53
|
-
setVal2State(value);
|
|
54
|
-
}, [value]);
|
|
55
|
-
// function handleChildChange(state: boolean, label: string) {
|
|
56
|
-
// if (innerValue) {
|
|
57
|
-
// let clippedValue = []
|
|
58
|
-
// if (state) {
|
|
59
|
-
// clippedValue = [...innerValue, label]
|
|
60
|
-
// } else {
|
|
61
|
-
// innerValue?.splice(innerValue?.indexOf(label), 1)
|
|
62
|
-
// clippedValue = [...innerValue]
|
|
63
|
-
// }
|
|
64
|
-
// setInnerValue(clippedValue)
|
|
65
|
-
// onChange && onChange(clippedValue)
|
|
66
|
-
// }
|
|
67
|
-
// }
|
|
68
|
-
function validateChildChecked(child) {
|
|
69
|
-
if (val2State === null) return false;
|
|
70
|
-
return val2State === child.props.value;
|
|
71
|
-
}
|
|
72
|
-
function validateChecked(value) {
|
|
73
|
-
if (val2State === null) return false;
|
|
74
|
-
return val2State === value;
|
|
75
|
-
}
|
|
76
|
-
function cloneChildren() {
|
|
77
|
-
return React__default.Children.map(children, function (child, index) {
|
|
78
|
-
var childChecked = validateChildChecked(child);
|
|
79
|
-
if (child.type.displayName !== 'NutRadio') {
|
|
80
|
-
return React__default.cloneElement(child);
|
|
81
|
-
}
|
|
82
|
-
return React__default.cloneElement(child, {
|
|
83
|
-
textPosition: textPosition,
|
|
84
|
-
checked: childChecked
|
|
85
|
-
// onChange: handleChildChange,
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
}
|
|
6
|
+
import './typings-b9828dba.js';
|
|
7
|
+
|
|
8
|
+
|
|
89
9
|
|
|
90
|
-
var renderOptionsChildren = useCallback(function () {
|
|
91
|
-
return options === null || options === void 0 ? void 0 : options.map(function (_ref) {
|
|
92
|
-
var label = _ref.label,
|
|
93
|
-
value = _ref.value,
|
|
94
|
-
disabled = _ref.disabled,
|
|
95
|
-
onChange = _ref.onChange,
|
|
96
|
-
rest = _objectWithoutProperties(_ref, _excluded2);
|
|
97
|
-
var childChecked = validateChecked(value);
|
|
98
|
-
return React__default.createElement(Radio, _objectSpread(_objectSpread({
|
|
99
|
-
key: value === null || value === void 0 ? void 0 : value.toString(),
|
|
100
|
-
children: label,
|
|
101
|
-
value: value,
|
|
102
|
-
disabled: disabled,
|
|
103
|
-
onChange: onChange
|
|
104
|
-
}, rest), {}, {
|
|
105
|
-
textPosition: textPosition,
|
|
106
|
-
checked: childChecked
|
|
107
|
-
}));
|
|
108
|
-
});
|
|
109
|
-
}, [val2State, options]);
|
|
110
|
-
return React__default.createElement(RadioContext.Provider, {
|
|
111
|
-
value: {
|
|
112
|
-
onChange: function onChange(val) {
|
|
113
|
-
setVal2State(val);
|
|
114
|
-
_onChange && _onChange(val);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}, React__default.createElement("div", _objectSpread({
|
|
118
|
-
className: "nut-radiogroup nut-radiogroup--".concat(props.direction, " ").concat(className || '')
|
|
119
|
-
}, rest), options !== null && options !== void 0 && options.length ? renderOptionsChildren() : cloneChildren()));
|
|
120
|
-
});
|
|
121
|
-
RadioGroup.defaultProps = defaultProps;
|
|
122
|
-
RadioGroup.displayName = 'NutRadioGroup';
|
|
123
10
|
export { RadioGroup as default };
|