@nutui/nutui-react 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/ActionSheet.js +15 -25
- package/dist/esm/Address.js +151 -221
- package/dist/esm/AnimatingNumbers.js +7 -31
- package/dist/esm/Audio.js +31 -66
- package/dist/esm/Avatar.js +25 -51
- package/dist/esm/AvatarGroup.js +2 -9
- package/dist/esm/BackTop.js +29 -55
- package/dist/esm/Badge.js +9 -20
- package/dist/esm/Barrage.js +8 -20
- package/dist/esm/Button.js +22 -37
- package/dist/esm/Calendar.js +23 -37
- package/dist/esm/CalendarItem.js +86 -186
- package/dist/esm/Card.js +14 -20
- package/dist/esm/Cascader.js +77 -197
- package/dist/esm/Cell.js +20 -30
- package/dist/esm/CellGroup.js +6 -12
- package/dist/esm/Checkbox.js +27 -48
- package/dist/esm/CheckboxGroup.js +12 -30
- package/dist/esm/CircleProgress.js +11 -28
- package/dist/esm/Col.js +11 -22
- package/dist/esm/Collapse.js +11 -27
- package/dist/esm/CollapseItem.js +33 -47
- package/dist/esm/ConfigProvider.js +4 -15
- package/dist/esm/CountDown.js +37 -74
- package/dist/esm/DatePicker.js +44 -106
- package/dist/esm/Dialog.js +31 -89
- package/dist/esm/Divider.js +8 -15
- package/dist/esm/Drag.js +30 -45
- package/dist/esm/Elevator.js +37 -74
- package/dist/esm/Empty.js +11 -24
- package/dist/esm/FixedNav.js +18 -29
- package/dist/esm/Grid.js +13 -28
- package/dist/esm/GridItem.js +18 -34
- package/dist/esm/ImagePreview.js +36 -71
- package/dist/esm/Indicator.js +9 -20
- package/dist/esm/Infiniteloading.js +26 -55
- package/dist/esm/Input.js +62 -106
- package/dist/esm/InputNumber.js +25 -52
- package/dist/esm/Layout.js +0 -6
- package/dist/esm/Menu.js +27 -49
- package/dist/esm/MenuItem.js +32 -56
- package/dist/esm/NavBar.js +18 -34
- package/dist/esm/NoticeBar.js +54 -102
- package/dist/esm/Notify.js +9 -38
- package/dist/esm/NumberKeyboard.js +21 -52
- package/dist/esm/Pagination.js +38 -71
- package/dist/esm/Picker.js +91 -178
- package/dist/esm/Popover.js +32 -72
- package/dist/esm/Popup.js +40 -72
- package/dist/esm/Price.js +7 -24
- package/dist/esm/Progress.js +35 -50
- package/dist/esm/PullToRefresh.js +28 -83
- package/dist/esm/Radio.js +24 -47
- package/dist/esm/RadioGroup.js +14 -24
- package/dist/esm/Range.js +44 -116
- package/dist/esm/Rate.js +21 -39
- package/dist/esm/Row.js +7 -16
- package/dist/esm/SearchBar.js +47 -68
- package/dist/esm/ShortPassword.js +29 -56
- package/dist/esm/SideNavBar.js +9 -16
- package/dist/esm/SideNavBarItem.js +4 -11
- package/dist/esm/Signature.js +13 -43
- package/dist/esm/Skeleton.js +13 -23
- package/dist/esm/Step.js +12 -28
- package/dist/esm/Steps.js +6 -14
- package/dist/esm/Sticky.js +24 -52
- package/dist/esm/SubSideNavBar.js +7 -22
- package/dist/esm/Swipe.js +15 -54
- package/dist/esm/Swiper.js +102 -186
- package/dist/esm/SwiperItem.js +2 -12
- package/dist/esm/Switch.js +13 -27
- package/dist/esm/Tabbar.js +13 -25
- package/dist/esm/TabbarItem.js +15 -23
- package/dist/esm/Table.js +19 -39
- package/dist/esm/Tag.js +19 -36
- package/dist/esm/TextArea.js +19 -43
- package/dist/esm/TimeDetail.js +15 -28
- package/dist/esm/TimePannel.js +5 -12
- package/dist/esm/TimeSelect.js +35 -59
- package/dist/esm/Toast.js +16 -49
- package/dist/esm/Uploader.js +57 -152
- package/dist/esm/Video.js +8 -19
- package/dist/esm/VirtualList.js +84 -118
- package/dist/esm/date-710f8c7c.js +9 -33
- package/dist/esm/get-scroll-parent-3dcd3f53.js +1 -9
- package/dist/esm/icon-8dc4de10.js +11 -21
- package/dist/esm/offsetContext-0e3d04b3.js +0 -3
- package/dist/esm/overlay-ed3eb37d.js +12 -23
- package/dist/esm/render-18227751.js +0 -11
- package/dist/esm/tabpane-c957ab14.js +4 -10
- package/dist/esm/tabs-0896a61b.js +28 -56
- 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/useClientRect-839d18c5.js +0 -5
- package/dist/esm/useTouch-a2ea68c6.js +27 -47
- 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 +429 -413
- package/dist/nutui.react.umd.js +421 -405
- 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 +2 -0
- package/package.json +1 -1
|
@@ -6,15 +6,10 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
7
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
8
8
|
var _excluded = ["maxLen", "endNumber", "delaySpeed", "easeSpeed", "className", "thousands"];
|
|
9
|
-
|
|
10
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); }; }
|
|
11
|
-
|
|
12
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; } }
|
|
13
|
-
|
|
14
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; }
|
|
15
|
-
|
|
16
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; }
|
|
17
|
-
|
|
18
13
|
import React__default, { useRef, useEffect, Component } from 'react';
|
|
19
14
|
import { c as cn } from './bem-893ad28d.js';
|
|
20
15
|
import '@bem-react/classname';
|
|
@@ -26,17 +21,15 @@ var defaultProps$1 = {
|
|
|
26
21
|
thousands: false,
|
|
27
22
|
className: ''
|
|
28
23
|
};
|
|
29
|
-
|
|
30
24
|
var CountUp = function CountUp(props) {
|
|
31
25
|
var _defaultProps$1$props = _objectSpread(_objectSpread({}, defaultProps$1), props),
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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);
|
|
40
33
|
var b = cn('countup');
|
|
41
34
|
var countupRef = useRef(null);
|
|
42
35
|
var timerRef = useRef(0);
|
|
@@ -45,16 +38,13 @@ var CountUp = function CountUp(props) {
|
|
|
45
38
|
}, function (v, i) {
|
|
46
39
|
return i;
|
|
47
40
|
});
|
|
48
|
-
|
|
49
41
|
var getShowNumber = function getShowNumber() {
|
|
50
42
|
var splitArr = endNumber.split('.');
|
|
51
43
|
var intNumber = maxLen && splitArr[0].length < maxLen ? (Array(maxLen).join('0') + splitArr[0]).slice(-maxLen) : splitArr[0];
|
|
52
44
|
var currNumber = "".concat(thousands ? intNumber.replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') : intNumber).concat(splitArr[1] ? '.' : '').concat(splitArr[1] || '');
|
|
53
45
|
return currNumber.split('');
|
|
54
46
|
};
|
|
55
|
-
|
|
56
47
|
var numerArr = getShowNumber();
|
|
57
|
-
|
|
58
48
|
var setNumberTransform = function setNumberTransform() {
|
|
59
49
|
if (countupRef.current) {
|
|
60
50
|
var numberItems = countupRef.current.querySelectorAll('.nut-countup__number');
|
|
@@ -64,7 +54,6 @@ var CountUp = function CountUp(props) {
|
|
|
64
54
|
Object.keys(numberItems).forEach(function (key) {
|
|
65
55
|
var elem = numberItems[Number(key)];
|
|
66
56
|
var idx = Number(numberFilterArr[Number(key)]);
|
|
67
|
-
|
|
68
57
|
if ((idx || idx === 0) && elem) {
|
|
69
58
|
// 计算规则:父元素和实际列表高度的百分比,分割成20等份
|
|
70
59
|
var transform = "translate(0, -".concat((idx === 0 ? 10 : idx) * 5, "%)");
|
|
@@ -74,7 +63,6 @@ var CountUp = function CountUp(props) {
|
|
|
74
63
|
});
|
|
75
64
|
}
|
|
76
65
|
};
|
|
77
|
-
|
|
78
66
|
var numberEaseStyle = {
|
|
79
67
|
transition: "transform ".concat(easeSpeed, "s ease-in-out")
|
|
80
68
|
};
|
|
@@ -112,26 +100,19 @@ var CountUp = function CountUp(props) {
|
|
|
112
100
|
}, item));
|
|
113
101
|
})));
|
|
114
102
|
};
|
|
115
|
-
|
|
116
103
|
CountUp.defaultProps = defaultProps$1;
|
|
117
104
|
CountUp.displayName = 'NutCountUp';
|
|
118
105
|
var defaultProps = {};
|
|
119
|
-
|
|
120
106
|
var AnimatingNumbers = /*#__PURE__*/function (_Component) {
|
|
121
107
|
_inherits(AnimatingNumbers, _Component);
|
|
122
|
-
|
|
123
108
|
var _super = _createSuper(AnimatingNumbers);
|
|
124
|
-
|
|
125
109
|
function AnimatingNumbers(props) {
|
|
126
110
|
var _this;
|
|
127
|
-
|
|
128
111
|
_classCallCheck(this, AnimatingNumbers);
|
|
129
|
-
|
|
130
112
|
_this = _super.call(this, props);
|
|
131
113
|
_this.state = {};
|
|
132
114
|
return _this;
|
|
133
115
|
}
|
|
134
|
-
|
|
135
116
|
_createClass(AnimatingNumbers, [{
|
|
136
117
|
key: "render",
|
|
137
118
|
value: function render() {
|
|
@@ -140,15 +121,10 @@ var AnimatingNumbers = /*#__PURE__*/function (_Component) {
|
|
|
140
121
|
});
|
|
141
122
|
}
|
|
142
123
|
}]);
|
|
143
|
-
|
|
144
124
|
return AnimatingNumbers;
|
|
145
125
|
}(Component);
|
|
146
|
-
|
|
147
126
|
_defineProperty(AnimatingNumbers, "defaultProps", defaultProps);
|
|
148
|
-
|
|
149
127
|
_defineProperty(AnimatingNumbers, "displayName", 'NutAnimatingNumbers');
|
|
150
|
-
|
|
151
128
|
_defineProperty(AnimatingNumbers, "CountUp", CountUp);
|
|
152
|
-
|
|
153
129
|
AnimatingNumbers.CountUp = CountUp;
|
|
154
130
|
export { AnimatingNumbers as default };
|
package/dist/esm/Audio.js
CHANGED
|
@@ -2,11 +2,8 @@ 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", "muted", "autoplay", "loop", "preload", "type", "onFastBack", "onForward", "onPause", "onPlayEnd", "onMute", "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, useEffect } from 'react';
|
|
11
8
|
import Icon from './Icon.js';
|
|
12
9
|
import Range from './Range.js';
|
|
@@ -15,7 +12,6 @@ import Button from './Button.js';
|
|
|
15
12
|
import { useConfig } from './ConfigProvider.js';
|
|
16
13
|
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
17
14
|
import '@bem-react/classname';
|
|
18
|
-
|
|
19
15
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
20
16
|
className: '',
|
|
21
17
|
url: '',
|
|
@@ -32,51 +28,44 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
|
32
28
|
onMute: function onMute(e) {},
|
|
33
29
|
onCanPlay: function onCanPlay(e) {}
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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);
|
|
60
53
|
var _useState = useState(false),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
55
|
+
playing = _useState2[0],
|
|
56
|
+
setPlaying = _useState2[1];
|
|
65
57
|
var _useState3 = useState(0),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
59
|
+
percent = _useState4[0],
|
|
60
|
+
setPercent = _useState4[1];
|
|
70
61
|
var _useState5 = useState(false),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
63
|
+
isCanPlay = _useState6[0],
|
|
64
|
+
setIsCanPlay = _useState6[1];
|
|
75
65
|
var _useState7 = useState('00:00:00'),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
66
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
67
|
+
currentDuration = _useState8[0],
|
|
68
|
+
setCurrentDuration = _useState8[1];
|
|
80
69
|
var AudioRef = useRef(null);
|
|
81
70
|
var statusRef = useRef({
|
|
82
71
|
currentTime: 0,
|
|
@@ -90,7 +79,6 @@ var Audio = function Audio(props) {
|
|
|
90
79
|
});
|
|
91
80
|
var b = cn('audio');
|
|
92
81
|
var warn = console.warn;
|
|
93
|
-
|
|
94
82
|
var handleEnded = function handleEnded(e) {
|
|
95
83
|
if (props.loop) {
|
|
96
84
|
warn(locale.audio.tips || 'onPlayEnd事件在loop=false时才会触发');
|
|
@@ -98,7 +86,6 @@ var Audio = function Audio(props) {
|
|
|
98
86
|
props.onPlayEnd && props.onPlayEnd(e);
|
|
99
87
|
}
|
|
100
88
|
};
|
|
101
|
-
|
|
102
89
|
function watch() {
|
|
103
90
|
if (AudioRef && AudioRef.current) {
|
|
104
91
|
var current = AudioRef.current;
|
|
@@ -107,22 +94,18 @@ var Audio = function Audio(props) {
|
|
|
107
94
|
});
|
|
108
95
|
}
|
|
109
96
|
}
|
|
110
|
-
|
|
111
97
|
useEffect(function () {
|
|
112
98
|
watch();
|
|
113
99
|
}, []);
|
|
114
100
|
useEffect(function () {}, [currentDuration]);
|
|
115
|
-
|
|
116
101
|
var handleStatusChange = function handleStatusChange() {
|
|
117
102
|
setPlaying(!playing);
|
|
118
|
-
|
|
119
103
|
if (playing) {
|
|
120
104
|
AudioRef && AudioRef.current && AudioRef.current.pause();
|
|
121
105
|
} else {
|
|
122
106
|
AudioRef && AudioRef.current && AudioRef.current.play();
|
|
123
107
|
}
|
|
124
108
|
};
|
|
125
|
-
|
|
126
109
|
var renderIcon = function renderIcon() {
|
|
127
110
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
128
111
|
className: b('icon')
|
|
@@ -140,7 +123,6 @@ var Audio = function Audio(props) {
|
|
|
140
123
|
name: "service"
|
|
141
124
|
}))));
|
|
142
125
|
};
|
|
143
|
-
|
|
144
126
|
var handleBack = function handleBack() {
|
|
145
127
|
if (statusRef.current.currentTime > 0 && AudioRef.current) {
|
|
146
128
|
statusRef.current.currentTime--;
|
|
@@ -148,7 +130,6 @@ var Audio = function Audio(props) {
|
|
|
148
130
|
props.onFastBack && props.onFastBack(AudioRef.current);
|
|
149
131
|
}
|
|
150
132
|
};
|
|
151
|
-
|
|
152
133
|
var handleForward = function handleForward() {
|
|
153
134
|
if (AudioRef.current) {
|
|
154
135
|
statusRef.current.currentTime++;
|
|
@@ -156,24 +137,20 @@ var Audio = function Audio(props) {
|
|
|
156
137
|
props.onForward && props.onForward(AudioRef.current);
|
|
157
138
|
}
|
|
158
139
|
};
|
|
159
|
-
|
|
160
140
|
var handleMute = function handleMute() {
|
|
161
141
|
if (AudioRef.current) {
|
|
162
142
|
AudioRef.current.muted = !AudioRef.current.muted;
|
|
163
143
|
props.onMute && props.onMute(AudioRef.current);
|
|
164
144
|
}
|
|
165
145
|
};
|
|
166
|
-
|
|
167
146
|
var handlePause = function handlePause(e) {
|
|
168
147
|
setPlaying(false);
|
|
169
148
|
props.onPause && props.onPause(e);
|
|
170
149
|
};
|
|
171
|
-
|
|
172
150
|
var formatSeconds = function formatSeconds(value) {
|
|
173
151
|
if (!value) {
|
|
174
152
|
return '00:00:00';
|
|
175
153
|
}
|
|
176
|
-
|
|
177
154
|
var time = parseInt(value);
|
|
178
155
|
var hours = Math.floor(time / 3600);
|
|
179
156
|
var minutes = Math.floor((time - hours * 3600) / 60);
|
|
@@ -184,7 +161,6 @@ var Audio = function Audio(props) {
|
|
|
184
161
|
result += "0".concat(seconds.toString()).slice(-2);
|
|
185
162
|
return result;
|
|
186
163
|
};
|
|
187
|
-
|
|
188
164
|
var renderProgerss = function renderProgerss() {
|
|
189
165
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
190
166
|
className: b('progress')
|
|
@@ -222,43 +198,34 @@ var Audio = function Audio(props) {
|
|
|
222
198
|
onClick: handleMute
|
|
223
199
|
}, locale.audio.mute || '静音')));
|
|
224
200
|
};
|
|
225
|
-
|
|
226
201
|
var renderNone = function renderNone() {
|
|
227
202
|
return React__default.createElement("div", {
|
|
228
203
|
className: b('none-container'),
|
|
229
204
|
onClick: handleStatusChange
|
|
230
205
|
}, children);
|
|
231
206
|
};
|
|
232
|
-
|
|
233
207
|
var renderAudio = function renderAudio() {
|
|
234
208
|
switch (type) {
|
|
235
209
|
case 'icon':
|
|
236
210
|
return renderIcon();
|
|
237
|
-
|
|
238
211
|
case 'progress':
|
|
239
212
|
return renderProgerss();
|
|
240
|
-
|
|
241
213
|
case 'none':
|
|
242
214
|
return renderNone();
|
|
243
|
-
|
|
244
215
|
default:
|
|
245
216
|
return null;
|
|
246
217
|
}
|
|
247
218
|
};
|
|
248
|
-
|
|
249
219
|
var handleCanplay = function handleCanplay(e) {
|
|
250
220
|
setIsCanPlay(true);
|
|
251
|
-
|
|
252
221
|
if (props.autoplay && !playing) {
|
|
253
222
|
AudioRef && AudioRef.current && AudioRef.current.play();
|
|
254
223
|
}
|
|
255
|
-
|
|
256
224
|
if (AudioRef.current) {
|
|
257
225
|
statusRef.current.second = AudioRef.current.duration || 0;
|
|
258
226
|
props.onCanPlay && props.onCanPlay(e);
|
|
259
227
|
}
|
|
260
228
|
};
|
|
261
|
-
|
|
262
229
|
var onTimeupdate = function onTimeupdate(e) {
|
|
263
230
|
var time = parseInt(e.target.currentTime);
|
|
264
231
|
var formated = formatSeconds("".concat(time));
|
|
@@ -267,7 +234,6 @@ var Audio = function Audio(props) {
|
|
|
267
234
|
setCurrentDuration(formated);
|
|
268
235
|
statusRef.current.currentTime = time;
|
|
269
236
|
};
|
|
270
|
-
|
|
271
237
|
return React__default.createElement("div", _objectSpread({
|
|
272
238
|
className: "".concat(b(), " ").concat(className),
|
|
273
239
|
style: style
|
|
@@ -295,7 +261,6 @@ var Audio = function Audio(props) {
|
|
|
295
261
|
kind: "captions"
|
|
296
262
|
})));
|
|
297
263
|
};
|
|
298
|
-
|
|
299
264
|
Audio.defaultProps = defaultProps;
|
|
300
265
|
Audio.displayName = 'NutAudio';
|
|
301
266
|
export { Audio as default };
|
package/dist/esm/Avatar.js
CHANGED
|
@@ -2,11 +2,8 @@ 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';
|
|
@@ -14,7 +11,6 @@ import { c as cn } from './bem-893ad28d.js';
|
|
|
14
11
|
import Icon from './Icon.js';
|
|
15
12
|
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
16
13
|
import '@bem-react/classname';
|
|
17
|
-
|
|
18
14
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
19
15
|
size: '',
|
|
20
16
|
icon: '',
|
|
@@ -24,53 +20,43 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
|
24
20
|
url: '',
|
|
25
21
|
alt: ''
|
|
26
22
|
});
|
|
27
|
-
|
|
28
23
|
var Avatar = function Avatar(props) {
|
|
29
24
|
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;
|
|
30
|
-
|
|
31
25
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
26
|
+
children = _defaultProps$props.children,
|
|
27
|
+
prefixCls = _defaultProps$props.prefixCls,
|
|
28
|
+
size = _defaultProps$props.size,
|
|
29
|
+
shape = _defaultProps$props.shape,
|
|
30
|
+
bgColor = _defaultProps$props.bgColor,
|
|
31
|
+
color = _defaultProps$props.color,
|
|
32
|
+
url = _defaultProps$props.url,
|
|
33
|
+
alt = _defaultProps$props.alt,
|
|
34
|
+
icon = _defaultProps$props.icon,
|
|
35
|
+
className = _defaultProps$props.className,
|
|
36
|
+
style = _defaultProps$props.style,
|
|
37
|
+
activeAvatar = _defaultProps$props.activeAvatar,
|
|
38
|
+
onError = _defaultProps$props.onError,
|
|
39
|
+
iconClassPrefix = _defaultProps$props.iconClassPrefix,
|
|
40
|
+
iconFontClassName = _defaultProps$props.iconFontClassName,
|
|
41
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
49
42
|
var _useState = useState(0),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
+
maxSum = _useState2[0],
|
|
45
|
+
setMaxSum = _useState2[1]; // avatarGroup里的avatar的个数
|
|
55
46
|
var _useState3 = useState(false),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
48
|
+
showMax = _useState4[0],
|
|
49
|
+
setShowMax = _useState4[1]; // 是否显示的最大头像个数
|
|
61
50
|
var _useState5 = useState(1),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
51
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
52
|
+
avatarIndex = _useState6[0],
|
|
53
|
+
setAvatarIndex = _useState6[1]; // avatar的索引
|
|
67
54
|
var avatarRef = useRef(null);
|
|
68
55
|
var parent = useContext(AvatarContext);
|
|
69
56
|
var b = cn('avatar');
|
|
70
57
|
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));
|
|
71
58
|
var cls = classNames(b(''), classes, className);
|
|
72
59
|
var sizeValue = ['large', 'normal', 'small'];
|
|
73
|
-
|
|
74
60
|
var styles = _objectSpread({
|
|
75
61
|
width: sizeValue.indexOf(size) > -1 ? '' : "".concat(size, "px"),
|
|
76
62
|
height: sizeValue.indexOf(size) > -1 ? '' : "".concat(size, "px"),
|
|
@@ -79,7 +65,6 @@ var Avatar = function Avatar(props) {
|
|
|
79
65
|
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") : '',
|
|
80
66
|
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)) : ''
|
|
81
67
|
}, style);
|
|
82
|
-
|
|
83
68
|
var maxStyles = {
|
|
84
69
|
backgroundColor: "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro6 = parent.propAvatarGroup) === null || _parent$propAvatarGro6 === void 0 ? void 0 : _parent$propAvatarGro6.maxBgColor),
|
|
85
70
|
color: "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro7 = parent.propAvatarGroup) === null || _parent$propAvatarGro7 === void 0 ? void 0 : _parent$propAvatarGro7.maxColor)
|
|
@@ -87,47 +72,37 @@ var Avatar = function Avatar(props) {
|
|
|
87
72
|
var iconStyles = icon || '';
|
|
88
73
|
useEffect(function () {
|
|
89
74
|
var _parent$avatarGroupRe;
|
|
90
|
-
|
|
91
75
|
var avatarChildren = parent === null || parent === void 0 ? void 0 : (_parent$avatarGroupRe = parent.avatarGroupRef) === null || _parent$avatarGroupRe === void 0 ? void 0 : _parent$avatarGroupRe.current.children;
|
|
92
|
-
|
|
93
76
|
if (avatarChildren) {
|
|
94
77
|
avatarLength(avatarChildren);
|
|
95
78
|
}
|
|
96
79
|
}, []);
|
|
97
|
-
|
|
98
80
|
var avatarLength = function avatarLength(children) {
|
|
99
81
|
var _avatarRef$current, _avatarRef$current$da, _parent$propAvatarGro8;
|
|
100
|
-
|
|
101
82
|
for (var i = 0; i < children.length; i++) {
|
|
102
83
|
console.log('child', children[i], children[i].classList);
|
|
103
|
-
|
|
104
84
|
if (children[i] && children[i].classList && children[i].classList[0] === 'nut-avatar') {
|
|
105
85
|
children[i].setAttribute('data-index', i + 1);
|
|
106
86
|
}
|
|
107
87
|
}
|
|
108
|
-
|
|
109
88
|
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);
|
|
110
89
|
var maxCount = parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro8 = parent.propAvatarGroup) === null || _parent$propAvatarGro8 === void 0 ? void 0 : _parent$propAvatarGro8.maxCount;
|
|
111
90
|
setMaxSum(children.length);
|
|
112
91
|
setAvatarIndex(index);
|
|
113
|
-
|
|
114
92
|
if (index === children.length && index !== maxCount && children.length > maxCount) {
|
|
115
93
|
setShowMax(true);
|
|
116
94
|
}
|
|
117
95
|
};
|
|
118
|
-
|
|
119
96
|
var errorEvent = function errorEvent(e) {
|
|
120
97
|
if (props.onError) {
|
|
121
98
|
props.onError(e);
|
|
122
99
|
}
|
|
123
100
|
};
|
|
124
|
-
|
|
125
101
|
var clickAvatar = function clickAvatar(e) {
|
|
126
102
|
if (props.activeAvatar) {
|
|
127
103
|
props.activeAvatar(e);
|
|
128
104
|
}
|
|
129
105
|
};
|
|
130
|
-
|
|
131
106
|
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({
|
|
132
107
|
className: cls
|
|
133
108
|
}, rest), {}, {
|
|
@@ -149,7 +124,6 @@ var Avatar = function Avatar(props) {
|
|
|
149
124
|
className: "text"
|
|
150
125
|
}, 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)))));
|
|
151
126
|
};
|
|
152
|
-
|
|
153
127
|
Avatar.defaultProps = defaultProps;
|
|
154
128
|
Avatar.displayName = 'NutAvatar';
|
|
155
129
|
export { Avatar as default };
|
package/dist/esm/AvatarGroup.js
CHANGED
|
@@ -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';
|
|
@@ -20,15 +17,12 @@ var defaultProps = {
|
|
|
20
17
|
span: '-8',
|
|
21
18
|
zIndex: 'left'
|
|
22
19
|
};
|
|
23
|
-
|
|
24
20
|
var AvatarGroup = function AvatarGroup(props) {
|
|
25
21
|
useConfig();
|
|
26
|
-
|
|
27
22
|
var propAvatarGroup = _objectSpread(_objectSpread({}, defaultProps), props);
|
|
28
|
-
|
|
29
23
|
var className = propAvatarGroup.className,
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
style = propAvatarGroup.style,
|
|
25
|
+
children = propAvatarGroup.children;
|
|
32
26
|
var avatarGroupRef = useRef(null);
|
|
33
27
|
var b = cn('avatar-group');
|
|
34
28
|
var cls = classNames(b(''), className);
|
|
@@ -44,7 +38,6 @@ var AvatarGroup = function AvatarGroup(props) {
|
|
|
44
38
|
ref: avatarGroupRef
|
|
45
39
|
}, children));
|
|
46
40
|
};
|
|
47
|
-
|
|
48
41
|
AvatarGroup.defaultProps = defaultProps;
|
|
49
42
|
AvatarGroup.displayName = 'NutAvatarGroup';
|
|
50
43
|
export { AvatarGroup as default };
|