@nutui/nutui-react 1.1.4-beta.3 → 1.1.5-beta.0
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 +12 -0
- package/dist/esm/BackTop.js +16 -12
- package/dist/esm/Barrage.js +1 -1
- package/dist/esm/ConfigProvider.js +3 -2
- package/dist/esm/Empty/style/index.js +2 -0
- package/dist/esm/Empty.js +89 -0
- package/dist/esm/Input.js +2 -3
- 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 +244 -186
- package/dist/nutui.react.umd.js +12 -12
- package/dist/packages/empty/empty.scss +33 -0
- 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/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/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## v1.1.4
|
|
2
|
+
`2022-05-23`
|
|
3
|
+
|
|
4
|
+
* :zap: feat(upload): upload 组件上传失败时希望可以自定义是否显示图片(#114 ) @junjun666
|
|
5
|
+
* :zap: feat(tabbar): tabbar 组件支持路由跳转,文档更新(#123 ) @allan2coder
|
|
6
|
+
* :zap: feat(circleprogress): circleprogress 组件 strokeInnerWidth 属性重命名为 strokeWidth,移除 isAuto、progressOption 属性(#121 ) @junjun666
|
|
7
|
+
* :zap: feat(avatar): avatar 组件 src 属性重命名为 url,增加 avatargroup 子组件(#121 ) @junjun666
|
|
8
|
+
* :zap: feat(skeleton): skeleton 组件 width、height 属性的类型修改为 string(#121 ) @junjun666
|
|
9
|
+
* :bug: fix(dialog): 修复 swiper 组件在 Next.js 环境下提示 window not defined 问题 @oasis-cloud
|
|
10
|
+
* :bug: fix(backtop): 修复 backtop 组件在 Next.js 环境下提示 document not defined 的问题 @oasis-cloud
|
|
11
|
+
* :zap: feat: NutUI-React 官网增加 issue 入口,以及组件文档更新。
|
|
12
|
+
|
|
1
13
|
## v1.1.3
|
|
2
14
|
`2022-04-18`
|
|
3
15
|
|
package/dist/esm/BackTop.js
CHANGED
|
@@ -5,7 +5,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
5
5
|
|
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
7
|
|
|
8
|
-
import React__default, { useState, useEffect } from 'react';
|
|
8
|
+
import React__default, { useState, useRef, useEffect } from 'react';
|
|
9
9
|
import Icon from './Icon.js';
|
|
10
10
|
var defaultProps = {
|
|
11
11
|
bottom: 20,
|
|
@@ -42,7 +42,7 @@ var BackTop = function BackTop(props) {
|
|
|
42
42
|
SetScrollTop = _useState4[1];
|
|
43
43
|
|
|
44
44
|
var startTime = 0;
|
|
45
|
-
var scrollEl =
|
|
45
|
+
var scrollEl = useRef(null); // 初始化
|
|
46
46
|
|
|
47
47
|
useEffect(function () {
|
|
48
48
|
init();
|
|
@@ -53,7 +53,7 @@ var BackTop = function BackTop(props) {
|
|
|
53
53
|
|
|
54
54
|
var init = function init() {
|
|
55
55
|
if (elId && document.getElementById(elId)) {
|
|
56
|
-
scrollEl = document.getElementById(elId);
|
|
56
|
+
scrollEl.current = document.getElementById(elId);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
addEventListener();
|
|
@@ -63,11 +63,11 @@ var BackTop = function BackTop(props) {
|
|
|
63
63
|
var scrollListener = function scrollListener() {
|
|
64
64
|
var top = null;
|
|
65
65
|
|
|
66
|
-
if (scrollEl instanceof Window) {
|
|
67
|
-
top = scrollEl.pageYOffset;
|
|
66
|
+
if (scrollEl.current instanceof Window) {
|
|
67
|
+
top = scrollEl.current.pageYOffset;
|
|
68
68
|
SetScrollTop(top);
|
|
69
69
|
} else {
|
|
70
|
-
top = scrollEl.scrollTop;
|
|
70
|
+
top = scrollEl.current.scrollTop;
|
|
71
71
|
SetScrollTop(top);
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -78,10 +78,10 @@ var BackTop = function BackTop(props) {
|
|
|
78
78
|
var scroll = function scroll() {
|
|
79
79
|
var y = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
80
80
|
|
|
81
|
-
if (scrollEl instanceof Window) {
|
|
81
|
+
if (scrollEl.current instanceof Window) {
|
|
82
82
|
window.scrollTo(0, y);
|
|
83
83
|
} else {
|
|
84
|
-
scrollEl.scrollTop = y;
|
|
84
|
+
scrollEl.current.scrollTop = y;
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
87
|
|
|
@@ -111,14 +111,18 @@ var BackTop = function BackTop(props) {
|
|
|
111
111
|
|
|
112
112
|
|
|
113
113
|
function addEventListener() {
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
var _scrollEl$current, _scrollEl$current2;
|
|
115
|
+
|
|
116
|
+
(_scrollEl$current = scrollEl.current) === null || _scrollEl$current === void 0 ? void 0 : _scrollEl$current.addEventListener('scroll', scrollListener, false);
|
|
117
|
+
(_scrollEl$current2 = scrollEl.current) === null || _scrollEl$current2 === void 0 ? void 0 : _scrollEl$current2.addEventListener('resize', scrollListener, false);
|
|
116
118
|
} // 移除监听事件
|
|
117
119
|
|
|
118
120
|
|
|
119
121
|
function removeEventListener() {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
var _scrollEl$current3, _scrollEl$current4;
|
|
123
|
+
|
|
124
|
+
(_scrollEl$current3 = scrollEl.current) === null || _scrollEl$current3 === void 0 ? void 0 : _scrollEl$current3.removeEventListener('scroll', scrollListener, false);
|
|
125
|
+
(_scrollEl$current4 = scrollEl.current) === null || _scrollEl$current4 === void 0 ? void 0 : _scrollEl$current4.removeEventListener('resize', scrollListener, false);
|
|
122
126
|
} // 返回顶部点击事件
|
|
123
127
|
|
|
124
128
|
|
package/dist/esm/Barrage.js
CHANGED
|
@@ -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/Input.js
CHANGED
|
@@ -59,8 +59,7 @@ var defaultProps = {
|
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
var Input = function Input(props) {
|
|
62
|
-
|
|
63
|
-
locale = _useConfig.locale;
|
|
62
|
+
useConfig();
|
|
64
63
|
|
|
65
64
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
66
65
|
type = _defaultProps$props.type,
|
|
@@ -159,7 +158,7 @@ var Input = function Input(props) {
|
|
|
159
158
|
}, label) : null), React__default.createElement("input", {
|
|
160
159
|
className: "input-text",
|
|
161
160
|
type: type,
|
|
162
|
-
placeholder:
|
|
161
|
+
placeholder: placeholder,
|
|
163
162
|
disabled: disabled,
|
|
164
163
|
readOnly: readonly,
|
|
165
164
|
value: inputValue,
|
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.0 Thu Jun 16 2022 10:02:02 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 ",
|
package/dist/locales/zh-CN.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui-react v1.1.
|
|
2
|
+
* @nutui/nutui-react v1.1.5-beta.0 Thu Jun 16 2022 10:02:02 GMT+0800 (China Standard Time)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -50,9 +50,10 @@ const zhCN = {
|
|
|
50
50
|
ready: "\u51C6\u5907\u5B8C\u6210",
|
|
51
51
|
readyUpload: "\u51C6\u5907\u4E0A\u4F20",
|
|
52
52
|
waitingUpload: "\u7B49\u5F85\u4E0A\u4F20",
|
|
53
|
-
uploading: "\u4E0A\u4F20\u4E2D",
|
|
53
|
+
uploading: "\u4E0A\u4F20\u4E2D...",
|
|
54
54
|
success: "\u4E0A\u4F20\u6210\u529F",
|
|
55
|
-
error: "\u4E0A\u4F20\u5931\u8D25"
|
|
55
|
+
error: "\u4E0A\u4F20\u5931\u8D25",
|
|
56
|
+
deleteWord: "\u7528\u6237\u963B\u6B62\u4E86\u5220\u9664\uFF01"
|
|
56
57
|
},
|
|
57
58
|
countdown: {
|
|
58
59
|
day: "\u5929",
|
package/dist/locales/zh-TW.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui-react v1.1.
|
|
2
|
+
* @nutui/nutui-react v1.1.5-beta.0 Thu Jun 16 2022 10:02:02 GMT+0800 (China Standard Time)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -48,9 +48,10 @@ const zhTW = {
|
|
|
48
48
|
ready: "\u6E96\u5099\u5B8C\u6210",
|
|
49
49
|
readyUpload: "\u6E96\u5099\u4E0A\u50B3",
|
|
50
50
|
waitingUpload: "\u7B49\u5F85\u4E0A\u50B3",
|
|
51
|
-
uploading: "\u4E0A\u50B3\u4E2D",
|
|
51
|
+
uploading: "\u4E0A\u50B3\u4E2D...",
|
|
52
52
|
success: "\u4E0A\u50B3\u6210\u529F",
|
|
53
|
-
error: "\u4E0A\u50B3\u5931\u6557"
|
|
53
|
+
error: "\u4E0A\u50B3\u5931\u6557",
|
|
54
|
+
deleteWord: "\u4F7F\u7528\u8005\u963B\u6B62\u4E86\u522A\u9664\uFF01"
|
|
54
55
|
},
|
|
55
56
|
countdown: {
|
|
56
57
|
day: "\u5929",
|