@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
package/dist/esm/Animate.js
CHANGED
|
@@ -1,55 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
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, { useState } from 'react';
|
|
8
|
-
import classNames from 'classnames';
|
|
9
|
-
import { c as cn } from './bem-3b438e61.js';
|
|
1
|
+
import { A as Animate } from './animate.taro-fb7986d6.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'classnames';
|
|
4
|
+
import './bem-350c1702.js';
|
|
10
5
|
import '@bem-react/classname';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
loop: false,
|
|
15
|
-
onClick: function onClick(event) {}
|
|
16
|
-
};
|
|
17
|
-
var Animate = function Animate(props) {
|
|
18
|
-
var _classNames;
|
|
19
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
20
|
-
className = _defaultProps$props.className,
|
|
21
|
-
type = _defaultProps$props.type,
|
|
22
|
-
action = _defaultProps$props.action,
|
|
23
|
-
loop = _defaultProps$props.loop,
|
|
24
|
-
onClick = _defaultProps$props.onClick,
|
|
25
|
-
children = _defaultProps$props.children,
|
|
26
|
-
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
27
|
-
var _useState = useState(false),
|
|
28
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
-
clicked = _useState2[0],
|
|
30
|
-
setClicked = _useState2[1];
|
|
31
|
-
var b = cn('animate');
|
|
32
|
-
var classes = classNames((_classNames = {
|
|
33
|
-
'nut-ani-container': true
|
|
34
|
-
}, _defineProperty(_classNames, "".concat(b(''), "-").concat(type), action === 'initial' || clicked ? type : false), _defineProperty(_classNames, "loop", loop), _classNames));
|
|
35
|
-
var cls = classNames(classes, className);
|
|
36
|
-
var handleClick = function handleClick(event) {
|
|
37
|
-
setClicked(true);
|
|
38
|
-
// 如果不是无限循环,清除类名
|
|
39
|
-
if (!loop) {
|
|
40
|
-
setTimeout(function () {
|
|
41
|
-
setClicked(false);
|
|
42
|
-
}, 1000);
|
|
43
|
-
}
|
|
44
|
-
onClick && onClick(event);
|
|
45
|
-
};
|
|
46
|
-
return React__default.createElement("div", {
|
|
47
|
-
className: "nut-animate"
|
|
48
|
-
}, React__default.createElement("div", _objectSpread({
|
|
49
|
-
className: cls,
|
|
50
|
-
onClick: handleClick
|
|
51
|
-
}, rest), children));
|
|
52
|
-
};
|
|
53
|
-
Animate.defaultProps = defaultProps;
|
|
54
|
-
Animate.displayName = 'NutAnimate';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
55
9
|
export { Animate as default };
|
|
@@ -1,127 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
8
|
-
var _excluded = ["maxLen", "endNumber", "delaySpeed", "easeSpeed", "className", "thousands"];
|
|
9
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
|
-
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; }
|
|
12
|
-
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; }
|
|
13
|
-
import React__default, { useRef, useMemo, useEffect, Component } from 'react';
|
|
14
|
-
import { c as cn } from './bem-3b438e61.js';
|
|
1
|
+
import { A as AnimatingNumbers } from './animatingnumbers.taro-03e5d61d.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '@tarojs/taro';
|
|
4
|
+
import './bem-350c1702.js';
|
|
15
5
|
import '@bem-react/classname';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
delaySpeed: 300,
|
|
20
|
-
easeSpeed: 1,
|
|
21
|
-
thousands: false,
|
|
22
|
-
className: ''
|
|
23
|
-
};
|
|
24
|
-
var CountUp = function CountUp(props) {
|
|
25
|
-
var _defaultProps$1$props = _objectSpread(_objectSpread({}, defaultProps$1), props),
|
|
26
|
-
maxLen = _defaultProps$1$props.maxLen,
|
|
27
|
-
endNumber = _defaultProps$1$props.endNumber,
|
|
28
|
-
delaySpeed = _defaultProps$1$props.delaySpeed,
|
|
29
|
-
easeSpeed = _defaultProps$1$props.easeSpeed,
|
|
30
|
-
className = _defaultProps$1$props.className,
|
|
31
|
-
thousands = _defaultProps$1$props.thousands,
|
|
32
|
-
reset = _objectWithoutProperties(_defaultProps$1$props, _excluded);
|
|
33
|
-
var b = cn('countup');
|
|
34
|
-
var countupRef = useRef(null);
|
|
35
|
-
var timerRef = useRef(0);
|
|
36
|
-
var numbers = Array.from({
|
|
37
|
-
length: 10
|
|
38
|
-
}, function (v, i) {
|
|
39
|
-
return i;
|
|
40
|
-
});
|
|
41
|
-
var getShowNumber = function getShowNumber() {
|
|
42
|
-
var splitArr = endNumber.split('.');
|
|
43
|
-
var intNumber = maxLen && splitArr[0].length < maxLen ? (Array(maxLen).join('0') + splitArr[0]).slice(-maxLen) : splitArr[0];
|
|
44
|
-
var currNumber = "".concat(thousands ? intNumber.replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') : intNumber).concat(splitArr[1] ? '.' : '').concat(splitArr[1] || '');
|
|
45
|
-
return currNumber.split('');
|
|
46
|
-
};
|
|
47
|
-
var numerArr = useMemo(getShowNumber, [endNumber, maxLen, thousands]);
|
|
48
|
-
var setNumberTransform = function setNumberTransform() {
|
|
49
|
-
if (countupRef.current) {
|
|
50
|
-
var numberItems = countupRef.current.querySelectorAll('.nut-countup__number');
|
|
51
|
-
var numberFilterArr = numerArr.filter(function (item) {
|
|
52
|
-
return !Number.isNaN(Number(item));
|
|
53
|
-
});
|
|
54
|
-
Object.keys(numberItems).forEach(function (key) {
|
|
55
|
-
var elem = numberItems[Number(key)];
|
|
56
|
-
var idx = Number(numberFilterArr[Number(key)]);
|
|
57
|
-
if ((idx || idx === 0) && elem) {
|
|
58
|
-
// 计算规则:父元素和实际列表高度的百分比,分割成20等份
|
|
59
|
-
var transform = "translate(0, -".concat((idx === 0 ? 10 : idx) * 5, "%)");
|
|
60
|
-
elem.style.transform = transform;
|
|
61
|
-
elem.style.webkitTransform = transform;
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
var numberEaseStyle = {
|
|
67
|
-
transition: "transform ".concat(easeSpeed, "s ease-in-out")
|
|
68
|
-
};
|
|
69
|
-
useEffect(function () {
|
|
70
|
-
timerRef.current = window.setTimeout(function () {
|
|
71
|
-
setNumberTransform();
|
|
72
|
-
}, delaySpeed);
|
|
73
|
-
return function () {
|
|
74
|
-
window.clearTimeout(timerRef.current);
|
|
75
|
-
};
|
|
76
|
-
}, [numerArr]);
|
|
77
|
-
return React__default.createElement("div", {
|
|
78
|
-
className: "".concat(b(), " ").concat(className),
|
|
79
|
-
ref: countupRef
|
|
80
|
-
}, React__default.createElement("ul", {
|
|
81
|
-
className: b('list')
|
|
82
|
-
}, numerArr.map(function (item, idx) {
|
|
83
|
-
return React__default.createElement("li", {
|
|
84
|
-
className: "".concat(b('listitem', {
|
|
85
|
-
number: !Number.isNaN(Number(item))
|
|
86
|
-
})),
|
|
87
|
-
key: idx
|
|
88
|
-
}, !Number.isNaN(Number(item)) ? React__default.createElement("span", {
|
|
89
|
-
className: b('number'),
|
|
90
|
-
style: numberEaseStyle
|
|
91
|
-
}, [].concat(numbers, numbers).map(function (number, subidx) {
|
|
92
|
-
return React__default.createElement("span", {
|
|
93
|
-
key: subidx
|
|
94
|
-
}, number);
|
|
95
|
-
})) : React__default.createElement("span", {
|
|
96
|
-
className: b('separator')
|
|
97
|
-
}, item));
|
|
98
|
-
})));
|
|
99
|
-
};
|
|
100
|
-
CountUp.defaultProps = defaultProps$1;
|
|
101
|
-
CountUp.displayName = 'NutCountUp';
|
|
102
|
-
var defaultProps = {};
|
|
103
|
-
var AnimatingNumbers = /*#__PURE__*/function (_Component) {
|
|
104
|
-
_inherits(AnimatingNumbers, _Component);
|
|
105
|
-
var _super = _createSuper(AnimatingNumbers);
|
|
106
|
-
function AnimatingNumbers(props) {
|
|
107
|
-
var _this;
|
|
108
|
-
_classCallCheck(this, AnimatingNumbers);
|
|
109
|
-
_this = _super.call(this, props);
|
|
110
|
-
_this.state = {};
|
|
111
|
-
return _this;
|
|
112
|
-
}
|
|
113
|
-
_createClass(AnimatingNumbers, [{
|
|
114
|
-
key: "render",
|
|
115
|
-
value: function render() {
|
|
116
|
-
return React__default.createElement("div", {
|
|
117
|
-
className: "nut-animatingnumbers"
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
}]);
|
|
121
|
-
return AnimatingNumbers;
|
|
122
|
-
}(Component);
|
|
123
|
-
_defineProperty(AnimatingNumbers, "defaultProps", defaultProps);
|
|
124
|
-
_defineProperty(AnimatingNumbers, "displayName", 'NutAnimatingNumbers');
|
|
125
|
-
_defineProperty(AnimatingNumbers, "CountUp", CountUp);
|
|
126
|
-
AnimatingNumbers.CountUp = CountUp;
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
127
9
|
export { AnimatingNumbers as default };
|
package/dist/esm/Audio.js
CHANGED
|
@@ -1,266 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
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, { useState, useRef, useEffect } from 'react';
|
|
8
|
-
import Icon from './Icon.js';
|
|
9
|
-
import Range from './Range.js';
|
|
10
|
-
import { c as cn } from './bem-3b438e61.js';
|
|
11
|
-
import Button from './Button.js';
|
|
12
|
-
import { useConfig } from './ConfigProvider.js';
|
|
13
|
-
import { C as ComponentDefaults } from './typings-f27b58f4.js';
|
|
1
|
+
import { A as Audio } from './audio.taro-87ec8bf2.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '@tarojs/taro';
|
|
4
|
+
import './icon.taro-296a1bec.js';
|
|
5
|
+
import './bem-350c1702.js';
|
|
14
6
|
import '@bem-react/classname';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
onCanPlay: function onCanPlay(e) {}
|
|
30
|
-
});
|
|
31
|
-
var Audio = function Audio(props) {
|
|
32
|
-
var _useConfig = useConfig(),
|
|
33
|
-
locale = _useConfig.locale;
|
|
34
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
35
|
-
className = _defaultProps$props.className,
|
|
36
|
-
url = _defaultProps$props.url,
|
|
37
|
-
style = _defaultProps$props.style,
|
|
38
|
-
muted = _defaultProps$props.muted,
|
|
39
|
-
autoplay = _defaultProps$props.autoplay,
|
|
40
|
-
loop = _defaultProps$props.loop,
|
|
41
|
-
preload = _defaultProps$props.preload,
|
|
42
|
-
type = _defaultProps$props.type,
|
|
43
|
-
onFastBack = _defaultProps$props.onFastBack,
|
|
44
|
-
onForward = _defaultProps$props.onForward,
|
|
45
|
-
onPause = _defaultProps$props.onPause,
|
|
46
|
-
onPlayEnd = _defaultProps$props.onPlayEnd,
|
|
47
|
-
onMute = _defaultProps$props.onMute,
|
|
48
|
-
onCanPlay = _defaultProps$props.onCanPlay,
|
|
49
|
-
children = _defaultProps$props.children,
|
|
50
|
-
iconClassPrefix = _defaultProps$props.iconClassPrefix,
|
|
51
|
-
iconFontClassName = _defaultProps$props.iconFontClassName,
|
|
52
|
-
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
53
|
-
var _useState = useState(false),
|
|
54
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
55
|
-
playing = _useState2[0],
|
|
56
|
-
setPlaying = _useState2[1];
|
|
57
|
-
var _useState3 = useState(0),
|
|
58
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
59
|
-
percent = _useState4[0],
|
|
60
|
-
setPercent = _useState4[1];
|
|
61
|
-
var _useState5 = useState(false),
|
|
62
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
63
|
-
isCanPlay = _useState6[0],
|
|
64
|
-
setIsCanPlay = _useState6[1];
|
|
65
|
-
var _useState7 = useState('00:00:00'),
|
|
66
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
67
|
-
currentDuration = _useState8[0],
|
|
68
|
-
setCurrentDuration = _useState8[1];
|
|
69
|
-
var AudioRef = useRef(null);
|
|
70
|
-
var statusRef = useRef({
|
|
71
|
-
currentTime: 0,
|
|
72
|
-
currentDuration: '00:00:00',
|
|
73
|
-
percent: 0,
|
|
74
|
-
duration: '00:00:00',
|
|
75
|
-
second: 0,
|
|
76
|
-
hanMuted: props.muted,
|
|
77
|
-
playing: props.autoplay,
|
|
78
|
-
handPlaying: false
|
|
79
|
-
});
|
|
80
|
-
var b = cn('audio');
|
|
81
|
-
var warn = console.warn;
|
|
82
|
-
var handleEnded = function handleEnded(e) {
|
|
83
|
-
if (props.loop) {
|
|
84
|
-
warn(locale.audio.tips || 'onPlayEnd事件在loop=false时才会触发');
|
|
85
|
-
} else {
|
|
86
|
-
props.onPlayEnd && props.onPlayEnd(e);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
function watch() {
|
|
90
|
-
if (AudioRef && AudioRef.current) {
|
|
91
|
-
var current = AudioRef.current;
|
|
92
|
-
current.addEventListener('play', function () {
|
|
93
|
-
setPlaying(true);
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
useEffect(function () {
|
|
98
|
-
watch();
|
|
99
|
-
}, []);
|
|
100
|
-
useEffect(function () {}, [currentDuration]);
|
|
101
|
-
var handleStatusChange = function handleStatusChange() {
|
|
102
|
-
setPlaying(!playing);
|
|
103
|
-
if (playing) {
|
|
104
|
-
AudioRef && AudioRef.current && AudioRef.current.pause();
|
|
105
|
-
} else {
|
|
106
|
-
AudioRef && AudioRef.current && AudioRef.current.play();
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
var renderIcon = function renderIcon() {
|
|
110
|
-
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
111
|
-
className: b('icon')
|
|
112
|
-
}, React__default.createElement("div", {
|
|
113
|
-
className: "".concat(b('icon-box'), " ").concat(playing ? b('icon-play') : b('icon-stop')),
|
|
114
|
-
onClick: handleStatusChange
|
|
115
|
-
}, playing ? React__default.createElement(Icon, {
|
|
116
|
-
classPrefix: iconClassPrefix,
|
|
117
|
-
fontClassName: iconFontClassName,
|
|
118
|
-
name: "service",
|
|
119
|
-
className: "nut-icon-loading"
|
|
120
|
-
}) : React__default.createElement(Icon, {
|
|
121
|
-
classPrefix: iconClassPrefix,
|
|
122
|
-
fontClassName: iconFontClassName,
|
|
123
|
-
name: "service"
|
|
124
|
-
}))));
|
|
125
|
-
};
|
|
126
|
-
var handleBack = function handleBack() {
|
|
127
|
-
if (statusRef.current.currentTime > 0 && AudioRef.current) {
|
|
128
|
-
statusRef.current.currentTime--;
|
|
129
|
-
AudioRef.current.currentTime = statusRef.current.currentTime;
|
|
130
|
-
props.onFastBack && props.onFastBack(AudioRef.current);
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
var handleForward = function handleForward() {
|
|
134
|
-
if (AudioRef.current) {
|
|
135
|
-
statusRef.current.currentTime++;
|
|
136
|
-
AudioRef.current.currentTime = statusRef.current.currentTime;
|
|
137
|
-
props.onForward && props.onForward(AudioRef.current);
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
var handleMute = function handleMute() {
|
|
141
|
-
if (AudioRef.current) {
|
|
142
|
-
AudioRef.current.muted = !AudioRef.current.muted;
|
|
143
|
-
props.onMute && props.onMute(AudioRef.current);
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
var handlePause = function handlePause(e) {
|
|
147
|
-
setPlaying(false);
|
|
148
|
-
props.onPause && props.onPause(e);
|
|
149
|
-
};
|
|
150
|
-
var formatSeconds = function formatSeconds(value) {
|
|
151
|
-
if (!value) {
|
|
152
|
-
return '00:00:00';
|
|
153
|
-
}
|
|
154
|
-
var time = parseInt(value);
|
|
155
|
-
var hours = Math.floor(time / 3600);
|
|
156
|
-
var minutes = Math.floor((time - hours * 3600) / 60);
|
|
157
|
-
var seconds = time - hours * 3600 - minutes * 60;
|
|
158
|
-
var result = '';
|
|
159
|
-
result += "".concat("0".concat(hours.toString()).slice(-2), ":");
|
|
160
|
-
result += "".concat("0".concat(minutes.toString()).slice(-2), ":");
|
|
161
|
-
result += "0".concat(seconds.toString()).slice(-2);
|
|
162
|
-
return result;
|
|
163
|
-
};
|
|
164
|
-
var renderProgerss = function renderProgerss() {
|
|
165
|
-
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
166
|
-
className: b('progress')
|
|
167
|
-
}, React__default.createElement("div", {
|
|
168
|
-
className: "time"
|
|
169
|
-
}, currentDuration), React__default.createElement("div", {
|
|
170
|
-
className: b('progress-bar-wrapper')
|
|
171
|
-
}, React__default.createElement(Range, {
|
|
172
|
-
modelValue: percent,
|
|
173
|
-
hiddenTag: true,
|
|
174
|
-
hiddenRange: true,
|
|
175
|
-
"inactive-color": "#cccccc",
|
|
176
|
-
"active-color": "#fa2c19"
|
|
177
|
-
})), React__default.createElement("div", {
|
|
178
|
-
className: "time"
|
|
179
|
-
}, AudioRef.current ? formatSeconds("".concat(statusRef.current.second)) : '00:00:00')), React__default.createElement("div", {
|
|
180
|
-
className: isCanPlay ? 'custom-button-group' : 'custom-button-group-disable'
|
|
181
|
-
}, React__default.createElement(Button, {
|
|
182
|
-
type: "primary",
|
|
183
|
-
size: "small",
|
|
184
|
-
className: "back",
|
|
185
|
-
onClick: handleBack
|
|
186
|
-
}, locale.audio.back || '快退'), React__default.createElement(Button, {
|
|
187
|
-
type: "primary",
|
|
188
|
-
size: "small",
|
|
189
|
-
className: "start",
|
|
190
|
-
onClick: handleStatusChange
|
|
191
|
-
}, playing ? "".concat(locale.audio.pause || '暂停') : "".concat(locale.audio.start || '开始')), React__default.createElement(Button, {
|
|
192
|
-
type: "primary",
|
|
193
|
-
size: "small",
|
|
194
|
-
onClick: handleForward
|
|
195
|
-
}, locale.audio.forward || '快进'), React__default.createElement(Button, {
|
|
196
|
-
type: AudioRef.current && AudioRef.current.muted ? 'default' : 'primary',
|
|
197
|
-
size: "small",
|
|
198
|
-
onClick: handleMute
|
|
199
|
-
}, locale.audio.mute || '静音')));
|
|
200
|
-
};
|
|
201
|
-
var renderNone = function renderNone() {
|
|
202
|
-
return React__default.createElement("div", {
|
|
203
|
-
className: b('none-container'),
|
|
204
|
-
onClick: handleStatusChange
|
|
205
|
-
}, children);
|
|
206
|
-
};
|
|
207
|
-
var renderAudio = function renderAudio() {
|
|
208
|
-
switch (type) {
|
|
209
|
-
case 'icon':
|
|
210
|
-
return renderIcon();
|
|
211
|
-
case 'progress':
|
|
212
|
-
return renderProgerss();
|
|
213
|
-
case 'none':
|
|
214
|
-
return renderNone();
|
|
215
|
-
default:
|
|
216
|
-
return null;
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
var handleCanplay = function handleCanplay(e) {
|
|
220
|
-
setIsCanPlay(true);
|
|
221
|
-
if (props.autoplay && !playing) {
|
|
222
|
-
AudioRef && AudioRef.current && AudioRef.current.play();
|
|
223
|
-
}
|
|
224
|
-
if (AudioRef.current) {
|
|
225
|
-
statusRef.current.second = AudioRef.current.duration || 0;
|
|
226
|
-
props.onCanPlay && props.onCanPlay(e);
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
var onTimeupdate = function onTimeupdate(e) {
|
|
230
|
-
var time = parseInt(e.target.currentTime);
|
|
231
|
-
var formated = formatSeconds("".concat(time));
|
|
232
|
-
statusRef.current.currentDuration = formated;
|
|
233
|
-
setPercent(time / statusRef.current.second * 100);
|
|
234
|
-
setCurrentDuration(formated);
|
|
235
|
-
statusRef.current.currentTime = time;
|
|
236
|
-
};
|
|
237
|
-
return React__default.createElement("div", _objectSpread({
|
|
238
|
-
className: "".concat(b(), " ").concat(className),
|
|
239
|
-
style: style
|
|
240
|
-
}, rest), renderAudio(), React__default.createElement("audio", {
|
|
241
|
-
className: "audioMain",
|
|
242
|
-
controls: type === 'controls',
|
|
243
|
-
ref: AudioRef,
|
|
244
|
-
src: url,
|
|
245
|
-
muted: muted,
|
|
246
|
-
preload: preload,
|
|
247
|
-
loop: loop,
|
|
248
|
-
onPause: function onPause(e) {
|
|
249
|
-
return handlePause(e);
|
|
250
|
-
},
|
|
251
|
-
onEnded: function onEnded(e) {
|
|
252
|
-
return handleEnded(e);
|
|
253
|
-
},
|
|
254
|
-
onCanPlay: function onCanPlay(e) {
|
|
255
|
-
return handleCanplay(e);
|
|
256
|
-
},
|
|
257
|
-
onTimeUpdate: function onTimeUpdate(e) {
|
|
258
|
-
return onTimeupdate(e);
|
|
259
|
-
}
|
|
260
|
-
}, React__default.createElement("track", {
|
|
261
|
-
kind: "captions"
|
|
262
|
-
})));
|
|
263
|
-
};
|
|
264
|
-
Audio.defaultProps = defaultProps;
|
|
265
|
-
Audio.displayName = 'NutAudio';
|
|
7
|
+
import './range.taro-d8fc7656.js';
|
|
8
|
+
import './useTouch-db24bb5c.js';
|
|
9
|
+
import './useClientRect-1f8ed1fe.js';
|
|
10
|
+
import './toast.taro-d6c14811.js';
|
|
11
|
+
import 'classnames';
|
|
12
|
+
import './icon-296a1bec.js';
|
|
13
|
+
import './configprovider.taro-8d71eb49.js';
|
|
14
|
+
import 'lodash.kebabcase';
|
|
15
|
+
import './zh-CN-c779e6c1.js';
|
|
16
|
+
import './button.taro-9244d065.js';
|
|
17
|
+
import './typings-b9828dba.js';
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
266
21
|
export { Audio as default };
|
package/dist/esm/Avatar.js
CHANGED
|
@@ -1,132 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import React__default, { useState, useRef, useContext, useEffect } from 'react';
|
|
8
|
-
import classNames from 'classnames';
|
|
9
|
-
import { A as AvatarContext } from './AvatarContext-15733596.js';
|
|
10
|
-
import { c as cn } from './bem-3b438e61.js';
|
|
11
|
-
import Icon from './Icon.js';
|
|
12
|
-
import { C as ComponentDefaults } from './typings-f27b58f4.js';
|
|
1
|
+
import { A as Avatar } from './avatar.taro-3676f38f.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'classnames';
|
|
4
|
+
import '@tarojs/components';
|
|
5
|
+
import './AvatarContext-c96afdcc.js';
|
|
6
|
+
import './bem-350c1702.js';
|
|
13
7
|
import '@bem-react/classname';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
color: '#666',
|
|
20
|
-
prefixCls: 'nut-avatar',
|
|
21
|
-
url: '',
|
|
22
|
-
alt: ''
|
|
23
|
-
});
|
|
24
|
-
var Avatar = function Avatar(props) {
|
|
25
|
-
var _parent$propAvatarGro, _parent$propAvatarGro2, _classNames, _parent$propAvatarGro3, _parent$propAvatarGro4, _parent$propAvatarGro5, _parent$propAvatarGro6, _parent$propAvatarGro7, _parent$propAvatarGro9, _parent$propAvatarGro10, _parent$propAvatarGro11, _parent$propAvatarGro12, _parent$propAvatarGro13, _parent$propAvatarGro14, _parent$propAvatarGro15;
|
|
26
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
27
|
-
children = _defaultProps$props.children,
|
|
28
|
-
prefixCls = _defaultProps$props.prefixCls,
|
|
29
|
-
size = _defaultProps$props.size,
|
|
30
|
-
shape = _defaultProps$props.shape,
|
|
31
|
-
bgColor = _defaultProps$props.bgColor,
|
|
32
|
-
color = _defaultProps$props.color,
|
|
33
|
-
url = _defaultProps$props.url,
|
|
34
|
-
alt = _defaultProps$props.alt,
|
|
35
|
-
icon = _defaultProps$props.icon,
|
|
36
|
-
iconSize = _defaultProps$props.iconSize,
|
|
37
|
-
className = _defaultProps$props.className,
|
|
38
|
-
style = _defaultProps$props.style,
|
|
39
|
-
activeAvatar = _defaultProps$props.activeAvatar,
|
|
40
|
-
onActiveAvatar = _defaultProps$props.onActiveAvatar,
|
|
41
|
-
onError = _defaultProps$props.onError,
|
|
42
|
-
iconClassPrefix = _defaultProps$props.iconClassPrefix,
|
|
43
|
-
iconFontClassName = _defaultProps$props.iconFontClassName,
|
|
44
|
-
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
45
|
-
var _useState = useState(0),
|
|
46
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
-
maxSum = _useState2[0],
|
|
48
|
-
setMaxSum = _useState2[1]; // avatarGroup里的avatar的个数
|
|
49
|
-
var _useState3 = useState(false),
|
|
50
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
51
|
-
showMax = _useState4[0],
|
|
52
|
-
setShowMax = _useState4[1]; // 是否显示的最大头像个数
|
|
53
|
-
var _useState5 = useState(1),
|
|
54
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
55
|
-
avatarIndex = _useState6[0],
|
|
56
|
-
setAvatarIndex = _useState6[1]; // avatar的索引
|
|
57
|
-
var avatarRef = useRef(null);
|
|
58
|
-
var parent = useContext(AvatarContext);
|
|
59
|
-
var b = cn('avatar');
|
|
60
|
-
var classes = classNames((_classNames = {}, _defineProperty(_classNames, "nut-avatar-".concat(size || (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro = parent.propAvatarGroup) === null || _parent$propAvatarGro === void 0 ? void 0 : _parent$propAvatarGro.size) || 'normal'), true), _defineProperty(_classNames, "nut-avatar-".concat(shape || (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro2 = parent.propAvatarGroup) === null || _parent$propAvatarGro2 === void 0 ? void 0 : _parent$propAvatarGro2.shape) || 'round'), true), _classNames));
|
|
61
|
-
var cls = classNames(b(''), classes, className);
|
|
62
|
-
var sizeValue = ['large', 'normal', 'small'];
|
|
63
|
-
var styles = _objectSpread({
|
|
64
|
-
width: sizeValue.indexOf(size) > -1 ? '' : "".concat(size, "px"),
|
|
65
|
-
height: sizeValue.indexOf(size) > -1 ? '' : "".concat(size, "px"),
|
|
66
|
-
backgroundColor: "".concat(bgColor),
|
|
67
|
-
color: "".concat(color),
|
|
68
|
-
marginLeft: avatarIndex !== 1 && parent !== null && parent !== void 0 && (_parent$propAvatarGro3 = parent.propAvatarGroup) !== null && _parent$propAvatarGro3 !== void 0 && _parent$propAvatarGro3.span ? "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro4 = parent.propAvatarGroup) === null || _parent$propAvatarGro4 === void 0 ? void 0 : _parent$propAvatarGro4.span, "px") : '',
|
|
69
|
-
zIndex: (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro5 = parent.propAvatarGroup) === null || _parent$propAvatarGro5 === void 0 ? void 0 : _parent$propAvatarGro5.zIndex) === 'right' ? "".concat(Math.abs(maxSum - avatarIndex)) : ''
|
|
70
|
-
}, style);
|
|
71
|
-
var maxStyles = {
|
|
72
|
-
backgroundColor: "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro6 = parent.propAvatarGroup) === null || _parent$propAvatarGro6 === void 0 ? void 0 : _parent$propAvatarGro6.maxBgColor),
|
|
73
|
-
color: "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro7 = parent.propAvatarGroup) === null || _parent$propAvatarGro7 === void 0 ? void 0 : _parent$propAvatarGro7.maxColor)
|
|
74
|
-
};
|
|
75
|
-
var iconStyles = icon || '';
|
|
76
|
-
useEffect(function () {
|
|
77
|
-
var _parent$avatarGroupRe;
|
|
78
|
-
var avatarChildren = parent === null || parent === void 0 ? void 0 : (_parent$avatarGroupRe = parent.avatarGroupRef) === null || _parent$avatarGroupRe === void 0 ? void 0 : _parent$avatarGroupRe.current.children;
|
|
79
|
-
if (avatarChildren) {
|
|
80
|
-
avatarLength(avatarChildren);
|
|
81
|
-
}
|
|
82
|
-
}, []);
|
|
83
|
-
var avatarLength = function avatarLength(children) {
|
|
84
|
-
var _avatarRef$current, _avatarRef$current$da, _parent$propAvatarGro8;
|
|
85
|
-
for (var i = 0; i < children.length; i++) {
|
|
86
|
-
if (children[i] && children[i].classList && children[i].classList[0] === 'nut-avatar') {
|
|
87
|
-
children[i].setAttribute('data-index', i + 1);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
var index = Number(avatarRef === null || avatarRef === void 0 ? void 0 : (_avatarRef$current = avatarRef.current) === null || _avatarRef$current === void 0 ? void 0 : (_avatarRef$current$da = _avatarRef$current.dataset) === null || _avatarRef$current$da === void 0 ? void 0 : _avatarRef$current$da.index);
|
|
91
|
-
var maxCount = parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro8 = parent.propAvatarGroup) === null || _parent$propAvatarGro8 === void 0 ? void 0 : _parent$propAvatarGro8.maxCount;
|
|
92
|
-
setMaxSum(children.length);
|
|
93
|
-
setAvatarIndex(index);
|
|
94
|
-
if (index === children.length && index !== maxCount && children.length > maxCount) {
|
|
95
|
-
setShowMax(true);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
var errorEvent = function errorEvent(e) {
|
|
99
|
-
if (props.onError) {
|
|
100
|
-
props.onError(e);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
var clickAvatar = function clickAvatar(e) {
|
|
104
|
-
activeAvatar && activeAvatar(e);
|
|
105
|
-
onActiveAvatar && onActiveAvatar(e);
|
|
106
|
-
};
|
|
107
|
-
return React__default.createElement(React__default.Fragment, null, (showMax || !(parent !== null && parent !== void 0 && (_parent$propAvatarGro9 = parent.propAvatarGroup) !== null && _parent$propAvatarGro9 !== void 0 && _parent$propAvatarGro9.maxCount) || avatarIndex <= (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro10 = parent.propAvatarGroup) === null || _parent$propAvatarGro10 === void 0 ? void 0 : _parent$propAvatarGro10.maxCount)) && React__default.createElement("div", _objectSpread(_objectSpread({
|
|
108
|
-
className: cls
|
|
109
|
-
}, rest), {}, {
|
|
110
|
-
style: !showMax ? styles : maxStyles,
|
|
111
|
-
onClick: clickAvatar,
|
|
112
|
-
ref: avatarRef
|
|
113
|
-
}), (!(parent !== null && parent !== void 0 && (_parent$propAvatarGro11 = parent.propAvatarGroup) !== null && _parent$propAvatarGro11 !== void 0 && _parent$propAvatarGro11.maxCount) || avatarIndex <= (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro12 = parent.propAvatarGroup) === null || _parent$propAvatarGro12 === void 0 ? void 0 : _parent$propAvatarGro12.maxCount)) && React__default.createElement(React__default.Fragment, null, url && React__default.createElement("img", {
|
|
114
|
-
className: "avatar-img",
|
|
115
|
-
src: url,
|
|
116
|
-
alt: alt,
|
|
117
|
-
onError: errorEvent
|
|
118
|
-
}), icon && React__default.createElement(Icon, {
|
|
119
|
-
classPrefix: iconClassPrefix,
|
|
120
|
-
fontClassName: iconFontClassName,
|
|
121
|
-
className: "icon",
|
|
122
|
-
name: iconStyles,
|
|
123
|
-
size: iconSize
|
|
124
|
-
}), children && React__default.createElement("span", {
|
|
125
|
-
className: "text"
|
|
126
|
-
}, children)), showMax && React__default.createElement("div", {
|
|
127
|
-
className: "text"
|
|
128
|
-
}, parent !== null && parent !== void 0 && (_parent$propAvatarGro13 = parent.propAvatarGroup) !== null && _parent$propAvatarGro13 !== void 0 && _parent$propAvatarGro13.maxContent ? parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro14 = parent.propAvatarGroup) === null || _parent$propAvatarGro14 === void 0 ? void 0 : _parent$propAvatarGro14.maxContent : "+ ".concat(avatarIndex - (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro15 = parent.propAvatarGroup) === null || _parent$propAvatarGro15 === void 0 ? void 0 : _parent$propAvatarGro15.maxCount)))));
|
|
129
|
-
};
|
|
130
|
-
Avatar.defaultProps = defaultProps;
|
|
131
|
-
Avatar.displayName = 'NutAvatar';
|
|
8
|
+
import './icon.taro-296a1bec.js';
|
|
9
|
+
import './typings-b9828dba.js';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
132
13
|
export { Avatar as default };
|