@arcblock/ux 1.17.13 → 1.17.14

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.
@@ -15,7 +15,7 @@ var _reactLottiePlayer = _interopRequireDefault(require("react-lottie-player"));
15
15
 
16
16
  var _defaultAnimation = _interopRequireDefault(require("./default-animation.json"));
17
17
 
18
- const _excluded = ["animationData", "size", "message", "messageDuration", "tips", "tipsDuration", "maybeDuration", "speed", "increaseSpeed"];
18
+ const _excluded = ["animationData", "size", "message", "messageDuration", "messageLoop", "tips", "tipsDuration", "maybeDuration", "speed", "increaseSpeed"];
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
@@ -34,6 +34,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
34
34
  * @param {Number} size 动画的尺寸,单位px
35
35
  * @param {String|Array} message 动画下方的文字;数组情况下会在一定时间切换文案
36
36
  * @param {Number} messageDuration 动画下方的文字为数组时,每个文案的持续时间;默认5000ms
37
+ * @param {Number} messageLoop 动画下方的文字为数组时,文案是否循环播放
37
38
  * @param {Array} tips 底部的提示元素
38
39
  * @param {Number} tipsDuration 底部提示的切换时间,单位毫秒,默认3000ms
39
40
  * @param {Number} speed 动画默认的播放速度
@@ -47,6 +48,7 @@ function AnimationWaiter(_ref) {
47
48
  size,
48
49
  message,
49
50
  messageDuration,
51
+ messageLoop,
50
52
  tips,
51
53
  tipsDuration,
52
54
  maybeDuration,
@@ -59,8 +61,7 @@ function AnimationWaiter(_ref) {
59
61
  const [currentSpeed, setCurrentSpeed] = (0, _react.useState)(speed);
60
62
  const [desc, setDesc] = (0, _react.useState)(''); // 动画的开始时间
61
63
 
62
- const startTime = (0, _react.useRef)(new Date().getTime()); // 省略号
63
-
64
+ const startTime = (0, _react.useRef)(new Date().getTime());
64
65
  (0, _react.useEffect)(() => {
65
66
  if (!message) {
66
67
  return;
@@ -75,7 +76,11 @@ function AnimationWaiter(_ref) {
75
76
  msgId++;
76
77
 
77
78
  if (msgId >= message.length) {
78
- msgId = 0;
79
+ if (messageLoop) {
80
+ msgId = 0;
81
+ } else {
82
+ msgId = message.length - 1;
83
+ }
79
84
  }
80
85
 
81
86
  setDesc(message[msgId]);
@@ -150,6 +155,7 @@ AnimationWaiter.propTypes = {
150
155
  size: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
151
156
  message: _propTypes.default.any,
152
157
  messageDuration: _propTypes.default.number,
158
+ messageLoop: _propTypes.default.bool,
153
159
  tips: _propTypes.default.array,
154
160
  tipsDuration: _propTypes.default.number,
155
161
  speed: _propTypes.default.number,
@@ -161,6 +167,7 @@ AnimationWaiter.defaultProps = {
161
167
  size: '',
162
168
  message: '',
163
169
  messageDuration: 5000,
170
+ messageLoop: true,
164
171
  tips: [],
165
172
  tipsDuration: 5000,
166
173
  speed: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "1.17.13",
3
+ "version": "1.17.14",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -53,10 +53,10 @@
53
53
  "react": ">=16.12.0",
54
54
  "react-ga": "^2.7.0"
55
55
  },
56
- "gitHead": "da903274c188ed5dbb9e318b1495af6faa5ce668",
56
+ "gitHead": "92363cd2492f37119f4418e602e2061f16c75765",
57
57
  "dependencies": {
58
- "@arcblock/icons": "^1.17.13",
59
- "@arcblock/react-hooks": "^1.17.13",
58
+ "@arcblock/icons": "^1.17.14",
59
+ "@arcblock/react-hooks": "^1.17.14",
60
60
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
61
61
  "@fontsource/lato": "^4.5.3",
62
62
  "@material-ui/core": "^4.12.3",
@@ -11,6 +11,7 @@ import lottieJson from './default-animation.json';
11
11
  * @param {Number} size 动画的尺寸,单位px
12
12
  * @param {String|Array} message 动画下方的文字;数组情况下会在一定时间切换文案
13
13
  * @param {Number} messageDuration 动画下方的文字为数组时,每个文案的持续时间;默认5000ms
14
+ * @param {Number} messageLoop 动画下方的文字为数组时,文案是否循环播放
14
15
  * @param {Array} tips 底部的提示元素
15
16
  * @param {Number} tipsDuration 底部提示的切换时间,单位毫秒,默认3000ms
16
17
  * @param {Number} speed 动画默认的播放速度
@@ -23,6 +24,7 @@ export default function AnimationWaiter({
23
24
  size,
24
25
  message,
25
26
  messageDuration,
27
+ messageLoop,
26
28
  tips,
27
29
  tipsDuration,
28
30
  maybeDuration,
@@ -36,7 +38,6 @@ export default function AnimationWaiter({
36
38
  // 动画的开始时间
37
39
  const startTime = useRef(new Date().getTime());
38
40
 
39
- // 省略号
40
41
  useEffect(() => {
41
42
  if (!message) {
42
43
  return;
@@ -50,7 +51,11 @@ export default function AnimationWaiter({
50
51
  timer1 = setInterval(() => {
51
52
  msgId++;
52
53
  if (msgId >= message.length) {
53
- msgId = 0;
54
+ if (messageLoop) {
55
+ msgId = 0;
56
+ } else {
57
+ msgId = message.length - 1;
58
+ }
54
59
  }
55
60
  setDesc(message[msgId]);
56
61
  }, messageDuration);
@@ -145,6 +150,7 @@ AnimationWaiter.propTypes = {
145
150
  size: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
146
151
  message: PropTypes.any,
147
152
  messageDuration: PropTypes.number,
153
+ messageLoop: PropTypes.bool,
148
154
  tips: PropTypes.array,
149
155
  tipsDuration: PropTypes.number,
150
156
  speed: PropTypes.number,
@@ -157,6 +163,7 @@ AnimationWaiter.defaultProps = {
157
163
  size: '',
158
164
  message: '',
159
165
  messageDuration: 5000,
166
+ messageLoop: true,
160
167
  tips: [],
161
168
  tipsDuration: 5000,
162
169
  speed: 1,