@nutui/nutui-react 1.1.3 → 1.1.4-beta.2
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/dist/esm/Address.js +22 -28
- package/dist/esm/Avatar/style/index.js +1 -1
- package/dist/esm/Avatar.js +97 -20
- package/dist/esm/Badge.js +0 -2
- package/dist/esm/Barrage.js +0 -1
- package/dist/esm/Calendar.js +6 -2
- package/dist/esm/CalendarItem.js +14 -13
- package/dist/esm/CheckboxGroup.js +1 -1
- package/dist/esm/CircleProgress.js +93 -56
- package/dist/esm/Collapse.js +2 -2
- package/dist/esm/ConfigProvider/style/index.js +2 -0
- package/dist/esm/ConfigProvider.js +146 -0
- package/dist/esm/CountDown.js +8 -4
- package/dist/esm/Dialog.js +7 -3
- package/dist/esm/FixedNav.js +5 -1
- package/dist/esm/Infiniteloading.js +7 -3
- package/dist/esm/Input.js +5 -1
- package/dist/esm/NoticeBar.js +1 -1
- package/dist/esm/Pagination.js +6 -2
- package/dist/esm/Picker.js +6 -2
- package/dist/esm/Range.js +5 -1
- package/dist/esm/ShortPassword.js +9 -5
- package/dist/esm/Signature.js +7 -3
- package/dist/esm/Skeleton.js +20 -12
- package/dist/esm/Step.js +14 -3
- package/dist/esm/Steps.js +4 -1
- package/dist/esm/Swiper.js +2 -1
- package/dist/esm/TabbarItem.js +9 -0
- package/dist/esm/TextArea.js +5 -1
- package/dist/esm/Toast.js +4 -10
- package/dist/esm/Uploader/style/index.js +2 -1
- package/dist/esm/Uploader.js +84 -18
- package/dist/esm/nutui-react.es.js +1 -0
- package/dist/locales/base.d.ts +91 -0
- package/dist/locales/base.js +5 -0
- package/dist/locales/en-US.d.ts +3 -0
- package/dist/locales/en-US.js +95 -0
- package/dist/locales/zh-CN.d.ts +3 -0
- package/dist/locales/zh-CN.js +97 -0
- package/dist/locales/zh-TW.d.ts +3 -0
- package/dist/locales/zh-TW.js +95 -0
- package/dist/nutui.react.es.js +519 -213
- package/dist/nutui.react.umd.js +26 -26
- package/dist/packages/avatar/avatar.scss +16 -6
- package/dist/packages/avatargroup/avatargroup.scss +14 -0
- package/dist/packages/circleprogress/circleprogress.scss +12 -53
- package/dist/packages/configprovider/configprovider.scss +0 -0
- package/dist/packages/skeleton/skeleton.scss +1 -3
- package/dist/packages/step/step.scss +29 -29
- package/dist/packages/uploader/uploader.scss +97 -14
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/themes/default.scss +2 -0
- package/dist/styles/variables.scss +36 -4
- package/dist/types/avatar/__tests__/avatar.spec.d.ts +1 -0
- package/dist/types/avatar/avatar.d.ts +6 -3
- package/dist/types/avatargroup/AvatarContext.d.ts +2 -0
- package/dist/types/avatargroup/__tests__/avatargroup.spec.d.ts +1 -0
- package/dist/types/avatargroup/avatargroup.d.ts +14 -0
- package/dist/types/avatargroup/index.d.ts +2 -0
- package/dist/types/barrage/__tests__/barrage.spec.d.ts +1 -0
- package/dist/types/button/button.d.ts +2 -2
- package/dist/types/checkbox/__test__/checkbox.spec.d.ts +1 -0
- package/dist/types/circleprogress/__tests__/circleprogress.spec.d.ts +1 -0
- package/dist/types/circleprogress/circleprogress.d.ts +11 -5
- package/dist/types/configprovider/configprovider.d.ts +12 -0
- package/dist/types/configprovider/index.d.ts +3 -0
- package/dist/types/icon/__test__/icon.spec.d.ts +1 -0
- package/dist/types/infiniteloading/__tests__/infiniteloading.spec.d.ts +1 -0
- package/dist/types/inputnumber/__tests__/inputnumber.spec.d.ts +1 -0
- package/dist/types/nutui.react.d.ts +2 -1
- package/dist/types/overlay/__tests__/overlay.spec.d.ts +1 -0
- package/dist/types/skeleton/__test__/skeleton.spec.d.ts +1 -0
- package/dist/types/skeleton/skeleton.d.ts +2 -2
- package/dist/types/step/step.d.ts +1 -0
- package/dist/types/steps/__tests__/steps.spec.d.ts +1 -0
- package/dist/types/steps/steps.d.ts +1 -0
- package/dist/types/tabbaritem/tabbaritem.d.ts +1 -0
- package/dist/types/toast/Notification.d.ts +1 -7
- package/dist/types/uploader/__tests__/uploader.spec.d.ts +1 -0
- package/dist/types/uploader/uploader.d.ts +9 -1
- package/package.json +9 -4
package/dist/esm/Address.js
CHANGED
|
@@ -13,6 +13,7 @@ import React__default, { useEffect, useState, useRef } from 'react';
|
|
|
13
13
|
import Icon from './Icon.js';
|
|
14
14
|
import Popup from './Popup.js';
|
|
15
15
|
import { c as cn } from './bem-893ad28d.js';
|
|
16
|
+
import { useConfig } from './ConfigProvider.js';
|
|
16
17
|
import Elevator from './Elevator.js';
|
|
17
18
|
import '@bem-react/classname';
|
|
18
19
|
var defaultProps$2 = {
|
|
@@ -25,6 +26,9 @@ var defaultProps$2 = {
|
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
var ExistRender = function ExistRender(props) {
|
|
29
|
+
var _useConfig = useConfig(),
|
|
30
|
+
locale = _useConfig.locale;
|
|
31
|
+
|
|
28
32
|
var _defaultProps$2$props = _objectSpread(_objectSpread({}, defaultProps$2), props),
|
|
29
33
|
children = _defaultProps$2$props.children,
|
|
30
34
|
type = _defaultProps$2$props.type,
|
|
@@ -103,7 +107,7 @@ var ExistRender = function ExistRender(props) {
|
|
|
103
107
|
onClick: switchModule
|
|
104
108
|
}, React__default.createElement("div", {
|
|
105
109
|
className: b('choose-other-btn')
|
|
106
|
-
}, customAndExistTitle)));
|
|
110
|
+
}, locale.address.chooseAnotherAddress || customAndExistTitle)));
|
|
107
111
|
};
|
|
108
112
|
|
|
109
113
|
var defaultProps$1 = {
|
|
@@ -116,6 +120,9 @@ var defaultProps$1 = {
|
|
|
116
120
|
};
|
|
117
121
|
|
|
118
122
|
var CustomRender = function CustomRender(props) {
|
|
123
|
+
var _useConfig2 = useConfig(),
|
|
124
|
+
locale = _useConfig2.locale;
|
|
125
|
+
|
|
119
126
|
var _defaultProps$1$props = _objectSpread(_objectSpread({}, defaultProps$1), props),
|
|
120
127
|
children = _defaultProps$1$props.children,
|
|
121
128
|
type = _defaultProps$1$props.type,
|
|
@@ -131,9 +138,8 @@ var CustomRender = function CustomRender(props) {
|
|
|
131
138
|
var b = cn('address');
|
|
132
139
|
|
|
133
140
|
var _useState = useState(type),
|
|
134
|
-
_useState2 = _slicedToArray(_useState,
|
|
135
|
-
privateType = _useState2[0]
|
|
136
|
-
setPrivateType = _useState2[1];
|
|
141
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
142
|
+
privateType = _useState2[0];
|
|
137
143
|
|
|
138
144
|
var _useState3 = useState(0),
|
|
139
145
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
@@ -141,9 +147,8 @@ var CustomRender = function CustomRender(props) {
|
|
|
141
147
|
setTabIndex = _useState4[1];
|
|
142
148
|
|
|
143
149
|
var _useState5 = useState(['province', 'city', 'country', 'town']),
|
|
144
|
-
_useState6 = _slicedToArray(_useState5,
|
|
145
|
-
tabName = _useState6[0]
|
|
146
|
-
setTabName = _useState6[1];
|
|
150
|
+
_useState6 = _slicedToArray(_useState5, 1),
|
|
151
|
+
tabName = _useState6[0];
|
|
147
152
|
|
|
148
153
|
var provinceRef = useRef(null);
|
|
149
154
|
var cityRef = useRef(null);
|
|
@@ -229,7 +234,7 @@ var CustomRender = function CustomRender(props) {
|
|
|
229
234
|
return item.name;
|
|
230
235
|
}
|
|
231
236
|
|
|
232
|
-
return
|
|
237
|
+
return locale.select;
|
|
233
238
|
};
|
|
234
239
|
|
|
235
240
|
var mapRef = {
|
|
@@ -397,6 +402,9 @@ var defaultProps = {
|
|
|
397
402
|
};
|
|
398
403
|
|
|
399
404
|
var Address = function Address(props) {
|
|
405
|
+
var _useConfig3 = useConfig(),
|
|
406
|
+
locale = _useConfig3.locale;
|
|
407
|
+
|
|
400
408
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
401
409
|
modelValue = _defaultProps$props.modelValue,
|
|
402
410
|
children = _defaultProps$props.children,
|
|
@@ -432,9 +440,8 @@ var Address = function Address(props) {
|
|
|
432
440
|
setPrivateType = _useState14[1];
|
|
433
441
|
|
|
434
442
|
var _useState15 = useState(['province', 'city', 'country', 'town']),
|
|
435
|
-
_useState16 = _slicedToArray(_useState15,
|
|
436
|
-
tabName = _useState16[0]
|
|
437
|
-
setTabName = _useState16[1];
|
|
443
|
+
_useState16 = _slicedToArray(_useState15, 1),
|
|
444
|
+
tabName = _useState16[0];
|
|
438
445
|
|
|
439
446
|
var _useState17 = useState(modelValue),
|
|
440
447
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
@@ -464,25 +471,15 @@ var Address = function Address(props) {
|
|
|
464
471
|
_useState22 = _slicedToArray(_useState21, 2),
|
|
465
472
|
selectedExistAddress = _useState22[0],
|
|
466
473
|
setSelectedExistAddress = _useState22[1]; // 当前选择的地址
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
var _useState23 = useState('self'),
|
|
470
|
-
_useState24 = _slicedToArray(_useState23, 2),
|
|
471
|
-
closeWay = _useState24[0],
|
|
472
|
-
setCloseWay = _useState24[1]; // 手动关闭 点击叉号(cross),或者蒙层(mask)
|
|
474
|
+
// 手动关闭 点击叉号(cross),或者蒙层(mask)
|
|
473
475
|
|
|
474
476
|
|
|
475
477
|
var handClose = function handClose() {
|
|
476
|
-
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'self';
|
|
477
|
-
setCloseWay(function () {
|
|
478
|
-
return type === 'cross' ? 'cross' : 'self';
|
|
479
|
-
});
|
|
480
478
|
setShowPopup(false);
|
|
481
479
|
}; // 点击遮罩层关闭
|
|
482
480
|
|
|
483
481
|
|
|
484
482
|
var clickOverlay = function clickOverlay() {
|
|
485
|
-
setCloseWay('mask');
|
|
486
483
|
closeMask && closeMask({
|
|
487
484
|
closeWay: 'mask'
|
|
488
485
|
});
|
|
@@ -571,9 +568,9 @@ var Address = function Address(props) {
|
|
|
571
568
|
color: "#cccccc"
|
|
572
569
|
})), React__default.createElement("div", {
|
|
573
570
|
className: b('header__title')
|
|
574
|
-
}, privateType === 'custom' ? customAddressTitle : existAddressTitle), React__default.createElement("div", {
|
|
571
|
+
}, privateType === 'custom' ? locale.address.selectRegion || customAddressTitle : locale.address.deliveryTo || existAddressTitle), React__default.createElement("div", {
|
|
575
572
|
onClick: function onClick() {
|
|
576
|
-
return handClose(
|
|
573
|
+
return handClose();
|
|
577
574
|
}
|
|
578
575
|
}, closeBtnIcon && React__default.createElement(Icon, {
|
|
579
576
|
name: closeBtnIcon,
|
|
@@ -594,9 +591,6 @@ var Address = function Address(props) {
|
|
|
594
591
|
visible: showPopup,
|
|
595
592
|
position: "bottom",
|
|
596
593
|
onClickOverlay: clickOverlay,
|
|
597
|
-
onOpen: function onOpen() {
|
|
598
|
-
setCloseWay('self');
|
|
599
|
-
},
|
|
600
594
|
onClose: function onClose() {
|
|
601
595
|
closeFun();
|
|
602
596
|
}
|
|
@@ -620,7 +614,7 @@ var Address = function Address(props) {
|
|
|
620
614
|
selectedIcon: selectedIcon,
|
|
621
615
|
defaultIcon: defaultIcon,
|
|
622
616
|
isShowCustomAddress: isShowCustomAddress,
|
|
623
|
-
customAndExistTitle: customAndExistTitle,
|
|
617
|
+
customAndExistTitle: locale.address.chooseAnotherAddress || customAndExistTitle,
|
|
624
618
|
onSelected: selectedExist,
|
|
625
619
|
onSwitchModule: onSwitchModule
|
|
626
620
|
}))));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
require('../../AvatarGroup/style')
|
|
2
2
|
require('../../../packages/avatar/avatar.scss')
|
package/dist/esm/Avatar.js
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "prefixCls", "size", "shape", "bgColor", "
|
|
4
|
+
var _excluded = ["children", "prefixCls", "size", "shape", "bgColor", "color", "url", "alt", "icon", "className", "style", "activeAvatar", "onError"];
|
|
4
5
|
|
|
5
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
7
|
|
|
7
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
9
|
|
|
9
|
-
import React__default from 'react';
|
|
10
|
+
import React__default, { createContext, useState, useRef, useContext, useEffect } from 'react';
|
|
11
|
+
import { c as cn } from './bem-893ad28d.js';
|
|
10
12
|
import classNames from 'classnames';
|
|
11
13
|
import Icon from './Icon.js';
|
|
14
|
+
import '@bem-react/classname';
|
|
15
|
+
var AvatarContext = createContext({});
|
|
12
16
|
var defaultProps = {
|
|
13
|
-
size: '
|
|
17
|
+
size: '',
|
|
14
18
|
icon: '',
|
|
15
|
-
shape: 'round',
|
|
16
19
|
bgColor: '#eee',
|
|
20
|
+
color: '#666',
|
|
17
21
|
prefixCls: 'nut-avatar',
|
|
18
|
-
|
|
22
|
+
url: '',
|
|
23
|
+
alt: ''
|
|
19
24
|
};
|
|
20
25
|
|
|
21
26
|
var Avatar = function Avatar(props) {
|
|
22
|
-
var _classNames;
|
|
27
|
+
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;
|
|
23
28
|
|
|
24
29
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
25
30
|
children = _defaultProps$props.children,
|
|
@@ -27,42 +32,114 @@ var Avatar = function Avatar(props) {
|
|
|
27
32
|
size = _defaultProps$props.size,
|
|
28
33
|
shape = _defaultProps$props.shape,
|
|
29
34
|
bgColor = _defaultProps$props.bgColor,
|
|
30
|
-
|
|
35
|
+
color = _defaultProps$props.color,
|
|
36
|
+
url = _defaultProps$props.url,
|
|
37
|
+
alt = _defaultProps$props.alt,
|
|
31
38
|
icon = _defaultProps$props.icon,
|
|
32
39
|
className = _defaultProps$props.className,
|
|
33
40
|
style = _defaultProps$props.style,
|
|
41
|
+
activeAvatar = _defaultProps$props.activeAvatar,
|
|
42
|
+
onError = _defaultProps$props.onError,
|
|
34
43
|
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
35
44
|
|
|
45
|
+
var _useState = useState(0),
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
+
maxSum = _useState2[0],
|
|
48
|
+
setMaxSum = _useState2[1]; // avatarGroup里的avatar的个数
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
var _useState3 = useState(false),
|
|
52
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
53
|
+
showMax = _useState4[0],
|
|
54
|
+
setShowMax = _useState4[1]; // 是否显示的最大头像个数
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
var _useState5 = useState(1),
|
|
58
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
59
|
+
avatarIndex = _useState6[0],
|
|
60
|
+
setAvatarIndex = _useState6[1]; // avatar的索引
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
var avatarRef = useRef(null);
|
|
64
|
+
var parent = useContext(AvatarContext);
|
|
65
|
+
var b = cn('avatar');
|
|
66
|
+
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));
|
|
67
|
+
var cls = classNames(b(''), classes, className);
|
|
36
68
|
var sizeValue = ['large', 'normal', 'small'];
|
|
37
|
-
var classes = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls), true), _defineProperty(_classNames, "avatar-".concat(size), true), _defineProperty(_classNames, "avatar-".concat(shape), true), _classNames));
|
|
38
|
-
var cls = classNames(classes, className);
|
|
39
69
|
|
|
40
70
|
var styles = _objectSpread({
|
|
41
71
|
width: sizeValue.indexOf(size) > -1 ? '' : "".concat(size, "px"),
|
|
42
72
|
height: sizeValue.indexOf(size) > -1 ? '' : "".concat(size, "px"),
|
|
43
|
-
|
|
44
|
-
|
|
73
|
+
backgroundColor: "".concat(bgColor),
|
|
74
|
+
color: "".concat(color),
|
|
75
|
+
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") : '',
|
|
76
|
+
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)) : ''
|
|
45
77
|
}, style);
|
|
46
78
|
|
|
47
|
-
var
|
|
79
|
+
var maxStyles = {
|
|
80
|
+
backgroundColor: "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro6 = parent.propAvatarGroup) === null || _parent$propAvatarGro6 === void 0 ? void 0 : _parent$propAvatarGro6.maxBgColor),
|
|
81
|
+
color: "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro7 = parent.propAvatarGroup) === null || _parent$propAvatarGro7 === void 0 ? void 0 : _parent$propAvatarGro7.maxColor)
|
|
82
|
+
};
|
|
83
|
+
var iconStyles = !!icon ? icon : '';
|
|
84
|
+
useEffect(function () {
|
|
85
|
+
var _parent$avatarGroupRe;
|
|
86
|
+
|
|
87
|
+
var avatarChildren = parent === null || parent === void 0 ? void 0 : (_parent$avatarGroupRe = parent.avatarGroupRef) === null || _parent$avatarGroupRe === void 0 ? void 0 : _parent$avatarGroupRe.current.children;
|
|
88
|
+
|
|
89
|
+
if (avatarChildren) {
|
|
90
|
+
avatarLength(avatarChildren);
|
|
91
|
+
}
|
|
92
|
+
}, []);
|
|
93
|
+
|
|
94
|
+
var avatarLength = function avatarLength(children) {
|
|
95
|
+
var _avatarRef$current, _avatarRef$current$da, _parent$propAvatarGro8;
|
|
48
96
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
97
|
+
for (var i = 0; i < children.length; i++) {
|
|
98
|
+
if (children[i] && children[i].classList && children[i].classList[0] == 'nut-avatar') {
|
|
99
|
+
children[i].setAttribute('data-index', i + 1);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
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;
|
|
104
|
+
var maxCount = parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro8 = parent.propAvatarGroup) === null || _parent$propAvatarGro8 === void 0 ? void 0 : _parent$propAvatarGro8.maxCount;
|
|
105
|
+
setMaxSum(children.length);
|
|
106
|
+
setAvatarIndex(index);
|
|
107
|
+
|
|
108
|
+
if (index == children.length && index != maxCount && children.length > maxCount) {
|
|
109
|
+
setShowMax(true);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
var errorEvent = function errorEvent(e) {
|
|
114
|
+
if (props.onError) {
|
|
115
|
+
props.onError(e);
|
|
52
116
|
}
|
|
53
117
|
};
|
|
54
118
|
|
|
55
|
-
|
|
119
|
+
var clickAvatar = function clickAvatar(e) {
|
|
120
|
+
if (props.activeAvatar) {
|
|
121
|
+
props.activeAvatar(e);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
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({
|
|
56
126
|
className: cls
|
|
57
127
|
}, rest), {}, {
|
|
58
|
-
style: styles,
|
|
59
|
-
onClick:
|
|
60
|
-
|
|
128
|
+
style: !showMax ? styles : maxStyles,
|
|
129
|
+
onClick: clickAvatar,
|
|
130
|
+
ref: avatarRef
|
|
131
|
+
}), (!(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", {
|
|
132
|
+
src: url,
|
|
133
|
+
alt: alt,
|
|
134
|
+
onError: errorEvent
|
|
135
|
+
}), icon && React__default.createElement(Icon, {
|
|
61
136
|
className: "icon",
|
|
62
137
|
name: iconStyles
|
|
63
138
|
}), children && React__default.createElement("span", {
|
|
64
139
|
className: "text"
|
|
65
|
-
}, children))
|
|
140
|
+
}, children)), showMax && React__default.createElement("div", {
|
|
141
|
+
className: "text"
|
|
142
|
+
}, 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)))));
|
|
66
143
|
};
|
|
67
144
|
|
|
68
145
|
Avatar.defaultProps = defaultProps;
|
package/dist/esm/Badge.js
CHANGED
|
@@ -19,10 +19,8 @@ var defaultProps = {
|
|
|
19
19
|
|
|
20
20
|
var Badge = function Badge(props) {
|
|
21
21
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
22
|
-
value = _defaultProps$props.value,
|
|
23
22
|
children = _defaultProps$props.children,
|
|
24
23
|
dot = _defaultProps$props.dot,
|
|
25
|
-
max = _defaultProps$props.max,
|
|
26
24
|
top = _defaultProps$props.top,
|
|
27
25
|
right = _defaultProps$props.right,
|
|
28
26
|
zIndex = _defaultProps$props.zIndex,
|
package/dist/esm/Barrage.js
CHANGED
|
@@ -74,7 +74,6 @@ var InternalBarrage = function InternalBarrage(props, ref) {
|
|
|
74
74
|
barrageContainer.current.appendChild(el);
|
|
75
75
|
var width = el.offsetWidth;
|
|
76
76
|
var height = el.offsetHeight;
|
|
77
|
-
console.log(el.offsetWidth, el.offsetHeight);
|
|
78
77
|
el.classList.add('move');
|
|
79
78
|
el.style.animationDuration = "".concat(speeds, "ms");
|
|
80
79
|
el.style.top = "".concat(_index % rows * (height + top) + 20, "px");
|
package/dist/esm/Calendar.js
CHANGED
|
@@ -8,6 +8,7 @@ import React__default from 'react';
|
|
|
8
8
|
import Popup from './Popup.js';
|
|
9
9
|
import CalendarItem from './CalendarItem.js';
|
|
10
10
|
import { U as Utils } from './date-b4847376.js';
|
|
11
|
+
import { useConfig } from './ConfigProvider.js';
|
|
11
12
|
var defaultProps = {
|
|
12
13
|
type: 'one',
|
|
13
14
|
isAutoBackFill: false,
|
|
@@ -22,6 +23,9 @@ var defaultProps = {
|
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
var Calendar = function Calendar(props) {
|
|
26
|
+
var _useConfig = useConfig(),
|
|
27
|
+
locale = _useConfig.locale;
|
|
28
|
+
|
|
25
29
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
26
30
|
children = _defaultProps$props.children,
|
|
27
31
|
poppable = _defaultProps$props.poppable,
|
|
@@ -61,7 +65,7 @@ var Calendar = function Calendar(props) {
|
|
|
61
65
|
type: type,
|
|
62
66
|
isAutoBackFill: isAutoBackFill,
|
|
63
67
|
poppable: poppable,
|
|
64
|
-
title: title,
|
|
68
|
+
title: locale.calendaritem.title || title,
|
|
65
69
|
defaultValue: defaultValue,
|
|
66
70
|
startDate: startDate,
|
|
67
71
|
endDate: endDate,
|
|
@@ -72,7 +76,7 @@ var Calendar = function Calendar(props) {
|
|
|
72
76
|
type: type,
|
|
73
77
|
isAutoBackFill: isAutoBackFill,
|
|
74
78
|
poppable: poppable,
|
|
75
|
-
title: title,
|
|
79
|
+
title: locale.calendaritem.title,
|
|
76
80
|
defaultValue: defaultValue,
|
|
77
81
|
startDate: startDate,
|
|
78
82
|
endDate: endDate,
|
package/dist/esm/CalendarItem.js
CHANGED
|
@@ -10,6 +10,7 @@ import React__default, { useState, useRef, useEffect } from 'react';
|
|
|
10
10
|
import classNames from 'classnames';
|
|
11
11
|
import { c as cn } from './bem-893ad28d.js';
|
|
12
12
|
import { U as Utils } from './date-b4847376.js';
|
|
13
|
+
import { useConfig } from './ConfigProvider.js';
|
|
13
14
|
import '@bem-react/classname';
|
|
14
15
|
|
|
15
16
|
function requestAniFrame() {
|
|
@@ -42,12 +43,13 @@ var defaultProps = {
|
|
|
42
43
|
var CalendarItem = function CalendarItem(props) {
|
|
43
44
|
var _classNames, _classNames2;
|
|
44
45
|
|
|
46
|
+
var _useConfig = useConfig(),
|
|
47
|
+
locale = _useConfig.locale;
|
|
48
|
+
|
|
45
49
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
46
|
-
children = _defaultProps$props.children,
|
|
47
50
|
type = _defaultProps$props.type,
|
|
48
51
|
isAutoBackFill = _defaultProps$props.isAutoBackFill,
|
|
49
52
|
poppable = _defaultProps$props.poppable,
|
|
50
|
-
visible = _defaultProps$props.visible,
|
|
51
53
|
title = _defaultProps$props.title,
|
|
52
54
|
defaultValue = _defaultProps$props.defaultValue,
|
|
53
55
|
startDate = _defaultProps$props.startDate,
|
|
@@ -56,7 +58,7 @@ var CalendarItem = function CalendarItem(props) {
|
|
|
56
58
|
onUpdate = _defaultProps$props.onUpdate,
|
|
57
59
|
onClose = _defaultProps$props.onClose;
|
|
58
60
|
|
|
59
|
-
var weeks =
|
|
61
|
+
var weeks = locale.calendaritem.weekdays;
|
|
60
62
|
|
|
61
63
|
var _useState = useState(''),
|
|
62
64
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -95,9 +97,8 @@ var CalendarItem = function CalendarItem(props) {
|
|
|
95
97
|
isRange: type === 'range',
|
|
96
98
|
timer: 0
|
|
97
99
|
}),
|
|
98
|
-
_useState8 = _slicedToArray(_useState7,
|
|
99
|
-
state = _useState8[0]
|
|
100
|
-
setState = _useState8[1];
|
|
100
|
+
_useState8 = _slicedToArray(_useState7, 1),
|
|
101
|
+
state = _useState8[0];
|
|
101
102
|
|
|
102
103
|
var weeksPanel = useRef(null);
|
|
103
104
|
var months = useRef(null);
|
|
@@ -263,7 +264,7 @@ var CalendarItem = function CalendarItem(props) {
|
|
|
263
264
|
};
|
|
264
265
|
var monthInfo = {
|
|
265
266
|
curData: curData,
|
|
266
|
-
title:
|
|
267
|
+
title: locale.calendaritem.monthTitle(title.year, title.month),
|
|
267
268
|
monthData: [].concat(_toConsumableArray(getDaysStatus(preMonthDays, 'prev')), _toConsumableArray(getDaysStatus(currMonthDays, 'curr')))
|
|
268
269
|
};
|
|
269
270
|
|
|
@@ -491,7 +492,7 @@ var CalendarItem = function CalendarItem(props) {
|
|
|
491
492
|
className: headerClasses
|
|
492
493
|
}, poppable ? React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
493
494
|
className: "calendar-title"
|
|
494
|
-
}, title), React__default.createElement("div", {
|
|
495
|
+
}, locale.calendaritem.title), React__default.createElement("div", {
|
|
495
496
|
className: "calendar-curr-month"
|
|
496
497
|
}, yearMonthTitle)) : '', React__default.createElement("div", {
|
|
497
498
|
className: "calendar-weeks",
|
|
@@ -512,7 +513,7 @@ var CalendarItem = function CalendarItem(props) {
|
|
|
512
513
|
ref: monthsPanel
|
|
513
514
|
}, React__default.createElement("div", {
|
|
514
515
|
className: "calendar-loading-tip"
|
|
515
|
-
}, !unLoadPrev ?
|
|
516
|
+
}, !unLoadPrev ? locale.calendaritem.loadPreviousMonth : locale.calendaritem.noEarlierMonth), monthsData.map(function (month, key) {
|
|
516
517
|
return React__default.createElement("div", {
|
|
517
518
|
className: "calendar-month",
|
|
518
519
|
key: key
|
|
@@ -533,18 +534,18 @@ var CalendarItem = function CalendarItem(props) {
|
|
|
533
534
|
className: "calendar-day"
|
|
534
535
|
}, day.type === 'curr' ? day.day : ''), isCurrDay(month, day.day) ? React__default.createElement("div", {
|
|
535
536
|
className: "calendar-curr-tips"
|
|
536
|
-
},
|
|
537
|
+
}, locale.calendaritem.today) : '', isStartTip(day, month) ? React__default.createElement("div", {
|
|
537
538
|
className: "calendar-day-tip"
|
|
538
|
-
},
|
|
539
|
+
}, locale.calendaritem.start) : isEndTip(day, month) ? React__default.createElement("div", {
|
|
539
540
|
className: "calendar-day-tip"
|
|
540
|
-
},
|
|
541
|
+
}, locale.calendaritem.end) : '');
|
|
541
542
|
}))));
|
|
542
543
|
}))), poppable && !isAutoBackFill ? React__default.createElement("div", {
|
|
543
544
|
className: "nut-calendar-footer"
|
|
544
545
|
}, React__default.createElement("div", {
|
|
545
546
|
className: "calendar-confirm-btn",
|
|
546
547
|
onClick: confirm
|
|
547
|
-
},
|
|
548
|
+
}, locale.confirm)) : ''));
|
|
548
549
|
};
|
|
549
550
|
|
|
550
551
|
CalendarItem.defaultProps = defaultProps;
|
|
@@ -83,7 +83,7 @@ var CheckboxGroup = React__default.forwardRef(function (props, ref) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
function cloneChildren() {
|
|
86
|
-
return React__default.Children.map(children, function (child
|
|
86
|
+
return React__default.Children.map(children, function (child) {
|
|
87
87
|
var childChecked = validateChildChecked(child);
|
|
88
88
|
|
|
89
89
|
if (child.type.displayName !== 'NutCheckBox') {
|