@nutui/nutui-react 1.1.4 → 1.1.5-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 +23 -11
- package/dist/esm/Barrage.js +1 -1
- package/dist/esm/Button.js +27 -28
- package/dist/esm/ConfigProvider.js +3 -2
- package/dist/esm/Dialog.js +4 -4
- package/dist/esm/Empty/style/index.js +2 -0
- package/dist/esm/Empty.js +89 -0
- package/dist/esm/FixedNav.js +3 -2
- package/dist/esm/Input.js +3 -2
- package/dist/esm/Swiper.js +62 -39
- package/dist/esm/SwiperItem.js +0 -4
- package/dist/esm/Uploader.js +12 -6
- package/dist/esm/nutui-react.es.js +1 -0
- package/dist/locales/base.d.ts +1 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +4 -3
- package/dist/locales/zh-CN.js +4 -3
- package/dist/locales/zh-TW.js +4 -3
- package/dist/nutui.react.es.js +354 -243
- package/dist/nutui.react.umd.js +15 -21
- package/dist/packages/empty/empty.scss +33 -0
- package/dist/packages/fixednav/fixednav.scss +1 -1
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/themes/default.scss +1 -0
- package/dist/styles/variables.scss +8 -0
- package/dist/types/address/address.d.ts +1 -0
- package/dist/types/address/customRender.d.ts +1 -0
- package/dist/types/card/__test__/card.spec.d.ts +1 -0
- package/dist/types/cell/__test__/cell.spec.d.ts +1 -0
- package/dist/types/cellgroup/__test__/cellgroup.spec.d.ts +1 -0
- package/dist/types/empty/empty.d.ts +8 -0
- package/dist/types/empty/index.d.ts +2 -0
- package/dist/types/nutui.react.d.ts +2 -1
- package/dist/types/price/__test__/price.spec.d.ts +1 -0
- package/package.json +1 -1
package/dist/esm/Address.js
CHANGED
|
@@ -2,8 +2,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["children", "type", "existAddress", "selectedIcon", "defaultIcon", "isShowCustomAddress", "customAndExistTitle", "onSelected", "onClose", "onSwitchModule"],
|
|
5
|
-
_excluded2 = ["children", "type", "height", "province", "city", "country", "town", "onNextArea", "onClose"],
|
|
6
|
-
_excluded3 = ["modelValue", "children", "type", "height", "customAddressTitle", "existAddress", "existAddressTitle", "province", "city", "country", "town", "isShowCustomAddress", "customAndExistTitle", "selectedIcon", "defaultIcon", "closeBtnIcon", "backBtnIcon", "onChange", "onSelected", "onClose", "closeMask", "switchModule", "style", "className"];
|
|
5
|
+
_excluded2 = ["children", "type", "height", "province", "city", "country", "town", "onNextArea", "onTabClick", "onClose"],
|
|
6
|
+
_excluded3 = ["modelValue", "children", "type", "height", "customAddressTitle", "existAddress", "existAddressTitle", "province", "city", "country", "town", "isShowCustomAddress", "customAndExistTitle", "selectedIcon", "defaultIcon", "closeBtnIcon", "backBtnIcon", "onChange", "onSelected", "onClose", "closeMask", "switchModule", "onTabChecked", "style", "className"];
|
|
7
7
|
|
|
8
8
|
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; }
|
|
9
9
|
|
|
@@ -132,6 +132,7 @@ var CustomRender = function CustomRender(props) {
|
|
|
132
132
|
country = _defaultProps$1$props.country,
|
|
133
133
|
town = _defaultProps$1$props.town,
|
|
134
134
|
onNextArea = _defaultProps$1$props.onNextArea,
|
|
135
|
+
onTabClick = _defaultProps$1$props.onTabClick,
|
|
135
136
|
onClose = _defaultProps$1$props.onClose,
|
|
136
137
|
rest = _objectWithoutProperties(_defaultProps$1$props, _excluded2);
|
|
137
138
|
|
|
@@ -279,13 +280,18 @@ var CustomRender = function CustomRender(props) {
|
|
|
279
280
|
_loop(i);
|
|
280
281
|
}
|
|
281
282
|
|
|
282
|
-
if (tabIndex <
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
283
|
+
if (tabIndex < 4) {
|
|
284
|
+
// 切换下一个
|
|
285
|
+
if (tabIndex === 3) {
|
|
286
|
+
calBack.next = '';
|
|
287
|
+
} else {
|
|
288
|
+
setTabIndex(function () {
|
|
289
|
+
return tabIndex + 1;
|
|
290
|
+
});
|
|
291
|
+
lineAnimation(tabIndex + 1);
|
|
292
|
+
calBack.next = tabName[tabIndex + 1];
|
|
293
|
+
}
|
|
287
294
|
|
|
288
|
-
calBack.next = tabName[tabIndex + 1];
|
|
289
295
|
calBack.value = item;
|
|
290
296
|
onNextArea && onNextArea(calBack);
|
|
291
297
|
} else {
|
|
@@ -294,11 +300,13 @@ var CustomRender = function CustomRender(props) {
|
|
|
294
300
|
}; // 切换地区Tab
|
|
295
301
|
|
|
296
302
|
|
|
297
|
-
var changeRegionTab = function changeRegionTab(item, index) {
|
|
303
|
+
var changeRegionTab = function changeRegionTab(item, index, key) {
|
|
298
304
|
if (getTabName(item, index)) {
|
|
299
305
|
setTabIndex(index);
|
|
300
306
|
lineAnimation(index);
|
|
301
307
|
}
|
|
308
|
+
|
|
309
|
+
onTabClick && onTabClick(key);
|
|
302
310
|
};
|
|
303
311
|
|
|
304
312
|
var handleElevatorItem = function handleElevatorItem(key, item) {
|
|
@@ -347,9 +355,9 @@ var CustomRender = function CustomRender(props) {
|
|
|
347
355
|
key: index,
|
|
348
356
|
ref: mapRef[key],
|
|
349
357
|
onClick: function onClick() {
|
|
350
|
-
return changeRegionTab(selectedRegion[key], index);
|
|
358
|
+
return changeRegionTab(selectedRegion[key], index, key);
|
|
351
359
|
}
|
|
352
|
-
}, React__default.createElement("div", null, getTabName(selectedRegion[key], index)));
|
|
360
|
+
}, index <= tabIndex && React__default.createElement("div", null, getTabName(selectedRegion[key], index)));
|
|
353
361
|
}), React__default.createElement("div", {
|
|
354
362
|
className: b('tab-line'),
|
|
355
363
|
ref: regionLine,
|
|
@@ -428,6 +436,7 @@ var Address = function Address(props) {
|
|
|
428
436
|
onClose = _defaultProps$props.onClose,
|
|
429
437
|
closeMask = _defaultProps$props.closeMask,
|
|
430
438
|
switchModule = _defaultProps$props.switchModule,
|
|
439
|
+
onTabChecked = _defaultProps$props.onTabChecked,
|
|
431
440
|
style = _defaultProps$props.style,
|
|
432
441
|
className = _defaultProps$props.className,
|
|
433
442
|
rest = _objectWithoutProperties(_defaultProps$props, _excluded3);
|
|
@@ -607,6 +616,9 @@ var Address = function Address(props) {
|
|
|
607
616
|
onNextArea: function onNextArea(cal) {
|
|
608
617
|
nextAreaList && nextAreaList(cal);
|
|
609
618
|
},
|
|
619
|
+
onTabClick: function onTabClick(type) {
|
|
620
|
+
onTabChecked && onTabChecked(type);
|
|
621
|
+
},
|
|
610
622
|
onClose: handClose
|
|
611
623
|
}), privateType === 'exist' && React__default.createElement(ExistRender, {
|
|
612
624
|
type: privateType,
|
package/dist/esm/Barrage.js
CHANGED
package/dist/esm/Button.js
CHANGED
|
@@ -7,7 +7,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
7
7
|
|
|
8
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; }
|
|
9
9
|
|
|
10
|
-
import React__default, { useState, useEffect } from 'react';
|
|
10
|
+
import React__default, { useCallback, useState, useEffect } from 'react';
|
|
11
11
|
import Icon from './Icon.js';
|
|
12
12
|
var defaultProps = {
|
|
13
13
|
className: '',
|
|
@@ -42,33 +42,7 @@ var Button = function Button(props) {
|
|
|
42
42
|
style = _defaultProps$props.style,
|
|
43
43
|
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
44
44
|
|
|
45
|
-
var
|
|
46
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
-
btnName = _useState2[0],
|
|
48
|
-
setBtnName = _useState2[1];
|
|
49
|
-
|
|
50
|
-
var _useState3 = useState({}),
|
|
51
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
52
|
-
btnStyle = _useState4[0],
|
|
53
|
-
setBtnStyle = _useState4[1];
|
|
54
|
-
|
|
55
|
-
useEffect(function () {
|
|
56
|
-
setBtnName(classes());
|
|
57
|
-
setBtnStyle(getStyle());
|
|
58
|
-
}, [className, color, shape, plain, loading, disabled, style, type, size, block, icon, children, onClick]);
|
|
59
|
-
|
|
60
|
-
var classes = function classes() {
|
|
61
|
-
var prefixCls = 'nut-button';
|
|
62
|
-
return "".concat(prefixCls, " ").concat(type ? "".concat(prefixCls, "--").concat(type) : '', "\n ").concat(size ? "".concat(prefixCls, "--").concat(size) : '', "\n ").concat(shape ? "".concat(prefixCls, "--").concat(shape) : '', "\n ").concat(plain ? "".concat(prefixCls, "--plain") : '', "\n ").concat(block ? "".concat(prefixCls, "--block") : '', "\n ").concat(disabled ? "".concat(prefixCls, "--disabled") : '', "\n ").concat(loading ? "".concat(prefixCls, "--loading") : '');
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
var handleClick = function handleClick(e) {
|
|
66
|
-
if (!loading && !disabled && onClick) {
|
|
67
|
-
onClick(e);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
var getStyle = function getStyle() {
|
|
45
|
+
var getStyle = useCallback(function () {
|
|
72
46
|
var style = {};
|
|
73
47
|
|
|
74
48
|
if (color) {
|
|
@@ -86,6 +60,31 @@ var Button = function Button(props) {
|
|
|
86
60
|
}
|
|
87
61
|
|
|
88
62
|
return style;
|
|
63
|
+
}, [color, plain]);
|
|
64
|
+
var classes = useCallback(function () {
|
|
65
|
+
var prefixCls = 'nut-button';
|
|
66
|
+
return [prefixCls, "".concat(type ? "".concat(prefixCls, "--").concat(type) : ''), "".concat(size ? "".concat(prefixCls, "--").concat(size) : ''), "".concat(shape ? "".concat(prefixCls, "--").concat(shape) : ''), "".concat(plain ? "".concat(prefixCls, "--plain") : ''), "".concat(block ? "".concat(prefixCls, "--block") : ''), "".concat(disabled ? "".concat(prefixCls, "--disabled") : ''), "".concat(loading ? "".concat(prefixCls, "--loading") : '')].filter(Boolean).join(' ');
|
|
67
|
+
}, [block, disabled, loading, plain, shape, size, type]);
|
|
68
|
+
|
|
69
|
+
var _useState = useState(classes()),
|
|
70
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
71
|
+
btnName = _useState2[0],
|
|
72
|
+
setBtnName = _useState2[1];
|
|
73
|
+
|
|
74
|
+
var _useState3 = useState(getStyle()),
|
|
75
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
76
|
+
btnStyle = _useState4[0],
|
|
77
|
+
setBtnStyle = _useState4[1];
|
|
78
|
+
|
|
79
|
+
useEffect(function () {
|
|
80
|
+
setBtnName(classes());
|
|
81
|
+
setBtnStyle(getStyle());
|
|
82
|
+
}, [className, color, shape, plain, loading, disabled, style, type, size, block, icon, children, onClick, classes, getStyle]);
|
|
83
|
+
|
|
84
|
+
var handleClick = function handleClick(e) {
|
|
85
|
+
if (!loading && !disabled && onClick) {
|
|
86
|
+
onClick(e);
|
|
87
|
+
}
|
|
89
88
|
};
|
|
90
89
|
|
|
91
90
|
return React__default.createElement("div", _objectSpread(_objectSpread({
|
package/dist/esm/Dialog.js
CHANGED
|
@@ -235,8 +235,8 @@ function confirm(config, renderFunc) {
|
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
var defaultProps = {
|
|
238
|
-
okText: '
|
|
239
|
-
cancelText: '
|
|
238
|
+
okText: '',
|
|
239
|
+
cancelText: '',
|
|
240
240
|
mask: true,
|
|
241
241
|
closeOnClickOverlay: true,
|
|
242
242
|
noFooter: false,
|
|
@@ -297,7 +297,7 @@ var BaseDialog = function BaseDialog(props, ref) {
|
|
|
297
297
|
onClick: function onClick() {
|
|
298
298
|
return handleCancel();
|
|
299
299
|
}
|
|
300
|
-
}, locale.cancel
|
|
300
|
+
}, cancelText || locale.cancel), !noOkBtn && React__default.createElement(Button, {
|
|
301
301
|
size: "small",
|
|
302
302
|
type: "primary",
|
|
303
303
|
className: classNames('nut-dialog__footer-ok', {
|
|
@@ -307,7 +307,7 @@ var BaseDialog = function BaseDialog(props, ref) {
|
|
|
307
307
|
onClick: function onClick() {
|
|
308
308
|
return handleOk();
|
|
309
309
|
}
|
|
310
|
-
}, locale.confirm
|
|
310
|
+
}, okText || locale.confirm));
|
|
311
311
|
return footerContent;
|
|
312
312
|
};
|
|
313
313
|
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["image", "imageSize", "description", "children", "className"];
|
|
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; }
|
|
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; }
|
|
9
|
+
|
|
10
|
+
import React__default, { useState, useEffect } from 'react';
|
|
11
|
+
import { c as cn } from './bem-893ad28d.js';
|
|
12
|
+
import '@bem-react/classname';
|
|
13
|
+
/**
|
|
14
|
+
* 内置图片地址
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
var defaultStatus = {
|
|
18
|
+
empty: 'https://static-ftcms.jd.com/p/files/61a9e3183985005b3958672b.png',
|
|
19
|
+
error: 'https://ftcms.jd.com/p/files/61a9e33ee7dcdbcc0ce62736.png',
|
|
20
|
+
network: 'https://static-ftcms.jd.com/p/files/61a9e31de7dcdbcc0ce62734.png'
|
|
21
|
+
};
|
|
22
|
+
var defaultProps = {
|
|
23
|
+
description: '无内容',
|
|
24
|
+
image: 'empty',
|
|
25
|
+
imageSize: '',
|
|
26
|
+
className: ''
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var Empty = function Empty(props) {
|
|
30
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
31
|
+
image = _defaultProps$props.image,
|
|
32
|
+
imageSize = _defaultProps$props.imageSize,
|
|
33
|
+
description = _defaultProps$props.description,
|
|
34
|
+
children = _defaultProps$props.children,
|
|
35
|
+
className = _defaultProps$props.className,
|
|
36
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
37
|
+
|
|
38
|
+
var _useState = useState({}),
|
|
39
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
40
|
+
imgStyle = _useState2[0],
|
|
41
|
+
setImgStyle = _useState2[1];
|
|
42
|
+
|
|
43
|
+
var b = cn('empty');
|
|
44
|
+
var imageNode = image;
|
|
45
|
+
|
|
46
|
+
if (typeof image === 'string') {
|
|
47
|
+
var isHttpUrl = image.startsWith('https://') || image.startsWith('http://') || image.startsWith('//');
|
|
48
|
+
var imageUrl = isHttpUrl ? image : defaultStatus[image];
|
|
49
|
+
imageNode = React__default.createElement("img", {
|
|
50
|
+
className: "img",
|
|
51
|
+
src: imageUrl,
|
|
52
|
+
alt: "empty"
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
useEffect(function () {
|
|
57
|
+
setImgStyle(function () {
|
|
58
|
+
if (!imageSize) {
|
|
59
|
+
return {};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (typeof imageSize === 'number') {
|
|
63
|
+
return {
|
|
64
|
+
width: "".concat(imageSize, "px"),
|
|
65
|
+
height: "".concat(imageSize, "px")
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
width: imageSize,
|
|
71
|
+
height: imageSize
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
}, [imageSize]);
|
|
75
|
+
return React__default.createElement("div", _objectSpread({
|
|
76
|
+
className: "".concat(b(), " ").concat(className)
|
|
77
|
+
}, rest), React__default.createElement("div", {
|
|
78
|
+
className: b('image'),
|
|
79
|
+
style: imgStyle
|
|
80
|
+
}, imageNode), typeof description === 'string' ? React__default.createElement("div", {
|
|
81
|
+
className: b('description')
|
|
82
|
+
}, description) : {
|
|
83
|
+
description: description
|
|
84
|
+
}, children);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
Empty.defaultProps = defaultProps;
|
|
88
|
+
Empty.displayName = 'NutEmpty';
|
|
89
|
+
export { Empty as default };
|
package/dist/esm/FixedNav.js
CHANGED
|
@@ -85,9 +85,10 @@ var FixedNav = function FixedNav(props) {
|
|
|
85
85
|
},
|
|
86
86
|
key: item.id || index
|
|
87
87
|
}, React__default.createElement("img", {
|
|
88
|
-
src: item.icon
|
|
88
|
+
src: item.icon,
|
|
89
|
+
alt: ""
|
|
89
90
|
}), React__default.createElement("div", {
|
|
90
|
-
className: "
|
|
91
|
+
className: "nut-fixednav__list-text"
|
|
91
92
|
}, item.text), item.num && React__default.createElement("div", {
|
|
92
93
|
className: "b"
|
|
93
94
|
}, item.num));
|
package/dist/esm/Input.js
CHANGED
|
@@ -48,7 +48,7 @@ function formatNumber(value) {
|
|
|
48
48
|
var defaultProps = {
|
|
49
49
|
type: 'text',
|
|
50
50
|
defaultValue: '',
|
|
51
|
-
placeholder: '
|
|
51
|
+
placeholder: '',
|
|
52
52
|
label: '',
|
|
53
53
|
requireShow: false,
|
|
54
54
|
disabled: false,
|
|
@@ -80,6 +80,7 @@ var Input = function Input(props) {
|
|
|
80
80
|
focus = _defaultProps$props.focus,
|
|
81
81
|
clear = _defaultProps$props.clear;
|
|
82
82
|
|
|
83
|
+
locale.placeholder = placeholder || locale.placeholder;
|
|
83
84
|
var inputBem = cn('input');
|
|
84
85
|
|
|
85
86
|
var _useState = useState(''),
|
|
@@ -159,7 +160,7 @@ var Input = function Input(props) {
|
|
|
159
160
|
}, label) : null), React__default.createElement("input", {
|
|
160
161
|
className: "input-text",
|
|
161
162
|
type: type,
|
|
162
|
-
placeholder:
|
|
163
|
+
placeholder: placeholder,
|
|
163
164
|
disabled: disabled,
|
|
164
165
|
readOnly: readonly,
|
|
165
166
|
value: inputValue,
|
package/dist/esm/Swiper.js
CHANGED
|
@@ -8,7 +8,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
8
8
|
|
|
9
9
|
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; }
|
|
10
10
|
|
|
11
|
-
import React__default, { useRef, useState, useEffect } from 'react';
|
|
11
|
+
import React__default, { useRef, useState, useMemo, useEffect } from 'react';
|
|
12
12
|
import classNames from 'classnames';
|
|
13
13
|
import { D as DataContext } from './UserContext-b4181162.js';
|
|
14
14
|
import { c as cn } from './bem-893ad28d.js';
|
|
@@ -60,7 +60,6 @@ var Swiper = React__default.forwardRef(function (props, ref) {
|
|
|
60
60
|
size: 0
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
var childsRefs = [];
|
|
64
63
|
var isVertical = direction === 'vertical';
|
|
65
64
|
|
|
66
65
|
var _useState = useState(null),
|
|
@@ -88,14 +87,19 @@ var Swiper = React__default.forwardRef(function (props, ref) {
|
|
|
88
87
|
offset = _useState10[0],
|
|
89
88
|
setOffset = _useState10[1];
|
|
90
89
|
|
|
91
|
-
var _useState11 = useState(
|
|
90
|
+
var _useState11 = useState([]),
|
|
92
91
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
childOffset = _useState12[0],
|
|
93
|
+
setChildOffset = _useState12[1];
|
|
94
|
+
|
|
95
|
+
var _useState13 = useState(false),
|
|
96
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
97
|
+
ready = _useState14[0],
|
|
98
|
+
setReady = _useState14[1];
|
|
95
99
|
|
|
96
100
|
var size = isVertical ? height : width;
|
|
97
101
|
|
|
98
|
-
var
|
|
102
|
+
var _useState15 = useState({
|
|
99
103
|
startX: 0,
|
|
100
104
|
startY: 0,
|
|
101
105
|
deltaX: 0,
|
|
@@ -106,37 +110,26 @@ var Swiper = React__default.forwardRef(function (props, ref) {
|
|
|
106
110
|
delta: 0,
|
|
107
111
|
touchTime: 0
|
|
108
112
|
}),
|
|
109
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
|
110
|
-
touch = _useState14[0],
|
|
111
|
-
setTouch = _useState14[1];
|
|
112
|
-
|
|
113
|
-
var _useState15 = useState([]),
|
|
114
113
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
var trackSize = childCount * Number(size);
|
|
126
|
-
|
|
127
|
-
var getChildren = function getChildren() {
|
|
128
|
-
var childs = [];
|
|
129
|
-
React__default.Children.toArray(children).forEach(function (child, index) {
|
|
130
|
-
if (child.type && child.type.displayName === 'NutSwiperItem') {
|
|
131
|
-
childs.push(React__default.cloneElement(child, {
|
|
132
|
-
ref: childsRefs[index],
|
|
133
|
-
key: "item_".concat(index)
|
|
134
|
-
}));
|
|
135
|
-
}
|
|
114
|
+
touch = _useState16[0],
|
|
115
|
+
setTouch = _useState16[1];
|
|
116
|
+
|
|
117
|
+
var _useMemo = useMemo(function () {
|
|
118
|
+
var childCount = 0;
|
|
119
|
+
var childs = React__default.Children.map(props.children, function (child) {
|
|
120
|
+
if (!React__default.isValidElement(child)) return null;
|
|
121
|
+
childCount++;
|
|
122
|
+
return child;
|
|
136
123
|
});
|
|
137
|
-
return
|
|
138
|
-
|
|
124
|
+
return {
|
|
125
|
+
childs: childs,
|
|
126
|
+
childCount: childCount
|
|
127
|
+
};
|
|
128
|
+
}, [props.children]),
|
|
129
|
+
childs = _useMemo.childs,
|
|
130
|
+
childCount = _useMemo.childCount;
|
|
139
131
|
|
|
132
|
+
var trackSize = childCount * Number(size); // 父组件参数传入子组件item
|
|
140
133
|
|
|
141
134
|
var parent = {
|
|
142
135
|
propSwiper: propSwiper,
|
|
@@ -256,13 +249,15 @@ var Swiper = React__default.forwardRef(function (props, ref) {
|
|
|
256
249
|
if (props.loop) {
|
|
257
250
|
if (Array.isArray(children) && children[0] && targetOffset !== minOffset) {
|
|
258
251
|
var rightBound = targetOffset < minOffset;
|
|
259
|
-
|
|
252
|
+
childOffset[0] = rightBound ? trackSize : 0;
|
|
260
253
|
}
|
|
261
254
|
|
|
262
255
|
if (Array.isArray(children) && children[childCount - 1] && targetOffset !== 0) {
|
|
263
256
|
var leftBound = targetOffset > 0;
|
|
264
|
-
|
|
257
|
+
childOffset[childCount - 1] = leftBound ? -trackSize : 0;
|
|
265
258
|
}
|
|
259
|
+
|
|
260
|
+
setChildOffset(childOffset);
|
|
266
261
|
}
|
|
267
262
|
|
|
268
263
|
if (isEmit && active !== targetActive) {
|
|
@@ -471,7 +466,8 @@ var Swiper = React__default.forwardRef(function (props, ref) {
|
|
|
471
466
|
};
|
|
472
467
|
}, [ready]);
|
|
473
468
|
useEffect(function () {
|
|
474
|
-
|
|
469
|
+
stopAutoPlay();
|
|
470
|
+
autoplay();
|
|
475
471
|
}, [children]);
|
|
476
472
|
useEffect(function () {
|
|
477
473
|
init();
|
|
@@ -487,6 +483,27 @@ var Swiper = React__default.forwardRef(function (props, ref) {
|
|
|
487
483
|
target.removeEventListener('touchend', onTouchEnd, false);
|
|
488
484
|
};
|
|
489
485
|
});
|
|
486
|
+
|
|
487
|
+
var style = function style(index) {
|
|
488
|
+
var style = {};
|
|
489
|
+
|
|
490
|
+
var _direction = propSwiper.direction || direction;
|
|
491
|
+
|
|
492
|
+
var _size = size;
|
|
493
|
+
|
|
494
|
+
if (_size) {
|
|
495
|
+
style[_direction === 'horizontal' ? 'width' : 'height'] = "".concat(_size, "px");
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
var offset = childOffset[index];
|
|
499
|
+
|
|
500
|
+
if (offset) {
|
|
501
|
+
style.transform = "translate3D".concat(_direction === 'horizontal' ? "(".concat(offset, "px,0,0)") : "(0,".concat(offset, "px,0)"));
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
return style;
|
|
505
|
+
};
|
|
506
|
+
|
|
490
507
|
React__default.useImperativeHandle(ref, function () {
|
|
491
508
|
return {
|
|
492
509
|
to: to,
|
|
@@ -502,9 +519,15 @@ var Swiper = React__default.forwardRef(function (props, ref) {
|
|
|
502
519
|
}, rest), React__default.createElement("div", {
|
|
503
520
|
className: contentClass,
|
|
504
521
|
ref: innerRef
|
|
505
|
-
}, childs
|
|
522
|
+
}, React__default.Children.map(childs, function (child, index) {
|
|
523
|
+
return React__default.createElement("div", {
|
|
524
|
+
className: b('item-wrapper'),
|
|
525
|
+
style: style(index),
|
|
526
|
+
key: index
|
|
527
|
+
}, child);
|
|
528
|
+
})), propSwiper.paginationVisible && !('pageContent' in propSwiper) ? React__default.createElement("div", {
|
|
506
529
|
className: classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(b('pagination')), true), _defineProperty(_classNames2, "".concat(b('pagination-vertical')), isVertical), _classNames2))
|
|
507
|
-
},
|
|
530
|
+
}, React__default.Children.map(childs, function (item, index) {
|
|
508
531
|
return React__default.createElement("i", {
|
|
509
532
|
style: {
|
|
510
533
|
backgroundColor: (active + childCount) % childCount === index ? propSwiper.paginationColor : '#ddd'
|
package/dist/esm/SwiperItem.js
CHANGED
|
@@ -47,10 +47,6 @@ var SwiperItem = React__default.forwardRef(function (props, ref) {
|
|
|
47
47
|
style[_direction === 'horizontal' ? 'width' : 'height'] = "".concat(_size, "px");
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
if (offset) {
|
|
51
|
-
style.transform = "translate3D".concat(_direction === 'horizontal' ? "(".concat(offset, "px,0,0)") : "(0,".concat(offset, "px,0)"));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
50
|
return style;
|
|
55
51
|
};
|
|
56
52
|
|
package/dist/esm/Uploader.js
CHANGED
|
@@ -14,6 +14,7 @@ import React__default, { useState, useEffect, useImperativeHandle } from 'react'
|
|
|
14
14
|
import classNames from 'classnames';
|
|
15
15
|
import Icon from './Icon.js';
|
|
16
16
|
import { c as cn } from './bem-893ad28d.js';
|
|
17
|
+
import { useConfig } from './ConfigProvider.js';
|
|
17
18
|
import '@bem-react/classname';
|
|
18
19
|
|
|
19
20
|
var UploadOptions = /*#__PURE__*/_createClass(function UploadOptions() {
|
|
@@ -154,6 +155,9 @@ var FileItem = /*#__PURE__*/_createClass(function FileItem() {
|
|
|
154
155
|
});
|
|
155
156
|
|
|
156
157
|
var InternalUploader = function InternalUploader(props, ref) {
|
|
158
|
+
var _useConfig = useConfig(),
|
|
159
|
+
locale = _useConfig.locale;
|
|
160
|
+
|
|
157
161
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
158
162
|
children = _defaultProps$props.children,
|
|
159
163
|
uploadIcon = _defaultProps$props.uploadIcon,
|
|
@@ -204,6 +208,8 @@ var InternalUploader = function InternalUploader(props, ref) {
|
|
|
204
208
|
setUploadQueue = _useState4[1];
|
|
205
209
|
|
|
206
210
|
useEffect(function () {
|
|
211
|
+
console.log('defaultFileList', defaultFileList);
|
|
212
|
+
|
|
207
213
|
if (defaultFileList) {
|
|
208
214
|
setFileList(defaultFileList);
|
|
209
215
|
}
|
|
@@ -262,7 +268,7 @@ var InternalUploader = function InternalUploader(props, ref) {
|
|
|
262
268
|
fileList.map(function (item) {
|
|
263
269
|
if (item.uid === fileItem.uid) {
|
|
264
270
|
item.status = 'ready';
|
|
265
|
-
item.message =
|
|
271
|
+
item.message = locale.uploader.readyUpload;
|
|
266
272
|
}
|
|
267
273
|
});
|
|
268
274
|
return _toConsumableArray(fileList);
|
|
@@ -275,7 +281,7 @@ var InternalUploader = function InternalUploader(props, ref) {
|
|
|
275
281
|
fileList.map(function (item) {
|
|
276
282
|
if (item.uid === fileItem.uid) {
|
|
277
283
|
item.status = 'uploading';
|
|
278
|
-
item.message =
|
|
284
|
+
item.message = locale.uploader.uploading;
|
|
279
285
|
}
|
|
280
286
|
});
|
|
281
287
|
return _toConsumableArray(fileList);
|
|
@@ -292,7 +298,7 @@ var InternalUploader = function InternalUploader(props, ref) {
|
|
|
292
298
|
fileList.map(function (item) {
|
|
293
299
|
if (item.uid === fileItem.uid) {
|
|
294
300
|
item.status = 'success';
|
|
295
|
-
item.message =
|
|
301
|
+
item.message = locale.uploader.success;
|
|
296
302
|
}
|
|
297
303
|
});
|
|
298
304
|
return _toConsumableArray(fileList);
|
|
@@ -308,7 +314,7 @@ var InternalUploader = function InternalUploader(props, ref) {
|
|
|
308
314
|
fileList.map(function (item) {
|
|
309
315
|
if (item.uid === fileItem.uid) {
|
|
310
316
|
item.status = 'error';
|
|
311
|
-
item.message =
|
|
317
|
+
item.message = locale.uploader.error;
|
|
312
318
|
}
|
|
313
319
|
});
|
|
314
320
|
return _toConsumableArray(fileList);
|
|
@@ -341,7 +347,7 @@ var InternalUploader = function InternalUploader(props, ref) {
|
|
|
341
347
|
fileItem.type = file.type;
|
|
342
348
|
fileItem.formData = formData;
|
|
343
349
|
fileItem.uid = file.lastModified + fileItem.uid;
|
|
344
|
-
fileItem.message =
|
|
350
|
+
fileItem.message = locale.uploader.readyUpload;
|
|
345
351
|
executeUpload(fileItem, index);
|
|
346
352
|
|
|
347
353
|
if (isPreview && file.type.includes('image')) {
|
|
@@ -397,7 +403,7 @@ var InternalUploader = function InternalUploader(props, ref) {
|
|
|
397
403
|
removeImage && removeImage(file, fileList);
|
|
398
404
|
setFileList(_toConsumableArray(fileList));
|
|
399
405
|
} else {
|
|
400
|
-
console.log(
|
|
406
|
+
console.log(locale.uploader.deleteWord);
|
|
401
407
|
}
|
|
402
408
|
};
|
|
403
409
|
|
|
@@ -56,6 +56,7 @@ export { default as CountDown } from './CountDown.js';
|
|
|
56
56
|
export { default as Collapse } from './Collapse.js';
|
|
57
57
|
export { default as CollapseItem } from './CollapseItem.js';
|
|
58
58
|
export { default as AnimatingNumbers } from './AnimatingNumbers.js';
|
|
59
|
+
export { default as Empty } from './Empty.js';
|
|
59
60
|
export { default as ConfigProvider } from './ConfigProvider.js';
|
|
60
61
|
export { default as Address } from './Address.js';
|
|
61
62
|
export { default as Barrage } from './Barrage.js';
|
package/dist/locales/base.d.ts
CHANGED
package/dist/locales/base.js
CHANGED
package/dist/locales/en-US.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui-react v1.1.
|
|
2
|
+
* @nutui/nutui-react v1.1.5-beta.2 Tue Jun 28 2022 09:34:29 GMT+0800 (China Standard Time)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -48,9 +48,10 @@ const enUS = {
|
|
|
48
48
|
ready: "Ready",
|
|
49
49
|
readyUpload: "Ready to upload",
|
|
50
50
|
waitingUpload: "Waiting for upload",
|
|
51
|
-
uploading: "Uploading",
|
|
51
|
+
uploading: "Uploading...",
|
|
52
52
|
success: "Upload successful",
|
|
53
|
-
error: "Upload failed"
|
|
53
|
+
error: "Upload failed",
|
|
54
|
+
deleteWord: "The user blocked the deletion!"
|
|
54
55
|
},
|
|
55
56
|
countdown: {
|
|
56
57
|
day: " Day ",
|