@nutui/nutui-react 1.1.4 → 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.
@@ -55,7 +55,7 @@ var InternalBarrage = function InternalBarrage(props, ref) {
55
55
  return function () {
56
56
  clearInterval(timer.current);
57
57
  };
58
- }, []);
58
+ }, [barrageList]);
59
59
 
60
60
  var run = function run() {
61
61
  clearInterval(timer.current);
@@ -56,9 +56,10 @@ var zhCN = {
56
56
  ready: '准备完成',
57
57
  readyUpload: '准备上传',
58
58
  waitingUpload: '等待上传',
59
- uploading: '上传中',
59
+ uploading: '上传中...',
60
60
  success: '上传成功',
61
- error: '上传失败'
61
+ error: '上传失败',
62
+ deleteWord: '用户阻止了删除!'
62
63
  },
63
64
  countdown: {
64
65
  day: '天',
@@ -0,0 +1,2 @@
1
+
2
+ require('../../../packages/empty/empty.scss')
@@ -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
- var _useConfig = useConfig(),
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: locale.placeholder || placeholder,
161
+ placeholder: placeholder,
163
162
  disabled: disabled,
164
163
  readOnly: readonly,
165
164
  value: inputValue,
@@ -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';
@@ -48,6 +48,7 @@ export interface BaseLang {
48
48
  uploading: string;
49
49
  success: string;
50
50
  error: string;
51
+ deleteWord: string;
51
52
  };
52
53
  countdown: {
53
54
  day: string;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.1.4 Tue May 24 2022 15:09:46 GMT+0800 (China Standard Time)
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
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.1.4 Tue May 24 2022 15:09:46 GMT+0800 (China Standard Time)
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 ",
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.1.4 Tue May 24 2022 15:09:46 GMT+0800 (China Standard Time)
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",
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.1.4 Tue May 24 2022 15:09:46 GMT+0800 (China Standard Time)
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",