@nutui/nutui-react-taro 1.3.5 → 1.3.7
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 +14 -0
- package/dist/esm/Audio.js +4 -4
- package/dist/esm/Calendar.js +4 -4
- package/dist/esm/CalendarItem.js +3 -3
- package/dist/esm/DatePicker.js +4 -4
- package/dist/esm/Drag.js +3 -4
- package/dist/esm/Elevator.js +2 -4
- package/dist/esm/Menu.js +2 -2
- package/dist/esm/MenuItem.js +2 -2
- package/dist/esm/NoticeBar.js +3 -3
- package/dist/esm/Picker.js +3 -3
- package/dist/esm/Popover.js +3 -3
- package/dist/esm/Range.js +3 -3
- package/dist/esm/SearchBar.js +3 -2
- package/dist/esm/Signature.js +3 -2
- package/dist/esm/Swipe.js +3 -3
- package/dist/esm/actionsheet.taro-360d8d34.js +15 -25
- package/dist/esm/address.taro-f16cef31.js +151 -219
- package/dist/esm/animatingnumbers.taro-6f40a2e9.js +13 -41
- package/dist/esm/{audio.taro-29f5568f.js → audio.taro-57d4f0da.js} +33 -60
- package/dist/esm/avatar.taro-ec620cdd.js +25 -50
- package/dist/esm/avatargroup-5b2584d9.js +2 -9
- package/dist/esm/backtop.taro-aa8b2bc5.js +29 -55
- package/dist/esm/badge.taro-38684262.js +9 -20
- package/dist/esm/barrage.taro-d86c367a.js +8 -21
- package/dist/esm/button.taro-a9ebb937.js +22 -37
- package/dist/esm/{calendar.taro-438940bd.js → calendar.taro-533b3219.js} +13 -24
- package/dist/esm/{calendaritem.taro-11333579.js → calendaritem.taro-fe5dd4bd.js} +71 -183
- package/dist/esm/card.taro-1bc35ebe.js +14 -20
- package/dist/esm/cascader.taro-77100fb4.js +77 -197
- package/dist/esm/cell.taro-a4c3bb7b.js +20 -30
- package/dist/esm/cellgroup.taro-8c87bf08.js +6 -12
- package/dist/esm/checkbox.taro-104557c1.js +27 -48
- package/dist/esm/checkboxgroup.taro-3d380042.js +12 -30
- package/dist/esm/circleprogress.taro-3c89a157.js +14 -41
- package/dist/esm/col.taro-2a437387.js +11 -22
- package/dist/esm/collapse.taro-72e58ba2.js +11 -27
- package/dist/esm/collapseitem-75843a5e.js +33 -47
- package/dist/esm/configprovider-3e87d67a.js +2 -6
- package/dist/esm/configprovider.taro-6c7b3056.js +4 -14
- package/dist/esm/countdown.taro-f2d9ffed.js +37 -74
- package/dist/esm/{datepicker.taro-1acec61f.js → datepicker.taro-49a4cf0c.js} +43 -104
- package/dist/esm/dialog.taro-492e2b9a.js +27 -58
- package/dist/esm/divider.taro-5236fe6a.js +8 -15
- package/dist/esm/drag.taro-0717c783.js +153 -0
- package/dist/esm/{elevator.taro-8e385785.js → elevator.taro-443253ec.js} +99 -124
- package/dist/esm/empty.taro-ab9c4f03.js +11 -24
- package/dist/esm/fixednav.taro-582322a1.js +16 -27
- package/dist/esm/grid.taro-5d75c0ad.js +13 -28
- package/dist/esm/griditem.taro-866cd288.js +18 -34
- package/dist/esm/icon-8dc4de10.js +11 -21
- package/dist/esm/icon.taro-1d0d4fb7.js +11 -21
- package/dist/esm/imagepreview.taro-1199e977.js +36 -71
- package/dist/esm/indicator.taro-183ea169.js +9 -20
- package/dist/esm/infiniteloading.taro-b95e62bf.js +23 -49
- package/dist/esm/input.taro-2453d7c4.js +62 -106
- package/dist/esm/inputnumber.taro-0cf7c1b7.js +25 -52
- package/dist/esm/layout.taro-358f014f.js +0 -6
- package/dist/esm/{menu.taro-9345dcfd.js → menu.taro-f8ca86db.js} +24 -42
- package/dist/esm/{menuitem.taro-fc0961b7.js → menuitem.taro-7bf564c9.js} +32 -57
- package/dist/esm/navbar.taro-c931c078.js +18 -34
- package/dist/esm/{noticebar.taro-1fa04a96.js → noticebar.taro-332691f9.js} +55 -107
- package/dist/esm/notify.taro-d9c48fae.js +18 -34
- package/dist/esm/numberkeyboard.taro-53c350b8.js +21 -52
- package/dist/esm/nutui-react.es.js +18 -18
- package/dist/esm/offsetContext-0e3d04b3.js +0 -3
- package/dist/esm/overlay.taro-be45fed5.js +12 -23
- package/dist/esm/pagination.taro-62bbd23f.js +38 -71
- package/dist/esm/{picker.taro-6a4dad23.js → picker.taro-f003b725.js} +95 -186
- package/dist/esm/{popover.taro-eddd0bd2.js → popover.taro-7e5dff8c.js} +33 -76
- package/dist/esm/popup.taro-33d0bbc8.js +40 -72
- package/dist/esm/price.taro-97393d8f.js +7 -24
- package/dist/esm/progress.taro-623bc807.js +23 -31
- package/dist/esm/pulltorefresh.taro-e66c78ad.js +29 -92
- package/dist/esm/radio.taro-95d43860.js +24 -47
- package/dist/esm/radiogroup.taro-b5dad516.js +14 -24
- package/dist/esm/{range.taro-515d37a4.js → range.taro-fc7c0b6a.js} +50 -133
- package/dist/esm/rate.taro-69c85081.js +21 -39
- package/dist/esm/row.taro-cec13a7e.js +7 -16
- package/dist/esm/{searchbar.taro-f134fb96.js → searchbar.taro-0d3c0081.js} +55 -70
- package/dist/esm/shortpassword.taro-2e96ca22.js +29 -56
- package/dist/esm/sidenavbar.taro-87f056cd.js +9 -16
- package/dist/esm/sidenavbaritem.taro-77e077f4.js +4 -11
- package/dist/esm/signature.taro-59b3b3ab.js +146 -0
- package/dist/esm/skeleton.taro-b9ff84b9.js +13 -23
- package/dist/esm/step.taro-f1057500.js +12 -28
- package/dist/esm/steps.taro-943f4fbb.js +6 -14
- package/dist/esm/sticky.taro-30d4e453.js +0 -7
- package/dist/esm/subsidenavbar.taro-2c1fcf16.js +7 -22
- package/dist/esm/{swipe.taro-dfb9a049.js → swipe.taro-83bc248f.js} +98 -91
- package/dist/esm/swiper.taro-f314d67a.js +110 -196
- package/dist/esm/swiperitem-d00e7513.js +2 -12
- package/dist/esm/switch.taro-be5eb823.js +13 -27
- package/dist/esm/tabbar.taro-da72fa2c.js +13 -25
- package/dist/esm/tabbaritem.taro-94cd62c2.js +15 -23
- package/dist/esm/table.taro-7ac89a6c.js +19 -39
- package/dist/esm/tabpane.taro-95aa185b.js +4 -10
- package/dist/esm/tabs.taro-86186dff.js +28 -54
- package/dist/esm/tag.taro-95d7f5c2.js +19 -36
- package/dist/esm/textarea.taro-388d1f90.js +18 -35
- package/dist/esm/timedetail.taro-519808cf.js +15 -28
- package/dist/esm/timepannel.taro-9904f6e6.js +5 -12
- package/dist/esm/timeselect.taro-73796bfc.js +35 -59
- package/dist/esm/toast.taro-86862dff.js +26 -46
- package/dist/esm/types/src/packages/elevator/demo.d.ts +1 -0
- package/dist/esm/types/src/packages/searchbar/searchbar.d.ts +2 -0
- package/dist/esm/types/src/packages/searchbar/searchbar.taro.d.ts +2 -0
- package/dist/esm/types/src/packages/signature/signature.taro.d.ts +10 -2
- package/dist/esm/uploader.taro-6184abe7.js +52 -144
- package/dist/esm/{useClientRect-8b7cc406.js → useClientRect-bf69d7b3.js} +1 -40
- package/dist/esm/useTouch-a2ea68c6.js +27 -47
- package/dist/esm/video-c1090c92.js +8 -19
- package/dist/esm/virtuallist.taro-6858f690.js +84 -118
- 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/nutui.react.es.js +10848 -11365
- package/dist/nutui.react.umd.js +10840 -11357
- package/dist/packages/menu/menu.scss +4 -0
- package/dist/packages/menuitem/menuitem.scss +27 -2
- package/dist/packages/searchbar/searchbar.scss +20 -3
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/types/index.d.ts +17 -8
- package/package.json +1 -1
- package/dist/esm/drag.taro-56e8c87a.js +0 -134
- package/dist/esm/signature.taro-a9286cd1.js +0 -178
|
@@ -7,15 +7,10 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
8
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
9
9
|
var _excluded = ["maxLen", "endNumber", "delaySpeed", "easeSpeed", "className", "thousands"];
|
|
10
|
-
|
|
11
10
|
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); }; }
|
|
12
|
-
|
|
13
11
|
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; } }
|
|
14
|
-
|
|
15
12
|
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; }
|
|
16
|
-
|
|
17
13
|
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; }
|
|
18
|
-
|
|
19
14
|
import React__default, { useRef, useState, useEffect, Component } from 'react';
|
|
20
15
|
import Taro from '@tarojs/taro';
|
|
21
16
|
import { c as cn } from './bem-893ad28d.js';
|
|
@@ -27,17 +22,15 @@ var defaultProps$1 = {
|
|
|
27
22
|
thousands: false,
|
|
28
23
|
className: ''
|
|
29
24
|
};
|
|
30
|
-
|
|
31
25
|
var CountUp = function CountUp(props) {
|
|
32
26
|
var _defaultProps$1$props = _objectSpread(_objectSpread({}, defaultProps$1), props),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
maxLen = _defaultProps$1$props.maxLen,
|
|
28
|
+
endNumber = _defaultProps$1$props.endNumber,
|
|
29
|
+
delaySpeed = _defaultProps$1$props.delaySpeed,
|
|
30
|
+
easeSpeed = _defaultProps$1$props.easeSpeed,
|
|
31
|
+
className = _defaultProps$1$props.className,
|
|
32
|
+
thousands = _defaultProps$1$props.thousands,
|
|
33
|
+
reset = _objectWithoutProperties(_defaultProps$1$props, _excluded);
|
|
41
34
|
var b = cn('countup');
|
|
42
35
|
var countupRef = useRef(null);
|
|
43
36
|
var timerRef = useRef(0);
|
|
@@ -46,26 +39,21 @@ var CountUp = function CountUp(props) {
|
|
|
46
39
|
}, function (v, i) {
|
|
47
40
|
return i;
|
|
48
41
|
});
|
|
49
|
-
|
|
50
42
|
var getShowNumber = function getShowNumber() {
|
|
51
43
|
var splitArr = endNumber.split('.');
|
|
52
44
|
var intNumber = maxLen && splitArr[0].length < maxLen ? (Array(maxLen).join('0') + splitArr[0]).slice(-maxLen) : splitArr[0];
|
|
53
45
|
var currNumber = "".concat(thousands ? intNumber.replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') : intNumber).concat(splitArr[1] ? '.' : '').concat(splitArr[1] || '');
|
|
54
46
|
return currNumber.split('');
|
|
55
47
|
};
|
|
56
|
-
|
|
57
48
|
var _useState = useState([]),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
+
numerArr = _useState2[0],
|
|
51
|
+
setNumerArr = _useState2[1];
|
|
62
52
|
var _useState3 = useState([]),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
54
|
+
transformArr = _useState4[0],
|
|
55
|
+
setTransformArr = _useState4[1];
|
|
67
56
|
var isLoaded = useRef(false);
|
|
68
|
-
|
|
69
57
|
var setNumberTransform = function setNumberTransform() {
|
|
70
58
|
if (countupRef.current && numerArr.length) {
|
|
71
59
|
Taro.createSelectorQuery().selectAll('.nut-countup__listitem').node(function (numberItems) {
|
|
@@ -73,7 +61,6 @@ var CountUp = function CountUp(props) {
|
|
|
73
61
|
Object.keys(numberItems).forEach(function (key) {
|
|
74
62
|
var elem = numberItems[Number(key)];
|
|
75
63
|
var idx = Number(numerArr[Number(key)]);
|
|
76
|
-
|
|
77
64
|
if (elem) {
|
|
78
65
|
// 计算规则:父元素和实际列表高度的百分比,分割成20等份
|
|
79
66
|
var transform = idx || idx === 0 ? "translate(0, -".concat((idx === 0 ? 10 : idx) * 5, "%)") : '';
|
|
@@ -84,14 +71,12 @@ var CountUp = function CountUp(props) {
|
|
|
84
71
|
}).exec();
|
|
85
72
|
}
|
|
86
73
|
};
|
|
87
|
-
|
|
88
74
|
var numberEaseStyle = function numberEaseStyle(idx) {
|
|
89
75
|
return {
|
|
90
76
|
transition: "transform ".concat(easeSpeed, "s ease-in-out"),
|
|
91
77
|
transform: transformArr[idx] ? transformArr[idx] : null
|
|
92
78
|
};
|
|
93
79
|
};
|
|
94
|
-
|
|
95
80
|
useEffect(function () {
|
|
96
81
|
setNumberTransform();
|
|
97
82
|
}, [numerArr]);
|
|
@@ -104,7 +89,6 @@ var CountUp = function CountUp(props) {
|
|
|
104
89
|
} else {
|
|
105
90
|
setNumerArr(getShowNumber());
|
|
106
91
|
}
|
|
107
|
-
|
|
108
92
|
return function () {
|
|
109
93
|
window.clearTimeout(timerRef.current);
|
|
110
94
|
};
|
|
@@ -132,26 +116,19 @@ var CountUp = function CountUp(props) {
|
|
|
132
116
|
}, item));
|
|
133
117
|
})));
|
|
134
118
|
};
|
|
135
|
-
|
|
136
119
|
CountUp.defaultProps = defaultProps$1;
|
|
137
120
|
CountUp.displayName = 'NutCountUp';
|
|
138
121
|
var defaultProps = {};
|
|
139
|
-
|
|
140
122
|
var AnimatingNumbers = /*#__PURE__*/function (_Component) {
|
|
141
123
|
_inherits(AnimatingNumbers, _Component);
|
|
142
|
-
|
|
143
124
|
var _super = _createSuper(AnimatingNumbers);
|
|
144
|
-
|
|
145
125
|
function AnimatingNumbers(props) {
|
|
146
126
|
var _this;
|
|
147
|
-
|
|
148
127
|
_classCallCheck(this, AnimatingNumbers);
|
|
149
|
-
|
|
150
128
|
_this = _super.call(this, props);
|
|
151
129
|
_this.state = {};
|
|
152
130
|
return _this;
|
|
153
131
|
}
|
|
154
|
-
|
|
155
132
|
_createClass(AnimatingNumbers, [{
|
|
156
133
|
key: "render",
|
|
157
134
|
value: function render() {
|
|
@@ -160,14 +137,9 @@ var AnimatingNumbers = /*#__PURE__*/function (_Component) {
|
|
|
160
137
|
});
|
|
161
138
|
}
|
|
162
139
|
}]);
|
|
163
|
-
|
|
164
140
|
return AnimatingNumbers;
|
|
165
141
|
}(Component);
|
|
166
|
-
|
|
167
142
|
_defineProperty(AnimatingNumbers, "defaultProps", defaultProps);
|
|
168
|
-
|
|
169
143
|
_defineProperty(AnimatingNumbers, "displayName", 'NutAnimatingNumbers');
|
|
170
|
-
|
|
171
144
|
_defineProperty(AnimatingNumbers, "CountUp", CountUp);
|
|
172
|
-
|
|
173
145
|
export { AnimatingNumbers as A };
|
|
@@ -2,22 +2,18 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
var _excluded = ["className", "url", "style", "autoplay", "loop", "type", "onFastBack", "onForward", "onPause", "onPlay", "onPlayEnd", "onCanPlay", "children", "iconClassPrefix", "iconFontClassName"];
|
|
5
|
-
|
|
6
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; }
|
|
7
|
-
|
|
8
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; }
|
|
9
|
-
|
|
10
7
|
import React__default, { useState, useRef } from 'react';
|
|
11
8
|
import Taro from '@tarojs/taro';
|
|
12
9
|
import { I as Icon } from './icon.taro-1d0d4fb7.js';
|
|
13
|
-
import { R as Range } from './range.taro-
|
|
10
|
+
import { R as Range } from './range.taro-fc7c0b6a.js';
|
|
14
11
|
import { B as Button } from './button.taro-a9ebb937.js';
|
|
15
12
|
import { c as cn } from './bem-893ad28d.js';
|
|
16
13
|
import { u as useConfig } from './configprovider.taro-6c7b3056.js';
|
|
17
14
|
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
18
15
|
var b = cn('audio');
|
|
19
16
|
var warn = console.warn;
|
|
20
|
-
|
|
21
17
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
22
18
|
className: '',
|
|
23
19
|
url: '',
|
|
@@ -32,54 +28,46 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
|
32
28
|
onPlayEnd: function onPlayEnd(ctx) {},
|
|
33
29
|
onCanPlay: function onCanPlay(ctx) {}
|
|
34
30
|
});
|
|
35
|
-
|
|
36
31
|
var Audio = function Audio(props) {
|
|
37
32
|
var _useConfig = useConfig(),
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
locale = _useConfig.locale;
|
|
40
34
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
35
|
+
className = _defaultProps$props.className,
|
|
36
|
+
url = _defaultProps$props.url,
|
|
37
|
+
style = _defaultProps$props.style,
|
|
38
|
+
autoplay = _defaultProps$props.autoplay,
|
|
39
|
+
loop = _defaultProps$props.loop,
|
|
40
|
+
type = _defaultProps$props.type,
|
|
41
|
+
onFastBack = _defaultProps$props.onFastBack,
|
|
42
|
+
onForward = _defaultProps$props.onForward,
|
|
43
|
+
onPause = _defaultProps$props.onPause,
|
|
44
|
+
onPlay = _defaultProps$props.onPlay,
|
|
45
|
+
onPlayEnd = _defaultProps$props.onPlayEnd,
|
|
46
|
+
onCanPlay = _defaultProps$props.onCanPlay,
|
|
47
|
+
children = _defaultProps$props.children,
|
|
48
|
+
iconClassPrefix = _defaultProps$props.iconClassPrefix,
|
|
49
|
+
iconFontClassName = _defaultProps$props.iconFontClassName,
|
|
50
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
58
51
|
var _useState = useState(false),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
+
playing = _useState2[0],
|
|
54
|
+
setPlaying = _useState2[1];
|
|
63
55
|
var _useState3 = useState(0),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
57
|
+
totalSeconds = _useState4[0],
|
|
58
|
+
setTotalSeconds = _useState4[1];
|
|
68
59
|
var _useState5 = useState(0),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
60
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
61
|
+
percent = _useState6[0],
|
|
62
|
+
setPercent = _useState6[1];
|
|
73
63
|
var _useState7 = useState(false),
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
64
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
65
|
+
isCanPlay = _useState8[0],
|
|
66
|
+
setIsCanPlay = _useState8[1];
|
|
78
67
|
var _useState9 = useState('00:00:00'),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
68
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
69
|
+
currentDuration = _useState10[0],
|
|
70
|
+
setCurrentDuration = _useState10[1];
|
|
83
71
|
var statusRef = useRef({
|
|
84
72
|
currentTime: 0,
|
|
85
73
|
currentDuration: '00:00:00',
|
|
@@ -126,12 +114,10 @@ var Audio = function Audio(props) {
|
|
|
126
114
|
console.log('code', res.errCode);
|
|
127
115
|
console.log('message', res.errMsg);
|
|
128
116
|
});
|
|
129
|
-
|
|
130
117
|
function formatSeconds(value) {
|
|
131
118
|
if (!value) {
|
|
132
119
|
return '00:00:00';
|
|
133
120
|
}
|
|
134
|
-
|
|
135
121
|
var time = parseInt(value);
|
|
136
122
|
var hours = Math.floor(time / 3600);
|
|
137
123
|
var minutes = Math.floor((time - hours * 3600) / 60);
|
|
@@ -142,7 +128,6 @@ var Audio = function Audio(props) {
|
|
|
142
128
|
result += "0".concat(secondss.toString()).slice(-2);
|
|
143
129
|
return result;
|
|
144
130
|
}
|
|
145
|
-
|
|
146
131
|
var handleBack = function handleBack() {
|
|
147
132
|
var currentTime = Math.floor(audioCtx.currentTime);
|
|
148
133
|
statusRef.current.currentTime = Math.max(currentTime - 1, 0);
|
|
@@ -150,7 +135,6 @@ var Audio = function Audio(props) {
|
|
|
150
135
|
audioCtx.seek(statusRef.current.currentTime);
|
|
151
136
|
props.onFastBack && props.onFastBack(audioCtx);
|
|
152
137
|
};
|
|
153
|
-
|
|
154
138
|
var handleForward = function handleForward() {
|
|
155
139
|
var currentTime = Math.floor(audioCtx.currentTime);
|
|
156
140
|
statusRef.current.currentTime = Math.min(currentTime + 1, audioCtx.duration);
|
|
@@ -158,17 +142,14 @@ var Audio = function Audio(props) {
|
|
|
158
142
|
audioCtx.seek(statusRef.current.currentTime);
|
|
159
143
|
props.onForward && props.onForward(audioCtx);
|
|
160
144
|
};
|
|
161
|
-
|
|
162
145
|
var handleStatusChange = function handleStatusChange() {
|
|
163
146
|
setPlaying(!playing);
|
|
164
|
-
|
|
165
147
|
if (!playing) {
|
|
166
148
|
audioCtx.play();
|
|
167
149
|
} else {
|
|
168
150
|
audioCtx.pause();
|
|
169
151
|
}
|
|
170
152
|
};
|
|
171
|
-
|
|
172
153
|
var renderIcon = function renderIcon() {
|
|
173
154
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
174
155
|
className: b('icon')
|
|
@@ -186,7 +167,6 @@ var Audio = function Audio(props) {
|
|
|
186
167
|
name: "service"
|
|
187
168
|
}))));
|
|
188
169
|
};
|
|
189
|
-
|
|
190
170
|
var renderProgerss = function renderProgerss() {
|
|
191
171
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
192
172
|
className: b('progress')
|
|
@@ -220,36 +200,29 @@ var Audio = function Audio(props) {
|
|
|
220
200
|
onClick: handleForward
|
|
221
201
|
}, locale.audio.forward || '快进')));
|
|
222
202
|
};
|
|
223
|
-
|
|
224
203
|
var renderNone = function renderNone() {
|
|
225
204
|
return React__default.createElement("div", {
|
|
226
205
|
className: b('none-container'),
|
|
227
206
|
onClick: handleStatusChange
|
|
228
207
|
}, children);
|
|
229
208
|
};
|
|
230
|
-
|
|
231
209
|
var renderAudio = function renderAudio() {
|
|
232
210
|
switch (type) {
|
|
233
211
|
case 'icon':
|
|
234
212
|
return renderIcon();
|
|
235
|
-
|
|
236
213
|
case 'progress':
|
|
237
214
|
return renderProgerss();
|
|
238
|
-
|
|
239
215
|
case 'none':
|
|
240
216
|
return renderNone();
|
|
241
|
-
|
|
242
217
|
default:
|
|
243
218
|
return null;
|
|
244
219
|
}
|
|
245
220
|
};
|
|
246
|
-
|
|
247
221
|
return React__default.createElement("div", _objectSpread({
|
|
248
222
|
className: "".concat(b(), " ").concat(className),
|
|
249
223
|
style: style
|
|
250
224
|
}, rest), renderAudio());
|
|
251
225
|
};
|
|
252
|
-
|
|
253
226
|
Audio.defaultProps = defaultProps;
|
|
254
227
|
Audio.displayName = 'NutAudio';
|
|
255
228
|
export { Audio as A };
|
|
@@ -2,18 +2,14 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
var _excluded = ["children", "prefixCls", "size", "shape", "bgColor", "color", "url", "alt", "icon", "className", "style", "activeAvatar", "onError", "iconClassPrefix", "iconFontClassName"];
|
|
5
|
-
|
|
6
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; }
|
|
7
|
-
|
|
8
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; }
|
|
9
|
-
|
|
10
7
|
import React__default, { useState, useRef, useContext, useEffect } from 'react';
|
|
11
8
|
import classNames from 'classnames';
|
|
12
9
|
import { A as AvatarContext } from './AvatarContext-7153ad2b.js';
|
|
13
10
|
import { c as cn } from './bem-893ad28d.js';
|
|
14
11
|
import { I as Icon } from './icon.taro-1d0d4fb7.js';
|
|
15
12
|
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
16
|
-
|
|
17
13
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
18
14
|
size: '',
|
|
19
15
|
icon: '',
|
|
@@ -23,53 +19,43 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
|
23
19
|
url: '',
|
|
24
20
|
alt: ''
|
|
25
21
|
});
|
|
26
|
-
|
|
27
22
|
var Avatar = function Avatar(props) {
|
|
28
23
|
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, _parent$propAvatarGro16;
|
|
29
|
-
|
|
30
24
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
25
|
+
children = _defaultProps$props.children,
|
|
26
|
+
prefixCls = _defaultProps$props.prefixCls,
|
|
27
|
+
size = _defaultProps$props.size,
|
|
28
|
+
shape = _defaultProps$props.shape,
|
|
29
|
+
bgColor = _defaultProps$props.bgColor,
|
|
30
|
+
color = _defaultProps$props.color,
|
|
31
|
+
url = _defaultProps$props.url,
|
|
32
|
+
alt = _defaultProps$props.alt,
|
|
33
|
+
icon = _defaultProps$props.icon,
|
|
34
|
+
className = _defaultProps$props.className,
|
|
35
|
+
style = _defaultProps$props.style,
|
|
36
|
+
activeAvatar = _defaultProps$props.activeAvatar,
|
|
37
|
+
onError = _defaultProps$props.onError,
|
|
38
|
+
iconClassPrefix = _defaultProps$props.iconClassPrefix,
|
|
39
|
+
iconFontClassName = _defaultProps$props.iconFontClassName,
|
|
40
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
48
41
|
var _useState = useState(0),
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
+
maxSum = _useState2[0],
|
|
44
|
+
setMaxSum = _useState2[1]; // avatarGroup里的avatar的个数
|
|
54
45
|
var _useState3 = useState(false),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
47
|
+
showMax = _useState4[0],
|
|
48
|
+
setShowMax = _useState4[1]; // 是否显示的最大头像个数
|
|
60
49
|
var _useState5 = useState(1),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
50
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
51
|
+
avatarIndex = _useState6[0],
|
|
52
|
+
setAvatarIndex = _useState6[1]; // avatar的索引
|
|
66
53
|
var avatarRef = useRef(null);
|
|
67
54
|
var parent = useContext(AvatarContext);
|
|
68
55
|
var b = cn('avatar');
|
|
69
56
|
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));
|
|
70
57
|
var cls = classNames(b(''), classes, className);
|
|
71
58
|
var sizeValue = ['large', 'normal', 'small'];
|
|
72
|
-
|
|
73
59
|
var styles = _objectSpread({
|
|
74
60
|
width: sizeValue.indexOf(size) > -1 ? '' : "".concat(size, "px"),
|
|
75
61
|
height: sizeValue.indexOf(size) > -1 ? '' : "".concat(size, "px"),
|
|
@@ -78,7 +64,6 @@ var Avatar = function Avatar(props) {
|
|
|
78
64
|
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") : '',
|
|
79
65
|
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)) : ''
|
|
80
66
|
}, style);
|
|
81
|
-
|
|
82
67
|
var maxStyles = {
|
|
83
68
|
backgroundColor: "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro6 = parent.propAvatarGroup) === null || _parent$propAvatarGro6 === void 0 ? void 0 : _parent$propAvatarGro6.maxBgColor),
|
|
84
69
|
color: "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro7 = parent.propAvatarGroup) === null || _parent$propAvatarGro7 === void 0 ? void 0 : _parent$propAvatarGro7.maxColor)
|
|
@@ -86,45 +71,36 @@ var Avatar = function Avatar(props) {
|
|
|
86
71
|
var iconStyles = icon || '';
|
|
87
72
|
useEffect(function () {
|
|
88
73
|
var _parent$avatarGroupRe;
|
|
89
|
-
|
|
90
74
|
var avatarChildren = parent === null || parent === void 0 ? void 0 : (_parent$avatarGroupRe = parent.avatarGroupRef) === null || _parent$avatarGroupRe === void 0 ? void 0 : _parent$avatarGroupRe.current.children;
|
|
91
|
-
|
|
92
75
|
if (avatarChildren) {
|
|
93
76
|
avatarLength(avatarChildren);
|
|
94
77
|
}
|
|
95
78
|
}, []);
|
|
96
|
-
|
|
97
79
|
var avatarLength = function avatarLength(children) {
|
|
98
80
|
var _avatarRef$current, _avatarRef$current$da, _parent$propAvatarGro8;
|
|
99
|
-
|
|
100
81
|
for (var i = 0; i < children.length; i++) {
|
|
101
82
|
if (children[i] && children[i].classList && (children[i].classList[0] === 'nut-avatar' || children[i].classList.values().next().value === 'nut-avatar')) {
|
|
102
83
|
children[i].setAttribute('data-index', i + 1);
|
|
103
84
|
}
|
|
104
85
|
}
|
|
105
|
-
|
|
106
86
|
var index = 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;
|
|
107
87
|
var maxCount = parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro8 = parent.propAvatarGroup) === null || _parent$propAvatarGro8 === void 0 ? void 0 : _parent$propAvatarGro8.maxCount;
|
|
108
88
|
setMaxSum(children.length);
|
|
109
89
|
setAvatarIndex(index);
|
|
110
|
-
|
|
111
90
|
if (index === children.length && index !== maxCount && children.length > maxCount) {
|
|
112
91
|
setShowMax(true);
|
|
113
92
|
}
|
|
114
93
|
};
|
|
115
|
-
|
|
116
94
|
var errorEvent = function errorEvent(e) {
|
|
117
95
|
if (props.onError) {
|
|
118
96
|
props.onError(e);
|
|
119
97
|
}
|
|
120
98
|
};
|
|
121
|
-
|
|
122
99
|
var clickAvatar = function clickAvatar(e) {
|
|
123
100
|
if (props.activeAvatar) {
|
|
124
101
|
props.activeAvatar(e);
|
|
125
102
|
}
|
|
126
103
|
};
|
|
127
|
-
|
|
128
104
|
console.log('!parent?.propAvatarGroup?.maxCount', !(parent !== null && parent !== void 0 && (_parent$propAvatarGro9 = parent.propAvatarGroup) !== null && _parent$propAvatarGro9 !== void 0 && _parent$propAvatarGro9.maxCount), showMax);
|
|
129
105
|
return React__default.createElement(React__default.Fragment, null, (showMax || !(parent !== null && parent !== void 0 && (_parent$propAvatarGro10 = parent.propAvatarGroup) !== null && _parent$propAvatarGro10 !== void 0 && _parent$propAvatarGro10.maxCount) || avatarIndex <= (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro11 = parent.propAvatarGroup) === null || _parent$propAvatarGro11 === void 0 ? void 0 : _parent$propAvatarGro11.maxCount)) && React__default.createElement("div", _objectSpread(_objectSpread({
|
|
130
106
|
className: cls
|
|
@@ -147,7 +123,6 @@ var Avatar = function Avatar(props) {
|
|
|
147
123
|
className: "text"
|
|
148
124
|
}, parent !== null && parent !== void 0 && (_parent$propAvatarGro14 = parent.propAvatarGroup) !== null && _parent$propAvatarGro14 !== void 0 && _parent$propAvatarGro14.maxContent ? parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro15 = parent.propAvatarGroup) === null || _parent$propAvatarGro15 === void 0 ? void 0 : _parent$propAvatarGro15.maxContent : "+ ".concat(avatarIndex - (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro16 = parent.propAvatarGroup) === null || _parent$propAvatarGro16 === void 0 ? void 0 : _parent$propAvatarGro16.maxCount)))));
|
|
149
125
|
};
|
|
150
|
-
|
|
151
126
|
Avatar.defaultProps = defaultProps;
|
|
152
127
|
Avatar.displayName = 'NutAvatar';
|
|
153
128
|
export { Avatar as A };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
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; }
|
|
4
|
-
|
|
5
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; }
|
|
6
|
-
|
|
7
4
|
import React__default, { useRef } from 'react';
|
|
8
5
|
import classNames from 'classnames';
|
|
9
6
|
import { A as AvatarContext } from './AvatarContext-7153ad2b.js';
|
|
@@ -19,15 +16,12 @@ var defaultProps = {
|
|
|
19
16
|
span: '-8',
|
|
20
17
|
zIndex: 'left'
|
|
21
18
|
};
|
|
22
|
-
|
|
23
19
|
var AvatarGroup = function AvatarGroup(props) {
|
|
24
20
|
useConfig();
|
|
25
|
-
|
|
26
21
|
var propAvatarGroup = _objectSpread(_objectSpread({}, defaultProps), props);
|
|
27
|
-
|
|
28
22
|
var className = propAvatarGroup.className,
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
style = propAvatarGroup.style,
|
|
24
|
+
children = propAvatarGroup.children;
|
|
31
25
|
var avatarGroupRef = useRef(null);
|
|
32
26
|
var b = cn('avatar-group');
|
|
33
27
|
var cls = classNames(b(''), className);
|
|
@@ -43,7 +37,6 @@ var AvatarGroup = function AvatarGroup(props) {
|
|
|
43
37
|
ref: avatarGroupRef
|
|
44
38
|
}, children));
|
|
45
39
|
};
|
|
46
|
-
|
|
47
40
|
AvatarGroup.defaultProps = defaultProps;
|
|
48
41
|
AvatarGroup.displayName = 'NutAvatarGroup';
|
|
49
42
|
export { AvatarGroup as A };
|