@nutui/nutui-react 1.5.1 → 1.5.2-beta.1

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 CHANGED
@@ -1,3 +1,11 @@
1
+ # v1.5.2
2
+ `2023-04-26`
3
+
4
+ * 🔨 chore: release v1.5.1 @junjun666
5
+ * :bug: fix: countdown 修改销毁实例方法 (#944) @拧巴的猫
6
+ * :bug: fix: uploader组件onSuccess和onFailure方法添加file参数表示当前上传文件 (#932) @cuicuiworld
7
+
8
+
1
9
  # v1.5.1
2
10
  `2023-04-19`
3
11
 
@@ -1,7 +1,7 @@
1
1
  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
- var _excluded = ["paused", "startTime", "endTime", "millisecond", "format", "autoStart", "time", "className", "style", "onEnd", "onPaused", "onRestart", "onUpdate", "children"];
4
+ var _excluded = ["paused", "startTime", "endTime", "millisecond", "format", "autoStart", "time", "destroy", "className", "style", "onEnd", "onPaused", "onRestart", "onUpdate", "children"];
5
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; }
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
  import React__default, { useState, useRef, useImperativeHandle, useEffect } from 'react';
@@ -15,7 +15,8 @@ var defaultProps = {
15
15
  millisecond: false,
16
16
  format: 'HH:mm:ss',
17
17
  autoStart: true,
18
- time: 0
18
+ time: 0,
19
+ destroy: false
19
20
  };
20
21
  var InternalCountDown = function InternalCountDown(props, ref) {
21
22
  useConfig();
@@ -27,6 +28,7 @@ var InternalCountDown = function InternalCountDown(props, ref) {
27
28
  format = _defaultProps$props.format,
28
29
  autoStart = _defaultProps$props.autoStart,
29
30
  time = _defaultProps$props.time,
31
+ destroy = _defaultProps$props.destroy,
30
32
  className = _defaultProps$props.className,
31
33
  style = _defaultProps$props.style,
32
34
  onEnd = _defaultProps$props.onEnd,
@@ -225,7 +227,7 @@ var InternalCountDown = function InternalCountDown(props, ref) {
225
227
  return componentWillUnmount;
226
228
  }, []);
227
229
  var componentWillUnmount = function componentWillUnmount() {
228
- clearInterval(stateRef.current.timer);
230
+ destroy && cancelAnimationFrame(stateRef.current.timer);
229
231
  };
230
232
  var renderTime = function () {
231
233
  return formatRemainTime(stateRef.current.restTime);
package/dist/esm/Form.js CHANGED
@@ -19,16 +19,14 @@ import './Cell.js';
19
19
  /**
20
20
  * 用于存储表单的数据
21
21
  */
22
- var FormStore = /*#__PURE__*/_createClass(
23
- // 存放表单中所有的数据 eg. {password: "ddd",username: "123"}
24
- // 所有的组件实例
25
- // 成功和失败的回调
26
-
27
- function FormStore() {
22
+ var FormStore = /*#__PURE__*/_createClass(function FormStore() {
28
23
  var _this = this;
29
24
  _classCallCheck(this, FormStore);
30
25
  _defineProperty(this, "store", {});
26
+ // 存放表单中所有的数据 eg. {password: "ddd",username: "123"}
31
27
  _defineProperty(this, "fieldEntities", []);
28
+ // 所有的组件实例
29
+ // 成功和失败的回调
32
30
  _defineProperty(this, "callbacks", {});
33
31
  _defineProperty(this, "errList", []);
34
32
  /**
@@ -304,7 +304,8 @@ var InternalUploader = function InternalUploader(props, ref) {
304
304
  onSuccess && onSuccess({
305
305
  responseText: responseText,
306
306
  option: option,
307
- fileList: fileList
307
+ fileList: fileList,
308
+ file: fileItem
308
309
  });
309
310
  };
310
311
  uploadOption.onFailure = function (responseText, option) {
@@ -321,7 +322,8 @@ var InternalUploader = function InternalUploader(props, ref) {
321
322
  onFailure && onFailure({
322
323
  responseText: responseText,
323
324
  option: option,
324
- fileList: fileList
325
+ fileList: fileList,
326
+ file: fileItem
325
327
  });
326
328
  };
327
329
  var task = new Upload(uploadOption);
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.5.1 Wed Apr 19 2023 14:14:12 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.5.2-beta.1 Wed Apr 26 2023 16:28:23 GMT+0800 (中国标准时间)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.5.1 Wed Apr 19 2023 14:14:12 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.5.2-beta.1 Wed Apr 26 2023 16:28:23 GMT+0800 (中国标准时间)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.5.1 Wed Apr 19 2023 14:14:12 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.5.2-beta.1 Wed Apr 26 2023 16:28:23 GMT+0800 (中国标准时间)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.5.1 Wed Apr 19 2023 14:14:12 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.5.2-beta.1 Wed Apr 26 2023 16:28:23 GMT+0800 (中国标准时间)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.5.1 Wed Apr 19 2023 14:14:12 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.5.2-beta.1 Wed Apr 26 2023 16:28:23 GMT+0800 (中国标准时间)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.5.1 Wed Apr 19 2023 14:14:12 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.5.2-beta.1 Wed Apr 26 2023 16:28:23 GMT+0800 (中国标准时间)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
6
6
  };
7
7
  var _a;
8
8
  /*!
9
- * @nutui/nutui-react v1.5.1 Wed Apr 19 2023 14:13:28 GMT+0800 (China Standard Time)
9
+ * @nutui/nutui-react v1.5.2-beta.1 Wed Apr 26 2023 16:27:53 GMT+0800 (中国标准时间)
10
10
  * (c) 2023 @jdf2e.
11
11
  * Released under the MIT License.
12
12
  */
@@ -31,37 +31,37 @@ function requireClassname_production_min() {
31
31
  return classname_production_min;
32
32
  hasRequiredClassname_production_min = 1;
33
33
  function r(r2) {
34
- function e2(e3, i, a, o) {
35
- var f = i ? t + e3 + r2.e + i : t + e3, v = f;
34
+ function t2(t3, i, a, o) {
35
+ var f = i ? e + t3 + r2.e + i : e + t3, v = f;
36
36
  if (a) {
37
- var u = " " + v + r2.m;
38
- for (var s in a)
39
- if (a.hasOwnProperty(s)) {
40
- var p = a[s];
41
- true === p ? v += u + s : p && (v += u + s + n + p);
37
+ var s = " " + v + r2.m;
38
+ for (var u in a)
39
+ if (a.hasOwnProperty(u)) {
40
+ var p = a[u];
41
+ true === p ? v += s + u : p && (v += s + u + n + p);
42
42
  }
43
43
  }
44
44
  if (void 0 !== o)
45
- for (var c = 0, l = o.length; c < l; c++) {
46
- var y = o[c];
47
- if (y && "string" == typeof y.valueOf())
48
- for (var g = y.valueOf().split(" "), d = 0; d < g.length; d++) {
45
+ for (var y = 0, c = (o = Array.isArray(o) ? o : [o]).length; y < c; y++) {
46
+ var l = o[y];
47
+ if (l && "string" == typeof l.valueOf())
48
+ for (var g = l.valueOf().split(" "), d = 0; d < g.length; d++) {
49
49
  var h = g[d];
50
50
  h !== f && (v += " " + h);
51
51
  }
52
52
  }
53
53
  return v;
54
54
  }
55
- var t = r2.n || "", n = r2.v || r2.m;
56
- return function(r3, t2) {
55
+ var e = r2.n || "", n = r2.v || r2.m;
56
+ return function(r3, e2) {
57
57
  return function(n2, i, a) {
58
- return "string" == typeof n2 ? Array.isArray(i) ? e2(r3, n2, void 0, i) : e2(r3, n2, i, a) : e2(r3, t2, n2, i);
58
+ return "string" == typeof n2 ? "string" == typeof i || Array.isArray(i) ? t2(r3, n2, void 0, i) : t2(r3, n2, i, a) : t2(r3, e2, n2, i);
59
59
  };
60
60
  };
61
61
  }
62
62
  Object.defineProperty(classname_production_min, "__esModule", { value: true });
63
- var e = r({ e: "-", m: "_" });
64
- classname_production_min.cn = e, classname_production_min.withNaming = r;
63
+ var t = r({ e: "-", m: "_" });
64
+ classname_production_min.cn = t, classname_production_min.withNaming = r;
65
65
  return classname_production_min;
66
66
  }
67
67
  var classname_development = {};
@@ -91,6 +91,7 @@ function requireClassname_development() {
91
91
  }
92
92
  }
93
93
  if (mix !== void 0) {
94
+ mix = Array.isArray(mix) ? mix : [mix];
94
95
  for (var i = 0, len = mix.length; i < len; i++) {
95
96
  var value = mix[i];
96
97
  if (!value || typeof value.valueOf() !== "string")
@@ -109,7 +110,7 @@ function requireClassname_development() {
109
110
  return function cnGenerator(b2, e) {
110
111
  return function(elemOrMods, elemModsOrBlockMix, elemMix) {
111
112
  if (typeof elemOrMods === "string") {
112
- if (Array.isArray(elemModsOrBlockMix)) {
113
+ if (typeof elemModsOrBlockMix === "string" || Array.isArray(elemModsOrBlockMix)) {
113
114
  return stringify(b2, elemOrMods, void 0, elemModsOrBlockMix);
114
115
  }
115
116
  return stringify(b2, elemOrMods, elemModsOrBlockMix, elemMix);
@@ -16722,7 +16723,8 @@ const InternalUploader = (props, ref) => {
16722
16723
  onSuccess && onSuccess({
16723
16724
  responseText,
16724
16725
  option,
16725
- fileList
16726
+ fileList,
16727
+ file: fileItem
16726
16728
  });
16727
16729
  };
16728
16730
  uploadOption.onFailure = (responseText, option) => {
@@ -16739,7 +16741,8 @@ const InternalUploader = (props, ref) => {
16739
16741
  onFailure && onFailure({
16740
16742
  responseText,
16741
16743
  option,
16742
- fileList
16744
+ fileList,
16745
+ file: fileItem
16743
16746
  });
16744
16747
  };
16745
16748
  const task = new Upload(uploadOption);
@@ -19332,7 +19335,8 @@ const defaultProps$q = {
19332
19335
  millisecond: false,
19333
19336
  format: "HH:mm:ss",
19334
19337
  autoStart: true,
19335
- time: 0
19338
+ time: 0,
19339
+ destroy: false
19336
19340
  };
19337
19341
  const InternalCountDown = (props, ref) => {
19338
19342
  useConfig();
@@ -19344,6 +19348,7 @@ const InternalCountDown = (props, ref) => {
19344
19348
  format: format2,
19345
19349
  autoStart,
19346
19350
  time,
19351
+ destroy,
19347
19352
  className,
19348
19353
  style,
19349
19354
  onEnd,
@@ -19535,7 +19540,7 @@ const InternalCountDown = (props, ref) => {
19535
19540
  return componentWillUnmount;
19536
19541
  }, []);
19537
19542
  const componentWillUnmount = () => {
19538
- clearInterval(stateRef.current.timer);
19543
+ destroy && cancelAnimationFrame(stateRef.current.timer);
19539
19544
  };
19540
19545
  const renderTime = (() => {
19541
19546
  return formatRemainTime(stateRef.current.restTime);
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
9
9
  return value;
10
10
  };
11
11
  /*!
12
- * @nutui/nutui-react v1.5.1 Wed Apr 19 2023 14:13:28 GMT+0800 (China Standard Time)
12
+ * @nutui/nutui-react v1.5.2-beta.1 Wed Apr 26 2023 16:27:53 GMT+0800 (中国标准时间)
13
13
  * (c) 2023 @jdf2e.
14
14
  * Released under the MIT License.
15
15
  */
@@ -49,37 +49,37 @@ var __publicField = (obj, key, value) => {
49
49
  return classname_production_min;
50
50
  hasRequiredClassname_production_min = 1;
51
51
  function r(r2) {
52
- function e2(e3, i, a, o) {
53
- var f = i ? t + e3 + r2.e + i : t + e3, v = f;
52
+ function t2(t3, i, a, o) {
53
+ var f = i ? e + t3 + r2.e + i : e + t3, v = f;
54
54
  if (a) {
55
- var u = " " + v + r2.m;
56
- for (var s in a)
57
- if (a.hasOwnProperty(s)) {
58
- var p = a[s];
59
- true === p ? v += u + s : p && (v += u + s + n + p);
55
+ var s = " " + v + r2.m;
56
+ for (var u in a)
57
+ if (a.hasOwnProperty(u)) {
58
+ var p = a[u];
59
+ true === p ? v += s + u : p && (v += s + u + n + p);
60
60
  }
61
61
  }
62
62
  if (void 0 !== o)
63
- for (var c = 0, l = o.length; c < l; c++) {
64
- var y = o[c];
65
- if (y && "string" == typeof y.valueOf())
66
- for (var g = y.valueOf().split(" "), d = 0; d < g.length; d++) {
63
+ for (var y = 0, c = (o = Array.isArray(o) ? o : [o]).length; y < c; y++) {
64
+ var l = o[y];
65
+ if (l && "string" == typeof l.valueOf())
66
+ for (var g = l.valueOf().split(" "), d = 0; d < g.length; d++) {
67
67
  var h = g[d];
68
68
  h !== f && (v += " " + h);
69
69
  }
70
70
  }
71
71
  return v;
72
72
  }
73
- var t = r2.n || "", n = r2.v || r2.m;
74
- return function(r3, t2) {
73
+ var e = r2.n || "", n = r2.v || r2.m;
74
+ return function(r3, e2) {
75
75
  return function(n2, i, a) {
76
- return "string" == typeof n2 ? Array.isArray(i) ? e2(r3, n2, void 0, i) : e2(r3, n2, i, a) : e2(r3, t2, n2, i);
76
+ return "string" == typeof n2 ? "string" == typeof i || Array.isArray(i) ? t2(r3, n2, void 0, i) : t2(r3, n2, i, a) : t2(r3, e2, n2, i);
77
77
  };
78
78
  };
79
79
  }
80
80
  Object.defineProperty(classname_production_min, "__esModule", { value: true });
81
- var e = r({ e: "-", m: "_" });
82
- classname_production_min.cn = e, classname_production_min.withNaming = r;
81
+ var t = r({ e: "-", m: "_" });
82
+ classname_production_min.cn = t, classname_production_min.withNaming = r;
83
83
  return classname_production_min;
84
84
  }
85
85
  var classname_development = {};
@@ -109,6 +109,7 @@ var __publicField = (obj, key, value) => {
109
109
  }
110
110
  }
111
111
  if (mix !== void 0) {
112
+ mix = Array.isArray(mix) ? mix : [mix];
112
113
  for (var i = 0, len = mix.length; i < len; i++) {
113
114
  var value = mix[i];
114
115
  if (!value || typeof value.valueOf() !== "string")
@@ -127,7 +128,7 @@ var __publicField = (obj, key, value) => {
127
128
  return function cnGenerator(b2, e) {
128
129
  return function(elemOrMods, elemModsOrBlockMix, elemMix) {
129
130
  if (typeof elemOrMods === "string") {
130
- if (Array.isArray(elemModsOrBlockMix)) {
131
+ if (typeof elemModsOrBlockMix === "string" || Array.isArray(elemModsOrBlockMix)) {
131
132
  return stringify(b2, elemOrMods, void 0, elemModsOrBlockMix);
132
133
  }
133
134
  return stringify(b2, elemOrMods, elemModsOrBlockMix, elemMix);
@@ -16740,7 +16741,8 @@ Please add \`${key}Action\` when creating your handler.`);
16740
16741
  onSuccess && onSuccess({
16741
16742
  responseText,
16742
16743
  option,
16743
- fileList
16744
+ fileList,
16745
+ file: fileItem
16744
16746
  });
16745
16747
  };
16746
16748
  uploadOption.onFailure = (responseText, option) => {
@@ -16757,7 +16759,8 @@ Please add \`${key}Action\` when creating your handler.`);
16757
16759
  onFailure && onFailure({
16758
16760
  responseText,
16759
16761
  option,
16760
- fileList
16762
+ fileList,
16763
+ file: fileItem
16761
16764
  });
16762
16765
  };
16763
16766
  const task = new Upload(uploadOption);
@@ -19350,7 +19353,8 @@ Please add \`${key}Action\` when creating your handler.`);
19350
19353
  millisecond: false,
19351
19354
  format: "HH:mm:ss",
19352
19355
  autoStart: true,
19353
- time: 0
19356
+ time: 0,
19357
+ destroy: false
19354
19358
  };
19355
19359
  const InternalCountDown = (props, ref) => {
19356
19360
  useConfig();
@@ -19362,6 +19366,7 @@ Please add \`${key}Action\` when creating your handler.`);
19362
19366
  format: format2,
19363
19367
  autoStart,
19364
19368
  time,
19369
+ destroy,
19365
19370
  className,
19366
19371
  style,
19367
19372
  onEnd,
@@ -19553,7 +19558,7 @@ Please add \`${key}Action\` when creating your handler.`);
19553
19558
  return componentWillUnmount;
19554
19559
  }, []);
19555
19560
  const componentWillUnmount = () => {
19556
- clearInterval(stateRef.current.timer);
19561
+ destroy && cancelAnimationFrame(stateRef.current.timer);
19557
19562
  };
19558
19563
  const renderTime = (() => {
19559
19564
  return formatRemainTime(stateRef.current.restTime);